diff --git a/packages/protocol/.solhint.json b/packages/protocol/.solhint.json index 3bdc8bc7fc0..ce3716cc9d3 100644 --- a/packages/protocol/.solhint.json +++ b/packages/protocol/.solhint.json @@ -10,7 +10,6 @@ "not-rely-on-time": "off", "ordering": "warn", "payable-fallback": "off", - "no-console": "off", - "one-contract-per-file": "off" + "no-console": "off" } } diff --git a/packages/protocol/.solhintignore b/packages/protocol/.solhintignore index ef1c8c9a147..0ae2b08dfc4 100644 --- a/packages/protocol/.solhintignore +++ b/packages/protocol/.solhintignore @@ -1,7 +1,6 @@ node_modules/ lib/ contracts/test/TestLibRLPReader.sol -contracts/test/TestLibRLPWriter.sol **/contracts/thirdparty/**/*.sol test/GasComparison.t.sol test/TestLn.sol \ No newline at end of file diff --git a/packages/protocol/CHANGELOG.md b/packages/protocol/CHANGELOG.md index df77fbdd7cf..0962c1b1434 100644 --- a/packages/protocol/CHANGELOG.md +++ b/packages/protocol/CHANGELOG.md @@ -211,7 +211,7 @@ - **protocol:** add special logics for alpha-2 testnet ([#12987](https://github.com/taikoxyz/taiko-mono/issues/12987)) ([3b71285](https://github.com/taikoxyz/taiko-mono/commit/3b712857b5d5ede2a3683d949d1974c8cceeb69a)) - **protocol:** deploy the generated Yul plonk verifier ([#13016](https://github.com/taikoxyz/taiko-mono/issues/13016)) ([eb5d564](https://github.com/taikoxyz/taiko-mono/commit/eb5d564ec469b1ec79619b4d563c3f9989d264c2)) - **protocol:** enable two dimensional circuit/verifier lookup. ([#13066](https://github.com/taikoxyz/taiko-mono/issues/13066)) ([51d1f67](https://github.com/taikoxyz/taiko-mono/commit/51d1f67aa45fec8e2de73c1ed5a992306c6339c1)) -- **protocol:** implement `Bridge.isMessageFailed` ([#13004](https://github.com/taikoxyz/taiko-mono/issues/13004)) ([45153d9](https://github.com/taikoxyz/taiko-mono/commit/45153d92cbcd0e80438c925d5ce5c52df3abd696)) +- **protocol:** implement `Bridge.proveMessageFailed` ([#13004](https://github.com/taikoxyz/taiko-mono/issues/13004)) ([45153d9](https://github.com/taikoxyz/taiko-mono/commit/45153d92cbcd0e80438c925d5ce5c52df3abd696)) - **protocol:** implement releaseEther & releaseERC20 ([#13008](https://github.com/taikoxyz/taiko-mono/issues/13008)) ([088933e](https://github.com/taikoxyz/taiko-mono/commit/088933e74f7163459e328d61d8331235ab87e388)) - **protocol:** improve sync header storage on L2 ([#13041](https://github.com/taikoxyz/taiko-mono/issues/13041)) ([86c9fe4](https://github.com/taikoxyz/taiko-mono/commit/86c9fe44a3200490032610c017bfc88c3a57a8dd)) - **protocol:** temporarily force an `oracle prover` to be the first prover ([#13070](https://github.com/taikoxyz/taiko-mono/issues/13070)) ([d7401a2](https://github.com/taikoxyz/taiko-mono/commit/d7401a20c66a3c52330c4f92c95c71c902d74452)) @@ -227,7 +227,7 @@ ### Features -- **bridge:** add getMessageStatusSlot function ([#12940](https://github.com/taikoxyz/taiko-mono/issues/12940)) ([9837fa3](https://github.com/taikoxyz/taiko-mono/commit/9837fa3dceb5d702b2247879af52988be4da333d)) +- **bridge:** add messageStatusSlot function ([#12940](https://github.com/taikoxyz/taiko-mono/issues/12940)) ([9837fa3](https://github.com/taikoxyz/taiko-mono/commit/9837fa3dceb5d702b2247879af52988be4da333d)) - **bridge:** bridge transactions ([#411](https://github.com/taikoxyz/taiko-mono/issues/411)) ([19dd7ab](https://github.com/taikoxyz/taiko-mono/commit/19dd7abd4a2f5bc83e43d31938e43501472ff108)) - **bridge:** implement the bridge relayer ([#191](https://github.com/taikoxyz/taiko-mono/issues/191)) ([9f49e4c](https://github.com/taikoxyz/taiko-mono/commit/9f49e4c87304853c9d94693434d23a6b8258eac6)) - **deployment:** fund L1 bridge ([#400](https://github.com/taikoxyz/taiko-mono/issues/400)) ([e7ef53e](https://github.com/taikoxyz/taiko-mono/commit/e7ef53e27cb906d7128a3e512e7082e4176786e4)) diff --git a/packages/protocol/contracts/L1/TaikoData.sol b/packages/protocol/contracts/L1/TaikoData.sol index aa0bb135b4c..e6e5158ed18 100644 --- a/packages/protocol/contracts/L1/TaikoData.sol +++ b/packages/protocol/contracts/L1/TaikoData.sol @@ -17,8 +17,6 @@ library TaikoData { // --------------------------------------------------------------------- // The chain ID of the network where Taiko contracts are deployed. uint256 chainId; - // Flag indicating whether the relay signal root is enabled or not. - bool relaySignalRoot; // --------------------------------------------------------------------- // Group 2: Block level configs // --------------------------------------------------------------------- diff --git a/packages/protocol/contracts/L1/TaikoL1.sol b/packages/protocol/contracts/L1/TaikoL1.sol index aadacd6d17a..c0199e45cb8 100644 --- a/packages/protocol/contracts/L1/TaikoL1.sol +++ b/packages/protocol/contracts/L1/TaikoL1.sol @@ -56,11 +56,7 @@ contract TaikoL1 is initializer { EssentialContract._init(_addressManager); - LibVerifying.init({ - state: state, - config: getConfig(), - genesisBlockHash: _genesisBlockHash - }); + LibVerifying.init(state, getConfig(), _genesisBlockHash); } /// @notice Proposes a Taiko L2 block. @@ -83,22 +79,22 @@ contract TaikoL1 is returns (TaikoData.BlockMetadata memory meta) { TaikoData.Config memory config = getConfig(); - meta = LibProposing.proposeBlock({ - state: state, - config: config, - resolver: AddressResolver(this), - txListHash: txListHash, - extraData: extraData, - assignment: abi.decode(assignment, (TaikoData.ProverAssignment)), - txList: txList - }); + meta = LibProposing.proposeBlock( + state, + config, + AddressResolver(this), + txListHash, + extraData, + abi.decode(assignment, (TaikoData.ProverAssignment)), + txList + ); if (config.maxBlocksToVerifyPerProposal > 0) { - LibVerifying.verifyBlocks({ - state: state, - config: config, - resolver: AddressResolver(this), - maxBlocksToVerify: config.maxBlocksToVerifyPerProposal - }); + LibVerifying.verifyBlocks( + state, + config, + AddressResolver(this), + config.maxBlocksToVerifyPerProposal + ); } } @@ -114,20 +110,17 @@ contract TaikoL1 is nonReentrant { TaikoData.Config memory config = getConfig(); - uint8 maxBlocksToVerify = LibProving.proveBlock({ - state: state, - config: config, - resolver: AddressResolver(this), - blockId: blockId, - evidence: abi.decode(input, (TaikoData.BlockEvidence)) - }); + uint8 maxBlocksToVerify = LibProving.proveBlock( + state, + config, + AddressResolver(this), + blockId, + abi.decode(input, (TaikoData.BlockEvidence)) + ); if (maxBlocksToVerify > 0) { - LibVerifying.verifyBlocks({ - state: state, - config: config, - resolver: AddressResolver(this), - maxBlocksToVerify: maxBlocksToVerify - }); + LibVerifying.verifyBlocks( + state, config, AddressResolver(this), maxBlocksToVerify + ); } } @@ -135,24 +128,21 @@ contract TaikoL1 is /// @param maxBlocksToVerify Max number of blocks to verify. function verifyBlocks(uint64 maxBlocksToVerify) external nonReentrant { if (maxBlocksToVerify == 0) revert L1_INVALID_PARAM(); - LibVerifying.verifyBlocks({ - state: state, - config: getConfig(), - resolver: AddressResolver(this), - maxBlocksToVerify: maxBlocksToVerify - }); + LibVerifying.verifyBlocks( + state, getConfig(), AddressResolver(this), maxBlocksToVerify + ); } /// @notice Deposit Taiko token to this contract /// @param amount Amount of Taiko token to deposit. function depositTaikoToken(uint256 amount) public { - LibTaikoToken.depositToken(state, AddressResolver(this), amount); + LibTaikoToken.depositTaikoToken(state, AddressResolver(this), amount); } /// @notice Withdraw Taiko token from this contract /// @param amount Amount of Taiko token to withdraw. function withdrawTaikoToken(uint256 amount) public { - LibTaikoToken.withdrawToken(state, AddressResolver(this), amount); + LibTaikoToken.withdrawTaikoToken(state, AddressResolver(this), amount); } function ownerWithdrawTaikoToken( @@ -162,30 +152,23 @@ contract TaikoL1 is public onlyOwner { - LibTaikoToken.ownerWithdrawToken(AddressResolver(this), to, amount); + LibTaikoToken.ownerWithdrawTaikoToken(AddressResolver(this), to, amount); } /// @notice Deposits Ether to Layer 2. /// @param recipient Address of the recipient for the deposited Ether on /// Layer 2. function depositEtherToL2(address recipient) public payable { - LibDepositing.depositEtherToL2({ - state: state, - config: getConfig(), - resolver: AddressResolver(this), - recipient: recipient - }); + LibDepositing.depositEtherToL2( + state, getConfig(), AddressResolver(this), recipient + ); } /// @notice Checks if Ether deposit is allowed for Layer 2. /// @param amount Amount of Ether to be deposited. /// @return true if Ether deposit is allowed, false otherwise. function canDepositEthToL2(uint256 amount) public view returns (bool) { - return LibDepositing.canDepositEthToL2({ - state: state, - config: getConfig(), - amount: amount - }); + return LibDepositing.canDepositEthToL2(state, getConfig(), amount); } /// @notice Gets the details of a block. @@ -196,11 +179,7 @@ contract TaikoL1 is view returns (TaikoData.Block memory blk) { - return LibUtils.getBlock({ - state: state, - config: getConfig(), - blockId: blockId - }); + return LibUtils.getBlock(state, getConfig(), blockId); } /// @notice Gets the state transition for a specific block. @@ -215,34 +194,21 @@ contract TaikoL1 is view returns (TaikoData.Transition memory) { - return LibUtils.getTransition({ - state: state, - config: getConfig(), - blockId: blockId, - parentHash: parentHash - }); + return LibUtils.getTransition(state, getConfig(), blockId, parentHash); } /// @inheritdoc ICrossChainSync - function getCrossChainBlockHash(uint64 blockId) + function getSyncedSnippet(uint64 blockId) public view override - returns (bytes32) + returns (ICrossChainSync.Snippet memory data) { - return LibUtils.getVerifyingTransition(state, getConfig(), blockId) - .blockHash; - } + TaikoData.Transition storage transition = + LibUtils.getVerifyingTransition(state, getConfig(), blockId); - /// @inheritdoc ICrossChainSync - function getCrossChainSignalRoot(uint64 blockId) - public - view - override - returns (bytes32) - { - return LibUtils.getVerifyingTransition(state, getConfig(), blockId) - .signalRoot; + data.blockHash = transition.blockHash; + data.signalRoot = transition.signalRoot; } /// @notice Gets the state variables of the TaikoL1 contract. @@ -308,7 +274,6 @@ contract TaikoL1 is { return TaikoData.Config({ chainId: 167_007, - relaySignalRoot: false, blockMaxProposals: 403_200, blockRingBufferSize: 403_210, maxBlocksToVerifyPerProposal: 10, diff --git a/packages/protocol/contracts/L1/TaikoToken.sol b/packages/protocol/contracts/L1/TaikoToken.sol index 2841d47c1a7..5b1a95edb04 100644 --- a/packages/protocol/contracts/L1/TaikoToken.sol +++ b/packages/protocol/contracts/L1/TaikoToken.sol @@ -70,7 +70,7 @@ contract TaikoToken is __ERC20Permit_init(_name); __ERC20Votes_init(); - for (uint256 i = 0; i < _premintRecipients.length; ++i) { + for (uint256 i; i < _premintRecipients.length; ++i) { _mint(_premintRecipients[i], _premintAmounts[i]); } } diff --git a/packages/protocol/contracts/L1/libs/LibProposing.sol b/packages/protocol/contracts/L1/libs/LibProposing.sol index d7a4d4b47bf..ddfed19776a 100644 --- a/packages/protocol/contracts/L1/libs/LibProposing.sol +++ b/packages/protocol/contracts/L1/libs/LibProposing.sol @@ -160,7 +160,7 @@ library LibProposing { // transition is not the initial one or if it was generated and // validated by different provers. Instead, a portion of the assignment // bond serves as a reward for the actual prover. - LibTaikoToken.debitToken( + LibTaikoToken.debitTaikoToken( state, resolver, blk.assignedProver, config.livenessBond ); @@ -171,11 +171,8 @@ library LibProposing { // Validate the prover assignment, then charge Ether or ERC20 as the // prover fee based on the block's minTier. - uint256 proverFee = _validateAssignment({ - minTier: blk.minTier, - txListHash: txListHash, - assignment: assignment - }); + uint256 proverFee = + _validateAssignment(blk.minTier, txListHash, assignment); emit BlockProposed({ blockId: blk.blockId, @@ -284,9 +281,7 @@ library LibProposing { returns (uint256) { for (uint256 i; i < tierFees.length; ++i) { - if (tierFees[i].tier == tierId) { - return tierFees[i].fee; - } + if (tierFees[i].tier == tierId) return tierFees[i].fee; } revert L1_TIER_NOT_FOUND(); } diff --git a/packages/protocol/contracts/L1/libs/LibProving.sol b/packages/protocol/contracts/L1/libs/LibProving.sol index 25d79b3e2c9..b538239491f 100644 --- a/packages/protocol/contracts/L1/libs/LibProving.sol +++ b/packages/protocol/contracts/L1/libs/LibProving.sol @@ -226,7 +226,7 @@ library LibProving { evidence.proof.length == 32 && bytes32(evidence.proof) == keccak256("RETURN_LIVENESS_BOND") ) { - LibTaikoToken.creditToken( + LibTaikoToken.creditTaikoToken( state, resolver, blk.assignedProver, blk.livenessBond, false ); } @@ -273,7 +273,7 @@ library LibProving { if (tran.contester != address(0)) revert L1_ALREADY_CONTESTED(); // Burn the contest bond from the prover. - LibTaikoToken.debitToken( + LibTaikoToken.debitTaikoToken( state, resolver, msg.sender, tier.contestBond ); @@ -352,7 +352,7 @@ library LibProving { } // Burn the validity bond from the prover. - LibTaikoToken.debitToken( + LibTaikoToken.debitTaikoToken( state, resolver, msg.sender, tier.validityBond ); @@ -372,7 +372,7 @@ library LibProving { // Mint the reward and the validity bond and return it to // the previous prover. - LibTaikoToken.creditToken( + LibTaikoToken.creditTaikoToken( state, resolver, tran.prover, @@ -389,7 +389,7 @@ library LibProving { // for the tier-0 transition. Consequently, we only grant a // reward to the contester if it is not a zero-address. if (tran.contester != address(0)) { - LibTaikoToken.creditToken( + LibTaikoToken.creditTaikoToken( state, resolver, tran.contester, @@ -397,9 +397,9 @@ library LibProving { false ); } else if (reward != 0) { - //The prover is also the contester, so the reward is + // The prover is also the contester, so the reward is // sent to him. - LibTaikoToken.creditToken( + LibTaikoToken.creditTaikoToken( state, resolver, msg.sender, reward, false ); } @@ -415,7 +415,7 @@ library LibProving { // In theory, the reward can also be zero for certain tiers if // their validity bonds are set to zero. if (reward != 0) { - LibTaikoToken.creditToken( + LibTaikoToken.creditTaikoToken( state, resolver, msg.sender, reward, false ); } diff --git a/packages/protocol/contracts/L1/libs/LibTaikoToken.sol b/packages/protocol/contracts/L1/libs/LibTaikoToken.sol index 52bb1862a94..8504a91278c 100644 --- a/packages/protocol/contracts/L1/libs/LibTaikoToken.sol +++ b/packages/protocol/contracts/L1/libs/LibTaikoToken.sol @@ -21,7 +21,7 @@ library LibTaikoToken { error L1_INSUFFICIENT_TOKEN(); error L1_INVALID_ADDRESS(); - function depositToken( + function depositTaikoToken( TaikoData.State storage state, AddressResolver resolver, uint256 amount @@ -38,7 +38,7 @@ library LibTaikoToken { emit TokenDeposited(amount); } - function withdrawToken( + function withdrawTaikoToken( TaikoData.State storage state, AddressResolver resolver, uint256 amount @@ -61,7 +61,7 @@ library LibTaikoToken { emit TokenWithdrawn(amount); } - function creditToken( + function creditTaikoToken( TaikoData.State storage state, AddressResolver resolver, address to, @@ -76,11 +76,12 @@ library LibTaikoToken { address(this), amount ); } + state.tokenBalances[to] += amount; emit TokenCredited(amount, mint); } - function debitToken( + function debitTaikoToken( TaikoData.State storage state, AddressResolver resolver, address from, @@ -102,7 +103,7 @@ library LibTaikoToken { } } - function ownerWithdrawToken( + function ownerWithdrawTaikoToken( AddressResolver resolver, address to, uint256 amount diff --git a/packages/protocol/contracts/L1/libs/LibUtils.sol b/packages/protocol/contracts/L1/libs/LibUtils.sol index 099caf62dfa..165246beb3b 100644 --- a/packages/protocol/contracts/L1/libs/LibUtils.sol +++ b/packages/protocol/contracts/L1/libs/LibUtils.sol @@ -90,7 +90,7 @@ library LibUtils { ) internal view - returns (TaikoData.Transition memory) + returns (TaikoData.Transition storage) { uint64 _blockId = blockId == 0 ? state.slotB.lastVerifiedBlockId : blockId; diff --git a/packages/protocol/contracts/L1/libs/LibVerifying.sol b/packages/protocol/contracts/L1/libs/LibVerifying.sol index 3194ab582e7..41c48bac913 100644 --- a/packages/protocol/contracts/L1/libs/LibVerifying.sol +++ b/packages/protocol/contracts/L1/libs/LibVerifying.sol @@ -175,7 +175,7 @@ library LibVerifying { bondToReturn -= blk.livenessBond / 2; } - LibTaikoToken.creditToken( + LibTaikoToken.creditTaikoToken( state, resolver, tran.prover, bondToReturn, false ); @@ -206,16 +206,11 @@ library LibVerifying { state.slotB.lastVerifiedBlockId = lastVerifiedBlockId; state.slotB.lastVerifiedAt = uint64(block.timestamp); - if (config.relaySignalRoot) { - // Forward the L2's signal root to the signal service to - // enable other TaikoL1 deployments, which share the same - // signal service, to relay the signal to their respective - // TaikoL2 contracts. This enables direct L1-to-L3 and - // L2-to-L2 bridging without assets passing an intermediary - // layer. - ISignalService(resolver.resolve("signal_service", false)) - .sendSignal(signalRoot); - } + // Store the L2's signal root as a signal to the local signal + // service to allow for multi-hop bridging. + ISignalService(resolver.resolve("signal_service", false)) + .sendSignal(signalRoot); + emit CrossChainSynced( lastVerifiedBlockId, blockHash, signalRoot ); @@ -233,7 +228,7 @@ library LibVerifying { || config.blockMaxProposals == 1 || config.blockRingBufferSize <= config.blockMaxProposals + 1 || config.blockMaxGasLimit == 0 || config.blockMaxTxListBytes == 0 - || config.blockMaxTxListBytes > 128 * 1024 //blob up to 128K + || config.blockMaxTxListBytes > 128 * 1024 // blob up to 128K || config.livenessBond == 0 || config.ethDepositRingBufferSize <= 1 || config.ethDepositMinCountPerBlock == 0 || config.ethDepositMaxCountPerBlock diff --git a/packages/protocol/contracts/L1/provers/GuardianProver.sol b/packages/protocol/contracts/L1/provers/GuardianProver.sol new file mode 100644 index 00000000000..8c9b50f9b69 --- /dev/null +++ b/packages/protocol/contracts/L1/provers/GuardianProver.sol @@ -0,0 +1,124 @@ +// SPDX-License-Identifier: MIT +// _____ _ _ _ _ +// |_ _|_ _(_) |_____ | | __ _| |__ ___ +// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< +// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ + +pragma solidity ^0.8.20; + +import { EssentialContract } from "../../common/EssentialContract.sol"; +import { Proxied } from "../../common/Proxied.sol"; + +import { LibTiers } from "../tiers/ITierProvider.sol"; +import { TaikoData } from "../TaikoData.sol"; + +/// @title GuardianProver +contract GuardianProver is EssentialContract { + uint256 public constant NUM_GUARDIANS = 5; + uint256 public constant REQUIRED_GUARDIANS = 3; + + address[NUM_GUARDIANS] public guardians; // slots 1 - 5 + mapping(address guardian => uint256 id) public guardianIds; // slot 6 + mapping(bytes32 => uint256 approvalBits) public approvals; // slot 7 + + uint256[43] private __gap; + // Cannot use NUM_GUARDIANS directly below otherwise hardhat will fail + + event GuardiansUpdated(address[5]); + event Approved( + uint64 blockId, + TaikoData.BlockEvidence evidence, + uint256 approvalBits, + bool proofSubmitted + ); + + error INVALID_GUARDIAN(); + error INVALID_GUARDIAN_SET(); + error INVALID_PROOF(); + error PROVING_FAILED(); + + /// @notice Initializes the contract with the provided address manager. + /// @param _addressManager The address of the address manager contract. + function init(address _addressManager) external initializer { + EssentialContract._init(_addressManager); + } + + /// @notice Set the set of guardians + /// @param _guardians The new set of guardians + function setGuardians(address[NUM_GUARDIANS] memory _guardians) + external + onlyOwner + nonReentrant + { + for (uint256 i; i < NUM_GUARDIANS; ++i) { + address guardian = _guardians[i]; + if (guardian == address(0)) revert INVALID_GUARDIAN(); + + // In case there is a pending 'approval' and we call setGuardians() + // with an existing guardian but with different array position (id), + // then accidentally 2 guardian signatures could lead to firing away + // a proveBlock() transaction. + uint256 id = guardianIds[guardian]; + + if (id != 0) { + if (id != i + 1) revert INVALID_GUARDIAN_SET(); + } else { + delete guardianIds[guardians[i]]; + guardianIds[guardian] = i + 1; + guardians[i] = guardian; + } + } + + emit GuardiansUpdated(_guardians); + } + + /// @dev Called by guardians to approve a guardian proof + function approveEvidence( + uint64 blockId, + TaikoData.BlockEvidence memory evidence + ) + external + nonReentrant + { + uint256 id = guardianIds[msg.sender]; + if (id == 0) revert INVALID_GUARDIAN(); + + if (evidence.tier != LibTiers.TIER_GUARDIAN) revert INVALID_PROOF(); + + bytes32 hash = keccak256(abi.encode(blockId, evidence)); + uint256 approvalBits = approvals[hash]; + + approvalBits |= 1 << id; + + if (_isApproved(approvalBits)) { + bytes memory data = abi.encodeWithSignature( + "proveBlock(uint64,bytes)", blockId, abi.encode(evidence) + ); + + (bool success,) = resolve("taiko", false).call(data); + + if (!success) revert PROVING_FAILED(); + delete approvals[hash]; + + emit Approved(blockId, evidence, approvalBits, true); + } else { + approvals[hash] = approvalBits; + emit Approved(blockId, evidence, approvalBits, false); + } + } + + function _isApproved(uint256 approvalBits) private pure returns (bool) { + uint256 count; + uint256 bits = approvalBits >> 1; + for (uint256 i; i < NUM_GUARDIANS; ++i) { + if (bits & 1 == 1) ++count; + if (count == REQUIRED_GUARDIANS) return true; + bits >>= 1; + } + return false; + } +} + +/// @title ProxiedGuardianProver +/// @notice Proxied version of the parent contract. +contract ProxiedGuardianProver is Proxied, GuardianProver { } diff --git a/packages/protocol/contracts/L1/tiers/ITierProvider.sol b/packages/protocol/contracts/L1/tiers/ITierProvider.sol index 2004fe42c35..034331af810 100644 --- a/packages/protocol/contracts/L1/tiers/ITierProvider.sol +++ b/packages/protocol/contracts/L1/tiers/ITierProvider.sol @@ -32,5 +32,6 @@ library LibTiers { uint16 public constant TIER_OPTIMISTIC = 100; uint16 public constant TIER_SGX = 200; uint16 public constant TIER_PSE_ZKEVM = 300; + uint16 public constant TIER_SGX_AND_PSE_ZKEVM = 400; uint16 public constant TIER_GUARDIAN = 1000; } diff --git a/packages/protocol/contracts/L1/tiers/OptimisticRollupConfigProvider.sol b/packages/protocol/contracts/L1/tiers/TaikoA6TierProvider.sol similarity index 56% rename from packages/protocol/contracts/L1/tiers/OptimisticRollupConfigProvider.sol rename to packages/protocol/contracts/L1/tiers/TaikoA6TierProvider.sol index da4d12e6088..83590d6fac3 100644 --- a/packages/protocol/contracts/L1/tiers/OptimisticRollupConfigProvider.sol +++ b/packages/protocol/contracts/L1/tiers/TaikoA6TierProvider.sol @@ -8,8 +8,11 @@ pragma solidity ^0.8.20; import { ITierProvider, LibTiers } from "./ITierProvider.sol"; -/// @title OptimisticRollupConfigProvider -contract OptimisticRollupConfigProvider is ITierProvider { +/// @title TaikoA6TierProvider +contract TaikoA6TierProvider is ITierProvider { + uint96 private constant UNIT = 10_000e18; // 10000 Taiko token + uint24 private constant COOLDOWN_BASE = 24 hours; + error TIER_NOT_FOUND(); function getTier(uint16 tierId) @@ -21,33 +24,33 @@ contract OptimisticRollupConfigProvider is ITierProvider { if (tierId == LibTiers.TIER_OPTIMISTIC) { return ITierProvider.Tier({ verifierName: "tier_optimistic", - validityBond: 100_000 ether, // TKO - contestBond: 100_000 ether, // TKO - cooldownWindow: 4 hours, - provingWindow: 20 minutes, - maxBlocksToVerify: 16 + validityBond: 20 * UNIT, + contestBond: 20 * UNIT, + cooldownWindow: 4 hours + COOLDOWN_BASE, + provingWindow: 1 hours, + maxBlocksToVerify: 10 }); } if (tierId == LibTiers.TIER_SGX) { return ITierProvider.Tier({ verifierName: "tier_sgx", - validityBond: 50_000 ether, // TKO - contestBond: 50_000 ether, // TKO - cooldownWindow: 3 hours, - provingWindow: 60 minutes, - maxBlocksToVerify: 12 + validityBond: 10 * UNIT, + contestBond: 10 * UNIT, + cooldownWindow: 3 hours + COOLDOWN_BASE, + provingWindow: 2 hours, + maxBlocksToVerify: 8 }); } - if (tierId == LibTiers.TIER_PSE_ZKEVM) { + if (tierId == LibTiers.TIER_SGX_AND_PSE_ZKEVM) { return ITierProvider.Tier({ - verifierName: "tier_pse_zkevm", - validityBond: 10_000 ether, // TKO - contestBond: 10_000 ether, // TKO - cooldownWindow: 2 hours, - provingWindow: 90 minutes, - maxBlocksToVerify: 8 + verifierName: "tier_sgx_and_pse_zkevm", + validityBond: 5 * UNIT, + contestBond: 5 * UNIT, + cooldownWindow: 2 hours + COOLDOWN_BASE, + provingWindow: 4 hours, + maxBlocksToVerify: 6 }); } @@ -56,9 +59,9 @@ contract OptimisticRollupConfigProvider is ITierProvider { verifierName: "tier_guardian", validityBond: 0, contestBond: 0, // not contestable - cooldownWindow: 1 hours, - provingWindow: 120 minutes, - maxBlocksToVerify: 0 + cooldownWindow: 1 hours + COOLDOWN_BASE, + provingWindow: 4 hours, + maxBlocksToVerify: 4 }); } @@ -74,13 +77,13 @@ contract OptimisticRollupConfigProvider is ITierProvider { tiers = new uint16[](4); tiers[0] = LibTiers.TIER_OPTIMISTIC; tiers[1] = LibTiers.TIER_SGX; - tiers[2] = LibTiers.TIER_PSE_ZKEVM; + tiers[2] = LibTiers.TIER_SGX_AND_PSE_ZKEVM; tiers[3] = LibTiers.TIER_GUARDIAN; } function getMinTier(uint256 rand) public pure override returns (uint16) { - if (rand % 100 == 0) return LibTiers.TIER_PSE_ZKEVM; - // else if (rand % 10 == 0) return LibTiers.TIER_SGX; + if (rand % 1000 == 0) return LibTiers.TIER_SGX_AND_PSE_ZKEVM; + else if (rand % 100 == 0) return LibTiers.TIER_SGX; else return LibTiers.TIER_OPTIMISTIC; } } diff --git a/packages/protocol/contracts/L1/tiers/ValidityRollupConfigProvider.sol b/packages/protocol/contracts/L1/tiers/ValidityRollupConfigProvider.sol deleted file mode 100644 index 9aad14d6ad4..00000000000 --- a/packages/protocol/contracts/L1/tiers/ValidityRollupConfigProvider.sol +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { ITierProvider, LibTiers } from "./ITierProvider.sol"; - -/// @title ValidityRollupConfigProvider -contract ValidityRollupConfigProvider is ITierProvider { - error TIER_NOT_FOUND(); - - function getTier(uint16 tierId) - public - pure - override - returns (ITierProvider.Tier memory) - { - if (tierId == LibTiers.TIER_SGX) { - return ITierProvider.Tier({ - verifierName: "tier_sgx", - validityBond: 50_000 ether, // TKO - contestBond: 50_000 ether, // TKO - cooldownWindow: 3 hours, - provingWindow: 60 minutes, - maxBlocksToVerify: 12 - }); - } - - if (tierId == LibTiers.TIER_PSE_ZKEVM) { - return ITierProvider.Tier({ - verifierName: "tier_pse_zkevm", - validityBond: 10_000 ether, // TKO - contestBond: 10_000 ether, // TKO - cooldownWindow: 2 hours, - provingWindow: 90 minutes, - maxBlocksToVerify: 8 - }); - } - - if (tierId == LibTiers.TIER_GUARDIAN) { - return ITierProvider.Tier({ - verifierName: "tier_guardian", - validityBond: 0, - contestBond: 0, // not contestable - cooldownWindow: 1 hours, - provingWindow: 120 minutes, - maxBlocksToVerify: 0 - }); - } - - revert TIER_NOT_FOUND(); - } - - function getTierIds() - public - pure - override - returns (uint16[] memory tiers) - { - tiers = new uint16[](3); - tiers[0] = LibTiers.TIER_SGX; - tiers[1] = LibTiers.TIER_PSE_ZKEVM; - tiers[2] = LibTiers.TIER_GUARDIAN; - } - - function getMinTier(uint256 rand) public pure override returns (uint16) { - if (rand % 100 == 0) return LibTiers.TIER_PSE_ZKEVM; - else return LibTiers.TIER_SGX; - } -} diff --git a/packages/protocol/contracts/L1/tiers/ZKRollupConfigProvider.sol b/packages/protocol/contracts/L1/tiers/ZKRollupConfigProvider.sol deleted file mode 100644 index 07d39da4dac..00000000000 --- a/packages/protocol/contracts/L1/tiers/ZKRollupConfigProvider.sol +++ /dev/null @@ -1,60 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { ITierProvider, LibTiers } from "./ITierProvider.sol"; - -/// @title ZKRollupConfigProvider -contract ZKRollupConfigProvider is ITierProvider { - error TIER_NOT_FOUND(); - - function getTier(uint16 tierId) - public - pure - override - returns (ITierProvider.Tier memory) - { - if (tierId == LibTiers.TIER_PSE_ZKEVM) { - return ITierProvider.Tier({ - verifierName: "tier_pse_zkevm", - validityBond: 10_000 ether, // TKO - contestBond: 10_000 ether, // TKO - cooldownWindow: 2 hours, - provingWindow: 90 minutes, - maxBlocksToVerify: 8 - }); - } - - if (tierId == LibTiers.TIER_GUARDIAN) { - return ITierProvider.Tier({ - verifierName: "tier_guardian", - validityBond: 0, - contestBond: 0, // not contestable - cooldownWindow: 1 hours, - provingWindow: 120 minutes, - maxBlocksToVerify: 0 - }); - } - - revert TIER_NOT_FOUND(); - } - - function getTierIds() - public - pure - override - returns (uint16[] memory tiers) - { - tiers = new uint16[](2); - tiers[0] = LibTiers.TIER_PSE_ZKEVM; - tiers[1] = LibTiers.TIER_GUARDIAN; - } - - function getMinTier(uint256) public pure override returns (uint16) { - return LibTiers.TIER_PSE_ZKEVM; - } -} diff --git a/packages/protocol/contracts/libs/yul/PlonkVerifier.yulp b/packages/protocol/contracts/L1/verifiers/PlonkVerifier.yulp similarity index 100% rename from packages/protocol/contracts/libs/yul/PlonkVerifier.yulp rename to packages/protocol/contracts/L1/verifiers/PlonkVerifier.yulp diff --git a/packages/protocol/contracts/L1/verifiers/PseZkVerifier.sol b/packages/protocol/contracts/L1/verifiers/PseZkVerifier.sol index e13b54c0d81..87b93884d91 100644 --- a/packages/protocol/contracts/L1/verifiers/PseZkVerifier.sol +++ b/packages/protocol/contracts/L1/verifiers/PseZkVerifier.sol @@ -7,8 +7,8 @@ pragma solidity ^0.8.20; import { EssentialContract } from "../../common/EssentialContract.sol"; -import { LibBytesUtils } from "../../thirdparty/LibBytesUtils.sol"; import { Proxied } from "../../common/Proxied.sol"; +import { LibBytesUtils } from "../../thirdparty/LibBytesUtils.sol"; import { TaikoData } from "../TaikoData.sol"; @@ -45,23 +45,17 @@ contract PseZkVerifier is EssentialContract, IVerifier { bytes32 instance = getInstance(prover, evidence); // Validate the instance using bytes utilities. - if ( - !LibBytesUtils.equal( - LibBytesUtils.slice(evidence.proof, 2, 32), - bytes.concat(bytes16(0), bytes16(instance)) - ) - ) { - revert L1_INVALID_PROOF(); - } - - if ( - !LibBytesUtils.equal( - LibBytesUtils.slice(evidence.proof, 34, 32), - bytes.concat(bytes16(0), bytes16(uint128(uint256(instance)))) - ) - ) { - revert L1_INVALID_PROOF(); - } + bool verified = LibBytesUtils.equal( + LibBytesUtils.slice(evidence.proof, 2, 32), + bytes.concat(bytes16(0), bytes16(instance)) + ); + if (!verified) revert L1_INVALID_PROOF(); + + verified = LibBytesUtils.equal( + LibBytesUtils.slice(evidence.proof, 34, 32), + bytes.concat(bytes16(0), bytes16(uint128(uint256(instance)))) + ); + if (!verified) revert L1_INVALID_PROOF(); // Extract verifier ID from the proof. uint16 verifierId = uint16(bytes2(evidence.proof[0:2])); @@ -71,14 +65,14 @@ contract PseZkVerifier is EssentialContract, IVerifier { address verifierAddress = resolve(getVerifierName(verifierId), false); // Call the verifier contract with the provided proof. - (bool verified, bytes memory ret) = + bytes memory ret; + (verified, ret) = verifierAddress.staticcall(bytes.concat(evidence.proof[2:])); // Check if the proof is valid. - if (!verified || ret.length != 32 || bytes32(ret) != keccak256("taiko")) - { - revert L1_INVALID_PROOF(); - } + if (!verified) revert L1_INVALID_PROOF(); + if (ret.length != 32) revert L1_INVALID_PROOF(); + if (bytes32(ret) != keccak256("taiko")) revert L1_INVALID_PROOF(); } function getInstance( diff --git a/packages/protocol/contracts/L1/verifiers/SGXVerifier.sol b/packages/protocol/contracts/L1/verifiers/SGXVerifier.sol deleted file mode 100644 index ffe32dd1be6..00000000000 --- a/packages/protocol/contracts/L1/verifiers/SGXVerifier.sol +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { EssentialContract } from "../../common/EssentialContract.sol"; -import { Proxied } from "../../common/Proxied.sol"; - -import { TaikoData } from "../TaikoData.sol"; - -import { IVerifier } from "./IVerifier.sol"; - -/// @title GuardianVerifier -// TODO(dani): implement this verifier. -contract SGXVerifier is EssentialContract, IVerifier { - uint256[50] private __gap; - - error UNIMPLEMENTED(); - - /// @notice Initializes the contract with the provided address manager. - /// @param _addressManager The address of the address manager contract. - function init(address _addressManager) external initializer { - EssentialContract._init(_addressManager); - } - - /// @inheritdoc IVerifier - function verifyProof( - // blockId is unused now, but can be used later when supporting - // different types of proofs. - uint64, - address, - bool, - TaikoData.BlockEvidence calldata - ) - external - pure - { - revert UNIMPLEMENTED(); - } -} - -/// @title ProxiedSGXVerifier -/// @notice Proxied version of the parent contract. -contract ProxiedSGXVerifier is Proxied, SGXVerifier { } diff --git a/packages/protocol/contracts/L1/verifiers/SgxAndZkVerifier.sol b/packages/protocol/contracts/L1/verifiers/SgxAndZkVerifier.sol new file mode 100644 index 00000000000..28e3e6d4086 --- /dev/null +++ b/packages/protocol/contracts/L1/verifiers/SgxAndZkVerifier.sol @@ -0,0 +1,60 @@ +// SPDX-License-Identifier: MIT +// _____ _ _ _ _ +// |_ _|_ _(_) |_____ | | __ _| |__ ___ +// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< +// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ + +pragma solidity ^0.8.20; + +import { EssentialContract } from "../../common/EssentialContract.sol"; +import { LibBytesUtils } from "../../thirdparty/LibBytesUtils.sol"; +import { Proxied } from "../../common/Proxied.sol"; + +import { TaikoData } from "../TaikoData.sol"; + +import { IVerifier } from "./IVerifier.sol"; + +/// @title SgxAndZkVerifier +/// @notice See the documentation in {IVerifier}. +contract SgxAndZkVerifier is EssentialContract, IVerifier { + uint8 public constant SGX_PROOF_SIZE = 87; + uint256[50] private __gap; + + /// @notice Initializes the contract with the provided address manager. + /// @param _addressManager The address of the address manager contract. + function init(address _addressManager) external initializer { + EssentialContract._init(_addressManager); + } + + /// @inheritdoc IVerifier + function verifyProof( + uint64 blockId, + address prover, + bool isContesting, + TaikoData.BlockEvidence calldata evidence + ) + external + { + TaikoData.BlockEvidence memory _evidence = evidence; + + // Verify the SGX part + _evidence.proof = LibBytesUtils.slice(evidence.proof, 0, SGX_PROOF_SIZE); + IVerifier(resolve("tier_sgx", false)).verifyProof( + blockId, prover, isContesting, _evidence + ); + + // Verify the ZK part + _evidence.proof = LibBytesUtils.slice( + evidence.proof, + SGX_PROOF_SIZE, + (evidence.proof.length - SGX_PROOF_SIZE) + ); + IVerifier(resolve("tier_pse_zkevm", false)).verifyProof( + blockId, prover, isContesting, _evidence + ); + } +} + +/// @title ProxiedProofVerifier +/// @notice Proxied version of the parent contract. +contract ProxiedSgxAndZkVerifier is Proxied, SgxAndZkVerifier { } diff --git a/packages/protocol/contracts/L1/verifiers/SgxVerifier.sol b/packages/protocol/contracts/L1/verifiers/SgxVerifier.sol new file mode 100644 index 00000000000..ca94e96e597 --- /dev/null +++ b/packages/protocol/contracts/L1/verifiers/SgxVerifier.sol @@ -0,0 +1,179 @@ +// SPDX-License-Identifier: MIT +// _____ _ _ _ _ +// |_ _|_ _(_) |_____ | | __ _| |__ ___ +// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< +// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ + +pragma solidity ^0.8.20; + +import { ECDSAUpgradeable } from + "lib/openzeppelin-contracts-upgradeable/contracts/utils/cryptography/ECDSAUpgradeable.sol"; + +import { EssentialContract } from "../../common/EssentialContract.sol"; +import { Proxied } from "../../common/Proxied.sol"; +import { LibBytesUtils } from "../../thirdparty/LibBytesUtils.sol"; + +import { TaikoData } from "../TaikoData.sol"; + +import { IVerifier } from "./IVerifier.sol"; + +/// @title SgxVerifier +contract SgxVerifier is EssentialContract, IVerifier { + using ECDSAUpgradeable for bytes32; + + struct Instance { + address addr; + uint64 addedAt; // We can calculate if expired + } + + uint256 public constant INSTANCE_EXPIRY = 180 days; + + /// @dev For gas savings, we shall assign each SGX instance with an id + /// so that when we need to set a new pub key, just write storage once. + uint256 public nextInstanceId; // slot 1 + + /// @dev One SGX instance is uniquely identified (on-chain) by it's ECDSA + /// public key (or rather ethereum address). Once that address is used (by + /// proof verification) it has to be overwritten by a new one (representing + /// the same instance). This is due to side-channel protection. Also this + /// public key shall expire after some time. (For now it is a long enough 6 + /// months setting.) + mapping(uint256 instanceId => Instance) public instances; // slot 2 + + uint256[48] private __gap; + + event InstanceAdded( + uint256 indexed id, + address indexed instance, + address replaced, + uint256 timstamp + ); + + error SGX_INVALID_INSTANCE(); + error SGX_INVALID_INSTANCES(); + error SGX_INVALID_PROOF(); + + /// @notice Initializes the contract with the provided address manager. + /// @param _addressManager The address of the address manager contract. + function init(address _addressManager) external initializer { + EssentialContract._init(_addressManager); + } + + /// @notice Adds trusted SGX instances to the registry. + /// @param _instances The address array of trusted SGX instances. + function addInstances(address[] calldata _instances) external onlyOwner { + if (_instances.length == 0) revert SGX_INVALID_INSTANCES(); + + for (uint256 i; i < _instances.length; ++i) { + _addInstance(_instances[i]); + } + } + + /// @notice Adds SGX instances to the registry by another SGX instance. + /// @param id The id of the SGX instance who is adding new members. + /// @param _instances The address array of SGX instances. + /// @param signature The signature proving authenticity. + function addInstances( + uint256 id, + address[] calldata _instances, + bytes calldata signature + ) + external + { + if (_instances.length == 0) revert SGX_INVALID_INSTANCES(); + + bytes32 signedHash = keccak256(abi.encode("ADD_INSTANCES", _instances)); + address oldInstance = signedHash.recover(signature); + if (!_isInstanceValid(id, oldInstance)) revert SGX_INVALID_INSTANCE(); + + _replaceInstance(id, oldInstance, _instances[0]); + for (uint256 i = 1; i < _instances.length; ++i) { + _addInstance(_instances[i]); + } + } + + /// @inheritdoc IVerifier + function verifyProof( + uint64, + address prover, + bool isContesting, + TaikoData.BlockEvidence calldata evidence + ) + external + { + // Do not run proof verification to contest an existing proof + if (isContesting) return; + + // Size is: 87 bytes + // 2 bytes + 20 bytes + 65 bytes (signature) = 87 + if (evidence.proof.length != 87) revert SGX_INVALID_PROOF(); + + uint16 id = uint16(bytes2(LibBytesUtils.slice(evidence.proof, 0, 2))); + address newInstance = + address(bytes20(LibBytesUtils.slice(evidence.proof, 2, 20))); + bytes memory signature = LibBytesUtils.slice(evidence.proof, 22); + address oldInstance = + getSignedHash(evidence, prover, newInstance).recover(signature); + + if (!_isInstanceValid(id, oldInstance)) revert SGX_INVALID_INSTANCE(); + _replaceInstance(id, oldInstance, newInstance); + } + + function getSignedHash( + TaikoData.BlockEvidence memory evidence, + address prover, + address newAddress + ) + public + pure + returns (bytes32 signedHash) + { + return keccak256( + abi.encode( + evidence.metaHash, + evidence.parentHash, + evidence.blockHash, + evidence.signalRoot, + evidence.graffiti, + prover, + newAddress + ) + ); + } + + function _addInstance(address instance) private { + if (instance == address(0)) revert SGX_INVALID_INSTANCE(); + + uint256 id = nextInstanceId++; + instances[id] = Instance(instance, uint64(block.timestamp)); + emit InstanceAdded(id, instance, address(0), block.timestamp); + } + + function _replaceInstance( + uint256 id, + address oldInstance, + address newInstance + ) + private + { + instances[id] = Instance(newInstance, uint64(block.timestamp)); + emit InstanceAdded(id, newInstance, oldInstance, block.timestamp); + } + + function _isInstanceValid( + uint256 id, + address instance + ) + private + view + returns (bool) + { + if (instance == address(0)) return false; + if (instance != instances[id].addr) return false; + return instances[id].addedAt + INSTANCE_EXPIRY > block.timestamp; + } +} + +/// @title ProxiedSgxVerifier +/// @notice Proxied version of the parent contract. +contract ProxiedSgxVerifier is Proxied, SgxVerifier { } diff --git a/packages/protocol/contracts/L2/TaikoL2.sol b/packages/protocol/contracts/L2/TaikoL2.sol index 97bd40e52f8..99e2d116a35 100644 --- a/packages/protocol/contracts/L2/TaikoL2.sol +++ b/packages/protocol/contracts/L2/TaikoL2.sol @@ -8,8 +8,8 @@ pragma solidity ^0.8.20; import { EssentialContract } from "../common/EssentialContract.sol"; import { ICrossChainSync } from "../common/ICrossChainSync.sol"; +import { ISignalService } from "../signal/ISignalService.sol"; import { Proxied } from "../common/Proxied.sol"; - import { LibMath } from "../libs/LibMath.sol"; import { TaikoToken } from "../L1/TaikoToken.sol"; @@ -33,18 +33,13 @@ contract TaikoL2 is EssentialContract, TaikoL2Signer, ICrossChainSync { uint8 blockRewardPoolPctg; } - struct VerifiedBlock { - bytes32 blockHash; - bytes32 signalRoot; - } - // TODO(david): figure out this value from internal devnet. uint32 public constant ANCHOR_GAS_DEDUCT = 40_000; // Mapping from L2 block numbers to their block hashes. // All L2 block hashes will be saved in this mapping. mapping(uint256 blockId => bytes32 blockHash) public l2Hashes; - mapping(uint256 blockId => VerifiedBlock) public l1VerifiedBlocks; + mapping(uint256 l1height => ICrossChainSync.Snippet) public snippets; // A hash to check the integrity of public inputs. bytes32 public publicInputHash; // slot 3 @@ -94,13 +89,13 @@ contract TaikoL2 is EssentialContract, TaikoL2Signer, ICrossChainSync { /// @notice Anchors the latest L1 block details to L2 for cross-layer /// message verification. - /// @param l1Hash The latest L1 block hash when this block was proposed. - /// @param l1SignalRoot The latest value of the L1 signal service storage - /// root. + /// @param l1BlockHash The latest L1 block hash when this block was + /// proposed. + /// @param l1SignalRoot The latest value of the L1 signal root. /// @param l1Height The latest L1 block height when this block was proposed. /// @param parentGasUsed The gas used in the parent block. function anchor( - bytes32 l1Hash, + bytes32 l1BlockHash, bytes32 l1SignalRoot, uint64 l1Height, uint32 parentGasUsed @@ -109,9 +104,14 @@ contract TaikoL2 is EssentialContract, TaikoL2Signer, ICrossChainSync { { if (msg.sender != GOLDEN_TOUCH_ADDRESS) revert L2_INVALID_SENDER(); + uint256 parentId; + unchecked { + parentId = block.number - 1; + } + // Verify ancestor hashes (bytes32 publicInputHashOld, bytes32 publicInputHashNew) = - _calcPublicInputHash(block.number - 1); + _calcPublicInputHash(parentId); if (publicInputHash != publicInputHashOld) { revert L2_PUBLIC_INPUT_HASH_MISMATCH(); } @@ -125,42 +125,38 @@ contract TaikoL2 is EssentialContract, TaikoL2Signer, ICrossChainSync { revert L2_BASEFEE_MISMATCH(); } + // Store the L1's signal root as a signal to the local signal service to + // allow for multi-hop bridging. + if (l1SignalRoot != 0) { + ISignalService(resolve("signal_service", false)).sendSignal( + l1SignalRoot + ); + } + emit CrossChainSynced(l1Height, l1BlockHash, l1SignalRoot); + // Reward block reward in Taiko token to the parent block's proposer uint128 blockReward = _rewardParentBlock(config, l1Height, parentGasUsed); // Update state variables - l2Hashes[block.number - 1] = blockhash(block.number - 1); - l1VerifiedBlocks[l1Height] = VerifiedBlock(l1Hash, l1SignalRoot); + l2Hashes[parentId] = blockhash(parentId); + snippets[l1Height] = ICrossChainSync.Snippet(l1BlockHash, l1SignalRoot); publicInputHash = publicInputHashNew; latestSyncedL1Height = l1Height; parentProposer = block.coinbase; - // Emit events - emit CrossChainSynced(l1Height, l1Hash, l1SignalRoot); - emit Anchored(blockhash(block.number - 1), gasExcess, blockReward); - } - - /// @inheritdoc ICrossChainSync - function getCrossChainBlockHash(uint64 blockId) - public - view - override - returns (bytes32) - { - uint256 id = blockId == 0 ? latestSyncedL1Height : blockId; - return l1VerifiedBlocks[id].blockHash; + emit Anchored(blockhash(parentId), gasExcess, blockReward); } /// @inheritdoc ICrossChainSync - function getCrossChainSignalRoot(uint64 blockId) + function getSyncedSnippet(uint64 blockId) public view override - returns (bytes32) + returns (ICrossChainSync.Snippet memory) { uint256 id = blockId == 0 ? latestSyncedL1Height : blockId; - return l1VerifiedBlocks[id].signalRoot; + return snippets[id]; } /// @notice Gets the basefee and gas excess using EIP-1559 configuration for diff --git a/packages/protocol/contracts/L2/TaikoL2Signer.sol b/packages/protocol/contracts/L2/TaikoL2Signer.sol index 82fbeffcd5f..5b8d6f83341 100644 --- a/packages/protocol/contracts/L2/TaikoL2Signer.sol +++ b/packages/protocol/contracts/L2/TaikoL2Signer.sol @@ -6,7 +6,7 @@ pragma solidity ^0.8.20; -import { LibUint512Math } from "../libs/LibUint512Math.sol"; +import { LibUint512Math } from "../thirdparty/LibUint512Math.sol"; /// @title TaikoL2Signer /// @notice This contract allows for signing operations required on Taiko L2. diff --git a/packages/protocol/contracts/bridge/Bridge.sol b/packages/protocol/contracts/bridge/Bridge.sol index 7c10462455c..9cbdae49fd5 100644 --- a/packages/protocol/contracts/bridge/Bridge.sol +++ b/packages/protocol/contracts/bridge/Bridge.sol @@ -8,32 +8,60 @@ pragma solidity ^0.8.20; import { AddressResolver } from "../common/AddressResolver.sol"; import { EssentialContract } from "../common/EssentialContract.sol"; import { Proxied } from "../common/Proxied.sol"; +import { ISignalService } from "../signal/ISignalService.sol"; +import { LibAddress } from "../libs/LibAddress.sol"; -import { LibBridgeData } from "./libs/LibBridgeData.sol"; -import { LibBridgeProcess } from "./libs/LibBridgeProcess.sol"; -import { LibBridgeRecall } from "./libs/LibBridgeRecall.sol"; -import { LibBridgeRetry } from "./libs/LibBridgeRetry.sol"; -import { LibBridgeSend } from "./libs/LibBridgeSend.sol"; -import { LibBridgeStatus } from "./libs/LibBridgeStatus.sol"; - -import { BridgeErrors } from "./BridgeErrors.sol"; -import { IBridge } from "./IBridge.sol"; +import { EtherVault } from "./EtherVault.sol"; +import { IBridge, IRecallableSender } from "./IBridge.sol"; /// @title Bridge /// @notice See the documentation for {IBridge}. /// @dev The code hash for the same address on L1 and L2 may be different. -contract Bridge is EssentialContract, IBridge, BridgeErrors { - using LibBridgeData for Message; +contract Bridge is EssentialContract, IBridge { + using LibAddress for address; + + enum Status { + NEW, + RETRIABLE, + DONE, + FAILED + } - LibBridgeData.State private _state; // 50 slots reserved + bytes32 internal constant MESSAGE_HASH_PLACEHOLDER = bytes32(uint256(1)); + uint256 internal constant CHAINID_PLACEHOLDER = type(uint256).max; + address internal constant SRC_CHAIN_SENDER_PLACEHOLDER = + address(uint160(uint256(1))); - event MessageStatusChanged( - bytes32 indexed msgHash, - LibBridgeStatus.MessageStatus status, - address transactor - ); + uint256 public nextMessageId; + mapping(bytes32 msgHash => bool recalled) public isMessageRecalled; + mapping(bytes32 msgHash => Status) public messageStatus; + Context private _ctx; // 3 slots + uint256[44] private __gap; + event SignalSent(address indexed sender, bytes32 msgHash); + event MessageSent(bytes32 indexed msgHash, Message message); + event MessageRecalled(bytes32 indexed msgHash); event DestChainEnabled(uint256 indexed chainId, bool enabled); + event MessageStatusChanged(bytes32 indexed msgHash, Status status); + + error B_INVALID_CHAINID(); + error B_INVALID_CONTEXT(); + error B_INVALID_GAS_LIMIT(); + error B_INVALID_SIGNAL(); + error B_INVALID_TO(); + error B_INVALID_USER(); + error B_INVALID_VALUE(); + error B_NON_RETRIABLE(); + error B_NOT_FAILED(); + error B_NOT_RECEIVED(); + error B_PERMISSION_DENIED(); + error B_RECALLED_ALREADY(); + error B_STATUS_MISMATCH(); + + modifier sameChain(uint256 chainId) { + if (chainId != block.chainid) revert B_INVALID_CHAINID(); + _; + } receive() external payable { } @@ -43,195 +71,391 @@ contract Bridge is EssentialContract, IBridge, BridgeErrors { EssentialContract._init(_addressManager); } - /// @notice Sends a message from the current chain to the destination chain - /// specified in the message. + /// @notice Sends a message to the destination chain and takes custody + /// of Ether required in this contract. All extra Ether will be refunded. /// @inheritdoc IBridge function sendMessage(Message calldata message) external payable + override nonReentrant - returns (bytes32 msgHash) + returns (bytes32 msgHash, Message memory _message) { - return LibBridgeSend.sendMessage({ - state: _state, - resolver: AddressResolver(this), - message: message - }); + // Ensure the message user is not null. + if (message.user == address(0)) revert B_INVALID_USER(); + + // Check if the destination chain is enabled. + (bool destChainEnabled, address destBridge) = + isDestChainEnabled(message.destChainId); + + // Verify destination chain and to address. + if (!destChainEnabled) revert B_INVALID_CHAINID(); + if (message.destChainId == block.chainid) { + revert B_INVALID_CHAINID(); + } + + if (message.to == address(0)) revert B_INVALID_TO(); + if (message.to == destBridge) revert B_INVALID_TO(); + + // Ensure the sent value matches the expected amount. + uint256 expectedAmount = message.value + message.fee; + if (expectedAmount != msg.value) revert B_INVALID_VALUE(); + + // On Taiko, send the expectedAmount to the EtherVault; otherwise, store + // it on the Bridge. + address ethVault = resolve("ether_vault", true); + ethVault.sendEther(expectedAmount); + + _message = message; + // Configure message details and send signal to indicate message + // sending. + _message.id = nextMessageId++; + _message.from = msg.sender; + _message.srcChainId = block.chainid; + + msgHash = keccak256(abi.encode(_message)); + + ISignalService(resolve("signal_service", false)).sendSignal(msgHash); + emit MessageSent(msgHash, _message); } - /// @notice Processes a message received from another chain. - /// @inheritdoc IBridge - function processMessage( + /// @notice Recalls a failed message on its source chain, releasing + /// associated assets. + /// @dev This function checks if the message failed on the source chain and + /// releases associated Ether or tokens. + /// @param message The message whose associated Ether should be released. + /// @param proof The merkle inclusion proof. + function recallMessage( Message calldata message, bytes calldata proof ) external nonReentrant + sameChain(message.srcChainId) { - return LibBridgeProcess.processMessage({ - state: _state, - resolver: AddressResolver(this), - message: message, - proof: proof, - checkProof: shouldCheckProof() - }); + bytes32 msgHash = keccak256(abi.encode(message)); + if (isMessageRecalled[msgHash]) revert B_RECALLED_ALREADY(); + + bool received = _proveSignalReceived( + _signalForFailedMessage(msgHash), message.destChainId, proof + ); + if (!received) revert B_NOT_FAILED(); + + isMessageRecalled[msgHash] = true; + + // Release necessary Ether from EtherVault if on Taiko, otherwise it's + // already available on this Bridge. + address ethVault = resolve("ether_vault", true); + if (ethVault != address(0)) { + EtherVault(payable(ethVault)).releaseEther( + address(this), message.value + ); + } + + // Execute the recall logic based on the contract's support for the + // IRecallableSender interface + bool support = + message.from.supportsInterface(type(IRecallableSender).interfaceId); + if (support) { + IRecallableSender(message.from).onMessageRecalled{ + value: message.value + }(message, msgHash); + } else { + message.user.sendEther(message.value); + } + + emit MessageRecalled(msgHash); } - /// @notice Retries executing a message that previously failed on its - /// destination chain. - /// @inheritdoc IBridge - function retryMessage( + /// @notice Processes a bridge message on the destination chain. This + /// function is callable by any address, including the `message.user`. + /// @dev The process begins by hashing the message and checking the message + /// status in the bridge If the status is "NEW", custody of Ether is + /// taken from the EtherVault, and the message is invoked. The status is + /// updated accordingly, and processing fees are refunded as needed. + /// @param message The message to be processed. + /// @param proof The merkle inclusion proof. + function processMessage( Message calldata message, - bool isLastAttempt + bytes calldata proof ) external nonReentrant + sameChain(message.destChainId) { - return LibBridgeRetry.retryMessage({ - state: _state, - resolver: AddressResolver(this), - message: message, - isLastAttempt: isLastAttempt - }); + // If the gas limit is set to zero, only the user can process the + // message. + if (message.gasLimit == 0 && msg.sender != message.user) { + revert B_PERMISSION_DENIED(); + } + + bytes32 msgHash = keccak256(abi.encode(message)); + if (messageStatus[msgHash] != Status.NEW) revert B_STATUS_MISMATCH(); + + bool received = _proveSignalReceived(msgHash, message.srcChainId, proof); + if (!received) revert B_NOT_RECEIVED(); + + // Release necessary Ether from EtherVault if on Taiko, otherwise it's + // already available on this Bridge. + address ethVault = resolve("ether_vault", true); + if (ethVault != address(0)) { + EtherVault(payable(ethVault)).releaseEther( + address(this), message.value + message.fee + ); + } + + Status status; + uint256 refundAmount; + + // Process message differently based on the target address + if (message.to == address(this) || message.to == address(0)) { + // Handle special addresses that don't require actual invocation but + // mark message as DONE + status = Status.DONE; + refundAmount = message.value; + } else { + // Use the specified message gas limit if called by the user, else + // use remaining gas + uint256 gasLimit = + msg.sender == message.user ? gasleft() : message.gasLimit; + + if (_invokeMessageCall(message, msgHash, gasLimit)) { + status = Status.DONE; + } else { + status = Status.RETRIABLE; + ethVault.sendEther(message.value); + } + } + + // Update the message status + _updateMessageStatus(msgHash, status); + + // Determine the refund recipient + address refundTo = + message.refundTo == address(0) ? message.user : message.refundTo; + + // Refund the processing fee + if (msg.sender == refundTo) { + uint256 amount = message.fee + refundAmount; + refundTo.sendEther(amount); + } else { + // If sender is another address, reward it and refund the rest + msg.sender.sendEther(message.fee); + refundTo.sendEther(refundAmount); + } } - /// @notice Recalls a failed message on its source chain - /// @inheritdoc IBridge - function recallMessage( - IBridge.Message calldata message, - bytes calldata proof + /// @notice Retries to invoke the messageCall after releasing associated + /// Ether and tokens. + /// @dev This function can be called by any address, including the + /// `message.user`. + /// It attempts to invoke the messageCall and updates the message status + /// accordingly. + /// @param message The message to retry. + /// @param isLastAttempt Specifies if this is the last attempt to retry the + /// message. + function retryMessage( + Message calldata message, + bool isLastAttempt ) external nonReentrant + sameChain(message.destChainId) { - return LibBridgeRecall.recallMessage({ - state: _state, - resolver: AddressResolver(this), - message: message, - proof: proof, - checkProof: shouldCheckProof() - }); + // If the gasLimit is set to 0 or isLastAttempt is true, the caller must + // be the message.user. + if (message.gasLimit == 0 || isLastAttempt) { + if (msg.sender != message.user) revert B_PERMISSION_DENIED(); + } + + bytes32 msgHash = keccak256(abi.encode(message)); + if (messageStatus[msgHash] != Status.RETRIABLE) { + revert B_NON_RETRIABLE(); + } + + // Release necessary Ether from EtherVault if on Taiko, otherwise it's + // already available on this Bridge. + address ethVault = resolve("ether_vault", true); + if (ethVault != address(0)) { + EtherVault(payable(ethVault)).releaseEther( + address(this), message.value + ); + } + + // Attempt to invoke the messageCall. + if (_invokeMessageCall(message, msgHash, gasleft())) { + // Update the message status to "DONE" on successful invocation. + _updateMessageStatus(msgHash, Status.DONE); + } else { + // Update the message status to "FAILED" + _updateMessageStatus(msgHash, Status.FAILED); + // Release Ether back to EtherVault (if on Taiko it is OK) + // otherwise funds stay at Bridge anyways. + ethVault.sendEther(message.value); + } } - /// @notice Checks if the message with the given hash has been sent on its - /// source chain. - /// @inheritdoc IBridge - function isMessageSent(bytes32 msgHash) + /// @notice Checks if the message was sent. + /// @param message The message. + /// @return True if the message was sent. + function isMessageSent(Message calldata message) public view - virtual returns (bool) { - return LibBridgeSend.isMessageSent(AddressResolver(this), msgHash); + if (message.srcChainId != block.chainid) return false; + return ISignalService(resolve("signal_service", false)).isSignalSent({ + app: address(this), + signal: keccak256(abi.encode(message)) + }); } - /// @notice Checks if the message with the given hash has been received on - /// its destination chain. - /// @inheritdoc IBridge - function isMessageReceived( - bytes32 msgHash, - uint256 srcChainId, + /// @notice Checks if a msgHash has failed on its destination chain. + /// @param message The message. + /// @param proof The merkle inclusion proof. + /// @return Returns true if the message has failed, false otherwise. + function proveMessageFailed( + Message calldata message, bytes calldata proof ) public view - virtual - override returns (bool) { - return LibBridgeSend.isMessageReceived({ - resolver: AddressResolver(this), - msgHash: msgHash, - srcChainId: srcChainId, - proof: proof - }); + if (message.srcChainId != block.chainid) return false; + return _proveSignalReceived( + _signalForFailedMessage(keccak256(abi.encode(message))), + message.destChainId, + proof + ); } /// @notice Checks if a msgHash has failed on its destination chain. - /// @inheritdoc IBridge - function isMessageFailed( - bytes32 msgHash, - uint256 destChainId, + /// @param message The message. + /// @param proof The merkle inclusion proof. + /// @return Returns true if the message has failed, false otherwise. + function proveMessageReceived( + Message calldata message, bytes calldata proof ) public view - virtual - override returns (bool) { - return LibBridgeStatus.isMessageFailed({ - resolver: AddressResolver(this), - msgHash: msgHash, - destChainId: destChainId, - proof: proof - }); - } - - /// @notice Checks if a failed message has been recalled on its source - /// chain. - /// @inheritdoc IBridge - function isMessageRecalled(bytes32 msgHash) public view returns (bool) { - return _state.recalls[msgHash]; + if (message.destChainId != block.chainid) return false; + return _proveSignalReceived( + keccak256(abi.encode(message)), message.srcChainId, proof + ); } - /// @notice Gets the execution status of the message with the given hash on - /// its destination chain. - /// @param msgHash The hash of the message. - /// @return Returns the status of the message. - function getMessageStatus(bytes32 msgHash) + /// @notice Checks if the destination chain is enabled. + /// @param chainId The destination chain ID. + /// @return enabled True if the destination chain is enabled. + /// @return destBridge The bridge of the destination chain. + function isDestChainEnabled(uint256 chainId) public view - virtual - returns (LibBridgeStatus.MessageStatus) + returns (bool enabled, address destBridge) { - return LibBridgeStatus.getMessageStatus(msgHash); + destBridge = resolve(chainId, "bridge", true); + enabled = destBridge != address(0); } /// @notice Gets the current context. /// @inheritdoc IBridge function context() public view returns (Context memory) { - return _state.ctx; + if (_ctx.msgHash == 0 || _ctx.msgHash == MESSAGE_HASH_PLACEHOLDER) { + revert B_INVALID_CONTEXT(); + } + return _ctx; } - /// @notice Checks if the destination chain with the given ID is enabled. - /// @param _chainId The ID of the chain. - /// @return enabled Returns true if the destination chain is enabled, false - /// otherwise. - function isDestChainEnabled(uint256 _chainId) - public - view - returns (bool enabled) + /// @notice Invokes a call message on the Bridge. + /// @param message The call message to be invoked. + /// @param msgHash The hash of the message. + /// @param gasLimit The gas limit for the message call. + /// @return success A boolean value indicating whether the message call was + /// successful. + /// @dev This function updates the context in the state before and after the + /// message call. + function _invokeMessageCall( + Message calldata message, + bytes32 msgHash, + uint256 gasLimit + ) + private + returns (bool success) { - (enabled,) = - LibBridgeSend.isDestChainEnabled(AddressResolver(this), _chainId); + if (gasLimit == 0) revert B_INVALID_GAS_LIMIT(); + + // Update the context for the message call + // Should we simply provide the message itself rather than + // a context object? + _ctx = Context({ + msgHash: msgHash, + from: message.from, + srcChainId: message.srcChainId + }); + + // Perform the message call and capture the success value + (success,) = + message.to.call{ value: message.value, gas: gasLimit }(message.data); + + // Reset the context after the message call + _ctx = Context({ + msgHash: MESSAGE_HASH_PLACEHOLDER, + from: SRC_CHAIN_SENDER_PLACEHOLDER, + srcChainId: CHAINID_PLACEHOLDER + }); } - /// @notice Computes the hash of a given message. - /// @inheritdoc IBridge - function hashMessage(Message calldata message) - public - pure - returns (bytes32) + /// @notice Updates the status of a bridge message. + /// @dev If the new status is different from the current status in the + /// mapping, the status is updated and an event is emitted. + /// @param msgHash The hash of the message. + /// @param status The new status of the message. + function _updateMessageStatus(bytes32 msgHash, Status status) private { + if (messageStatus[msgHash] == status) return; + + messageStatus[msgHash] = status; + emit MessageStatusChanged(msgHash, status); + + if (status != Status.FAILED) return; + + ISignalService(resolve("signal_service", false)).sendSignal( + _signalForFailedMessage(msgHash) + ); + } + + /// @notice Checks if the signal was received. + /// @param signal The signal. + /// @param srcChainId The ID of the source chain. + /// @param proof The merkle inclusion proof. + /// @return True if the message was received. + function _proveSignalReceived( + bytes32 signal, + uint256 srcChainId, + bytes calldata proof + ) + private + view + returns (bool) { - return LibBridgeData.hashMessage(message); + return ISignalService(resolve("signal_service", false)) + .proveSignalReceived({ + srcChainId: srcChainId, + app: resolve(srcChainId, "bridge", false), + signal: signal, + proof: proof + }); } - /// @notice Gets the slot associated with a given message hash status. - /// @param msgHash The hash of the message. - /// @return Returns the slot associated with the given message hash status. - function getMessageStatusSlot(bytes32 msgHash) - public + function _signalForFailedMessage(bytes32 msgHash) + private pure returns (bytes32) { - return LibBridgeStatus.getMessageStatusSlot(msgHash); - } - - /// @notice Tells if we need to check real proof or it is a test. - /// @return Returns true if this contract, or can be false if mock/test. - function shouldCheckProof() internal pure virtual returns (bool) { - return true; + return msgHash ^ bytes32(uint256(Status.FAILED)); } } diff --git a/packages/protocol/contracts/bridge/BridgeErrors.sol b/packages/protocol/contracts/bridge/BridgeErrors.sol deleted file mode 100644 index 3b90dc0acfb..00000000000 --- a/packages/protocol/contracts/bridge/BridgeErrors.sol +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -/// @title BridgeErrors -/// @dev This abstract contract defines custom errors that are used throughout -/// the Bridge contract. -abstract contract BridgeErrors { - error B_DENIED(); - error B_ERC20_CANNOT_RECEIVE(); - error B_MSG_RECALLED_ALREADY(); - error B_EV_DO_NOT_BURN(); - error B_EV_NOT_AUTHORIZED(); - error B_EV_PARAM(); - error B_FAILED_TRANSFER(); - error B_FORBIDDEN(); - error B_GAS_LIMIT(); - error B_INCORRECT_VALUE(); - error B_INIT_PARAM_ERROR(); - error B_MSG_HASH_NULL(); - error B_MSG_NON_RETRIABLE(); - error B_MSG_NOT_FAILED(); - error B_NULL_APP_ADDR(); - error B_USER_IS_NULL(); - error B_SIGNAL_NOT_RECEIVED(); - error B_STATUS_MISMATCH(); - error B_WRONG_CHAIN_ID(); - error B_WRONG_TO_ADDRESS(); - error B_ZERO_SIGNAL(); -} diff --git a/packages/protocol/contracts/bridge/EtherVault.sol b/packages/protocol/contracts/bridge/EtherVault.sol index 534297b717e..344560e243d 100644 --- a/packages/protocol/contracts/bridge/EtherVault.sol +++ b/packages/protocol/contracts/bridge/EtherVault.sol @@ -10,27 +10,26 @@ import { EssentialContract } from "../common/EssentialContract.sol"; import { LibAddress } from "../libs/LibAddress.sol"; import { Proxied } from "../common/Proxied.sol"; -import { BridgeErrors } from "./BridgeErrors.sol"; - /// @title EtherVault /// @notice This contract is initialized with 2^128 Ether and allows authorized /// addresses to release Ether. /// @dev Only the contract owner can authorize or deauthorize addresses. -contract EtherVault is EssentialContract, BridgeErrors { +contract EtherVault is EssentialContract { using LibAddress for address; - mapping(address addr => bool isAuthorized) private _authorizedAddrs; // Authorized - // addresses + mapping(address addr => bool authorized) public isAuthorized; uint256[49] private __gap; event Authorized(address indexed addr, bool authorized); event EtherReleased(address indexed to, uint256 amount); + error VAULT_PERMISSION_DENIED(); + error VAULT_INVALID_RECIPIENT(); + error VAULT_INVALID_PARAMS(); + modifier onlyAuthorized() { // Ensure the caller is authorized to perform the action - if (!isAuthorized(msg.sender)) { - revert B_EV_NOT_AUTHORIZED(); - } + if (!isAuthorized[msg.sender]) revert VAULT_PERMISSION_DENIED(); _; } @@ -38,8 +37,8 @@ contract EtherVault is EssentialContract, BridgeErrors { /// @dev Only authorized addresses can send Ether to the contract. receive() external payable { // EthVault's balance must == 0 OR the sender isAuthorized. - if (address(this).balance != 0 && !isAuthorized(msg.sender)) { - revert B_EV_NOT_AUTHORIZED(); + if (address(this).balance != 0 && !isAuthorized[msg.sender]) { + revert VAULT_PERMISSION_DENIED(); } } @@ -69,10 +68,8 @@ contract EtherVault is EssentialContract, BridgeErrors { onlyAuthorized nonReentrant { - if (amount == 0) return; - if (recipient == address(0)) { - revert B_EV_DO_NOT_BURN(); - } + if (recipient == address(0)) revert VAULT_INVALID_RECIPIENT(); + recipient.sendEther(amount); emit EtherReleased(recipient, amount); } @@ -82,17 +79,11 @@ contract EtherVault is EssentialContract, BridgeErrors { /// @param addr Address to set the authorized status of. /// @param authorized Authorized status to set. function authorize(address addr, bool authorized) public onlyOwner { - if (addr == address(0) || _authorizedAddrs[addr] == authorized) { - revert B_EV_PARAM(); - } - _authorizedAddrs[addr] = authorized; - emit Authorized(addr, authorized); - } + if (addr == address(0)) revert VAULT_INVALID_PARAMS(); + if (isAuthorized[addr] == authorized) revert VAULT_INVALID_PARAMS(); - /// @notice Gets the authorized status of an address. - /// @param addr Address to get the authorized status of. - function isAuthorized(address addr) public view returns (bool) { - return _authorizedAddrs[addr]; + isAuthorized[addr] = authorized; + emit Authorized(addr, authorized); } } diff --git a/packages/protocol/contracts/bridge/IBridge.sol b/packages/protocol/contracts/bridge/IBridge.sol index dffd7aa54d4..bad6efb3c47 100644 --- a/packages/protocol/contracts/bridge/IBridge.sol +++ b/packages/protocol/contracts/bridge/IBridge.sol @@ -6,20 +6,11 @@ pragma solidity ^0.8.20; -/// @title IRecallableMessageSender -/// @notice An interface that all recallable message senders shall implement. -interface IRecallableMessageSender { - function onMessageRecalled(IBridge.Message calldata message) - external - payable; -} - /// @title IBridge /// @notice The bridge used in conjunction with the {ISignalService}. /// @dev Ether is held by Bridges on L1 and by the EtherVault on L2, /// not by token vaults. interface IBridge { - // Struct representing a message sent across the bridge. struct Message { // Message ID. uint256 id; @@ -54,98 +45,28 @@ interface IBridge { uint256 srcChainId; // Source chain ID. } - event SignalSent(address indexed sender, bytes32 msgHash); - event MessageSent(bytes32 indexed msgHash, Message message); - event MessageRecalled(bytes32 indexed msgHash); - /// @notice Sends a message to the destination chain and takes custody /// of Ether required in this contract. All extra Ether will be refunded. /// @param message The message to be sent. /// @return msgHash The hash of the sent message. - function sendMessage(Message memory message) + /// @return updatedMessage The updated message sent. + function sendMessage(Message calldata message) external payable - returns (bytes32 msgHash); - - /// @notice Processes a message received from another chain. - /// @param message The message to process. - /// @param proof The proof of the cross-chain transfer. - function processMessage( - Message calldata message, - bytes calldata proof - ) - external; - - /// @notice Retries executing a message that previously failed on its - /// destination chain. - /// @param message The message to retry. - /// @param isLastAttempt Specifies whether this is the last attempt to send - /// the message. - function retryMessage( - Message calldata message, - bool isLastAttempt - ) - external; - - /// @notice Recalls a failed message on its source chain. - /// @param message The message to be recalled. - /// @param proof The proof of message processing failure. - function recallMessage( - IBridge.Message calldata message, - bytes calldata proof - ) - external; - - /// @notice Checks if the message with the given hash has been sent on its - /// source chain. - /// @param msgHash The hash of the message. - /// @return Returns true if the message has been sent, false otherwise. - function isMessageSent(bytes32 msgHash) external view returns (bool); - - /// @notice Checks if the message with the given hash has been received on - /// its destination chain. - /// @param msgHash The hash of the message. - /// @param srcChainId The source chain ID. - /// @param proof The proof of message receipt. - /// @return Returns true if the message has been received, false otherwise. - function isMessageReceived( - bytes32 msgHash, - uint256 srcChainId, - bytes calldata proof - ) - external - view - returns (bool); - - /// @notice Checks if a msgHash has failed on its destination chain. - /// @param msgHash The hash of the message. - /// @param destChainId The destination chain ID. - /// @param proof The proof of message failure. - /// @return Returns true if the message has failed, false otherwise. - function isMessageFailed( - bytes32 msgHash, - uint256 destChainId, - bytes calldata proof - ) - external - view - returns (bool); - - /// @notice Checks if a failed message has been recalled on its source - /// chain. - /// @param msgHash The hash of the message. - /// @return Returns true if the Ether has been released, false otherwise. - function isMessageRecalled(bytes32 msgHash) external view returns (bool); + returns (bytes32 msgHash, Message memory updatedMessage); /// @notice Returns the bridge state context. /// @return context The context of the current bridge operation. function context() external view returns (Context memory context); +} - /// @notice Computes the hash of a given message. - /// @param message The message to compute the hash for. - /// @return Returns the hash of the message. - function hashMessage(IBridge.Message calldata message) +/// @title IRecallableSender +/// @notice An interface that all recallable message senders shall implement. +interface IRecallableSender { + function onMessageRecalled( + IBridge.Message calldata message, + bytes32 msgHash + ) external - pure - returns (bytes32); + payable; } diff --git a/packages/protocol/contracts/bridge/README.md b/packages/protocol/contracts/bridge/README.md index f13f4c0836e..227c3bd8a8c 100644 --- a/packages/protocol/contracts/bridge/README.md +++ b/packages/protocol/contracts/bridge/README.md @@ -95,7 +95,7 @@ struct BridgeTransferOp { If the `processingFee` is set to 0, only the user can call `processMessage`. Otherwise, either the user or an off-chain relayer can process the message. Let's explain the next steps in the case of a relayer -- the user will have to do the same steps anyways. In the case of a relayer, the relayer picks up the event and **generates a proof from srcChain** -- this can be obtained with `eth_getProof` on the srcChain bridge contract. This proof is sent along with the signal to `processMessage` on the destChain bridge contract. -The `processMessage` call will first check that the message has not been processed yet, this status is stored in the destination chain's bridge contract state as `messageStatus`. Next, the proof (that the message is indeed sent to the SignalService on the source chain) is checked inside `isSignalReceived`. The proof demonstrates that the storage on the `Bridge` contract on srcChain contains the `key` with a value of `1`. `LibTrieProof` takes the proof, the signal, and the message sender address to check the `key` is set on the srcChain bridge contract state. This verifies that the message is sent on srcChain. Next, `isSignalReceived` gets the header hash on destChain of the header height specified in the proof. It then checks that this hash is equal to the hash specified in the proof. This will verify that the message is received on destChain. +The `processMessage` call will first check that the message has not been processed yet, this status is stored in the destination chain's bridge contract state as `statuses`. Next, the proof (that the message is indeed sent to the SignalService on the source chain) is checked inside `proveSignalReceived`. The proof demonstrates that the storage on the `Bridge` contract on srcChain contains the `key` with a value of `1`. `LibSecureMerkleTrie` takes the proof, the signal, and the message sender address to check the `key` is set on the srcChain bridge contract state. This verifies that the message is sent on srcChain. Next, `proveSignalReceived` gets the header hash on destChain of the header height specified in the proof. It then checks that this hash is equal to the hash specified in the proof. This will verify that the message is received on destChain. The `processMessage` call will then proceed to invoke the message call, which will actually take the Ether from the vault and send it to the specified address. If it succeeds, it will mark the message as "DONE" on the srcChain bridge state. If it fails, it will mark the message as "RETRIABLE" and send the Ether back to the vault. Later, `retryMessage` can be called **only** by the user (`processMessage` cannot be called again for this message by the relayer). @@ -103,4 +103,4 @@ Finally, any unused funds are sent back to the user as a refund. ### Failed bridging -If the `messageStatus` is "RETRIABLE" and - for whatever reason - the second try also cannot successfully initiate releasing the funds/tokens to the recipient on the destination chain, the `messageStatus` will be set to "FAILED". In this case the `recallMessage` shall be called on the source chain's Bridge contract (with `message` and `proof` input params), which will send the assets back to the user. +If the `statuses` is "RETRIABLE" and - for whatever reason - the second try also cannot successfully initiate releasing the funds/tokens to the recipient on the destination chain, the `statuses` will be set to "FAILED". In this case the `recallMessage` shall be called on the source chain's Bridge contract (with `message` and `proof` input params), which will send the assets back to the user. diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeData.sol b/packages/protocol/contracts/bridge/libs/LibBridgeData.sol deleted file mode 100644 index 582418153b1..00000000000 --- a/packages/protocol/contracts/bridge/libs/LibBridgeData.sol +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ -pragma solidity ^0.8.20; - -import { BlockHeader } from "../../libs/LibBlockHeader.sol"; - -import { IBridge } from "../IBridge.sol"; - -/// @title LibBridgeData -/// @notice This library provides functions and data structures for storing and -/// managing message metadata on the Bridge. -/// The library is used to keep track of the state of messages that are being -/// transferred across the bridge, and it contains functions to hash messages -/// and check their status. -library LibBridgeData { - /// @dev The State struct stores the state of messages in the Bridge - /// contract. - struct State { - uint256 nextMessageId; - IBridge.Context ctx; // 3 slots - mapping(bytes32 msgHash => bool recalled) recalls; - uint256[45] __gap; - } - - /// @dev StatusProof holds the block header and proof for a particular - /// status. - struct StatusProof { - BlockHeader header; - bytes proof; - } - - bytes32 internal constant MESSAGE_HASH_PLACEHOLDER = bytes32(uint256(1)); - uint256 internal constant CHAINID_PLACEHOLDER = type(uint256).max; - address internal constant SRC_CHAIN_SENDER_PLACEHOLDER = - address(uint160(uint256(1))); - - // Note: These events must match the ones defined in Bridge.sol. - event MessageSent(bytes32 indexed msgHash, IBridge.Message message); - event DestChainEnabled(uint256 indexed chainId, bool enabled); - - /// @notice Calculates the keccak256 hash of the message. - /// @param message The message to be hashed. - /// @return msgHash The keccak256 hash of the message. - function hashMessage(IBridge.Message memory message) - internal - pure - returns (bytes32) - { - return keccak256(abi.encode(message)); - } -} diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeInvoke.sol b/packages/protocol/contracts/bridge/libs/LibBridgeInvoke.sol deleted file mode 100644 index 56920f07782..00000000000 --- a/packages/protocol/contracts/bridge/libs/LibBridgeInvoke.sol +++ /dev/null @@ -1,64 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { IBridge } from "../IBridge.sol"; - -import { LibBridgeData } from "./LibBridgeData.sol"; - -/// @title LibBridgeInvoke -/// @notice This library provides functions for handling the invocation of call -/// messages on the Bridge. -/// The library facilitates the interaction with messages sent across the -/// bridge, allowing for call execution and state updates. -library LibBridgeInvoke { - using LibBridgeData for IBridge.Message; - - error B_GAS_LIMIT(); - - /// @notice Invokes a call message on the Bridge. - /// @param state The current state of the Bridge. - /// @param message The call message to be invoked. - /// @param msgHash The hash of the message. - /// @param gasLimit The gas limit for the message call. - /// @return success A boolean value indicating whether the message call was - /// successful. - /// @dev This function updates the context in the state before and after the - /// message call. - function invokeMessageCall( - LibBridgeData.State storage state, - IBridge.Message calldata message, - bytes32 msgHash, - uint256 gasLimit - ) - internal - returns (bool success) - { - if (gasLimit == 0) { - revert B_GAS_LIMIT(); - } - // Update the context for the message call - // Should we simply provide the message itself rather than - // a context object? - state.ctx = IBridge.Context({ - msgHash: msgHash, - from: message.from, - srcChainId: message.srcChainId - }); - - // Perform the message call and capture the success value - (success,) = - message.to.call{ value: message.value, gas: gasLimit }(message.data); - - // Reset the context after the message call - state.ctx = IBridge.Context({ - msgHash: LibBridgeData.MESSAGE_HASH_PLACEHOLDER, - from: LibBridgeData.SRC_CHAIN_SENDER_PLACEHOLDER, - srcChainId: LibBridgeData.CHAINID_PLACEHOLDER - }); - } -} diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeProcess.sol b/packages/protocol/contracts/bridge/libs/LibBridgeProcess.sol deleted file mode 100644 index 17a6729c98e..00000000000 --- a/packages/protocol/contracts/bridge/libs/LibBridgeProcess.sol +++ /dev/null @@ -1,149 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { AddressResolver } from "../../common/AddressResolver.sol"; -import { ISignalService } from "../../signal/ISignalService.sol"; -import { LibAddress } from "../../libs/LibAddress.sol"; - -import { EtherVault } from "../EtherVault.sol"; -import { IBridge } from "../IBridge.sol"; - -import { LibBridgeData } from "./LibBridgeData.sol"; -import { LibBridgeInvoke } from "./LibBridgeInvoke.sol"; -import { LibBridgeStatus } from "./LibBridgeStatus.sol"; - -/// @title LibBridgeProcess Library -/// @notice This library provides functions for processing bridge messages on -/// the destination chain. -/// The library handles the execution of bridge messages, status updates, and -/// fee refunds. -library LibBridgeProcess { - using LibAddress for address; - using LibBridgeData for IBridge.Message; - using LibBridgeData for LibBridgeData.State; - - error B_FORBIDDEN(); - error B_SIGNAL_NOT_RECEIVED(); - error B_STATUS_MISMATCH(); - error B_WRONG_CHAIN_ID(); - - /// @notice Processes a bridge message on the destination chain. This - /// function is callable by any address, including the `message.user`. - /// @dev The process begins by hashing the message and checking the message - /// status in the bridge state. If the status is "NEW", custody of Ether is - /// taken from the EtherVault, and the message is invoked. The status is - /// updated accordingly, and processing fees are refunded as needed. - /// @param state The state of the bridge. - /// @param resolver The address resolver. - /// @param message The message to be processed. - /// @param proof The proof of the message hash from the source chain. - /// @param checkProof A boolean flag indicating whether to verify the signal - /// receipt proof. - function processMessage( - LibBridgeData.State storage state, - AddressResolver resolver, - IBridge.Message calldata message, - bytes calldata proof, - bool checkProof - ) - internal - { - // If the gas limit is set to zero, only the user can process the - // message. - if (message.gasLimit == 0 && msg.sender != message.user) { - revert B_FORBIDDEN(); - } - - if (message.destChainId != block.chainid) { - revert B_WRONG_CHAIN_ID(); - } - - // The message status must be "NEW"; "RETRIABLE" is managed in - // LibBridgeRetry.sol. - bytes32 msgHash = message.hashMessage(); - if ( - LibBridgeStatus.getMessageStatus(msgHash) - != LibBridgeStatus.MessageStatus.NEW - ) { - revert B_STATUS_MISMATCH(); - } - - // Check if the signal has been received on the source chain - address srcBridge = - resolver.resolve(message.srcChainId, "bridge", false); - - if ( - checkProof - && !ISignalService(resolver.resolve("signal_service", false)) - .isSignalReceived({ - srcChainId: message.srcChainId, - app: srcBridge, - signal: msgHash, - proof: proof - }) - ) { - revert B_SIGNAL_NOT_RECEIVED(); - } - - // Release necessary Ether from EtherVault if on Taiko, otherwise it's - // already available on this Bridge. - address ethVault = resolver.resolve("ether_vault", true); - if (ethVault != address(0)) { - EtherVault(payable(ethVault)).releaseEther( - address(this), message.value + message.fee - ); - } - - LibBridgeStatus.MessageStatus status; - uint256 refundAmount; - - // Process message differently based on the target address - if (message.to == address(this) || message.to == address(0)) { - // Handle special addresses that don't require actual invocation but - // mark message as DONE - status = LibBridgeStatus.MessageStatus.DONE; - refundAmount = message.value; - } else { - // Use the specified message gas limit if called by the user, else - // use remaining gas - uint256 gasLimit = - msg.sender == message.user ? gasleft() : message.gasLimit; - - bool success = LibBridgeInvoke.invokeMessageCall({ - state: state, - message: message, - msgHash: msgHash, - gasLimit: gasLimit - }); - - if (success) { - status = LibBridgeStatus.MessageStatus.DONE; - } else { - status = LibBridgeStatus.MessageStatus.RETRIABLE; - ethVault.sendEther(message.value); - } - } - - // Update the message status - LibBridgeStatus.updateMessageStatus(msgHash, status); - - // Determine the refund recipient - address refundTo = - message.refundTo == address(0) ? message.user : message.refundTo; - - // Refund the processing fee - if (msg.sender == refundTo) { - uint256 amount = message.fee + refundAmount; - refundTo.sendEther(amount); - } else { - // If sender is another address, reward it and refund the rest - msg.sender.sendEther(message.fee); - refundTo.sendEther(refundAmount); - } - } -} diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeRecall.sol b/packages/protocol/contracts/bridge/libs/LibBridgeRecall.sol deleted file mode 100644 index 1746595e7cb..00000000000 --- a/packages/protocol/contracts/bridge/libs/LibBridgeRecall.sol +++ /dev/null @@ -1,93 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { AddressResolver } from "../../common/AddressResolver.sol"; -import { LibAddress } from "../../libs/LibAddress.sol"; - -import { EtherVault } from "../EtherVault.sol"; -import { IRecallableMessageSender, IBridge } from "../IBridge.sol"; - -import { LibBridgeData } from "./LibBridgeData.sol"; -import { LibBridgeStatus } from "./LibBridgeStatus.sol"; - -/// @title LibBridgeRecall -/// @notice This library provides functions for releasing Ether and tokens -/// related to message execution on the Bridge. -/// The library allows recalling failed messages on their source chain, -/// releasing associated assets. -library LibBridgeRecall { - using LibBridgeData for IBridge.Message; - using LibAddress for address; - - event MessageRecalled(bytes32 indexed msgHash); - - error B_MSG_NOT_FAILED(); - error B_MSG_RECALLED_ALREADY(); - - /// @notice Recalls a failed message on its source chain, releasing - /// associated assets. - /// @dev This function checks if the message failed on the source chain and - /// releases associated Ether or tokens. - /// @param state The current state of the Bridge. - /// @param resolver The AddressResolver instance. - /// @param message The message whose associated Ether should be released. - /// @param proof The proof data. - /// @param checkProof A flag indicating whether to check the proof (test - /// version). - function recallMessage( - LibBridgeData.State storage state, - AddressResolver resolver, - IBridge.Message calldata message, - bytes calldata proof, - bool checkProof - ) - internal - { - bytes32 msgHash = message.hashMessage(); - - if (state.recalls[msgHash]) { - revert B_MSG_RECALLED_ALREADY(); - } - - if ( - checkProof - && !LibBridgeStatus.isMessageFailed( - resolver, msgHash, message.destChainId, proof - ) - ) { - revert B_MSG_NOT_FAILED(); - } - - state.recalls[msgHash] = true; - - // Release necessary Ether from EtherVault if on Taiko, otherwise it's - // already available on this Bridge. - address ethVault = resolver.resolve("ether_vault", true); - if (ethVault != address(0)) { - EtherVault(payable(ethVault)).releaseEther( - address(this), message.value - ); - } - - // Execute the recall logic based on the contract's support for the - // IRecallableMessageSender interface - if ( - message.from.supportsInterface( - type(IRecallableMessageSender).interfaceId - ) - ) { - IRecallableMessageSender(message.from).onMessageRecalled{ - value: message.value - }(message); - } else { - message.user.sendEther(message.value); - } - - emit MessageRecalled(msgHash); - } -} diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeRetry.sol b/packages/protocol/contracts/bridge/libs/LibBridgeRetry.sol deleted file mode 100644 index 82092e68a7d..00000000000 --- a/packages/protocol/contracts/bridge/libs/LibBridgeRetry.sol +++ /dev/null @@ -1,99 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { AddressResolver } from "../../common/AddressResolver.sol"; -import { LibAddress } from "../../libs/LibAddress.sol"; - -import { EtherVault } from "../EtherVault.sol"; -import { IBridge } from "../IBridge.sol"; - -import { LibBridgeData } from "./LibBridgeData.sol"; -import { LibBridgeInvoke } from "./LibBridgeInvoke.sol"; -import { LibBridgeStatus } from "./LibBridgeStatus.sol"; - -/// @title LibBridgeRetry -/// @notice This library provides functions for retrying bridge messages that -/// are marked as "RETRIABLE". -/// The library facilitates the process of invoking the messageCall after -/// releasing any associated Ether, allowing for retries. -/// It handles the transition of message status from "RETRIABLE" to "DONE" on -/// success, and to "FAILED" on the last attempt if unsuccessful. -library LibBridgeRetry { - using LibAddress for address; - using LibBridgeData for IBridge.Message; - using LibBridgeData for LibBridgeData.State; - - error B_DENIED(); - error B_MSG_NON_RETRIABLE(); - - /// @notice Retries to invoke the messageCall after releasing associated - /// Ether and tokens. - /// @dev This function can be called by any address, including the - /// `message.user`. - /// It attempts to invoke the messageCall and updates the message status - /// accordingly. - /// @param state The current state of the Bridge. - /// @param resolver The address resolver. - /// @param message The message to retry. - /// @param isLastAttempt Specifies if this is the last attempt to retry the - /// message. - function retryMessage( - LibBridgeData.State storage state, - AddressResolver resolver, - IBridge.Message calldata message, - bool isLastAttempt - ) - internal - { - // If the gasLimit is set to 0 or isLastAttempt is true, the caller must - // be the message.user. - if (message.gasLimit == 0 || isLastAttempt) { - if (msg.sender != message.user) revert B_DENIED(); - } - - bytes32 msgHash = message.hashMessage(); - if ( - LibBridgeStatus.getMessageStatus(msgHash) - != LibBridgeStatus.MessageStatus.RETRIABLE - ) { - revert B_MSG_NON_RETRIABLE(); - } - - // Release necessary Ether from EtherVault if on Taiko, otherwise it's - // already available on this Bridge. - address ethVault = resolver.resolve("ether_vault", true); - if (ethVault != address(0)) { - EtherVault(payable(ethVault)).releaseEther( - address(this), message.value - ); - } - - // Attempt to invoke the messageCall. - bool success = LibBridgeInvoke.invokeMessageCall({ - state: state, - message: message, - msgHash: msgHash, - gasLimit: gasleft() - }); - - if (success) { - // Update the message status to "DONE" on successful invocation. - LibBridgeStatus.updateMessageStatus( - msgHash, LibBridgeStatus.MessageStatus.DONE - ); - } else { - // Update the message status to "FAILED" - LibBridgeStatus.updateMessageStatus( - msgHash, LibBridgeStatus.MessageStatus.FAILED - ); - // Release Ether back to EtherVault (if on Taiko it is OK) - // otherwise funds stay at Bridge anyways. - ethVault.sendEther(message.value); - } - } -} diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeSend.sol b/packages/protocol/contracts/bridge/libs/LibBridgeSend.sol deleted file mode 100644 index ef1f48a19ac..00000000000 --- a/packages/protocol/contracts/bridge/libs/LibBridgeSend.sol +++ /dev/null @@ -1,147 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { AddressResolver } from "../../common/AddressResolver.sol"; -import { ISignalService } from "../../signal/ISignalService.sol"; -import { LibAddress } from "../../libs/LibAddress.sol"; - -import { IBridge } from "../IBridge.sol"; - -import { LibBridgeData } from "./LibBridgeData.sol"; - -/// @title LibBridgeSend -/// @notice This library provides functions for sending bridge messages and -/// checking their status. -/// The library facilitates the process of sending messages to the Bridge, -/// validating input parameters, and managing Ether custody based on destination -/// chains. -library LibBridgeSend { - using LibAddress for address; - using LibBridgeData for IBridge.Message; - - error B_INCORRECT_VALUE(); - error B_USER_IS_NULL(); - error B_WRONG_CHAIN_ID(); - error B_WRONG_TO_ADDRESS(); - - /// @notice Sends a message to the Bridge with the details of the request. - /// @dev This function takes custody of the specified funds, sending them to - /// the EtherVault on Taiko or storing them on the Bridge for processing on - /// the destination chain. - /// @param state The current state of the Bridge. - /// @param resolver The address resolver. - /// @param message The message to be sent, including value and fee details. - /// @return msgHash The hash of the sent message. - function sendMessage( - LibBridgeData.State storage state, - AddressResolver resolver, - IBridge.Message memory message - ) - internal - returns (bytes32 msgHash) - { - // Ensure the message user is not null. - if (message.user == address(0)) { - revert B_USER_IS_NULL(); - } - - // Check if the destination chain is enabled. - (bool destChainEnabled, address destBridge) = - isDestChainEnabled(resolver, message.destChainId); - - // Verify destination chain and to address. - if (!destChainEnabled || message.destChainId == block.chainid) { - revert B_WRONG_CHAIN_ID(); - } - if (message.to == address(0) || message.to == destBridge) { - revert B_WRONG_TO_ADDRESS(); - } - - // Ensure the sent value matches the expected amount. - uint256 expectedAmount = message.value + message.fee; - if (expectedAmount != msg.value) { - revert B_INCORRECT_VALUE(); - } - - // On Taiko, send the expectedAmount to the EtherVault; otherwise, store - // it on the Bridge. - address ethVault = resolver.resolve("ether_vault", true); - ethVault.sendEther(expectedAmount); - - // Configure message details and send signal to indicate message - // sending. - message.id = state.nextMessageId++; - message.from = msg.sender; - message.srcChainId = block.chainid; - - msgHash = message.hashMessage(); - ISignalService(resolver.resolve("signal_service", false)).sendSignal( - msgHash - ); - emit LibBridgeData.MessageSent(msgHash, message); - } - - /// @notice Checks if the destination chain is enabled. - /// @param resolver The address resolver. - /// @param chainId The destination chain ID. - /// @return enabled True if the destination chain is enabled. - /// @return destBridge The bridge of the destination chain. - function isDestChainEnabled( - AddressResolver resolver, - uint256 chainId - ) - internal - view - returns (bool enabled, address destBridge) - { - destBridge = resolver.resolve(chainId, "bridge", true); - enabled = destBridge != address(0); - } - - /// @notice Checks if the message was sent. - /// @param resolver The address resolver. - /// @param msgHash The hash of the sent message. - /// @return True if the message was sent. - function isMessageSent( - AddressResolver resolver, - bytes32 msgHash - ) - internal - view - returns (bool) - { - return ISignalService(resolver.resolve("signal_service", false)) - .isSignalSent({ app: address(this), signal: msgHash }); - } - - /// @notice Checks if the message was received. - /// @param resolver The address resolver. - /// @param msgHash The hash of the received message. - /// @param srcChainId The ID of the source chain. - /// @param proof The proof of message receipt. - /// @return True if the message was received. - function isMessageReceived( - AddressResolver resolver, - bytes32 msgHash, - uint256 srcChainId, - bytes calldata proof - ) - internal - view - returns (bool) - { - address srcBridge = resolver.resolve(srcChainId, "bridge", false); - return ISignalService(resolver.resolve("signal_service", false)) - .isSignalReceived({ - srcChainId: srcChainId, - app: srcBridge, - signal: msgHash, - proof: proof - }); - } -} diff --git a/packages/protocol/contracts/bridge/libs/LibBridgeStatus.sol b/packages/protocol/contracts/bridge/libs/LibBridgeStatus.sol deleted file mode 100644 index 64c45ff200c..00000000000 --- a/packages/protocol/contracts/bridge/libs/LibBridgeStatus.sol +++ /dev/null @@ -1,140 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { AddressResolver } from "../../common/AddressResolver.sol"; -import { BlockHeader, LibBlockHeader } from "../../libs/LibBlockHeader.sol"; -import { ICrossChainSync } from "../../common/ICrossChainSync.sol"; -import { LibTrieProof } from "../../libs/LibTrieProof.sol"; - -import { LibBridgeData } from "./LibBridgeData.sol"; - -/// @title LibBridgeStatus -/// @notice This library provides functions for getting and updating the status -/// of bridge messages. -/// The library handles various aspects of message statuses, including their -/// retrieval, update, and verification of failure status on the destination -/// chain. -library LibBridgeStatus { - using LibBlockHeader for BlockHeader; - - enum MessageStatus { - NEW, - RETRIABLE, - DONE, - FAILED - } - - event MessageStatusChanged( - bytes32 indexed msgHash, MessageStatus status, address transactor - ); - - error B_MSG_HASH_NULL(); - error B_WRONG_CHAIN_ID(); - - /// @notice Updates the status of a bridge message. - /// @dev If the new status is different from the current status in the - /// mapping, the status is updated and an event is emitted. - /// @param msgHash The hash of the message. - /// @param status The new status of the message. - function updateMessageStatus( - bytes32 msgHash, - MessageStatus status - ) - internal - { - if (getMessageStatus(msgHash) != status) { - _setMessageStatus(msgHash, status); - emit MessageStatusChanged(msgHash, status, msg.sender); - } - } - - /// @notice Gets the status of a bridge message on the destination chain. - /// @param msgHash The hash of the message. - /// @return The status of the message. - function getMessageStatus(bytes32 msgHash) - internal - view - returns (MessageStatus) - { - bytes32 slot = getMessageStatusSlot(msgHash); - uint256 value; - assembly { - value := sload(slot) - } - return MessageStatus(value); - } - - /// @notice Checks whether a bridge message has failed on its destination - /// chain. - /// @param resolver The address resolver. - /// @param msgHash The hash of the message. - /// @param destChainId The ID of the destination chain. - /// @param proof The proof of the status of the message. - /// @return True if the message has failed, false otherwise. - function isMessageFailed( - AddressResolver resolver, - bytes32 msgHash, - uint256 destChainId, - bytes calldata proof - ) - internal - view - returns (bool) - { - if (destChainId == block.chainid) { - revert B_WRONG_CHAIN_ID(); - } - if (msgHash == 0x0) { - revert B_MSG_HASH_NULL(); - } - - LibBridgeData.StatusProof memory sp = - abi.decode(proof, (LibBridgeData.StatusProof)); - - bytes32 syncedHeaderHash = ICrossChainSync( - resolver.resolve("taiko", false) - ).getCrossChainBlockHash(uint64(sp.header.height)); - - if ( - syncedHeaderHash == 0 - || syncedHeaderHash != sp.header.hashBlockHeader() - ) { - return false; - } - - return LibTrieProof.verifyWithFullMerkleProof({ - stateRoot: sp.header.stateRoot, - addr: resolver.resolve(destChainId, "bridge", false), - slot: getMessageStatusSlot(msgHash), - value: bytes32(uint256(LibBridgeStatus.MessageStatus.FAILED)), - mkproof: sp.proof - }); - } - - /// @notice Gets the storage slot for a bridge message status. - /// @param msgHash The hash of the message. - /// @return The storage slot for the message status. - function getMessageStatusSlot(bytes32 msgHash) - internal - pure - returns (bytes32) - { - return keccak256(bytes.concat(bytes("MESSAGE_STATUS"), msgHash)); - } - - /// @notice Sets the status of a bridge message. - /// @param msgHash The hash of the message. - /// @param status The new status of the message. - function _setMessageStatus(bytes32 msgHash, MessageStatus status) private { - bytes32 slot = getMessageStatusSlot(msgHash); - uint256 value = uint256(status); - assembly { - sstore(slot, value) - } - } -} diff --git a/packages/protocol/contracts/common/AddressResolver.sol b/packages/protocol/contracts/common/AddressResolver.sol index 1be57c51b6a..04610fb5a34 100644 --- a/packages/protocol/contracts/common/AddressResolver.sol +++ b/packages/protocol/contracts/common/AddressResolver.sol @@ -18,12 +18,12 @@ import { IAddressManager } from "./AddressManager.sol"; /// is no setAddressManager() function go guarantee atomicness across all /// contracts that are resolvers. abstract contract AddressResolver { - IAddressManager internal _addressManager; + address public addressManager; uint256[49] private __gap; error RESOLVER_DENIED(); - error RESOLVER_INVALID_ADDR(); + error RESOLVER_INVALID_MANAGER(); error RESOLVER_ZERO_ADDR(uint256 chainId, bytes32 name); /// @dev Modifier that ensures the caller is the resolved address of a given @@ -83,17 +83,11 @@ abstract contract AddressResolver { return _resolve(chainId, name, allowZeroAddress); } - /// @notice Fetches the AddressManager's address. - /// @return The current address of the AddressManager. - function addressManager() public view returns (address) { - return address(_addressManager); - } - /// @dev Initialization method for setting up AddressManager reference. - /// @param addressManager_ Address of the AddressManager. - function _init(address addressManager_) internal virtual { - if (addressManager_ == address(0)) revert RESOLVER_INVALID_ADDR(); - _addressManager = IAddressManager(addressManager_); + /// @param _addressManager Address of the AddressManager. + function _init(address _addressManager) internal virtual { + if (_addressManager == address(0)) revert RESOLVER_INVALID_MANAGER(); + addressManager = _addressManager; } /// @dev Helper method to resolve name-to-address. @@ -112,7 +106,8 @@ abstract contract AddressResolver { view returns (address payable addr) { - addr = payable(_addressManager.getAddress(chainId, name)); + addr = + payable(IAddressManager(addressManager).getAddress(chainId, name)); if (!allowZeroAddress && addr == address(0)) { revert RESOLVER_ZERO_ADDR(chainId, name); diff --git a/packages/protocol/contracts/common/ICrossChainSync.sol b/packages/protocol/contracts/common/ICrossChainSync.sol index e0a4150a5d4..85903e36a87 100644 --- a/packages/protocol/contracts/common/ICrossChainSync.sol +++ b/packages/protocol/contracts/common/ICrossChainSync.sol @@ -13,6 +13,11 @@ pragma solidity ^0.8.20; /// block hashes across chains. The core idea is to ensure that data between /// both chains remain consistent and can be cross-referenced with integrity. interface ICrossChainSync { + struct Snippet { + bytes32 blockHash; + bytes32 signalRoot; + } + /// @dev Emitted when a block has been synced across chains. /// @param srcHeight The height (block id_ that was synced. /// @param blockHash The hash of the synced block. @@ -24,19 +29,9 @@ interface ICrossChainSync { /// @notice Fetches the hash of a block from the opposite chain. /// @param blockId The target block id. Specifying 0 retrieves the hash /// of the latest block. - /// @return The hash of the desired block from the other chain. - function getCrossChainBlockHash(uint64 blockId) - external - view - returns (bytes32); - - /// @notice Retrieves the root hash of the signal service storage for a - /// given block from the opposite chain. - /// @param blockId The target block id. Specifying 0 retrieves the root - /// of the latest block. - /// @return The root hash for the specified block's signal service. - function getCrossChainSignalRoot(uint64 blockId) + /// @return snippet The block hash and signal root synced. + function getSyncedSnippet(uint64 blockId) external view - returns (bytes32); + returns (Snippet memory snippet); } diff --git a/packages/protocol/contracts/libs/LibBlockHeader.sol b/packages/protocol/contracts/libs/LibBlockHeader.sol deleted file mode 100644 index c2becfd739c..00000000000 --- a/packages/protocol/contracts/libs/LibBlockHeader.sol +++ /dev/null @@ -1,96 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { LibRLPWriter } from "../thirdparty/LibRLPWriter.sol"; - -/// @dev Defines the data structure for an Ethereum block header. -struct BlockHeader { - bytes32 parentHash; - bytes32 ommersHash; - address proposer; - bytes32 stateRoot; - bytes32 transactionsRoot; - bytes32 receiptsRoot; - bytes32[8] logsBloom; - uint256 difficulty; - uint128 height; - uint64 gasLimit; - uint64 gasUsed; - uint64 timestamp; - bytes extraData; - bytes32 mixHash; - uint64 nonce; - uint256 baseFeePerGas; - bytes32 withdrawalsRoot; -} - -/// @title LibBlockHeader -/// @dev Provides utilities for Ethereum block headers. -library LibBlockHeader { - /// @dev Returns the hash of a block header. - /// @param header The block header. - /// @return The hash of the block header. - function hashBlockHeader(BlockHeader memory header) - internal - pure - returns (bytes32) - { - bytes memory rlpHeader = - LibRLPWriter.writeList(_getBlockHeaderRLPItemsList(header, 0)); - return keccak256(rlpHeader); - } - - /// @dev Constructs the RLP item list for a block header. - /// @param header The block header. - /// @param extraCapacity Additional capacity for the list. - /// @return list The RLP item list for the block header. - function _getBlockHeaderRLPItemsList( - BlockHeader memory header, - uint256 extraCapacity - ) - private - pure - returns (bytes[] memory list) - { - if (header.withdrawalsRoot != 0) { - // EIP-4895 transaction - list = new bytes[](17 + extraCapacity); - } else if (header.baseFeePerGas != 0) { - // EIP-1559 transaction - list = new bytes[](16 + extraCapacity); - } else { - // non-EIP-1559 transaction - list = new bytes[](15 + extraCapacity); - } - list[0] = LibRLPWriter.writeHash(header.parentHash); - list[1] = LibRLPWriter.writeHash(header.ommersHash); - list[2] = LibRLPWriter.writeAddress(header.proposer); - list[3] = LibRLPWriter.writeHash(header.stateRoot); - list[4] = LibRLPWriter.writeHash(header.transactionsRoot); - list[5] = LibRLPWriter.writeHash(header.receiptsRoot); - list[6] = LibRLPWriter.writeBytes(abi.encodePacked(header.logsBloom)); - list[7] = LibRLPWriter.writeUint(header.difficulty); - list[8] = LibRLPWriter.writeUint(header.height); - list[9] = LibRLPWriter.writeUint64(header.gasLimit); - list[10] = LibRLPWriter.writeUint64(header.gasUsed); - list[11] = LibRLPWriter.writeUint64(header.timestamp); - list[12] = LibRLPWriter.writeBytes(header.extraData); - list[13] = LibRLPWriter.writeHash(header.mixHash); - // According to the Ethereum yellow paper, we should treat `nonce` - // as [8]byte when hashing the block. - list[14] = LibRLPWriter.writeBytes(abi.encodePacked(header.nonce)); - if (header.baseFeePerGas != 0) { - // EIP-1559 transaction - list[15] = LibRLPWriter.writeUint(header.baseFeePerGas); - } - if (header.withdrawalsRoot != 0) { - // EIP-4895 transaction - list[16] = LibRLPWriter.writeHash(header.withdrawalsRoot); - } - } -} diff --git a/packages/protocol/contracts/libs/LibTrieProof.sol b/packages/protocol/contracts/libs/LibTrieProof.sol deleted file mode 100644 index dfc87b63eb6..00000000000 --- a/packages/protocol/contracts/libs/LibTrieProof.sol +++ /dev/null @@ -1,71 +0,0 @@ -// SPDX-License-Identifier: MIT -// _____ _ _ _ _ -// |_ _|_ _(_) |_____ | | __ _| |__ ___ -// | |/ _` | | / / _ \ | |__/ _` | '_ (_-< -// |_|\__,_|_|_\_\___/ |____\__,_|_.__/__/ - -pragma solidity ^0.8.20; - -import { LibRLPReader } from "../thirdparty/LibRLPReader.sol"; -import { LibRLPWriter } from "../thirdparty/LibRLPWriter.sol"; -import { LibSecureMerkleTrie } from "../thirdparty/LibSecureMerkleTrie.sol"; - -/// @title LibTrieProof -/// @dev This library is used for verifying the proof of values within the -/// storage trie of an Ethereum account. -library LibTrieProof { - // Constant defining the index for the storage hash in the RLP-encoded - // account structure. - // It follows the order: nonce, balance, storageHash, codeHash. - uint256 private constant ACCOUNT_FIELD_INDEX_STORAGE_HASH = 2; - - error INVALID_ACCOUNT_PROOF(); - - /// @dev Verifies that the value of a specific slot in the storage of an - /// account equals the given value. - /// @param stateRoot The merkle root of the state tree. - /// @param addr The address of the account. - /// @param slot The specific slot within the storage of the contract. - /// @param value The value to be verified against the proof. - /// @param mkproof The concatenated proof containing both account and - /// storage proofs. - /// @return verified Boolean result indicating if the proof is valid. - function verifyWithFullMerkleProof( - bytes32 stateRoot, - address addr, - bytes32 slot, - bytes32 value, - bytes calldata mkproof - ) - public - pure - returns (bool) - { - // Decoding the proof into account and storage proofs - (bytes memory accountProof, bytes memory storageProof) = - abi.decode(mkproof, (bytes, bytes)); - - // Retrieving the RLP-encoded account and verifying existence - (bool exists, bytes memory rlpAccount) = LibSecureMerkleTrie.get( - abi.encodePacked(addr), accountProof, stateRoot - ); - - if (!exists) revert INVALID_ACCOUNT_PROOF(); - - // Reading the RLP-encoded account into a structured list - LibRLPReader.RLPItem[] memory accountState = - LibRLPReader.readList(rlpAccount); - // Extracting the storage root from the RLP-encoded account - bytes32 storageRoot = LibRLPReader.readBytes32( - accountState[ACCOUNT_FIELD_INDEX_STORAGE_HASH] - ); - - // Verifying the inclusion proof for the value within the storage root - return LibSecureMerkleTrie.verifyInclusionProof( - abi.encodePacked(slot), - LibRLPWriter.writeBytes32(value), - storageProof, - storageRoot - ); - } -} diff --git a/packages/protocol/contracts/signal/ISignalService.sol b/packages/protocol/contracts/signal/ISignalService.sol index f5c43c92411..5073c9315ff 100644 --- a/packages/protocol/contracts/signal/ISignalService.sol +++ b/packages/protocol/contracts/signal/ISignalService.sol @@ -44,7 +44,7 @@ interface ISignalService { /// @param proof Merkle proof that the signal was persisted on the /// source chain. /// @return True if the signal has been received, otherwise false. - function isSignalReceived( + function proveSignalReceived( uint256 srcChainId, address app, bytes32 signal, diff --git a/packages/protocol/contracts/signal/SignalService.sol b/packages/protocol/contracts/signal/SignalService.sol index 6a02f09fbc2..7342c34925c 100644 --- a/packages/protocol/contracts/signal/SignalService.sol +++ b/packages/protocol/contracts/signal/SignalService.sol @@ -15,28 +15,29 @@ import { ISignalService } from "./ISignalService.sol"; /// @title SignalService /// @notice See the documentation in {ISignalService} for more details. -contract SignalService is ISignalService, EssentialContract { - struct SignalProof { +contract SignalService is EssentialContract, ISignalService { + struct Hop { + uint256 chainId; + bytes32 signalRoot; + bytes storageProof; + } + + struct Proof { uint64 height; - bytes proof; // A storage proof + bytes storageProof; + Hop[] hops; } - error B_ZERO_SIGNAL(); - error B_NULL_APP_ADDR(); - error B_WRONG_CHAIN_ID(); + error SS_INVALID_APP(); + error SS_INVALID_SIGNAL(); modifier validApp(address app) { - if (app == address(0)) revert B_NULL_APP_ADDR(); + if (app == address(0)) revert SS_INVALID_APP(); _; } modifier validSignal(bytes32 signal) { - if (signal == 0) revert B_ZERO_SIGNAL(); - _; - } - - modifier validChainId(uint256 srcChainId) { - if (srcChainId == block.chainid) revert B_WRONG_CHAIN_ID(); + if (signal == 0) revert SS_INVALID_SIGNAL(); _; } @@ -45,15 +46,19 @@ contract SignalService is ISignalService, EssentialContract { EssentialContract._init(_addressManager); } + /// @notice Tells if we need to check real proof or it is a test. + /// @return Returns true to skip checking inclusion proofs. + function skipProofCheck() public pure virtual returns (bool) { } + /// @inheritdoc ISignalService function sendSignal(bytes32 signal) public validSignal(signal) - returns (bytes32 storageSlot) + returns (bytes32 slot) { - storageSlot = getSignalSlot(msg.sender, signal); + slot = getSignalSlot(block.chainid, msg.sender, signal); assembly { - sstore(storageSlot, 1) + sstore(slot, 1) } } @@ -68,7 +73,7 @@ contract SignalService is ISignalService, EssentialContract { validSignal(signal) returns (bool) { - bytes32 slot = getSignalSlot(app, signal); + bytes32 slot = getSignalSlot(block.chainid, app, signal); uint256 value; assembly { value := sload(slot) @@ -77,7 +82,7 @@ contract SignalService is ISignalService, EssentialContract { } /// @inheritdoc ISignalService - function isSignalReceived( + function proveSignalReceived( uint256 srcChainId, address app, bytes32 signal, @@ -85,49 +90,73 @@ contract SignalService is ISignalService, EssentialContract { ) public view - validChainId(srcChainId) - validApp(app) - validSignal(signal) returns (bool) { - SignalProof memory signalProof = abi.decode(proof, (SignalProof)); - bytes32 syncedSignalRoot = ICrossChainSync(resolve("taiko", false)) - .getCrossChainSignalRoot(signalProof.height); + if (skipProofCheck()) return true; + + if ( + app == address(0) || signal == 0 || srcChainId == 0 + || srcChainId == block.chainid + ) { + return false; + } + + Proof memory p = abi.decode(proof, (Proof)); + if (p.storageProof.length == 0) return false; + + for (uint256 i; i < p.hops.length; ++i) { + if (p.hops[i].signalRoot == 0) return false; + if (p.hops[i].storageProof.length == 0) return false; + } + + // Check a chain of inclusion proofs. If this chain is chainA, and the + // message is sent on chainC, and we have chainB in the middle, we + // verify that chainB's signalRoot has been sent as a signal by chainB's + // "taiko" contract, then using chainB's signalRoot, we further check + // the signal is sent by chainC's "bridge" contract. + bytes32 signalRoot = ICrossChainSync(resolve("taiko", false)) + .getSyncedSnippet(p.height).signalRoot; + if (signalRoot == 0) return false; + + for (uint256 i; i < p.hops.length; ++i) { + Hop memory hop = p.hops[i]; + bytes32 slot = getSignalSlot( + hop.chainId, + resolve(hop.chainId, "taiko", false), + hop.signalRoot // as a signal + ); + bool verified = LibSecureMerkleTrie.verifyInclusionProof( + bytes.concat(slot), hex"01", hop.storageProof, signalRoot + ); + if (!verified) return false; + + signalRoot = hop.signalRoot; + } return LibSecureMerkleTrie.verifyInclusionProof( - bytes.concat(getSignalSlot(app, signal)), + bytes.concat(getSignalSlot(srcChainId, app, signal)), hex"01", - signalProof.proof, - syncedSignalRoot + p.storageProof, + signalRoot ); } /// @notice Get the storage slot of the signal. + /// @param chainId The address's chainId. /// @param app The address that initiated the signal. /// @param signal The signal to get the storage slot of. - /// @return signalSlot The unique storage slot of the signal which is + /// @return The unique storage slot of the signal which is /// created by encoding the sender address with the signal (message). function getSignalSlot( + uint256 chainId, address app, bytes32 signal ) public pure - returns (bytes32 signalSlot) + returns (bytes32) { - // Equivalent to `keccak256(abi.encodePacked(app, signal))` - assembly { - // Load the free memory pointer - let ptr := mload(0x40) - // Store the app address and signal bytes32 value in the allocated - // memory - mstore(ptr, app) - mstore(add(ptr, 32), signal) - // Calculate the hash of the concatenated arguments using keccak256 - signalSlot := keccak256(add(ptr, 12), 52) - // Update free memory pointer - mstore(0x40, add(ptr, 64)) - } + return keccak256(abi.encodePacked("SINGAL", chainId, app, signal)); } } diff --git a/packages/protocol/contracts/thirdparty/LibBytesUtils.sol b/packages/protocol/contracts/thirdparty/LibBytesUtils.sol index 53f17fd4154..dd411386bfe 100644 --- a/packages/protocol/contracts/thirdparty/LibBytesUtils.sol +++ b/packages/protocol/contracts/thirdparty/LibBytesUtils.sol @@ -90,18 +90,17 @@ library LibBytesUtils { mstore(tempBytes, _length) - //update free-memory pointer - //allocating the array padded to 32 bytes like the compiler does - // now + // update free-memory pointer allocating the array padded to 32 + // bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } - //if we want a zero-length slice let's just return a zero-length + // if we want a zero-length slice let's just return a zero-length // array default { tempBytes := mload(0x40) - //zero out the 32 bytes slice we are about to return - //we need to do it because Solidity does not garbage collect + // zero out the 32 bytes slice we are about to return + // we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) diff --git a/packages/protocol/contracts/thirdparty/LibRLPWriter.sol b/packages/protocol/contracts/thirdparty/LibRLPWriter.sol deleted file mode 100644 index e6c90933c03..00000000000 --- a/packages/protocol/contracts/thirdparty/LibRLPWriter.sol +++ /dev/null @@ -1,293 +0,0 @@ -// SPDX-License-Identifier: MIT -// Taken from -// https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts/contracts/libraries/rlp/LibRLPWriter.sol -// Modified to support writeBytes32/writeUint64 -// (The MIT License) -// -// Copyright 2020-2021 Optimism -// Copyright 2022-2023 Taiko Labs -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -pragma solidity ^0.8.20; - -/** - * @title LibRLPWriter - * @author Bakaoh (with modifications) - */ -library LibRLPWriter { - /** - * RLP encodes a byte string. - * @param _in The byte string to encode. - * @return The RLP encoded string in bytes. - */ - function writeBytes(bytes memory _in) - internal - pure - returns (bytes memory) - { - bytes memory encoded; - - if (_in.length == 1 && uint8(_in[0]) < 128) { - encoded = _in; - } else { - encoded = abi.encodePacked(_writeLength(_in.length, 128), _in); - } - - return encoded; - } - - /** - * RLP encodes a list of RLP encoded byte byte strings. - * @param _in The list of RLP encoded byte strings. - * @return The RLP encoded list of items in bytes. - */ - function writeList(bytes[] memory _in) - internal - pure - returns (bytes memory) - { - bytes memory list = _flatten(_in); - return abi.encodePacked(_writeLength(list.length, 192), list); - } - - /** - * RLP encodes a string. - * @param _in The string to encode. - * @return The RLP encoded string in bytes. - */ - function writeString(string memory _in) - internal - pure - returns (bytes memory) - { - return writeBytes(bytes(_in)); - } - - /** - * RLP encodes an address. - * @param _in The address to encode. - * @return The RLP encoded address in bytes. - */ - function writeAddress(address _in) internal pure returns (bytes memory) { - return writeBytes(abi.encodePacked(_in)); - } - - /** - * RLP encodes a uint. - * @param _in The uint256 to encode. - * @return The RLP encoded uint256 in bytes. - */ - function writeUint(uint256 _in) internal pure returns (bytes memory) { - return writeBytes(_toBinary(_in)); - } - - function writeBytes32(bytes32 _in) internal pure returns (bytes memory) { - return writeBytes(_toBinary(uint256(_in))); - } - - /** - * RLP encodes a hash, we should use this function but not writeBytes32 to - * encode a hash, since writeBytes32 will remove the leading zeros of the - * given bytes. - * @param _in The hash to encode. - * @return The RLP encoded hash in bytes. - */ - function writeHash(bytes32 _in) internal pure returns (bytes memory) { - return writeBytes(_toBinaryWithLeadingZeros(uint256(_in))); - } - - function writeUint64(uint64 _in) internal pure returns (bytes memory) { - return writeBytes(_toBinary(_in)); - } - - /** - * RLP encodes a bool. - * @param _in The bool to encode. - * @return The RLP encoded bool in bytes. - */ - function writeBool(bool _in) internal pure returns (bytes memory) { - bytes memory encoded = new bytes(1); - encoded[0] = (_in ? bytes1(0x01) : bytes1(0x80)); - return encoded; - } - - /*////////////////////////////////////////////////////////////// - PRIVATE FUNCTIONS - //////////////////////////////////////////////////////////////*/ - - /** - * Encode the first byte, followed by the `len` in binary form if `length` - * is more than 55. - * @param _len The length of the string or the payload. - * @param _offset 128 if item is string, 192 if item is list. - * @return RLP encoded bytes. - */ - function _writeLength( - uint256 _len, - uint256 _offset - ) - private - pure - returns (bytes memory) - { - bytes memory encoded; - - if (_len < 56) { - encoded = new bytes(1); - encoded[0] = bytes1(uint8(_len) + uint8(_offset)); - } else { - uint256 lenLen; - uint256 i = 1; - while (_len / i != 0) { - ++lenLen; - i *= 256; - } - - encoded = new bytes(lenLen + 1); - encoded[0] = bytes1(uint8(lenLen) + uint8(_offset) + 55); - for (i = 1; i <= lenLen; ++i) { - encoded[i] = bytes1(uint8((_len / (256 ** (lenLen - i))) % 256)); - } - } - - return encoded; - } - - /** - * Encode integer in big endian binary form with no leading zeroes. - * @param _x The integer to encode. - * @return RLP encoded bytes. - */ - function _toBinary(uint256 _x) private pure returns (bytes memory) { - bytes memory b = abi.encodePacked(_x); - - uint256 i; - for (; i < 32; ++i) { - if (b[i] != 0) { - break; - } - } - - bytes memory res = new bytes(32 - i); - for (uint256 j; j < res.length; ++j) { - res[j] = b[i++]; - } - - return res; - } - - /** - * Encode integer in big endian binary form with leading zeroes. - * @param _x The integer to encode. - * @return RLP encoded bytes. - */ - function _toBinaryWithLeadingZeros(uint256 _x) - private - pure - returns (bytes memory) - { - bytes memory b = abi.encodePacked(_x); - - uint256 i; - - bytes memory res = new bytes(32); - for (uint256 j; j < res.length; ++j) { - res[j] = b[i++]; - } - - return res; - } - - /** - * Copies a piece of memory to another location. - * @notice From: - * https://github.com/Arachnid/solidity-stringutils/blob/master/src/strings.sol. - * @param _dest Destination location. - * @param _src Source location. - * @param _len Length of memory to copy. - */ - function _memcpy(uint256 _dest, uint256 _src, uint256 _len) private pure { - uint256 dest = _dest; - uint256 src = _src; - uint256 len = _len; - - for (; len >= 32; len -= 32) { - assembly { - mstore(dest, mload(src)) - } - dest += 32; - src += 32; - } - - uint256 mask; - unchecked { - mask = 256 ** (32 - len) - 1; - } - assembly { - let srcpart := and(mload(src), not(mask)) - let destpart := and(mload(dest), mask) - mstore(dest, or(destpart, srcpart)) - } - } - - /** - * Flattens a list of byte strings into one byte string. - * @notice From: - * https://github.com/sammayo/solidity-rlp-encoder/blob/master/RLPEncode.sol. - * @param _list List of byte strings to flatten. - * @return The flattened byte string. - */ - function _flatten(bytes[] memory _list) - private - pure - returns (bytes memory) - { - if (_list.length == 0) { - return new bytes(0); - } - - uint256 len; - uint256 i; - for (; i < _list.length; ++i) { - len += _list[i].length; - } - - bytes memory flattened = new bytes(len); - uint256 flattenedPtr; - assembly { - flattenedPtr := add(flattened, 0x20) - } - - for (i = 0; i < _list.length; ++i) { - bytes memory item = _list[i]; - - uint256 listPtr; - assembly { - listPtr := add(item, 0x20) - } - - _memcpy(flattenedPtr, listPtr, item.length); - flattenedPtr += _list[i].length; - } - - return flattened; - } -} diff --git a/packages/protocol/contracts/libs/LibUint512Math.sol b/packages/protocol/contracts/thirdparty/LibUint512Math.sol similarity index 100% rename from packages/protocol/contracts/libs/LibUint512Math.sol rename to packages/protocol/contracts/thirdparty/LibUint512Math.sol diff --git a/packages/protocol/contracts/tokenvault/BaseNFTVault.sol b/packages/protocol/contracts/tokenvault/BaseNFTVault.sol index 4e0106f3b86..26730710815 100644 --- a/packages/protocol/contracts/tokenvault/BaseNFTVault.sol +++ b/packages/protocol/contracts/tokenvault/BaseNFTVault.sol @@ -7,14 +7,11 @@ pragma solidity ^0.8.20; import { EssentialContract } from "../common/EssentialContract.sol"; -import { IRecallableMessageSender } from "../bridge/IBridge.sol"; +import { IRecallableSender } from "../bridge/IBridge.sol"; /// @title BaseNFTVault /// @notice Abstract contract for bridging NFTs across different chains. -abstract contract BaseNFTVault is - EssentialContract, - IRecallableMessageSender -{ +abstract contract BaseNFTVault is EssentialContract, IRecallableSender { // Struct representing the canonical NFT on another chain. struct CanonicalNFT { // Chain ID of the NFT. diff --git a/packages/protocol/contracts/tokenvault/ERC1155Vault.sol b/packages/protocol/contracts/tokenvault/ERC1155Vault.sol index 787033719aa..f14bb5cb353 100644 --- a/packages/protocol/contracts/tokenvault/ERC1155Vault.sol +++ b/packages/protocol/contracts/tokenvault/ERC1155Vault.sol @@ -20,7 +20,7 @@ import { "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/ERC1155Upgradeable.sol"; import { Proxied } from "../common/Proxied.sol"; -import { IRecallableMessageSender, IBridge } from "../bridge/IBridge.sol"; +import { IBridge, IRecallableSender } from "../bridge/IBridge.sol"; import { LibAddress } from "../libs/LibAddress.sol"; import { LibVaultUtils } from "./libs/LibVaultUtils.sol"; @@ -84,16 +84,16 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable { message.memo = opt.memo; // Send the message and obtain the message hash - bytes32 msgHash = IBridge(resolve("bridge", false)).sendMessage{ - value: msg.value - }(message); + (bytes32 msgHash, IBridge.Message memory _message) = IBridge( + resolve("bridge", false) + ).sendMessage{ value: msg.value }(message); // Emit TokenSent event emit TokenSent({ msgHash: msgHash, - from: message.user, + from: _message.user, to: opt.to, - destChainId: message.destChainId, + destChainId: _message.destChainId, token: _token, tokenIds: _tokenIds, amounts: _amounts @@ -163,12 +163,11 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable { }); } - /// @notice Releases deposited ERC1155 token(s) back to the user on the - /// source chain with a proof that the message processing on the destination - /// Bridge has failed. - /// @param message The message that corresponds to the ERC1155 deposit on - /// the source chain. - function onMessageRecalled(IBridge.Message calldata message) + /// @inheritdoc IRecallableSender + function onMessageRecalled( + IBridge.Message calldata message, + bytes32 msgHash + ) external payable override @@ -186,9 +185,7 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable { (CanonicalNFT, address, address, uint256[], uint256[]) ); - bytes32 msgHash = LibVaultUtils.hashAndCheckToken( - message, resolve("bridge", false), nft.addr - ); + if (nft.addr == address(0)) revert VAULT_INVALID_TOKEN(); unchecked { if (isBridgedToken[nft.addr]) { @@ -258,7 +255,7 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable { returns (bool) { return interfaceId == type(ERC1155ReceiverUpgradeable).interfaceId - || interfaceId == type(IRecallableMessageSender).interfaceId + || interfaceId == type(IRecallableSender).interfaceId || super.supportsInterface(interfaceId); } @@ -353,7 +350,7 @@ contract ERC1155Vault is BaseNFTVault, ERC1155ReceiverUpgradeable { bytes.concat( ProxiedBridgedERC1155(bridgedToken).init.selector, abi.encode( - address(_addressManager), + addressManager, ctoken.addr, ctoken.chainId, ctoken.symbol, diff --git a/packages/protocol/contracts/tokenvault/ERC20Vault.sol b/packages/protocol/contracts/tokenvault/ERC20Vault.sol index 91175c8d8fd..50e7862d9a2 100644 --- a/packages/protocol/contracts/tokenvault/ERC20Vault.sol +++ b/packages/protocol/contracts/tokenvault/ERC20Vault.sol @@ -18,7 +18,7 @@ import { IERC165Upgradeable } from import { EssentialContract } from "../common/EssentialContract.sol"; import { IMintableERC20 } from "../common/IMintableERC20.sol"; import { Proxied } from "../common/Proxied.sol"; -import { IRecallableMessageSender, IBridge } from "../bridge/IBridge.sol"; +import { IBridge, IRecallableSender } from "../bridge/IBridge.sol"; import { LibAddress } from "../libs/LibAddress.sol"; import { ProxiedBridgedERC20 } from "./BridgedERC20.sol"; @@ -31,7 +31,7 @@ import { LibVaultUtils } from "./libs/LibVaultUtils.sol"; contract ERC20Vault is EssentialContract, IERC165Upgradeable, - IRecallableMessageSender + IRecallableSender { using LibAddress for address; using SafeERC20Upgradeable for ERC20Upgradeable; @@ -158,13 +158,13 @@ contract ERC20Vault is message.refundTo = opt.refundTo; message.memo = opt.memo; - bytes32 msgHash = IBridge(resolve("bridge", false)).sendMessage{ - value: msg.value - }(message); + (bytes32 msgHash, IBridge.Message memory _message) = IBridge( + resolve("bridge", false) + ).sendMessage{ value: msg.value }(message); emit TokenSent({ msgHash: msgHash, - from: message.user, + from: _message.user, to: opt.to, destChainId: opt.destChainId, token: opt.token, @@ -216,21 +216,17 @@ contract ERC20Vault is }); } - /// @notice Releases deposited ERC20 tokens back to the user on the source - /// ERC20Vault with a proof that the message processing on the destination - /// Bridge has failed. - /// @param message The message that corresponds to the ERC20 deposit on the - /// source chain. - function onMessageRecalled(IBridge.Message calldata message) + /// @inheritdoc IRecallableSender + function onMessageRecalled( + IBridge.Message calldata message, + bytes32 msgHash + ) external payable override nonReentrant onlyFromNamed("bridge") { - IBridge bridge = IBridge(resolve("bridge", false)); - bytes32 msgHash = bridge.hashMessage(message); - (, address token,, uint256 amount) = abi.decode( message.data[4:], (CanonicalERC20, address, address, uint256) ); @@ -264,7 +260,7 @@ contract ERC20Vault is override returns (bool) { - return interfaceId == type(IRecallableMessageSender).interfaceId; + return interfaceId == type(IRecallableSender).interfaceId; } /// @dev Encodes sending bridged or canonical ERC20 tokens to the user. @@ -358,7 +354,7 @@ contract ERC20Vault is bytes.concat( ProxiedBridgedERC20(bridgedToken).init.selector, abi.encode( - address(_addressManager), + addressManager, ctoken.addr, ctoken.chainId, ctoken.decimals, diff --git a/packages/protocol/contracts/tokenvault/ERC721Vault.sol b/packages/protocol/contracts/tokenvault/ERC721Vault.sol index 535605ec2b6..c1b5754d25d 100644 --- a/packages/protocol/contracts/tokenvault/ERC721Vault.sol +++ b/packages/protocol/contracts/tokenvault/ERC721Vault.sol @@ -18,7 +18,7 @@ import { IERC165Upgradeable } from import { IERC721ReceiverUpgradeable } from "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC721/IERC721ReceiverUpgradeable.sol"; -import { IBridge, IRecallableMessageSender } from "../bridge/IBridge.sol"; +import { IBridge, IRecallableSender } from "../bridge/IBridge.sol"; import { LibAddress } from "../libs/LibAddress.sol"; import { Proxied } from "../common/Proxied.sol"; @@ -74,15 +74,15 @@ contract ERC721Vault is message.refundTo = opt.refundTo; message.memo = opt.memo; - bytes32 msgHash = IBridge(resolve("bridge", false)).sendMessage{ - value: msg.value - }(message); + (bytes32 msgHash, IBridge.Message memory _message) = IBridge( + resolve("bridge", false) + ).sendMessage{ value: msg.value }(message); emit TokenSent({ msgHash: msgHash, - from: message.user, + from: _message.user, to: opt.to, - destChainId: message.destChainId, + destChainId: _message.destChainId, token: _token, tokenIds: _tokenIds, amounts: _amounts @@ -140,12 +140,11 @@ contract ERC721Vault is }); } - /// @notice Release deposited ERC721 token(s) back to the user on the source - /// chain with a proof that the message processing on the destination Bridge - /// has failed. - /// @param message The message that corresponds to the ERC721 deposit on the - /// source chain. - function onMessageRecalled(IBridge.Message calldata message) + /// @inheritdoc IRecallableSender + function onMessageRecalled( + IBridge.Message calldata message, + bytes32 msgHash + ) external payable override @@ -166,9 +165,7 @@ contract ERC721Vault is message.data[4:], (CanonicalNFT, address, address, uint256[]) ); - bytes32 msgHash = LibVaultUtils.hashAndCheckToken( - message, resolve("bridge", false), nft.addr - ); + if (nft.addr == address(0)) revert VAULT_INVALID_TOKEN(); unchecked { if (isBridgedToken[nft.addr]) { @@ -222,7 +219,7 @@ contract ERC721Vault is override returns (bool) { - return interfaceId == type(IRecallableMessageSender).interfaceId; + return interfaceId == type(IRecallableSender).interfaceId; } /// @dev Encodes sending bridged or canonical ERC721 tokens to the user. @@ -300,7 +297,7 @@ contract ERC721Vault is bytes.concat( ProxiedBridgedERC721(bridgedToken).init.selector, abi.encode( - address(_addressManager), + addressManager, ctoken.addr, ctoken.chainId, ctoken.symbol, diff --git a/packages/protocol/contracts/tokenvault/libs/LibVaultUtils.sol b/packages/protocol/contracts/tokenvault/libs/LibVaultUtils.sol index 32cc70fb399..8d5c1213524 100644 --- a/packages/protocol/contracts/tokenvault/libs/LibVaultUtils.sol +++ b/packages/protocol/contracts/tokenvault/libs/LibVaultUtils.sol @@ -16,6 +16,7 @@ library LibVaultUtils { uint256 public constant MAX_TOKEN_PER_TXN = 10; error VAULT_INVALID_FROM(); + error VAULT_INVALID_IMPL(); error VAULT_INVALID_TOKEN(); error VAULT_INVALID_TO(); error VAULT_TOKEN_ARRAY_MISMATCH(); @@ -34,7 +35,7 @@ library LibVaultUtils { external returns (address proxy) { - assert(implementation != address(0)); + if (implementation == address(0)) revert VAULT_INVALID_IMPL(); proxy = address( new TransparentUpgradeableProxy(implementation, owner, initializationData) ); @@ -52,33 +53,10 @@ library LibVaultUtils { returns (IBridge.Context memory ctx) { ctx = IBridge(msg.sender).context(); - if ( - ctx.from - != AddressResolver(resolver).resolve( - ctx.srcChainId, validSender, false - ) - ) { - revert VAULT_INVALID_FROM(); - } - } - - /// @dev Checks if token is invalid and returns the message hash - /// @param message The bridged message struct data - /// @param bridgeAddress The bridge contract - /// @param tokenAddress The token address to be checked - function hashAndCheckToken( - IBridge.Message calldata message, - address bridgeAddress, - address tokenAddress - ) - external - pure - returns (bytes32 msgHash) - { - IBridge bridge = IBridge(bridgeAddress); - msgHash = bridge.hashMessage(message); - - if (tokenAddress == address(0)) revert VAULT_INVALID_TOKEN(); + address sender = AddressResolver(resolver).resolve( + ctx.srcChainId, validSender, false + ); + if (ctx.from != sender) revert VAULT_INVALID_FROM(); } function checkIfValidAddresses( @@ -89,10 +67,7 @@ library LibVaultUtils { external pure { - if (to == address(0) || to == vault) { - revert VAULT_INVALID_TO(); - } - + if (to == address(0) || to == vault) revert VAULT_INVALID_TO(); if (token == address(0)) revert VAULT_INVALID_TOKEN(); } @@ -113,16 +88,12 @@ library LibVaultUtils { } if (isERC721) { - for (uint256 i; i < tokenIds.length; i++) { - if (amounts[i] != 0) { - revert VAULT_INVALID_AMOUNT(); - } + for (uint256 i; i < tokenIds.length; ++i) { + if (amounts[i] != 0) revert VAULT_INVALID_AMOUNT(); } } else { - for (uint256 i; i < amounts.length; i++) { - if (amounts[i] == 0) { - revert VAULT_INVALID_AMOUNT(); - } + for (uint256 i; i < amounts.length; ++i) { + if (amounts[i] == 0) revert VAULT_INVALID_AMOUNT(); } } } diff --git a/packages/protocol/contracts/actors_privileges_deployments.md b/packages/protocol/docs/actors_privileges_deployments.md similarity index 100% rename from packages/protocol/contracts/actors_privileges_deployments.md rename to packages/protocol/docs/actors_privileges_deployments.md diff --git a/packages/protocol/genesis/GenerateGenesis.g.sol b/packages/protocol/genesis/GenerateGenesis.g.sol index 148607bc5b1..bb23b2e334b 100644 --- a/packages/protocol/genesis/GenerateGenesis.g.sol +++ b/packages/protocol/genesis/GenerateGenesis.g.sol @@ -10,13 +10,11 @@ import { TransparentUpgradeableProxy } from "lib/openzeppelin-contracts/contract import { AddressManager } from "../contracts/common/AddressManager.sol"; import { AddressResolver } from "../contracts/common/AddressResolver.sol"; import { Bridge } from "../contracts/bridge/Bridge.sol"; -import { BridgeErrors } from "../contracts/bridge/BridgeErrors.sol"; import { ERC1155Vault } from "../contracts/tokenvault/ERC1155Vault.sol"; import { ERC20Vault } from "../contracts/tokenvault/ERC20Vault.sol"; import { ERC721Vault } from "../contracts/tokenvault/ERC721Vault.sol"; import { EtherVault } from "../contracts/bridge/EtherVault.sol"; import { IBridge } from "../contracts/bridge/IBridge.sol"; -import { LibBridgeStatus } from "../contracts/bridge/libs/LibBridgeStatus.sol"; import { RegularERC20 } from "../contracts/test/erc20/RegularERC20.sol"; import { SignalService } from "../contracts/signal/SignalService.sol"; import { TaikoL2 } from "../contracts/L2/TaikoL2.sol"; @@ -104,7 +102,7 @@ contract TestGenerateGenesis is Test, AddressResolver { TaikoL2 taikoL2 = TaikoL2(getPredeployedContractAddress("TaikoL2Proxy")); vm.startPrank(taikoL2.GOLDEN_TOUCH_ADDRESS()); - for (uint32 i = 0; i < 300; i++) { + for (uint32 i = 0; i < 300; ++i) { vm.roll(block.number + 1); vm.warp(block.number + 12); vm.fee(taikoL2.getBasefee(12, i)); @@ -145,7 +143,7 @@ contract TestGenerateGenesis is Test, AddressResolver { assertEq(owner, bridge.owner()); - vm.expectRevert(BridgeErrors.B_FORBIDDEN.selector); + vm.expectRevert(Bridge.B_PERMISSION_DENIED.selector); bridge.processMessage( IBridge.Message({ id: 0, diff --git a/packages/protocol/package.json b/packages/protocol/package.json index f719674e989..e45c35fe8f7 100644 --- a/packages/protocol/package.json +++ b/packages/protocol/package.json @@ -17,8 +17,8 @@ "sizer": "pnpm hardhat size-contracts", "snapshot": "forge snapshot --match-path 'test/**/*.t.sol'", "test": "forge test -vvv --gas-report --match-path test/*.t.sol", - "test:coverage": "forge coverage --report lcov", - "test:genesis": "FOUNDRY_PROFILE=genesis ./genesis/generate_genesis.test.sh", + "test:coverage": "mkdir -p coverage && forge coverage --report lcov && lcov --remove ./lcov.info -o ./coverage/lcov.info 'test/' 'script/' 'contracts/thirdparty/' && genhtml coverage/lcov.info --branch-coverage --output-dir coverage --ignore-errors category && open coverage/index.html", + "test:genesis": "pnpm compile && pnpm compile:hardhat && FOUNDRY_PROFILE=genesis ./genesis/generate_genesis.test.sh", "upgrade": "./script/upgrade_to.sh" }, "keywords": [ diff --git a/packages/protocol/script/DeployOnL1.s.sol b/packages/protocol/script/DeployOnL1.s.sol index 22e1bad7568..76969121b8e 100644 --- a/packages/protocol/script/DeployOnL1.s.sol +++ b/packages/protocol/script/DeployOnL1.s.sol @@ -14,12 +14,10 @@ import "lib/openzeppelin-contracts/contracts/utils/Strings.sol"; import "../contracts/L1/TaikoToken.sol"; import "../contracts/L1/TaikoL1.sol"; import "../contracts/L1/verifiers/PseZkVerifier.sol"; -import "../contracts/L1/verifiers/SGXVerifier.sol"; +import "../contracts/L1/verifiers/SgxVerifier.sol"; import "../contracts/L1/verifiers/GuardianVerifier.sol"; import "../contracts/L1/tiers/ITierProvider.sol"; -import "../contracts/L1/tiers/OptimisticRollupConfigProvider.sol"; -import "../contracts/L1/tiers/ValidityRollupConfigProvider.sol"; -import "../contracts/L1/tiers/ZKRollupConfigProvider.sol"; +import "../contracts/L1/tiers/TaikoA6TierProvider.sol"; import "../contracts/bridge/Bridge.sol"; import "../contracts/tokenvault/ERC20Vault.sol"; import "../contracts/tokenvault/ERC1155Vault.sol"; @@ -60,11 +58,7 @@ contract DeployOnL1 is Script { TaikoL1 taikoL1; address public addressManagerProxy; - enum tierProviders { - OptimisticRollupConfigProvider, - ValidityRollupConfigProvider, - ZKRollupConfigProvider - } + enum TierProviders { TAIKO_ALPHA6 } error FAILED_TO_DEPLOY_PLONK_VERIFIER(string contractPath); @@ -81,8 +75,6 @@ contract DeployOnL1 is Script { == taikoTokenPremintAmounts.length, "taikoTokenPremintRecipients and taikoTokenPremintAmounts must be same length" ); - require(validateTierProvider(tierProvider), "invalid tier provider"); - vm.startBroadcast(deployerPrivateKey); // AddressManager @@ -180,8 +172,12 @@ contract DeployOnL1 is Script { ) ); - // TierProvider - deployProxy("tier_provider", deployTierProvider(tierProvider), ""); + // Config provider + deployProxy( + "tier_provider", + deployTierProvider(uint256(TierProviders.TAIKO_ALPHA6)), + "" + ); // GuardianVerifier GuardianVerifier guardianVerifier = new ProxiedGuardianVerifier(); @@ -193,8 +189,8 @@ contract DeployOnL1 is Script { ) ); - // SGXVerifier - SGXVerifier sgxVerifier = new ProxiedSGXVerifier(); + // SgxVerifier + SgxVerifier sgxVerifier = new ProxiedSgxVerifier(); deployProxy( "tier_sgx", address(sgxVerifier), @@ -204,12 +200,12 @@ contract DeployOnL1 is Script { ); // PseZkVerifier - PseZkVerifier proofVerifier = new ProxiedPseZkVerifier(); + PseZkVerifier pseZkVerifier = new ProxiedPseZkVerifier(); deployProxy( "tier_pse_zkevm", - address(proofVerifier), + address(pseZkVerifier), bytes.concat( - proofVerifier.init.selector, abi.encode(addressManagerProxy) + pseZkVerifier.init.selector, abi.encode(addressManagerProxy) ) ); @@ -230,23 +226,20 @@ contract DeployOnL1 is Script { setAddress("signal_service", sharedSignalService); } + // PlonkVerifier + deployPlonkVerifiers(pseZkVerifier); + vm.stopBroadcast(); } - function validateTierProvider(uint256 provier) - private - pure - returns (bool) - { - if ( - provier == uint256(tierProviders.OptimisticRollupConfigProvider) - || provier == uint256(tierProviders.ValidityRollupConfigProvider) - || provier == uint256(tierProviders.ZKRollupConfigProvider) - ) { - return true; - } + function deployPlonkVerifiers(PseZkVerifier pseZkVerifier) private { + address[] memory plonkVerifiers = new address[](1); + plonkVerifiers[0] = + deployYulContract("contracts/L1/verifiers/PlonkVerifier.yulp"); - return false; + for (uint16 i = 0; i < plonkVerifiers.length; ++i) { + setAddress(pseZkVerifier.getVerifierName(i), plonkVerifiers[i]); + } } function deployYulContract(string memory contractPath) @@ -279,21 +272,15 @@ contract DeployOnL1 is Script { return deployedAddress; } - function deployTierProvider(uint256 provier) + function deployTierProvider(uint256 tier) private returns (address providerAddress) { - if (provier == uint256(tierProviders.OptimisticRollupConfigProvider)) { - return address(new OptimisticRollupConfigProvider()); - } else if ( - provier == uint256(tierProviders.ValidityRollupConfigProvider) - ) { - return address(new ValidityRollupConfigProvider()); - } else if (provier == uint256(tierProviders.ZKRollupConfigProvider)) { - return address(new ZKRollupConfigProvider()); + if (tier == uint256(TierProviders.TAIKO_ALPHA6)) { + return address(new TaikoA6TierProvider()); } - revert(); + revert("invalid provider"); } function deployProxy( diff --git a/packages/protocol/test/L1/SgxVerifier.t.sol b/packages/protocol/test/L1/SgxVerifier.t.sol new file mode 100644 index 00000000000..9337f9d3aa8 --- /dev/null +++ b/packages/protocol/test/L1/SgxVerifier.t.sol @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import { Test } from "forge-std/Test.sol"; +import { console2 } from "forge-std/console2.sol"; +import { TaikoL1 } from "../../contracts/L1/TaikoL1.sol"; +import { SgxVerifier } from "../../contracts/L1/verifiers/SgxVerifier.sol"; +import { TaikoL1TestBase } from "./TaikoL1TestBase.sol"; + +contract TestSgxVerifier is TaikoL1TestBase { + function deployTaikoL1() internal override returns (TaikoL1 taikoL1) { + taikoL1 = new TaikoL1(); + } + + function setUp() public override { + TaikoL1TestBase.setUp(); + } + + function test_addInstancesByOwner() external { + address[] memory _instances = new address[](3); + _instances[0] = SGX_X_1; + _instances[1] = SGX_Y; + _instances[2] = SGX_Z; + sv.addInstances(_instances); + } + + function test_addInstancesByOwner_WithoutOwnerRole() external { + address[] memory _instances = new address[](3); + _instances[0] = SGX_X_0; + _instances[1] = SGX_Y; + _instances[2] = SGX_Z; + + vm.expectRevert(); + vm.prank(Bob, Bob); + sv.addInstances(_instances); + } + + function test_addInstancesBySgxInstance() external { + address[] memory _instances = new address[](3); + _instances[0] = SGX_X_1; + _instances[1] = SGX_Y; + _instances[2] = SGX_Z; + + bytes memory signature = _getSignature(_instances, 0x4); + + vm.prank(Bob, Bob); + sv.addInstances(0, _instances, signature); + } + + function _getSignature( + address[] memory _instances, + uint256 privKey + ) + private + pure + returns (bytes memory signature) + { + bytes32 digest = keccak256(abi.encode("ADD_INSTANCES", _instances)); + (uint8 v, bytes32 r, bytes32 s) = vm.sign(privKey, digest); + signature = abi.encodePacked(r, s, v); + } +} diff --git a/packages/protocol/test/L1/TaikoL1.t.sol b/packages/protocol/test/L1/TaikoL1.t.sol index 8cfc31756fe..886b05d4e8e 100644 --- a/packages/protocol/test/L1/TaikoL1.t.sol +++ b/packages/protocol/test/L1/TaikoL1.t.sol @@ -78,8 +78,7 @@ contract TaikoL1Test is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); vm.roll(block.number + 15 * 12); @@ -105,7 +104,7 @@ contract TaikoL1Test is TaikoL1TestBase { bytes32 parentHash = GENESIS_BLOCK_HASH; - for (uint256 blockId = 1; blockId <= 20; blockId++) { + for (uint256 blockId = 1; blockId <= 20; ++blockId) { printVariables("before propose"); TaikoData.BlockMetadata memory meta = proposeBlock(Alice, Bob, 1_000_000, 1024); @@ -122,8 +121,7 @@ contract TaikoL1Test is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); vm.roll(block.number + 15 * 12); uint16 minTier = L1.getBlock(meta.id).minTier; @@ -165,8 +163,7 @@ contract TaikoL1Test is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); parentHash = blockHash; } @@ -243,16 +240,16 @@ contract TaikoL1Test is TaikoL1TestBase { /// @dev getCrossChainBlockHash tests function test_L1_getCrossChainBlockHash0() external { - bytes32 genHash = L1.getCrossChainBlockHash(0); + bytes32 genHash = L1.getSyncedSnippet(0).blockHash; assertEq(GENESIS_BLOCK_HASH, genHash); // Reverts if block is not yet verified! vm.expectRevert(TaikoErrors.L1_BLOCK_MISMATCH.selector); - L1.getCrossChainBlockHash(1); + L1.getSyncedSnippet(1); } - /// @dev getCrossChainSignalRoot tests - function test_L1_getCrossChainSignalRoot() external { + /// @dev getSyncedSnippet tests + function test_L1_getSyncedSnippet() external { uint64 count = 10; // Declare here so that block prop/prove/verif. can be used in 1 place TaikoData.BlockMetadata memory meta; @@ -267,7 +264,7 @@ contract TaikoL1Test is TaikoL1TestBase { console2.log("Bob balance:", tko.balanceOf(Bob)); // Propose blocks - for (uint64 blockId = 1; blockId < count; blockId++) { + for (uint64 blockId = 1; blockId < count; ++blockId) { printVariables("before propose"); meta = proposeBlock(Alice, Bob, 1_000_000, 1024); mine(5); @@ -283,8 +280,7 @@ contract TaikoL1Test is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); vm.roll(block.number + 15 * 12); @@ -294,7 +290,7 @@ contract TaikoL1Test is TaikoL1TestBase { verifyBlock(Carol, 1); // Querying written blockhash - assertEq(L1.getCrossChainBlockHash(blockId), blockHash); + assertEq(L1.getSyncedSnippet(blockId).blockHash, blockHash); mine(5); parentHashes[blockId] = blockHash; @@ -303,16 +299,16 @@ contract TaikoL1Test is TaikoL1TestBase { uint64 queriedBlockId = 1; bytes32 expectedSR = bytes32(1e9 + uint256(queriedBlockId)); - assertEq(expectedSR, L1.getCrossChainSignalRoot(queriedBlockId)); + assertEq(expectedSR, L1.getSyncedSnippet(queriedBlockId).signalRoot); // 2nd queriedBlockId = 2; expectedSR = bytes32(1e9 + uint256(queriedBlockId)); - assertEq(expectedSR, L1.getCrossChainSignalRoot(queriedBlockId)); + assertEq(expectedSR, L1.getSyncedSnippet(queriedBlockId).signalRoot); // Not found -> reverts vm.expectRevert(TaikoErrors.L1_BLOCK_MISMATCH.selector); - L1.getCrossChainSignalRoot((count + 1)); + L1.getSyncedSnippet((count + 1)); } function test_L1_deposit_hash_creation() external { diff --git a/packages/protocol/test/L1/TaikoL1LibProvingWithTiers.t.sol b/packages/protocol/test/L1/TaikoL1LibProvingWithTiers.t.sol index 31295589179..7e21eb9cdd2 100644 --- a/packages/protocol/test/L1/TaikoL1LibProvingWithTiers.t.sol +++ b/packages/protocol/test/L1/TaikoL1LibProvingWithTiers.t.sol @@ -6,6 +6,7 @@ import { console2 } from "forge-std/console2.sol"; import { AddressManager } from "../../contracts/common/AddressManager.sol"; import { LibUtils } from "../../contracts/L1/libs/LibUtils.sol"; +import { LibProposing } from "../../contracts/L1/libs/LibProposing.sol"; import { GuardianVerifier } from "../../contracts/L1/verifiers/GuardianVerifier.sol"; import { TaikoData } from "../../contracts/L1/TaikoData.sol"; @@ -48,6 +49,35 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { TaikoL1TestBase.setUp(); } + function proveHigherTierProof( + TaikoData.BlockMetadata memory meta, + bytes32 parentHash, + bytes32 signalRoot, + bytes32 blockHash, + uint16 minTier + ) + internal + { + uint16 tierToProveWith; + if (minTier == LibTiers.TIER_OPTIMISTIC) { + tierToProveWith = LibTiers.TIER_SGX; + } else if (minTier == LibTiers.TIER_SGX) { + tierToProveWith = LibTiers.TIER_SGX_AND_PSE_ZKEVM; + } else if (minTier == LibTiers.TIER_SGX_AND_PSE_ZKEVM) { + tierToProveWith = LibTiers.TIER_GUARDIAN; + } + proveBlock( + Carol, + Carol, + meta, + parentHash, + blockHash, + signalRoot, + tierToProveWith, + "" + ); + } + function test_L1_ContestingWithSameProof() external { giveEthAndTko(Alice, 1e7 ether, 1000 ether); giveEthAndTko(Carol, 1e7 ether, 1000 ether); @@ -83,8 +113,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); // Try to contest - but should revert with L1_ALREADY_PROVED @@ -96,8 +125,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - TaikoErrors.L1_ALREADY_PROVED.selector, - false + TaikoErrors.L1_ALREADY_PROVED.selector ); vm.roll(block.number + 15 * 12); @@ -140,55 +168,34 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { // This proof cannot be verified obviously because of // signalRoot instead of blockHash uint16 minTier = L1.getBlock(meta.id).minTier; + proveBlock( - Bob, - Bob, + Bob, Bob, meta, parentHash, signalRoot, signalRoot, minTier, "" + ); + + // Try to contest + proveBlock( + Carol, + Carol, meta, parentHash, - signalRoot, + blockHash, signalRoot, minTier, - "", - false + "" ); - if (minTier == LibTiers.TIER_OPTIMISTIC) { - // Try to contest - proveBlock( - Carol, - Carol, - meta, - parentHash, - blockHash, - signalRoot, - minTier, - "", - false - ); - - vm.roll(block.number + 15 * 12); + vm.roll(block.number + 15 * 12); - vm.warp( - block.timestamp + L1.getTier(minTier).cooldownWindow + 1 - ); + vm.warp(block.timestamp + L1.getTier(minTier).cooldownWindow + 1); - // Cannot verify block because it is contested.. - verifyBlock(Carol, 1); + // Cannot verify block because it is contested.. + verifyBlock(Carol, 1); - proveBlock( - Carol, - Carol, - meta, - parentHash, - blockHash, - signalRoot, - LibTiers.TIER_PSE_ZKEVM, - "", - false - ); - } + proveHigherTierProof( + meta, parentHash, signalRoot, blockHash, minTier + ); - // Otherwise just not contest vm.warp( block.timestamp + L1.getTier(LibTiers.TIER_GUARDIAN).cooldownWindow + 1 @@ -201,7 +208,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { printVariables(""); } - function test_L1_ContestingWithDifferentButInCorrectProof() external { + function test_L1_ContestingWithSgxProof() external { giveEthAndTko(Alice, 1e8 ether, 1000 ether); giveEthAndTko(Carol, 1e8 ether, 1000 ether); console2.log("Alice balance:", tko.balanceOf(Alice)); @@ -229,17 +236,77 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { // This proof cannot be verified obviously because of // signalRoot instead of blockHash uint16 minTier = L1.getBlock(meta.id).minTier; + proveBlock( + Bob, Bob, meta, parentHash, signalRoot, signalRoot, minTier, "" + ); + // Try to contest proveBlock( - Bob, - Bob, + Carol, + Carol, meta, parentHash, blockHash, signalRoot, minTier, - "", - false + "" + ); + + vm.roll(block.number + 15 * 12); + + vm.warp(block.timestamp + L1.getTier(minTier).cooldownWindow + 1); + + // Cannot verify block because it is contested.. + verifyBlock(Carol, 1); + + proveHigherTierProof( + meta, parentHash, signalRoot, blockHash, minTier + ); + + // Otherwise just not contest + vm.warp( + block.timestamp + + L1.getTier(LibTiers.TIER_GUARDIAN).cooldownWindow + 1 + ); + // Now can verify + verifyBlock(Carol, 1); + + parentHash = blockHash; + } + printVariables(""); + } + + function test_L1_ContestingWithDifferentButInCorrectProof() external { + giveEthAndTko(Alice, 1e8 ether, 1000 ether); + giveEthAndTko(Carol, 1e8 ether, 1000 ether); + console2.log("Alice balance:", tko.balanceOf(Alice)); + // This is a very weird test (code?) issue here. + // If this line is uncommented, + // Alice/Bob has no balance.. (Causing reverts !!!) + // Current investigations are ongoing with foundry team + giveEthAndTko(Bob, 1e8 ether, 100 ether); + console2.log("Bob balance:", tko.balanceOf(Bob)); + // Bob + vm.prank(Bob, Bob); + + bytes32 parentHash = GENESIS_BLOCK_HASH; + for ( + uint256 blockId = 1; blockId < conf.blockMaxProposals * 3; blockId++ + ) { + printVariables("before propose"); + TaikoData.BlockMetadata memory meta = + proposeBlock(Alice, Bob, 1_000_000, 1024); + //printVariables("after propose"); + mine(1); + + bytes32 blockHash = bytes32(1e10 + blockId); + bytes32 signalRoot = bytes32(1e9 + blockId); + // This proof cannot be verified obviously because of + // signalRoot instead of blockHash + uint16 minTier = L1.getBlock(meta.id).minTier; + + proveBlock( + Bob, Bob, meta, parentHash, blockHash, signalRoot, minTier, "" ); if (minTier == LibTiers.TIER_OPTIMISTIC) { @@ -252,8 +319,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { signalRoot, signalRoot, minTier, - "", - false + "" ); vm.roll(block.number + 15 * 12); @@ -272,9 +338,8 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { parentHash, blockHash, signalRoot, - LibTiers.TIER_PSE_ZKEVM, - "", - false + LibTiers.TIER_SGX_AND_PSE_ZKEVM, + "" ); } @@ -318,15 +383,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { // signalRoot instead of blockHash uint16 minTier = L1.getBlock(meta.id).minTier; proveBlock( - Bob, - Bob, - meta, - parentHash, - signalRoot, - signalRoot, - minTier, - "", - false + Bob, Bob, meta, parentHash, signalRoot, signalRoot, minTier, "" ); if (minTier == LibTiers.TIER_OPTIMISTIC) { @@ -339,8 +396,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, minTier, - "", - false + "" ); vm.roll(block.number + 15 * 12); @@ -360,9 +416,8 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { parentHash, 0, signalRoot, - LibTiers.TIER_PSE_ZKEVM, - TaikoErrors.L1_INVALID_EVIDENCE.selector, - false + LibTiers.TIER_SGX_AND_PSE_ZKEVM, + TaikoErrors.L1_INVALID_EVIDENCE.selector ); } @@ -412,8 +467,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - TaikoErrors.L1_NOT_ASSIGNED_PROVER.selector, - false + TaikoErrors.L1_NOT_ASSIGNED_PROVER.selector ); vm.roll(block.number + 15 * 12); @@ -463,8 +517,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - TaikoErrors.L1_ASSIGNED_PROVER_NOT_ALLOWED.selector, - false + TaikoErrors.L1_ASSIGNED_PROVER_NOT_ALLOWED.selector ); verifyBlock(Carol, 1); @@ -474,8 +527,6 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { } function test_L1_GuardianProverCannotOverwriteIfSameProof() external { - registerAddress("guardian", Carol); - giveEthAndTko(Alice, 1e7 ether, 1000 ether); giveEthAndTko(Carol, 1e7 ether, 1000 ether); console2.log("Alice balance:", tko.balanceOf(Alice)); @@ -510,8 +561,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); // Try to contest - but should revert with L1_ALREADY_PROVED @@ -523,8 +573,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, LibTiers.TIER_GUARDIAN, - TaikoErrors.L1_ALREADY_PROVED.selector, - false + TaikoErrors.L1_ALREADY_PROVED.selector ); vm.roll(block.number + 15 * 12); @@ -540,8 +589,6 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { } function test_L1_GuardianProverFailsWithInvalidBlockHash() external { - registerAddress("guardian", Carol); - giveEthAndTko(Alice, 1e7 ether, 1000 ether); giveEthAndTko(Carol, 1e7 ether, 1000 ether); console2.log("Alice balance:", tko.balanceOf(Alice)); @@ -576,8 +623,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); // Try to contest - but should revert with L1_ALREADY_PROVED @@ -589,8 +635,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { 0, signalRoot, LibTiers.TIER_GUARDIAN, - TaikoErrors.L1_INVALID_EVIDENCE.selector, - false + TaikoErrors.L1_INVALID_EVIDENCE.selector ); vm.roll(block.number + 15 * 12); @@ -606,8 +651,6 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { } function test_L1_GuardianProverCanOverwriteIfNotSameProof() external { - registerAddress("guardian", Carol); - giveEthAndTko(Alice, 1e7 ether, 1000 ether); giveEthAndTko(Carol, 1e7 ether, 1000 ether); console2.log("Alice balance:", tko.balanceOf(Alice)); @@ -642,8 +685,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { signalRoot, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); // Prove as guardian @@ -655,8 +697,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, LibTiers.TIER_GUARDIAN, - "", - false + "" ); vm.roll(block.number + 15 * 12); @@ -706,8 +747,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { signalRoot, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); // Prove as guardian but in reality not a guardian @@ -719,8 +759,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, LibTiers.TIER_GUARDIAN, - GuardianVerifier.PERMISSION_DENIED.selector, - false + GuardianVerifier.PERMISSION_DENIED.selector ); vm.roll(block.number + 15 * 12); @@ -770,8 +809,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, LibTiers.TIER_PSE_ZKEVM, - TaikoErrors.L1_INVALID_BLOCK_ID.selector, - false + TaikoErrors.L1_INVALID_BLOCK_ID.selector ); parentHash = blockHash; @@ -815,8 +853,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, LibTiers.TIER_PSE_ZKEVM, - TaikoErrors.L1_BLOCK_MISMATCH.selector, - false + TaikoErrors.L1_BLOCK_MISMATCH.selector ); parentHash = blockHash; @@ -825,8 +862,6 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { } function test_L1_GuardianProofCannotBeOverwrittenByLowerTier() external { - registerAddress("guardian", Carol); - giveEthAndTko(Alice, 1e7 ether, 1000 ether); giveEthAndTko(Carol, 1e7 ether, 1000 ether); console2.log("Alice balance:", tko.balanceOf(Alice)); @@ -861,8 +896,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { signalRoot, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); // Prove as guardian @@ -874,8 +908,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, LibTiers.TIER_GUARDIAN, - "", - false + "" ); // Try to re-prove but reverts @@ -887,8 +920,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { signalRoot, signalRoot, LibTiers.TIER_PSE_ZKEVM, - TaikoErrors.L1_INVALID_TIER.selector, - false + TaikoErrors.L1_INVALID_TIER.selector ); vm.roll(block.number + 15 * 12); @@ -904,8 +936,6 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { } function test_L1_GuardianCanReturnBondIfBlockUnprovable() external { - registerAddress("guardian", Carol); - giveEthAndTko(Alice, 1e7 ether, 1000 ether); giveEthAndTko(Carol, 1e7 ether, 1000 ether); console2.log("Alice balance:", tko.balanceOf(Alice)); @@ -940,27 +970,34 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { signalRoot, signalRoot, L1.getBlock(meta.id).minTier, - "", - false + "" ); - // Let's say the 10th block is unprovable + // Let's say the 10th block is unprovable so prove accordingly if (blockId == 10) { - // Prove as guardian - proveBlock( - Carol, - Carol, - meta, - parentHash, - blockHash, - signalRoot, - LibTiers.TIER_GUARDIAN, - "", - true - ); - - // Credited back the bond (not transferred to the user wallet, - // but in-contract account credited only.) + TaikoData.BlockEvidence memory evidence = TaikoData + .BlockEvidence({ + metaHash: LibProposing.hashMetadata(meta), + parentHash: parentHash, + blockHash: blockHash, + signalRoot: signalRoot, + graffiti: 0x0, + tier: LibTiers.TIER_GUARDIAN, + proof: new bytes(102) + }); + + evidence.proof = bytes.concat(keccak256("RETURN_LIVENESS_BOND")); + + vm.prank(David, David); + gp.approveEvidence(meta.id, evidence); + vm.prank(Emma, Emma); + gp.approveEvidence(meta.id, evidence); + vm.prank(Frank, Frank); + gp.approveEvidence(meta.id, evidence); + + // // Credited back the bond (not transferred to the user + // wallet, + // // but in-contract account credited only.) assertEq(L1.getTaikoTokenBalance(Bob), 1 ether); } else { // Prove as guardian @@ -972,8 +1009,7 @@ contract TaikoL1LibProvingWithTiers is TaikoL1TestBase { blockHash, signalRoot, LibTiers.TIER_GUARDIAN, - "", - false + "" ); } vm.roll(block.number + 15 * 12); diff --git a/packages/protocol/test/L1/TaikoL1TestBase.sol b/packages/protocol/test/L1/TaikoL1TestBase.sol index 29dae095a07..799c27955e6 100644 --- a/packages/protocol/test/L1/TaikoL1TestBase.sol +++ b/packages/protocol/test/L1/TaikoL1TestBase.sol @@ -12,9 +12,13 @@ import { TaikoL1 } from "../../contracts/L1/TaikoL1.sol"; import { TaikoToken } from "../../contracts/L1/TaikoToken.sol"; import { GuardianVerifier } from "../../contracts/L1/verifiers/GuardianVerifier.sol"; -import { OptimisticRollupConfigProvider } from - "../../contracts/L1/tiers/OptimisticRollupConfigProvider.sol"; +import { TaikoA6TierProvider } from + "../../contracts/L1/tiers/TaikoA6TierProvider.sol"; import { PseZkVerifier } from "../../contracts/L1/verifiers/PseZkVerifier.sol"; +import { SgxVerifier } from "../../contracts/L1/verifiers/SgxVerifier.sol"; +import { SgxAndZkVerifier } from + "../../contracts/L1/verifiers/SgxAndZkVerifier.sol"; +import { GuardianProver } from "../../contracts/L1/provers/GuardianProver.sol"; import { SignalService } from "../../contracts/signal/SignalService.sol"; import { StringsUpgradeable as Strings } from "lib/openzeppelin-contracts-upgradeable/contracts/utils/StringsUpgradeable.sol"; @@ -27,6 +31,8 @@ contract MockVerifier { } } +// TODO (dani): remove some code to sub-contracts, this one shall only contain +// shared logics and data. abstract contract TaikoL1TestBase is TestBase { AddressManager public addressManager; TaikoToken public tko; @@ -35,19 +41,14 @@ abstract contract TaikoL1TestBase is TestBase { TaikoData.Config conf; uint256 internal logCount; PseZkVerifier public pv; + SgxVerifier public sv; + SgxAndZkVerifier public sgxZkVerifier; GuardianVerifier public gv; - OptimisticRollupConfigProvider public cp; + GuardianProver public gp; + TaikoA6TierProvider public cp; bytes32 public constant GENESIS_BLOCK_HASH = keccak256("GENESIS_BLOCK_HASH"); - // 1 TKO --> it is to huge. It should be in 'wei' (?). - // Because otherwise first proposal is around: 1TKO * (1_000_000+20_000) - // required as a deposit. - // uint32 feePerGas = 10; - // uint16 provingWindow = 60 minutes; - uint64 l2GasExcess = 1e18; - - address public constant L2Treasury = - 0x859d74b52762d9ed07D1b2B8d7F93d26B1EA78Bb; + address public constant L2SS = 0xa008AE5Ba00656a3Cc384de589579e3E52aC030C; address public constant TaikoL2 = 0x0082D90249342980d011C58105a03b35cCb4A315; address public constant L1EthVault = @@ -68,17 +69,32 @@ abstract contract TaikoL1TestBase is TestBase { pv = new PseZkVerifier(); pv.init(address(addressManager)); + sv = new SgxVerifier(); + sv.init(address(addressManager)); + address[] memory initSgxInstances = new address[](1); + initSgxInstances[0] = SGX_X_0; + sv.addInstances(initSgxInstances); + + sgxZkVerifier = new SgxAndZkVerifier(); + sgxZkVerifier.init(address(addressManager)); + gv = new GuardianVerifier(); gv.init(address(addressManager)); - cp = new OptimisticRollupConfigProvider(); + gp = new GuardianProver(); + gp.init(address(addressManager)); + setupGuardianProverMultisig(); + + cp = new TaikoA6TierProvider(); registerAddress("tier_pse_zkevm", address(pv)); + registerAddress("tier_sgx", address(sv)); registerAddress("tier_guardian", address(gv)); + registerAddress("tier_sgx_and_pse_zkevm", address(sgxZkVerifier)); registerAddress("tier_provider", address(cp)); registerAddress("signal_service", address(ss)); + registerAddress("guardian", address(gp)); registerAddress("ether_vault", address(L1EthVault)); - registerL2Address("treasury", L2Treasury); registerL2Address("taiko", address(TaikoL2)); registerL2Address("signal_service", address(L2SS)); registerL2Address("taiko_l2", address(TaikoL2)); @@ -119,15 +135,20 @@ abstract contract TaikoL1TestBase is TestBase { internal returns (TaikoData.BlockMetadata memory meta) { - TaikoData.TierFee[] memory tierFees = new TaikoData.TierFee[](3); + TaikoData.TierFee[] memory tierFees = new TaikoData.TierFee[](5); // Register the tier fees // Based on OPL2ConfigTier we need 3: // - LibTiers.TIER_PSE_ZKEVM; + // - LibTiers.TIER_SGX; // - LibTiers.TIER_OPTIMISTIC; // - LibTiers.TIER_GUARDIAN; + // - LibTiers.TIER_SGX_AND_PSE_ZKEVM tierFees[0] = TaikoData.TierFee(LibTiers.TIER_OPTIMISTIC, 1 ether); - tierFees[1] = TaikoData.TierFee(LibTiers.TIER_PSE_ZKEVM, 2 ether); - tierFees[2] = TaikoData.TierFee(LibTiers.TIER_GUARDIAN, 0 ether); + tierFees[1] = TaikoData.TierFee(LibTiers.TIER_SGX, 1 ether); + tierFees[2] = TaikoData.TierFee(LibTiers.TIER_PSE_ZKEVM, 2 ether); + tierFees[3] = + TaikoData.TierFee(LibTiers.TIER_SGX_AND_PSE_ZKEVM, 2 ether); + tierFees[4] = TaikoData.TierFee(LibTiers.TIER_GUARDIAN, 0 ether); // For the test not to fail, set the message.value to the highest, the // rest will be returned // anyways @@ -175,8 +196,7 @@ abstract contract TaikoL1TestBase is TestBase { bytes32 blockHash, bytes32 signalRoot, uint16 tier, - bytes4 revertReason, - bool unprovable + bytes4 revertReason ) internal { @@ -191,7 +211,7 @@ abstract contract TaikoL1TestBase is TestBase { }); bytes32 instance = pv.getInstance(prover, evidence); - uint16 verifierId = tier; + uint16 verifierId = 300; // 300 as see mock verifier in line 95 evidence.proof = bytes.concat( bytes2(verifierId), @@ -202,22 +222,62 @@ abstract contract TaikoL1TestBase is TestBase { new bytes(100) ); + address newPubKey; + // Keep changing the pub key associated with an instance to avoid + // attacks, + // obviously just a mock due to 2 addresses changing all the time. + (newPubKey,) = sv.instances(0); + if (newPubKey == SGX_X_0) { + newPubKey = SGX_X_1; + } else { + newPubKey = SGX_X_0; + } + + if (tier == LibTiers.TIER_SGX) { + bytes memory signature = + createSgxSignatureProof(evidence, newPubKey, prover); + + evidence.proof = + bytes.concat(bytes2(0), bytes20(newPubKey), signature); + } + + if (tier == LibTiers.TIER_SGX_AND_PSE_ZKEVM) { + bytes memory signature = + createSgxSignatureProof(evidence, newPubKey, prover); + + bytes memory sgxProof = + bytes.concat(bytes2(0), bytes20(newPubKey), signature); + // Concatenate SGX and ZK (in this order) + evidence.proof = bytes.concat(sgxProof, evidence.proof); + } + if (tier == LibTiers.TIER_GUARDIAN) { evidence.proof = ""; - if (unprovable) { - evidence.proof = - bytes.concat(bytes32(keccak256("RETURN_LIVENESS_BOND"))); + // Grant 2 signatures, 3rd might be a revert + vm.prank(David, David); + gp.approveEvidence(meta.id, evidence); + vm.prank(Emma, Emma); + gp.approveEvidence(meta.id, evidence); + + if (revertReason != "") { + vm.prank(Frank, Frank); + vm.expectRevert(); // Revert reason is 'wrapped' so will not be + // identical to the expectedRevert + gp.approveEvidence(meta.id, evidence); + } else { + vm.prank(Frank, Frank); + gp.approveEvidence(meta.id, evidence); } - } - - if (revertReason != "") { - vm.prank(msgSender, msgSender); - vm.expectRevert(revertReason); - L1.proveBlock(meta.id, abi.encode(evidence)); } else { - vm.prank(msgSender, msgSender); - L1.proveBlock(meta.id, abi.encode(evidence)); + if (revertReason != "") { + vm.prank(msgSender, msgSender); + vm.expectRevert(revertReason); + L1.proveBlock(meta.id, abi.encode(evidence)); + } else { + vm.prank(msgSender, msgSender); + L1.proveBlock(meta.id, abi.encode(evidence)); + } } } @@ -225,6 +285,16 @@ abstract contract TaikoL1TestBase is TestBase { L1.verifyBlocks(count); } + function setupGuardianProverMultisig() internal { + address[5] memory initMultiSig; + initMultiSig[0] = David; + initMultiSig[1] = Emma; + initMultiSig[2] = Frank; + initMultiSig[3] = Grace; + initMultiSig[4] = Henry; + gp.setGuardians(initMultiSig); + } + function registerAddress(bytes32 nameHash, address addr) internal { addressManager.setAddress(block.chainid, nameHash, addr); console2.log(block.chainid, uint256(nameHash), unicode"→", addr); @@ -263,6 +333,40 @@ abstract contract TaikoL1TestBase is TestBase { signature = abi.encodePacked(r, s, v); } + function createSgxSignatureProof( + TaikoData.BlockEvidence memory evidence, + address newPubKey, + address prover + ) + internal + view + returns (bytes memory signature) + { + bytes32 digest = keccak256( + abi.encode( + evidence.metaHash, + evidence.parentHash, + evidence.blockHash, + evidence.signalRoot, + evidence.graffiti, + prover, + newPubKey + ) + ); + + uint256 signerPrivateKey; + + // In the test suite these are the 3 which acts as provers + if (SGX_X_0 == newPubKey) { + signerPrivateKey = 0x5; + } else if (SGX_X_1 == newPubKey) { + signerPrivateKey = 0x4; + } + + (uint8 v, bytes32 r, bytes32 s) = vm.sign(signerPrivateKey, digest); + signature = abi.encodePacked(r, s, v); + } + function giveEthAndTko( address to, uint256 amountTko, diff --git a/packages/protocol/test/L2/TaikoL2.t.sol b/packages/protocol/test/L2/TaikoL2.t.sol index c7662486834..8f19080af9d 100644 --- a/packages/protocol/test/L2/TaikoL2.t.sol +++ b/packages/protocol/test/L2/TaikoL2.t.sol @@ -5,8 +5,10 @@ import { console2 } from "forge-std/console2.sol"; import { Strings } from "lib/openzeppelin-contracts/contracts/utils/Strings.sol"; import { SafeCastUpgradeable } from "lib/openzeppelin-contracts-upgradeable/contracts/utils/math/SafeCastUpgradeable.sol"; -import { TestBase } from "../TestBase.sol"; +import { AddressManager } from "../../contracts/common/AddressManager.sol"; +import { SignalService } from "../../contracts/signal/SignalService.sol"; import { TaikoL2 } from "../../contracts/L2/TaikoL2.sol"; +import { TestBase } from "../TestBase.sol"; contract TestTaikoL2 is TestBase { using SafeCastUpgradeable for uint256; @@ -14,21 +16,29 @@ contract TestTaikoL2 is TestBase { // same as `block_gas_limit` in foundry.toml uint32 public constant BLOCK_GAS_LIMIT = 30_000_000; + AddressManager public addressManager; + SignalService public ss; TaikoL2 public L2; uint256 private logIndex; function setUp() public { + addressManager = new AddressManager(); + addressManager.init(); + + ss = new SignalService(); + ss.init(address(addressManager)); + registerAddress("signal_service", address(ss)); + L2 = new TaikoL2(); - address dummyAddressManager = getRandomAddress(); uint128 gasExcess = 0; - L2.init(dummyAddressManager, gasExcess); + L2.init(address(addressManager), gasExcess); vm.roll(block.number + 1); vm.warp(block.timestamp + 30); } function test_L2_AnchorTx_with_constant_block_time() external { - for (uint256 i = 0; i < 100; i++) { + for (uint256 i; i < 100; ++i) { vm.fee(1); vm.prank(L2.GOLDEN_TOUCH_ADDRESS()); @@ -40,7 +50,7 @@ contract TestTaikoL2 is TestBase { } function test_L2_AnchorTx_with_decreasing_block_time() external { - for (uint256 i = 0; i < 32; i++) { + for (uint256 i; i < 32; ++i) { vm.fee(1); vm.prank(L2.GOLDEN_TOUCH_ADDRESS()); @@ -52,7 +62,7 @@ contract TestTaikoL2 is TestBase { } function test_L2_AnchorTx_with_increasing_block_time() external { - for (uint256 i = 0; i < 30; i++) { + for (uint256 i; i < 30; ++i) { vm.fee(1); vm.prank(L2.GOLDEN_TOUCH_ADDRESS()); @@ -104,4 +114,9 @@ contract TestTaikoL2 is TestBase { bytes32 l1SignalRoot = getRandomBytes32(); L2.anchor(l1Hash, l1SignalRoot, 12_345, parentGasLimit); } + + function registerAddress(bytes32 nameHash, address addr) internal { + addressManager.setAddress(block.chainid, nameHash, addr); + console2.log(block.chainid, uint256(nameHash), unicode"→", addr); + } } diff --git a/packages/protocol/test/TestBase.sol b/packages/protocol/test/TestBase.sol index 282128aecc1..187bd5d2203 100644 --- a/packages/protocol/test/TestBase.sol +++ b/packages/protocol/test/TestBase.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.20; import { Test } from "forge-std/Test.sol"; import { Bridge } from "../contracts/bridge/Bridge.sol"; +import { SignalService } from "../contracts/signal/SignalService.sol"; import { ICrossChainSync } from "../contracts/common/ICrossChainSync.sol"; abstract contract TestBase is Test { @@ -17,10 +18,6 @@ abstract contract TestBase is Test { return keccak256(abi.encodePacked("bytes32", _seed++)); } - function getRandomUint256() internal returns (uint256) { - return uint256(keccak256(abi.encodePacked("uint256", _seed++))); - } - address internal Alice = vm.addr(0x1); address internal Bob = vm.addr(0x2); address internal Carol = vm.addr(0x3); @@ -47,6 +44,10 @@ abstract contract TestBase is Test { address internal Xavier = getRandomAddress(); address internal Yasmine = getRandomAddress(); address internal Zachary = getRandomAddress(); + address internal SGX_X_0 = vm.addr(0x4); + address internal SGX_X_1 = vm.addr(0x5); + address internal SGX_Y = getRandomAddress(); + address internal SGX_Z = getRandomAddress(); } contract BadReceiver { @@ -80,29 +81,21 @@ contract NonNftContract { } } -contract SkipProofCheckBridge is Bridge { - function shouldCheckProof() internal pure override returns (bool) { - return false; +contract SkipProofCheckSignal is SignalService { + function skipProofCheck() public pure override returns (bool) { + return true; } } contract DummyCrossChainSync is ICrossChainSync { - bytes32 private _blockHash; - bytes32 private _signalRoot; - - function setCrossChainBlockHeader(bytes32 blockHash) external { - _blockHash = blockHash; - } - - function setCrossChainSignalRoot(bytes32 signalRoot) external { - _signalRoot = signalRoot; - } + Snippet private _snippet; - function getCrossChainBlockHash(uint64) external view returns (bytes32) { - return _blockHash; + function setSyncedData(bytes32 blockHash, bytes32 signalRoot) external { + _snippet.blockHash = blockHash; + _snippet.signalRoot = signalRoot; } - function getCrossChainSignalRoot(uint64) external view returns (bytes32) { - return _signalRoot; + function getSyncedSnippet(uint64) external view returns (Snippet memory) { + return _snippet; } } diff --git a/packages/protocol/test/bridge/Bridge.t.sol b/packages/protocol/test/bridge/Bridge.t.sol index 198103e88c9..173d71f46fc 100644 --- a/packages/protocol/test/bridge/Bridge.t.sol +++ b/packages/protocol/test/bridge/Bridge.t.sol @@ -3,15 +3,12 @@ pragma solidity ^0.8.20; import { AddressManager } from "../../contracts/common/AddressManager.sol"; import { IBridge, Bridge } from "../../contracts/bridge/Bridge.sol"; -import { BridgeErrors } from "../../contracts/bridge/BridgeErrors.sol"; import { EtherVault } from "../../contracts/bridge/EtherVault.sol"; import { console2 } from "forge-std/console2.sol"; -import { LibBridgeStatus } from - "../../contracts/bridge/libs/LibBridgeStatus.sol"; import { SignalService } from "../../contracts/signal/SignalService.sol"; import { TestBase, - SkipProofCheckBridge, + SkipProofCheckSignal, DummyCrossChainSync, GoodReceiver, BadReceiver @@ -26,7 +23,7 @@ contract BridgeTest is TestBase { EtherVault etherVault; SignalService signalService; DummyCrossChainSync crossChainSync; - SkipProofCheckBridge mockProofBridge; + SkipProofCheckSignal mockProofSignalService; uint256 destChainId = 19_389; function setUp() public { @@ -43,10 +40,10 @@ contract BridgeTest is TestBase { vm.deal(address(destChainBridge), 100 ether); - mockProofBridge = new SkipProofCheckBridge(); - mockProofBridge.init(address(addressManager)); + mockProofSignalService = new SkipProofCheckSignal(); + mockProofSignalService.init(address(addressManager)); - vm.deal(address(mockProofBridge), 100 ether); + vm.deal(address(mockProofSignalService), 100 ether); signalService = new SignalService(); signalService.init(address(addressManager)); @@ -57,7 +54,11 @@ contract BridgeTest is TestBase { crossChainSync = new DummyCrossChainSync(); addressManager.setAddress( - block.chainid, "signal_service", address(signalService) + block.chainid, "signal_service", address(mockProofSignalService) + ); + + addressManager.setAddress( + destChainId, "signal_service", address(mockProofSignalService) ); addressManager.setAddress( @@ -88,16 +89,15 @@ contract BridgeTest is TestBase { // coresponding to the message bytes memory proof = hex"00"; - bytes32 msgHash = destChainBridge.hashMessage(message); + bytes32 msgHash = keccak256(abi.encode(message)); vm.chainId(destChainId); vm.prank(Bob, Bob); - mockProofBridge.processMessage(message, proof); + destChainBridge.processMessage(message, proof); - LibBridgeStatus.MessageStatus status = - mockProofBridge.getMessageStatus(msgHash); + Bridge.Status status = destChainBridge.messageStatus(msgHash); - assertEq(status == LibBridgeStatus.MessageStatus.DONE, true); + assertEq(status == Bridge.Status.DONE, true); // Alice has 100 ether + 1000 wei balance, because we did not use the // 'sendMessage' // since we mocking the proof, so therefore the 1000 wei @@ -128,17 +128,16 @@ contract BridgeTest is TestBase { // coresponding to the message bytes memory proof = hex"00"; - bytes32 msgHash = destChainBridge.hashMessage(message); + bytes32 msgHash = keccak256(abi.encode(message)); vm.chainId(destChainId); vm.prank(Bob, Bob); - mockProofBridge.processMessage(message, proof); + destChainBridge.processMessage(message, proof); - LibBridgeStatus.MessageStatus status = - mockProofBridge.getMessageStatus(msgHash); + Bridge.Status status = destChainBridge.messageStatus(msgHash); - assertEq(status == LibBridgeStatus.MessageStatus.DONE, true); + assertEq(status == Bridge.Status.DONE, true); // Bob (relayer) and goodContract has 1000 wei balance assertEq(address(goodReceiver).balance, 1000); @@ -168,17 +167,16 @@ contract BridgeTest is TestBase { // coresponding to the message bytes memory proof = hex"00"; - bytes32 msgHash = destChainBridge.hashMessage(message); + bytes32 msgHash = keccak256(abi.encode(message)); vm.chainId(destChainId); vm.prank(Bob, Bob); - mockProofBridge.processMessage(message, proof); + destChainBridge.processMessage(message, proof); - LibBridgeStatus.MessageStatus status = - mockProofBridge.getMessageStatus(msgHash); + Bridge.Status status = destChainBridge.messageStatus(msgHash); - assertEq(status == LibBridgeStatus.MessageStatus.DONE, true); + assertEq(status == Bridge.Status.DONE, true); // Carol and goodContract has 500 wei balance assertEq(address(goodReceiver).balance, 500); @@ -189,7 +187,7 @@ contract BridgeTest is TestBase { ) public { - //uint256 amount = 1 wei; + // uint256 amount = 1 wei; IBridge.Message memory message = newMessage({ user: Alice, to: Alice, @@ -199,7 +197,7 @@ contract BridgeTest is TestBase { destChain: destChainId }); - vm.expectRevert(BridgeErrors.B_INCORRECT_VALUE.selector); + vm.expectRevert(Bridge.B_INVALID_VALUE.selector); bridge.sendMessage(message); } @@ -216,7 +214,7 @@ contract BridgeTest is TestBase { destChain: destChainId }); - vm.expectRevert(BridgeErrors.B_USER_IS_NULL.selector); + vm.expectRevert(Bridge.B_INVALID_USER.selector); bridge.sendMessage{ value: amount }(message); } @@ -234,7 +232,7 @@ contract BridgeTest is TestBase { destChain: destChainId + 1 }); - vm.expectRevert(BridgeErrors.B_WRONG_CHAIN_ID.selector); + vm.expectRevert(Bridge.B_INVALID_CHAINID.selector); bridge.sendMessage{ value: amount }(message); } @@ -252,7 +250,7 @@ contract BridgeTest is TestBase { destChain: block.chainid }); - vm.expectRevert(BridgeErrors.B_WRONG_CHAIN_ID.selector); + vm.expectRevert(Bridge.B_INVALID_CHAINID.selector); bridge.sendMessage{ value: amount }(message); } @@ -269,7 +267,7 @@ contract BridgeTest is TestBase { destChain: destChainId }); - vm.expectRevert(BridgeErrors.B_WRONG_TO_ADDRESS.selector); + vm.expectRevert(Bridge.B_INVALID_TO.selector); bridge.sendMessage{ value: amount }(message); } @@ -284,10 +282,9 @@ contract BridgeTest is TestBase { destChain: destChainId }); - bytes32 msgHash = bridge.sendMessage{ value: amount }(message); - - bool isMessageSent = bridge.isMessageSent(msgHash); - assertEq(isMessageSent, true); + (, IBridge.Message memory _message) = + bridge.sendMessage{ value: amount }(message); + assertEq(bridge.isMessageSent(_message), true); } function test_Bridge_send_message_ether_with_processing_fee() public { @@ -302,10 +299,9 @@ contract BridgeTest is TestBase { destChain: destChainId }); - bytes32 msgHash = bridge.sendMessage{ value: amount + fee }(message); - - bool isMessageSent = bridge.isMessageSent(msgHash); - assertEq(isMessageSent, true); + (, IBridge.Message memory _message) = + bridge.sendMessage{ value: amount + fee }(message); + assertEq(bridge.isMessageSent(_message), true); } function test_Bridge_send_message_ether_with_processing_fee_invalid_amount() @@ -322,7 +318,7 @@ contract BridgeTest is TestBase { destChain: destChainId }); - vm.expectRevert(BridgeErrors.B_INCORRECT_VALUE.selector); + vm.expectRevert(Bridge.B_INVALID_VALUE.selector); bridge.sendMessage{ value: amount }(message); } @@ -331,7 +327,7 @@ contract BridgeTest is TestBase { // in foundry function test_Bridge_process_message() public { /* DISCALIMER: From now on we do not need to have real - proofs because we cna bypass with overriding shouldCheckProof() + proofs because we can bypass with overriding skipProofCheck() in a mockBirdge AND proof system already 'battle tested'.*/ // This predefined successful process message call fails now // since we modified the iBridge.Message struct and cut out @@ -340,14 +336,13 @@ contract BridgeTest is TestBase { (IBridge.Message memory message, bytes memory proof) = setUpPredefinedSuccessfulProcessMessageCall(); - bytes32 msgHash = destChainBridge.hashMessage(message); + bytes32 msgHash = keccak256(abi.encode(message)); - mockProofBridge.processMessage(message, proof); + destChainBridge.processMessage(message, proof); - LibBridgeStatus.MessageStatus status = - mockProofBridge.getMessageStatus(msgHash); + Bridge.Status status = destChainBridge.messageStatus(msgHash); - assertEq(status == LibBridgeStatus.MessageStatus.DONE, true); + assertEq(status == Bridge.Status.DONE, true); } // test with a known good merkle proof / message since we cant generate @@ -355,7 +350,7 @@ contract BridgeTest is TestBase { // in foundry function test_Bridge_retry_message_and_end_up_in_failed_status() public { /* DISCALIMER: From now on we do not need to have real - proofs because we cna bypass with overriding shouldCheckProof() + proofs because we can bypass with overriding skipProofCheck() in a mockBirdge AND proof system already 'battle tested'.*/ vm.startPrank(Alice); (IBridge.Message memory message, bytes memory proof) = @@ -364,24 +359,22 @@ contract BridgeTest is TestBase { // etch bad receiver at the to address, so it fails. vm.etch(message.to, address(badReceiver).code); - bytes32 msgHash = destChainBridge.hashMessage(message); + bytes32 msgHash = keccak256(abi.encode(message)); - mockProofBridge.processMessage(message, proof); + destChainBridge.processMessage(message, proof); - LibBridgeStatus.MessageStatus status = - mockProofBridge.getMessageStatus(msgHash); + Bridge.Status status = destChainBridge.messageStatus(msgHash); - assertEq(status == LibBridgeStatus.MessageStatus.RETRIABLE, true); + assertEq(status == Bridge.Status.RETRIABLE, true); vm.stopPrank(); vm.prank(message.user); - mockProofBridge.retryMessage(message, true); + destChainBridge.retryMessage(message, true); - LibBridgeStatus.MessageStatus postRetryStatus = - mockProofBridge.getMessageStatus(msgHash); + Bridge.Status postRetryStatus = destChainBridge.messageStatus(msgHash); - assertEq(postRetryStatus == LibBridgeStatus.MessageStatus.FAILED, true); + assertEq(postRetryStatus == Bridge.Status.FAILED, true); } function retry_message_reverts_when_status_non_retriable() public { @@ -394,7 +387,7 @@ contract BridgeTest is TestBase { destChain: destChainId }); - vm.expectRevert(BridgeErrors.B_MSG_NON_RETRIABLE.selector); + vm.expectRevert(Bridge.B_NON_RETRIABLE.selector); destChainBridge.retryMessage(message, true); } @@ -411,12 +404,12 @@ contract BridgeTest is TestBase { destChain: destChainId }); - vm.expectRevert(BridgeErrors.B_DENIED.selector); + vm.expectRevert(Bridge.B_PERMISSION_DENIED.selector); destChainBridge.retryMessage(message, true); } /* DISCALIMER: From now on we do not need to have real - proofs because we cna bypass with overriding shouldCheckProof() + proofs because we can bypass with overriding skipProofCheck() in a mockBirdge AND proof system already 'battle tested'.*/ function setUpPredefinedSuccessfulProcessMessageCall() internal @@ -436,19 +429,16 @@ contract BridgeTest is TestBase { addressManager.setAddress(dest, "ether_vault", address(etherVault)); etherVault.authorize(address(destChainBridge), true); - etherVault.authorize(address(mockProofBridge), true); + etherVault.authorize(address(mockProofSignalService), true); vm.deal(address(etherVault), 100 ether); addressManager.setAddress( - dest, "signal_service", address(signalService) - ); - - crossChainSync.setCrossChainBlockHeader( - 0xd5f5d8ac6bc37139c97389b00e9cf53e89c153ad8a5fc765ffe9f44ea9f3d31e + dest, "signal_service", address(mockProofSignalService) ); - crossChainSync.setCrossChainSignalRoot( + crossChainSync.setSyncedData( + 0xd5f5d8ac6bc37139c97389b00e9cf53e89c153ad8a5fc765ffe9f44ea9f3d31e, 0x631b214fb030d82847224f0b3d3b906a6764dded176ad3c7262630204867ba85 ); diff --git a/packages/protocol/test/signal/SignalService.t.sol b/packages/protocol/test/signal/SignalService.t.sol index 5be86126d94..c1b357fb2fa 100644 --- a/packages/protocol/test/signal/SignalService.t.sol +++ b/packages/protocol/test/signal/SignalService.t.sol @@ -5,8 +5,7 @@ import { AddressManager } from "../../contracts/common/AddressManager.sol"; import { AddressResolver } from "../../contracts/common/AddressResolver.sol"; import { Bridge } from "../../contracts/bridge/Bridge.sol"; import { BridgedERC20 } from "../../contracts/tokenvault/BridgedERC20.sol"; -import { BridgeErrors } from "../../contracts/bridge/BridgeErrors.sol"; -import { console2 } from "forge-std/console2.sol"; +import { console } from "forge-std/console.sol"; import { FreeMintERC20 } from "../../contracts/test/erc20/FreeMintERC20.sol"; import { SignalService } from "../../contracts/signal/SignalService.sol"; import { TestBase, DummyCrossChainSync } from "../TestBase.sol"; @@ -49,17 +48,17 @@ contract TestSignalService is TestBase { } function test_SignalService_sendSignal_revert() public { - vm.expectRevert(SignalService.B_ZERO_SIGNAL.selector); + vm.expectRevert(SignalService.SS_INVALID_SIGNAL.selector); signalService.sendSignal(0); } function test_SignalService_isSignalSent_revert() public { bytes32 signal = bytes32(uint256(1)); - vm.expectRevert(SignalService.B_NULL_APP_ADDR.selector); + vm.expectRevert(SignalService.SS_INVALID_APP.selector); signalService.isSignalSent(address(0), signal); signal = bytes32(uint256(0)); - vm.expectRevert(SignalService.B_ZERO_SIGNAL.selector); + vm.expectRevert(SignalService.SS_INVALID_SIGNAL.selector); signalService.isSignalSent(Alice, signal); } @@ -73,67 +72,11 @@ contract TestSignalService is TestBase { function test_SignalService_getSignalSlot() public { vm.startPrank(Alice); - for (uint8 i = 1; i < 100; i++) { + for (uint8 i = 1; i < 100; ++i) { bytes32 signal = bytes32(block.prevrandao + i); signalService.sendSignal(signal); assertTrue(signalService.isSignalSent(Alice, signal)); - - // confirm our assembly gives same output as expected native - // solidity hash/packing - assertEq( - signalService.getSignalSlot(Alice, signal), - keccak256(abi.encodePacked(Alice, signal)) - ); } } - - function test_SignalService_isSignalReceived_revert() public { - bytes32 signal = bytes32(uint256(1)); - bytes memory proof = new bytes(1); - vm.expectRevert(SignalService.B_WRONG_CHAIN_ID.selector); - signalService.isSignalReceived(block.chainid, Alice, signal, proof); - - signal = bytes32(uint256(1)); - proof = new bytes(1); - vm.expectRevert(SignalService.B_NULL_APP_ADDR.selector); - signalService.isSignalReceived(destChainId, address(0), signal, proof); - - signal = bytes32(uint256(0)); - proof = new bytes(1); - vm.expectRevert(SignalService.B_ZERO_SIGNAL.selector); - signalService.isSignalReceived(destChainId, Alice, signal, proof); - - signal = bytes32(uint256(1)); - proof = new bytes(1); - vm.expectRevert(); - signalService.isSignalReceived(destChainId, Alice, signal, proof); - } - - function test_SignalService_isSignalReceived() public { - // This specific value is used, do not change it. - address Brecht = 0xDf08F82De32B8d460adbE8D72043E3a7e25A3B39; - - // known signal with known proof for known block header/signalRoot from - // a known chain ID of 1336, since we cant generate merkle proofs with - // foundry. - bytes32 signal = bytes32( - 0xa99d658793daba4d352c77378e2d0f3b12ff47503518b3ec9ad61bb33ee7031d - ); - bytes memory proof = - hex"0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000003e0d5c45a5c0fabac05a887ad983965a225214df2cecd77adc216d3b1172866b1e91dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d493470000000000000000000000000000000000000000000000000000000000000000cba38a70215ae3eeba2e97f9b6c3c804541484202953760c1cfe734df6dfce7cf7f7ed1e57a053e1c79765d6b76305193cae04261538400724837787437e621c9e6a8ea258a11278cf2e54d0e4845843837a1da42483ebe1dddf3eed1d33088b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000099c8ac000000000000000000000000000000000000000000000000000000000000ac7500000000000000000000000000000000000000000000000000000000644311c100000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000164c61e700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000061d883010a1a846765746888676f312e31382e38856c696e757800000000000000def5020e30ddc20e32151adb608a5d8367d817a707ae8d520c98ac13de04bce35f95ef795a9c4fd13d3e5daf713525521043125bde66aa71eed7ca715f05c720000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dbf8d9b8b3f8b18080a04fc5f13ab2f9ba0c2da88b0151ab0e7cf4d85d08cca45ccd923c6ab76323eb28a02b70a98baa2507beffe8c266006cae52064dccf4fd1998af774ab3399029b38380808080a07394a09684ef3b2c87e9e2a753eb4ac78e2047b980e16d2e2133aee78946370d8080a0f4984a11f61a2921456141df88de6e1a710d28681b91af794c5a721e47839cd7a00f6329feca1549bd3bf7ab9a2e474bde37cb4f81366fca1dfdd9257c7305b5b880808080a3e2a037a8317247f2d3e645fa68570a9ae97a73b5568fe0578b90197316c654138997010000000000"; - - crossChainSync.setCrossChainBlockHeader( - 0x986278442ae7469dbd55f478348b4547c399004c93325b18ed995d2bc008f98d - ); - crossChainSync.setCrossChainSignalRoot( - 0x58900f5366437923bb250887d359d828a1a89e1837f9369f75c3e1bb238b854f - ); - - vm.chainId(destChainId); - - assertTrue( - destSignalService.isSignalReceived(1336, Brecht, signal, proof) - ); - } } diff --git a/packages/protocol/test/tokenvault/ERC1155Vault.t.sol b/packages/protocol/test/tokenvault/ERC1155Vault.t.sol index bc62ff099a1..eb5673c9464 100644 --- a/packages/protocol/test/tokenvault/ERC1155Vault.t.sol +++ b/packages/protocol/test/tokenvault/ERC1155Vault.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.20; import { console2 } from "forge-std/console2.sol"; import { TestBase, - SkipProofCheckBridge, + SkipProofCheckSignal, DummyCrossChainSync, NonNftContract, BadReceiver @@ -12,14 +12,10 @@ import { import { AddressResolver } from "../../contracts/common/AddressResolver.sol"; import { AddressManager } from "../../contracts/common/AddressManager.sol"; import { IBridge, Bridge } from "../../contracts/bridge/Bridge.sol"; -import { LibBridgeData } from "../../contracts/bridge/libs/LibBridgeData.sol"; -import { BridgeErrors } from "../../contracts/bridge/BridgeErrors.sol"; import { BaseNFTVault } from "../../contracts/tokenvault/BaseNFTVault.sol"; import { ERC1155Vault } from "../../contracts/tokenvault/ERC1155Vault.sol"; import { BridgedERC1155 } from "../../contracts/tokenvault/BridgedERC1155.sol"; import { EtherVault } from "../../contracts/bridge/EtherVault.sol"; -import { LibBridgeStatus } from - "../../contracts/bridge/libs/LibBridgeStatus.sol"; import { SignalService } from "../../contracts/signal/SignalService.sol"; import { ICrossChainSync } from "../../contracts/common/ICrossChainSync.sol"; import { ERC1155 } from @@ -60,10 +56,10 @@ contract PrankDestBridge { function sendMessage(IBridge.Message memory message) external payable - returns (bytes32 msgHash) + returns (bytes32 msgHash, IBridge.Message memory _message) { // Dummy return value - return keccak256(abi.encode(message.id)); + return (keccak256(abi.encode(message.id)), _message); } function context() public view returns (BridgeContext memory) { @@ -105,15 +101,6 @@ contract PrankDestBridge { } } -// PrankSrcBridge lets us mock Bridge/SignalService to return true when called -// isMessageFailed() -contract PrankSrcBridge is SkipProofCheckBridge { - function getPreDeterminedDataBytes() external pure returns (bytes memory) { - return - hex"20b8155900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000010020fcb72e27650651b05ed2ceca493bc807ba400000000000000000000000010020fcb72e27650651b05ed2ceca493bc807ba4000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000007a69000000000000000000000000a64f94242628683ea967cd7dd6a10b5ed0400662000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002"; - } -} - contract UpdatedBridgedERC1155 is BridgedERC1155 { function helloWorld() public pure returns (string memory) { return "helloworld"; @@ -126,7 +113,7 @@ contract ERC1155VaultTest is TestBase { Bridge bridge; Bridge destChainBridge; PrankDestBridge destChainIdBridge; - PrankSrcBridge srcPrankBridge; + SkipProofCheckSignal mockProofSignalService; ERC1155Vault erc1155Vault; ERC1155Vault destChainErc1155Vault; TestTokenERC1155 ctoken1155; @@ -135,9 +122,10 @@ contract ERC1155VaultTest is TestBase { DummyCrossChainSync crossChainSync; uint256 destChainId = 19_389; - // TODO(dani): why chaning Amilia's address will fail the test? - //Need +1 bc. and Amelia is the proxied bridge contracts owner - address public Amelia = 0x60081B12838240B1BA02b3177153BCa678A86080; + // Need +1 bc. and Amelia is the proxied bridge contracts owner + // Change will cause onMessageRecall() test fails, because of + // getPreDeterminedDataBytes + address public Amelia = 0x60081b12838240B1ba02B3177153Bca678a86081; function setUp() public { vm.startPrank(Amelia); @@ -168,13 +156,17 @@ contract ERC1155VaultTest is TestBase { destChainIdBridge = new PrankDestBridge(destChainErc1155Vault); vm.deal(address(destChainIdBridge), 100 ether); - srcPrankBridge = new PrankSrcBridge(); - srcPrankBridge.init(address(addressManager)); + mockProofSignalService = new SkipProofCheckSignal(); + mockProofSignalService.init(address(addressManager)); crossChainSync = new DummyCrossChainSync(); addressManager.setAddress( - block.chainid, "signal_service", address(signalService) + block.chainid, "signal_service", address(mockProofSignalService) + ); + + addressManager.setAddress( + destChainId, "signal_service", address(mockProofSignalService) ); addressManager.setAddress(block.chainid, "bridge", address(bridge)); @@ -195,22 +187,22 @@ contract ERC1155VaultTest is TestBase { // LibBridgeRecall.sol's // resolve address addressManager.setAddress( - destChainId, "erc721_vault", address(srcPrankBridge) + destChainId, "erc721_vault", address(mockProofSignalService) ); addressManager.setAddress( - destChainId, "erc20_vault", address(srcPrankBridge) + destChainId, "erc20_vault", address(mockProofSignalService) ); addressManager.setAddress( - block.chainid, "erc721_vault", address(srcPrankBridge) + block.chainid, "erc721_vault", address(mockProofSignalService) ); addressManager.setAddress( - block.chainid, "erc20_vault", address(srcPrankBridge) + block.chainid, "erc20_vault", address(mockProofSignalService) ); addressManager.setAddress( block.chainid, "ether_vault", address(etherVault) ); // Authorize - etherVault.authorize(address(srcPrankBridge), true); + etherVault.authorize(address(destChainIdBridge), true); etherVault.authorize(address(bridge), true); vm.deal(address(etherVault), 100 ether); @@ -224,6 +216,11 @@ contract ERC1155VaultTest is TestBase { vm.stopPrank(); } + function getPreDeterminedDataBytes() internal pure returns (bytes memory) { + return + hex"20b8155900000000000000000000000000000000000000000000000000000000000000a00000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf0000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000007a690000000000000000000000007935de70183a080242a58f64637a8e7f15349b63000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002"; + } + function test_1155Vault_sendToken_1155() public { vm.prank(Alice, Alice); ctoken1155.setApprovalForAll(address(erc1155Vault), true); @@ -615,13 +612,6 @@ contract ERC1155VaultTest is TestBase { "" ); - // Let's test that message is failed and we want to release it back to - // the owner - vm.prank(Amelia, Amelia); - addressManager.setAddress( - block.chainid, "bridge", address(srcPrankBridge) - ); - vm.prank(Alice, Alice); erc1155Vault.sendToken{ value: 140_000 }(sendOpts); @@ -640,14 +630,13 @@ contract ERC1155VaultTest is TestBase { message.user = Alice; message.from = address(erc1155Vault); message.to = address(destChainErc1155Vault); - message.data = srcPrankBridge.getPreDeterminedDataBytes(); + message.data = getPreDeterminedDataBytes(); message.gasLimit = 140_000; message.fee = 140_000; message.refundTo = Alice; message.memo = ""; - bytes memory proof = bytes(""); - srcPrankBridge.recallMessage(message, proof); + bridge.recallMessage(message, bytes("")); // Alice got back her NFTs, and vault has 0 assertEq(ctoken1155.balanceOf(Alice, 1), 10); @@ -782,7 +771,6 @@ contract ERC1155VaultTest is TestBase { chainId, 0 ); - // Query canonicalToBridged address deployedContract = destChainErc1155Vault.canonicalToBridged( chainId, address(ctoken1155) diff --git a/packages/protocol/test/tokenvault/ERC20Vault.t.sol b/packages/protocol/test/tokenvault/ERC20Vault.t.sol index ae552d725c0..2e454e84a7f 100644 --- a/packages/protocol/test/tokenvault/ERC20Vault.t.sol +++ b/packages/protocol/test/tokenvault/ERC20Vault.t.sol @@ -5,7 +5,6 @@ import { AddressManager } from "../../contracts/common/AddressManager.sol"; import { AddressResolver } from "../../contracts/common/AddressResolver.sol"; import { Bridge } from "../../contracts/bridge/Bridge.sol"; import { BridgedERC20 } from "../../contracts/tokenvault/BridgedERC20.sol"; -import { BridgeErrors } from "../../contracts/bridge/BridgeErrors.sol"; import { FreeMintERC20 } from "../../contracts/test/erc20/FreeMintERC20.sol"; import { SignalService } from "../../contracts/signal/SignalService.sol"; import { TaikoToken } from "../../contracts/L1/TaikoToken.sol"; @@ -92,7 +91,7 @@ contract TestERC20Vault is Test { address public constant Alice = 0x10020FCb72e27650651B05eD2CEcA493bC807Ba4; address public constant Bob = 0x200708D76eB1B69761c23821809d53F65049939e; - //Need +1 bc. and Amelia is the proxied bridge contracts owner + // Need +1 bc. and Amelia is the proxied bridge contracts owner address public constant Amelia = 0x60081B12838240B1BA02b3177153BCa678A86080; // Dave has nothing so that we can check if he gets the ether (and other // erc20) @@ -433,7 +432,7 @@ contract TestERC20Vault is Test { try UpdatedBridgedERC20(bridgedAddressAfter).helloWorld() { fail(); } catch { - //It should not yet support this function call + // It should not yet support this function call } // Upgrade the implementation of that contract @@ -447,7 +446,7 @@ contract TestERC20Vault is Test { vm.prank(Alice, Alice); try UpdatedBridgedERC20(bridgedAddressAfter).helloWorld() { - //It should support now this function call + // It should support now this function call } catch { fail(); } diff --git a/packages/protocol/test/tokenvault/ERC721Vault.t.sol b/packages/protocol/test/tokenvault/ERC721Vault.t.sol index 0192b7793cb..2adc5250aaf 100644 --- a/packages/protocol/test/tokenvault/ERC721Vault.t.sol +++ b/packages/protocol/test/tokenvault/ERC721Vault.t.sol @@ -4,21 +4,17 @@ pragma solidity ^0.8.20; import { console2 } from "forge-std/console2.sol"; import { TestBase, - SkipProofCheckBridge, + SkipProofCheckSignal, DummyCrossChainSync, NonNftContract, BadReceiver } from "../TestBase.sol"; import { AddressManager } from "../../contracts/common/AddressManager.sol"; import { IBridge, Bridge } from "../../contracts/bridge/Bridge.sol"; -import { LibBridgeData } from "../../contracts/bridge/libs/LibBridgeData.sol"; -import { BridgeErrors } from "../../contracts/bridge/BridgeErrors.sol"; import { BaseNFTVault } from "../../contracts/tokenvault/BaseNFTVault.sol"; import { ERC721Vault } from "../../contracts/tokenvault/ERC721Vault.sol"; import { BridgedERC721 } from "../../contracts/tokenvault/BridgedERC721.sol"; import { EtherVault } from "../../contracts/bridge/EtherVault.sol"; -import { LibBridgeStatus } from - "../../contracts/bridge/libs/LibBridgeStatus.sol"; import { SignalService } from "../../contracts/signal/SignalService.sol"; import { ICrossChainSync } from "../../contracts/common/ICrossChainSync.sol"; import { ERC721 } from @@ -49,7 +45,7 @@ contract TestTokenERC721 is ERC721 { } function mint(uint256 amount) public { - for (uint256 i; i < amount; i++) { + for (uint256 i; i < amount; ++i) { _safeMint(msg.sender, minted + i); } minted += amount; @@ -81,10 +77,10 @@ contract PrankDestBridge { function sendMessage(IBridge.Message memory message) external payable - returns (bytes32 msgHash) + returns (bytes32 msgHash, IBridge.Message memory _message) { // Dummy return value - return keccak256(abi.encode(message.id)); + return (keccak256(abi.encode(message.id)), _message); } function context() public view returns (BridgeContext memory) { @@ -125,15 +121,6 @@ contract PrankDestBridge { } } -// PrankSrcBridge lets us mock Bridge/SignalService to return true when called -// isMessageFailed() -contract PrankSrcBridge is SkipProofCheckBridge { - function getPreDeterminedDataBytes() external pure returns (bytes memory) { - return - hex"a9976baf000000000000000000000000000000000000000000000000000000000000008000000000000000000000000010020fcb72e27650651b05ed2ceca493bc807ba400000000000000000000000010020fcb72e27650651b05ed2ceca493bc807ba400000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000007a69000000000000000000000000f349eda7118cad7972b7401c1f5d71e9ea218ef8000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000254540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002545400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001"; - } -} - contract UpdatedBridgedERC721 is BridgedERC721 { function helloWorld() public pure returns (string memory) { return "helloworld"; @@ -146,7 +133,7 @@ contract ERC721VaultTest is TestBase { Bridge bridge; Bridge destChainBridge; PrankDestBridge destChainIdBridge; - PrankSrcBridge srcPrankBridge; + SkipProofCheckSignal mockProofSignalService; ERC721Vault erc721Vault; ERC721Vault destChainErc721Vault; TestTokenERC721 canonicalToken721; @@ -155,14 +142,12 @@ contract ERC721VaultTest is TestBase { DummyCrossChainSync crossChainSync; uint256 destChainId = 19_389; - //Need +1 bc. and Amelia is the proxied bridge contracts owner + // Need +1 bc. and Amelia is the proxied bridge contracts owner + // Change will cause onMessageRecall() test fails, because of + // getPreDeterminedDataBytes address public constant Amelia = 0x60081B12838240B1BA02b3177153BCa678A86080; function setUp() public { - // TODO(dani): we have to overwrite Alice address, otherise - // test_onMessageRecalled_721 will fail. Do you know why? - Alice = 0x10020FCb72e27650651B05eD2CEcA493bC807Ba4; - vm.startPrank(Amelia); vm.deal(Alice, 100 ether); vm.deal(Amelia, 100 ether); @@ -191,13 +176,17 @@ contract ERC721VaultTest is TestBase { destChainIdBridge = new PrankDestBridge(destChainErc721Vault); vm.deal(address(destChainIdBridge), 100 ether); - srcPrankBridge = new PrankSrcBridge(); - srcPrankBridge.init(address(addressManager)); + mockProofSignalService = new SkipProofCheckSignal(); + mockProofSignalService.init(address(addressManager)); crossChainSync = new DummyCrossChainSync(); addressManager.setAddress( - block.chainid, "signal_service", address(signalService) + block.chainid, "signal_service", address(mockProofSignalService) + ); + + addressManager.setAddress( + destChainId, "signal_service", address(mockProofSignalService) ); addressManager.setAddress(block.chainid, "bridge", address(bridge)); @@ -217,22 +206,22 @@ contract ERC721VaultTest is TestBase { // LibBridgeRecall.sol's // resolve address addressManager.setAddress( - destChainId, "erc1155_vault", address(srcPrankBridge) + destChainId, "erc1155_vault", address(erc721Vault) ); addressManager.setAddress( - destChainId, "erc20_vault", address(srcPrankBridge) + destChainId, "erc20_vault", address(erc721Vault) ); addressManager.setAddress( - block.chainid, "erc1155_vault", address(srcPrankBridge) + block.chainid, "erc1155_vault", address(erc721Vault) ); addressManager.setAddress( - block.chainid, "erc20_vault", address(srcPrankBridge) + block.chainid, "erc20_vault", address(erc721Vault) ); addressManager.setAddress( block.chainid, "ether_vault", address(etherVault) ); // Authorize - etherVault.authorize(address(srcPrankBridge), true); + etherVault.authorize(address(destChainBridge), true); etherVault.authorize(address(bridge), true); vm.stopPrank(); @@ -244,6 +233,11 @@ contract ERC721VaultTest is TestBase { vm.stopPrank(); } + function getPreDeterminedDataBytes() internal pure returns (bytes memory) { + return + hex"a9976baf00000000000000000000000000000000000000000000000000000000000000800000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf0000000000000000000000007e5f4552091a69125d5dfcb7b8c2659029395bdf00000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000007a69000000000000000000000000f2e246bb76df876cef8b38ae84130f4f55de395b000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000254540000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002545400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001"; + } + function test_721Vault_sendToken_721() public { vm.prank(Alice, Alice); canonicalToken721.approve(address(erc721Vault), 1); @@ -622,12 +616,6 @@ contract ERC721VaultTest is TestBase { Alice, "" ); - // Let's test that message is failed and we want to release it back to - // the owner - vm.prank(Amelia, Amelia); - addressManager.setAddress( - block.chainid, "bridge", address(srcPrankBridge) - ); vm.prank(Alice, Alice); erc721Vault.sendToken{ value: 140_000 }(sendOpts); @@ -646,14 +634,13 @@ contract ERC721VaultTest is TestBase { message.user = Alice; message.from = address(erc721Vault); message.to = address(destChainErc721Vault); - message.data = srcPrankBridge.getPreDeterminedDataBytes(); + message.data = getPreDeterminedDataBytes(); message.gasLimit = 140_000; message.fee = 140_000; message.refundTo = Alice; message.memo = ""; - bytes memory proof = bytes(""); - srcPrankBridge.recallMessage(message, proof); + bridge.recallMessage(message, bytes("")); // Alice got back her NFT assertEq(canonicalToken721.ownerOf(1), Alice); @@ -1001,7 +988,7 @@ contract ERC721VaultTest is TestBase { try UpdatedBridgedERC721(deployedContract).helloWorld() { fail(); } catch { - //It should not yet support this function call + // It should not yet support this function call } // Upgrade the implementation of that contract @@ -1013,7 +1000,7 @@ contract ERC721VaultTest is TestBase { ); try UpdatedBridgedERC721(deployedContract).helloWorld() { - //It should support now this function call + // It should support now this function call } catch { fail(); } diff --git a/packages/protocol/test/tokenvault/EtherVault.t.sol b/packages/protocol/test/tokenvault/EtherVault.t.sol index 4e23e0fb7fd..46ece6f4525 100644 --- a/packages/protocol/test/tokenvault/EtherVault.t.sol +++ b/packages/protocol/test/tokenvault/EtherVault.t.sol @@ -4,7 +4,6 @@ pragma solidity ^0.8.20; import { TestBase } from "../TestBase.sol"; import { AddressManager } from "../../contracts/common/AddressManager.sol"; import { EtherVault } from "../../contracts/bridge/EtherVault.sol"; -import { BridgeErrors } from "../../contracts/bridge/BridgeErrors.sol"; contract TestEtherVault is TestBase { AddressManager addressManager; @@ -26,12 +25,12 @@ contract TestEtherVault is TestBase { etherVault.authorize(Bob, true); vm.prank(Alice); - vm.expectRevert(BridgeErrors.B_EV_PARAM.selector); + vm.expectRevert(EtherVault.VAULT_INVALID_PARAMS.selector); etherVault.authorize(address(0), true); vm.startPrank(Alice); etherVault.authorize(Bob, true); - vm.expectRevert(BridgeErrors.B_EV_PARAM.selector); + vm.expectRevert(EtherVault.VAULT_INVALID_PARAMS.selector); etherVault.authorize(Bob, true); assertTrue(etherVault.isAuthorized(Bob)); } @@ -69,7 +68,7 @@ contract TestEtherVault is TestBase { etherVault.authorize(Alice, true); _seedEtherVault(); - vm.expectRevert(BridgeErrors.B_EV_DO_NOT_BURN.selector); + vm.expectRevert(EtherVault.VAULT_INVALID_RECIPIENT.selector); etherVault.releaseEther(address(0), 1 ether); } diff --git a/packages/protocol/utils/generate_genesis/erc20.ts b/packages/protocol/utils/generate_genesis/erc20.ts index 6621d400143..cbc7db4ea0d 100644 --- a/packages/protocol/utils/generate_genesis/erc20.ts +++ b/packages/protocol/utils/generate_genesis/erc20.ts @@ -15,17 +15,16 @@ export const PREMINT_SEED_ACCOUNT_BALANCE = ethers.BigNumber.from(1024000); // and premints some tokens for the seed accounts given in the configurations. export async function deployERC20( config: any, - result: Result + result: Result, ): Promise { const { contractOwner, chainId, seedAccounts } = config; const alloc: any = {}; const storageLayouts: any = {}; - const artifact = require(path.join( - ARTIFACTS_PATH, - "./RegularERC20.sol/RegularERC20.json" - )); + const artifact = require( + path.join(ARTIFACTS_PATH, "./RegularERC20.sol/RegularERC20.json"), + ); artifact.contractName = "RegularERC20"; @@ -39,9 +38,9 @@ export async function deployERC20( address = ethers.utils.getCreate2Address( contractOwner, ethers.utils.keccak256( - ethers.utils.toUtf8Bytes(`${chainId}${artifact.contractName}`) + ethers.utils.toUtf8Bytes(`${chainId}${artifact.contractName}`), ), - ethers.utils.keccak256(ethers.utils.toUtf8Bytes(artifact.bytecode)) + ethers.utils.keccak256(ethers.utils.toUtf8Bytes(artifact.bytecode)), ); } @@ -65,12 +64,12 @@ export async function deployERC20( }; storageLayouts[artifact.contractName] = await getStorageLayout( - artifact.contractName + artifact.contractName, ); for (const slot of computeStorageSlots( storageLayouts[artifact.contractName], - variables + variables, )) { alloc[address].storage[slot.key] = slot.val; } @@ -78,7 +77,7 @@ export async function deployERC20( result.alloc = Object.assign(result.alloc, alloc); result.storageLayouts = Object.assign( result.storageLayouts, - storageLayouts + storageLayouts, ); return result; diff --git a/packages/protocol/utils/generate_genesis/main.ts b/packages/protocol/utils/generate_genesis/main.ts index 777c48402c3..450fe4590fe 100644 --- a/packages/protocol/utils/generate_genesis/main.ts +++ b/packages/protocol/utils/generate_genesis/main.ts @@ -12,9 +12,11 @@ async function main() { throw new Error("missing config json"); } - const config: Config = require(path.isAbsolute(process.argv[2]) - ? process.argv[2] - : path.join(process.cwd(), process.argv[2])); + const config: Config = require( + path.isAbsolute(process.argv[2]) + ? process.argv[2] + : path.join(process.cwd(), process.argv[2]), + ); const contractOwner = config.contractOwner; const chainId = config.chainId; @@ -39,7 +41,7 @@ async function main() { contractOwner, chainId, seedAccounts, - })}` + })}`, ); } @@ -60,19 +62,19 @@ async function main() { const allocSavedPath = path.join( __dirname, - "../../deployments/genesis_alloc.json" + "../../deployments/genesis_alloc.json", ); fs.writeFileSync(allocSavedPath, JSON.stringify(result.alloc, null, 2)); const layoutSavedPath = path.join( __dirname, - "../../deployments/genesis_storage_layout.json" + "../../deployments/genesis_storage_layout.json", ); fs.writeFileSync( layoutSavedPath, - JSON.stringify(result.storageLayouts, null, 2) + JSON.stringify(result.storageLayouts, null, 2), ); console.log("done"); diff --git a/packages/protocol/utils/generate_genesis/taikoL2.ts b/packages/protocol/utils/generate_genesis/taikoL2.ts index 1f6cdc0eec5..ea979aa451d 100644 --- a/packages/protocol/utils/generate_genesis/taikoL2.ts +++ b/packages/protocol/utils/generate_genesis/taikoL2.ts @@ -17,7 +17,7 @@ const ADMIN_SLOT = // deployTaikoL2 generates a L2 genesis alloc of the TaikoL2 contract. export async function deployTaikoL2( config: Config, - result: Result + result: Result, ): Promise { const { contractOwner, chainId, seedAccounts, contractAdmin } = config; @@ -28,7 +28,7 @@ export async function deployTaikoL2( for (const seedAccount of seedAccounts) { const accountAddress = Object.keys(seedAccount)[0]; const balance = ethers.utils.parseEther( - `${Object.values(seedAccount)[0]}` + `${Object.values(seedAccount)[0]}`, ); console.log(`seedAccountAddress: ${accountAddress}`); @@ -47,7 +47,7 @@ export async function deployTaikoL2( contractAdmin, chainId, config.contractAddresses, - config.param1559 + config.param1559, ); const storageLayouts: any = {}; @@ -78,14 +78,13 @@ export async function deployTaikoL2( storageLayoutName = `Proxied${storageLayoutName}`; } - storageLayouts[contractName] = await getStorageLayout( - storageLayoutName - ); + storageLayouts[contractName] = + await getStorageLayout(storageLayoutName); // initialize contract variables, we only care about the variables // that need to be initialized with non-zero value. const slots = computeStorageSlots( storageLayouts[contractName], - contractConfigs[contractName].variables + contractConfigs[contractName].variables, ); for (const slot of slots) { @@ -94,7 +93,7 @@ export async function deployTaikoL2( if (contractConfigs[contractName].slots) { for (const [slot, val] of Object.entries( - contractConfigs[contractName].slots + contractConfigs[contractName].slots, )) { alloc[contractConfig.address].storage[slot] = val; } @@ -104,7 +103,7 @@ export async function deployTaikoL2( result.alloc = Object.assign(result.alloc, alloc); result.storageLayouts = Object.assign( result.storageLayouts, - storageLayouts + storageLayouts, ); return result; @@ -117,65 +116,64 @@ async function generateContractConfigs( contractAdmin: string, chainId: number, hardCodedAddresses: any, - param1559: any + param1559: any, ): Promise { const contractArtifacts: any = { // Libraries - LibTrieProof: require(path.join( - ARTIFACTS_PATH, - "./LibTrieProof.sol/LibTrieProof.json" - )), - LibBridgeRetry: require(path.join( - ARTIFACTS_PATH, - "./LibBridgeRetry.sol/LibBridgeRetry.json" - )), - LibBridgeProcess: require(path.join( - ARTIFACTS_PATH, - "./LibBridgeProcess.sol/LibBridgeProcess.json" - )), - LibVaultUtils: require(path.join( - ARTIFACTS_PATH, - "./LibVaultUtils.sol/LibVaultUtils.json" - )), + LibVaultUtils: require( + path.join(ARTIFACTS_PATH, "./LibVaultUtils.sol/LibVaultUtils.json"), + ), // Contracts - ProxiedAddressManager: require(path.join( - ARTIFACTS_PATH, - "./AddressManager.sol/ProxiedAddressManager.json" - )), - ProxiedTaikoL2: require(path.join( - ARTIFACTS_PATH, - "./TaikoL2.sol/ProxiedTaikoL2.json" - )), - ProxiedBridge: require(path.join( - ARTIFACTS_PATH, - "./Bridge.sol/ProxiedBridge.json" - )), - ProxiedERC20Vault: require(path.join( - ARTIFACTS_PATH, - "./ERC20Vault.sol/ProxiedERC20Vault.json" - )), - ProxiedERC721Vault: require(path.join( - ARTIFACTS_PATH, - "./ERC721Vault.sol/ProxiedERC721Vault.json" - )), - ProxiedERC1155Vault: require(path.join( - ARTIFACTS_PATH, - "./ERC1155Vault.sol/ProxiedERC1155Vault.json" - )), - ProxiedEtherVault: require(path.join( - ARTIFACTS_PATH, - "./EtherVault.sol/ProxiedEtherVault.json" - )), - ProxiedSignalService: require(path.join( - ARTIFACTS_PATH, - "./SignalService.sol/ProxiedSignalService.json" - )), + ProxiedAddressManager: require( + path.join( + ARTIFACTS_PATH, + "./AddressManager.sol/ProxiedAddressManager.json", + ), + ), + ProxiedTaikoL2: require( + path.join(ARTIFACTS_PATH, "./TaikoL2.sol/ProxiedTaikoL2.json"), + ), + ProxiedBridge: require( + path.join(ARTIFACTS_PATH, "./Bridge.sol/ProxiedBridge.json"), + ), + ProxiedERC20Vault: require( + path.join( + ARTIFACTS_PATH, + "./ERC20Vault.sol/ProxiedERC20Vault.json", + ), + ), + ProxiedERC721Vault: require( + path.join( + ARTIFACTS_PATH, + "./ERC721Vault.sol/ProxiedERC721Vault.json", + ), + ), + ProxiedERC1155Vault: require( + path.join( + ARTIFACTS_PATH, + "./ERC1155Vault.sol/ProxiedERC1155Vault.json", + ), + ), + ProxiedEtherVault: require( + path.join( + ARTIFACTS_PATH, + "./EtherVault.sol/ProxiedEtherVault.json", + ), + ), + ProxiedSignalService: require( + path.join( + ARTIFACTS_PATH, + "./SignalService.sol/ProxiedSignalService.json", + ), + ), }; - const proxy = require(path.join( - ARTIFACTS_PATH, - "./TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json" - )); + const proxy = require( + path.join( + ARTIFACTS_PATH, + "./TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json", + ), + ); contractArtifacts.TaikoL2Proxy = proxy; contractArtifacts.BridgeProxy = proxy; contractArtifacts.ERC20VaultProxy = proxy; @@ -194,43 +192,19 @@ async function generateContractConfigs( case "ProxiedTaikoL2": bytecode = linkContractLibs( contractArtifacts.ProxiedTaikoL2, - addressMap - ); - break; - case "LibBridgeProcess": - if (!addressMap.LibTrieProof) { - throw new Error("LibTrieProof not initialized"); - } - - bytecode = linkContractLibs( - contractArtifacts.LibBridgeProcess, - addressMap + addressMap, ); break; case "ProxiedBridge": - if ( - !addressMap.LibTrieProof || - !addressMap.LibBridgeRetry || - !addressMap.LibBridgeProcess - ) { - throw new Error( - "LibTrieProof/LibBridgeRetry/LibBridgeProcess not initialized" - ); - } - bytecode = linkContractLibs( contractArtifacts.ProxiedBridge, - addressMap + addressMap, ); break; case "ProxiedSignalService": - if (!addressMap.LibTrieProof) { - throw new Error("LibTrieProof not initialized"); - } - bytecode = linkContractLibs( contractArtifacts.ProxiedSignalService, - addressMap + addressMap, ); break; default: @@ -246,9 +220,9 @@ async function generateContractConfigs( addressMap[contractName] = ethers.utils.getCreate2Address( contractOwner, ethers.utils.keccak256( - ethers.utils.toUtf8Bytes(`${chainId}${contractName}`) + ethers.utils.toUtf8Bytes(`${chainId}${contractName}`), ), - ethers.utils.keccak256(ethers.utils.toUtf8Bytes(bytecode)) + ethers.utils.keccak256(ethers.utils.toUtf8Bytes(bytecode)), ); } } @@ -258,26 +232,6 @@ async function generateContractConfigs( return { // Libraries - LibTrieProof: { - address: addressMap.LibTrieProof, - deployedBytecode: - contractArtifacts.LibTrieProof.deployedBytecode.object, - variables: {}, - }, - LibBridgeRetry: { - address: addressMap.LibBridgeRetry, - deployedBytecode: - contractArtifacts.LibBridgeRetry.deployedBytecode.object, - variables: {}, - }, - LibBridgeProcess: { - address: addressMap.LibBridgeProcess, - deployedBytecode: linkContractLibs( - contractArtifacts.LibBridgeProcess, - addressMap - ), - variables: {}, - }, ProxiedAddressManager: { address: addressMap.ProxiedAddressManager, deployedBytecode: @@ -297,25 +251,25 @@ async function generateContractConfigs( addresses: { [chainId]: { [ethers.utils.hexlify( - ethers.utils.toUtf8Bytes("taiko") + ethers.utils.toUtf8Bytes("taiko"), )]: addressMap.TaikoL2Proxy, [ethers.utils.hexlify( - ethers.utils.toUtf8Bytes("bridge") + ethers.utils.toUtf8Bytes("bridge"), )]: addressMap.BridgeProxy, [ethers.utils.hexlify( - ethers.utils.toUtf8Bytes("erc20_vault") + ethers.utils.toUtf8Bytes("erc20_vault"), )]: addressMap.ERC20VaultProxy, [ethers.utils.hexlify( - ethers.utils.toUtf8Bytes("erc721_vault") + ethers.utils.toUtf8Bytes("erc721_vault"), )]: addressMap.ERC721VaultProxy, [ethers.utils.hexlify( - ethers.utils.toUtf8Bytes("erc1155_vault") + ethers.utils.toUtf8Bytes("erc1155_vault"), )]: addressMap.ERC1155VaultProxy, [ethers.utils.hexlify( - ethers.utils.toUtf8Bytes("ether_vault") + ethers.utils.toUtf8Bytes("ether_vault"), )]: addressMap.EtherVaultProxy, [ethers.utils.hexlify( - ethers.utils.toUtf8Bytes("signal_service") + ethers.utils.toUtf8Bytes("signal_service"), )]: addressMap.SignalServiceProxy, }, }, @@ -330,7 +284,7 @@ async function generateContractConfigs( address: addressMap.ProxiedTaikoL2, deployedBytecode: linkContractLibs( contractArtifacts.ProxiedTaikoL2, - addressMap + addressMap, ), }, TaikoL2Proxy: { @@ -350,14 +304,14 @@ async function generateContractConfigs( .concat([ ethers.utils.hexZeroPad( ethers.utils.hexlify(chainId), - 32 + 32, ), ]), - ] + ], )}`, gasExcess: ethers.BigNumber.from(param1559.gasExcess), // AddressResolver - _addressManager: addressMap.AddressManagerProxy, + addressManager: addressMap.AddressManagerProxy, }, slots: { [ADMIN_SLOT]: contractAdmin, @@ -369,7 +323,7 @@ async function generateContractConfigs( address: addressMap.ProxiedBridge, deployedBytecode: linkContractLibs( contractArtifacts.ProxiedBridge, - addressMap + addressMap, ), }, BridgeProxy: { @@ -385,9 +339,7 @@ async function generateContractConfigs( // OwnableUpgradeable _owner: contractOwner, // AddressResolver - _addressManager: addressMap.AddressManagerProxy, - // Bridge - _state: {}, + addressManager: addressMap.AddressManagerProxy, }, slots: { [ADMIN_SLOT]: contractAdmin, @@ -399,7 +351,7 @@ async function generateContractConfigs( address: addressMap.ProxiedERC20Vault, deployedBytecode: linkContractLibs( contractArtifacts.ProxiedERC20Vault, - addressMap + addressMap, ), }, ERC20VaultProxy: { @@ -415,7 +367,7 @@ async function generateContractConfigs( // OwnableUpgradeable _owner: contractOwner, // AddressResolver - _addressManager: addressMap.AddressManagerProxy, + addressManager: addressMap.AddressManagerProxy, }, slots: { [ADMIN_SLOT]: contractAdmin, @@ -427,7 +379,7 @@ async function generateContractConfigs( address: addressMap.ProxiedERC721Vault, deployedBytecode: linkContractLibs( contractArtifacts.ProxiedERC721Vault, - addressMap + addressMap, ), }, ERC721VaultProxy: { @@ -443,7 +395,7 @@ async function generateContractConfigs( // OwnableUpgradeable _owner: contractOwner, // AddressResolver - _addressManager: addressMap.AddressManagerProxy, + addressManager: addressMap.AddressManagerProxy, }, slots: { [ADMIN_SLOT]: contractAdmin, @@ -455,7 +407,7 @@ async function generateContractConfigs( address: addressMap.ProxiedERC1155Vault, deployedBytecode: linkContractLibs( contractArtifacts.ProxiedERC1155Vault, - addressMap + addressMap, ), }, ERC1155VaultProxy: { @@ -471,7 +423,7 @@ async function generateContractConfigs( // OwnableUpgradeable _owner: contractOwner, // AddressResolver - _addressManager: addressMap.AddressManagerProxy, + addressManager: addressMap.AddressManagerProxy, }, slots: { [ADMIN_SLOT]: contractAdmin, @@ -497,10 +449,10 @@ async function generateContractConfigs( // OwnableUpgradeable _owner: contractOwner, // AddressResolver - _addressManager: addressMap.AddressManagerProxy, + addressManager: addressMap.AddressManagerProxy, // EtherVault // Authorize L2 bridge - _authorizedAddrs: { [`${addressMap.BridgeProxy}`]: true }, + isAuthorized: { [`${addressMap.BridgeProxy}`]: true }, }, slots: { [ADMIN_SLOT]: contractAdmin, @@ -512,7 +464,7 @@ async function generateContractConfigs( address: addressMap.ProxiedSignalService, deployedBytecode: linkContractLibs( contractArtifacts.ProxiedSignalService, - addressMap + addressMap, ), }, SignalServiceProxy: { @@ -528,7 +480,7 @@ async function generateContractConfigs( // OwnableUpgradeable _owner: contractOwner, // AddressResolver - _addressManager: addressMap.AddressManagerProxy, + addressManager: addressMap.AddressManagerProxy, }, slots: { [ADMIN_SLOT]: contractAdmin, @@ -547,8 +499,8 @@ function linkContractLibs(artifact: any, addressMap: any) { getLinkLibs( artifact, linker.findLinkReferences(artifact.deployedBytecode.object), - addressMap - ) + addressMap, + ), ); if (ethers.utils.toUtf8Bytes(linkedBytecode).includes("$__")) { @@ -569,11 +521,11 @@ function getLinkLibs(artifact: any, linkRefs: any, addressMap: any) { const linkRefKey: any = Object.keys(linkRefs).find( (key) => linkRefs[key][0].start === - linkReference[contractName][0].start + 1 + linkReference[contractName][0].start + 1, ); result[linkRefKey] = addressMap[contractName]; - } + }, ); return result; diff --git a/packages/relayer/ERC1155Vault.json b/packages/relayer/ERC1155Vault.json index bf5ab4ea8f2..2de11eda06d 100644 --- a/packages/relayer/ERC1155Vault.json +++ b/packages/relayer/ERC1155Vault.json @@ -6,7 +6,7 @@ }, { "inputs": [], - "name": "RESOLVER_INVALID_ADDR", + "name": "RESOLVER_INVALID_MANAGER", "type": "error" }, { @@ -80,19 +80,6 @@ "name": "VAULT_TOKEN_ARRAY_MISMATCH", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "addressManager", - "type": "address" - } - ], - "name": "AddressManagerChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -572,6 +559,11 @@ "internalType": "struct IBridge.Message", "name": "message", "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" } ], "name": "onMessageRecalled", @@ -767,19 +759,6 @@ "stateMutability": "payable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAddressManager", - "type": "address" - } - ], - "name": "setAddressManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { diff --git a/packages/relayer/ERC20Vault.json b/packages/relayer/ERC20Vault.json index 98ef72350f9..ab3080b0db1 100644 --- a/packages/relayer/ERC20Vault.json +++ b/packages/relayer/ERC20Vault.json @@ -6,7 +6,7 @@ }, { "inputs": [], - "name": "RESOLVER_INVALID_ADDR", + "name": "RESOLVER_INVALID_MANAGER", "type": "error" }, { @@ -65,19 +65,6 @@ "name": "VAULT_MESSAGE_RELEASED_ALREADY", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "addressManager", - "type": "address" - } - ], - "name": "AddressManagerChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -446,6 +433,11 @@ "internalType": "struct IBridge.Message", "name": "message", "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" } ], "name": "onMessageRecalled", @@ -636,19 +628,6 @@ "stateMutability": "payable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAddressManager", - "type": "address" - } - ], - "name": "setAddressManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { diff --git a/packages/relayer/ERC721Vault.json b/packages/relayer/ERC721Vault.json index 461abec1766..e914bc4a7ce 100644 --- a/packages/relayer/ERC721Vault.json +++ b/packages/relayer/ERC721Vault.json @@ -6,7 +6,7 @@ }, { "inputs": [], - "name": "RESOLVER_INVALID_ADDR", + "name": "RESOLVER_INVALID_MANAGER", "type": "error" }, { @@ -80,19 +80,6 @@ "name": "VAULT_TOKEN_ARRAY_MISMATCH", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "addressManager", - "type": "address" - } - ], - "name": "AddressManagerChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -528,6 +515,11 @@ "internalType": "struct IBridge.Message", "name": "message", "type": "tuple" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" } ], "name": "onMessageRecalled", @@ -718,19 +710,6 @@ "stateMutability": "payable", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAddressManager", - "type": "address" - } - ], - "name": "setAddressManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { diff --git a/packages/relayer/ICrossChainSync.json b/packages/relayer/ICrossChainSync.json index 24e1ce2372b..dd18064338b 100644 --- a/packages/relayer/ICrossChainSync.json +++ b/packages/relayer/ICrossChainSync.json @@ -32,31 +32,24 @@ "type": "uint64" } ], - "name": "getCrossChainBlockHash", + "name": "getSyncedSnippet", "outputs": [ { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "blockId", - "type": "uint64" - } - ], - "name": "getCrossChainSignalRoot", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" + "components": [ + { + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "signalRoot", + "type": "bytes32" + } + ], + "internalType": "struct ICrossChainSync.Snippet", + "name": "snippet", + "type": "tuple" } ], "stateMutability": "view", diff --git a/packages/relayer/TaikoL1.json b/packages/relayer/TaikoL1.json index 60f46b34c01..a9a6ee556f5 100644 --- a/packages/relayer/TaikoL1.json +++ b/packages/relayer/TaikoL1.json @@ -94,6 +94,11 @@ "name": "L1_INSUFFICIENT_TOKEN", "type": "error" }, + { + "inputs": [], + "name": "L1_INSUFFICIENT_TOKEN", + "type": "error" + }, { "inputs": [], "name": "L1_INVALID_ADDRESS", @@ -306,7 +311,7 @@ }, { "inputs": [], - "name": "RESOLVER_INVALID_ADDR", + "name": "RESOLVER_INVALID_MANAGER", "type": "error" }, { @@ -325,19 +330,6 @@ "name": "RESOLVER_ZERO_ADDR", "type": "error" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "addressManager", - "type": "address" - } - ], - "name": "AddressManagerChanged", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -365,12 +357,6 @@ "name": "proverFee", "type": "uint256" }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, { "indexed": false, "internalType": "uint16", @@ -483,12 +469,6 @@ "name": "proverFee", "type": "uint256" }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, { "indexed": false, "internalType": "uint16", @@ -1287,11 +1267,6 @@ "name": "chainId", "type": "uint256" }, - { - "internalType": "bool", - "name": "relaySignalRoot", - "type": "bool" - }, { "internalType": "uint64", "name": "blockMaxProposals", @@ -1312,26 +1287,11 @@ "name": "blockMaxGasLimit", "type": "uint32" }, - { - "internalType": "uint32", - "name": "blockFeeBaseGas", - "type": "uint32" - }, { "internalType": "uint24", "name": "blockMaxTxListBytes", "type": "uint24" }, - { - "internalType": "uint256", - "name": "proposerRewardPerSecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "proposerRewardMax", - "type": "uint256" - }, { "internalType": "uint96", "name": "livenessBond", @@ -1381,44 +1341,6 @@ "stateMutability": "pure", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "blockId", - "type": "uint64" - } - ], - "name": "getCrossChainBlockHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint64", - "name": "blockId", - "type": "uint64" - } - ], - "name": "getCrossChainSignalRoot", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1483,6 +1405,37 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "blockId", + "type": "uint64" + } + ], + "name": "getSyncedSnippet", + "outputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "blockHash", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "signalRoot", + "type": "bytes32" + } + ], + "internalType": "struct ICrossChainSync.Snippet", + "name": "data", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1538,6 +1491,11 @@ "internalType": "uint16", "name": "provingWindow", "type": "uint16" + }, + { + "internalType": "uint8", + "name": "maxBlocksToVerify", + "type": "uint8" } ], "internalType": "struct ITierProvider.Tier", @@ -1655,6 +1613,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "isConfigValid", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + }, { "inputs": [], "name": "owner", @@ -1867,19 +1838,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAddressManager", - "type": "address" - } - ], - "name": "setAddressManager", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "state", @@ -1937,6 +1895,23 @@ "internalType": "struct TaikoData.SlotB", "name": "slotB", "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint128", + "name": "accumulatedReward", + "type": "uint128" + }, + { + "internalType": "uint64", + "name": "lastProposedHeight", + "type": "uint64" + } + ], + "internalType": "struct TaikoData.SlotC", + "name": "slotC", + "type": "tuple" } ], "stateMutability": "view", @@ -1959,7 +1934,7 @@ "inputs": [ { "internalType": "uint64", - "name": "maxBlocks", + "name": "maxBlocksToVerify", "type": "uint64" } ], diff --git a/packages/relayer/bindings/bridge/Bridge.go b/packages/relayer/bindings/bridge/Bridge.go index 2313b34e13a..3802d78c7e0 100644 --- a/packages/relayer/bindings/bridge/Bridge.go +++ b/packages/relayer/bindings/bridge/Bridge.go @@ -54,7 +54,7 @@ type IBridgeMessage struct { // BridgeMetaData contains all meta data concerning the Bridge contract. var BridgeMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"B_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_ERC20_CANNOT_RECEIVE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_EV_DO_NOT_BURN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_EV_NOT_AUTHORIZED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_EV_PARAM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_FAILED_TRANSFER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_FORBIDDEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_FORBIDDEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_GAS_LIMIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_GAS_LIMIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INCORRECT_VALUE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INCORRECT_VALUE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INIT_PARAM_ERROR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_HASH_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_HASH_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_NON_RETRIABLE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_NON_RETRIABLE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_RECALLED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_MSG_RECALLED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_NULL_APP_ADDR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_SIGNAL_NOT_RECEIVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_SIGNAL_NOT_RECEIVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_STATUS_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_STATUS_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_USER_IS_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_USER_IS_NULL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_TO_ADDRESS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_WRONG_TO_ADDRESS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_ZERO_SIGNAL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"DestChainEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"MessageRecalled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"MessageRecalled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"MessageSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"MessageSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"enumLibBridgeStatus.MessageStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transactor\",\"type\":\"address\"}],\"name\":\"MessageStatusChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"enumLibBridgeStatus.MessageStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"transactor\",\"type\":\"address\"}],\"name\":\"MessageStatusChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"SignalSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"context\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"}],\"internalType\":\"structIBridge.Context\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"getMessageStatus\",\"outputs\":[{\"internalType\":\"enumLibBridgeStatus.MessageStatus\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"getMessageStatusSlot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"hashMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"isDestChainEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"isMessageFailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"isMessageRecalled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"isMessageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"isMessageSent\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"processMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"recallMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"isLastAttempt\",\"type\":\"bool\"}],\"name\":\"retryMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"sendMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + ABI: "[{\"inputs\":[],\"name\":\"B_INVALID_CHAINID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INVALID_CONTEXT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INVALID_GAS_LIMIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INVALID_SIGNAL\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INVALID_TO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INVALID_USER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_INVALID_VALUE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_NON_RETRIABLE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_NOT_RECEIVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_PERMISSION_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_RECALLED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"B_STATUS_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_MANAGER\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"}],\"name\":\"DestChainEnabled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"MessageRecalled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"indexed\":false,\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"MessageSent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"enumBridge.Status\",\"name\":\"status\",\"type\":\"uint8\"}],\"name\":\"MessageStatusChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"SignalSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"context\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"}],\"internalType\":\"structIBridge.Context\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"name\":\"isDestChainEnabled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"enabled\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"destBridge\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"isMessageRecalled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"recalled\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"isMessageSent\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"messageStatus\",\"outputs\":[{\"internalType\":\"enumBridge.Status\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextMessageId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"processMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"proveMessageFailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"proveMessageReceived\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\"}],\"name\":\"recallMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bool\",\"name\":\"isLastAttempt\",\"type\":\"bool\"}],\"name\":\"retryMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"sendMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"_message\",\"type\":\"tuple\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", } // BridgeABI is the input ABI used to generate the binding from. @@ -265,105 +265,88 @@ func (_Bridge *BridgeCallerSession) Context() (IBridgeContext, error) { return _Bridge.Contract.Context(&_Bridge.CallOpts) } -// GetMessageStatus is a free data retrieval call binding the contract method 0x5075a9d4. -// -// Solidity: function getMessageStatus(bytes32 msgHash) view returns(uint8) -func (_Bridge *BridgeCaller) GetMessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error) { - var out []interface{} - err := _Bridge.contract.Call(opts, &out, "getMessageStatus", msgHash) - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// GetMessageStatus is a free data retrieval call binding the contract method 0x5075a9d4. -// -// Solidity: function getMessageStatus(bytes32 msgHash) view returns(uint8) -func (_Bridge *BridgeSession) GetMessageStatus(msgHash [32]byte) (uint8, error) { - return _Bridge.Contract.GetMessageStatus(&_Bridge.CallOpts, msgHash) -} - -// GetMessageStatus is a free data retrieval call binding the contract method 0x5075a9d4. -// -// Solidity: function getMessageStatus(bytes32 msgHash) view returns(uint8) -func (_Bridge *BridgeCallerSession) GetMessageStatus(msgHash [32]byte) (uint8, error) { - return _Bridge.Contract.GetMessageStatus(&_Bridge.CallOpts, msgHash) -} - -// GetMessageStatusSlot is a free data retrieval call binding the contract method 0x606b5b74. +// IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. // -// Solidity: function getMessageStatusSlot(bytes32 msgHash) pure returns(bytes32) -func (_Bridge *BridgeCaller) GetMessageStatusSlot(opts *bind.CallOpts, msgHash [32]byte) ([32]byte, error) { +// Solidity: function isDestChainEnabled(uint256 chainId) view returns(bool enabled, address destBridge) +func (_Bridge *BridgeCaller) IsDestChainEnabled(opts *bind.CallOpts, chainId *big.Int) (struct { + Enabled bool + DestBridge common.Address +}, error) { var out []interface{} - err := _Bridge.contract.Call(opts, &out, "getMessageStatusSlot", msgHash) + err := _Bridge.contract.Call(opts, &out, "isDestChainEnabled", chainId) + outstruct := new(struct { + Enabled bool + DestBridge common.Address + }) if err != nil { - return *new([32]byte), err + return *outstruct, err } - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + outstruct.Enabled = *abi.ConvertType(out[0], new(bool)).(*bool) + outstruct.DestBridge = *abi.ConvertType(out[1], new(common.Address)).(*common.Address) - return out0, err + return *outstruct, err } -// GetMessageStatusSlot is a free data retrieval call binding the contract method 0x606b5b74. +// IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. // -// Solidity: function getMessageStatusSlot(bytes32 msgHash) pure returns(bytes32) -func (_Bridge *BridgeSession) GetMessageStatusSlot(msgHash [32]byte) ([32]byte, error) { - return _Bridge.Contract.GetMessageStatusSlot(&_Bridge.CallOpts, msgHash) +// Solidity: function isDestChainEnabled(uint256 chainId) view returns(bool enabled, address destBridge) +func (_Bridge *BridgeSession) IsDestChainEnabled(chainId *big.Int) (struct { + Enabled bool + DestBridge common.Address +}, error) { + return _Bridge.Contract.IsDestChainEnabled(&_Bridge.CallOpts, chainId) } -// GetMessageStatusSlot is a free data retrieval call binding the contract method 0x606b5b74. +// IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. // -// Solidity: function getMessageStatusSlot(bytes32 msgHash) pure returns(bytes32) -func (_Bridge *BridgeCallerSession) GetMessageStatusSlot(msgHash [32]byte) ([32]byte, error) { - return _Bridge.Contract.GetMessageStatusSlot(&_Bridge.CallOpts, msgHash) +// Solidity: function isDestChainEnabled(uint256 chainId) view returns(bool enabled, address destBridge) +func (_Bridge *BridgeCallerSession) IsDestChainEnabled(chainId *big.Int) (struct { + Enabled bool + DestBridge common.Address +}, error) { + return _Bridge.Contract.IsDestChainEnabled(&_Bridge.CallOpts, chainId) } -// HashMessage is a free data retrieval call binding the contract method 0x263463c8. +// IsMessageRecalled is a free data retrieval call binding the contract method 0x4f5f9772. // -// Solidity: function hashMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) pure returns(bytes32) -func (_Bridge *BridgeCaller) HashMessage(opts *bind.CallOpts, message IBridgeMessage) ([32]byte, error) { +// Solidity: function isMessageRecalled(bytes32 msgHash) view returns(bool recalled) +func (_Bridge *BridgeCaller) IsMessageRecalled(opts *bind.CallOpts, msgHash [32]byte) (bool, error) { var out []interface{} - err := _Bridge.contract.Call(opts, &out, "hashMessage", message) + err := _Bridge.contract.Call(opts, &out, "isMessageRecalled", msgHash) if err != nil { - return *new([32]byte), err + return *new(bool), err } - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) return out0, err } -// HashMessage is a free data retrieval call binding the contract method 0x263463c8. +// IsMessageRecalled is a free data retrieval call binding the contract method 0x4f5f9772. // -// Solidity: function hashMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) pure returns(bytes32) -func (_Bridge *BridgeSession) HashMessage(message IBridgeMessage) ([32]byte, error) { - return _Bridge.Contract.HashMessage(&_Bridge.CallOpts, message) +// Solidity: function isMessageRecalled(bytes32 msgHash) view returns(bool recalled) +func (_Bridge *BridgeSession) IsMessageRecalled(msgHash [32]byte) (bool, error) { + return _Bridge.Contract.IsMessageRecalled(&_Bridge.CallOpts, msgHash) } -// HashMessage is a free data retrieval call binding the contract method 0x263463c8. +// IsMessageRecalled is a free data retrieval call binding the contract method 0x4f5f9772. // -// Solidity: function hashMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) pure returns(bytes32) -func (_Bridge *BridgeCallerSession) HashMessage(message IBridgeMessage) ([32]byte, error) { - return _Bridge.Contract.HashMessage(&_Bridge.CallOpts, message) +// Solidity: function isMessageRecalled(bytes32 msgHash) view returns(bool recalled) +func (_Bridge *BridgeCallerSession) IsMessageRecalled(msgHash [32]byte) (bool, error) { + return _Bridge.Contract.IsMessageRecalled(&_Bridge.CallOpts, msgHash) } -// IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. +// IsMessageSent is a free data retrieval call binding the contract method 0xd6624194. // -// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool enabled) -func (_Bridge *BridgeCaller) IsDestChainEnabled(opts *bind.CallOpts, _chainId *big.Int) (bool, error) { +// Solidity: function isMessageSent((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) view returns(bool) +func (_Bridge *BridgeCaller) IsMessageSent(opts *bind.CallOpts, message IBridgeMessage) (bool, error) { var out []interface{} - err := _Bridge.contract.Call(opts, &out, "isDestChainEnabled", _chainId) + err := _Bridge.contract.Call(opts, &out, "isMessageSent", message) if err != nil { return *new(bool), err @@ -375,119 +358,119 @@ func (_Bridge *BridgeCaller) IsDestChainEnabled(opts *bind.CallOpts, _chainId *b } -// IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. +// IsMessageSent is a free data retrieval call binding the contract method 0xd6624194. // -// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool enabled) -func (_Bridge *BridgeSession) IsDestChainEnabled(_chainId *big.Int) (bool, error) { - return _Bridge.Contract.IsDestChainEnabled(&_Bridge.CallOpts, _chainId) +// Solidity: function isMessageSent((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) view returns(bool) +func (_Bridge *BridgeSession) IsMessageSent(message IBridgeMessage) (bool, error) { + return _Bridge.Contract.IsMessageSent(&_Bridge.CallOpts, message) } -// IsDestChainEnabled is a free data retrieval call binding the contract method 0x5d0bd986. +// IsMessageSent is a free data retrieval call binding the contract method 0xd6624194. // -// Solidity: function isDestChainEnabled(uint256 _chainId) view returns(bool enabled) -func (_Bridge *BridgeCallerSession) IsDestChainEnabled(_chainId *big.Int) (bool, error) { - return _Bridge.Contract.IsDestChainEnabled(&_Bridge.CallOpts, _chainId) +// Solidity: function isMessageSent((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) view returns(bool) +func (_Bridge *BridgeCallerSession) IsMessageSent(message IBridgeMessage) (bool, error) { + return _Bridge.Contract.IsMessageSent(&_Bridge.CallOpts, message) } -// IsMessageFailed is a free data retrieval call binding the contract method 0xce70f39b. +// MessageStatus is a free data retrieval call binding the contract method 0x3c6cf473. // -// Solidity: function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) view returns(bool) -func (_Bridge *BridgeCaller) IsMessageFailed(opts *bind.CallOpts, msgHash [32]byte, destChainId *big.Int, proof []byte) (bool, error) { +// Solidity: function messageStatus(bytes32 msgHash) view returns(uint8) +func (_Bridge *BridgeCaller) MessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error) { var out []interface{} - err := _Bridge.contract.Call(opts, &out, "isMessageFailed", msgHash, destChainId, proof) + err := _Bridge.contract.Call(opts, &out, "messageStatus", msgHash) if err != nil { - return *new(bool), err + return *new(uint8), err } - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) return out0, err } -// IsMessageFailed is a free data retrieval call binding the contract method 0xce70f39b. +// MessageStatus is a free data retrieval call binding the contract method 0x3c6cf473. // -// Solidity: function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) view returns(bool) -func (_Bridge *BridgeSession) IsMessageFailed(msgHash [32]byte, destChainId *big.Int, proof []byte) (bool, error) { - return _Bridge.Contract.IsMessageFailed(&_Bridge.CallOpts, msgHash, destChainId, proof) +// Solidity: function messageStatus(bytes32 msgHash) view returns(uint8) +func (_Bridge *BridgeSession) MessageStatus(msgHash [32]byte) (uint8, error) { + return _Bridge.Contract.MessageStatus(&_Bridge.CallOpts, msgHash) } -// IsMessageFailed is a free data retrieval call binding the contract method 0xce70f39b. +// MessageStatus is a free data retrieval call binding the contract method 0x3c6cf473. // -// Solidity: function isMessageFailed(bytes32 msgHash, uint256 destChainId, bytes proof) view returns(bool) -func (_Bridge *BridgeCallerSession) IsMessageFailed(msgHash [32]byte, destChainId *big.Int, proof []byte) (bool, error) { - return _Bridge.Contract.IsMessageFailed(&_Bridge.CallOpts, msgHash, destChainId, proof) +// Solidity: function messageStatus(bytes32 msgHash) view returns(uint8) +func (_Bridge *BridgeCallerSession) MessageStatus(msgHash [32]byte) (uint8, error) { + return _Bridge.Contract.MessageStatus(&_Bridge.CallOpts, msgHash) } -// IsMessageRecalled is a free data retrieval call binding the contract method 0x4f5f9772. +// NextMessageId is a free data retrieval call binding the contract method 0xeefbf17e. // -// Solidity: function isMessageRecalled(bytes32 msgHash) view returns(bool) -func (_Bridge *BridgeCaller) IsMessageRecalled(opts *bind.CallOpts, msgHash [32]byte) (bool, error) { +// Solidity: function nextMessageId() view returns(uint256) +func (_Bridge *BridgeCaller) NextMessageId(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _Bridge.contract.Call(opts, &out, "isMessageRecalled", msgHash) + err := _Bridge.contract.Call(opts, &out, "nextMessageId") if err != nil { - return *new(bool), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err } -// IsMessageRecalled is a free data retrieval call binding the contract method 0x4f5f9772. +// NextMessageId is a free data retrieval call binding the contract method 0xeefbf17e. // -// Solidity: function isMessageRecalled(bytes32 msgHash) view returns(bool) -func (_Bridge *BridgeSession) IsMessageRecalled(msgHash [32]byte) (bool, error) { - return _Bridge.Contract.IsMessageRecalled(&_Bridge.CallOpts, msgHash) +// Solidity: function nextMessageId() view returns(uint256) +func (_Bridge *BridgeSession) NextMessageId() (*big.Int, error) { + return _Bridge.Contract.NextMessageId(&_Bridge.CallOpts) } -// IsMessageRecalled is a free data retrieval call binding the contract method 0x4f5f9772. +// NextMessageId is a free data retrieval call binding the contract method 0xeefbf17e. // -// Solidity: function isMessageRecalled(bytes32 msgHash) view returns(bool) -func (_Bridge *BridgeCallerSession) IsMessageRecalled(msgHash [32]byte) (bool, error) { - return _Bridge.Contract.IsMessageRecalled(&_Bridge.CallOpts, msgHash) +// Solidity: function nextMessageId() view returns(uint256) +func (_Bridge *BridgeCallerSession) NextMessageId() (*big.Int, error) { + return _Bridge.Contract.NextMessageId(&_Bridge.CallOpts) } -// IsMessageReceived is a free data retrieval call binding the contract method 0xa4444efd. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) view returns(bool) -func (_Bridge *BridgeCaller) IsMessageReceived(opts *bind.CallOpts, msgHash [32]byte, srcChainId *big.Int, proof []byte) (bool, error) { +// Solidity: function owner() view returns(address) +func (_Bridge *BridgeCaller) Owner(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _Bridge.contract.Call(opts, &out, "isMessageReceived", msgHash, srcChainId, proof) + err := _Bridge.contract.Call(opts, &out, "owner") if err != nil { - return *new(bool), err + return *new(common.Address), err } - out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) return out0, err } -// IsMessageReceived is a free data retrieval call binding the contract method 0xa4444efd. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) view returns(bool) -func (_Bridge *BridgeSession) IsMessageReceived(msgHash [32]byte, srcChainId *big.Int, proof []byte) (bool, error) { - return _Bridge.Contract.IsMessageReceived(&_Bridge.CallOpts, msgHash, srcChainId, proof) +// Solidity: function owner() view returns(address) +func (_Bridge *BridgeSession) Owner() (common.Address, error) { + return _Bridge.Contract.Owner(&_Bridge.CallOpts) } -// IsMessageReceived is a free data retrieval call binding the contract method 0xa4444efd. +// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // -// Solidity: function isMessageReceived(bytes32 msgHash, uint256 srcChainId, bytes proof) view returns(bool) -func (_Bridge *BridgeCallerSession) IsMessageReceived(msgHash [32]byte, srcChainId *big.Int, proof []byte) (bool, error) { - return _Bridge.Contract.IsMessageReceived(&_Bridge.CallOpts, msgHash, srcChainId, proof) +// Solidity: function owner() view returns(address) +func (_Bridge *BridgeCallerSession) Owner() (common.Address, error) { + return _Bridge.Contract.Owner(&_Bridge.CallOpts) } -// IsMessageSent is a free data retrieval call binding the contract method 0x540be6a3. +// ProveMessageFailed is a free data retrieval call binding the contract method 0x6b778a9e. // -// Solidity: function isMessageSent(bytes32 msgHash) view returns(bool) -func (_Bridge *BridgeCaller) IsMessageSent(opts *bind.CallOpts, msgHash [32]byte) (bool, error) { +// Solidity: function proveMessageFailed((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes proof) view returns(bool) +func (_Bridge *BridgeCaller) ProveMessageFailed(opts *bind.CallOpts, message IBridgeMessage, proof []byte) (bool, error) { var out []interface{} - err := _Bridge.contract.Call(opts, &out, "isMessageSent", msgHash) + err := _Bridge.contract.Call(opts, &out, "proveMessageFailed", message, proof) if err != nil { return *new(bool), err @@ -499,49 +482,49 @@ func (_Bridge *BridgeCaller) IsMessageSent(opts *bind.CallOpts, msgHash [32]byte } -// IsMessageSent is a free data retrieval call binding the contract method 0x540be6a3. +// ProveMessageFailed is a free data retrieval call binding the contract method 0x6b778a9e. // -// Solidity: function isMessageSent(bytes32 msgHash) view returns(bool) -func (_Bridge *BridgeSession) IsMessageSent(msgHash [32]byte) (bool, error) { - return _Bridge.Contract.IsMessageSent(&_Bridge.CallOpts, msgHash) +// Solidity: function proveMessageFailed((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes proof) view returns(bool) +func (_Bridge *BridgeSession) ProveMessageFailed(message IBridgeMessage, proof []byte) (bool, error) { + return _Bridge.Contract.ProveMessageFailed(&_Bridge.CallOpts, message, proof) } -// IsMessageSent is a free data retrieval call binding the contract method 0x540be6a3. +// ProveMessageFailed is a free data retrieval call binding the contract method 0x6b778a9e. // -// Solidity: function isMessageSent(bytes32 msgHash) view returns(bool) -func (_Bridge *BridgeCallerSession) IsMessageSent(msgHash [32]byte) (bool, error) { - return _Bridge.Contract.IsMessageSent(&_Bridge.CallOpts, msgHash) +// Solidity: function proveMessageFailed((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes proof) view returns(bool) +func (_Bridge *BridgeCallerSession) ProveMessageFailed(message IBridgeMessage, proof []byte) (bool, error) { + return _Bridge.Contract.ProveMessageFailed(&_Bridge.CallOpts, message, proof) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// ProveMessageReceived is a free data retrieval call binding the contract method 0x9494caf7. // -// Solidity: function owner() view returns(address) -func (_Bridge *BridgeCaller) Owner(opts *bind.CallOpts) (common.Address, error) { +// Solidity: function proveMessageReceived((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes proof) view returns(bool) +func (_Bridge *BridgeCaller) ProveMessageReceived(opts *bind.CallOpts, message IBridgeMessage, proof []byte) (bool, error) { var out []interface{} - err := _Bridge.contract.Call(opts, &out, "owner") + err := _Bridge.contract.Call(opts, &out, "proveMessageReceived", message, proof) if err != nil { - return *new(common.Address), err + return *new(bool), err } - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) return out0, err } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// ProveMessageReceived is a free data retrieval call binding the contract method 0x9494caf7. // -// Solidity: function owner() view returns(address) -func (_Bridge *BridgeSession) Owner() (common.Address, error) { - return _Bridge.Contract.Owner(&_Bridge.CallOpts) +// Solidity: function proveMessageReceived((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes proof) view returns(bool) +func (_Bridge *BridgeSession) ProveMessageReceived(message IBridgeMessage, proof []byte) (bool, error) { + return _Bridge.Contract.ProveMessageReceived(&_Bridge.CallOpts, message, proof) } -// Owner is a free data retrieval call binding the contract method 0x8da5cb5b. +// ProveMessageReceived is a free data retrieval call binding the contract method 0x9494caf7. // -// Solidity: function owner() view returns(address) -func (_Bridge *BridgeCallerSession) Owner() (common.Address, error) { - return _Bridge.Contract.Owner(&_Bridge.CallOpts) +// Solidity: function proveMessageReceived((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes proof) view returns(bool) +func (_Bridge *BridgeCallerSession) ProveMessageReceived(message IBridgeMessage, proof []byte) (bool, error) { + return _Bridge.Contract.ProveMessageReceived(&_Bridge.CallOpts, message, proof) } // Resolve is a free data retrieval call binding the contract method 0x6c6563f6. @@ -713,46 +696,25 @@ func (_Bridge *BridgeTransactorSession) RetryMessage(message IBridgeMessage, isL // SendMessage is a paid mutator transaction binding the contract method 0x4c1888bc. // -// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash) +// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) _message) func (_Bridge *BridgeTransactor) SendMessage(opts *bind.TransactOpts, message IBridgeMessage) (*types.Transaction, error) { return _Bridge.contract.Transact(opts, "sendMessage", message) } // SendMessage is a paid mutator transaction binding the contract method 0x4c1888bc. // -// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash) +// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) _message) func (_Bridge *BridgeSession) SendMessage(message IBridgeMessage) (*types.Transaction, error) { return _Bridge.Contract.SendMessage(&_Bridge.TransactOpts, message) } // SendMessage is a paid mutator transaction binding the contract method 0x4c1888bc. // -// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash) +// Solidity: function sendMessage((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns(bytes32 msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) _message) func (_Bridge *BridgeTransactorSession) SendMessage(message IBridgeMessage) (*types.Transaction, error) { return _Bridge.Contract.SendMessage(&_Bridge.TransactOpts, message) } -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_Bridge *BridgeTransactor) SetAddressManager(opts *bind.TransactOpts, newAddressManager common.Address) (*types.Transaction, error) { - return _Bridge.contract.Transact(opts, "setAddressManager", newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_Bridge *BridgeSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _Bridge.Contract.SetAddressManager(&_Bridge.TransactOpts, newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_Bridge *BridgeTransactorSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _Bridge.Contract.SetAddressManager(&_Bridge.TransactOpts, newAddressManager) -} - // TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() @@ -795,150 +757,6 @@ func (_Bridge *BridgeTransactorSession) Receive() (*types.Transaction, error) { return _Bridge.Contract.Receive(&_Bridge.TransactOpts) } -// BridgeAddressManagerChangedIterator is returned from FilterAddressManagerChanged and is used to iterate over the raw logs and unpacked data for AddressManagerChanged events raised by the Bridge contract. -type BridgeAddressManagerChangedIterator struct { - Event *BridgeAddressManagerChanged // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *BridgeAddressManagerChangedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(BridgeAddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(BridgeAddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *BridgeAddressManagerChangedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *BridgeAddressManagerChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// BridgeAddressManagerChanged represents a AddressManagerChanged event raised by the Bridge contract. -type BridgeAddressManagerChanged struct { - AddressManager common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAddressManagerChanged is a free log retrieval operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_Bridge *BridgeFilterer) FilterAddressManagerChanged(opts *bind.FilterOpts, addressManager []common.Address) (*BridgeAddressManagerChangedIterator, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _Bridge.contract.FilterLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return &BridgeAddressManagerChangedIterator{contract: _Bridge.contract, event: "AddressManagerChanged", logs: logs, sub: sub}, nil -} - -// WatchAddressManagerChanged is a free log subscription operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_Bridge *BridgeFilterer) WatchAddressManagerChanged(opts *bind.WatchOpts, sink chan<- *BridgeAddressManagerChanged, addressManager []common.Address) (event.Subscription, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _Bridge.contract.WatchLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(BridgeAddressManagerChanged) - if err := _Bridge.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseAddressManagerChanged is a log parse operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_Bridge *BridgeFilterer) ParseAddressManagerChanged(log types.Log) (*BridgeAddressManagerChanged, error) { - event := new(BridgeAddressManagerChanged) - if err := _Bridge.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // BridgeDestChainEnabledIterator is returned from FilterDestChainEnabled and is used to iterate over the raw logs and unpacked data for DestChainEnabled events raised by the Bridge contract. type BridgeDestChainEnabledIterator struct { Event *BridgeDestChainEnabled // Event containing the contract specifics and raw log @@ -1362,9 +1180,9 @@ func (_Bridge *BridgeFilterer) ParseMessageRecalled(log types.Log) (*BridgeMessa return event, nil } -// BridgeMessageRecalled0Iterator is returned from FilterMessageRecalled0 and is used to iterate over the raw logs and unpacked data for MessageRecalled0 events raised by the Bridge contract. -type BridgeMessageRecalled0Iterator struct { - Event *BridgeMessageRecalled0 // Event containing the contract specifics and raw log +// BridgeMessageSentIterator is returned from FilterMessageSent and is used to iterate over the raw logs and unpacked data for MessageSent events raised by the Bridge contract. +type BridgeMessageSentIterator struct { + Event *BridgeMessageSent // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1378,7 +1196,7 @@ type BridgeMessageRecalled0Iterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *BridgeMessageRecalled0Iterator) Next() bool { +func (it *BridgeMessageSentIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1387,7 +1205,7 @@ func (it *BridgeMessageRecalled0Iterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(BridgeMessageRecalled0) + it.Event = new(BridgeMessageSent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1402,7 +1220,7 @@ func (it *BridgeMessageRecalled0Iterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(BridgeMessageRecalled0) + it.Event = new(BridgeMessageSent) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1418,51 +1236,52 @@ func (it *BridgeMessageRecalled0Iterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *BridgeMessageRecalled0Iterator) Error() error { +func (it *BridgeMessageSentIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *BridgeMessageRecalled0Iterator) Close() error { +func (it *BridgeMessageSentIterator) Close() error { it.sub.Unsubscribe() return nil } -// BridgeMessageRecalled0 represents a MessageRecalled0 event raised by the Bridge contract. -type BridgeMessageRecalled0 struct { +// BridgeMessageSent represents a MessageSent event raised by the Bridge contract. +type BridgeMessageSent struct { MsgHash [32]byte + Message IBridgeMessage Raw types.Log // Blockchain specific contextual infos } -// FilterMessageRecalled0 is a free log retrieval operation binding the contract event 0xc6fbc1fa0145a394c9c414b2ae7bd634eb50dd888938bcd75692ae427b680fa2. +// FilterMessageSent is a free log retrieval operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. // -// Solidity: event MessageRecalled(bytes32 indexed msgHash) -func (_Bridge *BridgeFilterer) FilterMessageRecalled0(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageRecalled0Iterator, error) { +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) FilterMessageSent(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageSentIterator, error) { var msgHashRule []interface{} for _, msgHashItem := range msgHash { msgHashRule = append(msgHashRule, msgHashItem) } - logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageRecalled0", msgHashRule) + logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageSent", msgHashRule) if err != nil { return nil, err } - return &BridgeMessageRecalled0Iterator{contract: _Bridge.contract, event: "MessageRecalled0", logs: logs, sub: sub}, nil + return &BridgeMessageSentIterator{contract: _Bridge.contract, event: "MessageSent", logs: logs, sub: sub}, nil } -// WatchMessageRecalled0 is a free log subscription operation binding the contract event 0xc6fbc1fa0145a394c9c414b2ae7bd634eb50dd888938bcd75692ae427b680fa2. +// WatchMessageSent is a free log subscription operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. // -// Solidity: event MessageRecalled(bytes32 indexed msgHash) -func (_Bridge *BridgeFilterer) WatchMessageRecalled0(opts *bind.WatchOpts, sink chan<- *BridgeMessageRecalled0, msgHash [][32]byte) (event.Subscription, error) { +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) WatchMessageSent(opts *bind.WatchOpts, sink chan<- *BridgeMessageSent, msgHash [][32]byte) (event.Subscription, error) { var msgHashRule []interface{} for _, msgHashItem := range msgHash { msgHashRule = append(msgHashRule, msgHashItem) } - logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageRecalled0", msgHashRule) + logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageSent", msgHashRule) if err != nil { return nil, err } @@ -1472,8 +1291,8 @@ func (_Bridge *BridgeFilterer) WatchMessageRecalled0(opts *bind.WatchOpts, sink select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(BridgeMessageRecalled0) - if err := _Bridge.contract.UnpackLog(event, "MessageRecalled0", log); err != nil { + event := new(BridgeMessageSent) + if err := _Bridge.contract.UnpackLog(event, "MessageSent", log); err != nil { return err } event.Raw = log @@ -1494,21 +1313,21 @@ func (_Bridge *BridgeFilterer) WatchMessageRecalled0(opts *bind.WatchOpts, sink }), nil } -// ParseMessageRecalled0 is a log parse operation binding the contract event 0xc6fbc1fa0145a394c9c414b2ae7bd634eb50dd888938bcd75692ae427b680fa2. +// ParseMessageSent is a log parse operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. // -// Solidity: event MessageRecalled(bytes32 indexed msgHash) -func (_Bridge *BridgeFilterer) ParseMessageRecalled0(log types.Log) (*BridgeMessageRecalled0, error) { - event := new(BridgeMessageRecalled0) - if err := _Bridge.contract.UnpackLog(event, "MessageRecalled0", log); err != nil { +// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) +func (_Bridge *BridgeFilterer) ParseMessageSent(log types.Log) (*BridgeMessageSent, error) { + event := new(BridgeMessageSent) + if err := _Bridge.contract.UnpackLog(event, "MessageSent", log); err != nil { return nil, err } event.Raw = log return event, nil } -// BridgeMessageSentIterator is returned from FilterMessageSent and is used to iterate over the raw logs and unpacked data for MessageSent events raised by the Bridge contract. -type BridgeMessageSentIterator struct { - Event *BridgeMessageSent // Event containing the contract specifics and raw log +// BridgeMessageStatusChangedIterator is returned from FilterMessageStatusChanged and is used to iterate over the raw logs and unpacked data for MessageStatusChanged events raised by the Bridge contract. +type BridgeMessageStatusChangedIterator struct { + Event *BridgeMessageStatusChanged // Event containing the contract specifics and raw log contract *bind.BoundContract // Generic contract to use for unpacking event data event string // Event name to use for unpacking event data @@ -1522,7 +1341,7 @@ type BridgeMessageSentIterator struct { // Next advances the iterator to the subsequent event, returning whether there // are any more events found. In case of a retrieval or parsing error, false is // returned and Error() can be queried for the exact failure. -func (it *BridgeMessageSentIterator) Next() bool { +func (it *BridgeMessageStatusChangedIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1531,7 +1350,7 @@ func (it *BridgeMessageSentIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(BridgeMessageSent) + it.Event = new(BridgeMessageStatusChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1546,7 +1365,7 @@ func (it *BridgeMessageSentIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(BridgeMessageSent) + it.Event = new(BridgeMessageStatusChanged) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1562,318 +1381,27 @@ func (it *BridgeMessageSentIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *BridgeMessageSentIterator) Error() error { +func (it *BridgeMessageStatusChangedIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *BridgeMessageSentIterator) Close() error { +func (it *BridgeMessageStatusChangedIterator) Close() error { it.sub.Unsubscribe() return nil } -// BridgeMessageSent represents a MessageSent event raised by the Bridge contract. -type BridgeMessageSent struct { +// BridgeMessageStatusChanged represents a MessageStatusChanged event raised by the Bridge contract. +type BridgeMessageStatusChanged struct { MsgHash [32]byte - Message IBridgeMessage + Status uint8 Raw types.Log // Blockchain specific contextual infos } -// FilterMessageSent is a free log retrieval operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. +// FilterMessageStatusChanged is a free log retrieval operation binding the contract event 0x6c51882bc2ed67617f77a1e9b9a25d2caad8448647ecb093b357a603b2575634. // -// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) -func (_Bridge *BridgeFilterer) FilterMessageSent(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageSentIterator, error) { - - var msgHashRule []interface{} - for _, msgHashItem := range msgHash { - msgHashRule = append(msgHashRule, msgHashItem) - } - - logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageSent", msgHashRule) - if err != nil { - return nil, err - } - return &BridgeMessageSentIterator{contract: _Bridge.contract, event: "MessageSent", logs: logs, sub: sub}, nil -} - -// WatchMessageSent is a free log subscription operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. -// -// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) -func (_Bridge *BridgeFilterer) WatchMessageSent(opts *bind.WatchOpts, sink chan<- *BridgeMessageSent, msgHash [][32]byte) (event.Subscription, error) { - - var msgHashRule []interface{} - for _, msgHashItem := range msgHash { - msgHashRule = append(msgHashRule, msgHashItem) - } - - logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageSent", msgHashRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(BridgeMessageSent) - if err := _Bridge.contract.UnpackLog(event, "MessageSent", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMessageSent is a log parse operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. -// -// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) -func (_Bridge *BridgeFilterer) ParseMessageSent(log types.Log) (*BridgeMessageSent, error) { - event := new(BridgeMessageSent) - if err := _Bridge.contract.UnpackLog(event, "MessageSent", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// BridgeMessageSent0Iterator is returned from FilterMessageSent0 and is used to iterate over the raw logs and unpacked data for MessageSent0 events raised by the Bridge contract. -type BridgeMessageSent0Iterator struct { - Event *BridgeMessageSent0 // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *BridgeMessageSent0Iterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(BridgeMessageSent0) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(BridgeMessageSent0) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *BridgeMessageSent0Iterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *BridgeMessageSent0Iterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// BridgeMessageSent0 represents a MessageSent0 event raised by the Bridge contract. -type BridgeMessageSent0 struct { - MsgHash [32]byte - Message IBridgeMessage - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMessageSent0 is a free log retrieval operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. -// -// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) -func (_Bridge *BridgeFilterer) FilterMessageSent0(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageSent0Iterator, error) { - - var msgHashRule []interface{} - for _, msgHashItem := range msgHash { - msgHashRule = append(msgHashRule, msgHashItem) - } - - logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageSent0", msgHashRule) - if err != nil { - return nil, err - } - return &BridgeMessageSent0Iterator{contract: _Bridge.contract, event: "MessageSent0", logs: logs, sub: sub}, nil -} - -// WatchMessageSent0 is a free log subscription operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. -// -// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) -func (_Bridge *BridgeFilterer) WatchMessageSent0(opts *bind.WatchOpts, sink chan<- *BridgeMessageSent0, msgHash [][32]byte) (event.Subscription, error) { - - var msgHashRule []interface{} - for _, msgHashItem := range msgHash { - msgHashRule = append(msgHashRule, msgHashItem) - } - - logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageSent0", msgHashRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(BridgeMessageSent0) - if err := _Bridge.contract.UnpackLog(event, "MessageSent0", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMessageSent0 is a log parse operation binding the contract event 0x238646a410b383b664b8d2fe57d2895c1ecd3464a3159cae73a93a9f21a43355. -// -// Solidity: event MessageSent(bytes32 indexed msgHash, (uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) -func (_Bridge *BridgeFilterer) ParseMessageSent0(log types.Log) (*BridgeMessageSent0, error) { - event := new(BridgeMessageSent0) - if err := _Bridge.contract.UnpackLog(event, "MessageSent0", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// BridgeMessageStatusChangedIterator is returned from FilterMessageStatusChanged and is used to iterate over the raw logs and unpacked data for MessageStatusChanged events raised by the Bridge contract. -type BridgeMessageStatusChangedIterator struct { - Event *BridgeMessageStatusChanged // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *BridgeMessageStatusChangedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(BridgeMessageStatusChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(BridgeMessageStatusChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *BridgeMessageStatusChangedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *BridgeMessageStatusChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// BridgeMessageStatusChanged represents a MessageStatusChanged event raised by the Bridge contract. -type BridgeMessageStatusChanged struct { - MsgHash [32]byte - Status uint8 - Transactor common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMessageStatusChanged is a free log retrieval operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. -// -// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status) func (_Bridge *BridgeFilterer) FilterMessageStatusChanged(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageStatusChangedIterator, error) { var msgHashRule []interface{} @@ -1888,9 +1416,9 @@ func (_Bridge *BridgeFilterer) FilterMessageStatusChanged(opts *bind.FilterOpts, return &BridgeMessageStatusChangedIterator{contract: _Bridge.contract, event: "MessageStatusChanged", logs: logs, sub: sub}, nil } -// WatchMessageStatusChanged is a free log subscription operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. +// WatchMessageStatusChanged is a free log subscription operation binding the contract event 0x6c51882bc2ed67617f77a1e9b9a25d2caad8448647ecb093b357a603b2575634. // -// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status) func (_Bridge *BridgeFilterer) WatchMessageStatusChanged(opts *bind.WatchOpts, sink chan<- *BridgeMessageStatusChanged, msgHash [][32]byte) (event.Subscription, error) { var msgHashRule []interface{} @@ -1930,9 +1458,9 @@ func (_Bridge *BridgeFilterer) WatchMessageStatusChanged(opts *bind.WatchOpts, s }), nil } -// ParseMessageStatusChanged is a log parse operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. +// ParseMessageStatusChanged is a log parse operation binding the contract event 0x6c51882bc2ed67617f77a1e9b9a25d2caad8448647ecb093b357a603b2575634. // -// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) +// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status) func (_Bridge *BridgeFilterer) ParseMessageStatusChanged(log types.Log) (*BridgeMessageStatusChanged, error) { event := new(BridgeMessageStatusChanged) if err := _Bridge.contract.UnpackLog(event, "MessageStatusChanged", log); err != nil { @@ -1942,152 +1470,6 @@ func (_Bridge *BridgeFilterer) ParseMessageStatusChanged(log types.Log) (*Bridge return event, nil } -// BridgeMessageStatusChanged0Iterator is returned from FilterMessageStatusChanged0 and is used to iterate over the raw logs and unpacked data for MessageStatusChanged0 events raised by the Bridge contract. -type BridgeMessageStatusChanged0Iterator struct { - Event *BridgeMessageStatusChanged0 // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *BridgeMessageStatusChanged0Iterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(BridgeMessageStatusChanged0) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(BridgeMessageStatusChanged0) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *BridgeMessageStatusChanged0Iterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *BridgeMessageStatusChanged0Iterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// BridgeMessageStatusChanged0 represents a MessageStatusChanged0 event raised by the Bridge contract. -type BridgeMessageStatusChanged0 struct { - MsgHash [32]byte - Status uint8 - Transactor common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMessageStatusChanged0 is a free log retrieval operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. -// -// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) -func (_Bridge *BridgeFilterer) FilterMessageStatusChanged0(opts *bind.FilterOpts, msgHash [][32]byte) (*BridgeMessageStatusChanged0Iterator, error) { - - var msgHashRule []interface{} - for _, msgHashItem := range msgHash { - msgHashRule = append(msgHashRule, msgHashItem) - } - - logs, sub, err := _Bridge.contract.FilterLogs(opts, "MessageStatusChanged0", msgHashRule) - if err != nil { - return nil, err - } - return &BridgeMessageStatusChanged0Iterator{contract: _Bridge.contract, event: "MessageStatusChanged0", logs: logs, sub: sub}, nil -} - -// WatchMessageStatusChanged0 is a free log subscription operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. -// -// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) -func (_Bridge *BridgeFilterer) WatchMessageStatusChanged0(opts *bind.WatchOpts, sink chan<- *BridgeMessageStatusChanged0, msgHash [][32]byte) (event.Subscription, error) { - - var msgHashRule []interface{} - for _, msgHashItem := range msgHash { - msgHashRule = append(msgHashRule, msgHashItem) - } - - logs, sub, err := _Bridge.contract.WatchLogs(opts, "MessageStatusChanged0", msgHashRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(BridgeMessageStatusChanged0) - if err := _Bridge.contract.UnpackLog(event, "MessageStatusChanged0", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMessageStatusChanged0 is a log parse operation binding the contract event 0x0af4d5247f6a4028d6699afb62871a76b398da1d1a626c8a9b90e0bd5f54c73c. -// -// Solidity: event MessageStatusChanged(bytes32 indexed msgHash, uint8 status, address transactor) -func (_Bridge *BridgeFilterer) ParseMessageStatusChanged0(log types.Log) (*BridgeMessageStatusChanged0, error) { - event := new(BridgeMessageStatusChanged0) - if err := _Bridge.contract.UnpackLog(event, "MessageStatusChanged0", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // BridgeOwnershipTransferredIterator is returned from FilterOwnershipTransferred and is used to iterate over the raw logs and unpacked data for OwnershipTransferred events raised by the Bridge contract. type BridgeOwnershipTransferredIterator struct { Event *BridgeOwnershipTransferred // Event containing the contract specifics and raw log diff --git a/packages/relayer/bindings/erc1155vault/ERC1155Vault.go b/packages/relayer/bindings/erc1155vault/ERC1155Vault.go index 4e45d122a78..8d24460057f 100644 --- a/packages/relayer/bindings/erc1155vault/ERC1155Vault.go +++ b/packages/relayer/bindings/erc1155vault/ERC1155Vault.go @@ -68,7 +68,7 @@ type IBridgeMessage struct { // ERC1155VaultMetaData contains all meta data concerning the ERC1155Vault contract. var ERC1155VaultMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INTERFACE_NOT_SUPPORTED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_AMOUNT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_FROM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_SRC_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_USER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MAX_TOKEN_PER_TXN_EXCEEDED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_RELEASED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_TOKEN_ARRAY_MISMATCH\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"ctoken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"btoken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenSymbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenName\",\"type\":\"string\"}],\"name\":\"BridgedTokenDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ERC1155_INTERFACE_ID\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC721_INTERFACE_ID\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedToCanonical\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canonicalToBridged\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isBridgedToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"onMessageRecalled\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structBaseNFTVault.CanonicalNFT\",\"name\":\"ctoken\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"receiveToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structBaseNFTVault.BridgeTransferOp\",\"name\":\"opt\",\"type\":\"tuple\"}],\"name\":\"sendToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_MANAGER\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INTERFACE_NOT_SUPPORTED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_AMOUNT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_FROM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_SRC_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_USER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MAX_TOKEN_PER_TXN_EXCEEDED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_RELEASED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_TOKEN_ARRAY_MISMATCH\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"ctoken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"btoken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenSymbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenName\",\"type\":\"string\"}],\"name\":\"BridgedTokenDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ERC1155_INTERFACE_ID\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC721_INTERFACE_ID\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedToCanonical\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canonicalToBridged\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isBridgedToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155BatchReceived\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC1155Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"onMessageRecalled\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structBaseNFTVault.CanonicalNFT\",\"name\":\"ctoken\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"receiveToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structBaseNFTVault.BridgeTransferOp\",\"name\":\"opt\",\"type\":\"tuple\"}],\"name\":\"sendToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC1155VaultABI is the input ABI used to generate the binding from. @@ -634,25 +634,25 @@ func (_ERC1155Vault *ERC1155VaultTransactorSession) Init(addressManager common.A return _ERC1155Vault.Contract.Init(&_ERC1155Vault.TransactOpts, addressManager) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC1155Vault *ERC1155VaultTransactor) OnMessageRecalled(opts *bind.TransactOpts, message IBridgeMessage) (*types.Transaction, error) { - return _ERC1155Vault.contract.Transact(opts, "onMessageRecalled", message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC1155Vault *ERC1155VaultTransactor) OnMessageRecalled(opts *bind.TransactOpts, message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC1155Vault.contract.Transact(opts, "onMessageRecalled", message, msgHash) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC1155Vault *ERC1155VaultSession) OnMessageRecalled(message IBridgeMessage) (*types.Transaction, error) { - return _ERC1155Vault.Contract.OnMessageRecalled(&_ERC1155Vault.TransactOpts, message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC1155Vault *ERC1155VaultSession) OnMessageRecalled(message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC1155Vault.Contract.OnMessageRecalled(&_ERC1155Vault.TransactOpts, message, msgHash) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC1155Vault *ERC1155VaultTransactorSession) OnMessageRecalled(message IBridgeMessage) (*types.Transaction, error) { - return _ERC1155Vault.Contract.OnMessageRecalled(&_ERC1155Vault.TransactOpts, message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC1155Vault *ERC1155VaultTransactorSession) OnMessageRecalled(message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC1155Vault.Contract.OnMessageRecalled(&_ERC1155Vault.TransactOpts, message, msgHash) } // ReceiveToken is a paid mutator transaction binding the contract method 0x20b81559. @@ -718,27 +718,6 @@ func (_ERC1155Vault *ERC1155VaultTransactorSession) SendToken(opt BaseNFTVaultBr return _ERC1155Vault.Contract.SendToken(&_ERC1155Vault.TransactOpts, opt) } -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC1155Vault *ERC1155VaultTransactor) SetAddressManager(opts *bind.TransactOpts, newAddressManager common.Address) (*types.Transaction, error) { - return _ERC1155Vault.contract.Transact(opts, "setAddressManager", newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC1155Vault *ERC1155VaultSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _ERC1155Vault.Contract.SetAddressManager(&_ERC1155Vault.TransactOpts, newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC1155Vault *ERC1155VaultTransactorSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _ERC1155Vault.Contract.SetAddressManager(&_ERC1155Vault.TransactOpts, newAddressManager) -} - // TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() @@ -760,150 +739,6 @@ func (_ERC1155Vault *ERC1155VaultTransactorSession) TransferOwnership(newOwner c return _ERC1155Vault.Contract.TransferOwnership(&_ERC1155Vault.TransactOpts, newOwner) } -// ERC1155VaultAddressManagerChangedIterator is returned from FilterAddressManagerChanged and is used to iterate over the raw logs and unpacked data for AddressManagerChanged events raised by the ERC1155Vault contract. -type ERC1155VaultAddressManagerChangedIterator struct { - Event *ERC1155VaultAddressManagerChanged // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ERC1155VaultAddressManagerChangedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ERC1155VaultAddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ERC1155VaultAddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ERC1155VaultAddressManagerChangedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ERC1155VaultAddressManagerChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ERC1155VaultAddressManagerChanged represents a AddressManagerChanged event raised by the ERC1155Vault contract. -type ERC1155VaultAddressManagerChanged struct { - AddressManager common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAddressManagerChanged is a free log retrieval operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC1155Vault *ERC1155VaultFilterer) FilterAddressManagerChanged(opts *bind.FilterOpts, addressManager []common.Address) (*ERC1155VaultAddressManagerChangedIterator, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _ERC1155Vault.contract.FilterLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return &ERC1155VaultAddressManagerChangedIterator{contract: _ERC1155Vault.contract, event: "AddressManagerChanged", logs: logs, sub: sub}, nil -} - -// WatchAddressManagerChanged is a free log subscription operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC1155Vault *ERC1155VaultFilterer) WatchAddressManagerChanged(opts *bind.WatchOpts, sink chan<- *ERC1155VaultAddressManagerChanged, addressManager []common.Address) (event.Subscription, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _ERC1155Vault.contract.WatchLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ERC1155VaultAddressManagerChanged) - if err := _ERC1155Vault.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseAddressManagerChanged is a log parse operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC1155Vault *ERC1155VaultFilterer) ParseAddressManagerChanged(log types.Log) (*ERC1155VaultAddressManagerChanged, error) { - event := new(ERC1155VaultAddressManagerChanged) - if err := _ERC1155Vault.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // ERC1155VaultBridgedTokenDeployedIterator is returned from FilterBridgedTokenDeployed and is used to iterate over the raw logs and unpacked data for BridgedTokenDeployed events raised by the ERC1155Vault contract. type ERC1155VaultBridgedTokenDeployedIterator struct { Event *ERC1155VaultBridgedTokenDeployed // Event containing the contract specifics and raw log diff --git a/packages/relayer/bindings/erc20vault/ERC20Vault.go b/packages/relayer/bindings/erc20vault/ERC20Vault.go index e59a8868c1b..9dfc0508216 100644 --- a/packages/relayer/bindings/erc20vault/ERC20Vault.go +++ b/packages/relayer/bindings/erc20vault/ERC20Vault.go @@ -68,7 +68,7 @@ type IBridgeMessage struct { // ERC20VaultMetaData contains all meta data concerning the ERC20Vault contract. var ERC20VaultMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_AMOUNT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_FROM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_SRC_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_USER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_RELEASED_ALREADY\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"ctoken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"btoken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenSymbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenName\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"ctokenDecimal\",\"type\":\"uint8\"}],\"name\":\"BridgedTokenDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedToCanonical\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canonicalToBridged\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isBridgedToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"onMessageRecalled\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structERC20Vault.CanonicalERC20\",\"name\":\"ctoken\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"receiveToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structERC20Vault.BridgeTransferOp\",\"name\":\"opt\",\"type\":\"tuple\"}],\"name\":\"sendToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_MANAGER\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_AMOUNT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_FROM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_SRC_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_USER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_RELEASED_ALREADY\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"ctoken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"btoken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenSymbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenName\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"ctokenDecimal\",\"type\":\"uint8\"}],\"name\":\"BridgedTokenDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedToCanonical\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canonicalToBridged\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isBridgedToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"onMessageRecalled\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"decimals\",\"type\":\"uint8\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structERC20Vault.CanonicalERC20\",\"name\":\"ctoken\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"receiveToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structERC20Vault.BridgeTransferOp\",\"name\":\"opt\",\"type\":\"tuple\"}],\"name\":\"sendToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC20VaultABI is the input ABI used to generate the binding from. @@ -515,25 +515,25 @@ func (_ERC20Vault *ERC20VaultTransactorSession) Init(addressManager common.Addre return _ERC20Vault.Contract.Init(&_ERC20Vault.TransactOpts, addressManager) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC20Vault *ERC20VaultTransactor) OnMessageRecalled(opts *bind.TransactOpts, message IBridgeMessage) (*types.Transaction, error) { - return _ERC20Vault.contract.Transact(opts, "onMessageRecalled", message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC20Vault *ERC20VaultTransactor) OnMessageRecalled(opts *bind.TransactOpts, message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC20Vault.contract.Transact(opts, "onMessageRecalled", message, msgHash) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC20Vault *ERC20VaultSession) OnMessageRecalled(message IBridgeMessage) (*types.Transaction, error) { - return _ERC20Vault.Contract.OnMessageRecalled(&_ERC20Vault.TransactOpts, message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC20Vault *ERC20VaultSession) OnMessageRecalled(message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC20Vault.Contract.OnMessageRecalled(&_ERC20Vault.TransactOpts, message, msgHash) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC20Vault *ERC20VaultTransactorSession) OnMessageRecalled(message IBridgeMessage) (*types.Transaction, error) { - return _ERC20Vault.Contract.OnMessageRecalled(&_ERC20Vault.TransactOpts, message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC20Vault *ERC20VaultTransactorSession) OnMessageRecalled(message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC20Vault.Contract.OnMessageRecalled(&_ERC20Vault.TransactOpts, message, msgHash) } // ReceiveToken is a paid mutator transaction binding the contract method 0xcb03d23c. @@ -599,27 +599,6 @@ func (_ERC20Vault *ERC20VaultTransactorSession) SendToken(opt ERC20VaultBridgeTr return _ERC20Vault.Contract.SendToken(&_ERC20Vault.TransactOpts, opt) } -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC20Vault *ERC20VaultTransactor) SetAddressManager(opts *bind.TransactOpts, newAddressManager common.Address) (*types.Transaction, error) { - return _ERC20Vault.contract.Transact(opts, "setAddressManager", newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC20Vault *ERC20VaultSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _ERC20Vault.Contract.SetAddressManager(&_ERC20Vault.TransactOpts, newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC20Vault *ERC20VaultTransactorSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _ERC20Vault.Contract.SetAddressManager(&_ERC20Vault.TransactOpts, newAddressManager) -} - // TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() @@ -641,150 +620,6 @@ func (_ERC20Vault *ERC20VaultTransactorSession) TransferOwnership(newOwner commo return _ERC20Vault.Contract.TransferOwnership(&_ERC20Vault.TransactOpts, newOwner) } -// ERC20VaultAddressManagerChangedIterator is returned from FilterAddressManagerChanged and is used to iterate over the raw logs and unpacked data for AddressManagerChanged events raised by the ERC20Vault contract. -type ERC20VaultAddressManagerChangedIterator struct { - Event *ERC20VaultAddressManagerChanged // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ERC20VaultAddressManagerChangedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ERC20VaultAddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ERC20VaultAddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ERC20VaultAddressManagerChangedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ERC20VaultAddressManagerChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ERC20VaultAddressManagerChanged represents a AddressManagerChanged event raised by the ERC20Vault contract. -type ERC20VaultAddressManagerChanged struct { - AddressManager common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAddressManagerChanged is a free log retrieval operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC20Vault *ERC20VaultFilterer) FilterAddressManagerChanged(opts *bind.FilterOpts, addressManager []common.Address) (*ERC20VaultAddressManagerChangedIterator, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _ERC20Vault.contract.FilterLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return &ERC20VaultAddressManagerChangedIterator{contract: _ERC20Vault.contract, event: "AddressManagerChanged", logs: logs, sub: sub}, nil -} - -// WatchAddressManagerChanged is a free log subscription operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC20Vault *ERC20VaultFilterer) WatchAddressManagerChanged(opts *bind.WatchOpts, sink chan<- *ERC20VaultAddressManagerChanged, addressManager []common.Address) (event.Subscription, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _ERC20Vault.contract.WatchLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ERC20VaultAddressManagerChanged) - if err := _ERC20Vault.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseAddressManagerChanged is a log parse operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC20Vault *ERC20VaultFilterer) ParseAddressManagerChanged(log types.Log) (*ERC20VaultAddressManagerChanged, error) { - event := new(ERC20VaultAddressManagerChanged) - if err := _ERC20Vault.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // ERC20VaultBridgedTokenDeployedIterator is returned from FilterBridgedTokenDeployed and is used to iterate over the raw logs and unpacked data for BridgedTokenDeployed events raised by the ERC20Vault contract. type ERC20VaultBridgedTokenDeployedIterator struct { Event *ERC20VaultBridgedTokenDeployed // Event containing the contract specifics and raw log diff --git a/packages/relayer/bindings/erc721vault/ERC721Vault.go b/packages/relayer/bindings/erc721vault/ERC721Vault.go index 1620b734584..edcdecaed78 100644 --- a/packages/relayer/bindings/erc721vault/ERC721Vault.go +++ b/packages/relayer/bindings/erc721vault/ERC721Vault.go @@ -68,7 +68,7 @@ type IBridgeMessage struct { // ERC721VaultMetaData contains all meta data concerning the ERC721Vault contract. var ERC721VaultMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INTERFACE_NOT_SUPPORTED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_AMOUNT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_FROM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_SRC_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_USER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MAX_TOKEN_PER_TXN_EXCEEDED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_RELEASED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_TOKEN_ARRAY_MISMATCH\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"ctoken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"btoken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenSymbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenName\",\"type\":\"string\"}],\"name\":\"BridgedTokenDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ERC1155_INTERFACE_ID\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC721_INTERFACE_ID\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedToCanonical\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canonicalToBridged\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isBridgedToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"}],\"name\":\"onMessageRecalled\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structBaseNFTVault.CanonicalNFT\",\"name\":\"ctoken\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"}],\"name\":\"receiveToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structBaseNFTVault.BridgeTransferOp\",\"name\":\"opt\",\"type\":\"tuple\"}],\"name\":\"sendToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_MANAGER\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INTERFACE_NOT_SUPPORTED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_AMOUNT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_FROM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_SRC_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_INVALID_USER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MAX_TOKEN_PER_TXN_EXCEEDED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_NOT_FAILED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_MESSAGE_RELEASED_ALREADY\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"VAULT_TOKEN_ARRAY_MISMATCH\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"ctoken\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"btoken\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenSymbol\",\"type\":\"string\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"ctokenName\",\"type\":\"string\"}],\"name\":\"BridgedTokenDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"TokenSent\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ERC1155_INTERFACE_ID\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"ERC721_INTERFACE_ID\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"bridgedToCanonical\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"canonicalToBridged\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"isBridgedToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"onERC721Received\",\"outputs\":[{\"internalType\":\"bytes4\",\"name\":\"\",\"type\":\"bytes4\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"srcChainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structIBridge.Message\",\"name\":\"message\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"msgHash\",\"type\":\"bytes32\"}],\"name\":\"onMessageRecalled\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"}],\"internalType\":\"structBaseNFTVault.CanonicalNFT\",\"name\":\"ctoken\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"}],\"name\":\"receiveToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"destChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"tokenIds\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"fee\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"refundTo\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"memo\",\"type\":\"string\"}],\"internalType\":\"structBaseNFTVault.BridgeTransferOp\",\"name\":\"opt\",\"type\":\"tuple\"}],\"name\":\"sendToken\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // ERC721VaultABI is the input ABI used to generate the binding from. @@ -603,25 +603,25 @@ func (_ERC721Vault *ERC721VaultTransactorSession) Init(addressManager common.Add return _ERC721Vault.Contract.Init(&_ERC721Vault.TransactOpts, addressManager) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC721Vault *ERC721VaultTransactor) OnMessageRecalled(opts *bind.TransactOpts, message IBridgeMessage) (*types.Transaction, error) { - return _ERC721Vault.contract.Transact(opts, "onMessageRecalled", message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC721Vault *ERC721VaultTransactor) OnMessageRecalled(opts *bind.TransactOpts, message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC721Vault.contract.Transact(opts, "onMessageRecalled", message, msgHash) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC721Vault *ERC721VaultSession) OnMessageRecalled(message IBridgeMessage) (*types.Transaction, error) { - return _ERC721Vault.Contract.OnMessageRecalled(&_ERC721Vault.TransactOpts, message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC721Vault *ERC721VaultSession) OnMessageRecalled(message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC721Vault.Contract.OnMessageRecalled(&_ERC721Vault.TransactOpts, message, msgHash) } -// OnMessageRecalled is a paid mutator transaction binding the contract method 0x32a642ca. +// OnMessageRecalled is a paid mutator transaction binding the contract method 0xa19ec154. // -// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message) payable returns() -func (_ERC721Vault *ERC721VaultTransactorSession) OnMessageRecalled(message IBridgeMessage) (*types.Transaction, error) { - return _ERC721Vault.Contract.OnMessageRecalled(&_ERC721Vault.TransactOpts, message) +// Solidity: function onMessageRecalled((uint256,address,uint256,uint256,address,address,address,uint256,uint256,uint256,bytes,string) message, bytes32 msgHash) payable returns() +func (_ERC721Vault *ERC721VaultTransactorSession) OnMessageRecalled(message IBridgeMessage, msgHash [32]byte) (*types.Transaction, error) { + return _ERC721Vault.Contract.OnMessageRecalled(&_ERC721Vault.TransactOpts, message, msgHash) } // ReceiveToken is a paid mutator transaction binding the contract method 0xa9976baf. @@ -687,27 +687,6 @@ func (_ERC721Vault *ERC721VaultTransactorSession) SendToken(opt BaseNFTVaultBrid return _ERC721Vault.Contract.SendToken(&_ERC721Vault.TransactOpts, opt) } -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC721Vault *ERC721VaultTransactor) SetAddressManager(opts *bind.TransactOpts, newAddressManager common.Address) (*types.Transaction, error) { - return _ERC721Vault.contract.Transact(opts, "setAddressManager", newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC721Vault *ERC721VaultSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _ERC721Vault.Contract.SetAddressManager(&_ERC721Vault.TransactOpts, newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_ERC721Vault *ERC721VaultTransactorSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _ERC721Vault.Contract.SetAddressManager(&_ERC721Vault.TransactOpts, newAddressManager) -} - // TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() @@ -729,150 +708,6 @@ func (_ERC721Vault *ERC721VaultTransactorSession) TransferOwnership(newOwner com return _ERC721Vault.Contract.TransferOwnership(&_ERC721Vault.TransactOpts, newOwner) } -// ERC721VaultAddressManagerChangedIterator is returned from FilterAddressManagerChanged and is used to iterate over the raw logs and unpacked data for AddressManagerChanged events raised by the ERC721Vault contract. -type ERC721VaultAddressManagerChangedIterator struct { - Event *ERC721VaultAddressManagerChanged // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *ERC721VaultAddressManagerChangedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(ERC721VaultAddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(ERC721VaultAddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *ERC721VaultAddressManagerChangedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *ERC721VaultAddressManagerChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// ERC721VaultAddressManagerChanged represents a AddressManagerChanged event raised by the ERC721Vault contract. -type ERC721VaultAddressManagerChanged struct { - AddressManager common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAddressManagerChanged is a free log retrieval operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC721Vault *ERC721VaultFilterer) FilterAddressManagerChanged(opts *bind.FilterOpts, addressManager []common.Address) (*ERC721VaultAddressManagerChangedIterator, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _ERC721Vault.contract.FilterLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return &ERC721VaultAddressManagerChangedIterator{contract: _ERC721Vault.contract, event: "AddressManagerChanged", logs: logs, sub: sub}, nil -} - -// WatchAddressManagerChanged is a free log subscription operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC721Vault *ERC721VaultFilterer) WatchAddressManagerChanged(opts *bind.WatchOpts, sink chan<- *ERC721VaultAddressManagerChanged, addressManager []common.Address) (event.Subscription, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _ERC721Vault.contract.WatchLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(ERC721VaultAddressManagerChanged) - if err := _ERC721Vault.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseAddressManagerChanged is a log parse operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_ERC721Vault *ERC721VaultFilterer) ParseAddressManagerChanged(log types.Log) (*ERC721VaultAddressManagerChanged, error) { - event := new(ERC721VaultAddressManagerChanged) - if err := _ERC721Vault.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // ERC721VaultBridgedTokenDeployedIterator is returned from FilterBridgedTokenDeployed and is used to iterate over the raw logs and unpacked data for BridgedTokenDeployed events raised by the ERC721Vault contract. type ERC721VaultBridgedTokenDeployedIterator struct { Event *ERC721VaultBridgedTokenDeployed // Event containing the contract specifics and raw log diff --git a/packages/relayer/bindings/icrosschainsync/ICrossChainSync.go b/packages/relayer/bindings/icrosschainsync/ICrossChainSync.go index f14a5ba1b4b..0f4c38f33c5 100644 --- a/packages/relayer/bindings/icrosschainsync/ICrossChainSync.go +++ b/packages/relayer/bindings/icrosschainsync/ICrossChainSync.go @@ -29,9 +29,15 @@ var ( _ = abi.ConvertType ) +// ICrossChainSyncSnippet is an auto generated low-level Go binding around an user-defined struct. +type ICrossChainSyncSnippet struct { + BlockHash [32]byte + SignalRoot [32]byte +} + // ICrossChainSyncMetaData contains all meta data concerning the ICrossChainSync contract. var ICrossChainSyncMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"srcHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getCrossChainBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getCrossChainSignalRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", + ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"srcHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getSyncedSnippet\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"internalType\":\"structICrossChainSync.Snippet\",\"name\":\"snippet\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } // ICrossChainSyncABI is the input ABI used to generate the binding from. @@ -180,66 +186,35 @@ func (_ICrossChainSync *ICrossChainSyncTransactorRaw) Transact(opts *bind.Transa return _ICrossChainSync.Contract.contract.Transact(opts, method, params...) } -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. -// -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_ICrossChainSync *ICrossChainSyncCaller) GetCrossChainBlockHash(opts *bind.CallOpts, blockId uint64) ([32]byte, error) { - var out []interface{} - err := _ICrossChainSync.contract.Call(opts, &out, "getCrossChainBlockHash", blockId) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. -// -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_ICrossChainSync *ICrossChainSyncSession) GetCrossChainBlockHash(blockId uint64) ([32]byte, error) { - return _ICrossChainSync.Contract.GetCrossChainBlockHash(&_ICrossChainSync.CallOpts, blockId) -} - -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. -// -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_ICrossChainSync *ICrossChainSyncCallerSession) GetCrossChainBlockHash(blockId uint64) ([32]byte, error) { - return _ICrossChainSync.Contract.GetCrossChainBlockHash(&_ICrossChainSync.CallOpts, blockId) -} - -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. // -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_ICrossChainSync *ICrossChainSyncCaller) GetCrossChainSignalRoot(opts *bind.CallOpts, blockId uint64) ([32]byte, error) { +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32) snippet) +func (_ICrossChainSync *ICrossChainSyncCaller) GetSyncedSnippet(opts *bind.CallOpts, blockId uint64) (ICrossChainSyncSnippet, error) { var out []interface{} - err := _ICrossChainSync.contract.Call(opts, &out, "getCrossChainSignalRoot", blockId) + err := _ICrossChainSync.contract.Call(opts, &out, "getSyncedSnippet", blockId) if err != nil { - return *new([32]byte), err + return *new(ICrossChainSyncSnippet), err } - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + out0 := *abi.ConvertType(out[0], new(ICrossChainSyncSnippet)).(*ICrossChainSyncSnippet) return out0, err } -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. // -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_ICrossChainSync *ICrossChainSyncSession) GetCrossChainSignalRoot(blockId uint64) ([32]byte, error) { - return _ICrossChainSync.Contract.GetCrossChainSignalRoot(&_ICrossChainSync.CallOpts, blockId) +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32) snippet) +func (_ICrossChainSync *ICrossChainSyncSession) GetSyncedSnippet(blockId uint64) (ICrossChainSyncSnippet, error) { + return _ICrossChainSync.Contract.GetSyncedSnippet(&_ICrossChainSync.CallOpts, blockId) } -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. // -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_ICrossChainSync *ICrossChainSyncCallerSession) GetCrossChainSignalRoot(blockId uint64) ([32]byte, error) { - return _ICrossChainSync.Contract.GetCrossChainSignalRoot(&_ICrossChainSync.CallOpts, blockId) +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32) snippet) +func (_ICrossChainSync *ICrossChainSyncCallerSession) GetSyncedSnippet(blockId uint64) (ICrossChainSyncSnippet, error) { + return _ICrossChainSync.Contract.GetSyncedSnippet(&_ICrossChainSync.CallOpts, blockId) } // ICrossChainSyncCrossChainSyncedIterator is returned from FilterCrossChainSynced and is used to iterate over the raw logs and unpacked data for CrossChainSynced events raised by the ICrossChainSync contract. diff --git a/packages/relayer/bindings/taikol1/TaikoL1.go b/packages/relayer/bindings/taikol1/TaikoL1.go index 09838474c55..af6e0a0dd80 100644 --- a/packages/relayer/bindings/taikol1/TaikoL1.go +++ b/packages/relayer/bindings/taikol1/TaikoL1.go @@ -29,13 +29,20 @@ var ( _ = abi.ConvertType ) +// ICrossChainSyncSnippet is an auto generated low-level Go binding around an user-defined struct. +type ICrossChainSyncSnippet struct { + BlockHash [32]byte + SignalRoot [32]byte +} + // ITierProviderTier is an auto generated low-level Go binding around an user-defined struct. type ITierProviderTier struct { - VerifierName [32]byte - ValidityBond *big.Int - ContestBond *big.Int - CooldownWindow *big.Int - ProvingWindow uint16 + VerifierName [32]byte + ValidityBond *big.Int + ContestBond *big.Int + CooldownWindow *big.Int + ProvingWindow uint16 + MaxBlocksToVerify uint8 } // TaikoDataBlock is an auto generated low-level Go binding around an user-defined struct. @@ -67,24 +74,20 @@ type TaikoDataBlockMetadata struct { // TaikoDataConfig is an auto generated low-level Go binding around an user-defined struct. type TaikoDataConfig struct { - ChainId *big.Int - RelaySignalRoot bool - BlockMaxProposals uint64 - BlockRingBufferSize uint64 - BlockMaxVerificationsPerTx uint64 - BlockMaxGasLimit uint32 - BlockFeeBaseGas uint32 - BlockMaxTxListBytes *big.Int - ProposerRewardPerSecond *big.Int - ProposerRewardMax *big.Int - LivenessBond *big.Int - EthDepositRingBufferSize *big.Int - EthDepositMinCountPerBlock uint64 - EthDepositMaxCountPerBlock uint64 - EthDepositMinAmount *big.Int - EthDepositMaxAmount *big.Int - EthDepositGas *big.Int - EthDepositMaxFee *big.Int + ChainId *big.Int + BlockMaxProposals uint64 + BlockRingBufferSize uint64 + MaxBlocksToVerifyPerProposal uint64 + BlockMaxGasLimit uint32 + BlockMaxTxListBytes *big.Int + LivenessBond *big.Int + EthDepositRingBufferSize *big.Int + EthDepositMinCountPerBlock uint64 + EthDepositMaxCountPerBlock uint64 + EthDepositMinAmount *big.Int + EthDepositMaxAmount *big.Int + EthDepositGas *big.Int + EthDepositMaxFee *big.Int } // TaikoDataEthDeposit is an auto generated low-level Go binding around an user-defined struct. @@ -110,6 +113,12 @@ type TaikoDataSlotB struct { LastVerifiedBlockId uint64 } +// TaikoDataSlotC is an auto generated low-level Go binding around an user-defined struct. +type TaikoDataSlotC struct { + AccumulatedReward *big.Int + LastProposedHeight uint64 +} + // TaikoDataStateVariables is an auto generated low-level Go binding around an user-defined struct. type TaikoDataStateVariables struct { GenesisHeight uint64 @@ -136,7 +145,7 @@ type TaikoDataTransition struct { // TaikoL1MetaData contains all meta data concerning the TaikoL1 contract. var TaikoL1MetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"L1_ALREADY_CONTESTED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ALREADY_CONTESTED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ALREADY_PROVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ALREADY_PROVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNED_PROVER_NOT_ALLOWED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNED_PROVER_NOT_ALLOWED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_EXPIRED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_EXPIRED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INSUFFICIENT_FEE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INSUFFICIENT_FEE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INVALID_PARAMS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INVALID_PARAMS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INVALID_SIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INVALID_SIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_BLOCK_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_BLOCK_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_BLOCK_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_BLOCK_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INSUFFICIENT_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_ADDRESS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_ADDRESS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_BLOCK_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_BLOCK_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_BLOCK_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_CONFIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_CONFIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_ETH_DEPOSIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_ETH_DEPOSIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_EVIDENCE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_EVIDENCE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_METADATA\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PARAM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PROOF\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PROPOSER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PROVER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PROVER_SIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_TIER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_TIER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_NOT_ASSIGNED_PROVER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_NOT_ASSIGNED_PROVER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TIER_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TIER_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TOO_MANY_BLOCKS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TOO_MANY_BLOCKS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TRANSITION_ID_ZERO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TRANSITION_ID_ZERO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TRANSITION_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TRANSITION_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_INVALID_RANGE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_TOO_LARGE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_TOO_LARGE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNAUTHORIZED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNAUTHORIZED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNEXPECTED_TRANSITION_TIER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNEXPECTED_TRANSITION_TIER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"livenessBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proverFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"minTier\",\"type\":\"uint16\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"difficulty\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"extraData\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.EthDeposit[]\",\"name\":\"depositsProcessed\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"name\":\"BlockProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"livenessBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proverFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"reward\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"minTier\",\"type\":\"uint16\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"difficulty\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"extraData\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.EthDeposit[]\",\"name\":\"depositsProcessed\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"name\":\"BlockProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"BlockVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"BlockVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"srcHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"srcHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"structTaikoData.EthDeposit\",\"name\":\"deposit\",\"type\":\"tuple\"}],\"name\":\"EthDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"structTaikoData.EthDeposit\",\"name\":\"deposit\",\"type\":\"tuple\"}],\"name\":\"EthDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"minted\",\"type\":\"bool\"}],\"name\":\"TokenCredited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"minted\",\"type\":\"bool\"}],\"name\":\"TokenCredited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"fromLocalBalance\",\"type\":\"bool\"}],\"name\":\"TokenDebited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"fromLocalBalance\",\"type\":\"bool\"}],\"name\":\"TokenDebited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawnByOwner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawnByOwner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"contester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"contestBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"}],\"name\":\"TransitionContested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"contester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"contestBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"}],\"name\":\"TransitionContested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"validityBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"}],\"name\":\"TransitionProved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"validityBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"}],\"name\":\"TransitionProved\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"canDepositEthToL2\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"depositEtherToL2\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"depositTaikoToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"metaHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"livenessBond\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"proposedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nextTransitionId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"verifiedTransitionId\",\"type\":\"uint32\"},{\"internalType\":\"uint16\",\"name\":\"minTier\",\"type\":\"uint16\"},{\"internalType\":\"bytes32[7]\",\"name\":\"__reserved\",\"type\":\"bytes32[7]\"}],\"internalType\":\"structTaikoData.Block\",\"name\":\"blk\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"relaySignalRoot\",\"type\":\"bool\"},{\"internalType\":\"uint64\",\"name\":\"blockMaxProposals\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"blockRingBufferSize\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxBlocksToVerifyPerProposal\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"blockMaxGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"blockFeeBaseGas\",\"type\":\"uint32\"},{\"internalType\":\"uint24\",\"name\":\"blockMaxTxListBytes\",\"type\":\"uint24\"},{\"internalType\":\"uint256\",\"name\":\"proposerRewardPerSecond\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"proposerRewardMax\",\"type\":\"uint256\"},{\"internalType\":\"uint96\",\"name\":\"livenessBond\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"ethDepositRingBufferSize\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"ethDepositMinCountPerBlock\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"ethDepositMaxCountPerBlock\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"ethDepositMinAmount\",\"type\":\"uint96\"},{\"internalType\":\"uint96\",\"name\":\"ethDepositMaxAmount\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"ethDepositGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ethDepositMaxFee\",\"type\":\"uint256\"}],\"internalType\":\"structTaikoData.Config\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getCrossChainBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getCrossChainSignalRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rand\",\"type\":\"uint256\"}],\"name\":\"getMinTier\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStateVariables\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"nextEthDepositToProcess\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"numEthDeposits\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"numBlocks\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.StateVariables\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getTaikoTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"tierId\",\"type\":\"uint16\"}],\"name\":\"getTier\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"verifierName\",\"type\":\"bytes32\"},{\"internalType\":\"uint96\",\"name\":\"validityBond\",\"type\":\"uint96\"},{\"internalType\":\"uint96\",\"name\":\"contestBond\",\"type\":\"uint96\"},{\"internalType\":\"uint24\",\"name\":\"cooldownWindow\",\"type\":\"uint24\"},{\"internalType\":\"uint16\",\"name\":\"provingWindow\",\"type\":\"uint16\"}],\"internalType\":\"structITierProvider.Tier\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTierIds\",\"outputs\":[{\"internalType\":\"uint16[]\",\"name\":\"\",\"type\":\"uint16[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"}],\"name\":\"getTransition\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"validityBond\",\"type\":\"uint96\"},{\"internalType\":\"address\",\"name\":\"contester\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"contestBond\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"},{\"internalType\":\"bytes32[4]\",\"name\":\"__reserved\",\"type\":\"bytes32[4]\"}],\"internalType\":\"structTaikoData.Transition\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_genesisBlockHash\",\"type\":\"bytes32\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ownerWithdrawTaikoToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"extraData\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"assignment\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"txList\",\"type\":\"bytes\"}],\"name\":\"proposeBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"difficulty\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"extraData\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.EthDeposit[]\",\"name\":\"depositsProcessed\",\"type\":\"tuple[]\"}],\"internalType\":\"structTaikoData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"proveBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"numEthDeposits\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"nextEthDepositToProcess\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.SlotA\",\"name\":\"slotA\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"numBlocks\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"nextEthDepositToProcess\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastVerifiedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.SlotB\",\"name\":\"slotB\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"maxBlocks\",\"type\":\"uint64\"}],\"name\":\"verifyBlocks\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawTaikoToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", + ABI: "[{\"inputs\":[],\"name\":\"L1_ALREADY_CONTESTED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ALREADY_CONTESTED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ALREADY_PROVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ALREADY_PROVED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNED_PROVER_NOT_ALLOWED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNED_PROVER_NOT_ALLOWED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_EXPIRED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_EXPIRED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INSUFFICIENT_FEE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INSUFFICIENT_FEE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INVALID_PARAMS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INVALID_PARAMS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INVALID_SIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_ASSIGNMENT_INVALID_SIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_BLOCK_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_BLOCK_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_BLOCK_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_BLOCK_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INSUFFICIENT_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INSUFFICIENT_TOKEN\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_ADDRESS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_ADDRESS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_BLOCK_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_BLOCK_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_BLOCK_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_CONFIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_CONFIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_ETH_DEPOSIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_ETH_DEPOSIT\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_EVIDENCE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_EVIDENCE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_METADATA\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PARAM\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PROOF\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PROPOSER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PROVER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_PROVER_SIG\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_TIER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_INVALID_TIER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_NOT_ASSIGNED_PROVER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_NOT_ASSIGNED_PROVER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TIER_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TIER_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TOO_MANY_BLOCKS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TOO_MANY_BLOCKS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TRANSITION_ID_ZERO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TRANSITION_ID_ZERO\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TRANSITION_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TRANSITION_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_INVALID_RANGE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_NOT_FOUND\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_TOO_LARGE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_TXLIST_TOO_LARGE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNAUTHORIZED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNAUTHORIZED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNEXPECTED_TRANSITION_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNEXPECTED_TRANSITION_TIER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L1_UNEXPECTED_TRANSITION_TIER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_MANAGER\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"livenessBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proverFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"minTier\",\"type\":\"uint16\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"difficulty\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"extraData\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.EthDeposit[]\",\"name\":\"depositsProcessed\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"name\":\"BlockProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"livenessBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"proverFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"minTier\",\"type\":\"uint16\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"difficulty\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"extraData\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.EthDeposit[]\",\"name\":\"depositsProcessed\",\"type\":\"tuple[]\"}],\"indexed\":false,\"internalType\":\"structTaikoData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"name\":\"BlockProposed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"BlockVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"BlockVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"srcHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"srcHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"structTaikoData.EthDeposit\",\"name\":\"deposit\",\"type\":\"tuple\"}],\"name\":\"EthDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"indexed\":false,\"internalType\":\"structTaikoData.EthDeposit\",\"name\":\"deposit\",\"type\":\"tuple\"}],\"name\":\"EthDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"minted\",\"type\":\"bool\"}],\"name\":\"TokenCredited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"minted\",\"type\":\"bool\"}],\"name\":\"TokenCredited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"fromLocalBalance\",\"type\":\"bool\"}],\"name\":\"TokenDebited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"fromLocalBalance\",\"type\":\"bool\"}],\"name\":\"TokenDebited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenDeposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawnByOwner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"TokenWithdrawnByOwner\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"contester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"contestBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"}],\"name\":\"TransitionContested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"contester\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"contestBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"}],\"name\":\"TransitionContested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"validityBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"}],\"name\":\"TransitionProved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"validityBond\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"}],\"name\":\"TransitionProved\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"canDepositEthToL2\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"depositEtherToL2\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"depositTaikoToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"metaHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"assignedProver\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"livenessBond\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"proposedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nextTransitionId\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"verifiedTransitionId\",\"type\":\"uint32\"},{\"internalType\":\"uint16\",\"name\":\"minTier\",\"type\":\"uint16\"},{\"internalType\":\"bytes32[7]\",\"name\":\"__reserved\",\"type\":\"bytes32[7]\"}],\"internalType\":\"structTaikoData.Block\",\"name\":\"blk\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"blockMaxProposals\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"blockRingBufferSize\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"maxBlocksToVerifyPerProposal\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"blockMaxGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"uint24\",\"name\":\"blockMaxTxListBytes\",\"type\":\"uint24\"},{\"internalType\":\"uint96\",\"name\":\"livenessBond\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"ethDepositRingBufferSize\",\"type\":\"uint256\"},{\"internalType\":\"uint64\",\"name\":\"ethDepositMinCountPerBlock\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"ethDepositMaxCountPerBlock\",\"type\":\"uint64\"},{\"internalType\":\"uint96\",\"name\":\"ethDepositMinAmount\",\"type\":\"uint96\"},{\"internalType\":\"uint96\",\"name\":\"ethDepositMaxAmount\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"ethDepositGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ethDepositMaxFee\",\"type\":\"uint256\"}],\"internalType\":\"structTaikoData.Config\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rand\",\"type\":\"uint256\"}],\"name\":\"getMinTier\",\"outputs\":[{\"internalType\":\"uint16\",\"name\":\"\",\"type\":\"uint16\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getStateVariables\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"nextEthDepositToProcess\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"numEthDeposits\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"numBlocks\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.StateVariables\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getSyncedSnippet\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"internalType\":\"structICrossChainSync.Snippet\",\"name\":\"data\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"getTaikoTokenBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"tierId\",\"type\":\"uint16\"}],\"name\":\"getTier\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"verifierName\",\"type\":\"bytes32\"},{\"internalType\":\"uint96\",\"name\":\"validityBond\",\"type\":\"uint96\"},{\"internalType\":\"uint96\",\"name\":\"contestBond\",\"type\":\"uint96\"},{\"internalType\":\"uint24\",\"name\":\"cooldownWindow\",\"type\":\"uint24\"},{\"internalType\":\"uint16\",\"name\":\"provingWindow\",\"type\":\"uint16\"},{\"internalType\":\"uint8\",\"name\":\"maxBlocksToVerify\",\"type\":\"uint8\"}],\"internalType\":\"structITierProvider.Tier\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTierIds\",\"outputs\":[{\"internalType\":\"uint16[]\",\"name\":\"\",\"type\":\"uint16[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"},{\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"}],\"name\":\"getTransition\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"key\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"prover\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"validityBond\",\"type\":\"uint96\"},{\"internalType\":\"address\",\"name\":\"contester\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"contestBond\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint16\",\"name\":\"tier\",\"type\":\"uint16\"},{\"internalType\":\"bytes32[4]\",\"name\":\"__reserved\",\"type\":\"bytes32[4]\"}],\"internalType\":\"structTaikoData.Transition\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_genesisBlockHash\",\"type\":\"bytes32\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isConfigValid\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ownerWithdrawTaikoToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"extraData\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"assignment\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"txList\",\"type\":\"bytes\"}],\"name\":\"proposeBlock\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"difficulty\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"txListHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"extraData\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasLimit\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"amount\",\"type\":\"uint96\"},{\"internalType\":\"uint64\",\"name\":\"id\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.EthDeposit[]\",\"name\":\"depositsProcessed\",\"type\":\"tuple[]\"}],\"internalType\":\"structTaikoData.BlockMetadata\",\"name\":\"meta\",\"type\":\"tuple\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"proveBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"state\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"genesisHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"genesisTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"numEthDeposits\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"nextEthDepositToProcess\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.SlotA\",\"name\":\"slotA\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint64\",\"name\":\"numBlocks\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"nextEthDepositToProcess\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastVerifiedAt\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"lastVerifiedBlockId\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.SlotB\",\"name\":\"slotB\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint128\",\"name\":\"accumulatedReward\",\"type\":\"uint128\"},{\"internalType\":\"uint64\",\"name\":\"lastProposedHeight\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoData.SlotC\",\"name\":\"slotC\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"maxBlocksToVerify\",\"type\":\"uint64\"}],\"name\":\"verifyBlocks\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"withdrawTaikoToken\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", } // TaikoL1ABI is the input ABI used to generate the binding from. @@ -380,7 +389,7 @@ func (_TaikoL1 *TaikoL1CallerSession) GetBlock(blockId uint64) (TaikoDataBlock, // GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. // -// Solidity: function getConfig() pure returns((uint256,bool,uint64,uint64,uint64,uint32,uint32,uint24,uint256,uint256,uint96,uint256,uint64,uint64,uint96,uint96,uint256,uint256)) +// Solidity: function getConfig() pure returns((uint256,uint64,uint64,uint64,uint32,uint24,uint96,uint256,uint64,uint64,uint96,uint96,uint256,uint256)) func (_TaikoL1 *TaikoL1Caller) GetConfig(opts *bind.CallOpts) (TaikoDataConfig, error) { var out []interface{} err := _TaikoL1.contract.Call(opts, &out, "getConfig") @@ -397,80 +406,18 @@ func (_TaikoL1 *TaikoL1Caller) GetConfig(opts *bind.CallOpts) (TaikoDataConfig, // GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. // -// Solidity: function getConfig() pure returns((uint256,bool,uint64,uint64,uint64,uint32,uint32,uint24,uint256,uint256,uint96,uint256,uint64,uint64,uint96,uint96,uint256,uint256)) +// Solidity: function getConfig() pure returns((uint256,uint64,uint64,uint64,uint32,uint24,uint96,uint256,uint64,uint64,uint96,uint96,uint256,uint256)) func (_TaikoL1 *TaikoL1Session) GetConfig() (TaikoDataConfig, error) { return _TaikoL1.Contract.GetConfig(&_TaikoL1.CallOpts) } // GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. // -// Solidity: function getConfig() pure returns((uint256,bool,uint64,uint64,uint64,uint32,uint32,uint24,uint256,uint256,uint96,uint256,uint64,uint64,uint96,uint96,uint256,uint256)) +// Solidity: function getConfig() pure returns((uint256,uint64,uint64,uint64,uint32,uint24,uint96,uint256,uint64,uint64,uint96,uint96,uint256,uint256)) func (_TaikoL1 *TaikoL1CallerSession) GetConfig() (TaikoDataConfig, error) { return _TaikoL1.Contract.GetConfig(&_TaikoL1.CallOpts) } -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. -// -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_TaikoL1 *TaikoL1Caller) GetCrossChainBlockHash(opts *bind.CallOpts, blockId uint64) ([32]byte, error) { - var out []interface{} - err := _TaikoL1.contract.Call(opts, &out, "getCrossChainBlockHash", blockId) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. -// -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_TaikoL1 *TaikoL1Session) GetCrossChainBlockHash(blockId uint64) ([32]byte, error) { - return _TaikoL1.Contract.GetCrossChainBlockHash(&_TaikoL1.CallOpts, blockId) -} - -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. -// -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_TaikoL1 *TaikoL1CallerSession) GetCrossChainBlockHash(blockId uint64) ([32]byte, error) { - return _TaikoL1.Contract.GetCrossChainBlockHash(&_TaikoL1.CallOpts, blockId) -} - -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. -// -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_TaikoL1 *TaikoL1Caller) GetCrossChainSignalRoot(opts *bind.CallOpts, blockId uint64) ([32]byte, error) { - var out []interface{} - err := _TaikoL1.contract.Call(opts, &out, "getCrossChainSignalRoot", blockId) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. -// -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_TaikoL1 *TaikoL1Session) GetCrossChainSignalRoot(blockId uint64) ([32]byte, error) { - return _TaikoL1.Contract.GetCrossChainSignalRoot(&_TaikoL1.CallOpts, blockId) -} - -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. -// -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_TaikoL1 *TaikoL1CallerSession) GetCrossChainSignalRoot(blockId uint64) ([32]byte, error) { - return _TaikoL1.Contract.GetCrossChainSignalRoot(&_TaikoL1.CallOpts, blockId) -} - // GetMinTier is a free data retrieval call binding the contract method 0x59ab4e23. // // Solidity: function getMinTier(uint256 rand) view returns(uint16) @@ -533,6 +480,37 @@ func (_TaikoL1 *TaikoL1CallerSession) GetStateVariables() (TaikoDataStateVariabl return _TaikoL1.Contract.GetStateVariables(&_TaikoL1.CallOpts) } +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. +// +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32) data) +func (_TaikoL1 *TaikoL1Caller) GetSyncedSnippet(opts *bind.CallOpts, blockId uint64) (ICrossChainSyncSnippet, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "getSyncedSnippet", blockId) + + if err != nil { + return *new(ICrossChainSyncSnippet), err + } + + out0 := *abi.ConvertType(out[0], new(ICrossChainSyncSnippet)).(*ICrossChainSyncSnippet) + + return out0, err + +} + +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. +// +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32) data) +func (_TaikoL1 *TaikoL1Session) GetSyncedSnippet(blockId uint64) (ICrossChainSyncSnippet, error) { + return _TaikoL1.Contract.GetSyncedSnippet(&_TaikoL1.CallOpts, blockId) +} + +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. +// +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32) data) +func (_TaikoL1 *TaikoL1CallerSession) GetSyncedSnippet(blockId uint64) (ICrossChainSyncSnippet, error) { + return _TaikoL1.Contract.GetSyncedSnippet(&_TaikoL1.CallOpts, blockId) +} + // GetTaikoTokenBalance is a free data retrieval call binding the contract method 0x8dff9cea. // // Solidity: function getTaikoTokenBalance(address user) view returns(uint256) @@ -566,7 +544,7 @@ func (_TaikoL1 *TaikoL1CallerSession) GetTaikoTokenBalance(user common.Address) // GetTier is a free data retrieval call binding the contract method 0x576c3de7. // -// Solidity: function getTier(uint16 tierId) view returns((bytes32,uint96,uint96,uint24,uint16)) +// Solidity: function getTier(uint16 tierId) view returns((bytes32,uint96,uint96,uint24,uint16,uint8)) func (_TaikoL1 *TaikoL1Caller) GetTier(opts *bind.CallOpts, tierId uint16) (ITierProviderTier, error) { var out []interface{} err := _TaikoL1.contract.Call(opts, &out, "getTier", tierId) @@ -583,14 +561,14 @@ func (_TaikoL1 *TaikoL1Caller) GetTier(opts *bind.CallOpts, tierId uint16) (ITie // GetTier is a free data retrieval call binding the contract method 0x576c3de7. // -// Solidity: function getTier(uint16 tierId) view returns((bytes32,uint96,uint96,uint24,uint16)) +// Solidity: function getTier(uint16 tierId) view returns((bytes32,uint96,uint96,uint24,uint16,uint8)) func (_TaikoL1 *TaikoL1Session) GetTier(tierId uint16) (ITierProviderTier, error) { return _TaikoL1.Contract.GetTier(&_TaikoL1.CallOpts, tierId) } // GetTier is a free data retrieval call binding the contract method 0x576c3de7. // -// Solidity: function getTier(uint16 tierId) view returns((bytes32,uint96,uint96,uint24,uint16)) +// Solidity: function getTier(uint16 tierId) view returns((bytes32,uint96,uint96,uint24,uint16,uint8)) func (_TaikoL1 *TaikoL1CallerSession) GetTier(tierId uint16) (ITierProviderTier, error) { return _TaikoL1.Contract.GetTier(&_TaikoL1.CallOpts, tierId) } @@ -657,6 +635,37 @@ func (_TaikoL1 *TaikoL1CallerSession) GetTransition(blockId uint64, parentHash [ return _TaikoL1.Contract.GetTransition(&_TaikoL1.CallOpts, blockId, parentHash) } +// IsConfigValid is a free data retrieval call binding the contract method 0xe3f1bdc5. +// +// Solidity: function isConfigValid() pure returns(bool) +func (_TaikoL1 *TaikoL1Caller) IsConfigValid(opts *bind.CallOpts) (bool, error) { + var out []interface{} + err := _TaikoL1.contract.Call(opts, &out, "isConfigValid") + + if err != nil { + return *new(bool), err + } + + out0 := *abi.ConvertType(out[0], new(bool)).(*bool) + + return out0, err + +} + +// IsConfigValid is a free data retrieval call binding the contract method 0xe3f1bdc5. +// +// Solidity: function isConfigValid() pure returns(bool) +func (_TaikoL1 *TaikoL1Session) IsConfigValid() (bool, error) { + return _TaikoL1.Contract.IsConfigValid(&_TaikoL1.CallOpts) +} + +// IsConfigValid is a free data retrieval call binding the contract method 0xe3f1bdc5. +// +// Solidity: function isConfigValid() pure returns(bool) +func (_TaikoL1 *TaikoL1CallerSession) IsConfigValid() (bool, error) { + return _TaikoL1.Contract.IsConfigValid(&_TaikoL1.CallOpts) +} + // Owner is a free data retrieval call binding the contract method 0x8da5cb5b. // // Solidity: function owner() view returns(address) @@ -752,10 +761,11 @@ func (_TaikoL1 *TaikoL1CallerSession) Resolve0(name [32]byte, allowZeroAddress b // State is a free data retrieval call binding the contract method 0xc19d93fb. // -// Solidity: function state() view returns((uint64,uint64,uint64,uint64) slotA, (uint64,uint64,uint64,uint64) slotB) +// Solidity: function state() view returns((uint64,uint64,uint64,uint64) slotA, (uint64,uint64,uint64,uint64) slotB, (uint128,uint64) slotC) func (_TaikoL1 *TaikoL1Caller) State(opts *bind.CallOpts) (struct { SlotA TaikoDataSlotA SlotB TaikoDataSlotB + SlotC TaikoDataSlotC }, error) { var out []interface{} err := _TaikoL1.contract.Call(opts, &out, "state") @@ -763,6 +773,7 @@ func (_TaikoL1 *TaikoL1Caller) State(opts *bind.CallOpts) (struct { outstruct := new(struct { SlotA TaikoDataSlotA SlotB TaikoDataSlotB + SlotC TaikoDataSlotC }) if err != nil { return *outstruct, err @@ -770,6 +781,7 @@ func (_TaikoL1 *TaikoL1Caller) State(opts *bind.CallOpts) (struct { outstruct.SlotA = *abi.ConvertType(out[0], new(TaikoDataSlotA)).(*TaikoDataSlotA) outstruct.SlotB = *abi.ConvertType(out[1], new(TaikoDataSlotB)).(*TaikoDataSlotB) + outstruct.SlotC = *abi.ConvertType(out[2], new(TaikoDataSlotC)).(*TaikoDataSlotC) return *outstruct, err @@ -777,20 +789,22 @@ func (_TaikoL1 *TaikoL1Caller) State(opts *bind.CallOpts) (struct { // State is a free data retrieval call binding the contract method 0xc19d93fb. // -// Solidity: function state() view returns((uint64,uint64,uint64,uint64) slotA, (uint64,uint64,uint64,uint64) slotB) +// Solidity: function state() view returns((uint64,uint64,uint64,uint64) slotA, (uint64,uint64,uint64,uint64) slotB, (uint128,uint64) slotC) func (_TaikoL1 *TaikoL1Session) State() (struct { SlotA TaikoDataSlotA SlotB TaikoDataSlotB + SlotC TaikoDataSlotC }, error) { return _TaikoL1.Contract.State(&_TaikoL1.CallOpts) } // State is a free data retrieval call binding the contract method 0xc19d93fb. // -// Solidity: function state() view returns((uint64,uint64,uint64,uint64) slotA, (uint64,uint64,uint64,uint64) slotB) +// Solidity: function state() view returns((uint64,uint64,uint64,uint64) slotA, (uint64,uint64,uint64,uint64) slotB, (uint128,uint64) slotC) func (_TaikoL1 *TaikoL1CallerSession) State() (struct { SlotA TaikoDataSlotA SlotB TaikoDataSlotB + SlotC TaikoDataSlotC }, error) { return _TaikoL1.Contract.State(&_TaikoL1.CallOpts) } @@ -942,27 +956,6 @@ func (_TaikoL1 *TaikoL1TransactorSession) RenounceOwnership() (*types.Transactio return _TaikoL1.Contract.RenounceOwnership(&_TaikoL1.TransactOpts) } -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_TaikoL1 *TaikoL1Transactor) SetAddressManager(opts *bind.TransactOpts, newAddressManager common.Address) (*types.Transaction, error) { - return _TaikoL1.contract.Transact(opts, "setAddressManager", newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_TaikoL1 *TaikoL1Session) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _TaikoL1.Contract.SetAddressManager(&_TaikoL1.TransactOpts, newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_TaikoL1 *TaikoL1TransactorSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _TaikoL1.Contract.SetAddressManager(&_TaikoL1.TransactOpts, newAddressManager) -} - // TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() @@ -986,23 +979,23 @@ func (_TaikoL1 *TaikoL1TransactorSession) TransferOwnership(newOwner common.Addr // VerifyBlocks is a paid mutator transaction binding the contract method 0x8778209d. // -// Solidity: function verifyBlocks(uint64 maxBlocks) returns() -func (_TaikoL1 *TaikoL1Transactor) VerifyBlocks(opts *bind.TransactOpts, maxBlocks uint64) (*types.Transaction, error) { - return _TaikoL1.contract.Transact(opts, "verifyBlocks", maxBlocks) +// Solidity: function verifyBlocks(uint64 maxBlocksToVerify) returns() +func (_TaikoL1 *TaikoL1Transactor) VerifyBlocks(opts *bind.TransactOpts, maxBlocksToVerify uint64) (*types.Transaction, error) { + return _TaikoL1.contract.Transact(opts, "verifyBlocks", maxBlocksToVerify) } // VerifyBlocks is a paid mutator transaction binding the contract method 0x8778209d. // -// Solidity: function verifyBlocks(uint64 maxBlocks) returns() -func (_TaikoL1 *TaikoL1Session) VerifyBlocks(maxBlocks uint64) (*types.Transaction, error) { - return _TaikoL1.Contract.VerifyBlocks(&_TaikoL1.TransactOpts, maxBlocks) +// Solidity: function verifyBlocks(uint64 maxBlocksToVerify) returns() +func (_TaikoL1 *TaikoL1Session) VerifyBlocks(maxBlocksToVerify uint64) (*types.Transaction, error) { + return _TaikoL1.Contract.VerifyBlocks(&_TaikoL1.TransactOpts, maxBlocksToVerify) } // VerifyBlocks is a paid mutator transaction binding the contract method 0x8778209d. // -// Solidity: function verifyBlocks(uint64 maxBlocks) returns() -func (_TaikoL1 *TaikoL1TransactorSession) VerifyBlocks(maxBlocks uint64) (*types.Transaction, error) { - return _TaikoL1.Contract.VerifyBlocks(&_TaikoL1.TransactOpts, maxBlocks) +// Solidity: function verifyBlocks(uint64 maxBlocksToVerify) returns() +func (_TaikoL1 *TaikoL1TransactorSession) VerifyBlocks(maxBlocksToVerify uint64) (*types.Transaction, error) { + return _TaikoL1.Contract.VerifyBlocks(&_TaikoL1.TransactOpts, maxBlocksToVerify) } // WithdrawTaikoToken is a paid mutator transaction binding the contract method 0x5043f059. @@ -1047,150 +1040,6 @@ func (_TaikoL1 *TaikoL1TransactorSession) Receive() (*types.Transaction, error) return _TaikoL1.Contract.Receive(&_TaikoL1.TransactOpts) } -// TaikoL1AddressManagerChangedIterator is returned from FilterAddressManagerChanged and is used to iterate over the raw logs and unpacked data for AddressManagerChanged events raised by the TaikoL1 contract. -type TaikoL1AddressManagerChangedIterator struct { - Event *TaikoL1AddressManagerChanged // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *TaikoL1AddressManagerChangedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(TaikoL1AddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(TaikoL1AddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *TaikoL1AddressManagerChangedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *TaikoL1AddressManagerChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// TaikoL1AddressManagerChanged represents a AddressManagerChanged event raised by the TaikoL1 contract. -type TaikoL1AddressManagerChanged struct { - AddressManager common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAddressManagerChanged is a free log retrieval operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_TaikoL1 *TaikoL1Filterer) FilterAddressManagerChanged(opts *bind.FilterOpts, addressManager []common.Address) (*TaikoL1AddressManagerChangedIterator, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _TaikoL1.contract.FilterLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return &TaikoL1AddressManagerChangedIterator{contract: _TaikoL1.contract, event: "AddressManagerChanged", logs: logs, sub: sub}, nil -} - -// WatchAddressManagerChanged is a free log subscription operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_TaikoL1 *TaikoL1Filterer) WatchAddressManagerChanged(opts *bind.WatchOpts, sink chan<- *TaikoL1AddressManagerChanged, addressManager []common.Address) (event.Subscription, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _TaikoL1.contract.WatchLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(TaikoL1AddressManagerChanged) - if err := _TaikoL1.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseAddressManagerChanged is a log parse operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_TaikoL1 *TaikoL1Filterer) ParseAddressManagerChanged(log types.Log) (*TaikoL1AddressManagerChanged, error) { - event := new(TaikoL1AddressManagerChanged) - if err := _TaikoL1.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // TaikoL1BlockProposedIterator is returned from FilterBlockProposed and is used to iterate over the raw logs and unpacked data for BlockProposed events raised by the TaikoL1 contract. type TaikoL1BlockProposedIterator struct { Event *TaikoL1BlockProposed // Event containing the contract specifics and raw log @@ -1264,15 +1113,14 @@ type TaikoL1BlockProposed struct { AssignedProver common.Address LivenessBond *big.Int ProverFee *big.Int - Reward *big.Int MinTier uint16 Meta TaikoDataBlockMetadata Raw types.Log // Blockchain specific contextual infos } -// FilterBlockProposed is a free log retrieval operation binding the contract event 0x3bc85eed257804b26e2232e767692931a620954ad0ae6ca5c58adb22be553418. +// FilterBlockProposed is a free log retrieval operation binding the contract event 0xc857f5d042c0ceb165ef70eab0812ba2e6b15a03ce07638b58efc04dbb175ef6. // -// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint256 reward, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) func (_TaikoL1 *TaikoL1Filterer) FilterBlockProposed(opts *bind.FilterOpts, blockId []*big.Int, assignedProver []common.Address) (*TaikoL1BlockProposedIterator, error) { var blockIdRule []interface{} @@ -1291,9 +1139,9 @@ func (_TaikoL1 *TaikoL1Filterer) FilterBlockProposed(opts *bind.FilterOpts, bloc return &TaikoL1BlockProposedIterator{contract: _TaikoL1.contract, event: "BlockProposed", logs: logs, sub: sub}, nil } -// WatchBlockProposed is a free log subscription operation binding the contract event 0x3bc85eed257804b26e2232e767692931a620954ad0ae6ca5c58adb22be553418. +// WatchBlockProposed is a free log subscription operation binding the contract event 0xc857f5d042c0ceb165ef70eab0812ba2e6b15a03ce07638b58efc04dbb175ef6. // -// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint256 reward, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) func (_TaikoL1 *TaikoL1Filterer) WatchBlockProposed(opts *bind.WatchOpts, sink chan<- *TaikoL1BlockProposed, blockId []*big.Int, assignedProver []common.Address) (event.Subscription, error) { var blockIdRule []interface{} @@ -1337,9 +1185,9 @@ func (_TaikoL1 *TaikoL1Filterer) WatchBlockProposed(opts *bind.WatchOpts, sink c }), nil } -// ParseBlockProposed is a log parse operation binding the contract event 0x3bc85eed257804b26e2232e767692931a620954ad0ae6ca5c58adb22be553418. +// ParseBlockProposed is a log parse operation binding the contract event 0xc857f5d042c0ceb165ef70eab0812ba2e6b15a03ce07638b58efc04dbb175ef6. // -// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint256 reward, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) func (_TaikoL1 *TaikoL1Filterer) ParseBlockProposed(log types.Log) (*TaikoL1BlockProposed, error) { event := new(TaikoL1BlockProposed) if err := _TaikoL1.contract.UnpackLog(event, "BlockProposed", log); err != nil { @@ -1422,15 +1270,14 @@ type TaikoL1BlockProposed0 struct { AssignedProver common.Address LivenessBond *big.Int ProverFee *big.Int - Reward *big.Int MinTier uint16 Meta TaikoDataBlockMetadata Raw types.Log // Blockchain specific contextual infos } -// FilterBlockProposed0 is a free log retrieval operation binding the contract event 0x3bc85eed257804b26e2232e767692931a620954ad0ae6ca5c58adb22be553418. +// FilterBlockProposed0 is a free log retrieval operation binding the contract event 0xc857f5d042c0ceb165ef70eab0812ba2e6b15a03ce07638b58efc04dbb175ef6. // -// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint256 reward, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) func (_TaikoL1 *TaikoL1Filterer) FilterBlockProposed0(opts *bind.FilterOpts, blockId []*big.Int, assignedProver []common.Address) (*TaikoL1BlockProposed0Iterator, error) { var blockIdRule []interface{} @@ -1449,9 +1296,9 @@ func (_TaikoL1 *TaikoL1Filterer) FilterBlockProposed0(opts *bind.FilterOpts, blo return &TaikoL1BlockProposed0Iterator{contract: _TaikoL1.contract, event: "BlockProposed0", logs: logs, sub: sub}, nil } -// WatchBlockProposed0 is a free log subscription operation binding the contract event 0x3bc85eed257804b26e2232e767692931a620954ad0ae6ca5c58adb22be553418. +// WatchBlockProposed0 is a free log subscription operation binding the contract event 0xc857f5d042c0ceb165ef70eab0812ba2e6b15a03ce07638b58efc04dbb175ef6. // -// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint256 reward, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) func (_TaikoL1 *TaikoL1Filterer) WatchBlockProposed0(opts *bind.WatchOpts, sink chan<- *TaikoL1BlockProposed0, blockId []*big.Int, assignedProver []common.Address) (event.Subscription, error) { var blockIdRule []interface{} @@ -1495,9 +1342,9 @@ func (_TaikoL1 *TaikoL1Filterer) WatchBlockProposed0(opts *bind.WatchOpts, sink }), nil } -// ParseBlockProposed0 is a log parse operation binding the contract event 0x3bc85eed257804b26e2232e767692931a620954ad0ae6ca5c58adb22be553418. +// ParseBlockProposed0 is a log parse operation binding the contract event 0xc857f5d042c0ceb165ef70eab0812ba2e6b15a03ce07638b58efc04dbb175ef6. // -// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint256 reward, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) +// Solidity: event BlockProposed(uint256 indexed blockId, address indexed assignedProver, uint96 livenessBond, uint256 proverFee, uint16 minTier, (bytes32,bytes32,bytes32,bytes32,uint64,uint64,uint64,uint32,address,(address,uint96,uint64)[]) meta) func (_TaikoL1 *TaikoL1Filterer) ParseBlockProposed0(log types.Log) (*TaikoL1BlockProposed0, error) { event := new(TaikoL1BlockProposed0) if err := _TaikoL1.contract.UnpackLog(event, "BlockProposed0", log); err != nil { diff --git a/packages/relayer/bindings/taikol2/TaikoL2.go b/packages/relayer/bindings/taikol2/TaikoL2.go index 8d8097c599f..0491da5cba5 100644 --- a/packages/relayer/bindings/taikol2/TaikoL2.go +++ b/packages/relayer/bindings/taikol2/TaikoL2.go @@ -29,17 +29,24 @@ var ( _ = abi.ConvertType ) -// TaikoL2EIP1559Config is an auto generated low-level Go binding around an user-defined struct. -type TaikoL2EIP1559Config struct { - Xscale *big.Int - Yscale *big.Int - GasIssuedPerSecond uint32 - GasExcessMax uint64 +// ICrossChainSyncSnippet is an auto generated low-level Go binding around an user-defined struct. +type ICrossChainSyncSnippet struct { + BlockHash [32]byte + SignalRoot [32]byte +} + +// TaikoL2Config is an auto generated low-level Go binding around an user-defined struct. +type TaikoL2Config struct { + GasTargetPerL1Block uint64 + BasefeeAdjustmentQuotient *big.Int + BlockRewardPerL1Block *big.Int + BlockRewardPoolMax *big.Int + BlockRewardPoolPctg uint8 } // TaikoL2MetaData contains all meta data concerning the TaikoL2 contract. var TaikoL2MetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"L2_1559_OUT_OF_STOCK\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"expected\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"actual\",\"type\":\"uint64\"}],\"name\":\"L2_1559_UNEXPECTED_CHANGE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_BASEFEE_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_1559_PARAMS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_GOLDEN_TOUCH_K\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_SENDER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_PUBLIC_INPUT_HASH_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_TOO_LATE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Overflow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_ADDR\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"addressManager\",\"type\":\"address\"}],\"name\":\"AddressManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"number\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"basefee\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"gaslimit\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"prevrandao\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"coinbase\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"chainid\",\"type\":\"uint64\"}],\"name\":\"Anchored\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"srcHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"GOLDEN_TOUCH_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOLDEN_TOUCH_PRIVATEKEY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"l1Hash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"l1SignalRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"parentGasUsed\",\"type\":\"uint32\"}],\"name\":\"anchor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"basefee\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"gasIssuedPerSecond\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"gasExcessMax\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"gasTarget\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"ratio2x1x\",\"type\":\"uint64\"}],\"name\":\"calcEIP1559Config\",\"outputs\":[{\"components\":[{\"internalType\":\"uint128\",\"name\":\"xscale\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"yscale\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"gasIssuedPerSecond\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"gasExcessMax\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoL2.EIP1559Config\",\"name\":\"config\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasExcess\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"timeSinceParent\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"parentGasUsed\",\"type\":\"uint32\"}],\"name\":\"getBasefee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_basefee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getCrossChainBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getCrossChainSignalRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getEIP1559Config\",\"outputs\":[{\"components\":[{\"internalType\":\"uint128\",\"name\":\"xscale\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"yscale\",\"type\":\"uint128\"},{\"internalType\":\"uint32\",\"name\":\"gasIssuedPerSecond\",\"type\":\"uint32\"},{\"internalType\":\"uint64\",\"name\":\"gasExcessMax\",\"type\":\"uint64\"}],\"internalType\":\"structTaikoL2.EIP1559Config\",\"name\":\"config\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestSyncedL1Height\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parentTimestamp\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"publicInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAddressManager\",\"type\":\"address\"}],\"name\":\"setAddressManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"digest\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"k\",\"type\":\"uint8\"}],\"name\":\"signAnchor\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"r\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + ABI: "[{\"inputs\":[],\"name\":\"EIP1559_INVALID_PARAMS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_BASEFEE_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_GAS_EXCESS_TOO_LARGE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_CHAIN_ID\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_GOLDEN_TOUCH_K\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_INVALID_SENDER\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_PUBLIC_INPUT_HASH_MISMATCH\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"L2_TOO_LATE\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"Overflow\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_DENIED\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"RESOLVER_INVALID_MANAGER\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"RESOLVER_ZERO_ADDR\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"gasExcess\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"blockReward\",\"type\":\"uint128\"}],\"name\":\"Anchored\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint64\",\"name\":\"srcHeight\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"name\":\"CrossChainSynced\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ANCHOR_GAS_DEDUCT\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOLDEN_TOUCH_ADDRESS\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GOLDEN_TOUCH_PRIVATEKEY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"accumulatedReward\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"addressManager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"l1BlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"l1SignalRoot\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"parentGasUsed\",\"type\":\"uint32\"}],\"name\":\"anchor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"avgGasUsed\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasExcess\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"l1Height\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"parentGasUsed\",\"type\":\"uint32\"}],\"name\":\"getBasefee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"basefee\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getConfig\",\"outputs\":[{\"components\":[{\"internalType\":\"uint64\",\"name\":\"gasTargetPerL1Block\",\"type\":\"uint64\"},{\"internalType\":\"uint256\",\"name\":\"basefeeAdjustmentQuotient\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"blockRewardPerL1Block\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"blockRewardPoolMax\",\"type\":\"uint128\"},{\"internalType\":\"uint8\",\"name\":\"blockRewardPoolPctg\",\"type\":\"uint8\"}],\"internalType\":\"structTaikoL2.Config\",\"name\":\"config\",\"type\":\"tuple\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"blockId\",\"type\":\"uint64\"}],\"name\":\"getSyncedSnippet\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"internalType\":\"structICrossChainSync.Snippet\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addressManager\",\"type\":\"address\"},{\"internalType\":\"uint128\",\"name\":\"_gasExcess\",\"type\":\"uint128\"}],\"name\":\"init\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"blockId\",\"type\":\"uint256\"}],\"name\":\"l2Hashes\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestSyncedL1Height\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"parentProposer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"publicInputHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"allowZeroAddress\",\"type\":\"bool\"}],\"name\":\"resolve\",\"outputs\":[{\"internalType\":\"addresspayable\",\"name\":\"addr\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"digest\",\"type\":\"bytes32\"},{\"internalType\":\"uint8\",\"name\":\"k\",\"type\":\"uint8\"}],\"name\":\"signAnchor\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"r\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"s\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"l1height\",\"type\":\"uint256\"}],\"name\":\"snippets\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"signalRoot\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } // TaikoL2ABI is the input ABI used to generate the binding from. @@ -188,6 +195,37 @@ func (_TaikoL2 *TaikoL2TransactorRaw) Transact(opts *bind.TransactOpts, method s return _TaikoL2.Contract.contract.Transact(opts, method, params...) } +// ANCHORGASDEDUCT is a free data retrieval call binding the contract method 0x51bf57b4. +// +// Solidity: function ANCHOR_GAS_DEDUCT() view returns(uint32) +func (_TaikoL2 *TaikoL2Caller) ANCHORGASDEDUCT(opts *bind.CallOpts) (uint32, error) { + var out []interface{} + err := _TaikoL2.contract.Call(opts, &out, "ANCHOR_GAS_DEDUCT") + + if err != nil { + return *new(uint32), err + } + + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) + + return out0, err + +} + +// ANCHORGASDEDUCT is a free data retrieval call binding the contract method 0x51bf57b4. +// +// Solidity: function ANCHOR_GAS_DEDUCT() view returns(uint32) +func (_TaikoL2 *TaikoL2Session) ANCHORGASDEDUCT() (uint32, error) { + return _TaikoL2.Contract.ANCHORGASDEDUCT(&_TaikoL2.CallOpts) +} + +// ANCHORGASDEDUCT is a free data retrieval call binding the contract method 0x51bf57b4. +// +// Solidity: function ANCHOR_GAS_DEDUCT() view returns(uint32) +func (_TaikoL2 *TaikoL2CallerSession) ANCHORGASDEDUCT() (uint32, error) { + return _TaikoL2.Contract.ANCHORGASDEDUCT(&_TaikoL2.CallOpts) +} + // GOLDENTOUCHADDRESS is a free data retrieval call binding the contract method 0x9ee512f2. // // Solidity: function GOLDEN_TOUCH_ADDRESS() view returns(address) @@ -250,6 +288,37 @@ func (_TaikoL2 *TaikoL2CallerSession) GOLDENTOUCHPRIVATEKEY() (*big.Int, error) return _TaikoL2.Contract.GOLDENTOUCHPRIVATEKEY(&_TaikoL2.CallOpts) } +// AccumulatedReward is a free data retrieval call binding the contract method 0x80fad325. +// +// Solidity: function accumulatedReward() view returns(uint128) +func (_TaikoL2 *TaikoL2Caller) AccumulatedReward(opts *bind.CallOpts) (*big.Int, error) { + var out []interface{} + err := _TaikoL2.contract.Call(opts, &out, "accumulatedReward") + + if err != nil { + return *new(*big.Int), err + } + + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) + + return out0, err + +} + +// AccumulatedReward is a free data retrieval call binding the contract method 0x80fad325. +// +// Solidity: function accumulatedReward() view returns(uint128) +func (_TaikoL2 *TaikoL2Session) AccumulatedReward() (*big.Int, error) { + return _TaikoL2.Contract.AccumulatedReward(&_TaikoL2.CallOpts) +} + +// AccumulatedReward is a free data retrieval call binding the contract method 0x80fad325. +// +// Solidity: function accumulatedReward() view returns(uint128) +func (_TaikoL2 *TaikoL2CallerSession) AccumulatedReward() (*big.Int, error) { + return _TaikoL2.Contract.AccumulatedReward(&_TaikoL2.CallOpts) +} + // AddressManager is a free data retrieval call binding the contract method 0x3ab76e9f. // // Solidity: function addressManager() view returns(address) @@ -281,49 +350,49 @@ func (_TaikoL2 *TaikoL2CallerSession) AddressManager() (common.Address, error) { return _TaikoL2.Contract.AddressManager(&_TaikoL2.CallOpts) } -// CalcEIP1559Config is a free data retrieval call binding the contract method 0x06becb55. +// AvgGasUsed is a free data retrieval call binding the contract method 0x6d6372c4. // -// Solidity: function calcEIP1559Config(uint64 basefee, uint32 gasIssuedPerSecond, uint64 gasExcessMax, uint64 gasTarget, uint64 ratio2x1x) pure returns((uint128,uint128,uint32,uint64) config) -func (_TaikoL2 *TaikoL2Caller) CalcEIP1559Config(opts *bind.CallOpts, basefee uint64, gasIssuedPerSecond uint32, gasExcessMax uint64, gasTarget uint64, ratio2x1x uint64) (TaikoL2EIP1559Config, error) { +// Solidity: function avgGasUsed() view returns(uint32) +func (_TaikoL2 *TaikoL2Caller) AvgGasUsed(opts *bind.CallOpts) (uint32, error) { var out []interface{} - err := _TaikoL2.contract.Call(opts, &out, "calcEIP1559Config", basefee, gasIssuedPerSecond, gasExcessMax, gasTarget, ratio2x1x) + err := _TaikoL2.contract.Call(opts, &out, "avgGasUsed") if err != nil { - return *new(TaikoL2EIP1559Config), err + return *new(uint32), err } - out0 := *abi.ConvertType(out[0], new(TaikoL2EIP1559Config)).(*TaikoL2EIP1559Config) + out0 := *abi.ConvertType(out[0], new(uint32)).(*uint32) return out0, err } -// CalcEIP1559Config is a free data retrieval call binding the contract method 0x06becb55. +// AvgGasUsed is a free data retrieval call binding the contract method 0x6d6372c4. // -// Solidity: function calcEIP1559Config(uint64 basefee, uint32 gasIssuedPerSecond, uint64 gasExcessMax, uint64 gasTarget, uint64 ratio2x1x) pure returns((uint128,uint128,uint32,uint64) config) -func (_TaikoL2 *TaikoL2Session) CalcEIP1559Config(basefee uint64, gasIssuedPerSecond uint32, gasExcessMax uint64, gasTarget uint64, ratio2x1x uint64) (TaikoL2EIP1559Config, error) { - return _TaikoL2.Contract.CalcEIP1559Config(&_TaikoL2.CallOpts, basefee, gasIssuedPerSecond, gasExcessMax, gasTarget, ratio2x1x) +// Solidity: function avgGasUsed() view returns(uint32) +func (_TaikoL2 *TaikoL2Session) AvgGasUsed() (uint32, error) { + return _TaikoL2.Contract.AvgGasUsed(&_TaikoL2.CallOpts) } -// CalcEIP1559Config is a free data retrieval call binding the contract method 0x06becb55. +// AvgGasUsed is a free data retrieval call binding the contract method 0x6d6372c4. // -// Solidity: function calcEIP1559Config(uint64 basefee, uint32 gasIssuedPerSecond, uint64 gasExcessMax, uint64 gasTarget, uint64 ratio2x1x) pure returns((uint128,uint128,uint32,uint64) config) -func (_TaikoL2 *TaikoL2CallerSession) CalcEIP1559Config(basefee uint64, gasIssuedPerSecond uint32, gasExcessMax uint64, gasTarget uint64, ratio2x1x uint64) (TaikoL2EIP1559Config, error) { - return _TaikoL2.Contract.CalcEIP1559Config(&_TaikoL2.CallOpts, basefee, gasIssuedPerSecond, gasExcessMax, gasTarget, ratio2x1x) +// Solidity: function avgGasUsed() view returns(uint32) +func (_TaikoL2 *TaikoL2CallerSession) AvgGasUsed() (uint32, error) { + return _TaikoL2.Contract.AvgGasUsed(&_TaikoL2.CallOpts) } // GasExcess is a free data retrieval call binding the contract method 0xf535bd56. // -// Solidity: function gasExcess() view returns(uint64) -func (_TaikoL2 *TaikoL2Caller) GasExcess(opts *bind.CallOpts) (uint64, error) { +// Solidity: function gasExcess() view returns(uint128) +func (_TaikoL2 *TaikoL2Caller) GasExcess(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _TaikoL2.contract.Call(opts, &out, "gasExcess") if err != nil { - return *new(uint64), err + return *new(*big.Int), err } - out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err @@ -331,24 +400,24 @@ func (_TaikoL2 *TaikoL2Caller) GasExcess(opts *bind.CallOpts) (uint64, error) { // GasExcess is a free data retrieval call binding the contract method 0xf535bd56. // -// Solidity: function gasExcess() view returns(uint64) -func (_TaikoL2 *TaikoL2Session) GasExcess() (uint64, error) { +// Solidity: function gasExcess() view returns(uint128) +func (_TaikoL2 *TaikoL2Session) GasExcess() (*big.Int, error) { return _TaikoL2.Contract.GasExcess(&_TaikoL2.CallOpts) } // GasExcess is a free data retrieval call binding the contract method 0xf535bd56. // -// Solidity: function gasExcess() view returns(uint64) -func (_TaikoL2 *TaikoL2CallerSession) GasExcess() (uint64, error) { +// Solidity: function gasExcess() view returns(uint128) +func (_TaikoL2 *TaikoL2CallerSession) GasExcess() (*big.Int, error) { return _TaikoL2.Contract.GasExcess(&_TaikoL2.CallOpts) } // GetBasefee is a free data retrieval call binding the contract method 0xa7e022d1. // -// Solidity: function getBasefee(uint64 timeSinceParent, uint32 parentGasUsed) view returns(uint256 _basefee) -func (_TaikoL2 *TaikoL2Caller) GetBasefee(opts *bind.CallOpts, timeSinceParent uint64, parentGasUsed uint32) (*big.Int, error) { +// Solidity: function getBasefee(uint64 l1Height, uint32 parentGasUsed) view returns(uint256 basefee) +func (_TaikoL2 *TaikoL2Caller) GetBasefee(opts *bind.CallOpts, l1Height uint64, parentGasUsed uint32) (*big.Int, error) { var out []interface{} - err := _TaikoL2.contract.Call(opts, &out, "getBasefee", timeSinceParent, parentGasUsed) + err := _TaikoL2.contract.Call(opts, &out, "getBasefee", l1Height, parentGasUsed) if err != nil { return *new(*big.Int), err @@ -362,16 +431,16 @@ func (_TaikoL2 *TaikoL2Caller) GetBasefee(opts *bind.CallOpts, timeSinceParent u // GetBasefee is a free data retrieval call binding the contract method 0xa7e022d1. // -// Solidity: function getBasefee(uint64 timeSinceParent, uint32 parentGasUsed) view returns(uint256 _basefee) -func (_TaikoL2 *TaikoL2Session) GetBasefee(timeSinceParent uint64, parentGasUsed uint32) (*big.Int, error) { - return _TaikoL2.Contract.GetBasefee(&_TaikoL2.CallOpts, timeSinceParent, parentGasUsed) +// Solidity: function getBasefee(uint64 l1Height, uint32 parentGasUsed) view returns(uint256 basefee) +func (_TaikoL2 *TaikoL2Session) GetBasefee(l1Height uint64, parentGasUsed uint32) (*big.Int, error) { + return _TaikoL2.Contract.GetBasefee(&_TaikoL2.CallOpts, l1Height, parentGasUsed) } // GetBasefee is a free data retrieval call binding the contract method 0xa7e022d1. // -// Solidity: function getBasefee(uint64 timeSinceParent, uint32 parentGasUsed) view returns(uint256 _basefee) -func (_TaikoL2 *TaikoL2CallerSession) GetBasefee(timeSinceParent uint64, parentGasUsed uint32) (*big.Int, error) { - return _TaikoL2.Contract.GetBasefee(&_TaikoL2.CallOpts, timeSinceParent, parentGasUsed) +// Solidity: function getBasefee(uint64 l1Height, uint32 parentGasUsed) view returns(uint256 basefee) +func (_TaikoL2 *TaikoL2CallerSession) GetBasefee(l1Height uint64, parentGasUsed uint32) (*big.Int, error) { + return _TaikoL2.Contract.GetBasefee(&_TaikoL2.CallOpts, l1Height, parentGasUsed) } // GetBlockHash is a free data retrieval call binding the contract method 0x23ac7136. @@ -405,97 +474,97 @@ func (_TaikoL2 *TaikoL2CallerSession) GetBlockHash(blockId uint64) ([32]byte, er return _TaikoL2.Contract.GetBlockHash(&_TaikoL2.CallOpts, blockId) } -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. +// GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. // -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_TaikoL2 *TaikoL2Caller) GetCrossChainBlockHash(opts *bind.CallOpts, blockId uint64) ([32]byte, error) { +// Solidity: function getConfig() pure returns((uint64,uint256,uint256,uint128,uint8) config) +func (_TaikoL2 *TaikoL2Caller) GetConfig(opts *bind.CallOpts) (TaikoL2Config, error) { var out []interface{} - err := _TaikoL2.contract.Call(opts, &out, "getCrossChainBlockHash", blockId) + err := _TaikoL2.contract.Call(opts, &out, "getConfig") if err != nil { - return *new([32]byte), err + return *new(TaikoL2Config), err } - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + out0 := *abi.ConvertType(out[0], new(TaikoL2Config)).(*TaikoL2Config) return out0, err } -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. +// GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. // -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_TaikoL2 *TaikoL2Session) GetCrossChainBlockHash(blockId uint64) ([32]byte, error) { - return _TaikoL2.Contract.GetCrossChainBlockHash(&_TaikoL2.CallOpts, blockId) +// Solidity: function getConfig() pure returns((uint64,uint256,uint256,uint128,uint8) config) +func (_TaikoL2 *TaikoL2Session) GetConfig() (TaikoL2Config, error) { + return _TaikoL2.Contract.GetConfig(&_TaikoL2.CallOpts) } -// GetCrossChainBlockHash is a free data retrieval call binding the contract method 0xbdd6bc36. +// GetConfig is a free data retrieval call binding the contract method 0xc3f909d4. // -// Solidity: function getCrossChainBlockHash(uint64 blockId) view returns(bytes32) -func (_TaikoL2 *TaikoL2CallerSession) GetCrossChainBlockHash(blockId uint64) ([32]byte, error) { - return _TaikoL2.Contract.GetCrossChainBlockHash(&_TaikoL2.CallOpts, blockId) +// Solidity: function getConfig() pure returns((uint64,uint256,uint256,uint128,uint8) config) +func (_TaikoL2 *TaikoL2CallerSession) GetConfig() (TaikoL2Config, error) { + return _TaikoL2.Contract.GetConfig(&_TaikoL2.CallOpts) } -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. // -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_TaikoL2 *TaikoL2Caller) GetCrossChainSignalRoot(opts *bind.CallOpts, blockId uint64) ([32]byte, error) { +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32)) +func (_TaikoL2 *TaikoL2Caller) GetSyncedSnippet(opts *bind.CallOpts, blockId uint64) (ICrossChainSyncSnippet, error) { var out []interface{} - err := _TaikoL2.contract.Call(opts, &out, "getCrossChainSignalRoot", blockId) + err := _TaikoL2.contract.Call(opts, &out, "getSyncedSnippet", blockId) if err != nil { - return *new([32]byte), err + return *new(ICrossChainSyncSnippet), err } - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + out0 := *abi.ConvertType(out[0], new(ICrossChainSyncSnippet)).(*ICrossChainSyncSnippet) return out0, err } -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. // -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_TaikoL2 *TaikoL2Session) GetCrossChainSignalRoot(blockId uint64) ([32]byte, error) { - return _TaikoL2.Contract.GetCrossChainSignalRoot(&_TaikoL2.CallOpts, blockId) +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32)) +func (_TaikoL2 *TaikoL2Session) GetSyncedSnippet(blockId uint64) (ICrossChainSyncSnippet, error) { + return _TaikoL2.Contract.GetSyncedSnippet(&_TaikoL2.CallOpts, blockId) } -// GetCrossChainSignalRoot is a free data retrieval call binding the contract method 0x0599d294. +// GetSyncedSnippet is a free data retrieval call binding the contract method 0x8cfb0459. // -// Solidity: function getCrossChainSignalRoot(uint64 blockId) view returns(bytes32) -func (_TaikoL2 *TaikoL2CallerSession) GetCrossChainSignalRoot(blockId uint64) ([32]byte, error) { - return _TaikoL2.Contract.GetCrossChainSignalRoot(&_TaikoL2.CallOpts, blockId) +// Solidity: function getSyncedSnippet(uint64 blockId) view returns((bytes32,bytes32)) +func (_TaikoL2 *TaikoL2CallerSession) GetSyncedSnippet(blockId uint64) (ICrossChainSyncSnippet, error) { + return _TaikoL2.Contract.GetSyncedSnippet(&_TaikoL2.CallOpts, blockId) } -// GetEIP1559Config is a free data retrieval call binding the contract method 0x4e755573. +// L2Hashes is a free data retrieval call binding the contract method 0x8551f41e. // -// Solidity: function getEIP1559Config() pure returns((uint128,uint128,uint32,uint64) config) -func (_TaikoL2 *TaikoL2Caller) GetEIP1559Config(opts *bind.CallOpts) (TaikoL2EIP1559Config, error) { +// Solidity: function l2Hashes(uint256 blockId) view returns(bytes32 blockHash) +func (_TaikoL2 *TaikoL2Caller) L2Hashes(opts *bind.CallOpts, blockId *big.Int) ([32]byte, error) { var out []interface{} - err := _TaikoL2.contract.Call(opts, &out, "getEIP1559Config") + err := _TaikoL2.contract.Call(opts, &out, "l2Hashes", blockId) if err != nil { - return *new(TaikoL2EIP1559Config), err + return *new([32]byte), err } - out0 := *abi.ConvertType(out[0], new(TaikoL2EIP1559Config)).(*TaikoL2EIP1559Config) + out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) return out0, err } -// GetEIP1559Config is a free data retrieval call binding the contract method 0x4e755573. +// L2Hashes is a free data retrieval call binding the contract method 0x8551f41e. // -// Solidity: function getEIP1559Config() pure returns((uint128,uint128,uint32,uint64) config) -func (_TaikoL2 *TaikoL2Session) GetEIP1559Config() (TaikoL2EIP1559Config, error) { - return _TaikoL2.Contract.GetEIP1559Config(&_TaikoL2.CallOpts) +// Solidity: function l2Hashes(uint256 blockId) view returns(bytes32 blockHash) +func (_TaikoL2 *TaikoL2Session) L2Hashes(blockId *big.Int) ([32]byte, error) { + return _TaikoL2.Contract.L2Hashes(&_TaikoL2.CallOpts, blockId) } -// GetEIP1559Config is a free data retrieval call binding the contract method 0x4e755573. +// L2Hashes is a free data retrieval call binding the contract method 0x8551f41e. // -// Solidity: function getEIP1559Config() pure returns((uint128,uint128,uint32,uint64) config) -func (_TaikoL2 *TaikoL2CallerSession) GetEIP1559Config() (TaikoL2EIP1559Config, error) { - return _TaikoL2.Contract.GetEIP1559Config(&_TaikoL2.CallOpts) +// Solidity: function l2Hashes(uint256 blockId) view returns(bytes32 blockHash) +func (_TaikoL2 *TaikoL2CallerSession) L2Hashes(blockId *big.Int) ([32]byte, error) { + return _TaikoL2.Contract.L2Hashes(&_TaikoL2.CallOpts, blockId) } // LatestSyncedL1Height is a free data retrieval call binding the contract method 0xc7b96908. @@ -560,35 +629,35 @@ func (_TaikoL2 *TaikoL2CallerSession) Owner() (common.Address, error) { return _TaikoL2.Contract.Owner(&_TaikoL2.CallOpts) } -// ParentTimestamp is a free data retrieval call binding the contract method 0x539b8ade. +// ParentProposer is a free data retrieval call binding the contract method 0xfca19902. // -// Solidity: function parentTimestamp() view returns(uint64) -func (_TaikoL2 *TaikoL2Caller) ParentTimestamp(opts *bind.CallOpts) (uint64, error) { +// Solidity: function parentProposer() view returns(address) +func (_TaikoL2 *TaikoL2Caller) ParentProposer(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _TaikoL2.contract.Call(opts, &out, "parentTimestamp") + err := _TaikoL2.contract.Call(opts, &out, "parentProposer") if err != nil { - return *new(uint64), err + return *new(common.Address), err } - out0 := *abi.ConvertType(out[0], new(uint64)).(*uint64) + out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) return out0, err } -// ParentTimestamp is a free data retrieval call binding the contract method 0x539b8ade. +// ParentProposer is a free data retrieval call binding the contract method 0xfca19902. // -// Solidity: function parentTimestamp() view returns(uint64) -func (_TaikoL2 *TaikoL2Session) ParentTimestamp() (uint64, error) { - return _TaikoL2.Contract.ParentTimestamp(&_TaikoL2.CallOpts) +// Solidity: function parentProposer() view returns(address) +func (_TaikoL2 *TaikoL2Session) ParentProposer() (common.Address, error) { + return _TaikoL2.Contract.ParentProposer(&_TaikoL2.CallOpts) } -// ParentTimestamp is a free data retrieval call binding the contract method 0x539b8ade. +// ParentProposer is a free data retrieval call binding the contract method 0xfca19902. // -// Solidity: function parentTimestamp() view returns(uint64) -func (_TaikoL2 *TaikoL2CallerSession) ParentTimestamp() (uint64, error) { - return _TaikoL2.Contract.ParentTimestamp(&_TaikoL2.CallOpts) +// Solidity: function parentProposer() view returns(address) +func (_TaikoL2 *TaikoL2CallerSession) ParentProposer() (common.Address, error) { + return _TaikoL2.Contract.ParentProposer(&_TaikoL2.CallOpts) } // PublicInputHash is a free data retrieval call binding the contract method 0xdac5df78. @@ -734,46 +803,91 @@ func (_TaikoL2 *TaikoL2CallerSession) SignAnchor(digest [32]byte, k uint8) (stru return _TaikoL2.Contract.SignAnchor(&_TaikoL2.CallOpts, digest, k) } +// Snippets is a free data retrieval call binding the contract method 0xe8e2c5fb. +// +// Solidity: function snippets(uint256 l1height) view returns(bytes32 blockHash, bytes32 signalRoot) +func (_TaikoL2 *TaikoL2Caller) Snippets(opts *bind.CallOpts, l1height *big.Int) (struct { + BlockHash [32]byte + SignalRoot [32]byte +}, error) { + var out []interface{} + err := _TaikoL2.contract.Call(opts, &out, "snippets", l1height) + + outstruct := new(struct { + BlockHash [32]byte + SignalRoot [32]byte + }) + if err != nil { + return *outstruct, err + } + + outstruct.BlockHash = *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) + outstruct.SignalRoot = *abi.ConvertType(out[1], new([32]byte)).(*[32]byte) + + return *outstruct, err + +} + +// Snippets is a free data retrieval call binding the contract method 0xe8e2c5fb. +// +// Solidity: function snippets(uint256 l1height) view returns(bytes32 blockHash, bytes32 signalRoot) +func (_TaikoL2 *TaikoL2Session) Snippets(l1height *big.Int) (struct { + BlockHash [32]byte + SignalRoot [32]byte +}, error) { + return _TaikoL2.Contract.Snippets(&_TaikoL2.CallOpts, l1height) +} + +// Snippets is a free data retrieval call binding the contract method 0xe8e2c5fb. +// +// Solidity: function snippets(uint256 l1height) view returns(bytes32 blockHash, bytes32 signalRoot) +func (_TaikoL2 *TaikoL2CallerSession) Snippets(l1height *big.Int) (struct { + BlockHash [32]byte + SignalRoot [32]byte +}, error) { + return _TaikoL2.Contract.Snippets(&_TaikoL2.CallOpts, l1height) +} + // Anchor is a paid mutator transaction binding the contract method 0xda69d3db. // -// Solidity: function anchor(bytes32 l1Hash, bytes32 l1SignalRoot, uint64 l1Height, uint32 parentGasUsed) returns() -func (_TaikoL2 *TaikoL2Transactor) Anchor(opts *bind.TransactOpts, l1Hash [32]byte, l1SignalRoot [32]byte, l1Height uint64, parentGasUsed uint32) (*types.Transaction, error) { - return _TaikoL2.contract.Transact(opts, "anchor", l1Hash, l1SignalRoot, l1Height, parentGasUsed) +// Solidity: function anchor(bytes32 l1BlockHash, bytes32 l1SignalRoot, uint64 l1Height, uint32 parentGasUsed) returns() +func (_TaikoL2 *TaikoL2Transactor) Anchor(opts *bind.TransactOpts, l1BlockHash [32]byte, l1SignalRoot [32]byte, l1Height uint64, parentGasUsed uint32) (*types.Transaction, error) { + return _TaikoL2.contract.Transact(opts, "anchor", l1BlockHash, l1SignalRoot, l1Height, parentGasUsed) } // Anchor is a paid mutator transaction binding the contract method 0xda69d3db. // -// Solidity: function anchor(bytes32 l1Hash, bytes32 l1SignalRoot, uint64 l1Height, uint32 parentGasUsed) returns() -func (_TaikoL2 *TaikoL2Session) Anchor(l1Hash [32]byte, l1SignalRoot [32]byte, l1Height uint64, parentGasUsed uint32) (*types.Transaction, error) { - return _TaikoL2.Contract.Anchor(&_TaikoL2.TransactOpts, l1Hash, l1SignalRoot, l1Height, parentGasUsed) +// Solidity: function anchor(bytes32 l1BlockHash, bytes32 l1SignalRoot, uint64 l1Height, uint32 parentGasUsed) returns() +func (_TaikoL2 *TaikoL2Session) Anchor(l1BlockHash [32]byte, l1SignalRoot [32]byte, l1Height uint64, parentGasUsed uint32) (*types.Transaction, error) { + return _TaikoL2.Contract.Anchor(&_TaikoL2.TransactOpts, l1BlockHash, l1SignalRoot, l1Height, parentGasUsed) } // Anchor is a paid mutator transaction binding the contract method 0xda69d3db. // -// Solidity: function anchor(bytes32 l1Hash, bytes32 l1SignalRoot, uint64 l1Height, uint32 parentGasUsed) returns() -func (_TaikoL2 *TaikoL2TransactorSession) Anchor(l1Hash [32]byte, l1SignalRoot [32]byte, l1Height uint64, parentGasUsed uint32) (*types.Transaction, error) { - return _TaikoL2.Contract.Anchor(&_TaikoL2.TransactOpts, l1Hash, l1SignalRoot, l1Height, parentGasUsed) +// Solidity: function anchor(bytes32 l1BlockHash, bytes32 l1SignalRoot, uint64 l1Height, uint32 parentGasUsed) returns() +func (_TaikoL2 *TaikoL2TransactorSession) Anchor(l1BlockHash [32]byte, l1SignalRoot [32]byte, l1Height uint64, parentGasUsed uint32) (*types.Transaction, error) { + return _TaikoL2.Contract.Anchor(&_TaikoL2.TransactOpts, l1BlockHash, l1SignalRoot, l1Height, parentGasUsed) } -// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// Init is a paid mutator transaction binding the contract method 0xcce03bf3. // -// Solidity: function init(address _addressManager) returns() -func (_TaikoL2 *TaikoL2Transactor) Init(opts *bind.TransactOpts, _addressManager common.Address) (*types.Transaction, error) { - return _TaikoL2.contract.Transact(opts, "init", _addressManager) +// Solidity: function init(address _addressManager, uint128 _gasExcess) returns() +func (_TaikoL2 *TaikoL2Transactor) Init(opts *bind.TransactOpts, _addressManager common.Address, _gasExcess *big.Int) (*types.Transaction, error) { + return _TaikoL2.contract.Transact(opts, "init", _addressManager, _gasExcess) } -// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// Init is a paid mutator transaction binding the contract method 0xcce03bf3. // -// Solidity: function init(address _addressManager) returns() -func (_TaikoL2 *TaikoL2Session) Init(_addressManager common.Address) (*types.Transaction, error) { - return _TaikoL2.Contract.Init(&_TaikoL2.TransactOpts, _addressManager) +// Solidity: function init(address _addressManager, uint128 _gasExcess) returns() +func (_TaikoL2 *TaikoL2Session) Init(_addressManager common.Address, _gasExcess *big.Int) (*types.Transaction, error) { + return _TaikoL2.Contract.Init(&_TaikoL2.TransactOpts, _addressManager, _gasExcess) } -// Init is a paid mutator transaction binding the contract method 0x19ab453c. +// Init is a paid mutator transaction binding the contract method 0xcce03bf3. // -// Solidity: function init(address _addressManager) returns() -func (_TaikoL2 *TaikoL2TransactorSession) Init(_addressManager common.Address) (*types.Transaction, error) { - return _TaikoL2.Contract.Init(&_TaikoL2.TransactOpts, _addressManager) +// Solidity: function init(address _addressManager, uint128 _gasExcess) returns() +func (_TaikoL2 *TaikoL2TransactorSession) Init(_addressManager common.Address, _gasExcess *big.Int) (*types.Transaction, error) { + return _TaikoL2.Contract.Init(&_TaikoL2.TransactOpts, _addressManager, _gasExcess) } // RenounceOwnership is a paid mutator transaction binding the contract method 0x715018a6. @@ -797,27 +911,6 @@ func (_TaikoL2 *TaikoL2TransactorSession) RenounceOwnership() (*types.Transactio return _TaikoL2.Contract.RenounceOwnership(&_TaikoL2.TransactOpts) } -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_TaikoL2 *TaikoL2Transactor) SetAddressManager(opts *bind.TransactOpts, newAddressManager common.Address) (*types.Transaction, error) { - return _TaikoL2.contract.Transact(opts, "setAddressManager", newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_TaikoL2 *TaikoL2Session) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _TaikoL2.Contract.SetAddressManager(&_TaikoL2.TransactOpts, newAddressManager) -} - -// SetAddressManager is a paid mutator transaction binding the contract method 0x0652b57a. -// -// Solidity: function setAddressManager(address newAddressManager) returns() -func (_TaikoL2 *TaikoL2TransactorSession) SetAddressManager(newAddressManager common.Address) (*types.Transaction, error) { - return _TaikoL2.Contract.SetAddressManager(&_TaikoL2.TransactOpts, newAddressManager) -} - // TransferOwnership is a paid mutator transaction binding the contract method 0xf2fde38b. // // Solidity: function transferOwnership(address newOwner) returns() @@ -839,150 +932,6 @@ func (_TaikoL2 *TaikoL2TransactorSession) TransferOwnership(newOwner common.Addr return _TaikoL2.Contract.TransferOwnership(&_TaikoL2.TransactOpts, newOwner) } -// TaikoL2AddressManagerChangedIterator is returned from FilterAddressManagerChanged and is used to iterate over the raw logs and unpacked data for AddressManagerChanged events raised by the TaikoL2 contract. -type TaikoL2AddressManagerChangedIterator struct { - Event *TaikoL2AddressManagerChanged // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *TaikoL2AddressManagerChangedIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(TaikoL2AddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(TaikoL2AddressManagerChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *TaikoL2AddressManagerChangedIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *TaikoL2AddressManagerChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// TaikoL2AddressManagerChanged represents a AddressManagerChanged event raised by the TaikoL2 contract. -type TaikoL2AddressManagerChanged struct { - AddressManager common.Address - Raw types.Log // Blockchain specific contextual infos -} - -// FilterAddressManagerChanged is a free log retrieval operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_TaikoL2 *TaikoL2Filterer) FilterAddressManagerChanged(opts *bind.FilterOpts, addressManager []common.Address) (*TaikoL2AddressManagerChangedIterator, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _TaikoL2.contract.FilterLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return &TaikoL2AddressManagerChangedIterator{contract: _TaikoL2.contract, event: "AddressManagerChanged", logs: logs, sub: sub}, nil -} - -// WatchAddressManagerChanged is a free log subscription operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_TaikoL2 *TaikoL2Filterer) WatchAddressManagerChanged(opts *bind.WatchOpts, sink chan<- *TaikoL2AddressManagerChanged, addressManager []common.Address) (event.Subscription, error) { - - var addressManagerRule []interface{} - for _, addressManagerItem := range addressManager { - addressManagerRule = append(addressManagerRule, addressManagerItem) - } - - logs, sub, err := _TaikoL2.contract.WatchLogs(opts, "AddressManagerChanged", addressManagerRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(TaikoL2AddressManagerChanged) - if err := _TaikoL2.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseAddressManagerChanged is a log parse operation binding the contract event 0x399ded90cb5ed8d89ef7e76ff4af65c373f06d3bf5d7eef55f4228e7b702a18b. -// -// Solidity: event AddressManagerChanged(address indexed addressManager) -func (_TaikoL2 *TaikoL2Filterer) ParseAddressManagerChanged(log types.Log) (*TaikoL2AddressManagerChanged, error) { - event := new(TaikoL2AddressManagerChanged) - if err := _TaikoL2.contract.UnpackLog(event, "AddressManagerChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - // TaikoL2AnchoredIterator is returned from FilterAnchored and is used to iterate over the raw logs and unpacked data for Anchored events raised by the TaikoL2 contract. type TaikoL2AnchoredIterator struct { Event *TaikoL2Anchored // Event containing the contract specifics and raw log @@ -1052,20 +1001,15 @@ func (it *TaikoL2AnchoredIterator) Close() error { // TaikoL2Anchored represents a Anchored event raised by the TaikoL2 contract. type TaikoL2Anchored struct { - Number uint64 - Basefee uint64 - Gaslimit uint32 - Timestamp uint64 - ParentHash [32]byte - Prevrandao *big.Int - Coinbase common.Address - Chainid uint64 - Raw types.Log // Blockchain specific contextual infos + ParentHash [32]byte + GasExcess *big.Int + BlockReward *big.Int + Raw types.Log // Blockchain specific contextual infos } -// FilterAnchored is a free log retrieval operation binding the contract event 0xf0fde5abf5476e9fb590d1e786d07c1ceee1d3c80cce3fafe0478e203cf5184e. +// FilterAnchored is a free log retrieval operation binding the contract event 0xf3a1ab67cc789a3e3961363ffd80ff59c13f394ff689b2fb85531a45dd0aa80d. // -// Solidity: event Anchored(uint64 number, uint64 basefee, uint32 gaslimit, uint64 timestamp, bytes32 parentHash, uint256 prevrandao, address coinbase, uint64 chainid) +// Solidity: event Anchored(bytes32 parentHash, uint128 gasExcess, uint128 blockReward) func (_TaikoL2 *TaikoL2Filterer) FilterAnchored(opts *bind.FilterOpts) (*TaikoL2AnchoredIterator, error) { logs, sub, err := _TaikoL2.contract.FilterLogs(opts, "Anchored") @@ -1075,9 +1019,9 @@ func (_TaikoL2 *TaikoL2Filterer) FilterAnchored(opts *bind.FilterOpts) (*TaikoL2 return &TaikoL2AnchoredIterator{contract: _TaikoL2.contract, event: "Anchored", logs: logs, sub: sub}, nil } -// WatchAnchored is a free log subscription operation binding the contract event 0xf0fde5abf5476e9fb590d1e786d07c1ceee1d3c80cce3fafe0478e203cf5184e. +// WatchAnchored is a free log subscription operation binding the contract event 0xf3a1ab67cc789a3e3961363ffd80ff59c13f394ff689b2fb85531a45dd0aa80d. // -// Solidity: event Anchored(uint64 number, uint64 basefee, uint32 gaslimit, uint64 timestamp, bytes32 parentHash, uint256 prevrandao, address coinbase, uint64 chainid) +// Solidity: event Anchored(bytes32 parentHash, uint128 gasExcess, uint128 blockReward) func (_TaikoL2 *TaikoL2Filterer) WatchAnchored(opts *bind.WatchOpts, sink chan<- *TaikoL2Anchored) (event.Subscription, error) { logs, sub, err := _TaikoL2.contract.WatchLogs(opts, "Anchored") @@ -1112,9 +1056,9 @@ func (_TaikoL2 *TaikoL2Filterer) WatchAnchored(opts *bind.WatchOpts, sink chan<- }), nil } -// ParseAnchored is a log parse operation binding the contract event 0xf0fde5abf5476e9fb590d1e786d07c1ceee1d3c80cce3fafe0478e203cf5184e. +// ParseAnchored is a log parse operation binding the contract event 0xf3a1ab67cc789a3e3961363ffd80ff59c13f394ff689b2fb85531a45dd0aa80d. // -// Solidity: event Anchored(uint64 number, uint64 basefee, uint32 gaslimit, uint64 timestamp, bytes32 parentHash, uint256 prevrandao, address coinbase, uint64 chainid) +// Solidity: event Anchored(bytes32 parentHash, uint128 gasExcess, uint128 blockReward) func (_TaikoL2 *TaikoL2Filterer) ParseAnchored(log types.Log) (*TaikoL2Anchored, error) { event := new(TaikoL2Anchored) if err := _TaikoL2.contract.UnpackLog(event, "Anchored", log); err != nil { diff --git a/packages/relayer/bridge.go b/packages/relayer/bridge.go index 7f2b40da95b..7b555b7fc8d 100644 --- a/packages/relayer/bridge.go +++ b/packages/relayer/bridge.go @@ -1,8 +1,6 @@ package relayer import ( - "math/big" - "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/event" @@ -16,9 +14,9 @@ type Bridge interface { msgHash [][32]byte, ) (event.Subscription, error) FilterMessageSent(opts *bind.FilterOpts, msgHash [][32]byte) (*bridge.BridgeMessageSentIterator, error) - GetMessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error) + MessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error) ProcessMessage(opts *bind.TransactOpts, message bridge.IBridgeMessage, proof []byte) (*types.Transaction, error) - IsMessageReceived(opts *bind.CallOpts, msgHash [32]byte, srcChainId *big.Int, proof []byte) (bool, error) // nolint + ProveMessageReceived(opts *bind.CallOpts, message bridge.IBridgeMessage, proof []byte) (bool, error) FilterMessageStatusChanged( opts *bind.FilterOpts, msgHash [][32]byte, diff --git a/packages/relayer/header_syncer.go b/packages/relayer/header_syncer.go index 662e54abb90..3b52ae8eacd 100644 --- a/packages/relayer/header_syncer.go +++ b/packages/relayer/header_syncer.go @@ -2,8 +2,12 @@ package relayer import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/taikoxyz/taiko-mono/packages/relayer/bindings/icrosschainsync" ) type HeaderSyncer interface { - GetCrossChainBlockHash(opts *bind.CallOpts, blockId uint64) ([32]byte, error) + GetSyncedSnippet( + opts *bind.CallOpts, + blockId uint64, + ) (icrosschainsync.ICrossChainSyncSnippet, error) } diff --git a/packages/relayer/indexer/handle_event.go b/packages/relayer/indexer/handle_event.go index 8052cce0d3c..5620740ebe8 100644 --- a/packages/relayer/indexer/handle_event.go +++ b/packages/relayer/indexer/handle_event.go @@ -110,7 +110,7 @@ func (i *Indexer) eventStatusFromMsgHash( defer cancel() - messageStatus, err := i.destBridge.GetMessageStatus(&bind.CallOpts{ + messageStatus, err := i.destBridge.MessageStatus(&bind.CallOpts{ Context: ctx, }, signal) if err != nil { diff --git a/packages/relayer/mock/bridge.go b/packages/relayer/mock/bridge.go index 5b198241db9..be4e7317aad 100644 --- a/packages/relayer/mock/bridge.go +++ b/packages/relayer/mock/bridge.go @@ -15,6 +15,7 @@ import ( var ( SuccessMsgHash = [32]byte{0x1} + SuccessId = big.NewInt(1) FailSignal = [32]byte{0x2} ) @@ -121,7 +122,7 @@ func (b *Bridge) FilterMessageStatusChanged( return &bridge.BridgeMessageStatusChangedIterator{}, nil } -func (b *Bridge) GetMessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error) { +func (b *Bridge) MessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error) { if msgHash == SuccessMsgHash { return uint8(relayer.EventStatusNew), nil } @@ -141,8 +142,8 @@ func (b *Bridge) ProcessMessage( return ProcessMessageTx, nil } -func (b *Bridge) IsMessageReceived(opts *bind.CallOpts, signal [32]byte, srcChainId *big.Int, proof []byte) (bool, error) { // nolint - if signal == SuccessMsgHash { +func (b *Bridge) ProveMessageReceived(opts *bind.CallOpts, message bridge.IBridgeMessage, proof []byte) (bool, error) { + if message.Id.Uint64() == SuccessId.Uint64() { return true, nil } diff --git a/packages/relayer/mock/header_syncer.go b/packages/relayer/mock/header_syncer.go index fe204c9b42c..a5b4688022f 100644 --- a/packages/relayer/mock/header_syncer.go +++ b/packages/relayer/mock/header_syncer.go @@ -4,17 +4,24 @@ import ( "errors" "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/taikoxyz/taiko-mono/packages/relayer/bindings/icrosschainsync" ) -var SuccessHeader = [32]byte{0x1} +var SuccessHeader = icrosschainsync.ICrossChainSyncSnippet{ + BlockHash: [32]byte{0x1}, + SignalRoot: [32]byte{0x2}, +} type HeaderSyncer struct { Fail bool } -func (h *HeaderSyncer) GetCrossChainBlockHash(opts *bind.CallOpts, blockId uint64) ([32]byte, error) { +func (h *HeaderSyncer) GetSyncedSnippet( + opts *bind.CallOpts, + blockId uint64, +) (icrosschainsync.ICrossChainSyncSnippet, error) { if h.Fail { - return [32]byte{}, errors.New("fail") + return icrosschainsync.ICrossChainSyncSnippet{}, errors.New("fail") } return SuccessHeader, nil diff --git a/packages/relayer/processor/process_message.go b/packages/relayer/processor/process_message.go index 2a0b0ceb86e..e235a9d01a1 100644 --- a/packages/relayer/processor/process_message.go +++ b/packages/relayer/processor/process_message.go @@ -39,11 +39,11 @@ func (p *Processor) eventStatusFromMsgHash( defer cancel() - messageStatus, err := p.destBridge.GetMessageStatus(&bind.CallOpts{ + messageStatus, err := p.destBridge.MessageStatus(&bind.CallOpts{ Context: ctx, }, signal) if err != nil { - return 0, errors.Wrap(err, "svc.destBridge.GetMessageStatus") + return 0, errors.Wrap(err, "svc.destBridge.MessageStatus") } eventStatus = relayer.EventStatus(messageStatus) @@ -94,7 +94,7 @@ func (p *Processor) processMessage( // get latest synced header since not every header is synced from L1 => L2, // and later blocks still have the storage trie proof from previous blocks. - latestSyncedHeader, err := p.destHeaderSyncer.GetCrossChainBlockHash(&bind.CallOpts{}, 0) + latestSyncedSnippet, err := p.destHeaderSyncer.GetSyncedSnippet(&bind.CallOpts{}, 0) if err != nil { return errors.Wrap(err, "taiko.GetSyncedHeader") } @@ -106,7 +106,13 @@ func (p *Processor) processMessage( key := hex.EncodeToString(hashed) - encodedSignalProof, err := p.prover.EncodedSignalProof(ctx, p.rpc, p.srcSignalServiceAddress, key, latestSyncedHeader) + encodedSignalProof, err := p.prover.EncodedSignalProof( + ctx, + p.rpc, + p.srcSignalServiceAddress, + key, + latestSyncedSnippet.BlockHash, + ) if err != nil { slog.Error("srcChainID: %v, destChainID: %v, txHash: %v: msgHash: %v, from: %v encountered signalProofError %v", msgBody.Event.Message.SrcChainId.String(), @@ -123,9 +129,9 @@ func (p *Processor) processMessage( // check if message is received first. if not, it will definitely fail, // so we can exit early on this one. there is most likely // an issue with the signal generation. - received, err := p.destBridge.IsMessageReceived(&bind.CallOpts{ + received, err := p.destBridge.ProveMessageReceived(&bind.CallOpts{ Context: ctx, - }, msgBody.Event.MsgHash, msgBody.Event.Message.SrcChainId, encodedSignalProof) + }, msgBody.Event.Message, encodedSignalProof) if err != nil { return errors.Wrap(err, "p.destBridge.IsMessageReceived") } @@ -181,7 +187,7 @@ func (p *Processor) processMessage( slog.Info("Mined tx", "txHash", hex.EncodeToString(tx.Hash().Bytes())) - messageStatus, err := p.destBridge.GetMessageStatus(&bind.CallOpts{}, msgBody.Event.MsgHash) + messageStatus, err := p.destBridge.MessageStatus(&bind.CallOpts{}, msgBody.Event.MsgHash) if err != nil { return errors.Wrap(err, "p.destBridge.GetMessageStatus") } diff --git a/packages/relayer/processor/process_message_test.go b/packages/relayer/processor/process_message_test.go index 42d51081155..235d40af50f 100644 --- a/packages/relayer/processor/process_message_test.go +++ b/packages/relayer/processor/process_message_test.go @@ -26,6 +26,7 @@ func Test_sendProcessMessageCall(t *testing.T) { &bridge.BridgeMessageSent{ Message: bridge.IBridgeMessage{ DestChainId: mock.MockChainID, + Id: big.NewInt(1), Fee: new(big.Int).Add(mock.ProcessMessageTx.Cost(), big.NewInt(1)), }, Raw: types.Log{ @@ -48,6 +49,7 @@ func Test_ProcessMessage_messageUnprocessable(t *testing.T) { Event: &bridge.BridgeMessageSent{ Message: bridge.IBridgeMessage{ GasLimit: big.NewInt(1), + Id: big.NewInt(1), }, Raw: types.Log{ Address: relayer.ZeroAddress, @@ -78,6 +80,7 @@ func Test_ProcessMessage_gasLimit0(t *testing.T) { Event: &bridge.BridgeMessageSent{ Message: bridge.IBridgeMessage{ GasLimit: big.NewInt(0), + Id: big.NewInt(1), }, Raw: types.Log{ Address: relayer.ZeroAddress, @@ -108,6 +111,7 @@ func Test_ProcessMessage_noChainId(t *testing.T) { Event: &bridge.BridgeMessageSent{ Message: bridge.IBridgeMessage{ GasLimit: big.NewInt(1), + Id: big.NewInt(0), }, MsgHash: mock.SuccessMsgHash, Raw: types.Log{ @@ -129,7 +133,7 @@ func Test_ProcessMessage_noChainId(t *testing.T) { } err = p.processMessage(context.Background(), msg) - assert.EqualError(t, err, "bind.NewKeyedTransactorWithChainID: no chain id specified") + assert.EqualError(t, err, "message not received") } func Test_ProcessMessage(t *testing.T) { @@ -142,6 +146,7 @@ func Test_ProcessMessage(t *testing.T) { DestChainId: mock.MockChainID, Fee: big.NewInt(1000000000), SrcChainId: mock.MockChainID, + Id: big.NewInt(1), }, MsgHash: mock.SuccessMsgHash, Raw: types.Log{ diff --git a/packages/relayer/processor/wait_header_synced.go b/packages/relayer/processor/wait_header_synced.go index 2c8465546ec..d78044f31c3 100644 --- a/packages/relayer/processor/wait_header_synced.go +++ b/packages/relayer/processor/wait_header_synced.go @@ -27,12 +27,12 @@ func (p *Processor) waitHeaderSynced(ctx context.Context, event *bridge.BridgeMe ) // get latest synced header since not every header is synced from L1 => L2, // and later blocks still have the storage trie proof from previous blocks. - latestSyncedHeader, err := p.destHeaderSyncer.GetCrossChainBlockHash(&bind.CallOpts{}, 0) + latestSyncedSnippet, err := p.destHeaderSyncer.GetSyncedSnippet(&bind.CallOpts{}, 0) if err != nil { return errors.Wrap(err, "p.destHeaderSyncer.GetCrossChainBlockHash") } - header, err := p.srcEthClient.HeaderByHash(ctx, latestSyncedHeader) + header, err := p.srcEthClient.HeaderByHash(ctx, latestSyncedSnippet.BlockHash) if err != nil { return errors.Wrap(err, "p.destHeaderSyncer.GetCrossChainBlockHash") }