@arbitrum/nitro-contracts 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/{LICENSE → LICENSE.md} +18 -16
- package/README.md +14 -0
- package/build/contracts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol/ERC1967Proxy.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol/ERC1967Upgrade.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/Proxy.sol/Proxy.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/beacon/IBeacon.sol/IBeacon.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol/UUPSUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/security/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/utils/StorageSlot.sol/StorageSlot.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol/AccessControlUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol/IAccessControlUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol/OwnableUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol/IERC20Upgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol/AddressUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol/IERC165Upgradeable.dbg.json +1 -1
- package/build/contracts/src/bridge/AbsBridge.sol/AbsBridge.dbg.json +1 -1
- package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.dbg.json +1 -1
- package/build/contracts/src/bridge/AbsOutbox.sol/AbsOutbox.dbg.json +1 -1
- package/build/contracts/src/bridge/Bridge.sol/Bridge.dbg.json +1 -1
- package/build/contracts/src/bridge/Bridge.sol/Bridge.json +2 -2
- package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.dbg.json +1 -1
- package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.json +2 -2
- package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.dbg.json +1 -1
- package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.json +2 -2
- package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.dbg.json +1 -1
- package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.json +2 -2
- package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.dbg.json +1 -1
- package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.json +2 -2
- package/build/contracts/src/bridge/IBridge.sol/IBridge.dbg.json +1 -1
- package/build/contracts/src/bridge/IDelayedMessageProvider.sol/IDelayedMessageProvider.dbg.json +1 -1
- package/build/contracts/src/bridge/IERC20Bridge.sol/IERC20Bridge.dbg.json +1 -1
- package/build/contracts/src/bridge/IERC20Inbox.sol/IERC20Inbox.dbg.json +1 -1
- package/build/contracts/src/bridge/IEthBridge.sol/IEthBridge.dbg.json +1 -1
- package/build/contracts/src/bridge/IInbox.sol/IInbox.dbg.json +1 -1
- package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.dbg.json +1 -1
- package/build/contracts/src/bridge/IOutbox.sol/IOutbox.dbg.json +1 -1
- package/build/contracts/src/bridge/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.dbg.json +1 -1
- package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.json +184 -22
- package/build/contracts/src/bridge/Inbox.sol/Inbox.dbg.json +1 -1
- package/build/contracts/src/bridge/Inbox.sol/Inbox.json +2 -2
- package/build/contracts/src/bridge/Messages.sol/Messages.dbg.json +1 -1
- package/build/contracts/src/bridge/Outbox.sol/Outbox.dbg.json +1 -1
- package/build/contracts/src/bridge/Outbox.sol/Outbox.json +2 -2
- package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.dbg.json +1 -1
- package/build/contracts/src/bridge/SequencerInbox.sol/SequencerInbox.json +249 -29
- package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.dbg.json +1 -1
- package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.dbg.json +1 -1
- package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.json +31 -2
- package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.dbg.json +1 -1
- package/build/contracts/src/challenge/IChallengeResultReceiver.sol/IChallengeResultReceiver.dbg.json +1 -1
- package/build/contracts/src/libraries/AddressAliasHelper.sol/AddressAliasHelper.dbg.json +1 -1
- package/build/contracts/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.dbg.json +1 -1
- package/build/contracts/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.dbg.json +1 -1
- package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.dbg.json +1 -1
- package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.dbg.json +1 -1
- package/build/contracts/src/libraries/DelegateCallAware.sol/DelegateCallAware.dbg.json +1 -1
- package/build/contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol/DoubleLogicUUPSUpgradeable.dbg.json +1 -1
- package/build/contracts/src/libraries/GasRefundEnabled.sol/GasRefundEnabled.dbg.json +4 -0
- package/build/contracts/src/libraries/{IGasRefunder.sol → GasRefundEnabled.sol}/GasRefundEnabled.json +1 -1
- package/build/contracts/src/libraries/IGasRefunder.sol/IGasRefunder.dbg.json +1 -1
- package/build/contracts/src/libraries/IReader4844.sol/IReader4844.dbg.json +4 -0
- package/build/contracts/src/libraries/IReader4844.sol/IReader4844.json +37 -0
- package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.dbg.json +1 -1
- package/build/contracts/src/libraries/MerkleLib.sol/MerkleLib.json +2 -2
- package/build/contracts/src/libraries/UUPSNotUpgradeable.sol/UUPSNotUpgradeable.dbg.json +1 -1
- package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.dbg.json +1 -1
- package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.json +2 -2
- package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.dbg.json +1 -1
- package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.json +2 -2
- package/build/contracts/src/mocks/InboxStub.sol/InboxStub.dbg.json +1 -1
- package/build/contracts/src/mocks/InboxStub.sol/InboxStub.json +4 -4
- package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.dbg.json +1 -1
- package/build/contracts/src/mocks/MockResultReceiver.sol/MockResultReceiver.json +2 -2
- package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.dbg.json +1 -1
- package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.dbg.json +1 -1
- package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.json +257 -37
- package/build/contracts/src/mocks/Simple.sol/Simple.dbg.json +1 -1
- package/build/contracts/src/mocks/Simple.sol/Simple.json +45 -2
- package/build/contracts/src/mocks/SimpleProxy.sol/SimpleProxy.dbg.json +1 -1
- package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.dbg.json +1 -1
- package/build/contracts/src/mocks/SingleExecutionChallenge.sol/SingleExecutionChallenge.json +31 -2
- package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.dbg.json +1 -1
- package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.json +31 -2
- package/build/contracts/src/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.dbg.json +1 -1
- package/build/contracts/src/node-interface/NodeInterface.sol/NodeInterface.dbg.json +1 -1
- package/build/contracts/src/node-interface/NodeInterfaceDebug.sol/NodeInterfaceDebug.dbg.json +1 -1
- package/build/contracts/src/osp/HashProofHelper.sol/HashProofHelper.dbg.json +1 -1
- package/build/contracts/src/osp/IOneStepProofEntry.sol/IOneStepProofEntry.dbg.json +1 -1
- package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.dbg.json +1 -1
- package/build/contracts/src/osp/IOneStepProofEntry.sol/OneStepProofEntryLib.json +2 -2
- package/build/contracts/src/osp/IOneStepProver.sol/IOneStepProver.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.json +2 -2
- package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.json +2 -2
- package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.json +2 -2
- package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.json +2 -2
- package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.json +2 -2
- package/build/contracts/src/precompiles/ArbAddressTable.sol/ArbAddressTable.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbAggregator.sol/ArbAggregator.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbBLS.sol/ArbBLS.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbDebug.sol/ArbDebug.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbFunctionTable.sol/ArbFunctionTable.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbGasInfo.sol/ArbGasInfo.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbGasInfo.sol/ArbGasInfo.json +65 -0
- package/build/contracts/src/precompiles/ArbInfo.sol/ArbInfo.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.json +18 -0
- package/build/contracts/src/precompiles/ArbRetryableTx.sol/ArbRetryableTx.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbStatistics.sol/ArbStatistics.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbSys.sol/ArbSys.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbosActs.sol/ArbosActs.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbosTest.sol/ArbosTest.dbg.json +1 -1
- package/build/contracts/src/rollup/AbsRollupEventInbox.sol/AbsRollupEventInbox.dbg.json +1 -1
- package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.dbg.json +1 -1
- package/build/contracts/src/rollup/BridgeCreator.sol/BridgeCreator.json +10 -10
- package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.dbg.json +1 -1
- package/build/contracts/src/rollup/DeployHelper.sol/DeployHelper.json +2 -2
- package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.dbg.json +1 -1
- package/build/contracts/src/rollup/ERC20RollupEventInbox.sol/ERC20RollupEventInbox.json +2 -2
- package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.dbg.json +1 -1
- package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.json +8 -8
- package/build/contracts/src/rollup/IRollupCore.sol/IRollupCore.dbg.json +1 -1
- package/build/contracts/src/rollup/IRollupEventInbox.sol/IRollupEventInbox.dbg.json +1 -1
- package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUser.dbg.json +1 -1
- package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.dbg.json +1 -1
- package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.dbg.json +1 -1
- package/build/contracts/src/rollup/Node.sol/NodeLib.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.json +10 -10
- package/build/contracts/src/rollup/RollupCore.sol/RollupCore.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json +20 -15
- package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupEventInbox.sol/RollupEventInbox.json +2 -2
- package/build/contracts/src/rollup/RollupLib.sol/RollupLib.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupLib.sol/RollupLib.json +2 -2
- package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupProxy.sol/RollupProxy.json +10 -10
- package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.json +2 -2
- package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.json +2 -2
- package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.dbg.json +1 -1
- package/build/contracts/src/rollup/ValidatorUtils.sol/ValidatorUtils.json +2 -2
- package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.dbg.json +1 -1
- package/build/contracts/src/rollup/ValidatorWallet.sol/ValidatorWallet.json +2 -2
- package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.dbg.json +1 -1
- package/build/contracts/src/rollup/ValidatorWalletCreator.sol/ValidatorWalletCreator.json +2 -2
- package/build/contracts/src/state/Deserialize.sol/Deserialize.dbg.json +1 -1
- package/build/contracts/src/state/GlobalState.sol/GlobalStateLib.dbg.json +1 -1
- package/build/contracts/src/state/Instructions.sol/Instructions.dbg.json +1 -1
- package/build/contracts/src/state/Machine.sol/MachineLib.dbg.json +1 -1
- package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.dbg.json +1 -1
- package/build/contracts/src/state/Module.sol/ModuleLib.dbg.json +1 -1
- package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.dbg.json +1 -1
- package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.dbg.json +1 -1
- package/build/contracts/src/state/PcArray.sol/PcArrayLib.dbg.json +1 -1
- package/build/contracts/src/state/StackFrame.sol/StackFrameLib.dbg.json +1 -1
- package/build/contracts/src/state/Value.sol/ValueLib.dbg.json +1 -1
- package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.dbg.json +1 -1
- package/build/contracts/src/state/ValueStack.sol/ValueStackLib.dbg.json +1 -1
- package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.dbg.json +1 -1
- package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.json +2 -2
- package/build/contracts/src/test-helpers/CryptographyPrimitivesTester.sol/CryptographyPrimitivesTester.dbg.json +1 -1
- package/build/contracts/src/test-helpers/EthVault.sol/EthVault.dbg.json +1 -1
- package/build/contracts/src/test-helpers/MessageTester.sol/MessageTester.dbg.json +1 -1
- package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.dbg.json +1 -1
- package/build/contracts/src/test-helpers/OutboxWithoutOptTester.sol/OutboxWithoutOptTester.json +2 -2
- package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.dbg.json +1 -1
- package/build/contracts/src/test-helpers/RollupMock.sol/RollupMock.json +26 -2
- package/build/contracts/src/test-helpers/TestToken.sol/TestToken.dbg.json +1 -1
- package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.dbg.json +1 -1
- package/out/yul/Reader4844.yul/Reader4844.json +1 -0
- package/package.json +12 -7
- package/src/bridge/GasRefunder.sol +2 -0
- package/src/bridge/IBridge.sol +22 -0
- package/src/bridge/ISequencerInbox.sol +73 -26
- package/src/bridge/SequencerInbox.sol +426 -140
- package/src/challenge/ChallengeManager.sol +6 -0
- package/src/libraries/Error.sol +27 -0
- package/src/libraries/GasRefundEnabled.sol +52 -0
- package/src/libraries/IGasRefunder.sol +0 -25
- package/src/libraries/IReader4844.sol +13 -0
- package/src/mocks/InboxStub.sol +2 -2
- package/src/mocks/SequencerInboxStub.sol +11 -6
- package/src/mocks/Simple.sol +31 -1
- package/src/osp/OneStepProverHostIo.sol +100 -7
- package/src/precompiles/ArbGasInfo.sol +20 -0
- package/src/precompiles/ArbOwnerPublic.sol +8 -0
- package/src/rollup/BridgeCreator.sol +1 -1
- package/src/rollup/RollupCreator.sol +31 -19
- package/src/rollup/ValidatorWallet.sol +4 -3
- package/src/test-helpers/RollupMock.sol +6 -0
- package/build/contracts/src/libraries/IGasRefunder.sol/GasRefundEnabled.dbg.json +0 -4
@@ -7,6 +7,7 @@ pragma solidity ^0.8.0;
|
|
7
7
|
import {
|
8
8
|
AlreadyInit,
|
9
9
|
HadZeroInit,
|
10
|
+
BadPostUpgradeInit,
|
10
11
|
NotOrigin,
|
11
12
|
DataTooLarge,
|
12
13
|
NotRollup,
|
@@ -21,7 +22,18 @@ import {
|
|
21
22
|
AlreadyValidDASKeyset,
|
22
23
|
NoSuchKeyset,
|
23
24
|
NotForked,
|
24
|
-
|
25
|
+
NotBatchPosterManager,
|
26
|
+
RollupNotChanged,
|
27
|
+
DataBlobsNotSupported,
|
28
|
+
InitParamZero,
|
29
|
+
MissingDataHashes,
|
30
|
+
InvalidBlobMetadata,
|
31
|
+
NotOwner,
|
32
|
+
RollupNotChanged,
|
33
|
+
EmptyBatchData,
|
34
|
+
InvalidHeaderFlag,
|
35
|
+
NativeTokenMismatch,
|
36
|
+
Deprecated
|
25
37
|
} from "../libraries/Error.sol";
|
26
38
|
import "./IBridge.sol";
|
27
39
|
import "./IInboxBase.sol";
|
@@ -30,18 +42,21 @@ import "../rollup/IRollupLogic.sol";
|
|
30
42
|
import "./Messages.sol";
|
31
43
|
import "../precompiles/ArbGasInfo.sol";
|
32
44
|
import "../precompiles/ArbSys.sol";
|
45
|
+
import "../libraries/IReader4844.sol";
|
33
46
|
|
34
47
|
import {L1MessageType_batchPostingReport} from "../libraries/MessageTypes.sol";
|
35
|
-
import {GasRefundEnabled, IGasRefunder} from "../libraries/IGasRefunder.sol";
|
36
48
|
import "../libraries/DelegateCallAware.sol";
|
49
|
+
import {IGasRefunder} from "../libraries/IGasRefunder.sol";
|
50
|
+
import {GasRefundEnabled} from "../libraries/GasRefundEnabled.sol";
|
37
51
|
import "../libraries/ArbitrumChecker.sol";
|
52
|
+
import {IERC20Bridge} from "./IERC20Bridge.sol";
|
38
53
|
|
39
54
|
/**
|
40
|
-
* @title
|
55
|
+
* @title Accepts batches from the sequencer and adds them to the rollup inbox.
|
41
56
|
* @notice Contains the inbox accumulator which is the ordering of all data and transactions to be processed by the rollup.
|
42
|
-
*
|
43
|
-
*
|
44
|
-
*
|
57
|
+
* As part of submitting a batch the sequencer is also expected to include items enqueued
|
58
|
+
* in the delayed inbox (Bridge.sol). If items in the delayed inbox are not included by a
|
59
|
+
* sequencer within a time limit they can be force included into the rollup inbox by anyone.
|
45
60
|
*/
|
46
61
|
contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox {
|
47
62
|
uint256 public totalDelayedMessagesRead;
|
@@ -54,42 +69,142 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
54
69
|
/// @inheritdoc ISequencerInbox
|
55
70
|
bytes1 public constant DATA_AUTHENTICATED_FLAG = 0x40;
|
56
71
|
|
72
|
+
/// @inheritdoc ISequencerInbox
|
73
|
+
bytes1 public constant DATA_BLOB_HEADER_FLAG = DATA_AUTHENTICATED_FLAG | 0x10;
|
74
|
+
|
75
|
+
/// @inheritdoc ISequencerInbox
|
76
|
+
bytes1 public constant DAS_MESSAGE_HEADER_FLAG = 0x80;
|
77
|
+
|
78
|
+
/// @inheritdoc ISequencerInbox
|
79
|
+
bytes1 public constant TREE_DAS_MESSAGE_HEADER_FLAG = 0x08;
|
80
|
+
|
81
|
+
/// @inheritdoc ISequencerInbox
|
82
|
+
bytes1 public constant BROTLI_MESSAGE_HEADER_FLAG = 0x00;
|
83
|
+
|
84
|
+
/// @inheritdoc ISequencerInbox
|
85
|
+
bytes1 public constant ZERO_HEAVY_MESSAGE_HEADER_FLAG = 0x20;
|
86
|
+
|
87
|
+
// GAS_PER_BLOB from EIP-4844
|
88
|
+
uint256 internal constant GAS_PER_BLOB = 1 << 17;
|
89
|
+
|
57
90
|
IOwnable public rollup;
|
91
|
+
|
58
92
|
mapping(address => bool) public isBatchPoster;
|
59
|
-
|
93
|
+
|
94
|
+
// we previously stored the max time variation in a (uint,uint,uint,uint) struct here
|
95
|
+
// solhint-disable-next-line var-name-mixedcase
|
96
|
+
uint256[4] private __LEGACY_MAX_TIME_VARIATION;
|
60
97
|
|
61
98
|
mapping(bytes32 => DasKeySetInfo) public dasKeySetInfo;
|
62
99
|
|
63
100
|
modifier onlyRollupOwner() {
|
64
|
-
if (msg.sender != rollup.owner()) revert NotOwner(msg.sender,
|
101
|
+
if (msg.sender != rollup.owner()) revert NotOwner(msg.sender, rollup.owner());
|
102
|
+
_;
|
103
|
+
}
|
104
|
+
|
105
|
+
modifier onlyRollupOwnerOrBatchPosterManager() {
|
106
|
+
if (msg.sender != rollup.owner() && msg.sender != batchPosterManager) {
|
107
|
+
revert NotBatchPosterManager(msg.sender);
|
108
|
+
}
|
65
109
|
_;
|
66
110
|
}
|
67
111
|
|
68
112
|
mapping(address => bool) public isSequencer;
|
113
|
+
IReader4844 public immutable reader4844;
|
114
|
+
|
115
|
+
// see ISequencerInbox.MaxTimeVariation
|
116
|
+
uint64 internal delayBlocks;
|
117
|
+
uint64 internal futureBlocks;
|
118
|
+
uint64 internal delaySeconds;
|
119
|
+
uint64 internal futureSeconds;
|
120
|
+
|
121
|
+
/// @inheritdoc ISequencerInbox
|
122
|
+
address public batchPosterManager;
|
69
123
|
|
70
124
|
// On L1 this should be set to 117964: 90% of Geth's 128KB tx size limit, leaving ~13KB for proving
|
71
125
|
uint256 public immutable maxDataSize;
|
72
126
|
uint256 internal immutable deployTimeChainId = block.chainid;
|
73
127
|
// If the chain this SequencerInbox is deployed on is an Arbitrum chain.
|
74
128
|
bool internal immutable hostChainIsArbitrum = ArbitrumChecker.runningOnArbitrum();
|
75
|
-
|
76
|
-
|
129
|
+
// True if the chain this SequencerInbox is deployed on uses custom fee token
|
130
|
+
bool public immutable isUsingFeeToken;
|
131
|
+
|
132
|
+
constructor(
|
133
|
+
uint256 _maxDataSize,
|
134
|
+
IReader4844 reader4844_,
|
135
|
+
bool _isUsingFeeToken
|
136
|
+
) {
|
77
137
|
maxDataSize = _maxDataSize;
|
138
|
+
if (hostChainIsArbitrum) {
|
139
|
+
if (reader4844_ != IReader4844(address(0))) revert DataBlobsNotSupported();
|
140
|
+
} else {
|
141
|
+
if (reader4844_ == IReader4844(address(0))) revert InitParamZero("Reader4844");
|
142
|
+
}
|
143
|
+
reader4844 = reader4844_;
|
144
|
+
isUsingFeeToken = _isUsingFeeToken;
|
78
145
|
}
|
79
146
|
|
80
147
|
function _chainIdChanged() internal view returns (bool) {
|
81
148
|
return deployTimeChainId != block.chainid;
|
82
149
|
}
|
83
150
|
|
151
|
+
function postUpgradeInit() external onlyDelegated onlyProxyOwner {
|
152
|
+
// Assuming we would not upgrade from a version that have MaxTimeVariation all set to zero
|
153
|
+
// If that is the case, postUpgradeInit do not need to be called
|
154
|
+
if (
|
155
|
+
__LEGACY_MAX_TIME_VARIATION[0] == 0 &&
|
156
|
+
__LEGACY_MAX_TIME_VARIATION[1] == 0 &&
|
157
|
+
__LEGACY_MAX_TIME_VARIATION[2] == 0 &&
|
158
|
+
__LEGACY_MAX_TIME_VARIATION[3] == 0
|
159
|
+
) {
|
160
|
+
revert AlreadyInit();
|
161
|
+
}
|
162
|
+
|
163
|
+
if (
|
164
|
+
__LEGACY_MAX_TIME_VARIATION[0] > type(uint64).max ||
|
165
|
+
__LEGACY_MAX_TIME_VARIATION[1] > type(uint64).max ||
|
166
|
+
__LEGACY_MAX_TIME_VARIATION[2] > type(uint64).max ||
|
167
|
+
__LEGACY_MAX_TIME_VARIATION[3] > type(uint64).max
|
168
|
+
) {
|
169
|
+
revert BadPostUpgradeInit();
|
170
|
+
}
|
171
|
+
|
172
|
+
delayBlocks = uint64(__LEGACY_MAX_TIME_VARIATION[0]);
|
173
|
+
futureBlocks = uint64(__LEGACY_MAX_TIME_VARIATION[1]);
|
174
|
+
delaySeconds = uint64(__LEGACY_MAX_TIME_VARIATION[2]);
|
175
|
+
futureSeconds = uint64(__LEGACY_MAX_TIME_VARIATION[3]);
|
176
|
+
|
177
|
+
__LEGACY_MAX_TIME_VARIATION[0] = 0;
|
178
|
+
__LEGACY_MAX_TIME_VARIATION[1] = 0;
|
179
|
+
__LEGACY_MAX_TIME_VARIATION[2] = 0;
|
180
|
+
__LEGACY_MAX_TIME_VARIATION[3] = 0;
|
181
|
+
}
|
182
|
+
|
84
183
|
function initialize(
|
85
184
|
IBridge bridge_,
|
86
185
|
ISequencerInbox.MaxTimeVariation calldata maxTimeVariation_
|
87
186
|
) external onlyDelegated {
|
88
187
|
if (bridge != IBridge(address(0))) revert AlreadyInit();
|
89
188
|
if (bridge_ == IBridge(address(0))) revert HadZeroInit();
|
189
|
+
|
190
|
+
// Make sure logic contract was created by proper value for 'isUsingFeeToken'.
|
191
|
+
// Bridge in ETH based chains doesn't implement nativeToken(). In future it might implement it and return address(0)
|
192
|
+
bool actualIsUsingFeeToken = false;
|
193
|
+
try IERC20Bridge(address(bridge_)).nativeToken() returns (address feeToken) {
|
194
|
+
if (feeToken != address(0)) {
|
195
|
+
actualIsUsingFeeToken = true;
|
196
|
+
}
|
197
|
+
} catch {}
|
198
|
+
if (isUsingFeeToken != actualIsUsingFeeToken) {
|
199
|
+
revert NativeTokenMismatch();
|
200
|
+
}
|
201
|
+
|
90
202
|
bridge = bridge_;
|
91
203
|
rollup = bridge_.rollup();
|
92
|
-
|
204
|
+
delayBlocks = maxTimeVariation_.delayBlocks;
|
205
|
+
futureBlocks = maxTimeVariation_.futureBlocks;
|
206
|
+
delaySeconds = maxTimeVariation_.delaySeconds;
|
207
|
+
futureSeconds = maxTimeVariation_.futureSeconds;
|
93
208
|
}
|
94
209
|
|
95
210
|
/// @notice Allows the rollup owner to sync the rollup address
|
@@ -101,28 +216,74 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
101
216
|
rollup = newRollup;
|
102
217
|
}
|
103
218
|
|
104
|
-
function getTimeBounds() internal view virtual returns (TimeBounds memory) {
|
105
|
-
TimeBounds memory bounds;
|
106
|
-
|
107
|
-
|
219
|
+
function getTimeBounds() internal view virtual returns (IBridge.TimeBounds memory) {
|
220
|
+
IBridge.TimeBounds memory bounds;
|
221
|
+
(
|
222
|
+
uint64 delayBlocks_,
|
223
|
+
uint64 futureBlocks_,
|
224
|
+
uint64 delaySeconds_,
|
225
|
+
uint64 futureSeconds_
|
226
|
+
) = maxTimeVariationInternal();
|
227
|
+
if (block.timestamp > delaySeconds_) {
|
228
|
+
bounds.minTimestamp = uint64(block.timestamp) - delaySeconds_;
|
108
229
|
}
|
109
|
-
bounds.maxTimestamp = uint64(block.timestamp +
|
110
|
-
if (block.number >
|
111
|
-
bounds.minBlockNumber = uint64(block.number -
|
230
|
+
bounds.maxTimestamp = uint64(block.timestamp) + futureSeconds_;
|
231
|
+
if (block.number > delayBlocks_) {
|
232
|
+
bounds.minBlockNumber = uint64(block.number) - delayBlocks_;
|
112
233
|
}
|
113
|
-
bounds.maxBlockNumber = uint64(block.number +
|
234
|
+
bounds.maxBlockNumber = uint64(block.number) + futureBlocks_;
|
114
235
|
return bounds;
|
115
236
|
}
|
116
237
|
|
117
238
|
/// @inheritdoc ISequencerInbox
|
118
239
|
function removeDelayAfterFork() external {
|
119
240
|
if (!_chainIdChanged()) revert NotForked();
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
241
|
+
delayBlocks = 1;
|
242
|
+
futureBlocks = 1;
|
243
|
+
delaySeconds = 1;
|
244
|
+
futureSeconds = 1;
|
245
|
+
}
|
246
|
+
|
247
|
+
function maxTimeVariation()
|
248
|
+
external
|
249
|
+
view
|
250
|
+
returns (
|
251
|
+
uint256,
|
252
|
+
uint256,
|
253
|
+
uint256,
|
254
|
+
uint256
|
255
|
+
)
|
256
|
+
{
|
257
|
+
(
|
258
|
+
uint64 delayBlocks_,
|
259
|
+
uint64 futureBlocks_,
|
260
|
+
uint64 delaySeconds_,
|
261
|
+
uint64 futureSeconds_
|
262
|
+
) = maxTimeVariationInternal();
|
263
|
+
|
264
|
+
return (
|
265
|
+
uint256(delayBlocks_),
|
266
|
+
uint256(futureBlocks_),
|
267
|
+
uint256(delaySeconds_),
|
268
|
+
uint256(futureSeconds_)
|
269
|
+
);
|
270
|
+
}
|
271
|
+
|
272
|
+
function maxTimeVariationInternal()
|
273
|
+
internal
|
274
|
+
view
|
275
|
+
returns (
|
276
|
+
uint64,
|
277
|
+
uint64,
|
278
|
+
uint64,
|
279
|
+
uint64
|
280
|
+
)
|
281
|
+
{
|
282
|
+
if (_chainIdChanged()) {
|
283
|
+
return (1, 1, 1, 1);
|
284
|
+
} else {
|
285
|
+
return (delayBlocks, futureBlocks, delaySeconds, futureSeconds);
|
286
|
+
}
|
126
287
|
}
|
127
288
|
|
128
289
|
/// @inheritdoc ISequencerInbox
|
@@ -145,10 +306,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
145
306
|
messageDataHash
|
146
307
|
);
|
147
308
|
// Can only force-include after the Sequencer-only window has expired.
|
148
|
-
if (l1BlockAndTime[0] +
|
149
|
-
|
150
|
-
if (l1BlockAndTime[1] + maxTimeVariation.delaySeconds >= block.timestamp)
|
151
|
-
revert ForceIncludeTimeTooSoon();
|
309
|
+
if (l1BlockAndTime[0] + delayBlocks >= block.number) revert ForceIncludeBlockTooSoon();
|
310
|
+
if (l1BlockAndTime[1] + delaySeconds >= block.timestamp) revert ForceIncludeTimeTooSoon();
|
152
311
|
|
153
312
|
// Verify that message hash represents the last message sequence of delayed message to be included
|
154
313
|
bytes32 prevDelayedAcc = 0;
|
@@ -160,14 +319,12 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
160
319
|
Messages.accumulateInboxMessage(prevDelayedAcc, messageHash)
|
161
320
|
) revert IncorrectMessagePreimage();
|
162
321
|
|
163
|
-
(bytes32 dataHash, TimeBounds memory timeBounds) = formEmptyDataHash(
|
322
|
+
(bytes32 dataHash, IBridge.TimeBounds memory timeBounds) = formEmptyDataHash(
|
164
323
|
_totalDelayedMessagesRead
|
165
324
|
);
|
166
325
|
uint256 __totalDelayedMessagesRead = _totalDelayedMessagesRead;
|
167
326
|
uint256 prevSeqMsgCount = bridge.sequencerReportedSubMessageCount();
|
168
|
-
uint256 newSeqMsgCount = prevSeqMsgCount
|
169
|
-
_totalDelayedMessagesRead -
|
170
|
-
totalDelayedMessagesRead;
|
327
|
+
uint256 newSeqMsgCount = prevSeqMsgCount; // force inclusion should not modify sequencer message count
|
171
328
|
(
|
172
329
|
uint256 seqMessageIndex,
|
173
330
|
bytes32 beforeAcc,
|
@@ -187,42 +344,18 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
187
344
|
delayedAcc,
|
188
345
|
totalDelayedMessagesRead,
|
189
346
|
timeBounds,
|
190
|
-
BatchDataLocation.NoData
|
347
|
+
IBridge.BatchDataLocation.NoData
|
191
348
|
);
|
192
349
|
}
|
193
350
|
|
194
|
-
/// @dev Deprecated
|
351
|
+
/// @dev Deprecated, kept for abi generation and will be removed in the future
|
195
352
|
function addSequencerL2BatchFromOrigin(
|
196
|
-
uint256
|
197
|
-
bytes calldata
|
198
|
-
uint256
|
199
|
-
IGasRefunder
|
200
|
-
) external
|
201
|
-
|
202
|
-
if (msg.sender != tx.origin) revert NotOrigin();
|
203
|
-
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
|
204
|
-
|
205
|
-
(bytes32 dataHash, TimeBounds memory timeBounds) = formDataHash(
|
206
|
-
data,
|
207
|
-
afterDelayedMessagesRead
|
208
|
-
);
|
209
|
-
(
|
210
|
-
uint256 seqMessageIndex,
|
211
|
-
bytes32 beforeAcc,
|
212
|
-
bytes32 delayedAcc,
|
213
|
-
bytes32 afterAcc
|
214
|
-
) = addSequencerL2BatchImpl(dataHash, afterDelayedMessagesRead, data.length, 0, 0);
|
215
|
-
if (seqMessageIndex != sequenceNumber)
|
216
|
-
revert BadSequencerNumber(seqMessageIndex, sequenceNumber);
|
217
|
-
emit SequencerBatchDelivered(
|
218
|
-
sequenceNumber,
|
219
|
-
beforeAcc,
|
220
|
-
afterAcc,
|
221
|
-
delayedAcc,
|
222
|
-
totalDelayedMessagesRead,
|
223
|
-
timeBounds,
|
224
|
-
BatchDataLocation.TxInput
|
225
|
-
);
|
353
|
+
uint256,
|
354
|
+
bytes calldata,
|
355
|
+
uint256,
|
356
|
+
IGasRefunder
|
357
|
+
) external pure {
|
358
|
+
revert Deprecated();
|
226
359
|
}
|
227
360
|
|
228
361
|
function addSequencerL2BatchFromOrigin(
|
@@ -232,17 +365,17 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
232
365
|
IGasRefunder gasRefunder,
|
233
366
|
uint256 prevMessageCount,
|
234
367
|
uint256 newMessageCount
|
235
|
-
) external refundsGas(gasRefunder) {
|
368
|
+
) external refundsGas(gasRefunder, IReader4844(address(0))) {
|
236
369
|
// solhint-disable-next-line avoid-tx-origin
|
237
370
|
if (msg.sender != tx.origin) revert NotOrigin();
|
238
371
|
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
|
239
|
-
(bytes32 dataHash, TimeBounds memory timeBounds) =
|
372
|
+
(bytes32 dataHash, IBridge.TimeBounds memory timeBounds) = formCallDataHash(
|
240
373
|
data,
|
241
374
|
afterDelayedMessagesRead
|
242
375
|
);
|
243
376
|
// Reformat the stack to prevent "Stack too deep"
|
244
377
|
uint256 sequenceNumber_ = sequenceNumber;
|
245
|
-
TimeBounds memory timeBounds_ = timeBounds;
|
378
|
+
IBridge.TimeBounds memory timeBounds_ = timeBounds;
|
246
379
|
bytes32 dataHash_ = dataHash;
|
247
380
|
uint256 dataLength = data.length;
|
248
381
|
uint256 afterDelayedMessagesRead_ = afterDelayedMessagesRead;
|
@@ -260,8 +393,12 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
260
393
|
prevMessageCount_,
|
261
394
|
newMessageCount_
|
262
395
|
);
|
263
|
-
|
396
|
+
|
397
|
+
// ~uint256(0) is type(uint256).max, but ever so slightly cheaper
|
398
|
+
if (seqMessageIndex != sequenceNumber_ && sequenceNumber_ != ~uint256(0)) {
|
264
399
|
revert BadSequencerNumber(seqMessageIndex, sequenceNumber_);
|
400
|
+
}
|
401
|
+
|
265
402
|
emit SequencerBatchDelivered(
|
266
403
|
seqMessageIndex,
|
267
404
|
beforeAcc,
|
@@ -269,10 +406,71 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
269
406
|
delayedAcc,
|
270
407
|
totalDelayedMessagesRead,
|
271
408
|
timeBounds_,
|
272
|
-
BatchDataLocation.TxInput
|
409
|
+
IBridge.BatchDataLocation.TxInput
|
273
410
|
);
|
274
411
|
}
|
275
412
|
|
413
|
+
function addSequencerL2BatchFromBlobs(
|
414
|
+
uint256 sequenceNumber,
|
415
|
+
uint256 afterDelayedMessagesRead,
|
416
|
+
IGasRefunder gasRefunder,
|
417
|
+
uint256 prevMessageCount,
|
418
|
+
uint256 newMessageCount
|
419
|
+
) external refundsGas(gasRefunder, reader4844) {
|
420
|
+
if (!isBatchPoster[msg.sender]) revert NotBatchPoster();
|
421
|
+
(
|
422
|
+
bytes32 dataHash,
|
423
|
+
IBridge.TimeBounds memory timeBounds,
|
424
|
+
uint256 blobGas
|
425
|
+
) = formBlobDataHash(afterDelayedMessagesRead);
|
426
|
+
|
427
|
+
// we use addSequencerL2BatchImpl for submitting the message
|
428
|
+
// normally this would also submit a batch spending report but that is skipped if we pass
|
429
|
+
// an empty call data size, then we submit a separate batch spending report later
|
430
|
+
(
|
431
|
+
uint256 seqMessageIndex,
|
432
|
+
bytes32 beforeAcc,
|
433
|
+
bytes32 delayedAcc,
|
434
|
+
bytes32 afterAcc
|
435
|
+
) = addSequencerL2BatchImpl(
|
436
|
+
dataHash,
|
437
|
+
afterDelayedMessagesRead,
|
438
|
+
0,
|
439
|
+
prevMessageCount,
|
440
|
+
newMessageCount
|
441
|
+
);
|
442
|
+
|
443
|
+
uint256 _sequenceNumber = sequenceNumber; // stack workaround
|
444
|
+
|
445
|
+
// ~uint256(0) is type(uint256).max, but ever so slightly cheaper
|
446
|
+
if (seqMessageIndex != _sequenceNumber && _sequenceNumber != ~uint256(0)) {
|
447
|
+
revert BadSequencerNumber(seqMessageIndex, _sequenceNumber);
|
448
|
+
}
|
449
|
+
|
450
|
+
emit SequencerBatchDelivered(
|
451
|
+
_sequenceNumber,
|
452
|
+
beforeAcc,
|
453
|
+
afterAcc,
|
454
|
+
delayedAcc,
|
455
|
+
totalDelayedMessagesRead,
|
456
|
+
timeBounds,
|
457
|
+
IBridge.BatchDataLocation.Blob
|
458
|
+
);
|
459
|
+
|
460
|
+
// blobs are currently not supported on host arbitrum chains, when support is added it may
|
461
|
+
// consume gas in a different way to L1, so explicitly block host arb chains so that if support for blobs
|
462
|
+
// on arb is added it will need to explicitly turned on in the sequencer inbox
|
463
|
+
if (hostChainIsArbitrum) revert DataBlobsNotSupported();
|
464
|
+
|
465
|
+
// submit a batch spending report to refund the entity that produced the blob batch data
|
466
|
+
// same as using calldata, we only submit spending report if the caller is the origin of the tx
|
467
|
+
// such that one cannot "double-claim" batch posting refund in the same tx
|
468
|
+
// solhint-disable-next-line avoid-tx-origin
|
469
|
+
if (msg.sender == tx.origin && !isUsingFeeToken) {
|
470
|
+
submitBatchSpendingReport(dataHash, seqMessageIndex, block.basefee, blobGas);
|
471
|
+
}
|
472
|
+
}
|
473
|
+
|
276
474
|
function addSequencerL2Batch(
|
277
475
|
uint256 sequenceNumber,
|
278
476
|
bytes calldata data,
|
@@ -280,9 +478,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
280
478
|
IGasRefunder gasRefunder,
|
281
479
|
uint256 prevMessageCount,
|
282
480
|
uint256 newMessageCount
|
283
|
-
) external override refundsGas(gasRefunder) {
|
481
|
+
) external override refundsGas(gasRefunder, IReader4844(address(0))) {
|
284
482
|
if (!isBatchPoster[msg.sender] && msg.sender != address(rollup)) revert NotBatchPoster();
|
285
|
-
(bytes32 dataHash, TimeBounds memory timeBounds) =
|
483
|
+
(bytes32 dataHash, IBridge.TimeBounds memory timeBounds) = formCallDataHash(
|
286
484
|
data,
|
287
485
|
afterDelayedMessagesRead
|
288
486
|
);
|
@@ -290,7 +488,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
290
488
|
{
|
291
489
|
// Reformat the stack to prevent "Stack too deep"
|
292
490
|
uint256 sequenceNumber_ = sequenceNumber;
|
293
|
-
TimeBounds memory timeBounds_ = timeBounds;
|
491
|
+
IBridge.TimeBounds memory timeBounds_ = timeBounds;
|
294
492
|
bytes32 dataHash_ = dataHash;
|
295
493
|
uint256 afterDelayedMessagesRead_ = afterDelayedMessagesRead;
|
296
494
|
uint256 prevMessageCount_ = prevMessageCount;
|
@@ -307,8 +505,12 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
307
505
|
prevMessageCount_,
|
308
506
|
newMessageCount_
|
309
507
|
);
|
310
|
-
|
508
|
+
|
509
|
+
// ~uint256(0) is type(uint256).max, but ever so slightly cheaper
|
510
|
+
if (seqMessageIndex != sequenceNumber_ && sequenceNumber_ != ~uint256(0)) {
|
311
511
|
revert BadSequencerNumber(seqMessageIndex, sequenceNumber_);
|
512
|
+
}
|
513
|
+
|
312
514
|
emit SequencerBatchDelivered(
|
313
515
|
seqMessageIndex,
|
314
516
|
beforeAcc,
|
@@ -316,34 +518,18 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
316
518
|
delayedAcc,
|
317
519
|
totalDelayedMessagesRead,
|
318
520
|
timeBounds_,
|
319
|
-
BatchDataLocation.SeparateBatchEvent
|
521
|
+
IBridge.BatchDataLocation.SeparateBatchEvent
|
320
522
|
);
|
321
523
|
}
|
322
524
|
emit SequencerBatchData(seqMessageIndex, data);
|
323
525
|
}
|
324
526
|
|
325
|
-
modifier validateBatchData(bytes calldata data) {
|
326
|
-
uint256 fullDataLen = HEADER_LENGTH + data.length;
|
327
|
-
if (fullDataLen > maxDataSize) revert DataTooLarge(fullDataLen, maxDataSize);
|
328
|
-
if (data.length > 0 && (data[0] & DATA_AUTHENTICATED_FLAG) == DATA_AUTHENTICATED_FLAG) {
|
329
|
-
revert DataNotAuthenticated();
|
330
|
-
}
|
331
|
-
// the first byte is used to identify the type of batch data
|
332
|
-
// das batches expect to have the type byte set, followed by the keyset (so they should have at least 33 bytes)
|
333
|
-
if (data.length >= 33 && data[0] & 0x80 != 0) {
|
334
|
-
// we skip the first byte, then read the next 32 bytes for the keyset
|
335
|
-
bytes32 dasKeysetHash = bytes32(data[1:33]);
|
336
|
-
if (!dasKeySetInfo[dasKeysetHash].isValidKeyset) revert NoSuchKeyset(dasKeysetHash);
|
337
|
-
}
|
338
|
-
_;
|
339
|
-
}
|
340
|
-
|
341
527
|
function packHeader(uint256 afterDelayedMessagesRead)
|
342
528
|
internal
|
343
529
|
view
|
344
|
-
returns (bytes memory, TimeBounds memory)
|
530
|
+
returns (bytes memory, IBridge.TimeBounds memory)
|
345
531
|
{
|
346
|
-
TimeBounds memory timeBounds = getTimeBounds();
|
532
|
+
IBridge.TimeBounds memory timeBounds = getTimeBounds();
|
347
533
|
bytes memory header = abi.encodePacked(
|
348
534
|
timeBounds.minTimestamp,
|
349
535
|
timeBounds.maxTimestamp,
|
@@ -356,24 +542,139 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
356
542
|
return (header, timeBounds);
|
357
543
|
}
|
358
544
|
|
359
|
-
|
545
|
+
/// @dev Form a hash for a sequencer message with no batch data
|
546
|
+
/// @param afterDelayedMessagesRead The delayed messages count read up to
|
547
|
+
/// @return The data hash
|
548
|
+
/// @return The timebounds within which the message should be processed
|
549
|
+
function formEmptyDataHash(uint256 afterDelayedMessagesRead)
|
360
550
|
internal
|
361
551
|
view
|
362
|
-
|
363
|
-
returns (bytes32, TimeBounds memory)
|
552
|
+
returns (bytes32, IBridge.TimeBounds memory)
|
364
553
|
{
|
365
|
-
(bytes memory header, TimeBounds memory timeBounds) = packHeader(
|
366
|
-
|
367
|
-
|
554
|
+
(bytes memory header, IBridge.TimeBounds memory timeBounds) = packHeader(
|
555
|
+
afterDelayedMessagesRead
|
556
|
+
);
|
557
|
+
return (keccak256(header), timeBounds);
|
368
558
|
}
|
369
559
|
|
370
|
-
|
560
|
+
/// @dev Since the data is supplied from calldata, the batch poster can choose the data type
|
561
|
+
/// We need to ensure that this data cannot cause a collision with data supplied via another method (eg blobs)
|
562
|
+
/// therefore we restrict which flags can be provided as a header in this field
|
563
|
+
/// This also safe guards unused flags for future use, as we know they would have been disallowed up until this point
|
564
|
+
/// @param headerByte The first byte in the calldata
|
565
|
+
function isValidCallDataFlag(bytes1 headerByte) internal pure returns (bool) {
|
566
|
+
return
|
567
|
+
headerByte == BROTLI_MESSAGE_HEADER_FLAG ||
|
568
|
+
headerByte == DAS_MESSAGE_HEADER_FLAG ||
|
569
|
+
(headerByte == (DAS_MESSAGE_HEADER_FLAG | TREE_DAS_MESSAGE_HEADER_FLAG)) ||
|
570
|
+
headerByte == ZERO_HEAVY_MESSAGE_HEADER_FLAG;
|
571
|
+
}
|
572
|
+
|
573
|
+
/// @dev Form a hash of the data taken from the calldata
|
574
|
+
/// @param data The calldata to be hashed
|
575
|
+
/// @param afterDelayedMessagesRead The delayed messages count read up to
|
576
|
+
/// @return The data hash
|
577
|
+
/// @return The timebounds within which the message should be processed
|
578
|
+
function formCallDataHash(bytes calldata data, uint256 afterDelayedMessagesRead)
|
371
579
|
internal
|
372
580
|
view
|
373
|
-
returns (bytes32, TimeBounds memory)
|
581
|
+
returns (bytes32, IBridge.TimeBounds memory)
|
374
582
|
{
|
375
|
-
|
376
|
-
|
583
|
+
uint256 fullDataLen = HEADER_LENGTH + data.length;
|
584
|
+
if (fullDataLen > maxDataSize) revert DataTooLarge(fullDataLen, maxDataSize);
|
585
|
+
|
586
|
+
(bytes memory header, IBridge.TimeBounds memory timeBounds) = packHeader(
|
587
|
+
afterDelayedMessagesRead
|
588
|
+
);
|
589
|
+
|
590
|
+
// the batch poster is allowed to submit an empty batch, they can use this to progress the
|
591
|
+
// delayed inbox without providing extra batch data
|
592
|
+
if (data.length > 0) {
|
593
|
+
// The first data byte cannot be the same as any that have been set via other methods (eg 4844 blob header) as this
|
594
|
+
// would allow the supplier of the data to spoof an incorrect 4844 data batch
|
595
|
+
if (!isValidCallDataFlag(data[0])) revert InvalidHeaderFlag(data[0]);
|
596
|
+
|
597
|
+
// the first byte is used to identify the type of batch data
|
598
|
+
// das batches expect to have the type byte set, followed by the keyset (so they should have at least 33 bytes)
|
599
|
+
// if invalid data is supplied here the state transition function will process it as an empty block
|
600
|
+
// however we can provide a nice additional check here for the batch poster
|
601
|
+
if (data[0] & DAS_MESSAGE_HEADER_FLAG != 0 && data.length >= 33) {
|
602
|
+
// we skip the first byte, then read the next 32 bytes for the keyset
|
603
|
+
bytes32 dasKeysetHash = bytes32(data[1:33]);
|
604
|
+
if (!dasKeySetInfo[dasKeysetHash].isValidKeyset) revert NoSuchKeyset(dasKeysetHash);
|
605
|
+
}
|
606
|
+
}
|
607
|
+
return (keccak256(bytes.concat(header, data)), timeBounds);
|
608
|
+
}
|
609
|
+
|
610
|
+
/// @dev Form a hash of the data being provided in 4844 data blobs
|
611
|
+
/// @param afterDelayedMessagesRead The delayed messages count read up to
|
612
|
+
/// @return The data hash
|
613
|
+
/// @return The timebounds within which the message should be processed
|
614
|
+
/// @return The normalized amount of gas used for blob posting
|
615
|
+
function formBlobDataHash(uint256 afterDelayedMessagesRead)
|
616
|
+
internal
|
617
|
+
view
|
618
|
+
returns (
|
619
|
+
bytes32,
|
620
|
+
IBridge.TimeBounds memory,
|
621
|
+
uint256
|
622
|
+
)
|
623
|
+
{
|
624
|
+
bytes32[] memory dataHashes = reader4844.getDataHashes();
|
625
|
+
if (dataHashes.length == 0) revert MissingDataHashes();
|
626
|
+
|
627
|
+
(bytes memory header, IBridge.TimeBounds memory timeBounds) = packHeader(
|
628
|
+
afterDelayedMessagesRead
|
629
|
+
);
|
630
|
+
|
631
|
+
uint256 blobCost = reader4844.getBlobBaseFee() * GAS_PER_BLOB * dataHashes.length;
|
632
|
+
return (
|
633
|
+
keccak256(bytes.concat(header, DATA_BLOB_HEADER_FLAG, abi.encodePacked(dataHashes))),
|
634
|
+
timeBounds,
|
635
|
+
block.basefee > 0 ? blobCost / block.basefee : 0
|
636
|
+
);
|
637
|
+
}
|
638
|
+
|
639
|
+
/// @dev Submit a batch spending report message so that the batch poster can be reimbursed on the rollup
|
640
|
+
/// This function expect msg.sender is tx.origin, and will always record tx.origin as the spender
|
641
|
+
/// @param dataHash The hash of the message the spending report is being submitted for
|
642
|
+
/// @param seqMessageIndex The index of the message to submit the spending report for
|
643
|
+
/// @param gasPrice The gas price that was paid for the data (standard gas or data gas)
|
644
|
+
function submitBatchSpendingReport(
|
645
|
+
bytes32 dataHash,
|
646
|
+
uint256 seqMessageIndex,
|
647
|
+
uint256 gasPrice,
|
648
|
+
uint256 extraGas
|
649
|
+
) internal {
|
650
|
+
// report the account who paid the gas (tx.origin) for the tx as batch poster
|
651
|
+
// if msg.sender is used and is a contract, it might not be able to spend the refund on l2
|
652
|
+
// solhint-disable-next-line avoid-tx-origin
|
653
|
+
address batchPoster = tx.origin;
|
654
|
+
|
655
|
+
// this msg isn't included in the current sequencer batch, but instead added to
|
656
|
+
// the delayed messages queue that is yet to be included
|
657
|
+
if (hostChainIsArbitrum) {
|
658
|
+
// Include extra gas for the host chain's L1 gas charging
|
659
|
+
uint256 l1Fees = ArbGasInfo(address(0x6c)).getCurrentTxL1GasFees();
|
660
|
+
extraGas += l1Fees / block.basefee;
|
661
|
+
}
|
662
|
+
require(extraGas <= type(uint64).max, "EXTRA_GAS_NOT_UINT64");
|
663
|
+
bytes memory spendingReportMsg = abi.encodePacked(
|
664
|
+
block.timestamp,
|
665
|
+
batchPoster,
|
666
|
+
dataHash,
|
667
|
+
seqMessageIndex,
|
668
|
+
gasPrice,
|
669
|
+
uint64(extraGas)
|
670
|
+
);
|
671
|
+
|
672
|
+
uint256 msgNum = bridge.submitBatchSpendingReport(
|
673
|
+
batchPoster,
|
674
|
+
keccak256(spendingReportMsg)
|
675
|
+
);
|
676
|
+
// this is the same event used by Inbox.sol after including a message to the delayed message accumulator
|
677
|
+
emit InboxMessageDelivered(msgNum, spendingReportMsg);
|
377
678
|
}
|
378
679
|
|
379
680
|
function addSequencerL2BatchImpl(
|
@@ -403,39 +704,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
403
704
|
|
404
705
|
totalDelayedMessagesRead = afterDelayedMessagesRead;
|
405
706
|
|
406
|
-
if (calldataLengthPosted > 0) {
|
407
|
-
//
|
408
|
-
|
409
|
-
address batchPoster = msg.sender;
|
410
|
-
bytes memory spendingReportMsg;
|
411
|
-
if (hostChainIsArbitrum) {
|
412
|
-
// Include extra gas for the host chain's L1 gas charging
|
413
|
-
uint256 l1Fees = ArbGasInfo(address(0x6c)).getCurrentTxL1GasFees();
|
414
|
-
uint256 extraGas = l1Fees / block.basefee;
|
415
|
-
require(extraGas <= type(uint64).max, "L1_GAS_NOT_UINT64");
|
416
|
-
spendingReportMsg = abi.encodePacked(
|
417
|
-
block.timestamp,
|
418
|
-
batchPoster,
|
419
|
-
dataHash,
|
420
|
-
seqMessageIndex,
|
421
|
-
block.basefee,
|
422
|
-
uint64(extraGas)
|
423
|
-
);
|
424
|
-
} else {
|
425
|
-
spendingReportMsg = abi.encodePacked(
|
426
|
-
block.timestamp,
|
427
|
-
batchPoster,
|
428
|
-
dataHash,
|
429
|
-
seqMessageIndex,
|
430
|
-
block.basefee
|
431
|
-
);
|
432
|
-
}
|
433
|
-
uint256 msgNum = bridge.submitBatchSpendingReport(
|
434
|
-
batchPoster,
|
435
|
-
keccak256(spendingReportMsg)
|
436
|
-
);
|
437
|
-
// this is the same event used by Inbox.sol after including a message to the delayed message accumulator
|
438
|
-
emit InboxMessageDelivered(msgNum, spendingReportMsg);
|
707
|
+
if (calldataLengthPosted > 0 && !isUsingFeeToken) {
|
708
|
+
// only report batch poster spendings if chain is using ETH as native currency
|
709
|
+
submitBatchSpendingReport(dataHash, seqMessageIndex, block.basefee, 0);
|
439
710
|
}
|
440
711
|
}
|
441
712
|
|
@@ -452,12 +723,18 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
452
723
|
external
|
453
724
|
onlyRollupOwner
|
454
725
|
{
|
455
|
-
|
726
|
+
delayBlocks = maxTimeVariation_.delayBlocks;
|
727
|
+
futureBlocks = maxTimeVariation_.futureBlocks;
|
728
|
+
delaySeconds = maxTimeVariation_.delaySeconds;
|
729
|
+
futureSeconds = maxTimeVariation_.futureSeconds;
|
456
730
|
emit OwnerFunctionCalled(0);
|
457
731
|
}
|
458
732
|
|
459
733
|
/// @inheritdoc ISequencerInbox
|
460
|
-
function setIsBatchPoster(address addr, bool isBatchPoster_)
|
734
|
+
function setIsBatchPoster(address addr, bool isBatchPoster_)
|
735
|
+
external
|
736
|
+
onlyRollupOwnerOrBatchPosterManager
|
737
|
+
{
|
461
738
|
isBatchPoster[addr] = isBatchPoster_;
|
462
739
|
emit OwnerFunctionCalled(1);
|
463
740
|
}
|
@@ -493,9 +770,18 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox
|
|
493
770
|
}
|
494
771
|
|
495
772
|
/// @inheritdoc ISequencerInbox
|
496
|
-
function setIsSequencer(address addr, bool isSequencer_)
|
773
|
+
function setIsSequencer(address addr, bool isSequencer_)
|
774
|
+
external
|
775
|
+
onlyRollupOwnerOrBatchPosterManager
|
776
|
+
{
|
497
777
|
isSequencer[addr] = isSequencer_;
|
498
|
-
emit OwnerFunctionCalled(4);
|
778
|
+
emit OwnerFunctionCalled(4); // Owner in this context can also be batch poster manager
|
779
|
+
}
|
780
|
+
|
781
|
+
/// @inheritdoc ISequencerInbox
|
782
|
+
function setBatchPosterManager(address newBatchPosterManager) external onlyRollupOwner {
|
783
|
+
batchPosterManager = newBatchPosterManager;
|
784
|
+
emit OwnerFunctionCalled(5);
|
499
785
|
}
|
500
786
|
|
501
787
|
function isValidKeysetHash(bytes32 ksHash) external view returns (bool) {
|