Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion op-bindings/bindings/l1block.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion op-bindings/bindings/l1block_deployed.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions packages/contracts-bedrock/.gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CrossDomainHashing_Test:test_l2TransactionHash() (gas: 103799)
CrossDomainHashing_Test:test_l2TransactionHash() (gas: 78639)
DeployerWhitelist_Test:test_owner() (gas: 7647)
DeployerWhitelist_Test:test_storageSlots() (gas: 33483)
GasPriceOracle_Test:test_baseFee() (gas: 8395)
Expand All @@ -9,20 +9,20 @@ GasPriceOracle_Test:test_onlyOwnerSetOverhead() (gas: 10599)
GasPriceOracle_Test:test_onlyOwnerSetScalar() (gas: 10640)
GasPriceOracle_Test:test_owner() (gas: 9762)
GasPriceOracle_Test:test_setDecimals() (gas: 36798)
GasPriceOracle_Test:test_setGasPriceReverts() (gas: 11718)
GasPriceOracle_Test:test_setL1BaseFeeReverts() (gas: 11717)
GasPriceOracle_Test:test_setGasPriceReverts() (gas: 11659)
GasPriceOracle_Test:test_setL1BaseFeeReverts() (gas: 11658)
GasPriceOracle_Test:test_setOverhead() (gas: 36767)
GasPriceOracle_Test:test_setScalar() (gas: 36840)
GasPriceOracle_Test:test_storageLayout() (gas: 86683)
L1BlockTest:test_basefee() (gas: 7575)
L1BlockTest:test_hash() (gas: 7552)
L1BlockTest:test_number() (gas: 7651)
L1BlockTest:test_sequenceNumber() (gas: 7585)
L1BlockTest:test_sequenceNumber() (gas: 7596)
L1BlockTest:test_timestamp() (gas: 7683)
L1BlockTest:test_updateValues() (gas: 28215)
L1BlockNumberTest:test_fallback() (gas: 18773)
L1BlockTest:test_updateValues() (gas: 23144)
L1BlockNumberTest:test_fallback() (gas: 10755)
L1BlockNumberTest:test_getL1BlockNumber() (gas: 10589)
L1BlockNumberTest:test_receive() (gas: 25436)
L1BlockNumberTest:test_receive() (gas: 17418)
L1CrossDomainMessenger_Test:testCannot_L1MessengerPause() (gas: 10909)
L1CrossDomainMessenger_Test:test_L1MessengerMessageVersion() (gas: 8366)
L1CrossDomainMessenger_Test:test_L1MessengerPause() (gas: 31882)
Expand Down
26 changes: 16 additions & 10 deletions packages/contracts-bedrock/contracts/L2/L1Block.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ contract L1Block {
*/
uint64 public timestamp;

/**
* @notice The number of L2 blocks in the same epoch
*/
uint64 public sequenceNumber;

/**
* @notice The latest L1 basefee
*/
Expand All @@ -40,11 +45,6 @@ contract L1Block {
*/
bytes32 public hash;

/**
* @notice The number of L2 blocks in the same epoch
*/
uint64 public sequenceNumber;

/**
* @notice Sets the L1 values
* @param _number L1 blocknumber
Expand All @@ -64,10 +64,16 @@ contract L1Block {
revert OnlyDepositor();
}

number = _number;
timestamp = _timestamp;
basefee = _basefee;
hash = _hash;
sequenceNumber = _sequenceNumber;
bytes32 slot;
assembly {
// _number, _timestamp and _sequenceNumber are all uint64 and will
// be tightly packed together in the first storage slot
slot := or(slot, _number)
slot := or(slot, shl(64, _timestamp))
slot := or(slot, shl(128, _sequenceNumber))
sstore(0, slot)
sstore(basefee.slot, _basefee)
sstore(hash.slot, _hash)
}
}
}