-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ledger strategy #435
Ledger strategy #435
Conversation
5bbe270
to
f9ad9e4
Compare
Signed-off-by: bur <[email protected]>
Signed-off-by: bur <[email protected]>
f9ad9e4
to
6fceafc
Compare
Signed-off-by: bur <[email protected]>
- secure channel | ||
- validate proposal | ||
- check org is "write" | ||
- replay protection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the view consistency/snapshot probably also belongs here?
In that context, would be interesting to know how fabric currently does it: do they serialize update and endorsement or do they maintain different ledger states/views concurrently? the former is of course the easiest to implement (though requires an explicit notification by ecc that a tx is finished) but also means that a slow tx can hold of others (not that this is probably immediately the biggest concern for us :-))
(this in turn might ask for adding eventually the endorsement equivalent of the "Fabric high-level validation" section above?)
- Phase2: Any enclave that runs a particular FPC chaincode | ||
|
||
Versioning: | ||
- single autonomously monotonously increasing version number?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
monotonically increasing version numbers for us will be a bit a challenge with it being MRENCLAVE ... ;-) [different story of course for ercc, though not sure whether for us the version really matters for ercc (compared to sequence numbers) as we look only at meta data changes and on that level version doesn't really have any effect? It is only relevant during the actual execution of the endorsement (which we delegate to normal peers for ercc)?
Signed-off-by: bur <[email protected]>
- Simplify chaincode versioning (TODO) | ||
- No chaincode updates for now | ||
- Support for default MSP only | ||
- Maintaining FPC chaincode state only is sufficient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what exactly you mean here ..
- Validate "normal" Enclave Registry (ERCC) transactions; however, ERCC comes with "hard-coded" endorsement policy | ||
|
||
|
||
Any transactions/blocks with unsupported features are ignored/aborted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
somewhere we definitely have to be more explicit where we abort and, in particular, where we (safely can) ignore. My feeling is that by default we should abort and ignore only for explicit cases where we know it's safe to ignore ..
### mid/long term | ||
- Introduce FPC transaction type (similar to introduce FPC namespace) and create | ||
a dedicated FPC tx processor; (removes the need of custom validation plugins and interference with existing Fabric validation logic; and also gives more freedom to FPC validation logic as no it not longer bound to the structure and format of endorsement transaction). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to above i guess is also to make tlcc maintain all state, not only meta-data (thereby also removing any issue of synchronicity between peer and tlcc (at least as long as we do not go to cc2cc between fpc and non-fpc chaincode ...)
## Implementation | ||
|
||
- nanopb to parse fabric protos (alternatively we could try to use real proto for c) | ||
- data state : leveldb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by data you mean actual ledger data and meta-data?
also, adding persistance to tlcc is more mid-term rather than short-term? Or do you see a low-hanging fruit where we get that for (almost) "free"? (If we restrict that state must fit into EPC and we write and read a snapshot in one go , we actually would not really have to do merkle tree and alike and a simple HMAC (based on some seal-key) protected snapshot should be enough?)
- TLCC must provide channel metadata (chaincode definition) | ||
|
||
- TLCC must maintain a "trusted" view of the ledger | ||
- TLCC must be syncronized with peer's ledger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these requirements really come from the fact that TLCC is implemented as a separate entity. In particular the implementation does not use the original peer's ledger Go code and, yet, it has to match its functionality.
A couple of lines at the very beginning could clarify this.
|
||
## Approach | ||
|
||
Restrict Fabric functionality: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the approach to modify Fabric in order to reduce the validation steps?
I think here you mean: design/implement a reduced validation procedure in TLCC -- compared to Fabric's legacy one.
Restrict Fabric functionality: | ||
|
||
- keep Fabric validation changes in sync with TLCC | ||
- Reduces validation logic to a minimum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely desirable, but my doubt is whether this is possible, given that ERCC and ECC are normal chaincodes, for which we run the normal validation procedure. However, this could open the possibility to implement specific validation plugins for both of them, avoiding the legacy validation. By doing this, we control the entire validation logic; we can implement a simple one and mirror the implementation in TLCC.
- keep code relation traceable and changes trackable | ||
- consistent naming and code structure as much as possible | ||
- bonus: | ||
- automated code-changes notification; notifies whenever relevant Fabric code changes and might FPC must be updates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice I would expect an FPC release, say 2.2, to support Fabric 2.2. Then, when Fabric 2.3 comes out, a new FPC should follow to support it.
- validate proposal | ||
- check org is "write" | ||
- replay protection | ||
- consistent view / snapshot during tx processing on integrity metadata / ledger state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I mentioned, implementing the snapshot approach might add a non-trivial complexity.
However, a consistent view might still be achieve by "playing" with the block height: either the chaincode or tlcc abort if they start a session with block height x
and terminate that with block height y
(meaning that there have been updates).
BTW: view consistency probably should also be addressed here? See also corresponding comments added to field |
Outdated and needs further work. |
What this PR does / why we need it:
This document defines the TLCC (trusted ledger) strategy.
Which issue(s) this PR fixes:
Fixes #402
Special notes for your reviewer:
Does this PR introduce a user-facing changes and/or breaks backward compatability?: