@arbitrum/nitro-contracts 1.2.1 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- 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/utils/Strings.sol/Strings.dbg.json +4 -0
- package/build/contracts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +10 -0
- 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 +26 -2
- package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.dbg.json +1 -1
- package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.json +13 -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/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/IERC20Bridge.sol/IERC20Bridge.json +13 -0
- 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/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 +2 -2
- package/build/contracts/src/chain/CacheManager.sol/CacheManager.dbg.json +4 -0
- package/build/contracts/src/chain/CacheManager.sol/CacheManager.json +517 -0
- package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.dbg.json +1 -1
- package/build/contracts/src/challenge/ChallengeLib.sol/ChallengeLib.json +2 -2
- package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.dbg.json +1 -1
- package/build/contracts/src/challenge/ChallengeManager.sol/ChallengeManager.json +50 -2
- package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.dbg.json +1 -1
- package/build/contracts/src/challenge/IChallengeManager.sol/IChallengeManager.json +55 -0
- 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/DecimalsConverterHelper.sol/DecimalsConverterHelper.dbg.json +4 -0
- package/build/contracts/src/libraries/DecimalsConverterHelper.sol/DecimalsConverterHelper.json +10 -0
- 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 +1 -1
- package/build/contracts/src/libraries/IGasRefunder.sol/IGasRefunder.dbg.json +1 -1
- package/build/contracts/src/libraries/IReader4844.sol/IReader4844.dbg.json +1 -1
- 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/Benchmarks.sol/Benchmarks.dbg.json +4 -0
- package/build/contracts/src/mocks/Benchmarks.sol/Benchmarks.json +46 -0
- package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.dbg.json +1 -1
- package/build/contracts/src/mocks/BridgeStub.sol/BridgeStub.json +28 -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 +2 -2
- 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/MultiCallTest.sol/MultiCallTest.dbg.json +4 -0
- package/build/contracts/src/mocks/MultiCallTest.sol/MultiCallTest.json +71 -0
- package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.dbg.json +4 -0
- package/build/contracts/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol/PendingBlkTimeAndNrAdvanceCheck.json +36 -0
- package/build/contracts/src/mocks/Program.sol/ProgramTest.dbg.json +4 -0
- package/build/contracts/src/mocks/Program.sol/ProgramTest.json +142 -0
- package/build/contracts/src/mocks/ProxyAdminForBinding.sol/ProxyAdminForBinding.dbg.json +1 -1
- package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.dbg.json +4 -0
- package/build/contracts/src/mocks/SdkStorage.sol/SdkStorage.json +25 -0
- package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.dbg.json +1 -1
- package/build/contracts/src/mocks/SequencerInboxStub.sol/SequencerInboxStub.json +2 -2
- package/build/contracts/src/mocks/Simple.sol/Simple.dbg.json +1 -1
- package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.dbg.json +4 -0
- package/build/contracts/src/mocks/SimpleCacheManager.sol/SimpleCacheManager.json +37 -0
- 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 +50 -2
- package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.dbg.json +1 -1
- package/build/contracts/src/mocks/TimedOutChallengeManager.sol/TimedOutChallengeManager.json +50 -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/IOneStepProofEntry.json +48 -0
- 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/IOneStepProver.sol/IOneStepProver.json +88 -0
- package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProofEntry.sol/OneStepProofEntry.json +50 -2
- package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProver0.sol/OneStepProver0.json +90 -2
- package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProverHostIo.sol/OneStepProverHostIo.json +90 -2
- package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProverMath.sol/OneStepProverMath.json +90 -2
- package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.dbg.json +1 -1
- package/build/contracts/src/osp/OneStepProverMemory.sol/OneStepProverMemory.json +90 -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/ArbDebug.sol/ArbDebug.json +7 -0
- 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/ArbInfo.sol/ArbInfo.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.dbg.json +1 -1
- package/build/contracts/src/precompiles/ArbOwner.sol/ArbOwner.json +161 -0
- package/build/contracts/src/precompiles/ArbOwnerPublic.sol/ArbOwnerPublic.dbg.json +1 -1
- 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/ArbWasm.sol/ArbWasm.dbg.json +4 -0
- package/build/contracts/src/precompiles/ArbWasm.sol/ArbWasm.json +453 -0
- package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.dbg.json +4 -0
- package/build/contracts/src/precompiles/ArbWasmCache.sol/ArbWasmCache.json +126 -0
- 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 +2 -2
- 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/FactoryDeployerHelper.sol/FactoryDeployerHelper.dbg.json +4 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/FactoryDeployerHelper.json +68 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IDeployHelper.dbg.json +4 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IDeployHelper.json +58 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20.dbg.json +4 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20.json +40 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20Bridge.dbg.json +4 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IERC20Bridge.json +24 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IInboxBase.dbg.json +4 -0
- package/build/contracts/src/rollup/FactoryDeployerHelper.sol/IInboxBase.json +24 -0
- package/build/contracts/src/rollup/IRollupAdmin.sol/IRollupAdmin.dbg.json +1 -1
- 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/IRollupUser.json +18 -0
- package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.dbg.json +1 -1
- package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserAbs.json +18 -0
- package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.dbg.json +1 -1
- package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.json +18 -0
- package/build/contracts/src/rollup/Node.sol/NodeLib.dbg.json +1 -1
- package/build/contracts/src/rollup/Node.sol/NodeLib.json +2 -2
- package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupAdminLogic.sol/RollupAdminLogic.json +28 -2
- package/build/contracts/src/rollup/RollupCore.sol/RollupCore.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupCore.sol/RollupCore.json +13 -0
- package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupCreator.sol/RollupCreator.json +2 -2
- 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 +2 -2
- package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupUserLogic.sol/AbsRollupUserLogic.json +31 -0
- package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.json +33 -2
- package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.json +33 -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/Deserialize.sol/Deserialize.json +2 -2
- 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/Instructions.sol/Instructions.json +2 -2
- package/build/contracts/src/state/Machine.sol/MachineLib.dbg.json +1 -1
- package/build/contracts/src/state/Machine.sol/MachineLib.json +2 -2
- package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.dbg.json +1 -1
- package/build/contracts/src/state/MerkleProof.sol/MerkleProofLib.json +2 -2
- package/build/contracts/src/state/Module.sol/ModuleLib.dbg.json +1 -1
- package/build/contracts/src/state/Module.sol/ModuleLib.json +2 -2
- package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.dbg.json +1 -1
- package/build/contracts/src/state/ModuleMemory.sol/ModuleMemoryLib.json +2 -2
- package/build/contracts/src/state/ModuleMemoryCompact.sol/ModuleMemoryCompactLib.dbg.json +1 -1
- package/build/contracts/src/state/MultiStack.sol/MultiStackLib.dbg.json +4 -0
- package/build/contracts/src/state/MultiStack.sol/MultiStackLib.json +10 -0
- 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/StackFrame.sol/StackFrameLib.json +2 -2
- package/build/contracts/src/state/Value.sol/ValueLib.dbg.json +1 -1
- package/build/contracts/src/state/Value.sol/ValueLib.json +2 -2
- package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.dbg.json +1 -1
- package/build/contracts/src/state/ValueArray.sol/ValueArrayLib.json +2 -2
- package/build/contracts/src/state/ValueStack.sol/ValueStackLib.dbg.json +1 -1
- package/build/contracts/src/state/ValueStack.sol/ValueStackLib.json +2 -2
- package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.dbg.json +1 -1
- package/build/contracts/src/test-helpers/BridgeTester.sol/BridgeTester.json +28 -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/TestToken.sol/TestToken.dbg.json +1 -1
- package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.dbg.json +1 -1
- package/build/contracts/src/test-helpers/ValueArrayTester.sol/ValueArrayTester.json +2 -2
- package/package.json +17 -8
- package/src/bridge/AbsInbox.sol +16 -4
- package/src/bridge/AbsOutbox.sol +11 -2
- package/src/bridge/ERC20Bridge.sol +30 -3
- package/src/bridge/ERC20Inbox.sol +28 -4
- package/src/bridge/ERC20Outbox.sol +10 -1
- package/src/bridge/IERC20Bridge.sol +7 -0
- package/src/bridge/IERC20Inbox.sol +4 -3
- package/src/bridge/IInbox.sol +3 -3
- package/src/bridge/Inbox.sol +6 -1
- package/src/bridge/Outbox.sol +5 -0
- package/src/chain/CacheManager.sol +293 -0
- package/src/challenge/ChallengeLib.sol +0 -45
- package/src/challenge/ChallengeManager.sol +24 -9
- package/src/challenge/IChallengeManager.sol +13 -0
- package/src/libraries/Constants.sol +11 -0
- package/src/libraries/DecimalsConverterHelper.sol +33 -0
- package/src/libraries/Error.sol +6 -0
- package/src/mocks/Benchmarks.sol +52 -0
- package/src/mocks/BridgeStub.sol +3 -0
- package/src/mocks/MultiCallTest.sol +117 -0
- package/src/mocks/PendingBlkTimeAndNrAdvanceCheck.sol +29 -0
- package/src/mocks/Program.sol +126 -0
- package/src/mocks/SdkStorage.sol +176 -0
- package/src/mocks/SimpleCacheManager.sol +22 -0
- package/src/node-interface/NodeInterface.sol +1 -1
- package/src/osp/IOneStepProofEntry.sol +10 -0
- package/src/osp/OneStepProofEntry.sol +81 -7
- package/src/osp/OneStepProver0.sol +64 -20
- package/src/osp/OneStepProverHostIo.sol +201 -2
- package/src/osp/OneStepProverMemory.sol +4 -33
- package/src/precompiles/ArbDebug.sol +2 -0
- package/src/precompiles/ArbOwner.sol +51 -9
- package/src/precompiles/ArbWasm.sol +119 -0
- package/src/precompiles/ArbWasmCache.sol +36 -0
- package/src/rollup/AbsRollupEventInbox.sol +3 -4
- package/src/rollup/DeployHelper.sol +22 -11
- package/src/rollup/ERC20RollupEventInbox.sol +5 -0
- package/src/rollup/FactoryDeployerHelper.sol +54 -0
- package/src/rollup/IRollupLogic.sol +2 -0
- package/src/rollup/RollupAdminLogic.sol +11 -0
- package/src/rollup/RollupCore.sol +1 -0
- package/src/rollup/RollupCreator.sol +49 -1
- package/src/rollup/RollupEventInbox.sol +8 -0
- package/src/rollup/RollupUserLogic.sol +35 -13
- package/src/state/Deserialize.sol +88 -47
- package/src/state/Instructions.sol +38 -3
- package/src/state/Machine.sol +92 -15
- package/src/state/MerkleProof.sol +22 -4
- package/src/state/Module.sol +3 -1
- package/src/state/ModuleMemory.sol +54 -0
- package/src/state/MultiStack.sol +58 -0
- package/src/state/StackFrame.sol +6 -1
- package/src/state/Value.sol +13 -1
- package/src/state/ValueStack.sol +6 -1
- package/src/test-helpers/BridgeTester.sol +3 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2021-2022, Offchain Labs, Inc.
|
|
2
|
+
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
|
|
3
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.0;
|
|
6
|
+
|
|
7
|
+
import "../precompiles/ArbSys.sol";
|
|
8
|
+
|
|
9
|
+
contract PendingBlkTimeAndNrAdvanceCheck {
|
|
10
|
+
uint256 immutable deployedAt;
|
|
11
|
+
uint256 immutable deployedAtBlock;
|
|
12
|
+
ArbSys constant ARB_SYS = ArbSys(address(100));
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
deployedAt = block.timestamp;
|
|
16
|
+
deployedAtBlock = ARB_SYS.arbBlockNumber();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isAdvancing() external {
|
|
20
|
+
require(block.timestamp > deployedAt, "Time didn't advance");
|
|
21
|
+
require(ARB_SYS.arbBlockNumber() > deployedAtBlock, "Block didn't advance");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function checkArbBlockHashReturnsLatest(bytes32 expected) external {
|
|
25
|
+
bytes32 gotBlockHash = ARB_SYS.arbBlockHash(ARB_SYS.arbBlockNumber() - 1);
|
|
26
|
+
require(gotBlockHash != bytes32(0), "ZERO_BLOCK_HASH");
|
|
27
|
+
require(gotBlockHash == expected, "WRONG_BLOCK_HASH");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Copyright 2022-2023, 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.0;
|
|
6
|
+
import "../precompiles/ArbSys.sol";
|
|
7
|
+
import "@openzeppelin/contracts/utils/Strings.sol";
|
|
8
|
+
|
|
9
|
+
contract ProgramTest {
|
|
10
|
+
event Hash(bytes32 result);
|
|
11
|
+
|
|
12
|
+
function callKeccak(address program, bytes calldata data) external {
|
|
13
|
+
// in keccak.rs
|
|
14
|
+
// the input is the # of hashings followed by a preimage
|
|
15
|
+
// the output is the iterated hash of the preimage
|
|
16
|
+
(bool success, bytes memory result) = address(program).call(data);
|
|
17
|
+
require(success, "call failed");
|
|
18
|
+
bytes32 hash = bytes32(result);
|
|
19
|
+
emit Hash(hash);
|
|
20
|
+
require(hash == keccak256(data[1:]));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function staticcallProgram(address program, bytes calldata data)
|
|
24
|
+
external
|
|
25
|
+
view
|
|
26
|
+
returns (bytes memory)
|
|
27
|
+
{
|
|
28
|
+
(bool success, bytes memory result) = address(program).staticcall(data);
|
|
29
|
+
require(success, "call failed");
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function assert256(
|
|
34
|
+
bytes memory data,
|
|
35
|
+
string memory text,
|
|
36
|
+
uint256 expected
|
|
37
|
+
) internal pure returns (bytes memory) {
|
|
38
|
+
uint256 value = abi.decode(data, (uint256));
|
|
39
|
+
require(value == expected, text);
|
|
40
|
+
|
|
41
|
+
bytes memory rest = new bytes(data.length - 32);
|
|
42
|
+
for (uint256 i = 32; i < data.length; i++) {
|
|
43
|
+
rest[i - 32] = data[i];
|
|
44
|
+
}
|
|
45
|
+
return rest;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function staticcallEvmData(
|
|
49
|
+
address program,
|
|
50
|
+
address fundedAccount,
|
|
51
|
+
uint64 gas,
|
|
52
|
+
bytes calldata data
|
|
53
|
+
) external view returns (bytes memory) {
|
|
54
|
+
(bool success, bytes memory result) = address(program).staticcall{gas: gas}(data);
|
|
55
|
+
require(success, "call failed");
|
|
56
|
+
|
|
57
|
+
address arbPrecompile = address(0x69);
|
|
58
|
+
address ethPrecompile = address(0x01);
|
|
59
|
+
|
|
60
|
+
result = assert256(result, "block number ", block.number - 1);
|
|
61
|
+
result = assert256(result, "chain id ", block.chainid);
|
|
62
|
+
result = assert256(result, "base fee ", block.basefee);
|
|
63
|
+
result = assert256(result, "gas price ", tx.gasprice);
|
|
64
|
+
result = assert256(result, "gas limit ", block.gaslimit);
|
|
65
|
+
result = assert256(result, "value ", 0);
|
|
66
|
+
result = assert256(result, "timestamp ", block.timestamp);
|
|
67
|
+
result = assert256(result, "balance ", fundedAccount.balance);
|
|
68
|
+
result = assert256(result, "rust address ", uint256(uint160(program)));
|
|
69
|
+
result = assert256(result, "sender ", uint256(uint160(address(this))));
|
|
70
|
+
result = assert256(result, "origin ", uint256(uint160(tx.origin)));
|
|
71
|
+
result = assert256(result, "coinbase ", uint256(uint160(address(block.coinbase))));
|
|
72
|
+
result = assert256(result, "rust codehash", uint256(program.codehash));
|
|
73
|
+
result = assert256(result, "arb codehash ", uint256(arbPrecompile.codehash));
|
|
74
|
+
result = assert256(result, "eth codehash ", uint256(ethPrecompile.codehash));
|
|
75
|
+
|
|
76
|
+
bytes memory code = new bytes(program.code.length);
|
|
77
|
+
for (uint256 i = 0; i < program.code.length; i++) {
|
|
78
|
+
code[i] = result[i];
|
|
79
|
+
}
|
|
80
|
+
require(keccak256(code) == keccak256(program.code), "code");
|
|
81
|
+
bytes memory rest = new bytes(result.length - program.code.length);
|
|
82
|
+
for (uint256 i = program.code.length; i < result.length; i++) {
|
|
83
|
+
rest[i - program.code.length] = result[i];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
result = rest;
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function checkRevertData(
|
|
91
|
+
address program,
|
|
92
|
+
bytes calldata data,
|
|
93
|
+
bytes calldata expected
|
|
94
|
+
) external payable returns (bytes memory) {
|
|
95
|
+
(bool success, bytes memory result) = address(program).call{value: msg.value}(data);
|
|
96
|
+
require(!success, "unexpected success");
|
|
97
|
+
require(result.length == expected.length, "wrong revert data length");
|
|
98
|
+
for (uint256 i = 0; i < result.length; i++) {
|
|
99
|
+
require(result[i] == expected[i], "revert data mismatch");
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function mathTest(address program) external {
|
|
105
|
+
uint256 value = 0xeddecf107b5740cef7f5a01e3ea7e287665c4e75a8eb6afae2fda2e3d4367786;
|
|
106
|
+
value = mulmod(
|
|
107
|
+
value,
|
|
108
|
+
0xc6178c2de1078cd36c3bd302cde755340d7f17fcb3fcc0b9c333ba03b217029f,
|
|
109
|
+
0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f
|
|
110
|
+
);
|
|
111
|
+
value = addmod(
|
|
112
|
+
value,
|
|
113
|
+
0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f,
|
|
114
|
+
0xc6178c2de1078cd36c3bd302cde755340d7f17fcb3fcc0b9c333ba03b217029f
|
|
115
|
+
);
|
|
116
|
+
unchecked {
|
|
117
|
+
value /= 0xeddecf107b5740ce;
|
|
118
|
+
value = value**0xfffffffefffffc2f;
|
|
119
|
+
value = value % 0xc6178c2de1078cd3;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
(bool success, bytes memory result) = address(program).call("");
|
|
123
|
+
require(success, "call failed");
|
|
124
|
+
require(keccak256(result) == keccak256(abi.encodePacked(value)));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Copyright 2022-2023, 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.0;
|
|
6
|
+
|
|
7
|
+
contract SdkStorage {
|
|
8
|
+
bool flag;
|
|
9
|
+
address owner;
|
|
10
|
+
address other;
|
|
11
|
+
Struct sub;
|
|
12
|
+
Struct[] structs;
|
|
13
|
+
uint64[] vector;
|
|
14
|
+
uint40[][] nested;
|
|
15
|
+
bytes bytesFull;
|
|
16
|
+
bytes bytesLong;
|
|
17
|
+
string chars;
|
|
18
|
+
Maps maps;
|
|
19
|
+
Arrays arrays;
|
|
20
|
+
|
|
21
|
+
struct Struct {
|
|
22
|
+
uint16 num;
|
|
23
|
+
int32 other;
|
|
24
|
+
bytes32 word;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
struct Maps {
|
|
28
|
+
mapping(uint256 => address) basic;
|
|
29
|
+
mapping(address => bool[]) vects;
|
|
30
|
+
mapping(int32 => address)[] array;
|
|
31
|
+
mapping(bytes1 => mapping(bool => uint256)) nested;
|
|
32
|
+
mapping(string => Struct) structs;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
struct Arrays {
|
|
36
|
+
string[4] strings;
|
|
37
|
+
uint8 spacer;
|
|
38
|
+
uint24[5] packed;
|
|
39
|
+
uint8 trail;
|
|
40
|
+
address[2] spill;
|
|
41
|
+
uint8[2][4] matrix;
|
|
42
|
+
int96[4][] vector;
|
|
43
|
+
int96[][4] vectors;
|
|
44
|
+
Struct[3] structs;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function populate() external {
|
|
48
|
+
flag = true;
|
|
49
|
+
owner = address(0x70);
|
|
50
|
+
other = address(0x30);
|
|
51
|
+
|
|
52
|
+
sub.num = 32;
|
|
53
|
+
sub.other = type(int32).max;
|
|
54
|
+
sub.word = bytes32(uint256(64));
|
|
55
|
+
|
|
56
|
+
for (uint64 i = 0; i < 32; i++) {
|
|
57
|
+
vector.push(i);
|
|
58
|
+
}
|
|
59
|
+
vector[7] = 77;
|
|
60
|
+
|
|
61
|
+
for (uint256 w = 0; w < 10; w++) {
|
|
62
|
+
nested.push(new uint40[](w));
|
|
63
|
+
for (uint256 i = 0; i < w; i++) {
|
|
64
|
+
nested[w][i] = uint40(i);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
for (uint256 w = 0; w < 10; w++) {
|
|
68
|
+
for (uint256 i = 0; i < w; i++) {
|
|
69
|
+
nested[w][i] *= 2;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
for (uint8 i = 0; i < 31; i++) {
|
|
74
|
+
bytesFull = abi.encodePacked(bytesFull, i);
|
|
75
|
+
}
|
|
76
|
+
for (uint8 i = 0; i < 80; i++) {
|
|
77
|
+
bytesLong = abi.encodePacked(bytesLong, i);
|
|
78
|
+
}
|
|
79
|
+
chars = "arbitrum stylus";
|
|
80
|
+
|
|
81
|
+
for (uint256 i = 0; i < 16; i++) {
|
|
82
|
+
maps.basic[i] = address(uint160(i));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
for (uint160 a = 0; a < 4; a++) {
|
|
86
|
+
maps.vects[address(a)] = new bool[](0);
|
|
87
|
+
for (uint256 i = 0; i <= a; i++) {
|
|
88
|
+
maps.vects[address(a)].push(true);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
for (int32 i = 0; i < 4; i++) {
|
|
93
|
+
maps.array.push();
|
|
94
|
+
maps.array[uint256(uint32(i))][i] = address(uint160(uint32(i)));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
for (uint8 i = 0; i < 4; i++) {
|
|
98
|
+
maps.nested[bytes1(i)][i % 2 == 0] = i + 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
maps.structs["stylus"] = sub;
|
|
102
|
+
|
|
103
|
+
for (uint256 i = 0; i < 4; i++) {
|
|
104
|
+
structs.push(sub);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
arrays.strings[2] = "L2 is for you!";
|
|
108
|
+
|
|
109
|
+
for (uint256 i = 0; i < 5; i++) {
|
|
110
|
+
arrays.packed[i] = uint24(i);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
for (uint256 i = 0; i < 2; i++) {
|
|
114
|
+
arrays.spill[i] = address(uint160(i));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
for (uint256 i = 0; i < 4; i++) {
|
|
118
|
+
arrays.matrix[i][0] = uint8(i);
|
|
119
|
+
arrays.matrix[i][1] = arrays.matrix[i][0] + 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
for (uint256 w = 0; w < 3; w++) {
|
|
123
|
+
int96[4] memory array;
|
|
124
|
+
for (int256 i = 0; i < 4; i++) {
|
|
125
|
+
array[uint256(i)] = int96(i);
|
|
126
|
+
}
|
|
127
|
+
arrays.vector.push(array);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
for (uint256 w = 0; w < 4; w++) {
|
|
131
|
+
for (int96 i = 0; i < 4; i++) {
|
|
132
|
+
arrays.vectors[w].push(i);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
for (uint256 i = 0; i < 3; i++) {
|
|
137
|
+
arrays.structs[i] = sub;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function remove() external {
|
|
142
|
+
while (bytesFull.length != 0) {
|
|
143
|
+
bytesFull.pop();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
while (bytesLong.length > 16) {
|
|
147
|
+
bytesLong.pop();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
chars = "wasm is cute <3";
|
|
151
|
+
|
|
152
|
+
while (vector.length != 0) {
|
|
153
|
+
vector.pop();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
while (nested.length > 1) {
|
|
157
|
+
nested.pop();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
for (uint256 i = 0; i < 8; i++) {
|
|
161
|
+
delete maps.basic[i];
|
|
162
|
+
}
|
|
163
|
+
maps.basic[8] = address(32);
|
|
164
|
+
|
|
165
|
+
for (uint160 i = 0; i < 4; i++) {
|
|
166
|
+
delete maps.vects[address(i)];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
structs.pop();
|
|
170
|
+
|
|
171
|
+
delete arrays.matrix;
|
|
172
|
+
delete arrays.vector;
|
|
173
|
+
delete arrays.vectors;
|
|
174
|
+
delete arrays.structs;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2022-2024, 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.0;
|
|
6
|
+
import "../precompiles/ArbWasmCache.sol";
|
|
7
|
+
|
|
8
|
+
contract SimpleCacheManager {
|
|
9
|
+
function cacheProgram(address program) external {
|
|
10
|
+
ArbWasmCache(address(0x72)).cacheProgram(program);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function evictProgram(address program) external {
|
|
14
|
+
ArbWasmCache(address(0x72)).evictCodehash(codehash(program));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function codehash(address program) internal view returns (bytes32 hash) {
|
|
18
|
+
assembly {
|
|
19
|
+
hash := extcodehash(program)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -18,7 +18,7 @@ interface NodeInterface {
|
|
|
18
18
|
* @param deposit amount to deposit to sender in L2
|
|
19
19
|
* @param to destination L2 contract address
|
|
20
20
|
* @param l2CallValue call value for retryable L2 message
|
|
21
|
-
* @param excessFeeRefundAddress
|
|
21
|
+
* @param excessFeeRefundAddress the address which receives the difference between execution fee paid and the actual execution cost
|
|
22
22
|
* @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled
|
|
23
23
|
* @param data ABI encoded data of L2 message
|
|
24
24
|
*/
|
|
@@ -11,6 +11,16 @@ library OneStepProofEntryLib {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
interface IOneStepProofEntry {
|
|
14
|
+
function getStartMachineHash(bytes32 globalStateHash, bytes32 wasmModuleRoot)
|
|
15
|
+
external
|
|
16
|
+
pure
|
|
17
|
+
returns (bytes32);
|
|
18
|
+
|
|
19
|
+
function getEndMachineHash(MachineStatus status, bytes32 globalStateHash)
|
|
20
|
+
external
|
|
21
|
+
pure
|
|
22
|
+
returns (bytes32);
|
|
23
|
+
|
|
14
24
|
function proveOneStep(
|
|
15
25
|
ExecutionContext calldata execCtx,
|
|
16
26
|
uint256 machineStep,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2021-
|
|
1
|
+
// Copyright 2021-2023, Offchain Labs, Inc.
|
|
2
2
|
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
|
|
3
3
|
// SPDX-License-Identifier: BUSL-1.1
|
|
4
4
|
|
|
@@ -7,12 +7,17 @@ pragma solidity ^0.8.0;
|
|
|
7
7
|
import "../state/Deserialize.sol";
|
|
8
8
|
import "../state/Machine.sol";
|
|
9
9
|
import "../state/MerkleProof.sol";
|
|
10
|
+
import "../state/MultiStack.sol";
|
|
10
11
|
import "./IOneStepProver.sol";
|
|
11
12
|
import "./IOneStepProofEntry.sol";
|
|
12
13
|
|
|
13
14
|
contract OneStepProofEntry is IOneStepProofEntry {
|
|
14
15
|
using MerkleProofLib for MerkleProof;
|
|
15
16
|
using MachineLib for Machine;
|
|
17
|
+
using MultiStackLib for MultiStack;
|
|
18
|
+
|
|
19
|
+
using ValueStackLib for ValueStack;
|
|
20
|
+
using StackFrameLib for StackFrameWindow;
|
|
16
21
|
|
|
17
22
|
IOneStepProver public prover0;
|
|
18
23
|
IOneStepProver public proverMem;
|
|
@@ -31,6 +36,58 @@ contract OneStepProofEntry is IOneStepProofEntry {
|
|
|
31
36
|
proverHostIo = proverHostIo_;
|
|
32
37
|
}
|
|
33
38
|
|
|
39
|
+
// Copied from ChallengeLib.sol
|
|
40
|
+
function getStartMachineHash(bytes32 globalStateHash, bytes32 wasmModuleRoot)
|
|
41
|
+
external
|
|
42
|
+
pure
|
|
43
|
+
returns (bytes32)
|
|
44
|
+
{
|
|
45
|
+
// Start the value stack with the function call ABI for the entrypoint
|
|
46
|
+
Value[] memory startingValues = new Value[](3);
|
|
47
|
+
startingValues[0] = ValueLib.newRefNull();
|
|
48
|
+
startingValues[1] = ValueLib.newI32(0);
|
|
49
|
+
startingValues[2] = ValueLib.newI32(0);
|
|
50
|
+
ValueArray memory valuesArray = ValueArray({inner: startingValues});
|
|
51
|
+
ValueStack memory values = ValueStack({proved: valuesArray, remainingHash: 0});
|
|
52
|
+
ValueStack memory internalStack;
|
|
53
|
+
StackFrameWindow memory frameStack;
|
|
54
|
+
MultiStack memory emptyMultiStack;
|
|
55
|
+
emptyMultiStack.setEmpty();
|
|
56
|
+
|
|
57
|
+
Machine memory mach = Machine({
|
|
58
|
+
status: MachineStatus.RUNNING,
|
|
59
|
+
valueStack: values,
|
|
60
|
+
valueMultiStack: emptyMultiStack,
|
|
61
|
+
internalStack: internalStack,
|
|
62
|
+
frameStack: frameStack,
|
|
63
|
+
frameMultiStack: emptyMultiStack,
|
|
64
|
+
globalStateHash: globalStateHash,
|
|
65
|
+
moduleIdx: 0,
|
|
66
|
+
functionIdx: 0,
|
|
67
|
+
functionPc: 0,
|
|
68
|
+
recoveryPc: MachineLib.NO_RECOVERY_PC,
|
|
69
|
+
modulesRoot: wasmModuleRoot
|
|
70
|
+
});
|
|
71
|
+
return mach.hash();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Copied from ChallengeLib.sol
|
|
75
|
+
function getEndMachineHash(MachineStatus status, bytes32 globalStateHash)
|
|
76
|
+
external
|
|
77
|
+
pure
|
|
78
|
+
returns (bytes32)
|
|
79
|
+
{
|
|
80
|
+
if (status == MachineStatus.FINISHED) {
|
|
81
|
+
return keccak256(abi.encodePacked("Machine finished:", globalStateHash));
|
|
82
|
+
} else if (status == MachineStatus.ERRORED) {
|
|
83
|
+
return keccak256(abi.encodePacked("Machine errored:"));
|
|
84
|
+
} else if (status == MachineStatus.TOO_FAR) {
|
|
85
|
+
return keccak256(abi.encodePacked("Machine too far:"));
|
|
86
|
+
} else {
|
|
87
|
+
revert("BAD_BLOCK_STATUS");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
34
91
|
function proveOneStep(
|
|
35
92
|
ExecutionContext calldata execCtx,
|
|
36
93
|
uint256 machineStep,
|
|
@@ -65,17 +122,22 @@ contract OneStepProofEntry is IOneStepProofEntry {
|
|
|
65
122
|
);
|
|
66
123
|
|
|
67
124
|
{
|
|
68
|
-
|
|
125
|
+
Instruction[] memory codeChunk;
|
|
126
|
+
MerkleProof memory codeProof;
|
|
69
127
|
MerkleProof memory funcProof;
|
|
70
|
-
(
|
|
71
|
-
(
|
|
128
|
+
(codeChunk, offset) = Deserialize.instructions(proof, offset);
|
|
129
|
+
(codeProof, offset) = Deserialize.merkleProof(proof, offset);
|
|
72
130
|
(funcProof, offset) = Deserialize.merkleProof(proof, offset);
|
|
73
|
-
bytes32 codeHash =
|
|
131
|
+
bytes32 codeHash = codeProof.computeRootFromInstructions(
|
|
132
|
+
mach.functionPc / 64,
|
|
133
|
+
codeChunk
|
|
134
|
+
);
|
|
74
135
|
bytes32 recomputedRoot = funcProof.computeRootFromFunction(
|
|
75
136
|
mach.functionIdx,
|
|
76
137
|
codeHash
|
|
77
138
|
);
|
|
78
139
|
require(recomputedRoot == mod.functionsMerkleRoot, "BAD_FUNCTIONS_ROOT");
|
|
140
|
+
inst = codeChunk[mach.functionPc % 64];
|
|
79
141
|
}
|
|
80
142
|
proof = proof[offset:];
|
|
81
143
|
}
|
|
@@ -113,7 +175,8 @@ contract OneStepProofEntry is IOneStepProofEntry {
|
|
|
113
175
|
} else if (
|
|
114
176
|
(opcode >= Instructions.GET_GLOBAL_STATE_BYTES32 &&
|
|
115
177
|
opcode <= Instructions.SET_GLOBAL_STATE_U64) ||
|
|
116
|
-
(opcode >= Instructions.READ_PRE_IMAGE && opcode <= Instructions.
|
|
178
|
+
(opcode >= Instructions.READ_PRE_IMAGE && opcode <= Instructions.UNLINK_MODULE) ||
|
|
179
|
+
(opcode >= Instructions.NEW_COTHREAD && opcode <= Instructions.SWITCH_COTHREAD)
|
|
117
180
|
) {
|
|
118
181
|
prover = proverHostIo;
|
|
119
182
|
} else {
|
|
@@ -122,7 +185,18 @@ contract OneStepProofEntry is IOneStepProofEntry {
|
|
|
122
185
|
|
|
123
186
|
(mach, mod) = prover.executeOneStep(execCtx, mach, mod, inst, proof);
|
|
124
187
|
|
|
125
|
-
|
|
188
|
+
bool updateRoot = !(opcode == Instructions.LINK_MODULE ||
|
|
189
|
+
opcode == Instructions.UNLINK_MODULE);
|
|
190
|
+
if (updateRoot) {
|
|
191
|
+
mach.modulesRoot = modProof.computeRootFromModule(oldModIdx, mod);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (mach.status == MachineStatus.ERRORED && mach.recoveryPc != MachineLib.NO_RECOVERY_PC) {
|
|
195
|
+
// capture error, recover into main thread.
|
|
196
|
+
mach.switchCoThreadStacks();
|
|
197
|
+
mach.setPcFromRecovery();
|
|
198
|
+
mach.status = MachineStatus.RUNNING;
|
|
199
|
+
}
|
|
126
200
|
|
|
127
201
|
return mach.hash();
|
|
128
202
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2021-
|
|
1
|
+
// Copyright 2021-2023, Offchain Labs, Inc.
|
|
2
2
|
// For license information, see https://github.com/OffchainLabs/nitro-contracts/blob/main/LICENSE
|
|
3
3
|
// SPDX-License-Identifier: BUSL-1.1
|
|
4
4
|
|
|
@@ -11,6 +11,7 @@ import "../state/Deserialize.sol";
|
|
|
11
11
|
import "./IOneStepProver.sol";
|
|
12
12
|
|
|
13
13
|
contract OneStepProver0 is IOneStepProver {
|
|
14
|
+
using MachineLib for Machine;
|
|
14
15
|
using MerkleProofLib for MerkleProof;
|
|
15
16
|
using StackFrameLib for StackFrameWindow;
|
|
16
17
|
using ValueLib for Value;
|
|
@@ -90,28 +91,11 @@ contract OneStepProver0 is IOneStepProver {
|
|
|
90
91
|
bytes calldata
|
|
91
92
|
) internal pure {
|
|
92
93
|
StackFrame memory frame = mach.frameStack.pop();
|
|
93
|
-
|
|
94
|
-
mach.status = MachineStatus.ERRORED;
|
|
95
|
-
return;
|
|
96
|
-
} else if (frame.returnPc.valueType != ValueType.INTERNAL_REF) {
|
|
97
|
-
revert("INVALID_RETURN_PC_TYPE");
|
|
98
|
-
}
|
|
99
|
-
uint256 data = frame.returnPc.contents;
|
|
100
|
-
uint32 pc = uint32(data);
|
|
101
|
-
uint32 func = uint32(data >> 32);
|
|
102
|
-
uint32 mod = uint32(data >> 64);
|
|
103
|
-
require(data >> 96 == 0, "INVALID_RETURN_PC_DATA");
|
|
104
|
-
mach.functionPc = pc;
|
|
105
|
-
mach.functionIdx = func;
|
|
106
|
-
mach.moduleIdx = mod;
|
|
94
|
+
mach.setPc(frame.returnPc);
|
|
107
95
|
}
|
|
108
96
|
|
|
109
97
|
function createReturnValue(Machine memory mach) internal pure returns (Value memory) {
|
|
110
|
-
|
|
111
|
-
returnData |= mach.functionPc;
|
|
112
|
-
returnData |= uint256(mach.functionIdx) << 32;
|
|
113
|
-
returnData |= uint256(mach.moduleIdx) << 64;
|
|
114
|
-
return Value({valueType: ValueType.INTERNAL_REF, contents: returnData});
|
|
98
|
+
return ValueLib.newPc(mach.functionPc, mach.functionIdx, mach.moduleIdx);
|
|
115
99
|
}
|
|
116
100
|
|
|
117
101
|
function executeCall(
|
|
@@ -157,6 +141,62 @@ contract OneStepProver0 is IOneStepProver {
|
|
|
157
141
|
mach.functionPc = 0;
|
|
158
142
|
}
|
|
159
143
|
|
|
144
|
+
function executeCrossModuleForward(
|
|
145
|
+
Machine memory mach,
|
|
146
|
+
Module memory,
|
|
147
|
+
Instruction calldata inst,
|
|
148
|
+
bytes calldata
|
|
149
|
+
) internal pure {
|
|
150
|
+
// Push the return pc to the stack
|
|
151
|
+
mach.valueStack.push(createReturnValue(mach));
|
|
152
|
+
|
|
153
|
+
// Push caller's caller module info to the stack
|
|
154
|
+
StackFrame memory frame = mach.frameStack.peek();
|
|
155
|
+
mach.valueStack.push(ValueLib.newI32(frame.callerModule));
|
|
156
|
+
mach.valueStack.push(ValueLib.newI32(frame.callerModuleInternals));
|
|
157
|
+
|
|
158
|
+
// Jump to the target
|
|
159
|
+
uint32 func = uint32(inst.argumentData);
|
|
160
|
+
uint32 module = uint32(inst.argumentData >> 32);
|
|
161
|
+
require(inst.argumentData >> 64 == 0, "BAD_CROSS_MODULE_CALL_DATA");
|
|
162
|
+
mach.moduleIdx = module;
|
|
163
|
+
mach.functionIdx = func;
|
|
164
|
+
mach.functionPc = 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function executeCrossModuleInternalCall(
|
|
168
|
+
Machine memory mach,
|
|
169
|
+
Module memory mod,
|
|
170
|
+
Instruction calldata inst,
|
|
171
|
+
bytes calldata proof
|
|
172
|
+
) internal pure {
|
|
173
|
+
// Get the target from the stack
|
|
174
|
+
uint32 internalIndex = uint32(inst.argumentData);
|
|
175
|
+
uint32 moduleIndex = mach.valueStack.pop().assumeI32();
|
|
176
|
+
Module memory calledMod;
|
|
177
|
+
|
|
178
|
+
MerkleProof memory modProof;
|
|
179
|
+
uint256 offset = 0;
|
|
180
|
+
(calledMod, offset) = Deserialize.module(proof, offset);
|
|
181
|
+
(modProof, offset) = Deserialize.merkleProof(proof, offset);
|
|
182
|
+
require(
|
|
183
|
+
modProof.computeRootFromModule(moduleIndex, calledMod) == mach.modulesRoot,
|
|
184
|
+
"CROSS_MODULE_INTERNAL_MODULES_ROOT"
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
// Push the return pc to the stack
|
|
188
|
+
mach.valueStack.push(createReturnValue(mach));
|
|
189
|
+
|
|
190
|
+
// Push caller module info to the stack
|
|
191
|
+
mach.valueStack.push(ValueLib.newI32(mach.moduleIdx));
|
|
192
|
+
mach.valueStack.push(ValueLib.newI32(mod.internalsOffset));
|
|
193
|
+
|
|
194
|
+
// Jump to the target
|
|
195
|
+
mach.moduleIdx = moduleIndex;
|
|
196
|
+
mach.functionIdx = internalIndex + calledMod.internalsOffset;
|
|
197
|
+
mach.functionPc = 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
160
200
|
function executeCallerModuleInternalCall(
|
|
161
201
|
Machine memory mach,
|
|
162
202
|
Module memory mod,
|
|
@@ -454,6 +494,10 @@ contract OneStepProver0 is IOneStepProver {
|
|
|
454
494
|
impl = executeCall;
|
|
455
495
|
} else if (opcode == Instructions.CROSS_MODULE_CALL) {
|
|
456
496
|
impl = executeCrossModuleCall;
|
|
497
|
+
} else if (opcode == Instructions.CROSS_MODULE_FORWARD) {
|
|
498
|
+
impl = executeCrossModuleForward;
|
|
499
|
+
} else if (opcode == Instructions.CROSS_MODULE_INTERNAL_CALL) {
|
|
500
|
+
impl = executeCrossModuleInternalCall;
|
|
457
501
|
} else if (opcode == Instructions.CALLER_MODULE_INTERNAL_CALL) {
|
|
458
502
|
impl = executeCallerModuleInternalCall;
|
|
459
503
|
} else if (opcode == Instructions.CALL_INDIRECT) {
|