@arbitrum/nitro-contracts 1.1.0-alpha.1 → 1.1.0-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +114 -0
- package/README.md +2 -2
- package/build/types/@openzeppelin/contracts/access/Ownable.ts +175 -0
- package/build/types/@openzeppelin/contracts/access/index.ts +4 -0
- package/build/types/@openzeppelin/contracts/index.ts +11 -0
- package/build/types/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable.ts +87 -0
- package/build/types/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/index.ts +4 -0
- package/build/types/@openzeppelin/contracts/interfaces/index.ts +5 -0
- package/build/types/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.ts +108 -0
- package/build/types/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.ts +108 -0
- package/build/types/@openzeppelin/contracts/proxy/ERC1967/index.ts +5 -0
- package/build/types/@openzeppelin/contracts/proxy/Proxy.ts +55 -0
- package/build/types/@openzeppelin/contracts/proxy/beacon/IBeacon.ts +87 -0
- package/build/types/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.ts +239 -0
- package/build/types/@openzeppelin/contracts/proxy/beacon/index.ts +5 -0
- package/build/types/@openzeppelin/contracts/proxy/index.ts +12 -0
- package/build/types/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.ts +359 -0
- package/build/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.ts +278 -0
- package/build/types/@openzeppelin/contracts/proxy/transparent/index.ts +5 -0
- package/build/types/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.ts +216 -0
- package/build/types/@openzeppelin/contracts/proxy/utils/index.ts +4 -0
- package/build/types/@openzeppelin/contracts/token/ERC20/ERC20.ts +444 -0
- package/build/types/@openzeppelin/contracts/token/ERC20/IERC20.ts +322 -0
- package/build/types/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.ts +507 -0
- package/build/types/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.ts +364 -0
- package/build/types/@openzeppelin/contracts/token/ERC20/extensions/index.ts +5 -0
- package/build/types/@openzeppelin/contracts/token/ERC20/index.ts +9 -0
- package/build/types/@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.ts +507 -0
- package/build/types/@openzeppelin/contracts/token/ERC20/presets/index.ts +4 -0
- package/build/types/@openzeppelin/contracts/token/index.ts +5 -0
- package/build/types/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.ts +175 -0
- package/build/types/@openzeppelin/contracts-upgradeable/access/index.ts +4 -0
- package/build/types/@openzeppelin/contracts-upgradeable/index.ts +9 -0
- package/build/types/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.ts +111 -0
- package/build/types/@openzeppelin/contracts-upgradeable/security/index.ts +4 -0
- package/build/types/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.ts +322 -0
- package/build/types/@openzeppelin/contracts-upgradeable/token/ERC20/index.ts +4 -0
- package/build/types/@openzeppelin/contracts-upgradeable/token/index.ts +5 -0
- package/build/types/@openzeppelin/index.ts +7 -0
- package/build/types/common.ts +44 -0
- package/build/types/factories/@openzeppelin/contracts/access/Ownable__factory.ts +78 -0
- package/build/types/factories/@openzeppelin/contracts/access/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts/index.ts +7 -0
- package/build/types/factories/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/IERC1822Proxiable__factory.ts +39 -0
- package/build/types/factories/@openzeppelin/contracts/interfaces/draft-IERC1822.sol/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts/interfaces/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy__factory.ts +146 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade__factory.ts +71 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/ERC1967/index.ts +5 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/Proxy__factory.ts +31 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/beacon/IBeacon__factory.ts +39 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon__factory.ts +169 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/beacon/index.ts +5 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/index.ts +8 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.ts +211 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy__factory.ts +228 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/transparent/index.ts +5 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/utils/UUPSUpgradeable__factory.ts +115 -0
- package/build/types/factories/@openzeppelin/contracts/proxy/utils/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.ts +349 -0
- package/build/types/factories/@openzeppelin/contracts/token/ERC20/IERC20__factory.ts +206 -0
- package/build/types/factories/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable__factory.ts +327 -0
- package/build/types/factories/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata__factory.ts +248 -0
- package/build/types/factories/@openzeppelin/contracts/token/ERC20/extensions/index.ts +5 -0
- package/build/types/factories/@openzeppelin/contracts/token/ERC20/index.ts +7 -0
- package/build/types/factories/@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply__factory.ts +420 -0
- package/build/types/factories/@openzeppelin/contracts/token/ERC20/presets/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts/token/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable__factory.ts +78 -0
- package/build/types/factories/@openzeppelin/contracts-upgradeable/access/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts-upgradeable/index.ts +6 -0
- package/build/types/factories/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable__factory.ts +65 -0
- package/build/types/factories/@openzeppelin/contracts-upgradeable/security/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable__factory.ts +209 -0
- package/build/types/factories/@openzeppelin/contracts-upgradeable/token/ERC20/index.ts +4 -0
- package/build/types/factories/@openzeppelin/contracts-upgradeable/token/index.ts +4 -0
- package/build/types/factories/@openzeppelin/index.ts +5 -0
- package/build/types/factories/index.ts +5 -0
- package/build/types/factories/src/bridge/AbsBridge__factory.ts +612 -0
- package/build/types/factories/src/bridge/AbsInbox__factory.ts +455 -0
- package/build/types/factories/src/bridge/AbsOutbox__factory.ts +561 -0
- package/build/types/factories/src/bridge/Bridge__factory.ts +695 -0
- package/build/types/factories/src/bridge/ERC20Bridge__factory.ts +746 -0
- package/build/types/factories/src/bridge/ERC20Inbox__factory.ts +719 -0
- package/build/types/factories/src/bridge/ERC20Outbox__factory.ts +610 -0
- package/build/types/factories/src/bridge/IBridge__factory.ts +508 -0
- package/build/types/factories/src/bridge/IDelayedMessageProvider__factory.ts +62 -0
- package/build/types/factories/src/bridge/IERC20Bridge__factory.ts +576 -0
- package/build/types/factories/src/bridge/IERC20Inbox__factory.ts +461 -0
- package/build/types/factories/src/bridge/IEthBridge__factory.ts +553 -0
- package/build/types/factories/src/bridge/IEthInbox__factory.ts +653 -0
- package/build/types/factories/src/bridge/IInbox__factory.ts +318 -0
- package/build/types/factories/src/bridge/IOutbox__factory.ts +431 -0
- package/build/types/factories/src/bridge/IOwnable__factory.ts +36 -0
- package/build/types/factories/src/bridge/ISequencerInbox__factory.ts +666 -0
- package/build/types/factories/src/bridge/Inbox__factory.ts +999 -0
- package/build/types/factories/src/bridge/Outbox__factory.ts +591 -0
- package/build/types/factories/src/bridge/SequencerInbox__factory.ts +865 -0
- package/build/types/factories/src/bridge/index.ts +23 -0
- package/build/types/factories/src/challenge/ChallengeManager__factory.ts +720 -0
- package/build/types/factories/src/challenge/IChallengeManager__factory.ts +401 -0
- package/build/types/factories/src/challenge/IChallengeResultReceiver__factory.ts +53 -0
- package/build/types/factories/src/challenge/index.ts +6 -0
- package/build/types/factories/src/index.ts +12 -0
- package/build/types/factories/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy__factory.ts +128 -0
- package/build/types/factories/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade__factory.ts +88 -0
- package/build/types/factories/src/libraries/AdminFallbackProxy.sol/index.ts +5 -0
- package/build/types/factories/src/libraries/DoubleLogicUUPSUpgradeable__factory.ts +163 -0
- package/build/types/factories/src/libraries/IGasRefunder__factory.ts +55 -0
- package/build/types/factories/src/libraries/UUPSNotUpgradeable__factory.ts +97 -0
- package/build/types/factories/src/libraries/index.ts +7 -0
- package/build/types/factories/src/mocks/BridgeStub__factory.ts +612 -0
- package/build/types/factories/src/mocks/BridgeUnproxied__factory.ts +706 -0
- package/build/types/factories/src/mocks/InboxStub__factory.ts +702 -0
- package/build/types/factories/src/mocks/MockResultReceiver__factory.ts +244 -0
- package/build/types/factories/src/mocks/ProxyAdminForBinding__factory.ts +215 -0
- package/build/types/factories/src/mocks/SequencerInboxStub__factory.ts +938 -0
- package/build/types/factories/src/mocks/SimpleProxy__factory.ts +83 -0
- package/build/types/factories/src/mocks/Simple__factory.ts +287 -0
- package/build/types/factories/src/mocks/SingleExecutionChallenge__factory.ts +823 -0
- package/build/types/factories/src/mocks/TimedOutChallengeManager__factory.ts +724 -0
- package/build/types/factories/src/mocks/index.ts +13 -0
- package/build/types/factories/src/node-interface/NodeInterfaceDebug__factory.ts +82 -0
- package/build/types/factories/src/node-interface/NodeInterface__factory.ts +301 -0
- package/build/types/factories/src/node-interface/index.ts +5 -0
- package/build/types/factories/src/osp/HashProofHelper__factory.ts +216 -0
- package/build/types/factories/src/osp/IOneStepProofEntry__factory.ts +72 -0
- package/build/types/factories/src/osp/IOneStepProver__factory.ts +492 -0
- package/build/types/factories/src/osp/OneStepProofEntry__factory.ts +206 -0
- package/build/types/factories/src/osp/OneStepProver0__factory.ts +528 -0
- package/build/types/factories/src/osp/OneStepProverHostIo__factory.ts +528 -0
- package/build/types/factories/src/osp/OneStepProverMath__factory.ts +528 -0
- package/build/types/factories/src/osp/OneStepProverMemory__factory.ts +528 -0
- package/build/types/factories/src/osp/index.ts +11 -0
- package/build/types/factories/src/precompiles/ArbAddressTable__factory.ts +163 -0
- package/build/types/factories/src/precompiles/ArbAggregator__factory.ts +163 -0
- package/build/types/factories/src/precompiles/ArbDebug__factory.ts +208 -0
- package/build/types/factories/src/precompiles/ArbFunctionTable__factory.ts +92 -0
- package/build/types/factories/src/precompiles/ArbGasInfo__factory.ts +339 -0
- package/build/types/factories/src/precompiles/ArbInfo__factory.ts +64 -0
- package/build/types/factories/src/precompiles/ArbOwnerPublic__factory.ts +84 -0
- package/build/types/factories/src/precompiles/ArbOwner__factory.ts +393 -0
- package/build/types/factories/src/precompiles/ArbRetryableTx__factory.ts +321 -0
- package/build/types/factories/src/precompiles/ArbStatistics__factory.ts +64 -0
- package/build/types/factories/src/precompiles/ArbSys__factory.ts +389 -0
- package/build/types/factories/src/precompiles/ArbosActs__factory.ts +92 -0
- package/build/types/factories/src/precompiles/ArbosTest__factory.ts +39 -0
- package/build/types/factories/src/precompiles/index.ts +16 -0
- package/build/types/factories/src/rollup/AbsBridgeCreator__factory.ts +182 -0
- package/build/types/factories/src/rollup/AbsRollupCreator__factory.ts +285 -0
- package/build/types/factories/src/rollup/AbsRollupEventInbox__factory.ts +125 -0
- package/build/types/factories/src/rollup/BridgeCreator__factory.ts +294 -0
- package/build/types/factories/src/rollup/ERC20BridgeCreator__factory.ts +299 -0
- package/build/types/factories/src/rollup/ERC20RollupCreator__factory.ts +439 -0
- package/build/types/factories/src/rollup/ERC20RollupEventInbox__factory.ts +170 -0
- package/build/types/factories/src/rollup/IBridgeCreator.sol/IBridgeCreator__factory.ts +124 -0
- package/build/types/factories/src/rollup/IBridgeCreator.sol/IERC20BridgeCreator__factory.ts +200 -0
- package/build/types/factories/src/rollup/IBridgeCreator.sol/IEthBridgeCreator__factory.ts +195 -0
- package/build/types/factories/src/rollup/IBridgeCreator.sol/index.ts +6 -0
- package/build/types/factories/src/rollup/IRollupAdmin__factory.ts +559 -0
- package/build/types/factories/src/rollup/IRollupCore__factory.ts +904 -0
- package/build/types/factories/src/rollup/IRollupCreator.sol/IERC20RollupCreator__factory.ts +182 -0
- package/build/types/factories/src/rollup/IRollupCreator.sol/IEthRollupCreator__factory.ts +177 -0
- package/build/types/factories/src/rollup/IRollupCreator.sol/IRollupCreator__factory.ts +69 -0
- package/build/types/factories/src/rollup/IRollupCreator.sol/index.ts +6 -0
- package/build/types/factories/src/rollup/IRollupEventInbox__factory.ts +83 -0
- package/build/types/factories/src/rollup/IRollupLogic.sol/IRollupUserAbs__factory.ts +1324 -0
- package/build/types/factories/src/rollup/IRollupLogic.sol/IRollupUserERC20__factory.ts +1458 -0
- package/build/types/factories/src/rollup/IRollupLogic.sol/IRollupUser__factory.ts +1443 -0
- package/build/types/factories/src/rollup/IRollupLogic.sol/index.ts +6 -0
- package/build/types/factories/src/rollup/RollupAdminLogic__factory.ts +1859 -0
- package/build/types/factories/src/rollup/RollupCore__factory.ts +1066 -0
- package/build/types/factories/src/rollup/RollupCreator__factory.ts +434 -0
- package/build/types/factories/src/rollup/RollupEventInbox__factory.ts +166 -0
- package/build/types/factories/src/rollup/RollupProxy__factory.ts +277 -0
- package/build/types/factories/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic__factory.ts +1593 -0
- package/build/types/factories/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic__factory.ts +1767 -0
- package/build/types/factories/src/rollup/RollupUserLogic.sol/RollupUserLogic__factory.ts +1748 -0
- package/build/types/factories/src/rollup/RollupUserLogic.sol/index.ts +6 -0
- package/build/types/factories/src/rollup/ValidatorUtils__factory.ts +430 -0
- package/build/types/factories/src/rollup/ValidatorWalletCreator__factory.ts +205 -0
- package/build/types/factories/src/rollup/ValidatorWallet__factory.ts +486 -0
- package/build/types/factories/src/rollup/index.ts +25 -0
- package/build/types/factories/src/test-helpers/BridgeTester__factory.ts +654 -0
- package/build/types/factories/src/test-helpers/CryptographyPrimitivesTester__factory.ts +111 -0
- package/build/types/factories/src/test-helpers/EthVault__factory.ts +95 -0
- package/build/types/factories/src/test-helpers/MessageTester__factory.ts +135 -0
- package/build/types/factories/src/test-helpers/OutboxWithoutOptTester__factory.ts +575 -0
- package/build/types/factories/src/test-helpers/RollupMock__factory.ts +100 -0
- package/build/types/factories/src/test-helpers/ValueArrayTester__factory.ts +69 -0
- package/build/types/factories/src/test-helpers/index.ts +10 -0
- package/build/types/index.ts +240 -0
- package/build/types/src/bridge/AbsBridge.ts +863 -0
- package/build/types/src/bridge/AbsInbox.ts +664 -0
- package/build/types/src/bridge/AbsOutbox.ts +700 -0
- package/build/types/src/bridge/Bridge.ts +934 -0
- package/build/types/src/bridge/ERC20Bridge.ts +970 -0
- package/build/types/src/bridge/ERC20Inbox.ts +869 -0
- package/build/types/src/bridge/ERC20Outbox.ts +722 -0
- package/build/types/src/bridge/IBridge.ts +799 -0
- package/build/types/src/bridge/IDelayedMessageProvider.ts +108 -0
- package/build/types/src/bridge/IERC20Bridge.ts +914 -0
- package/build/types/src/bridge/IERC20Inbox.ts +788 -0
- package/build/types/src/bridge/IEthBridge.ts +871 -0
- package/build/types/src/bridge/IEthInbox.ts +1081 -0
- package/build/types/src/bridge/IInbox.ts +583 -0
- package/build/types/src/bridge/IOutbox.ts +654 -0
- package/build/types/src/bridge/IOwnable.ts +81 -0
- package/build/types/src/bridge/ISequencerInbox.ts +1038 -0
- package/build/types/src/bridge/Inbox.ts +1279 -0
- package/build/types/src/bridge/Outbox.ts +700 -0
- package/build/types/src/bridge/SequencerInbox.ts +1138 -0
- package/build/types/src/bridge/index.ts +23 -0
- package/build/types/src/challenge/ChallengeManager.ts +889 -0
- package/build/types/src/challenge/IChallengeManager.ts +543 -0
- package/build/types/src/challenge/IChallengeResultReceiver.ts +115 -0
- package/build/types/src/challenge/index.ts +6 -0
- package/build/types/src/index.ts +21 -0
- package/build/types/src/libraries/AdminFallbackProxy.sol/AdminFallbackProxy.ts +128 -0
- package/build/types/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.ts +128 -0
- package/build/types/src/libraries/AdminFallbackProxy.sol/index.ts +5 -0
- package/build/types/src/libraries/DoubleLogicUUPSUpgradeable.ts +314 -0
- package/build/types/src/libraries/IGasRefunder.ts +112 -0
- package/build/types/src/libraries/UUPSNotUpgradeable.ts +164 -0
- package/build/types/src/libraries/index.ts +8 -0
- package/build/types/src/mocks/BridgeStub.ts +887 -0
- package/build/types/src/mocks/BridgeUnproxied.ts +934 -0
- package/build/types/src/mocks/InboxStub.ts +1076 -0
- package/build/types/src/mocks/MockResultReceiver.ts +301 -0
- package/build/types/src/mocks/ProxyAdminForBinding.ts +359 -0
- package/build/types/src/mocks/SequencerInboxStub.ts +1173 -0
- package/build/types/src/mocks/Simple.ts +514 -0
- package/build/types/src/mocks/SimpleProxy.ts +55 -0
- package/build/types/src/mocks/SingleExecutionChallenge.ts +889 -0
- package/build/types/src/mocks/TimedOutChallengeManager.ts +883 -0
- package/build/types/src/mocks/index.ts +13 -0
- package/build/types/src/node-interface/NodeInterface.ts +502 -0
- package/build/types/src/node-interface/NodeInterfaceDebug.ts +137 -0
- package/build/types/src/node-interface/index.ts +5 -0
- package/build/types/src/osp/HashProofHelper.ts +308 -0
- package/build/types/src/osp/IOneStepProofEntry.ts +128 -0
- package/build/types/src/osp/IOneStepProver.ts +284 -0
- package/build/types/src/osp/OneStepProofEntry.ts +196 -0
- package/build/types/src/osp/OneStepProver0.ts +284 -0
- package/build/types/src/osp/OneStepProverHostIo.ts +284 -0
- package/build/types/src/osp/OneStepProverMath.ts +284 -0
- package/build/types/src/osp/OneStepProverMemory.ts +284 -0
- package/build/types/src/osp/index.ts +11 -0
- package/build/types/src/precompiles/ArbAddressTable.ts +248 -0
- package/build/types/src/precompiles/ArbAggregator.ts +335 -0
- package/build/types/src/precompiles/ArbDebug.ts +292 -0
- package/build/types/src/precompiles/ArbFunctionTable.ts +150 -0
- package/build/types/src/precompiles/ArbGasInfo.ts +494 -0
- package/build/types/src/precompiles/ArbInfo.ts +105 -0
- package/build/types/src/precompiles/ArbOwner.ts +928 -0
- package/build/types/src/precompiles/ArbOwnerPublic.ts +157 -0
- package/build/types/src/precompiles/ArbRetryableTx.ts +467 -0
- package/build/types/src/precompiles/ArbStatistics.ts +93 -0
- package/build/types/src/precompiles/ArbSys.ts +553 -0
- package/build/types/src/precompiles/ArbosActs.ts +173 -0
- package/build/types/src/precompiles/ArbosTest.ts +97 -0
- package/build/types/src/precompiles/index.ts +16 -0
- package/build/types/src/rollup/AbsBridgeCreator.ts +348 -0
- package/build/types/src/rollup/AbsRollupCreator.ts +449 -0
- package/build/types/src/rollup/AbsRollupEventInbox.ts +218 -0
- package/build/types/src/rollup/BridgeCreator.ts +415 -0
- package/build/types/src/rollup/ERC20BridgeCreator.ts +420 -0
- package/build/types/src/rollup/ERC20RollupCreator.ts +561 -0
- package/build/types/src/rollup/ERC20RollupEventInbox.ts +218 -0
- package/build/types/src/rollup/IBridgeCreator.sol/IBridgeCreator.ts +231 -0
- package/build/types/src/rollup/IBridgeCreator.sol/IERC20BridgeCreator.ts +303 -0
- package/build/types/src/rollup/IBridgeCreator.sol/IEthBridgeCreator.ts +298 -0
- package/build/types/src/rollup/IBridgeCreator.sol/index.ts +6 -0
- package/build/types/src/rollup/IRollupAdmin.ts +1003 -0
- package/build/types/src/rollup/IRollupCore.ts +1183 -0
- package/build/types/src/rollup/IRollupCreator.sol/IERC20RollupCreator.ts +247 -0
- package/build/types/src/rollup/IRollupCreator.sol/IEthRollupCreator.ts +242 -0
- package/build/types/src/rollup/IRollupCreator.sol/IRollupCreator.ts +134 -0
- package/build/types/src/rollup/IRollupCreator.sol/index.ts +6 -0
- package/build/types/src/rollup/IRollupEventInbox.ts +167 -0
- package/build/types/src/rollup/IRollupLogic.sol/IRollupUser.ts +2022 -0
- package/build/types/src/rollup/IRollupLogic.sol/IRollupUserAbs.ts +1901 -0
- package/build/types/src/rollup/IRollupLogic.sol/IRollupUserERC20.ts +2036 -0
- package/build/types/src/rollup/IRollupLogic.sol/index.ts +6 -0
- package/build/types/src/rollup/RollupAdminLogic.ts +2593 -0
- package/build/types/src/rollup/RollupCore.ts +1406 -0
- package/build/types/src/rollup/RollupCreator.ts +556 -0
- package/build/types/src/rollup/RollupEventInbox.ts +218 -0
- package/build/types/src/rollup/RollupProxy.ts +285 -0
- package/build/types/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.ts +2282 -0
- package/build/types/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.ts +2417 -0
- package/build/types/src/rollup/RollupUserLogic.sol/RollupUserLogic.ts +2403 -0
- package/build/types/src/rollup/RollupUserLogic.sol/index.ts +6 -0
- package/build/types/src/rollup/ValidatorUtils.ts +561 -0
- package/build/types/src/rollup/ValidatorWallet.ts +751 -0
- package/build/types/src/rollup/ValidatorWalletCreator.ts +294 -0
- package/build/types/src/rollup/index.ts +29 -0
- package/build/types/src/test-helpers/BridgeTester.ts +899 -0
- package/build/types/src/test-helpers/CryptographyPrimitivesTester.ts +141 -0
- package/build/types/src/test-helpers/EthVault.ts +141 -0
- package/build/types/src/test-helpers/MessageTester.ts +182 -0
- package/build/types/src/test-helpers/OutboxWithoutOptTester.ts +700 -0
- package/build/types/src/test-helpers/RollupMock.ts +164 -0
- package/build/types/src/test-helpers/ValueArrayTester.ts +81 -0
- package/build/types/src/test-helpers/index.ts +10 -0
- package/package.json +9 -3
- package/src/bridge/AbsBridge.sol +302 -0
- package/src/bridge/AbsInbox.sol +335 -0
- package/src/bridge/AbsOutbox.sol +295 -0
- package/src/bridge/Bridge.sol +15 -244
- package/src/bridge/ERC20Bridge.sol +74 -0
- package/src/bridge/ERC20Inbox.sol +141 -0
- package/src/bridge/ERC20Outbox.sol +27 -0
- package/src/bridge/IBridge.sol +1 -16
- package/src/bridge/IDelayedMessageProvider.sol +1 -1
- package/src/bridge/IERC20Bridge.sol +35 -0
- package/src/bridge/IERC20Inbox.sol +75 -0
- package/src/bridge/IEthBridge.sol +26 -0
- package/src/bridge/IEthInbox.sol +133 -0
- package/src/bridge/IInbox.sol +13 -123
- package/src/bridge/IOutbox.sol +1 -1
- package/src/bridge/IOwnable.sol +1 -1
- package/src/bridge/ISequencerInbox.sol +12 -4
- package/src/bridge/Inbox.sol +46 -333
- package/src/bridge/Messages.sol +1 -1
- package/src/bridge/Outbox.sol +8 -265
- package/src/bridge/SequencerInbox.sol +29 -8
- package/src/challenge/ChallengeLib.sol +1 -1
- package/src/challenge/ChallengeManager.sol +1 -1
- package/src/challenge/IChallengeManager.sol +1 -1
- package/src/challenge/IChallengeResultReceiver.sol +1 -1
- package/src/libraries/AddressAliasHelper.sol +1 -1
- package/src/libraries/AdminFallbackProxy.sol +1 -1
- package/src/libraries/ArbitrumChecker.sol +16 -0
- package/src/libraries/Constants.sol +1 -4
- package/src/libraries/CryptographyPrimitives.sol +1 -1
- package/src/libraries/DelegateCallAware.sol +1 -1
- package/src/libraries/DoubleLogicUUPSUpgradeable.sol +1 -1
- package/src/libraries/Error.sol +9 -1
- package/src/libraries/IGasRefunder.sol +1 -1
- package/src/libraries/MerkleLib.sol +1 -1
- package/src/libraries/MessageTypes.sol +1 -1
- package/src/mocks/BridgeStub.sol +3 -2
- package/src/mocks/BridgeUnproxied.sol +1 -1
- package/src/mocks/InboxStub.sol +28 -5
- package/src/mocks/MockResultReceiver.sol +1 -1
- package/src/mocks/ProxyAdminForBinding.sol +1 -1
- package/src/mocks/SequencerInboxStub.sol +3 -2
- package/src/mocks/Simple.sol +3 -1
- package/src/mocks/SimpleProxy.sol +1 -1
- package/src/mocks/SingleExecutionChallenge.sol +1 -1
- package/src/mocks/TimedOutChallengeManager.sol +1 -1
- package/src/node-interface/NodeInterface.sol +1 -1
- package/src/node-interface/NodeInterfaceDebug.sol +1 -1
- package/src/osp/HashProofHelper.sol +1 -1
- package/src/osp/IOneStepProofEntry.sol +1 -1
- package/src/osp/IOneStepProver.sol +2 -1
- package/src/osp/OneStepProofEntry.sol +1 -1
- package/src/osp/OneStepProver0.sol +1 -1
- package/src/osp/OneStepProverHostIo.sol +2 -1
- package/src/osp/OneStepProverMath.sol +1 -1
- package/src/osp/OneStepProverMemory.sol +2 -1
- package/src/precompiles/ArbAddressTable.sol +1 -1
- package/src/precompiles/ArbAggregator.sol +1 -1
- package/src/precompiles/ArbBLS.sol +1 -1
- package/src/precompiles/ArbDebug.sol +1 -1
- package/src/precompiles/ArbFunctionTable.sol +1 -1
- package/src/precompiles/ArbGasInfo.sol +1 -1
- package/src/precompiles/ArbInfo.sol +1 -1
- package/src/precompiles/ArbOwner.sol +1 -1
- package/src/precompiles/ArbOwnerPublic.sol +1 -1
- package/src/precompiles/ArbRetryableTx.sol +1 -1
- package/src/precompiles/ArbStatistics.sol +1 -1
- package/src/precompiles/ArbSys.sol +1 -1
- package/src/precompiles/ArbosTest.sol +1 -1
- package/src/rollup/AbsBridgeCreator.sol +117 -0
- package/src/rollup/AbsRollupCreator.sol +164 -0
- package/src/rollup/AbsRollupEventInbox.sol +62 -0
- package/src/rollup/BridgeCreator.sol +17 -88
- package/src/rollup/Config.sol +43 -0
- package/src/rollup/ERC20BridgeCreator.sol +48 -0
- package/src/rollup/ERC20RollupCreator.sol +48 -0
- package/src/rollup/ERC20RollupEventInbox.sol +26 -0
- package/src/rollup/IBridgeCreator.sol +64 -0
- package/src/rollup/IRollupAdmin.sol +138 -0
- package/src/rollup/IRollupCore.sol +7 -3
- package/src/rollup/IRollupCreator.sol +40 -0
- package/src/rollup/IRollupEventInbox.sol +1 -1
- package/src/rollup/IRollupLogic.sol +4 -132
- package/src/rollup/Node.sol +15 -1
- package/src/rollup/RollupAdminLogic.sol +6 -8
- package/src/rollup/RollupCore.sol +4 -11
- package/src/rollup/RollupCreator.sol +22 -97
- package/src/rollup/RollupEventInbox.sol +12 -35
- package/src/rollup/RollupLib.sol +2 -41
- package/src/rollup/RollupProxy.sol +3 -2
- package/src/rollup/RollupUserLogic.sol +6 -4
- package/src/rollup/ValidatorUtils.sol +2 -1
- package/src/rollup/ValidatorWallet.sol +1 -1
- package/src/rollup/ValidatorWalletCreator.sol +1 -1
- package/src/state/Deserialize.sol +2 -2
- package/src/state/GlobalState.sol +1 -1
- package/src/state/Instructions.sol +1 -1
- package/src/state/Machine.sol +1 -1
- package/src/state/MerkleProof.sol +1 -1
- package/src/state/Module.sol +3 -3
- package/src/state/ModuleMemory.sol +3 -8
- package/src/state/ModuleMemoryCompact.sol +17 -0
- package/src/state/PcArray.sol +1 -1
- package/src/state/StackFrame.sol +1 -1
- package/src/state/Value.sol +1 -1
- package/src/state/ValueArray.sol +1 -1
- package/src/state/ValueStack.sol +1 -1
- package/src/test-helpers/BridgeTester.sol +3 -2
- package/src/test-helpers/CryptographyPrimitivesTester.sol +1 -1
- package/src/test-helpers/EthVault.sol +20 -0
- package/src/test-helpers/InterfaceCompatibilityTester.sol +1 -1
- package/src/test-helpers/MessageTester.sol +1 -1
- package/src/test-helpers/OutboxWithoutOptTester.sol +1 -1
- package/src/test-helpers/RollupMock.sol +1 -1
- package/src/test-helpers/ValueArrayTester.sol +1 -1
- package/hardhat.config.ts +0 -164
@@ -0,0 +1,335 @@
|
|
1
|
+
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
+
// For license information, see https://github.com/nitro/blob/master/LICENSE
|
3
|
+
// SPDX-License-Identifier: BUSL-1.1
|
4
|
+
|
5
|
+
pragma solidity ^0.8.4;
|
6
|
+
|
7
|
+
import {
|
8
|
+
DataTooLarge,
|
9
|
+
GasLimitTooLarge,
|
10
|
+
InsufficientValue,
|
11
|
+
InsufficientSubmissionCost,
|
12
|
+
L1Forked,
|
13
|
+
NotAllowedOrigin,
|
14
|
+
NotOrigin,
|
15
|
+
NotRollupOrOwner,
|
16
|
+
RetryableData
|
17
|
+
} from "../libraries/Error.sol";
|
18
|
+
import "./IInbox.sol";
|
19
|
+
import "./ISequencerInbox.sol";
|
20
|
+
import "./IBridge.sol";
|
21
|
+
import "../libraries/AddressAliasHelper.sol";
|
22
|
+
import "../libraries/DelegateCallAware.sol";
|
23
|
+
import {
|
24
|
+
L1MessageType_submitRetryableTx,
|
25
|
+
L2MessageType_unsignedContractTx,
|
26
|
+
L2MessageType_unsignedEOATx,
|
27
|
+
L2_MSG
|
28
|
+
} from "../libraries/MessageTypes.sol";
|
29
|
+
import {MAX_DATA_SIZE} from "../libraries/Constants.sol";
|
30
|
+
|
31
|
+
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
|
32
|
+
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
|
33
|
+
|
34
|
+
/**
|
35
|
+
* @title Inbox for user and contract originated messages
|
36
|
+
* @notice Messages created via this inbox are enqueued in the delayed accumulator
|
37
|
+
* to await inclusion in the SequencerInbox
|
38
|
+
*/
|
39
|
+
abstract contract AbsInbox is DelegateCallAware, PausableUpgradeable, IInbox {
|
40
|
+
/// @inheritdoc IInbox
|
41
|
+
IBridge public bridge;
|
42
|
+
/// @inheritdoc IInbox
|
43
|
+
ISequencerInbox public sequencerInbox;
|
44
|
+
|
45
|
+
/// ------------------------------------ allow list start ------------------------------------ ///
|
46
|
+
|
47
|
+
/// @inheritdoc IInbox
|
48
|
+
bool public allowListEnabled;
|
49
|
+
|
50
|
+
/// @inheritdoc IInbox
|
51
|
+
mapping(address => bool) public isAllowed;
|
52
|
+
|
53
|
+
event AllowListAddressSet(address indexed user, bool val);
|
54
|
+
event AllowListEnabledUpdated(bool isEnabled);
|
55
|
+
|
56
|
+
/// @inheritdoc IInbox
|
57
|
+
function setAllowList(address[] memory user, bool[] memory val) external onlyRollupOrOwner {
|
58
|
+
require(user.length == val.length, "INVALID_INPUT");
|
59
|
+
|
60
|
+
for (uint256 i = 0; i < user.length; i++) {
|
61
|
+
isAllowed[user[i]] = val[i];
|
62
|
+
emit AllowListAddressSet(user[i], val[i]);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
/// @inheritdoc IInbox
|
67
|
+
function setAllowListEnabled(bool _allowListEnabled) external onlyRollupOrOwner {
|
68
|
+
require(_allowListEnabled != allowListEnabled, "ALREADY_SET");
|
69
|
+
allowListEnabled = _allowListEnabled;
|
70
|
+
emit AllowListEnabledUpdated(_allowListEnabled);
|
71
|
+
}
|
72
|
+
|
73
|
+
/// @dev this modifier checks the tx.origin instead of msg.sender for convenience (ie it allows
|
74
|
+
/// allowed users to interact with the token bridge without needing the token bridge to be allowList aware).
|
75
|
+
/// this modifier is not intended to use to be used for security (since this opens the allowList to
|
76
|
+
/// a smart contract phishing risk).
|
77
|
+
modifier onlyAllowed() {
|
78
|
+
// solhint-disable-next-line avoid-tx-origin
|
79
|
+
if (allowListEnabled && !isAllowed[tx.origin]) revert NotAllowedOrigin(tx.origin);
|
80
|
+
_;
|
81
|
+
}
|
82
|
+
|
83
|
+
/// ------------------------------------ allow list end ------------------------------------ ///
|
84
|
+
|
85
|
+
modifier onlyRollupOrOwner() {
|
86
|
+
IOwnable rollup = bridge.rollup();
|
87
|
+
if (msg.sender != address(rollup)) {
|
88
|
+
address rollupOwner = rollup.owner();
|
89
|
+
if (msg.sender != rollupOwner) {
|
90
|
+
revert NotRollupOrOwner(msg.sender, address(rollup), rollupOwner);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
_;
|
94
|
+
}
|
95
|
+
|
96
|
+
uint256 internal immutable deployTimeChainId = block.chainid;
|
97
|
+
|
98
|
+
function _chainIdChanged() internal view returns (bool) {
|
99
|
+
return deployTimeChainId != block.chainid;
|
100
|
+
}
|
101
|
+
|
102
|
+
/// @inheritdoc IInbox
|
103
|
+
function pause() external onlyRollupOrOwner {
|
104
|
+
_pause();
|
105
|
+
}
|
106
|
+
|
107
|
+
/// @inheritdoc IInbox
|
108
|
+
function unpause() external onlyRollupOrOwner {
|
109
|
+
_unpause();
|
110
|
+
}
|
111
|
+
|
112
|
+
/* solhint-disable func-name-mixedcase */
|
113
|
+
function __AbsInbox_init(IBridge _bridge, ISequencerInbox _sequencerInbox)
|
114
|
+
internal
|
115
|
+
onlyInitializing
|
116
|
+
{
|
117
|
+
bridge = _bridge;
|
118
|
+
sequencerInbox = _sequencerInbox;
|
119
|
+
allowListEnabled = false;
|
120
|
+
__Pausable_init();
|
121
|
+
}
|
122
|
+
|
123
|
+
/// @inheritdoc IInbox
|
124
|
+
function sendL2MessageFromOrigin(bytes calldata messageData)
|
125
|
+
external
|
126
|
+
whenNotPaused
|
127
|
+
onlyAllowed
|
128
|
+
returns (uint256)
|
129
|
+
{
|
130
|
+
if (_chainIdChanged()) revert L1Forked();
|
131
|
+
// solhint-disable-next-line avoid-tx-origin
|
132
|
+
if (msg.sender != tx.origin) revert NotOrigin();
|
133
|
+
if (messageData.length > MAX_DATA_SIZE)
|
134
|
+
revert DataTooLarge(messageData.length, MAX_DATA_SIZE);
|
135
|
+
uint256 msgNum = _deliverToBridge(L2_MSG, msg.sender, keccak256(messageData), 0);
|
136
|
+
emit InboxMessageDeliveredFromOrigin(msgNum);
|
137
|
+
return msgNum;
|
138
|
+
}
|
139
|
+
|
140
|
+
/// @inheritdoc IInbox
|
141
|
+
function sendL2Message(bytes calldata messageData)
|
142
|
+
external
|
143
|
+
whenNotPaused
|
144
|
+
onlyAllowed
|
145
|
+
returns (uint256)
|
146
|
+
{
|
147
|
+
if (_chainIdChanged()) revert L1Forked();
|
148
|
+
return _deliverMessage(L2_MSG, msg.sender, messageData, 0);
|
149
|
+
}
|
150
|
+
|
151
|
+
/// @inheritdoc IInbox
|
152
|
+
function sendUnsignedTransaction(
|
153
|
+
uint256 gasLimit,
|
154
|
+
uint256 maxFeePerGas,
|
155
|
+
uint256 nonce,
|
156
|
+
address to,
|
157
|
+
uint256 value,
|
158
|
+
bytes calldata data
|
159
|
+
) external whenNotPaused onlyAllowed returns (uint256) {
|
160
|
+
// arbos will discard unsigned tx with gas limit too large
|
161
|
+
if (gasLimit > type(uint64).max) {
|
162
|
+
revert GasLimitTooLarge();
|
163
|
+
}
|
164
|
+
return
|
165
|
+
_deliverMessage(
|
166
|
+
L2_MSG,
|
167
|
+
msg.sender,
|
168
|
+
abi.encodePacked(
|
169
|
+
L2MessageType_unsignedEOATx,
|
170
|
+
gasLimit,
|
171
|
+
maxFeePerGas,
|
172
|
+
nonce,
|
173
|
+
uint256(uint160(to)),
|
174
|
+
value,
|
175
|
+
data
|
176
|
+
),
|
177
|
+
0
|
178
|
+
);
|
179
|
+
}
|
180
|
+
|
181
|
+
/// @inheritdoc IInbox
|
182
|
+
function sendContractTransaction(
|
183
|
+
uint256 gasLimit,
|
184
|
+
uint256 maxFeePerGas,
|
185
|
+
address to,
|
186
|
+
uint256 value,
|
187
|
+
bytes calldata data
|
188
|
+
) external whenNotPaused onlyAllowed returns (uint256) {
|
189
|
+
// arbos will discard unsigned tx with gas limit too large
|
190
|
+
if (gasLimit > type(uint64).max) {
|
191
|
+
revert GasLimitTooLarge();
|
192
|
+
}
|
193
|
+
return
|
194
|
+
_deliverMessage(
|
195
|
+
L2_MSG,
|
196
|
+
msg.sender,
|
197
|
+
abi.encodePacked(
|
198
|
+
L2MessageType_unsignedContractTx,
|
199
|
+
gasLimit,
|
200
|
+
maxFeePerGas,
|
201
|
+
uint256(uint160(to)),
|
202
|
+
value,
|
203
|
+
data
|
204
|
+
),
|
205
|
+
0
|
206
|
+
);
|
207
|
+
}
|
208
|
+
|
209
|
+
function _createRetryableTicket(
|
210
|
+
address to,
|
211
|
+
uint256 l2CallValue,
|
212
|
+
uint256 maxSubmissionCost,
|
213
|
+
address excessFeeRefundAddress,
|
214
|
+
address callValueRefundAddress,
|
215
|
+
uint256 gasLimit,
|
216
|
+
uint256 maxFeePerGas,
|
217
|
+
uint256 amount,
|
218
|
+
bytes calldata data
|
219
|
+
) internal returns (uint256) {
|
220
|
+
// ensure the user's deposit alone will make submission succeed
|
221
|
+
if (amount < (maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas)) {
|
222
|
+
revert InsufficientValue(
|
223
|
+
maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas,
|
224
|
+
amount
|
225
|
+
);
|
226
|
+
}
|
227
|
+
|
228
|
+
// if a refund address is a contract, we apply the alias to it
|
229
|
+
// so that it can access its funds on the L2
|
230
|
+
// since the beneficiary and other refund addresses don't get rewritten by arb-os
|
231
|
+
if (AddressUpgradeable.isContract(excessFeeRefundAddress)) {
|
232
|
+
excessFeeRefundAddress = AddressAliasHelper.applyL1ToL2Alias(excessFeeRefundAddress);
|
233
|
+
}
|
234
|
+
if (AddressUpgradeable.isContract(callValueRefundAddress)) {
|
235
|
+
// this is the beneficiary. be careful since this is the address that can cancel the retryable in the L2
|
236
|
+
callValueRefundAddress = AddressAliasHelper.applyL1ToL2Alias(callValueRefundAddress);
|
237
|
+
}
|
238
|
+
|
239
|
+
// gas limit is validated to be within uint64 in unsafeCreateRetryableTicket
|
240
|
+
return
|
241
|
+
_unsafeCreateRetryableTicket(
|
242
|
+
to,
|
243
|
+
l2CallValue,
|
244
|
+
maxSubmissionCost,
|
245
|
+
excessFeeRefundAddress,
|
246
|
+
callValueRefundAddress,
|
247
|
+
gasLimit,
|
248
|
+
maxFeePerGas,
|
249
|
+
amount,
|
250
|
+
data
|
251
|
+
);
|
252
|
+
}
|
253
|
+
|
254
|
+
function _unsafeCreateRetryableTicket(
|
255
|
+
address to,
|
256
|
+
uint256 l2CallValue,
|
257
|
+
uint256 maxSubmissionCost,
|
258
|
+
address excessFeeRefundAddress,
|
259
|
+
address callValueRefundAddress,
|
260
|
+
uint256 gasLimit,
|
261
|
+
uint256 maxFeePerGas,
|
262
|
+
uint256 amount,
|
263
|
+
bytes calldata data
|
264
|
+
) internal returns (uint256) {
|
265
|
+
// gas price and limit of 1 should never be a valid input, so instead they are used as
|
266
|
+
// magic values to trigger a revert in eth calls that surface data without requiring a tx trace
|
267
|
+
if (gasLimit == 1 || maxFeePerGas == 1)
|
268
|
+
revert RetryableData(
|
269
|
+
msg.sender,
|
270
|
+
to,
|
271
|
+
l2CallValue,
|
272
|
+
amount,
|
273
|
+
maxSubmissionCost,
|
274
|
+
excessFeeRefundAddress,
|
275
|
+
callValueRefundAddress,
|
276
|
+
gasLimit,
|
277
|
+
maxFeePerGas,
|
278
|
+
data
|
279
|
+
);
|
280
|
+
|
281
|
+
// arbos will discard retryable with gas limit too large
|
282
|
+
if (gasLimit > type(uint64).max) {
|
283
|
+
revert GasLimitTooLarge();
|
284
|
+
}
|
285
|
+
|
286
|
+
uint256 submissionFee = calculateRetryableSubmissionFee(data.length, block.basefee);
|
287
|
+
if (maxSubmissionCost < submissionFee)
|
288
|
+
revert InsufficientSubmissionCost(submissionFee, maxSubmissionCost);
|
289
|
+
|
290
|
+
return
|
291
|
+
_deliverMessage(
|
292
|
+
L1MessageType_submitRetryableTx,
|
293
|
+
msg.sender,
|
294
|
+
abi.encodePacked(
|
295
|
+
uint256(uint160(to)),
|
296
|
+
l2CallValue,
|
297
|
+
amount,
|
298
|
+
maxSubmissionCost,
|
299
|
+
uint256(uint160(excessFeeRefundAddress)),
|
300
|
+
uint256(uint160(callValueRefundAddress)),
|
301
|
+
gasLimit,
|
302
|
+
maxFeePerGas,
|
303
|
+
data.length,
|
304
|
+
data
|
305
|
+
),
|
306
|
+
amount
|
307
|
+
);
|
308
|
+
}
|
309
|
+
|
310
|
+
function _deliverMessage(
|
311
|
+
uint8 _kind,
|
312
|
+
address _sender,
|
313
|
+
bytes memory _messageData,
|
314
|
+
uint256 amount
|
315
|
+
) internal returns (uint256) {
|
316
|
+
if (_messageData.length > MAX_DATA_SIZE)
|
317
|
+
revert DataTooLarge(_messageData.length, MAX_DATA_SIZE);
|
318
|
+
uint256 msgNum = _deliverToBridge(_kind, _sender, keccak256(_messageData), amount);
|
319
|
+
emit InboxMessageDelivered(msgNum, _messageData);
|
320
|
+
return msgNum;
|
321
|
+
}
|
322
|
+
|
323
|
+
function _deliverToBridge(
|
324
|
+
uint8 kind,
|
325
|
+
address sender,
|
326
|
+
bytes32 messageDataHash,
|
327
|
+
uint256 amount
|
328
|
+
) internal virtual returns (uint256);
|
329
|
+
|
330
|
+
function calculateRetryableSubmissionFee(uint256 dataLength, uint256 baseFee)
|
331
|
+
public
|
332
|
+
view
|
333
|
+
virtual
|
334
|
+
returns (uint256);
|
335
|
+
}
|
@@ -0,0 +1,295 @@
|
|
1
|
+
// Copyright 2021-2022, Offchain Labs, Inc.
|
2
|
+
// For license information, see https://github.com/nitro/blob/master/LICENSE
|
3
|
+
// SPDX-License-Identifier: BUSL-1.1
|
4
|
+
|
5
|
+
pragma solidity ^0.8.4;
|
6
|
+
|
7
|
+
import {
|
8
|
+
AlreadyInit,
|
9
|
+
NotRollup,
|
10
|
+
ProofTooLong,
|
11
|
+
PathNotMinimal,
|
12
|
+
UnknownRoot,
|
13
|
+
AlreadySpent,
|
14
|
+
BridgeCallFailed,
|
15
|
+
HadZeroInit
|
16
|
+
} from "../libraries/Error.sol";
|
17
|
+
import "./IBridge.sol";
|
18
|
+
import "./IOutbox.sol";
|
19
|
+
import "../libraries/MerkleLib.sol";
|
20
|
+
import "../libraries/DelegateCallAware.sol";
|
21
|
+
|
22
|
+
/// @dev this error is thrown since certain functions are only expected to be used in simulations, not in actual txs
|
23
|
+
error SimulationOnlyEntrypoint();
|
24
|
+
|
25
|
+
abstract contract AbsOutbox is DelegateCallAware, IOutbox {
|
26
|
+
address public rollup; // the rollup contract
|
27
|
+
IBridge public bridge; // the bridge contract
|
28
|
+
|
29
|
+
mapping(uint256 => bytes32) public spent; // packed spent bitmap
|
30
|
+
mapping(bytes32 => bytes32) public roots; // maps root hashes => L2 block hash
|
31
|
+
|
32
|
+
// we're packing this struct into 4 storage slots
|
33
|
+
// 1st slot: timestamp, l2Block (128 bits each, max ~3.4*10^38)
|
34
|
+
// 2nd slot: outputId (256 bits)
|
35
|
+
// 3rd slot: l1Block (96 bits, max ~7.9*10^28), sender (address 160 bits)
|
36
|
+
// 4th slot: withdrawalAmount (256 bits)
|
37
|
+
struct L2ToL1Context {
|
38
|
+
uint128 l2Block;
|
39
|
+
uint128 timestamp;
|
40
|
+
bytes32 outputId;
|
41
|
+
address sender;
|
42
|
+
uint96 l1Block;
|
43
|
+
uint256 withdrawalAmount;
|
44
|
+
}
|
45
|
+
|
46
|
+
// Note, these variables are set and then wiped during a single transaction.
|
47
|
+
// Therefore their values don't need to be maintained, and their slots will
|
48
|
+
// hold default values (which are interpreted as empty values) outside of transactions
|
49
|
+
L2ToL1Context internal context;
|
50
|
+
|
51
|
+
// default context values to be used in storage instead of zero, to save on storage refunds
|
52
|
+
// it is assumed that arb-os never assigns these values to a valid leaf to be redeemed
|
53
|
+
uint128 private constant L2BLOCK_DEFAULT_CONTEXT = type(uint128).max;
|
54
|
+
uint96 private constant L1BLOCK_DEFAULT_CONTEXT = type(uint96).max;
|
55
|
+
uint128 private constant TIMESTAMP_DEFAULT_CONTEXT = type(uint128).max;
|
56
|
+
bytes32 private constant OUTPUTID_DEFAULT_CONTEXT = bytes32(type(uint256).max);
|
57
|
+
address private constant SENDER_DEFAULT_CONTEXT = address(type(uint160).max);
|
58
|
+
|
59
|
+
uint128 public constant OUTBOX_VERSION = 2;
|
60
|
+
|
61
|
+
function initialize(IBridge _bridge) external onlyDelegated {
|
62
|
+
if (address(_bridge) == address(0)) revert HadZeroInit();
|
63
|
+
if (address(bridge) != address(0)) revert AlreadyInit();
|
64
|
+
// address zero is returned if no context is set, but the values used in storage
|
65
|
+
// are non-zero to save users some gas (as storage refunds are usually maxed out)
|
66
|
+
// EIP-1153 would help here
|
67
|
+
context = L2ToL1Context({
|
68
|
+
l2Block: L2BLOCK_DEFAULT_CONTEXT,
|
69
|
+
l1Block: L1BLOCK_DEFAULT_CONTEXT,
|
70
|
+
timestamp: TIMESTAMP_DEFAULT_CONTEXT,
|
71
|
+
outputId: OUTPUTID_DEFAULT_CONTEXT,
|
72
|
+
sender: SENDER_DEFAULT_CONTEXT,
|
73
|
+
withdrawalAmount: _defaultContextAmount()
|
74
|
+
});
|
75
|
+
bridge = _bridge;
|
76
|
+
rollup = address(_bridge.rollup());
|
77
|
+
}
|
78
|
+
|
79
|
+
function updateSendRoot(bytes32 root, bytes32 l2BlockHash) external {
|
80
|
+
if (msg.sender != rollup) revert NotRollup(msg.sender, rollup);
|
81
|
+
roots[root] = l2BlockHash;
|
82
|
+
emit SendRootUpdated(root, l2BlockHash);
|
83
|
+
}
|
84
|
+
|
85
|
+
/// @inheritdoc IOutbox
|
86
|
+
function l2ToL1Sender() external view returns (address) {
|
87
|
+
address sender = context.sender;
|
88
|
+
// we don't return the default context value to avoid a breaking change in the API
|
89
|
+
if (sender == SENDER_DEFAULT_CONTEXT) return address(0);
|
90
|
+
return sender;
|
91
|
+
}
|
92
|
+
|
93
|
+
/// @inheritdoc IOutbox
|
94
|
+
function l2ToL1Block() external view returns (uint256) {
|
95
|
+
uint128 l2Block = context.l2Block;
|
96
|
+
// we don't return the default context value to avoid a breaking change in the API
|
97
|
+
if (l2Block == L2BLOCK_DEFAULT_CONTEXT) return uint256(0);
|
98
|
+
return uint256(l2Block);
|
99
|
+
}
|
100
|
+
|
101
|
+
/// @inheritdoc IOutbox
|
102
|
+
function l2ToL1EthBlock() external view returns (uint256) {
|
103
|
+
uint96 l1Block = context.l1Block;
|
104
|
+
// we don't return the default context value to avoid a breaking change in the API
|
105
|
+
if (l1Block == L1BLOCK_DEFAULT_CONTEXT) return uint256(0);
|
106
|
+
return uint256(l1Block);
|
107
|
+
}
|
108
|
+
|
109
|
+
/// @inheritdoc IOutbox
|
110
|
+
function l2ToL1Timestamp() external view returns (uint256) {
|
111
|
+
uint128 timestamp = context.timestamp;
|
112
|
+
// we don't return the default context value to avoid a breaking change in the API
|
113
|
+
if (timestamp == TIMESTAMP_DEFAULT_CONTEXT) return uint256(0);
|
114
|
+
return uint256(timestamp);
|
115
|
+
}
|
116
|
+
|
117
|
+
/// @notice batch number is deprecated and now always returns 0
|
118
|
+
function l2ToL1BatchNum() external pure returns (uint256) {
|
119
|
+
return 0;
|
120
|
+
}
|
121
|
+
|
122
|
+
/// @inheritdoc IOutbox
|
123
|
+
function l2ToL1OutputId() external view returns (bytes32) {
|
124
|
+
bytes32 outputId = context.outputId;
|
125
|
+
// we don't return the default context value to avoid a breaking change in the API
|
126
|
+
if (outputId == OUTPUTID_DEFAULT_CONTEXT) return bytes32(0);
|
127
|
+
return outputId;
|
128
|
+
}
|
129
|
+
|
130
|
+
/// @inheritdoc IOutbox
|
131
|
+
function executeTransaction(
|
132
|
+
bytes32[] calldata proof,
|
133
|
+
uint256 index,
|
134
|
+
address l2Sender,
|
135
|
+
address to,
|
136
|
+
uint256 l2Block,
|
137
|
+
uint256 l1Block,
|
138
|
+
uint256 l2Timestamp,
|
139
|
+
uint256 value,
|
140
|
+
bytes calldata data
|
141
|
+
) external {
|
142
|
+
bytes32 userTx = calculateItemHash(
|
143
|
+
l2Sender,
|
144
|
+
to,
|
145
|
+
l2Block,
|
146
|
+
l1Block,
|
147
|
+
l2Timestamp,
|
148
|
+
value,
|
149
|
+
data
|
150
|
+
);
|
151
|
+
|
152
|
+
recordOutputAsSpent(proof, index, userTx);
|
153
|
+
|
154
|
+
executeTransactionImpl(index, l2Sender, to, l2Block, l1Block, l2Timestamp, value, data);
|
155
|
+
}
|
156
|
+
|
157
|
+
/// @inheritdoc IOutbox
|
158
|
+
function executeTransactionSimulation(
|
159
|
+
uint256 index,
|
160
|
+
address l2Sender,
|
161
|
+
address to,
|
162
|
+
uint256 l2Block,
|
163
|
+
uint256 l1Block,
|
164
|
+
uint256 l2Timestamp,
|
165
|
+
uint256 value,
|
166
|
+
bytes calldata data
|
167
|
+
) external {
|
168
|
+
if (msg.sender != address(0)) revert SimulationOnlyEntrypoint();
|
169
|
+
executeTransactionImpl(index, l2Sender, to, l2Block, l1Block, l2Timestamp, value, data);
|
170
|
+
}
|
171
|
+
|
172
|
+
function executeTransactionImpl(
|
173
|
+
uint256 outputId,
|
174
|
+
address l2Sender,
|
175
|
+
address to,
|
176
|
+
uint256 l2Block,
|
177
|
+
uint256 l1Block,
|
178
|
+
uint256 l2Timestamp,
|
179
|
+
uint256 value,
|
180
|
+
bytes calldata data
|
181
|
+
) internal {
|
182
|
+
emit OutBoxTransactionExecuted(to, l2Sender, 0, outputId);
|
183
|
+
|
184
|
+
// we temporarily store the previous values so the outbox can naturally
|
185
|
+
// unwind itself when there are nested calls to `executeTransaction`
|
186
|
+
L2ToL1Context memory prevContext = context;
|
187
|
+
|
188
|
+
context = L2ToL1Context({
|
189
|
+
sender: l2Sender,
|
190
|
+
l2Block: uint128(l2Block),
|
191
|
+
l1Block: uint96(l1Block),
|
192
|
+
timestamp: uint128(l2Timestamp),
|
193
|
+
outputId: bytes32(outputId),
|
194
|
+
withdrawalAmount: _amountToSetInContext(value)
|
195
|
+
});
|
196
|
+
|
197
|
+
// set and reset vars around execution so they remain valid during call
|
198
|
+
executeBridgeCall(to, value, data);
|
199
|
+
|
200
|
+
context = prevContext;
|
201
|
+
}
|
202
|
+
|
203
|
+
function _calcSpentIndexOffset(uint256 index)
|
204
|
+
internal
|
205
|
+
view
|
206
|
+
returns (
|
207
|
+
uint256,
|
208
|
+
uint256,
|
209
|
+
bytes32
|
210
|
+
)
|
211
|
+
{
|
212
|
+
uint256 spentIndex = index / 255; // Note: Reserves the MSB.
|
213
|
+
uint256 bitOffset = index % 255;
|
214
|
+
bytes32 replay = spent[spentIndex];
|
215
|
+
return (spentIndex, bitOffset, replay);
|
216
|
+
}
|
217
|
+
|
218
|
+
function _isSpent(uint256 bitOffset, bytes32 replay) internal pure returns (bool) {
|
219
|
+
return ((replay >> bitOffset) & bytes32(uint256(1))) != bytes32(0);
|
220
|
+
}
|
221
|
+
|
222
|
+
/// @inheritdoc IOutbox
|
223
|
+
function isSpent(uint256 index) external view returns (bool) {
|
224
|
+
(, uint256 bitOffset, bytes32 replay) = _calcSpentIndexOffset(index);
|
225
|
+
return _isSpent(bitOffset, replay);
|
226
|
+
}
|
227
|
+
|
228
|
+
function recordOutputAsSpent(
|
229
|
+
bytes32[] memory proof,
|
230
|
+
uint256 index,
|
231
|
+
bytes32 item
|
232
|
+
) internal {
|
233
|
+
if (proof.length >= 256) revert ProofTooLong(proof.length);
|
234
|
+
if (index >= 2**proof.length) revert PathNotMinimal(index, 2**proof.length);
|
235
|
+
|
236
|
+
// Hash the leaf an extra time to prove it's a leaf
|
237
|
+
bytes32 calcRoot = calculateMerkleRoot(proof, index, item);
|
238
|
+
if (roots[calcRoot] == bytes32(0)) revert UnknownRoot(calcRoot);
|
239
|
+
|
240
|
+
(uint256 spentIndex, uint256 bitOffset, bytes32 replay) = _calcSpentIndexOffset(index);
|
241
|
+
|
242
|
+
if (_isSpent(bitOffset, replay)) revert AlreadySpent(index);
|
243
|
+
spent[spentIndex] = (replay | bytes32(1 << bitOffset));
|
244
|
+
}
|
245
|
+
|
246
|
+
function executeBridgeCall(
|
247
|
+
address to,
|
248
|
+
uint256 value,
|
249
|
+
bytes memory data
|
250
|
+
) internal {
|
251
|
+
(bool success, bytes memory returndata) = bridge.executeCall(to, value, data);
|
252
|
+
if (!success) {
|
253
|
+
if (returndata.length > 0) {
|
254
|
+
// solhint-disable-next-line no-inline-assembly
|
255
|
+
assembly {
|
256
|
+
let returndata_size := mload(returndata)
|
257
|
+
revert(add(32, returndata), returndata_size)
|
258
|
+
}
|
259
|
+
} else {
|
260
|
+
revert BridgeCallFailed();
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
|
265
|
+
function calculateItemHash(
|
266
|
+
address l2Sender,
|
267
|
+
address to,
|
268
|
+
uint256 l2Block,
|
269
|
+
uint256 l1Block,
|
270
|
+
uint256 l2Timestamp,
|
271
|
+
uint256 value,
|
272
|
+
bytes calldata data
|
273
|
+
) public pure returns (bytes32) {
|
274
|
+
return
|
275
|
+
keccak256(abi.encodePacked(l2Sender, to, l2Block, l1Block, l2Timestamp, value, data));
|
276
|
+
}
|
277
|
+
|
278
|
+
function calculateMerkleRoot(
|
279
|
+
bytes32[] memory proof,
|
280
|
+
uint256 path,
|
281
|
+
bytes32 item
|
282
|
+
) public pure returns (bytes32) {
|
283
|
+
return MerkleLib.calculateRoot(proof, path, keccak256(abi.encodePacked(item)));
|
284
|
+
}
|
285
|
+
|
286
|
+
/// @notice default value to be used for 'amount' field in L2ToL1Context outside of transaction execution.
|
287
|
+
/// @return default 'amount' in case of ERC20-based rollup is type(uint256).max, or 0 in case of ETH-based rollup
|
288
|
+
function _defaultContextAmount() internal pure virtual returns (uint256);
|
289
|
+
|
290
|
+
/// @notice value to be set for 'amount' field in L2ToL1Context during L2 to L1 transaction execution.
|
291
|
+
/// In case of ERC20-based rollup this is the amount of native token being withdrawn. In case of standard ETH-based
|
292
|
+
/// rollup this amount shall always be 0, because amount of ETH being withdrawn can be read from msg.value.
|
293
|
+
/// @return amount of native token being withdrawn in case of ERC20-based rollup, or 0 in case of ETH-based rollup
|
294
|
+
function _amountToSetInContext(uint256 value) internal pure virtual returns (uint256);
|
295
|
+
}
|