-
Notifications
You must be signed in to change notification settings - Fork 233
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: slot duration flexibility (#8122)
This PR add support for using Aztec slot durations that are not just 1 ethereum slot. To do so it adds more logic to the sequencer such that they can figure out if they are really the sequencer or not. This is mainly in the `canProposeBlock` and `shouldProposeBlock` functions which respectively assert that the proposer can actually propose, and whether he should. The logic in those functions are partly what we had sprinkled over the code before, but also adding some additional checks to match what is in the rollup contract and Leonidas. Since there are now additional restrictions to block production related to WHEN the block is to land on L1, I have added a `commitTimeJump` function into the `l1-publisher`which will jump to the next slot after a block have been published. This functionality toggled with a `TIME_TRAVELER` boolean flag. Note that we will jump INTO the next slot, since simulations in `viem` and `anvil` are limited to run on block values in the bast, meaning that we cannot nicely just simulate as if it was included in the NEXT block which is what we ideally want. See issue #8110 for more information. Since it caused some issues that there was no actual genesis state (just 0), I have inserted a genesis state equal to what we compute as the `lastArchive` for the very first block, fixing #4148. To not mess too much with DEVNET, the extra logic related to the exact timing of when L2 blocks should make it onto L1 can be "toggled" with the `IS_DEV_NET` flag. Namely, if `IS_DEV_NET` is toggled, we can publish outside of the "current" slot, as long as the slots are in order. With the changes in this pr, we should be able to run DEVNET without `automine`, I have tried a minor test but that seemed to work fine when we have `AZTEC_SLOT_DURATION = 36` and internal mining :) Points of interest: - `sequencer.ts` - `canProposeBlock` - `shouldProposeBlock` - `l1-publisher.ts` - Adding `simulate` since viem `write` does not provide meaningful error messages, but `simulate` does. - The `commitTimeJump` won't happen if the `AZTEC_SLOT_DURATION = ETHEREUM_SLOT_DURATION` or `TIME_TRAVELER = false` - `sequencer.test.ts` - Some of the test naming a odd. For example the test `builds a block that contains zero real transactions once flushed` sounds to me like you expect to have an empty block, after the block flushed, e.g., once flushed make it sound like it already happened - `l1-publisher.test.ts` - `does not publish if last archive root is different to expected` is deleted, as that job falls on the sequencer. The sequencer should define whether or not it will send a tx, and publisher deals more with publishing tasks. - Adding a `simulate` that is also mocked to account for `simulate` in the publisher. - `e2e_p2p_network.test.ts` - There is a flag for using a local anvil chain that you are running in another terminal. This is useful for running internal mining etc. --- This PR will be run with `AZTEC_SLOT_DURATION = 12` and `IS_DEV_NET = true`. Note that when using values different from those, there are still some hiccups and kinks, but it should be addressed in a separate PR to not make this explode in size.
- Loading branch information
Showing
28 changed files
with
655 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.