Skip to content

Conversation

@HagarMeir
Copy link
Contributor

@HagarMeir HagarMeir commented Oct 15, 2025

@HagarMeir HagarMeir force-pushed the common-block-metadata branch 2 times, most recently from 418aeb1 to ba3186a Compare October 15, 2025 09:14
@HagarMeir HagarMeir force-pushed the common-block-metadata branch 4 times, most recently from b6d94c1 to b292849 Compare October 26, 2025 06:52
@tock-ibm tock-ibm force-pushed the common-block-metadata branch from b292849 to 769e144 Compare October 27, 2025 14:21
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)
Copy link
Contributor

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.

Copy link
Contributor Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here - TX count

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next PR


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

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

Comment on lines +117 to +122
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)
Copy link
Contributor

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.

Copy link
Contributor Author

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>
@HagarMeir HagarMeir force-pushed the common-block-metadata branch from 769e144 to 2667ce3 Compare October 28, 2025 09:03
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
@tock-ibm tock-ibm merged commit 5f0b170 into hyperledger:main Oct 28, 2025
7 checks passed
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.

2 participants