trustbloc / sidetree-fabric

Implementation of Sidetree with a backing Hyperledger Fabric ledger
Apache License 2.0
26 stars 13 forks source link

fix: Validate transaction info during 'writeAnchor' #431

Closed bstasyszyn closed 4 years ago

bstasyszyn commented 4 years ago

This commit doesn't solve issue #428 as it is written since (in hindsight) this scenario cannot reliably be prevented. If a peer that's behind in protocol version submits an anchor to the blockchain then operations in the anchor can still be processed by peers (observers) at a higher protocol version since those peers should still support previous protocol versions. So, this commit simply adds validation logic on the endorsers to ensure that the protocol version in the request is valid. If the endorser is behind in protocol version (i.e. behind the version in the request) then the endorser will return an error (since it doesn't recognize the protocol version in the request) and the batch writer will retry the request on another peer or until the former peer has caught up.

closes #428

Signed-off-by: Bob Stasyszyn Bob.Stasyszyn@securekey.com

codecov[bot] commented 4 years ago

Codecov Report

Merging #431 into master will increase coverage by 0.07%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #431      +/-   ##
==========================================
+ Coverage   91.56%   91.64%   +0.07%     
==========================================
  Files          80       80              
  Lines        3048     3077      +29     
==========================================
+ Hits         2791     2820      +29     
  Misses        174      174              
  Partials       83       83              
Impacted Files Coverage Δ
cmd/chaincode/txn/txn.go 96.26% <100.00%> (+1.02%) :arrow_up:
pkg/peer/init.go 100.00% <100.00%> (ø)
pkg/peer/sidetreesvc/provider.go 86.00% <100.00%> (+1.90%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9f86340...bd030e5. Read the comment docs.