-
Notifications
You must be signed in to change notification settings - Fork 55
fix(l2): ignore deposits after state reconstruction #2642
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
base: main
Are you sure you want to change the base?
Conversation
Lines of code reportTotal lines added: Detailed view
|
.join("../rollup_store") | ||
.join("./rollup_store") |
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.
Create an issue to make this an ethrex_l2 stack reconstruct
flag.
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.
Maybe we could rename store_path
to data_dir
and place both store
and rollup_store
under that directory?
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.
Works for me.
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.
Created #2656
crates/l2/sequencer/l1_watcher.rs
Outdated
// Get the pending deposits from the contract. | ||
let pending_deposits = self | ||
.eth_client | ||
.get_pending_deposit_logs(self.address) | ||
.await?; |
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.
Let's execute this only if the first if condition of deposit_already_processed
is false and avoid doing this otherwise.
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.
Done in c5512fe!
crates/l2/sequencer/l1_watcher.rs
Outdated
mint_value, | ||
to_address, | ||
deposit_id, | ||
recipient, | ||
from, | ||
gas_limit, | ||
calldata, | ||
deposit_hash, |
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.
what do you think of using a struct for this elements?
Something like DepositValues
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.
Created DepositData
here 75e327e
We should wait for the deposit in the 3 L2 tests
crates/l2/tests/tests.rs
Outdated
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 should do 3.
in the other tests.
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.
Addressed in 1201ab4!
Motivation
Currently, If we start our l2 node with a reconstructed state, the node will process all deposit logs from l1 and mint them again in l2. This is because, in a reconstructed store, we don't have the included transactions to determine whether a deposit was previously processed or not.
Description
l2MintTxHash
emitted in theCommonBridge
contract.integration_test
to wait for the deposit receipt on L2.l2MintTxHash
instead of recalculating it in the watcher.CommonBridge
contract, whether a deposit is pending or not before minting the transaction.DepositData
struct inl1_watcher
How to test
Here we are going to run the integration test on a node with a reconstructed state.
You may want to lower the
commit_time_ms
.ctrl + c
:Note
This is because we are going to use already created blobs with 6 batches and we need
to advance the L1 until that point.
path_to_store
:path_to_store
:You should observe that all deposits are skipped now.
Warning
Before running the integration test, wait for 20 blocks to be built in the L2.
This is because the test currently uses estimate_gas_tip that needs at least 20 blocks to estimate the gas price.
Closes #1279