@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,54 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @title Helper contract for cross-chain deployment of deterministic factories when rollup uses custom fee token
|
|
6
|
+
* @notice It bundles sending the fee token to inbox and invoking the factory deployment function.
|
|
7
|
+
* Prerequisite: fee token must be approved for this contract to send it to inbox.
|
|
8
|
+
*/
|
|
9
|
+
contract FactoryDeployerHelper {
|
|
10
|
+
address public constant DEPLOY_HELPER = address(0x90D68B056c411015eaE3EC0b98AD94E2C91419F1);
|
|
11
|
+
uint256 public constant MAX_FEE_PER_GAS = 100_000_000;
|
|
12
|
+
|
|
13
|
+
function deploy(address inbox) external {
|
|
14
|
+
deploy(inbox, MAX_FEE_PER_GAS);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function deploy(address inbox, uint256 maxFeePerGas) public {
|
|
18
|
+
address bridge = address(IInboxBase(inbox).bridge());
|
|
19
|
+
address feeToken = IERC20Bridge(bridge).nativeToken();
|
|
20
|
+
|
|
21
|
+
uint256 amount = IDeployHelper(DEPLOY_HELPER).getDeploymentTotalCost(inbox, maxFeePerGas);
|
|
22
|
+
IERC20(feeToken).transferFrom(msg.sender, inbox, amount);
|
|
23
|
+
IDeployHelper(DEPLOY_HELPER).perform(inbox, feeToken, maxFeePerGas);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface IERC20 {
|
|
28
|
+
function transferFrom(
|
|
29
|
+
address from,
|
|
30
|
+
address to,
|
|
31
|
+
uint256 value
|
|
32
|
+
) external returns (bool);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface IDeployHelper {
|
|
36
|
+
function getDeploymentTotalCost(address inbox, uint256 maxFeePerGas)
|
|
37
|
+
external
|
|
38
|
+
view
|
|
39
|
+
returns (uint256);
|
|
40
|
+
|
|
41
|
+
function perform(
|
|
42
|
+
address _inbox,
|
|
43
|
+
address _nativeToken,
|
|
44
|
+
uint256 _maxFeePerGas
|
|
45
|
+
) external payable;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface IInboxBase {
|
|
49
|
+
function bridge() external view returns (address);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface IERC20Bridge {
|
|
53
|
+
function nativeToken() external view returns (address);
|
|
54
|
+
}
|
|
@@ -24,6 +24,8 @@ interface IRollupUserAbs is IRollupCore, IOwnable {
|
|
|
24
24
|
|
|
25
25
|
function confirmNextNode(bytes32 blockHash, bytes32 sendRoot) external;
|
|
26
26
|
|
|
27
|
+
function fastConfirmNextNode(bytes32 blockHash, bytes32 sendRoot) external;
|
|
28
|
+
|
|
27
29
|
function stakeOnExistingNode(uint64 nodeNum, bytes32 nodeHash) external;
|
|
28
30
|
|
|
29
31
|
function stakeOnNewNode(
|
|
@@ -379,4 +379,15 @@ contract RollupAdminLogic is RollupCore, IRollupAdmin, DoubleLogicUUPSUpgradeabl
|
|
|
379
379
|
validatorWhitelistDisabled = _validatorWhitelistDisabled;
|
|
380
380
|
emit OwnerFunctionCalled(30);
|
|
381
381
|
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* @notice set the anyTrustFastConfirmer address
|
|
385
|
+
* must also call `setValidator` to set the same address as a validator to work
|
|
386
|
+
* old fast confirmer need to be removed from the validator list manually
|
|
387
|
+
* @param _anyTrustFastConfirmer new value of anyTrustFastConfirmer
|
|
388
|
+
*/
|
|
389
|
+
function setAnyTrustFastConfirmer(address _anyTrustFastConfirmer) external {
|
|
390
|
+
anyTrustFastConfirmer = _anyTrustFastConfirmer;
|
|
391
|
+
emit OwnerFunctionCalled(31);
|
|
392
|
+
}
|
|
382
393
|
}
|
|
@@ -77,6 +77,7 @@ abstract contract RollupCore is IRollupCore, PausableUpgradeable {
|
|
|
77
77
|
uint64 internal constant GENESIS_NODE = 0;
|
|
78
78
|
|
|
79
79
|
bool public validatorWhitelistDisabled;
|
|
80
|
+
address public anyTrustFastConfirmer;
|
|
80
81
|
|
|
81
82
|
// If the chain this RollupCore is deployed on is an Arbitrum chain.
|
|
82
83
|
bool internal immutable _hostChainIsArbitrum = ArbitrumChecker.runningOnArbitrum();
|
|
@@ -277,10 +277,58 @@ contract RollupCreator is Ownable {
|
|
|
277
277
|
IInboxBase(_inbox),
|
|
278
278
|
_maxFeePerGas
|
|
279
279
|
);
|
|
280
|
-
|
|
280
|
+
|
|
281
|
+
// calculate the fee amount in the native token's decimals
|
|
282
|
+
uint8 decimals = ERC20(_nativeToken).decimals();
|
|
283
|
+
|
|
284
|
+
uint256 totalFeeNativeDenominated = totalFee;
|
|
285
|
+
if (decimals < 18) {
|
|
286
|
+
uint256 gasCost = _maxFeePerGas * 21_000;
|
|
287
|
+
uint256 nickCreate2Cost = _scaleDownToNativeDecimals(
|
|
288
|
+
l2FactoriesDeployer.NICK_CREATE2_VALUE() + gasCost,
|
|
289
|
+
decimals
|
|
290
|
+
);
|
|
291
|
+
uint256 erc2470Cost = _scaleDownToNativeDecimals(
|
|
292
|
+
l2FactoriesDeployer.ERC2470_VALUE() + gasCost,
|
|
293
|
+
decimals
|
|
294
|
+
);
|
|
295
|
+
uint256 zoltuCreate2Cost = _scaleDownToNativeDecimals(
|
|
296
|
+
l2FactoriesDeployer.ZOLTU_VALUE() + gasCost,
|
|
297
|
+
decimals
|
|
298
|
+
);
|
|
299
|
+
uint256 erc1820Cost = _scaleDownToNativeDecimals(
|
|
300
|
+
l2FactoriesDeployer.ERC1820_VALUE() + gasCost,
|
|
301
|
+
decimals
|
|
302
|
+
);
|
|
303
|
+
totalFeeNativeDenominated =
|
|
304
|
+
nickCreate2Cost +
|
|
305
|
+
erc2470Cost +
|
|
306
|
+
zoltuCreate2Cost +
|
|
307
|
+
erc1820Cost;
|
|
308
|
+
} else if (decimals > 18) {
|
|
309
|
+
totalFeeNativeDenominated = totalFee * (10**(decimals - 18));
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
IERC20(_nativeToken).safeTransferFrom(msg.sender, _inbox, totalFeeNativeDenominated);
|
|
281
313
|
|
|
282
314
|
// do it
|
|
283
315
|
l2FactoriesDeployer.perform(_inbox, _nativeToken, _maxFeePerGas);
|
|
284
316
|
}
|
|
285
317
|
}
|
|
318
|
+
|
|
319
|
+
function _scaleDownToNativeDecimals(uint256 amount, uint8 decimals)
|
|
320
|
+
internal
|
|
321
|
+
pure
|
|
322
|
+
returns (uint256)
|
|
323
|
+
{
|
|
324
|
+
uint256 scaledAmount = amount;
|
|
325
|
+
if (decimals < 18) {
|
|
326
|
+
scaledAmount = amount / (10**(18 - decimals));
|
|
327
|
+
// round up if necessary
|
|
328
|
+
if (scaledAmount * (10**(18 - decimals)) < amount) {
|
|
329
|
+
scaledAmount++;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return scaledAmount;
|
|
333
|
+
}
|
|
286
334
|
}
|
|
@@ -21,4 +21,12 @@ contract RollupEventInbox is AbsRollupEventInbox {
|
|
|
21
21
|
keccak256(initMsg)
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
function _currentDataCostToReport() internal view override returns (uint256) {
|
|
26
|
+
uint256 currentDataCost = block.basefee;
|
|
27
|
+
if (ArbitrumChecker.runningOnArbitrum()) {
|
|
28
|
+
currentDataCost += ArbGasInfo(address(0x6c)).getL1BaseFeeEstimate();
|
|
29
|
+
}
|
|
30
|
+
return currentDataCost;
|
|
31
|
+
}
|
|
24
32
|
}
|
|
@@ -116,29 +116,28 @@ abstract contract AbsRollupUserLogic is
|
|
|
116
116
|
emit NodeRejected(firstUnresolvedNodeNum);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
function confirmNextNode(bytes32 blockHash, bytes32 sendRoot)
|
|
125
|
-
external
|
|
126
|
-
onlyValidator
|
|
127
|
-
whenNotPaused
|
|
128
|
-
{
|
|
119
|
+
function _confirmNextNode(
|
|
120
|
+
bytes32 blockHash,
|
|
121
|
+
bytes32 sendRoot,
|
|
122
|
+
bool isFastConfirm
|
|
123
|
+
) internal {
|
|
129
124
|
requireUnresolvedExists();
|
|
130
125
|
|
|
131
126
|
uint64 nodeNum = firstUnresolvedNode();
|
|
132
127
|
Node storage node = getNodeStorage(nodeNum);
|
|
133
128
|
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
if (!isFastConfirm) {
|
|
130
|
+
// Verify the block's deadline has passed
|
|
131
|
+
node.requirePastDeadline();
|
|
132
|
+
}
|
|
136
133
|
|
|
137
134
|
// Check that prev is latest confirmed
|
|
138
135
|
assert(node.prevNum == latestConfirmed());
|
|
139
136
|
|
|
140
137
|
Node storage prevNode = getNodeStorage(node.prevNum);
|
|
141
|
-
|
|
138
|
+
if (!isFastConfirm) {
|
|
139
|
+
prevNode.requirePastChildConfirmDeadline();
|
|
140
|
+
}
|
|
142
141
|
|
|
143
142
|
removeOldZombies(0);
|
|
144
143
|
|
|
@@ -155,6 +154,29 @@ abstract contract AbsRollupUserLogic is
|
|
|
155
154
|
confirmNode(nodeNum, blockHash, sendRoot);
|
|
156
155
|
}
|
|
157
156
|
|
|
157
|
+
/**
|
|
158
|
+
* @notice Confirm the next unresolved node
|
|
159
|
+
* @param blockHash The block hash at the end of the assertion
|
|
160
|
+
* @param sendRoot The send root at the end of the assertion
|
|
161
|
+
*/
|
|
162
|
+
function confirmNextNode(bytes32 blockHash, bytes32 sendRoot)
|
|
163
|
+
external
|
|
164
|
+
onlyValidator
|
|
165
|
+
whenNotPaused
|
|
166
|
+
{
|
|
167
|
+
_confirmNextNode(blockHash, sendRoot, false);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @notice This allow anyTrustFastConfirmer to confirm next node regardless of deadline
|
|
172
|
+
* the anyTrustFastConfirmer is supposed to be set only on an AnyTrust chain to
|
|
173
|
+
* a contract that can call this function when received sufficient signatures
|
|
174
|
+
*/
|
|
175
|
+
function fastConfirmNextNode(bytes32 blockHash, bytes32 sendRoot) external whenNotPaused {
|
|
176
|
+
require(msg.sender == anyTrustFastConfirmer, "NOT_FAST_CONFIRMER");
|
|
177
|
+
_confirmNextNode(blockHash, sendRoot, true);
|
|
178
|
+
}
|
|
179
|
+
|
|
158
180
|
/**
|
|
159
181
|
* @notice Create a new stake
|
|
160
182
|
* @param depositAmount The amount of either eth or tokens staked
|
|
@@ -7,6 +7,7 @@ pragma solidity ^0.8.0;
|
|
|
7
7
|
import "./Value.sol";
|
|
8
8
|
import "./ValueStack.sol";
|
|
9
9
|
import "./Machine.sol";
|
|
10
|
+
import "./MultiStack.sol";
|
|
10
11
|
import "./Instructions.sol";
|
|
11
12
|
import "./StackFrame.sol";
|
|
12
13
|
import "./MerkleProof.sol";
|
|
@@ -88,6 +89,16 @@ library Deserialize {
|
|
|
88
89
|
ret = bytes32(retInt);
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
function boolean(bytes calldata proof, uint256 startOffset)
|
|
93
|
+
internal
|
|
94
|
+
pure
|
|
95
|
+
returns (bool ret, uint256 offset)
|
|
96
|
+
{
|
|
97
|
+
offset = startOffset;
|
|
98
|
+
ret = uint8(proof[offset]) != 0;
|
|
99
|
+
offset++;
|
|
100
|
+
}
|
|
101
|
+
|
|
91
102
|
function value(bytes calldata proof, uint256 startOffset)
|
|
92
103
|
internal
|
|
93
104
|
pure
|
|
@@ -119,17 +130,39 @@ library Deserialize {
|
|
|
119
130
|
stack = ValueStack({proved: ValueArray(proved), remainingHash: remainingHash});
|
|
120
131
|
}
|
|
121
132
|
|
|
122
|
-
function
|
|
133
|
+
function multiStack(bytes calldata proof, uint256 startOffset)
|
|
123
134
|
internal
|
|
124
135
|
pure
|
|
125
|
-
returns (
|
|
136
|
+
returns (MultiStack memory multistack, uint256 offset)
|
|
126
137
|
{
|
|
127
138
|
offset = startOffset;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
(
|
|
132
|
-
|
|
139
|
+
bytes32 inactiveStackHash;
|
|
140
|
+
(inactiveStackHash, offset) = b32(proof, offset);
|
|
141
|
+
bytes32 remainingHash;
|
|
142
|
+
(remainingHash, offset) = b32(proof, offset);
|
|
143
|
+
multistack = MultiStack({
|
|
144
|
+
inactiveStackHash: inactiveStackHash,
|
|
145
|
+
remainingHash: remainingHash
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function instructions(bytes calldata proof, uint256 startOffset)
|
|
150
|
+
internal
|
|
151
|
+
pure
|
|
152
|
+
returns (Instruction[] memory code, uint256 offset)
|
|
153
|
+
{
|
|
154
|
+
offset = startOffset;
|
|
155
|
+
uint8 count;
|
|
156
|
+
(count, offset) = u8(proof, offset);
|
|
157
|
+
code = new Instruction[](count);
|
|
158
|
+
|
|
159
|
+
for (uint256 i = 0; i < uint256(count); i++) {
|
|
160
|
+
uint16 opcode;
|
|
161
|
+
uint256 data;
|
|
162
|
+
(opcode, offset) = u16(proof, offset);
|
|
163
|
+
(data, offset) = u256(proof, offset);
|
|
164
|
+
code[i] = Instruction({opcode: opcode, argumentData: data});
|
|
165
|
+
}
|
|
133
166
|
}
|
|
134
167
|
|
|
135
168
|
function stackFrame(bytes calldata proof, uint256 startOffset)
|
|
@@ -199,17 +232,20 @@ library Deserialize {
|
|
|
199
232
|
ModuleMemory memory mem;
|
|
200
233
|
bytes32 tablesMerkleRoot;
|
|
201
234
|
bytes32 functionsMerkleRoot;
|
|
235
|
+
bytes32 extraHash;
|
|
202
236
|
uint32 internalsOffset;
|
|
203
237
|
(globalsMerkleRoot, offset) = b32(proof, offset);
|
|
204
238
|
(mem, offset) = moduleMemory(proof, offset);
|
|
205
239
|
(tablesMerkleRoot, offset) = b32(proof, offset);
|
|
206
240
|
(functionsMerkleRoot, offset) = b32(proof, offset);
|
|
241
|
+
(extraHash, offset) = b32(proof, offset);
|
|
207
242
|
(internalsOffset, offset) = u32(proof, offset);
|
|
208
243
|
mod = Module({
|
|
209
244
|
globalsMerkleRoot: globalsMerkleRoot,
|
|
210
245
|
moduleMemory: mem,
|
|
211
246
|
tablesMerkleRoot: tablesMerkleRoot,
|
|
212
247
|
functionsMerkleRoot: functionsMerkleRoot,
|
|
248
|
+
extraHash: extraHash,
|
|
213
249
|
internalsOffset: internalsOffset
|
|
214
250
|
});
|
|
215
251
|
}
|
|
@@ -240,49 +276,54 @@ library Deserialize {
|
|
|
240
276
|
returns (Machine memory mach, uint256 offset)
|
|
241
277
|
{
|
|
242
278
|
offset = startOffset;
|
|
243
|
-
MachineStatus status;
|
|
244
279
|
{
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
280
|
+
MachineStatus status;
|
|
281
|
+
{
|
|
282
|
+
uint8 statusU8;
|
|
283
|
+
(statusU8, offset) = u8(proof, offset);
|
|
284
|
+
if (statusU8 == 0) {
|
|
285
|
+
status = MachineStatus.RUNNING;
|
|
286
|
+
} else if (statusU8 == 1) {
|
|
287
|
+
status = MachineStatus.FINISHED;
|
|
288
|
+
} else if (statusU8 == 2) {
|
|
289
|
+
status = MachineStatus.ERRORED;
|
|
290
|
+
} else if (statusU8 == 3) {
|
|
291
|
+
status = MachineStatus.TOO_FAR;
|
|
292
|
+
} else {
|
|
293
|
+
revert("UNKNOWN_MACH_STATUS");
|
|
294
|
+
}
|
|
257
295
|
}
|
|
296
|
+
ValueStack memory values;
|
|
297
|
+
ValueStack memory internalStack;
|
|
298
|
+
MultiStack memory valuesMulti;
|
|
299
|
+
StackFrameWindow memory frameStack;
|
|
300
|
+
MultiStack memory framesMulti;
|
|
301
|
+
(values, offset) = valueStack(proof, offset);
|
|
302
|
+
(valuesMulti, offset) = multiStack(proof, offset);
|
|
303
|
+
(internalStack, offset) = valueStack(proof, offset);
|
|
304
|
+
(frameStack, offset) = stackFrameWindow(proof, offset);
|
|
305
|
+
(framesMulti, offset) = multiStack(proof, offset);
|
|
306
|
+
mach = Machine({
|
|
307
|
+
status: status,
|
|
308
|
+
valueStack: values,
|
|
309
|
+
valueMultiStack: valuesMulti,
|
|
310
|
+
internalStack: internalStack,
|
|
311
|
+
frameStack: frameStack,
|
|
312
|
+
frameMultiStack: framesMulti,
|
|
313
|
+
globalStateHash: bytes32(0), // filled later
|
|
314
|
+
moduleIdx: 0, // filled later
|
|
315
|
+
functionIdx: 0, // filled later
|
|
316
|
+
functionPc: 0, // filled later
|
|
317
|
+
recoveryPc: bytes32(0), // filled later
|
|
318
|
+
modulesRoot: bytes32(0) // filled later
|
|
319
|
+
});
|
|
258
320
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
StackFrameWindow memory frameStack;
|
|
266
|
-
bytes32 modulesRoot;
|
|
267
|
-
(values, offset) = valueStack(proof, offset);
|
|
268
|
-
(internalStack, offset) = valueStack(proof, offset);
|
|
269
|
-
(frameStack, offset) = stackFrameWindow(proof, offset);
|
|
270
|
-
(globalStateHash, offset) = b32(proof, offset);
|
|
271
|
-
(moduleIdx, offset) = u32(proof, offset);
|
|
272
|
-
(functionIdx, offset) = u32(proof, offset);
|
|
273
|
-
(functionPc, offset) = u32(proof, offset);
|
|
274
|
-
(modulesRoot, offset) = b32(proof, offset);
|
|
275
|
-
mach = Machine({
|
|
276
|
-
status: status,
|
|
277
|
-
valueStack: values,
|
|
278
|
-
internalStack: internalStack,
|
|
279
|
-
frameStack: frameStack,
|
|
280
|
-
globalStateHash: globalStateHash,
|
|
281
|
-
moduleIdx: moduleIdx,
|
|
282
|
-
functionIdx: functionIdx,
|
|
283
|
-
functionPc: functionPc,
|
|
284
|
-
modulesRoot: modulesRoot
|
|
285
|
-
});
|
|
321
|
+
(mach.globalStateHash, offset) = b32(proof, offset);
|
|
322
|
+
(mach.moduleIdx, offset) = u32(proof, offset);
|
|
323
|
+
(mach.functionIdx, offset) = u32(proof, offset);
|
|
324
|
+
(mach.functionPc, offset) = u32(proof, offset);
|
|
325
|
+
(mach.recoveryPc, offset) = b32(proof, offset);
|
|
326
|
+
(mach.modulesRoot, offset) = b32(proof, offset);
|
|
286
327
|
}
|
|
287
328
|
|
|
288
329
|
function merkleProof(bytes calldata proof, uint256 startOffset)
|
|
@@ -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
|
|
|
@@ -134,6 +134,8 @@ library Instructions {
|
|
|
134
134
|
uint16 internal constant DUP = 0x8008;
|
|
135
135
|
uint16 internal constant CROSS_MODULE_CALL = 0x8009;
|
|
136
136
|
uint16 internal constant CALLER_MODULE_INTERNAL_CALL = 0x800A;
|
|
137
|
+
uint16 internal constant CROSS_MODULE_FORWARD = 0x800B;
|
|
138
|
+
uint16 internal constant CROSS_MODULE_INTERNAL_CALL = 0x800C;
|
|
137
139
|
|
|
138
140
|
uint16 internal constant GET_GLOBAL_STATE_BYTES32 = 0x8010;
|
|
139
141
|
uint16 internal constant SET_GLOBAL_STATE_BYTES32 = 0x8011;
|
|
@@ -143,11 +145,44 @@ library Instructions {
|
|
|
143
145
|
uint16 internal constant READ_PRE_IMAGE = 0x8020;
|
|
144
146
|
uint16 internal constant READ_INBOX_MESSAGE = 0x8021;
|
|
145
147
|
uint16 internal constant HALT_AND_SET_FINISHED = 0x8022;
|
|
148
|
+
uint16 internal constant LINK_MODULE = 0x8023;
|
|
149
|
+
uint16 internal constant UNLINK_MODULE = 0x8024;
|
|
150
|
+
|
|
151
|
+
uint16 internal constant NEW_COTHREAD = 0x8030;
|
|
152
|
+
uint16 internal constant POP_COTHREAD = 0x8031;
|
|
153
|
+
uint16 internal constant SWITCH_COTHREAD = 0x8032;
|
|
146
154
|
|
|
147
155
|
uint256 internal constant INBOX_INDEX_SEQUENCER = 0;
|
|
148
156
|
uint256 internal constant INBOX_INDEX_DELAYED = 1;
|
|
149
157
|
|
|
150
|
-
function hash(Instruction memory
|
|
151
|
-
|
|
158
|
+
function hash(Instruction[] memory code) internal pure returns (bytes32) {
|
|
159
|
+
// To avoid quadratic expense, we declare a `bytes` early and populate its contents.
|
|
160
|
+
bytes memory data = new bytes(13 + 1 + 34 * code.length);
|
|
161
|
+
assembly {
|
|
162
|
+
// Represents the string "Instructions:", which we place after the length word.
|
|
163
|
+
mstore(
|
|
164
|
+
add(data, 32),
|
|
165
|
+
0x496e737472756374696f6e733a00000000000000000000000000000000000000
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// write the instruction count
|
|
170
|
+
uint256 offset = 13;
|
|
171
|
+
data[offset] = bytes1(uint8(code.length));
|
|
172
|
+
offset++;
|
|
173
|
+
|
|
174
|
+
// write each instruction
|
|
175
|
+
for (uint256 i = 0; i < code.length; i++) {
|
|
176
|
+
Instruction memory inst = code[i];
|
|
177
|
+
data[offset] = bytes1(uint8(inst.opcode >> 8));
|
|
178
|
+
data[offset + 1] = bytes1(uint8(inst.opcode));
|
|
179
|
+
offset += 2;
|
|
180
|
+
uint256 argumentData = inst.argumentData;
|
|
181
|
+
assembly {
|
|
182
|
+
mstore(add(add(data, 32), offset), argumentData)
|
|
183
|
+
}
|
|
184
|
+
offset += 32;
|
|
185
|
+
}
|
|
186
|
+
return keccak256(data);
|
|
152
187
|
}
|
|
153
188
|
}
|
package/src/state/Machine.sol
CHANGED
|
@@ -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
|
|
|
@@ -6,6 +6,7 @@ pragma solidity ^0.8.0;
|
|
|
6
6
|
|
|
7
7
|
import "./ValueStack.sol";
|
|
8
8
|
import "./Instructions.sol";
|
|
9
|
+
import "./MultiStack.sol";
|
|
9
10
|
import "./StackFrame.sol";
|
|
10
11
|
|
|
11
12
|
enum MachineStatus {
|
|
@@ -18,36 +19,49 @@ enum MachineStatus {
|
|
|
18
19
|
struct Machine {
|
|
19
20
|
MachineStatus status;
|
|
20
21
|
ValueStack valueStack;
|
|
22
|
+
MultiStack valueMultiStack;
|
|
21
23
|
ValueStack internalStack;
|
|
22
24
|
StackFrameWindow frameStack;
|
|
25
|
+
MultiStack frameMultiStack;
|
|
23
26
|
bytes32 globalStateHash;
|
|
24
27
|
uint32 moduleIdx;
|
|
25
28
|
uint32 functionIdx;
|
|
26
29
|
uint32 functionPc;
|
|
30
|
+
bytes32 recoveryPc;
|
|
27
31
|
bytes32 modulesRoot;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
library MachineLib {
|
|
31
35
|
using StackFrameLib for StackFrameWindow;
|
|
32
36
|
using ValueStackLib for ValueStack;
|
|
37
|
+
using MultiStackLib for MultiStack;
|
|
38
|
+
|
|
39
|
+
bytes32 internal constant NO_RECOVERY_PC = ~bytes32(0);
|
|
33
40
|
|
|
34
41
|
function hash(Machine memory mach) internal pure returns (bytes32) {
|
|
35
42
|
// Warning: the non-running hashes are replicated in Challenge
|
|
36
43
|
if (mach.status == MachineStatus.RUNNING) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
bytes32 valueMultiHash = mach.valueMultiStack.hash(
|
|
45
|
+
mach.valueStack.hash(),
|
|
46
|
+
mach.recoveryPc != NO_RECOVERY_PC
|
|
47
|
+
);
|
|
48
|
+
bytes32 frameMultiHash = mach.frameMultiStack.hash(
|
|
49
|
+
mach.frameStack.hash(),
|
|
50
|
+
mach.recoveryPc != NO_RECOVERY_PC
|
|
51
|
+
);
|
|
52
|
+
bytes memory preimage = abi.encodePacked(
|
|
53
|
+
"Machine running:",
|
|
54
|
+
valueMultiHash,
|
|
55
|
+
mach.internalStack.hash(),
|
|
56
|
+
frameMultiHash,
|
|
57
|
+
mach.globalStateHash,
|
|
58
|
+
mach.moduleIdx,
|
|
59
|
+
mach.functionIdx,
|
|
60
|
+
mach.functionPc,
|
|
61
|
+
mach.recoveryPc,
|
|
62
|
+
mach.modulesRoot
|
|
63
|
+
);
|
|
64
|
+
return keccak256(preimage);
|
|
51
65
|
} else if (mach.status == MachineStatus.FINISHED) {
|
|
52
66
|
return keccak256(abi.encodePacked("Machine finished:", mach.globalStateHash));
|
|
53
67
|
} else if (mach.status == MachineStatus.ERRORED) {
|
|
@@ -58,4 +72,67 @@ library MachineLib {
|
|
|
58
72
|
revert("BAD_MACH_STATUS");
|
|
59
73
|
}
|
|
60
74
|
}
|
|
75
|
+
|
|
76
|
+
function switchCoThreadStacks(Machine memory mach) internal pure {
|
|
77
|
+
bytes32 newActiveValue = mach.valueMultiStack.inactiveStackHash;
|
|
78
|
+
bytes32 newActiveFrame = mach.frameMultiStack.inactiveStackHash;
|
|
79
|
+
if (
|
|
80
|
+
newActiveFrame == MultiStackLib.NO_STACK_HASH ||
|
|
81
|
+
newActiveValue == MultiStackLib.NO_STACK_HASH
|
|
82
|
+
) {
|
|
83
|
+
mach.status = MachineStatus.ERRORED;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
mach.frameMultiStack.inactiveStackHash = mach.frameStack.hash();
|
|
87
|
+
mach.valueMultiStack.inactiveStackHash = mach.valueStack.hash();
|
|
88
|
+
mach.frameStack.overwrite(newActiveFrame);
|
|
89
|
+
mach.valueStack.overwrite(newActiveValue);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function setPcFromData(Machine memory mach, uint256 data) internal pure returns (bool) {
|
|
93
|
+
if (data >> 96 != 0) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
mach.functionPc = uint32(data);
|
|
98
|
+
mach.functionIdx = uint32(data >> 32);
|
|
99
|
+
mach.moduleIdx = uint32(data >> 64);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function setPcFromRecovery(Machine memory mach) internal pure returns (bool) {
|
|
104
|
+
if (!setPcFromData(mach, uint256(mach.recoveryPc))) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
mach.recoveryPc = NO_RECOVERY_PC;
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function setRecoveryFromPc(Machine memory mach, uint32 offset) internal pure returns (bool) {
|
|
112
|
+
if (mach.recoveryPc != NO_RECOVERY_PC) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
uint256 result;
|
|
117
|
+
result = uint256(mach.moduleIdx) << 64;
|
|
118
|
+
result = result | (uint256(mach.functionIdx) << 32);
|
|
119
|
+
result = result | uint256(mach.functionPc + offset - 1);
|
|
120
|
+
mach.recoveryPc = bytes32(result);
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function setPc(Machine memory mach, Value memory pc) internal pure {
|
|
125
|
+
if (pc.valueType == ValueType.REF_NULL) {
|
|
126
|
+
mach.status = MachineStatus.ERRORED;
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (pc.valueType != ValueType.INTERNAL_REF) {
|
|
130
|
+
mach.status = MachineStatus.ERRORED;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (!setPcFromData(mach, pc.contents)) {
|
|
134
|
+
mach.status = MachineStatus.ERRORED;
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
61
138
|
}
|
|
@@ -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
|
|
|
@@ -24,12 +24,12 @@ library MerkleProofLib {
|
|
|
24
24
|
return computeRootUnsafe(proof, index, leaf.hash(), "Value merkle tree:");
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
function
|
|
27
|
+
function computeRootFromInstructions(
|
|
28
28
|
MerkleProof memory proof,
|
|
29
29
|
uint256 index,
|
|
30
|
-
Instruction memory
|
|
30
|
+
Instruction[] memory code
|
|
31
31
|
) internal pure returns (bytes32) {
|
|
32
|
-
return computeRootUnsafe(proof, index, Instructions.hash(
|
|
32
|
+
return computeRootUnsafe(proof, index, Instructions.hash(code), "Instruction merkle tree:");
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function computeRootFromFunction(
|
|
@@ -95,5 +95,23 @@ library MerkleProofLib {
|
|
|
95
95
|
}
|
|
96
96
|
index >>= 1;
|
|
97
97
|
}
|
|
98
|
+
require(index == 0, "PROOF_TOO_SHORT");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function growToNewRoot(
|
|
102
|
+
bytes32 root,
|
|
103
|
+
uint256 leaf,
|
|
104
|
+
bytes32 hash,
|
|
105
|
+
bytes32 zero,
|
|
106
|
+
string memory prefix
|
|
107
|
+
) internal pure returns (bytes32) {
|
|
108
|
+
bytes32 h = hash;
|
|
109
|
+
uint256 node = leaf;
|
|
110
|
+
while (node > 1) {
|
|
111
|
+
h = keccak256(abi.encodePacked(prefix, h, zero));
|
|
112
|
+
zero = keccak256(abi.encodePacked(prefix, zero, zero));
|
|
113
|
+
node >>= 1;
|
|
114
|
+
}
|
|
115
|
+
return keccak256(abi.encodePacked(prefix, root, h));
|
|
98
116
|
}
|
|
99
117
|
}
|