Open pscott opened 1 week ago
Unable to replicate the issue: https://github.com/pscott/flush_example/issues/1
I was not able to run your JS test, but I wrote something very similar in Rust, based on Devnet's existing messaging tests and it seems I am observing the same problem. Will continue debugging tomorrow.
Just for when you are back, I am confused by this comment in your StarknetCommit.ts
file:
// Checking that the L1 -> L2 message has been propagated. Should be `1` message but due to how `flush` will look at ALL
// the logs of the previous messages, it will return `2` messages.
// Due to the fact that the "authenticator" from the previous test has not been deployed on the current network, the "flush"
// will error with "0x..." is not deployed.
How can it at the same time fail with the mentioned error, and have a length of 2 instead of 1? I.e. if the flush
fails, doesn't it exit and prevent the array length assertion from happening?
The problem is that Devnet's L1-L2 messaging mechanism is not well integrated with the feature of restarting. Flushing works by fetching messages from L1 blocks in the range : from_block
- to_block
. But from_block
is kept as a property in Devnet's memory and to_block
is the latest chain block. So what happens is that on a restart request, from_block
is restarted together with the rest of the state, leading to the re-sending of the older messages.
I've explained the situation in the
README.md
of this example repo: https://github.com/pscott/flush_example .But basically,
flush
will load messages from L1 even if we have resetL2
in between. This leads to harder testing, as one must either re-deploy contracts, or load L1 from a dump file (currently not possible using Anvil, as it's not a dump on request but a dump on exit).