Etherlink/Kernel: add the chain id to deposits
What
This MR extends the format of Etherlink (FA-) deposits. When the bytes sent are longer than an EVM address, the extra bytes are interpreted as a chain id which is currently ignored.
Why
In the context of Tezlink, to make Etherlink multi-chain we will need a way within the kernel to dispatch deposits toward the correct chain. We have considered two solutions for this:
- the one implemented in this MR: extend the format of deposits,
- dispatch on the sender of the internal inbox message, but this would make the rollup harder to interact with from L1 smart contracts because we would need to whitelist them in the kernel to associate to each contract a target L2 chain.
How
When reading (FA-) deposits from the inbox, we now allow longer byte sequences and the extra bytes are read in little-endian as the chain id. To avoid modifying the binary format of deposits in the delayed inbox, the chain id is propagated alongside the deposits. In parsing.rs, the new definition of the Input enum is:
#[derive(Debug, PartialEq, Clone)]
pub enum Input<Mode> {
ModeSpecific(Mode),
Deposit((Deposit, Option<U256>)),
FaDeposit((FaDeposit, Option<U256>)),
Upgrade(KernelUpgrade),
SequencerUpgrade(SequencerUpgrade),
RemoveSequencer,
Info(LevelWithInfo),
ForceKernelUpgrade,
}
Manually testing the MR
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Raphaël Cauderlier