This involves several changes to support hashing blocks to support Merkle proofs. Primarily, these involves updating how LFMBTree hashes are computed for the new P7 protocol version.
Changes
New hashing scheme for LFMBTrees, which includes the size of the tree at the root.
CapitalDistribution is hashed differently depending on BlockHashVersion, which determines the LFMBTree hashing scheme to use.
PoolRewards parametrised by BlockHashVersion. The next and current capital distribution hashes are dependent on the BlockHashVersion, as well as the hashing of the bakerPoolRewardDetails LFMBTree.
As the majority of Concordium.GlobalState.Basic.BlockState.PoolRewards was not used, the remaining useful definitions are lifted to Concordium.GlobalState.PoolRewards.
Introduce new AccountsHash, ModulesHash and InstancesHash types for the accounts, modules and instances tables, which are parametrised by the protocol version.
A lot of legacy code for the in-memory instances/instance table is removed. The tests on the instances table are revised to use the persistent version.
Accounts hashing revised to use the new LFMBTree hashing scheme in P7.
BlockRewardDetails is revised to parametrise by the BlockHashVersion.
TransactionOutcomes are moved from base into a new Concordium.Types.TransactionOutcomes.
PersistentTransactionOutcomes supports a new TransactionOutcomesVersion that uses the new LFMBTree hashing scheme. A TransactionOutcomesHashV that is parametrised by the TransactionOutcomesVersion is introduced for hashing the PersistentTransactionOutcomes. TransactionOutcomesHash is still used in places where the version parameter is inconvenient or unnecessary.
Module table hashing revised to use the new LFMBTree hashing scheme in P7.
Changes to the instances table:
Fix a bug in newContractInstanceIT when inserting in a table with vacancies.
Change the instances table to track the total number of leaves including vacancies, instead of just the non-vacant leaves. This is a non-breaking change since it has never yet been possible to delete an instance, and so these numbers have historically been the same. This change affects the behaviour of newContractInstance and deleteContractInstance.
Change the hashing scheme at P7 to incorporate the number of leaves in the root hash (as for the LFMBTree).
ConsensusV1 block types are now parametrised by the protocol version.
Partial implementation of MerkleProvable for BakedBlock, supporting deriving Merkle proofs about a range of block attributes.
Checklist
[X] My code follows the style of this project.
[X] The code compiles without warnings.
[X] I have performed a self-review of the changes.
[X] I have documented my code, in particular the intent of the
hard-to-understand areas.
Purpose
This involves several changes to support hashing blocks to support Merkle proofs. Primarily, these involves updating how
LFMBTree
hashes are computed for the new P7 protocol version.Changes
CapitalDistribution
is hashed differently depending onBlockHashVersion
, which determines the LFMBTree hashing scheme to use.PoolRewards
parametrised byBlockHashVersion
. The next and current capital distribution hashes are dependent on theBlockHashVersion
, as well as the hashing of thebakerPoolRewardDetails
LFMBTree.Concordium.GlobalState.Basic.BlockState.PoolRewards
was not used, the remaining useful definitions are lifted toConcordium.GlobalState.PoolRewards
.AccountsHash
,ModulesHash
andInstancesHash
types for the accounts, modules and instances tables, which are parametrised by the protocol version.BlockRewardDetails
is revised to parametrise by theBlockHashVersion
.TransactionOutcomes
are moved from base into a newConcordium.Types.TransactionOutcomes
.PersistentTransactionOutcomes
supports a newTransactionOutcomesVersion
that uses the new LFMBTree hashing scheme. ATransactionOutcomesHashV
that is parametrised by theTransactionOutcomesVersion
is introduced for hashing thePersistentTransactionOutcomes
.TransactionOutcomesHash
is still used in places where the version parameter is inconvenient or unnecessary.newContractInstanceIT
when inserting in a table with vacancies.newContractInstance
anddeleteContractInstance
.MerkleProvable
forBakedBlock
, supporting deriving Merkle proofs about a range of block attributes.Checklist