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
feat: Preserve message proofs post-regenesis #1891
feat: Preserve message proofs post-regenesis #1891
Conversation
This reverts commit 7245764.
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.
FuelBlockMerkleData
and FuelBlockMerkleMetadata
should be on-chain data because all newly produced blocks should be connected to old blocks. Otherwise, it is impossible to withdraw money.
We need to update the Genesis block as well, not to use zero prev_root
. It should be the root that contains all old blocks.
assert_eq!(nonces.len(), 1); | ||
|
||
for nonce in nonces { | ||
let proof = core |
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 need to use the proof
and validate it like in the can_get_message_proof
test.
Because the proof returned here is not usable. The user is still unable to withdraw his funds because new blocks are not connected to old blocks.
Reapply "Populate prev root from last block before regenesis" This reverts commit aaa061c.
tests/tests/regenesis.rs
Outdated
|
||
// Then | ||
assert_eq!(nonces.len(), 1); | ||
|
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.
for block_height in message_block_height+1..latest_block_after_regenesis {
}
Related tickets:
This PR adds block Merkle data and metadata to the list of migrated tables during regenesis. Creating a snapshot now inlcudes the
FuelBlockMerkleData
andFuelBlockMerkleMetadata
tables. Loading the snapshot writes theFuelBlockMerkleData
andFuelBlockMerkleMetadata
snapshot tables to theOldFuelBlockMerkleData
andOldFuelBlockMerkleMetadata
database tables respectively (2 new tables added to the off-chain database).When querying for a message proof, we check the block height of the query. If the requested message proof is for block height at or above the regenesis block height, we continue to use the on-chain database for data lookups. If it is instead lower than the regenesis block height, we then check the off-chain database for the
Old
tables.This PR also refactors the block proof logic to rely on a new trait called
DatabaseMerklizedBlocks
which provides an interface for querying block related Merkle data. Specifically, this includes retrieving Merkle block data and metadata, and loading the block Merkle tree. TheDatabaseMessageProof
is now implemented by default for any type that implements this trait, which include the on-chain and off-chain databases that define the corresponding tables.This PR is intended to not be a breaking change.
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]