Derivation
Table of Contents
Overview
Deposit Context
Derivation is extended to create deposit contexts, which signifies the execution of a depositing transaction. A deposit context is scoped to a single block, commencing with the execution of the first deposited transaction and concluding immediately after the execution of the final deposited transaction within that block. As such, there is exactly one deposit context per block.
The order of deposit transactions occurs as follows:
- L1 attributes transaction, opening the deposit context.
- User deposits (if any).
- L1 attributes transaction, closing the deposit context.
- During upgrades, additional deposits, inserted by derivation, may follow after the above. See upgrade specification.
The L1 attributes operations wrap user deposits,
such that isDeposit = true
occurs during the first L1 attributes transaction
and isDeposit = false
occurs immediately after the last user deposit,
if any exists, or after the first L1 attributes transaction if there are no user deposits.
Opening the deposit context
A new L1Block
predeploy function is introduced to set the L1 attributes: setL1BlockValuesIsthmus()
.
The block-attributes contents are unchanged from the previous fork. See Ecotone L1 attributes specifications, and Holocene specifications.
In addition to the setting L1 block attributes, the setL1BlockValuesIsthmus
function
now sets isDeposit = true
on the L1Block
predeploy contract.
This instantiates a deposit context for the current block.
Closing the deposit context
A new L1Block
predeploy function is introduced to close the deposit context: depositsComplete()
.
This sets isDeposit = false
in the L1Block
predeploy contract.
This function is called by a new L1 block system transaction. This transaction MUST have the following values:
from
is0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001
, the address of the L1 Attributes depositor account.to
is0x4200000000000000000000000000000000000015
, the address of the L1 attributes predeployed contract.mint
is0
.value
is0
.gasLimit
is set36000
gas, to cover intrinsic costs, processing costs, and margin for change.isSystemTx
isfalse
.data
is set to0xe32d20bb
, the 4-byte selector ofdepositsComplete()
. This closes the existing deposit context.sourceHash
is computed with a new deposit source-hash domain, see below.
Deposits-complete Source-hash
The source hash is computed alike to that
of the "L1 attributes deposited" deposit that opens the deposit context.
The one difference is the source-hash domain: 3
(instead of 1
).
The source-hash is thus computed as:
keccak256(bytes32(uint256(3)), keccak256(l1BlockHash, bytes32(uint256(seqNumber))))
.
Where l1BlockHash
refers to the L1 block hash of which the info attributes are deposited.
And seqNumber = l2BlockNum - l2EpochStartBlockNum
,
where l2BlockNum
is the L2 block number of the inclusion of the deposit tx in L2,
and l2EpochStartBlockNum
is the L2 block number of the first L2 block in the epoch.
Security Considerations
Gas Considerations
There must be sufficient gas available in the block to destroy deposit context. There's no guarantee on the minimum gas available for the second L1 attributes transaction as the block may be filled by the other deposit transactions. As a consequence, a deposit context may spill into multiple blocks.
This will be fixed in the future.