@arbitrum/nitro-contracts 1.2.1 → 2.0.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/ERC1967Proxy.sol/ERC1967Proxy.json +2 -2
- 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/beacon/UpgradeableBeacon.sol/UpgradeableBeacon.json +2 -2
- package/build/contracts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +2 -2
- package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +2 -2
- 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/ERC20.sol/ERC20.json +2 -2
- 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/extensions/draft-IERC20Permit.sol/IERC20Permit.dbg.json +4 -0
- package/build/contracts/@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol/IERC20Permit.json +86 -0
- package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol/SafeERC20.json +2 -2
- package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts/utils/Address.sol/Address.json +2 -2
- 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/StorageSlot.sol/StorageSlot.json +2 -2
- 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/AccessControlUpgradeable.sol/AccessControlUpgradeable.json +13 -0
- 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/access/OwnableUpgradeable.sol/OwnableUpgradeable.json +13 -0
- package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol/Initializable.json +15 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol/PausableUpgradeable.json +13 -0
- 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/AddressUpgradeable.sol/AddressUpgradeable.json +2 -2
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol/ContextUpgradeable.json +15 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol/StorageSlotUpgradeable.json +2 -2
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol/StringsUpgradeable.json +2 -2
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.dbg.json +1 -1
- package/build/contracts/@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol/ERC165Upgradeable.json +13 -0
- 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/AbsBridge.sol/AbsBridge.json +13 -0
- package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.dbg.json +1 -1
- package/build/contracts/src/bridge/AbsInbox.sol/AbsInbox.json +13 -0
- 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 +15 -2
- package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.dbg.json +1 -1
- package/build/contracts/src/bridge/ERC20Bridge.sol/ERC20Bridge.json +15 -2
- package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.dbg.json +1 -1
- package/build/contracts/src/bridge/ERC20Inbox.sol/ERC20Inbox.json +15 -2
- package/build/contracts/src/bridge/ERC20Outbox.sol/ERC20Outbox.dbg.json +1 -1
- package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.dbg.json +1 -1
- package/build/contracts/src/bridge/GasRefunder.sol/GasRefunder.json +2 -2
- package/build/contracts/src/bridge/IBridge.sol/IBridge.dbg.json +1 -1
- package/build/contracts/src/bridge/IDelayedMessageProvider.sol/IDelayedMessageProvider.dbg.json +1 -1
- package/build/contracts/src/bridge/IERC20Bridge.sol/IERC20Bridge.dbg.json +1 -1
- package/build/contracts/src/bridge/IERC20Inbox.sol/IERC20Inbox.dbg.json +1 -1
- package/build/contracts/src/bridge/IEthBridge.sol/IEthBridge.dbg.json +1 -1
- package/build/contracts/src/bridge/IInbox.sol/IInbox.dbg.json +1 -1
- package/build/contracts/src/bridge/IInboxBase.sol/IInboxBase.dbg.json +1 -1
- package/build/contracts/src/bridge/IOutbox.sol/IOutbox.dbg.json +1 -1
- package/build/contracts/src/bridge/IOwnable.sol/IOwnable.dbg.json +1 -1
- package/build/contracts/src/bridge/ISequencerInbox.sol/ISequencerInbox.dbg.json +1 -1
- package/build/contracts/src/bridge/Inbox.sol/Inbox.dbg.json +1 -1
- package/build/contracts/src/bridge/Inbox.sol/Inbox.json +15 -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/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 +490 -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/AdminFallbackProxy.json +2 -2
- package/build/contracts/src/libraries/AdminFallbackProxy.sol/DoubleLogicERC1967Upgrade.dbg.json +1 -1
- package/build/contracts/src/libraries/ArbitrumChecker.sol/ArbitrumChecker.dbg.json +1 -1
- package/build/contracts/src/libraries/CryptographyPrimitives.sol/CryptographyPrimitives.dbg.json +1 -1
- package/build/contracts/src/libraries/DelegateCallAware.sol/DelegateCallAware.dbg.json +1 -1
- package/build/contracts/src/libraries/DoubleLogicUUPSUpgradeable.sol/DoubleLogicUUPSUpgradeable.dbg.json +1 -1
- package/build/contracts/src/libraries/GasRefundEnabled.sol/GasRefundEnabled.dbg.json +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/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/BridgeUnproxied.sol/BridgeUnproxied.dbg.json +1 -1
- package/build/contracts/src/mocks/BridgeUnproxied.sol/BridgeUnproxied.json +15 -2
- package/build/contracts/src/mocks/InboxStub.sol/InboxStub.dbg.json +1 -1
- 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/ProxyAdminForBinding.sol/ProxyAdminForBinding.json +2 -2
- 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/SimpleProxy.sol/SimpleProxy.json +2 -2
- 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/mocks/UpgradeExecutorMock.sol/UpgradeExecutorMock.json +15 -2
- 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 +113 -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/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/IRollupUserAbs.dbg.json +1 -1
- package/build/contracts/src/rollup/IRollupLogic.sol/IRollupUserERC20.dbg.json +1 -1
- package/build/contracts/src/rollup/Node.sol/NodeLib.dbg.json +1 -1
- package/build/contracts/src/rollup/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 +15 -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/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 +13 -0
- package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupUserLogic.sol/ERC20RollupUserLogic.json +15 -2
- package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.dbg.json +1 -1
- package/build/contracts/src/rollup/RollupUserLogic.sol/RollupUserLogic.json +15 -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 +15 -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 +15 -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/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/TestToken.sol/TestToken.json +2 -2
- 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 +13 -7
- package/src/chain/CacheManager.sol +283 -0
- package/src/challenge/ChallengeLib.sol +0 -45
- package/src/challenge/ChallengeManager.sol +24 -9
- package/src/challenge/IChallengeManager.sol +13 -0
- package/src/mocks/Benchmarks.sol +52 -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/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 +33 -0
- 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
@@ -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
|
}
|
package/src/state/Module.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
|
|
@@ -11,6 +11,7 @@ struct Module {
|
|
11
11
|
ModuleMemory moduleMemory;
|
12
12
|
bytes32 tablesMerkleRoot;
|
13
13
|
bytes32 functionsMerkleRoot;
|
14
|
+
bytes32 extraHash;
|
14
15
|
uint32 internalsOffset;
|
15
16
|
}
|
16
17
|
|
@@ -26,6 +27,7 @@ library ModuleLib {
|
|
26
27
|
mod.moduleMemory.hash(),
|
27
28
|
mod.tablesMerkleRoot,
|
28
29
|
mod.functionsMerkleRoot,
|
30
|
+
mod.extraHash,
|
29
31
|
mod.internalsOffset
|
30
32
|
)
|
31
33
|
);
|
@@ -11,6 +11,8 @@ import "./ModuleMemoryCompact.sol";
|
|
11
11
|
library ModuleMemoryLib {
|
12
12
|
using MerkleProofLib for MerkleProof;
|
13
13
|
|
14
|
+
uint256 private constant LEAF_SIZE = 32;
|
15
|
+
|
14
16
|
function hash(ModuleMemory memory mem) internal pure returns (bytes32) {
|
15
17
|
return ModuleMemoryCompactLib.hash(mem);
|
16
18
|
}
|
@@ -35,4 +37,56 @@ library ModuleMemoryLib {
|
|
35
37
|
bytes32 recomputedRoot = merkle.computeRootFromMemory(leafIdx, contents);
|
36
38
|
require(recomputedRoot == mem.merkleRoot, "WRONG_MEM_ROOT");
|
37
39
|
}
|
40
|
+
|
41
|
+
function isValidLeaf(ModuleMemory memory mem, uint256 pointer) internal pure returns (bool) {
|
42
|
+
return pointer + 32 <= mem.size && pointer % LEAF_SIZE == 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
function pullLeafByte(bytes32 leaf, uint256 idx) internal pure returns (uint8) {
|
46
|
+
require(idx < LEAF_SIZE, "BAD_PULL_LEAF_BYTE_IDX");
|
47
|
+
// Take into account that we are casting the leaf to a big-endian integer
|
48
|
+
uint256 leafShift = (LEAF_SIZE - 1 - idx) * 8;
|
49
|
+
return uint8(uint256(leaf) >> leafShift);
|
50
|
+
}
|
51
|
+
|
52
|
+
// loads a big-endian value from memory
|
53
|
+
function load(
|
54
|
+
ModuleMemory memory mem,
|
55
|
+
uint256 start,
|
56
|
+
uint256 width,
|
57
|
+
bytes calldata proof,
|
58
|
+
uint256 proofOffset
|
59
|
+
)
|
60
|
+
internal
|
61
|
+
pure
|
62
|
+
returns (
|
63
|
+
bool err,
|
64
|
+
uint256 value,
|
65
|
+
uint256 offset
|
66
|
+
)
|
67
|
+
{
|
68
|
+
if (start + width > mem.size) {
|
69
|
+
return (true, 0, proofOffset);
|
70
|
+
}
|
71
|
+
|
72
|
+
uint256 lastProvedLeafIdx = ~uint256(0);
|
73
|
+
bytes32 lastProvedLeafContents;
|
74
|
+
uint256 readValue;
|
75
|
+
for (uint256 i = 0; i < width; i++) {
|
76
|
+
uint256 idx = start + i;
|
77
|
+
uint256 leafIdx = idx / LEAF_SIZE;
|
78
|
+
if (leafIdx != lastProvedLeafIdx) {
|
79
|
+
(lastProvedLeafContents, proofOffset, ) = proveLeaf(
|
80
|
+
mem,
|
81
|
+
leafIdx,
|
82
|
+
proof,
|
83
|
+
proofOffset
|
84
|
+
);
|
85
|
+
lastProvedLeafIdx = leafIdx;
|
86
|
+
}
|
87
|
+
uint256 indexWithinLeaf = idx % LEAF_SIZE;
|
88
|
+
readValue |= uint256(pullLeafByte(lastProvedLeafContents, indexWithinLeaf)) << (i * 8);
|
89
|
+
}
|
90
|
+
return (false, readValue, proofOffset);
|
91
|
+
}
|
38
92
|
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
// Copyright 2021-2024, 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
|
+
struct MultiStack {
|
8
|
+
bytes32 inactiveStackHash; // NO_STACK_HASH if no stack, 0 if empty stack
|
9
|
+
bytes32 remainingHash; // 0 if less than 2 cothreads exist
|
10
|
+
}
|
11
|
+
|
12
|
+
library MultiStackLib {
|
13
|
+
bytes32 internal constant NO_STACK_HASH = ~bytes32(0);
|
14
|
+
|
15
|
+
function hash(
|
16
|
+
MultiStack memory multi,
|
17
|
+
bytes32 activeStackHash,
|
18
|
+
bool cothread
|
19
|
+
) internal pure returns (bytes32) {
|
20
|
+
require(activeStackHash != NO_STACK_HASH, "MULTISTACK_NOSTACK_ACTIVE");
|
21
|
+
if (cothread) {
|
22
|
+
require(multi.inactiveStackHash != NO_STACK_HASH, "MULTISTACK_NOSTACK_MAIN");
|
23
|
+
return
|
24
|
+
keccak256(
|
25
|
+
abi.encodePacked(
|
26
|
+
"multistack:",
|
27
|
+
multi.inactiveStackHash,
|
28
|
+
activeStackHash,
|
29
|
+
multi.remainingHash
|
30
|
+
)
|
31
|
+
);
|
32
|
+
} else {
|
33
|
+
return
|
34
|
+
keccak256(
|
35
|
+
abi.encodePacked(
|
36
|
+
"multistack:",
|
37
|
+
activeStackHash,
|
38
|
+
multi.inactiveStackHash,
|
39
|
+
multi.remainingHash
|
40
|
+
)
|
41
|
+
);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
function setEmpty(MultiStack memory multi) internal pure {
|
46
|
+
multi.inactiveStackHash = NO_STACK_HASH;
|
47
|
+
multi.remainingHash = 0;
|
48
|
+
}
|
49
|
+
|
50
|
+
function pushNew(MultiStack memory multi) internal pure {
|
51
|
+
if (multi.inactiveStackHash != NO_STACK_HASH) {
|
52
|
+
multi.remainingHash = keccak256(
|
53
|
+
abi.encodePacked("cothread:", multi.inactiveStackHash, multi.remainingHash)
|
54
|
+
);
|
55
|
+
}
|
56
|
+
multi.inactiveStackHash = 0;
|
57
|
+
}
|
58
|
+
}
|
package/src/state/StackFrame.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
|
|
@@ -60,4 +60,9 @@ library StackFrameLib {
|
|
60
60
|
newProved[window.proved.length] = frame;
|
61
61
|
window.proved = newProved;
|
62
62
|
}
|
63
|
+
|
64
|
+
function overwrite(StackFrameWindow memory window, bytes32 root) internal pure {
|
65
|
+
window.remainingHash = root;
|
66
|
+
delete window.proved;
|
67
|
+
}
|
63
68
|
}
|
package/src/state/Value.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
|
|
@@ -61,4 +61,16 @@ library ValueLib {
|
|
61
61
|
return newI32(uint32(0));
|
62
62
|
}
|
63
63
|
}
|
64
|
+
|
65
|
+
function newPc(
|
66
|
+
uint32 funcPc,
|
67
|
+
uint32 func,
|
68
|
+
uint32 module
|
69
|
+
) internal pure returns (Value memory) {
|
70
|
+
uint256 data = 0;
|
71
|
+
data |= funcPc;
|
72
|
+
data |= uint256(func) << 32;
|
73
|
+
data |= uint256(module) << 64;
|
74
|
+
return Value({valueType: ValueType.INTERNAL_REF, contents: data});
|
75
|
+
}
|
64
76
|
}
|
package/src/state/ValueStack.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
|
|
@@ -36,4 +36,9 @@ library ValueStackLib {
|
|
36
36
|
function push(ValueStack memory stack, Value memory val) internal pure {
|
37
37
|
return stack.proved.push(val);
|
38
38
|
}
|
39
|
+
|
40
|
+
function overwrite(ValueStack memory stack, bytes32 root) internal pure {
|
41
|
+
stack.remainingHash = root;
|
42
|
+
delete stack.proved;
|
43
|
+
}
|
39
44
|
}
|