Skip to content
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

Closed

Conversation

mbrandenburger
Copy link
Contributor

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?:

Signed-off-by: bur <bur@zurich.ibm.com>
Signed-off-by: bur <bur@zurich.ibm.com>
Signed-off-by: bur <bur@zurich.ibm.com>
- secure channel
- validate proposal
- check org is "write"
- replay protection
Copy link
Contributor

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??
Copy link
Contributor

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 <bur@zurich.ibm.com>
- Simplify chaincode versioning (TODO)
- No chaincode updates for now
- Support for default MSP only
- Maintaining FPC chaincode state only is sufficient
Copy link
Contributor

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
Copy link
Contributor

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).

Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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:
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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).

@g2flyer
Copy link
Contributor

g2flyer commented Aug 25, 2020

BTW: view consistency probably should also be addressed here? See also corresponding comments added to field tx_context in message TLCCRequest added as part of #434. Probably #361 is also somewhat relevant regarding the question whether view consistency is required just to guarantee progress or whether there are also integrity issues if we do not enforce view consistency and (more importantly) any confidentiality issues which could exploit integraty failures (e.g., integrity failures might be caught by peers when processing endorsements but it still could be that integrity issues during endorsement could lead to confidentiality breaches). Related to this it probably would also be useful to know how fabric deals with view consistency (e.g., do peers ensure that chaincode have consistent views and, if so, how)

@bvavala
Copy link
Contributor

bvavala commented Dec 28, 2020

Outdated and needs further work.
Will be reopened as the discussion restarts in the future.

@bvavala bvavala closed this Dec 28, 2020
@mbrandenburger mbrandenburger deleted the ledger_strategy branch January 27, 2021 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ledger Enclave Strategy
3 participants