Commit 2e89f634 authored by smartcontracts's avatar smartcontracts Committed by GitHub

fix(ctb): bug computing L2 timestamp (#2880)

* fix(ctb): bug computing L2 timestamp

Fixes a bug where the wrong constant was being used to compute L2
timestamps.

* bedrock: fix computeL2Timestamp block time

* bedrock: regenerate bindings

And add changeset.

* devnet: add missing config
Co-authored-by: default avatarMaurelian <maurelian@protonmail.ch>
Co-authored-by: default avatarMark Tyneway <mark.tyneway@gmail.com>
parent 71800503
---
'@eth-optimism/contracts-bedrock': patch
---
Fixes a bug that caused L2 timestamps to be computed incorrectly
This diff is collapsed.
...@@ -279,8 +279,7 @@ contract L2OutputOracle is OwnableUpgradeable { ...@@ -279,8 +279,7 @@ contract L2OutputOracle is OwnableUpgradeable {
"OutputOracle: Block number must be greater than or equal to the starting block number." "OutputOracle: Block number must be greater than or equal to the starting block number."
); );
return return STARTING_TIMESTAMP + ((_l2BlockNumber - STARTING_BLOCK_NUMBER) * L2_BLOCK_TIME);
STARTING_TIMESTAMP + ((_l2BlockNumber - STARTING_BLOCK_NUMBER) * SUBMISSION_INTERVAL);
} }
/** /**
......
...@@ -82,13 +82,13 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer { ...@@ -82,13 +82,13 @@ contract L2OutputOracleTest is L2OutputOracle_Initializer {
// ... for the first block after the starting block // ... for the first block after the starting block
assertEq( assertEq(
oracle.computeL2Timestamp(startingBlockNumber + 1), oracle.computeL2Timestamp(startingBlockNumber + 1),
startingTimestamp + submissionInterval startingTimestamp + l2BlockTime
); );
// ... for some other block number // ... for some other block number
assertEq( assertEq(
oracle.computeL2Timestamp(startingBlockNumber + 96024), oracle.computeL2Timestamp(startingBlockNumber + 96024),
startingTimestamp + submissionInterval * 96024 startingTimestamp + l2BlockTime * 96024
); );
} }
......
...@@ -39,9 +39,11 @@ const config = { ...@@ -39,9 +39,11 @@ const config = {
genesisBlockChainid: 901, genesisBlockChainid: 901,
fundDevAccounts: true, fundDevAccounts: true,
optimsismBaseFeeRecipient: '0xBcd4042DE499D14e55001CcbB24a551F3b954096', optimismBaseFeeRecipient: '0xBcd4042DE499D14e55001CcbB24a551F3b954096',
optimismL1FeeRecipient: '0x71bE63f3384f5fb98995898A86B02Fb2426c5788', optimismL1FeeRecipient: '0x71bE63f3384f5fb98995898A86B02Fb2426c5788',
p2pSequencerAddress: '0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc',
deploymentWaitConfirmations: 1, deploymentWaitConfirmations: 1,
maxSequencerDrift: 1000, maxSequencerDrift: 1000,
...@@ -49,6 +51,8 @@ const config = { ...@@ -49,6 +51,8 @@ const config = {
channelTimeout: 40, channelTimeout: 40,
outputOracleOwner: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', outputOracleOwner: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
optimismL2FeeRecipient: '0xd9c09e21b57c98e58a80552c170989b426766aa7',
batchSenderAddress: '0xDe3829A23DF1479438622a08a116E8Eb3f620BB5',
} }
export default config export default config
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment