-
Couldn't load subscription status.
- Fork 9
add metadata to common block #300
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
Conversation
418aeb1 to
ba3186a
Compare
b6d94c1 to
b292849
Compare
b292849 to
769e144
Compare
| return nil, fmt.Errorf("proposed common block header number %d in index %d isn't equal to computed number %d", hdr.AvailableCommonBlocks[i].Header.Number, i, lastBlockNumber) | ||
| } | ||
|
|
||
| blockMetadata, err := ledger.AssemblerBlockMetadataToBytes(ba[0], &state.OrderingInformation{DecisionNum: arma_types.DecisionNum(md.LatestSequence), BatchCount: len(attestations), BatchIndex: i}, 0) |
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.
Calculate the TX count, or tests will break when you switch to use this metadata instead of creating it in the assembler.
In addition, right now we are not signing the metadata when we sign the block, but in fabric they do. One more reason to have the orderer metadata computed correctly here.
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.
I can add this in the next PR
| lastBlockNumber++ | ||
| availableCommonBlocks[i] = protoutil.NewBlock(lastBlockNumber, prevHash) | ||
| availableCommonBlocks[i].Header.DataHash = ba[0].Digest() | ||
| blockMetadata, err := ledger.AssemblerBlockMetadataToBytes(ba[0], &state.OrderingInformation{DecisionNum: arma_types.DecisionNum(md.LatestSequence), BatchCount: len(attestations), BatchIndex: i}, 0) |
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.
same here - TX count
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.
next PR
node/consensus/consensus_builder.go
Outdated
|
|
||
| protoutil.InitBlockMetadata(availableCommonBlocks[0]) | ||
|
|
||
| blockMetadata, err := ledger.AssemblerBlockMetadataToBytes(state.NewAvailableBatch(0, arma_types.ShardIDConsensus, 0, genesisDigest), &state.OrderingInformation{DecisionNum: 0, BatchCount: 1, BatchIndex: 0}, 0) |
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.
TX count should be 1
| primary, shard, seq, _, _, _, _, err := ledger.AssemblerBlockMetadataFromBytes(acb.Metadata.Metadata[common.BlockMetadataIndex_ORDERER]) | ||
| if err != nil { | ||
| cr.logger.Panicf("Failed extracting info from metadata: %s", err) | ||
| } | ||
|
|
||
| acbBatch := state.NewAvailableBatch(primary, shard, seq, acb.Header.DataHash) |
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.
We could probably bundle this into a method "AssemblerBatchIDFromBlock" and put it in utils...
But I suspect we will have to streamline here anyway.
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.
Next PR
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
769e144 to
2667ce3
Compare
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
#193