Raise process gas and add tests/ (#560)

* test: expose more utilities on test deploy

* test: scaffold more transfer tests

* test: remotely-originating roundtrip test

* test: local token roundtrip test

* test: local token unapproved and insufficient balance

* test: basic prefill test

* test: prefill test w/ local token

* chore: clean unused imports

* chore: regenerate typescript for core

* bug: increase PROCESS_GAS further to better account for enqueue costs

* deploy: aug-12 increased PROCESS_GAS

* test: decrease allowed process gas to ensure buffer
buddies-main-deployment
James Prestwich 3 years ago committed by GitHub
parent 9a596e85ea
commit 9d95cab1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 39
      rust/config/1628807252805/alfajores_config.json
  2. 22
      rust/config/1628807252805/alfajores_contracts.json
  3. 77
      rust/config/1628807252805/alfajores_verification.json
  4. 12
      rust/config/1628807252805/bridge/1628807481166/alfajores_contracts.json
  5. 44
      rust/config/1628807252805/bridge/1628807481166/alfajores_verification.json
  6. 13
      rust/config/1628807252805/bridge/1628807481166/kovan_contracts.json
  7. 52
      rust/config/1628807252805/bridge/1628807481166/kovan_verification.json
  8. 8
      rust/config/1628807252805/kathy-partial.json
  9. 39
      rust/config/1628807252805/kovan_config.json
  10. 22
      rust/config/1628807252805/kovan_contracts.json
  11. 77
      rust/config/1628807252805/kovan_verification.json
  12. 3
      rust/config/1628807252805/processor-partial.json
  13. 3
      rust/config/1628807252805/relayer-partial.json
  14. 8
      rust/config/1628807252805/updater-partial.json
  15. 33
      rust/config/1628807252805/watcher-partial.json
  16. 4
      solidity/optics-core/contracts/Replica.sol
  17. 60
      solidity/optics-xapps/contracts/bridge/test/MockCore.sol
  18. 66
      typescript/optics-deploy/src/bridge/TestBridgeDeploy.ts
  19. 366
      typescript/optics-tests/test/bridge/bridge.test.ts
  20. 2
      typescript/typechain/optics-core/factories/GovernanceRouter__factory.ts
  21. 2
      typescript/typechain/optics-core/factories/Home__factory.ts
  22. 2
      typescript/typechain/optics-core/factories/Replica__factory.ts
  23. 2
      typescript/typechain/optics-core/factories/TestGovernanceRouter__factory.ts
  24. 2
      typescript/typechain/optics-core/factories/TestHome__factory.ts
  25. 2
      typescript/typechain/optics-core/factories/TestReplica__factory.ts
  26. 2
      typescript/typechain/optics-core/factories/TestXAppConnectionManager__factory.ts
  27. 2
      typescript/typechain/optics-core/factories/UpdaterManager__factory.ts
  28. 2
      typescript/typechain/optics-core/factories/XAppConnectionManager__factory.ts
  29. 164
      typescript/typechain/optics-xapps/MockCore.d.ts
  30. 2
      typescript/typechain/optics-xapps/factories/BridgeRouter__factory.ts
  31. 2
      typescript/typechain/optics-xapps/factories/BridgeToken__factory.ts
  32. 2
      typescript/typechain/optics-xapps/factories/ETHHelper__factory.ts
  33. 149
      typescript/typechain/optics-xapps/factories/MockCore__factory.ts
  34. 2
      typescript/typechain/optics-xapps/factories/PingPongRouter__factory.ts
  35. 2
      typescript/typechain/optics-xapps/factories/Replica__factory.ts
  36. 2
      typescript/typechain/optics-xapps/factories/RouterTemplate__factory.ts
  37. 2
      typescript/typechain/optics-xapps/factories/XAppConnectionManager__factory.ts

@ -0,0 +1,39 @@
{
"signers": {
"alfajores": {
"key": "",
"type": "hexKey"
},
"kovan": {
"key": "",
"type": "hexKey"
}
},
"replicas": {
"kovan": {
"address": "0xeACafFb9fBCe3d4c4C5D07AF5DFa51CcF5a348b7",
"domain": "3000",
"name": "kovan",
"rpcStyle": "ethereum",
"connection": {
"type": "http",
"url": "https://kovan.infura.io/v3/5c456d7844fa40a683e934df60534c60"
}
}
},
"home": {
"address": "0x8D09cAB9628a154d15b814113f11f19Fa8cE37A3",
"domain": "1000",
"name": "alfajores",
"rpcStyle": "ethereum",
"connection": {
"type": "http",
"url": "https://alfajores-forno.celo-testnet.org"
}
},
"tracing": {
"level": "debug",
"style": "json"
},
"db": "db_path"
}

@ -0,0 +1,22 @@
{
"upgradeBeaconController": "0x896DFD65C87D59E7C325762109936Bc3945F1863",
"xAppConnectionManager": "0x1192B3cc8f7B2c664c53b7E2432b95fE5AfE8D88",
"updaterManager": "0x5a8dBB50b1abC6E059876582d708258B3DE0aE07",
"governance": {
"implementation": "0xEbDDd78Ee024C737660Eaf6669a18Ced8FDB83c0",
"proxy": "0x264a96F5Da65BE0c360794Cf62603835b2B712D1",
"beacon": "0x4065B6937DB4C3Bc0311F38B1710eDB5F6f78054"
},
"home": {
"implementation": "0xba01d48f666f0fA5899d8f36b48DBCA81391fE06",
"proxy": "0x8D09cAB9628a154d15b814113f11f19Fa8cE37A3",
"beacon": "0xc7436ae92784087C58d2BEF31a16F0Fb3E12DD9e"
},
"replicas": {
"3000": {
"implementation": "0x3878204c2dA27b8EbB89feD25Cc6028878fEC51a",
"proxy": "0x27d8008Bb9738DFBb0E546e175efe401e914Aa93",
"beacon": "0x50dc82F72c663BFB234A643f89d67C928b86f15B"
}
}
}

@ -0,0 +1,77 @@
[
{
"name": "UpgradeBeaconController",
"address": "0x896DFD65C87D59E7C325762109936Bc3945F1863",
"constructorArguments": []
},
{
"name": "Contract Implementation",
"address": "0xba01d48f666f0fA5899d8f36b48DBCA81391fE06",
"constructorArguments": [
1000
]
},
{
"name": "Contract UpgradeBeacon",
"address": "0xc7436ae92784087C58d2BEF31a16F0Fb3E12DD9e",
"constructorArguments": [
"0xba01d48f666f0fA5899d8f36b48DBCA81391fE06",
"0x896DFD65C87D59E7C325762109936Bc3945F1863"
]
},
{
"name": "Contract Proxy",
"address": "0x8D09cAB9628a154d15b814113f11f19Fa8cE37A3",
"constructorArguments": [
"0xc7436ae92784087C58d2BEF31a16F0Fb3E12DD9e",
"0xc4d66de80000000000000000000000005a8dbb50b1abc6e059876582d708258b3de0ae07"
]
},
{
"name": "Contract Implementation",
"address": "0xEbDDd78Ee024C737660Eaf6669a18Ced8FDB83c0",
"constructorArguments": [
1000,
1
]
},
{
"name": "Contract UpgradeBeacon",
"address": "0x4065B6937DB4C3Bc0311F38B1710eDB5F6f78054",
"constructorArguments": [
"0xEbDDd78Ee024C737660Eaf6669a18Ced8FDB83c0",
"0x896DFD65C87D59E7C325762109936Bc3945F1863"
]
},
{
"name": "Contract Proxy",
"address": "0x264a96F5Da65BE0c360794Cf62603835b2B712D1",
"constructorArguments": [
"0x4065B6937DB4C3Bc0311F38B1710eDB5F6f78054",
"0x485cc9550000000000000000000000001192b3cc8f7b2c664c53b7e2432b95fe5afe8d8800000000000000000000000024f6c874f56533d9a1422e85e5c7a806ed11c036"
]
},
{
"name": "Contract Implementation",
"address": "0x3878204c2dA27b8EbB89feD25Cc6028878fEC51a",
"constructorArguments": [
1000
]
},
{
"name": "Contract UpgradeBeacon",
"address": "0x50dc82F72c663BFB234A643f89d67C928b86f15B",
"constructorArguments": [
"0x3878204c2dA27b8EbB89feD25Cc6028878fEC51a",
"0x896DFD65C87D59E7C325762109936Bc3945F1863"
]
},
{
"name": "Contract Proxy",
"address": "0x27d8008Bb9738DFBb0E546e175efe401e914Aa93",
"constructorArguments": [
"0x50dc82F72c663BFB234A643f89d67C928b86f15B",
"0xbf30a55d0000000000000000000000000000000000000000000000000000000000000bb80000000000000000000000004177372fd9581ceb2367e0ce84adc5dad9df8d550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000"
]
}
]

@ -0,0 +1,12 @@
{
"bridgeRouter": {
"implementation": "0x17200253E47d2464b3a06ec0186e7afDf2b25518",
"proxy": "0x635b125c63410D658EeAE1eF98a9a11aEdB1E322",
"beacon": "0x7455b2F22aC5435E201E3E8c630b5202Da876357"
},
"bridgeToken": {
"implementation": "0xD6F24647e373F4D95b25a8Ff87287FE76726C56A",
"proxy": "0xF7857c43618257dD8b21945accfd7ef4e73Ce256",
"beacon": "0xF3d7E8e119bC629dC35F7Dea1246AA5Ee15771bc"
}
}

@ -0,0 +1,44 @@
[
{
"name": "Contract Implementation",
"address": "0xD6F24647e373F4D95b25a8Ff87287FE76726C56A",
"constructorArguments": []
},
{
"name": "Contract UpgradeBeacon",
"address": "0xF3d7E8e119bC629dC35F7Dea1246AA5Ee15771bc",
"constructorArguments": [
"0xD6F24647e373F4D95b25a8Ff87287FE76726C56A",
"0x896DFD65C87D59E7C325762109936Bc3945F1863"
]
},
{
"name": "Contract Proxy",
"address": "0xF7857c43618257dD8b21945accfd7ef4e73Ce256",
"constructorArguments": [
"0xF3d7E8e119bC629dC35F7Dea1246AA5Ee15771bc",
"0x"
]
},
{
"name": "Contract Implementation",
"address": "0x17200253E47d2464b3a06ec0186e7afDf2b25518",
"constructorArguments": []
},
{
"name": "Contract UpgradeBeacon",
"address": "0x7455b2F22aC5435E201E3E8c630b5202Da876357",
"constructorArguments": [
"0x17200253E47d2464b3a06ec0186e7afDf2b25518",
"0x896DFD65C87D59E7C325762109936Bc3945F1863"
]
},
{
"name": "Contract Proxy",
"address": "0x635b125c63410D658EeAE1eF98a9a11aEdB1E322",
"constructorArguments": [
"0x7455b2F22aC5435E201E3E8c630b5202Da876357",
"0x485cc955000000000000000000000000f3d7e8e119bc629dc35f7dea1246aa5ee15771bc0000000000000000000000001192b3cc8f7b2c664c53b7e2432b95fe5afe8d88"
]
}
]

@ -0,0 +1,13 @@
{
"bridgeRouter": {
"implementation": "0x653fd06dC14A1f7e2eF0bd09F208672E5F04E237",
"proxy": "0xd29b41335092D1427463D4e4a5fC28D90f2A695c",
"beacon": "0xc5dB53513eB47C857A5bEff381b111588CB4623F"
},
"bridgeToken": {
"implementation": "0x311DD715Fdaf80aD5Cf2dF2d8A6C05D7207205e4",
"proxy": "0x23AA200E4AD3A4DfBC87612eb99C88bfeD742b96",
"beacon": "0x8eA98384C671E4612fDdA50B7CB9D62Bf8dD7560"
},
"ethHelper": "0x954EdA7095D43D6A6aC055892Bd0bAE2FE330FeD"
}

@ -0,0 +1,52 @@
[
{
"name": "Contract Implementation",
"address": "0x311DD715Fdaf80aD5Cf2dF2d8A6C05D7207205e4",
"constructorArguments": []
},
{
"name": "Contract UpgradeBeacon",
"address": "0x8eA98384C671E4612fDdA50B7CB9D62Bf8dD7560",
"constructorArguments": [
"0x311DD715Fdaf80aD5Cf2dF2d8A6C05D7207205e4",
"0x75Ab9C07552A630A377FAc68135402210388e05c"
]
},
{
"name": "Contract Proxy",
"address": "0x23AA200E4AD3A4DfBC87612eb99C88bfeD742b96",
"constructorArguments": [
"0x8eA98384C671E4612fDdA50B7CB9D62Bf8dD7560",
"0x"
]
},
{
"name": "Contract Implementation",
"address": "0x653fd06dC14A1f7e2eF0bd09F208672E5F04E237",
"constructorArguments": []
},
{
"name": "Contract UpgradeBeacon",
"address": "0xc5dB53513eB47C857A5bEff381b111588CB4623F",
"constructorArguments": [
"0x653fd06dC14A1f7e2eF0bd09F208672E5F04E237",
"0x75Ab9C07552A630A377FAc68135402210388e05c"
]
},
{
"name": "Contract Proxy",
"address": "0xd29b41335092D1427463D4e4a5fC28D90f2A695c",
"constructorArguments": [
"0xc5dB53513eB47C857A5bEff381b111588CB4623F",
"0x485cc9550000000000000000000000008ea98384c671e4612fdda50b7cb9d62bf8dd7560000000000000000000000000fe8a2093dd9b99db801d97ca1b0c82cdb9308708"
]
},
{
"name": "ETH Helper",
"address": "0x954EdA7095D43D6A6aC055892Bd0bAE2FE330FeD",
"constructorArguments": [
"0xd0a1e359811322d97991e03f863a0c30c2cf029c",
"0xd29b41335092D1427463D4e4a5fC28D90f2A695c"
]
}
]

@ -0,0 +1,8 @@
{
"messageInterval": "100",
"chat": {
"message": "static message",
"recipient": "0xabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcdabcd",
"type": "static"
}
}

@ -0,0 +1,39 @@
{
"signers": {
"kovan": {
"key": "",
"type": "hexKey"
},
"alfajores": {
"key": "",
"type": "hexKey"
}
},
"replicas": {
"alfajores": {
"address": "0x27d8008Bb9738DFBb0E546e175efe401e914Aa93",
"domain": "1000",
"name": "alfajores",
"rpcStyle": "ethereum",
"connection": {
"type": "http",
"url": "https://alfajores-forno.celo-testnet.org"
}
}
},
"home": {
"address": "0x0C4501f2088c4963286CE5E9a5080a31F17b1a87",
"domain": "3000",
"name": "kovan",
"rpcStyle": "ethereum",
"connection": {
"type": "http",
"url": "https://kovan.infura.io/v3/5c456d7844fa40a683e934df60534c60"
}
},
"tracing": {
"level": "debug",
"style": "json"
},
"db": "db_path"
}

@ -0,0 +1,22 @@
{
"upgradeBeaconController": "0x75Ab9C07552A630A377FAc68135402210388e05c",
"xAppConnectionManager": "0xFE8A2093Dd9B99DB801D97Ca1b0c82cdB9308708",
"updaterManager": "0xea3b5F0fB82ef0Aee1b81dfE99A7AF7F065FD28B",
"governance": {
"implementation": "0x3ac3C18A00bA186314dc8f0Ca89D869A4262fFFB",
"proxy": "0x885A8bd4be130422AEB1Eb9Eeb9513a5D2102cad",
"beacon": "0x4d911A52837703708CB2bc733CcBD87726dEA3Cc"
},
"home": {
"implementation": "0xf85B6D10aD90Bfd7218D7dC5E234d4421FD3fd88",
"proxy": "0x0C4501f2088c4963286CE5E9a5080a31F17b1a87",
"beacon": "0x9FEE0b4D16c630813439919e1e4Ab7f6A7E6636C"
},
"replicas": {
"1000": {
"implementation": "0x0754Db4C98F4B28c48228103d9770f1940079934",
"proxy": "0xeACafFb9fBCe3d4c4C5D07AF5DFa51CcF5a348b7",
"beacon": "0x7274963E5A70f9d6d441847Ee000105dd710cAb5"
}
}
}

@ -0,0 +1,77 @@
[
{
"name": "UpgradeBeaconController",
"address": "0x75Ab9C07552A630A377FAc68135402210388e05c",
"constructorArguments": []
},
{
"name": "Contract Implementation",
"address": "0xf85B6D10aD90Bfd7218D7dC5E234d4421FD3fd88",
"constructorArguments": [
3000
]
},
{
"name": "Contract UpgradeBeacon",
"address": "0x9FEE0b4D16c630813439919e1e4Ab7f6A7E6636C",
"constructorArguments": [
"0xf85B6D10aD90Bfd7218D7dC5E234d4421FD3fd88",
"0x75Ab9C07552A630A377FAc68135402210388e05c"
]
},
{
"name": "Contract Proxy",
"address": "0x0C4501f2088c4963286CE5E9a5080a31F17b1a87",
"constructorArguments": [
"0x9FEE0b4D16c630813439919e1e4Ab7f6A7E6636C",
"0xc4d66de8000000000000000000000000ea3b5f0fb82ef0aee1b81dfe99a7af7f065fd28b"
]
},
{
"name": "Contract Implementation",
"address": "0x3ac3C18A00bA186314dc8f0Ca89D869A4262fFFB",
"constructorArguments": [
3000,
1
]
},
{
"name": "Contract UpgradeBeacon",
"address": "0x4d911A52837703708CB2bc733CcBD87726dEA3Cc",
"constructorArguments": [
"0x3ac3C18A00bA186314dc8f0Ca89D869A4262fFFB",
"0x75Ab9C07552A630A377FAc68135402210388e05c"
]
},
{
"name": "Contract Proxy",
"address": "0x885A8bd4be130422AEB1Eb9Eeb9513a5D2102cad",
"constructorArguments": [
"0x4d911A52837703708CB2bc733CcBD87726dEA3Cc",
"0x485cc955000000000000000000000000fe8a2093dd9b99db801d97ca1b0c82cdb930870800000000000000000000000024f6c874f56533d9a1422e85e5c7a806ed11c036"
]
},
{
"name": "Contract Implementation",
"address": "0x0754Db4C98F4B28c48228103d9770f1940079934",
"constructorArguments": [
3000
]
},
{
"name": "Contract UpgradeBeacon",
"address": "0x7274963E5A70f9d6d441847Ee000105dd710cAb5",
"constructorArguments": [
"0x0754Db4C98F4B28c48228103d9770f1940079934",
"0x75Ab9C07552A630A377FAc68135402210388e05c"
]
},
{
"name": "Contract Proxy",
"address": "0xeACafFb9fBCe3d4c4C5D07AF5DFa51CcF5a348b7",
"constructorArguments": [
"0x7274963E5A70f9d6d441847Ee000105dd710cAb5",
"0xbf30a55d00000000000000000000000000000000000000000000000000000000000003e80000000000000000000000004177372fd9581ceb2367e0ce84adc5dad9df8d550000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000"
]
}
]

@ -0,0 +1,3 @@
{
"pollingInterval": "10"
}

@ -0,0 +1,3 @@
{
"pollingInterval": "10"
}

@ -0,0 +1,8 @@
{
"pollingInterval": "5",
"updatePause": "15",
"updater": {
"key": "",
"type": "hexKey"
}
}

@ -0,0 +1,33 @@
{
"pollingInterval": "100",
"watcher": {
"key": "",
"type": "hexKey"
},
"connectionManagers": [
{
"address": "0x0000000000000000000000000000000000000000",
"domain": "60",
"name": "ethereum",
"rpcStyle": "ethereum",
"config": {
"connection": {
"type": "ws",
"url": "ws://localhost:8545"
}
}
},
{
"address": "0x0000000000000000000000000000000000000000",
"domain": "61",
"name": "eth-classic",
"rpcStyle": "ethereum",
"config": {
"connection": {
"type": "ws",
"url": "ws://localhost:8545"
}
}
}
]
}

@ -23,9 +23,9 @@ contract Replica is Initializable, Common, QueueManager {
using Message for bytes29;
/// @notice Minimum gas for message processing
uint256 public constant PROCESS_GAS = 500000;
uint256 public constant PROCESS_GAS = 850000;
/// @notice Reserved gas (to ensure tx completes in case message processing runs out)
uint256 public constant RESERVE_GAS = 10000;
uint256 public constant RESERVE_GAS = 15000;
/// @notice Domain of home chain
uint32 public remoteDomain;

@ -1,14 +1,36 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.6.11;
contract MockCore {
import {MerkleTreeManager} from "@celo-org/optics-sol/contracts/Merkle.sol";
import {QueueManager} from "@celo-org/optics-sol/contracts/Queue.sol";
import {Message} from "@celo-org/optics-sol/libs/Message.sol";
import {MerkleLib} from "@celo-org/optics-sol/libs/Merkle.sol";
import {QueueLib} from "@celo-org/optics-sol/libs/Queue.sol";
// We reproduce a significant amount of logic from `Home` to ensure that
// calling enqueue here is AT LEAST AS EXPENSIVE as calling it on home
contract MockCore is MerkleTreeManager, QueueManager {
using QueueLib for QueueLib.Queue;
using MerkleLib for MerkleLib.Tree;
uint256 public constant MAX_MESSAGE_BODY_BYTES = 2 * 2**10;
event Enqueue(
uint32 indexed _destination,
bytes32 indexed _recipient,
bytes _body
);
event Dispatch(
uint256 indexed leafIndex,
uint64 indexed destinationAndSequence,
bytes32 indexed leaf,
bytes message
);
mapping(uint32 => uint32) public sequences;
function localDomain() external pure returns (uint32) {
function localDomain() public pure returns (uint32) {
return 5;
}
@ -16,15 +38,49 @@ contract MockCore {
return address(this);
}
// We reproduce the logic here to simulate
function enqueue(
uint32 _destination,
bytes32 _recipient,
bytes calldata _body
) external {
require(_body.length <= MAX_MESSAGE_BODY_BYTES, "!too big");
uint32 _sequence = sequences[_destination];
bytes memory _message = Message.formatMessage(
localDomain(),
bytes32(uint256(uint160(msg.sender))),
_sequence,
_destination,
_recipient,
_body
);
bytes32 _leaf = keccak256(_message);
tree.insert(_leaf);
queue.enqueue(root());
// leafIndex is count() - 1 since new leaf has already been inserted
emit Dispatch(
count() - 1,
_destinationAndSequence(_destination, _sequence),
_leaf,
_message
);
emit Enqueue(_destination, _recipient, _body);
sequences[_destination] = _sequence + 1;
}
function isReplica(address) public pure returns (bool) {
return true;
}
function _destinationAndSequence(uint32 _destination, uint32 _sequence)
internal
pure
returns (uint64)
{
return (uint64(_destination) << 32) | _sequence;
}
}

@ -1,9 +1,15 @@
import { Signer } from 'ethers';
import { BytesLike, ethers, Signer } from 'ethers';
import {
UpgradeBeaconController,
UpgradeBeaconController__factory,
} from '../../../typechain/optics-core';
import { MockCore, MockCore__factory } from '../../../typechain/optics-xapps';
import {
BridgeRouter,
IERC20,
IERC20__factory,
MockCore,
MockCore__factory,
} from '../../../typechain/optics-xapps';
import { ContractVerificationInput } from '../deploy';
import { BridgeContracts } from './BridgeContracts';
import * as process from '.';
@ -25,12 +31,14 @@ export default class TestBridgeDeploy {
mockCore: MockCore;
contracts: BridgeContracts;
verificationInput: ContractVerificationInput[];
localDomain: number;
constructor(
signer: Signer,
mockCore: MockCore,
ubc: UpgradeBeaconController,
contracts: BridgeContracts,
domain: number,
callerKnowsWhatTheyAreDoing: boolean = false,
) {
if (!callerKnowsWhatTheyAreDoing) {
@ -41,14 +49,23 @@ export default class TestBridgeDeploy {
this.mockCore = mockCore;
this.contracts = contracts;
this.signer = signer;
this.localDomain = domain;
}
static async deploy(signer: Signer): Promise<TestBridgeDeploy> {
const mockCore = await new MockCore__factory(signer).deploy();
const ubc = await new UpgradeBeaconController__factory(signer).deploy();
const contracts = new BridgeContracts();
const domain = await mockCore.localDomain();
let deploy = new TestBridgeDeploy(signer, mockCore, ubc, contracts, true);
let deploy = new TestBridgeDeploy(
signer,
mockCore,
ubc,
contracts,
domain,
true,
);
await process.deployTokenUpgradeBeacon(deploy);
await process.deployBridgeRouter(deploy);
@ -93,4 +110,47 @@ export default class TestBridgeDeploy {
get config() {
return { weth: '' };
}
get bridgeRouter(): BridgeRouter | undefined {
return this.contracts.bridgeRouter?.proxy;
}
get remoteDomain(): number {
return 1;
}
get remoteDomainBytes(): string {
return `0x0000000${this.remoteDomain}`;
}
get localDomainBytes(): string {
return `0x0000000${this.localDomain}`;
}
get testToken(): string {
return `0x${'11'.repeat(32)}`;
}
get testTokenId(): string {
return ethers.utils.hexConcat([this.remoteDomainBytes, this.testToken]);
}
async getTestRepresentation(): Promise<IERC20 | undefined> {
return await this.getRepresentation(this.remoteDomain, this.testToken);
}
async getRepresentation(
domain: number,
canonicalTokenAddress: BytesLike,
): Promise<IERC20 | undefined> {
const reprAddr = await this.bridgeRouter![
'getLocalAddress(uint32,bytes32)'
](domain, canonicalTokenAddress);
if (domain === 0) {
return undefined;
}
return IERC20__factory.connect(reprAddr, this.signer);
}
}

@ -4,12 +4,7 @@ import { BigNumber, BytesLike } from 'ethers';
import TestBridgeDeploy from '../../../optics-deploy/src/bridge/TestBridgeDeploy';
import { toBytes32 } from '../../lib/utils';
import { expect } from 'chai';
import {IERC20__factory, BridgeRouter, IERC20} from '../../../typechain/optics-xapps';
async function getRepresentationTokenContract(deployer: Signer, bridgeRouter: BridgeRouter, domain: number, canonicalTokenAddress: BytesLike): Promise<IERC20> {
const reprAddr = await bridgeRouter['getLocalAddress(uint32,bytes32)'](domain, canonicalTokenAddress);
return IERC20__factory.connect(reprAddr, deployer);
}
import { BridgeToken__factory } from '../../../typechain/optics-xapps';
const BRIDGE_MESSAGE_TYPES = {
INVALID: 0,
@ -24,54 +19,353 @@ const typeToBytes = (type: number) => `0x0${type}`;
describe('Bridge', async () => {
let deployer: Signer;
let deployerAddress: String;
let deployerAddress: string;
let deployerId: BytesLike;
let deploy: TestBridgeDeploy;
let transferAction: BytesLike;
let transferMessage: BytesLike;
let bridgeRouter: BridgeRouter;
const DOMAIN = 1;
// 4-byte domain ID
const DOMAIN_BYTES = `0x0000000${DOMAIN}`;
const PROTOCOL_PROCESS_GAS = 800_000;
// 1-byte Action Type
const TRANSFER_BYTES = typeToBytes(BRIDGE_MESSAGE_TYPES.TRANSFER);
// 32-byte token address
const CANONICAL_TOKEN_ADDRESS = `0x${'11'.repeat(32)}`;
// 36 byte token id
const TOKEN_ID = ethers.utils.concat([DOMAIN_BYTES, CANONICAL_TOKEN_ADDRESS]);
const TRANSER_TAG = typeToBytes(BRIDGE_MESSAGE_TYPES.TRANSFER);
// Numerical token value
const TOKEN_VALUE = 0xffff;
// 32-byte token value
const TOKEN_VALUE = `0x${'00'.repeat(30)}ffff`;
const TOKEN_VALUE_BYTES = `0x${'00'.repeat(30)}ffff`;
before(async () => {
// populate deployer signer
[deployer] = await ethers.getSigners();
deployerAddress = await deployer.getAddress();
deployerId = toBytes32(await deployer.getAddress());
deployerId = toBytes32(await deployer.getAddress()).toLowerCase();
});
beforeEach(async () => {
// run test deploy of bridge contracts
deploy = await TestBridgeDeploy.deploy(deployer);
bridgeRouter = deploy.contracts.bridgeRouter!.proxy;
// generate transfer action
transferAction = ethers.utils.concat([TRANSFER_BYTES, deployerId, TOKEN_VALUE]);
transferMessage = ethers.utils.concat([TOKEN_ID, transferAction]);
});
it('handles a transfer message', async () => {
// first handle message for a new canonical token should deploy a representation token contract
expect(await bridgeRouter.handle(
DOMAIN,
describe('transfer message', async () => {
it('errors when missing a remote router', async () => {
expect(
deploy.bridgeRouter!.send(
ethers.constants.AddressZero,
0,
12378,
`0x${'00'.repeat(32)}`,
),
).to.be.revertedWith('!remote');
});
it('remotely-originating asset roundtrip', async () => {
// generate transfer action
const transferAction = ethers.utils.hexConcat([
TRANSER_TAG,
deployerId,
TOKEN_VALUE_BYTES,
]);
const transferMessage = ethers.utils.hexConcat([
deploy.testTokenId,
transferAction,
]);
// INBOUND
let handleTx = await deploy.bridgeRouter!.handle(
deploy.remoteDomain,
deployerId,
transferMessage,
{ gasLimit: PROTOCOL_PROCESS_GAS },
);
await expect(handleTx).to.emit(deploy.bridgeRouter!, 'TokenDeployed');
const repr = await deploy.getTestRepresentation();
expect(repr).to.not.be.undefined;
expect(await repr!.balanceOf(deployer.address)).to.equal(
BigNumber.from(TOKEN_VALUE),
);
expect(await repr!.totalSupply()).to.equal(BigNumber.from(TOKEN_VALUE));
// OUTBOUND, TOO MANY TOKENS
const stealTx = deploy.bridgeRouter!.send(
repr!.address,
TOKEN_VALUE * 10,
deploy.remoteDomain,
deployerId,
);
await expect(stealTx).to.be.revertedWith(
'ERC20: burn amount exceeds balance',
);
// OUTBOUND
const sendTx = await deploy.bridgeRouter!.send(
repr!.address,
TOKEN_VALUE,
deploy.remoteDomain,
deployerId,
);
await expect(sendTx)
.to.emit(deploy.mockCore, 'Enqueue')
.withArgs(deploy.remoteDomain, deployerId, transferMessage);
expect(await repr!.totalSupply()).to.equal(BigNumber.from(0));
// OUTBOUND, NO Tokens
const badTx = deploy.bridgeRouter!.send(
repr!.address,
TOKEN_VALUE,
deploy.remoteDomain,
deployerId,
);
await expect(badTx).to.be.revertedWith(
'ERC20: burn amount exceeds balance',
);
});
it('locally-originating asset roundtrip', async () => {
// SETUP
const localToken = await new BridgeToken__factory(deployer).deploy();
await localToken.initialize();
await localToken.mint(deployerAddress, TOKEN_VALUE);
// generate protocol messages
const localTokenId = ethers.utils.hexConcat([
deploy.localDomainBytes,
toBytes32(localToken.address),
]);
const transferAction = ethers.utils.hexConcat([
TRANSER_TAG,
deployerId,
TOKEN_VALUE_BYTES,
]);
const transferMessage = ethers.utils.hexConcat([
localTokenId,
transferAction,
]);
expect(await localToken.balanceOf(deployerAddress)).to.equal(
BigNumber.from(TOKEN_VALUE),
);
expect(await localToken.balanceOf(deploy.bridgeRouter!.address)).to.equal(
BigNumber.from(0),
);
// TOKEN NOT APPROVED
const unapproved = deploy.bridgeRouter!.send(
localToken.address,
1,
deploy.remoteDomain,
deployerId,
);
expect(unapproved).to.be.revertedWith(
'ERC20: transfer amount exceeds allowance',
);
expect(await localToken.balanceOf(deploy.bridgeRouter!.address)).to.equal(
BigNumber.from(0),
);
// INSUFFICIENT BALANCE
await localToken.approve(
deploy.bridgeRouter!.address,
ethers.constants.MaxUint256,
);
const badTx = deploy.bridgeRouter!.send(
localToken.address,
TOKEN_VALUE * 5,
deploy.remoteDomain,
deployerId,
);
expect(badTx).to.be.revertedWith(
'ERC20: transfer amount exceeds balance',
);
expect(await localToken.balanceOf(deploy.bridgeRouter!.address)).to.equal(
BigNumber.from(0),
);
// OUTBOUND
const sendTx = await deploy.bridgeRouter!.send(
localToken.address,
TOKEN_VALUE,
deploy.remoteDomain,
deployerId,
);
await expect(sendTx)
.to.emit(deploy.mockCore, 'Enqueue')
.withArgs(deploy.remoteDomain, deployerId, transferMessage);
expect(await localToken.balanceOf(deploy.bridgeRouter!.address)).to.equal(
BigNumber.from(TOKEN_VALUE),
);
// INBOUND
let handleTx = await deploy.bridgeRouter!.handle(
deploy.remoteDomain,
deployerId,
transferMessage,
{ gasLimit: PROTOCOL_PROCESS_GAS },
);
expect(handleTx).to.not.emit(deploy.bridgeRouter!, 'TokenDeployed');
expect(await localToken.balanceOf(deploy.bridgeRouter!.address)).to.equal(
BigNumber.from(0),
);
expect(await localToken.balanceOf(deployerAddress)).to.equal(
BigNumber.from(TOKEN_VALUE),
);
});
});
describe('Prefill', async () => {
it('errors for non-existing assets', async () => {
// generate transfer action
const transferAction = ethers.utils.hexConcat([
TRANSER_TAG,
deployerId,
transferMessage
)).to.emit(bridgeRouter, "TokenDeployed");
TOKEN_VALUE_BYTES,
]);
const transferMessage = ethers.utils.hexConcat([
deploy.testTokenId,
transferAction,
]);
const repr: IERC20 = await getRepresentationTokenContract(deployer, bridgeRouter, DOMAIN, CANONICAL_TOKEN_ADDRESS);
expect(deploy.bridgeRouter!.preFill(transferMessage)).to.be.revertedWith(
'!token',
);
});
expect(await repr.balanceOf(deployer.address)).to.equal(BigNumber.from(TOKEN_VALUE));
expect(await repr.totalSupply()).to.equal(BigNumber.from(TOKEN_VALUE));
it('remotely-originating asset', async () => {
// SETUP REPRESENTATION
const setupAction = ethers.utils.hexConcat([
TRANSER_TAG,
deployerId,
TOKEN_VALUE_BYTES,
]);
const setupMessage = ethers.utils.hexConcat([
deploy.testTokenId,
setupAction,
]);
const setupTx = await deploy.bridgeRouter!.handle(
deploy.remoteDomain,
deployerId,
setupMessage,
{ gasLimit: PROTOCOL_PROCESS_GAS },
);
await expect(setupTx).to.emit(deploy.bridgeRouter!, 'TokenDeployed');
const repr = await deploy.getTestRepresentation();
expect(await repr!.balanceOf(deployerAddress)).to.equal(
BigNumber.from(TOKEN_VALUE),
);
// APPROVE
await repr?.approve(
deploy.bridgeRouter!.address,
ethers.constants.MaxUint256,
);
// generate transfer action
const recipient = `0x${'00'.repeat(19)}ff`;
const recipientId = toBytes32(recipient);
const transferAction = ethers.utils.hexConcat([
TRANSER_TAG,
recipientId,
TOKEN_VALUE_BYTES,
]);
const transferMessage = ethers.utils.hexConcat([
deploy.testTokenId,
transferAction,
]);
// DISPATCH PREFILL TX
const prefillTx = await deploy.bridgeRouter!.preFill(transferMessage);
await expect(prefillTx)
.to.emit(repr, 'Transfer')
.withArgs(
deployerAddress,
recipient,
BigNumber.from(TOKEN_VALUE).mul(9995).div(10000),
);
// DELIVER PREFILLED MESSAGE
let deliver = deploy.bridgeRouter!.handle(
deploy.remoteDomain,
deployerId,
transferMessage,
{ gasLimit: PROTOCOL_PROCESS_GAS },
);
await expect(deliver)
.to.emit(repr, 'Transfer')
.withArgs(ethers.constants.AddressZero, deployerAddress, TOKEN_VALUE);
});
it('locally-originating asset', async () => {
// SETUP
const localToken = await new BridgeToken__factory(deployer).deploy();
await localToken.initialize();
await localToken.mint(deployerAddress, TOKEN_VALUE);
await localToken.mint(deploy.bridgeRouter!.address, TOKEN_VALUE);
await localToken.approve(
deploy.bridgeRouter!.address,
ethers.constants.MaxUint256,
);
expect(await localToken.balanceOf(deployerAddress)).to.equal(
BigNumber.from(TOKEN_VALUE),
);
expect(await localToken.balanceOf(deploy.bridgeRouter!.address)).to.equal(
BigNumber.from(TOKEN_VALUE),
);
// generate transfer action
const recipient = `0x${'00'.repeat(19)}ff`;
const recipientId = toBytes32(recipient);
const localTokenId = ethers.utils.hexConcat([
deploy.localDomainBytes,
toBytes32(localToken.address),
]);
const transferAction = ethers.utils.hexConcat([
TRANSER_TAG,
recipientId,
TOKEN_VALUE_BYTES,
]);
const transferMessage = ethers.utils.hexConcat([
localTokenId,
transferAction,
]);
// DISPATCH PREFILL TX
const prefillTx = await deploy.bridgeRouter!.preFill(transferMessage);
await expect(prefillTx)
.to.emit(localToken, 'Transfer')
.withArgs(
deployerAddress,
recipient,
BigNumber.from(TOKEN_VALUE).mul(9995).div(10000),
);
// DELIVER PREFILLED MESSAGE
let deliver = deploy.bridgeRouter!.handle(
deploy.remoteDomain,
deployerId,
transferMessage,
{ gasLimit: PROTOCOL_PROCESS_GAS },
);
await expect(deliver)
.to.emit(localToken, 'Transfer')
.withArgs(deploy.bridgeRouter!.address, deployerAddress, TOKEN_VALUE);
});
});
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -147,7 +147,7 @@ const _abi = [
];
const _bytecode =
"0x608060405260405161091d38038061091d8339818101604052602081101561002657600080fd5b505160006100326100a1565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b0319166001600160a01b03929092169190911790556100a5565b3390565b610869806100b46000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100f25780639d54f41914610123578063df034cd014610156578063f2fde38b1461015e5761007d565b80635b3c2cbf146100825780636ef0f37f146100b7578063715018a6146100ea575b600080fd5b6100b56004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610191565b005b6100b5600480360360208110156100cd57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661021a565b6100b56103af565b6100fa6104c6565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100b56004803603602081101561013957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104e2565b6100fa610646565b6100b56004803603602081101561017457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610662565b60025473ffffffffffffffffffffffffffffffffffffffff16331461021757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f21686f6d65000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b50565b610222610803565b73ffffffffffffffffffffffffffffffffffffffff166102406104c6565b73ffffffffffffffffffffffffffffffffffffffff16146102c257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102cb81610807565b61033657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f21636f6e747261637420686f6d65000000000000000000000000000000000000604482015290519081900360640190fd5b6002805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fa6c230e5615262e310dcb42eaf014e813e5d8580abf5b00d2186ca8e9833de219181900360200190a150565b6103b7610803565b73ffffffffffffffffffffffffffffffffffffffff166103d56104c6565b73ffffffffffffffffffffffffffffffffffffffff161461045757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6104ea610803565b73ffffffffffffffffffffffffffffffffffffffff166105086104c6565b73ffffffffffffffffffffffffffffffffffffffff161461058a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255600254604080517f9d54f419000000000000000000000000000000000000000000000000000000008152600481019390935251921691639d54f4199160248082019260009290919082900301818387803b15801561062b57600080fd5b505af115801561063f573d6000803e3d6000fd5b5050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b61066a610803565b73ffffffffffffffffffffffffffffffffffffffff166106886104c6565b73ffffffffffffffffffffffffffffffffffffffff161461070a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061080e6026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b3390565b3b15159056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220c7f95edf91da0799f11b43c0ec8aac28e2d2f2b50803214748d566d88908579764736f6c63430007060033";
"0x608060405260405161091d38038061091d8339818101604052602081101561002657600080fd5b505160006100326100a1565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b0319166001600160a01b03929092169190911790556100a5565b3390565b610869806100b46000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80638da5cb5b1161005b5780638da5cb5b146100f25780639d54f41914610123578063df034cd014610156578063f2fde38b1461015e5761007d565b80635b3c2cbf146100825780636ef0f37f146100b7578063715018a6146100ea575b600080fd5b6100b56004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610191565b005b6100b5600480360360208110156100cd57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661021a565b6100b56103af565b6100fa6104c6565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100b56004803603602081101561013957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104e2565b6100fa610646565b6100b56004803603602081101561017457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610662565b60025473ffffffffffffffffffffffffffffffffffffffff16331461021757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600560248201527f21686f6d65000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b50565b610222610803565b73ffffffffffffffffffffffffffffffffffffffff166102406104c6565b73ffffffffffffffffffffffffffffffffffffffff16146102c257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6102cb81610807565b61033657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f21636f6e747261637420686f6d65000000000000000000000000000000000000604482015290519081900360640190fd5b6002805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff0000000000000000000000000000000000000000909116811790915560408051918252517fa6c230e5615262e310dcb42eaf014e813e5d8580abf5b00d2186ca8e9833de219181900360200190a150565b6103b7610803565b73ffffffffffffffffffffffffffffffffffffffff166103d56104c6565b73ffffffffffffffffffffffffffffffffffffffff161461045757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b6104ea610803565b73ffffffffffffffffffffffffffffffffffffffff166105086104c6565b73ffffffffffffffffffffffffffffffffffffffff161461058a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff838116918217909255600254604080517f9d54f419000000000000000000000000000000000000000000000000000000008152600481019390935251921691639d54f4199160248082019260009290919082900301818387803b15801561062b57600080fd5b505af115801561063f573d6000803e3d6000fd5b5050505050565b60015473ffffffffffffffffffffffffffffffffffffffff1690565b61066a610803565b73ffffffffffffffffffffffffffffffffffffffff166106886104c6565b73ffffffffffffffffffffffffffffffffffffffff161461070a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116610776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061080e6026913960400191505060405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b3390565b3b15159056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122007e4ee1b6b2b53e3973a54ed17321cab0ec4412f972f40bf60c372ff5f530ea664736f6c63430007060033";
export class UpdaterManager__factory extends ContractFactory {
constructor(signer?: Signer) {

File diff suppressed because one or more lines are too long

@ -21,12 +21,25 @@ import { TypedEventFilter, TypedEvent, TypedListener } from "./commons";
interface MockCoreInterface extends ethers.utils.Interface {
functions: {
"MAX_MESSAGE_BODY_BYTES()": FunctionFragment;
"count()": FunctionFragment;
"enqueue(uint32,bytes32,bytes)": FunctionFragment;
"home()": FunctionFragment;
"isReplica(address)": FunctionFragment;
"localDomain()": FunctionFragment;
"queueContains(bytes32)": FunctionFragment;
"queueEnd()": FunctionFragment;
"queueLength()": FunctionFragment;
"root()": FunctionFragment;
"sequences(uint32)": FunctionFragment;
"tree()": FunctionFragment;
};
encodeFunctionData(
functionFragment: "MAX_MESSAGE_BODY_BYTES",
values?: undefined
): string;
encodeFunctionData(functionFragment: "count", values?: undefined): string;
encodeFunctionData(
functionFragment: "enqueue",
values: [BigNumberish, BytesLike, BytesLike]
@ -37,7 +50,27 @@ interface MockCoreInterface extends ethers.utils.Interface {
functionFragment: "localDomain",
values?: undefined
): string;
encodeFunctionData(
functionFragment: "queueContains",
values: [BytesLike]
): string;
encodeFunctionData(functionFragment: "queueEnd", values?: undefined): string;
encodeFunctionData(
functionFragment: "queueLength",
values?: undefined
): string;
encodeFunctionData(functionFragment: "root", values?: undefined): string;
encodeFunctionData(
functionFragment: "sequences",
values: [BigNumberish]
): string;
encodeFunctionData(functionFragment: "tree", values?: undefined): string;
decodeFunctionResult(
functionFragment: "MAX_MESSAGE_BODY_BYTES",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "count", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "enqueue", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "home", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "isReplica", data: BytesLike): Result;
@ -45,11 +78,25 @@ interface MockCoreInterface extends ethers.utils.Interface {
functionFragment: "localDomain",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "queueContains",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "queueEnd", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "queueLength",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "root", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "sequences", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "tree", data: BytesLike): Result;
events: {
"Dispatch(uint256,uint64,bytes32,bytes)": EventFragment;
"Enqueue(uint32,bytes32,bytes)": EventFragment;
};
getEvent(nameOrSignatureOrTopic: "Dispatch"): EventFragment;
getEvent(nameOrSignatureOrTopic: "Enqueue"): EventFragment;
}
@ -97,6 +144,10 @@ export class MockCore extends BaseContract {
interface: MockCoreInterface;
functions: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<[BigNumber]>;
count(overrides?: CallOverrides): Promise<[BigNumber]>;
enqueue(
_destination: BigNumberish,
_recipient: BytesLike,
@ -109,8 +160,29 @@ export class MockCore extends BaseContract {
isReplica(arg0: string, overrides?: CallOverrides): Promise<[boolean]>;
localDomain(overrides?: CallOverrides): Promise<[number]>;
queueContains(
_item: BytesLike,
overrides?: CallOverrides
): Promise<[boolean]>;
queueEnd(overrides?: CallOverrides): Promise<[string]>;
queueLength(overrides?: CallOverrides): Promise<[BigNumber]>;
root(overrides?: CallOverrides): Promise<[string]>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<[number]>;
tree(
overrides?: CallOverrides
): Promise<[BigNumber] & { count: BigNumber }>;
};
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
count(overrides?: CallOverrides): Promise<BigNumber>;
enqueue(
_destination: BigNumberish,
_recipient: BytesLike,
@ -124,7 +196,23 @@ export class MockCore extends BaseContract {
localDomain(overrides?: CallOverrides): Promise<number>;
queueContains(_item: BytesLike, overrides?: CallOverrides): Promise<boolean>;
queueEnd(overrides?: CallOverrides): Promise<string>;
queueLength(overrides?: CallOverrides): Promise<BigNumber>;
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
tree(overrides?: CallOverrides): Promise<BigNumber>;
callStatic: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
count(overrides?: CallOverrides): Promise<BigNumber>;
enqueue(
_destination: BigNumberish,
_recipient: BytesLike,
@ -137,9 +225,39 @@ export class MockCore extends BaseContract {
isReplica(arg0: string, overrides?: CallOverrides): Promise<boolean>;
localDomain(overrides?: CallOverrides): Promise<number>;
queueContains(
_item: BytesLike,
overrides?: CallOverrides
): Promise<boolean>;
queueEnd(overrides?: CallOverrides): Promise<string>;
queueLength(overrides?: CallOverrides): Promise<BigNumber>;
root(overrides?: CallOverrides): Promise<string>;
sequences(arg0: BigNumberish, overrides?: CallOverrides): Promise<number>;
tree(overrides?: CallOverrides): Promise<BigNumber>;
};
filters: {
Dispatch(
leafIndex?: BigNumberish | null,
destinationAndSequence?: BigNumberish | null,
leaf?: BytesLike | null,
message?: null
): TypedEventFilter<
[BigNumber, BigNumber, string, string],
{
leafIndex: BigNumber;
destinationAndSequence: BigNumber;
leaf: string;
message: string;
}
>;
Enqueue(
_destination?: BigNumberish | null,
_recipient?: BytesLike | null,
@ -151,6 +269,10 @@ export class MockCore extends BaseContract {
};
estimateGas: {
MAX_MESSAGE_BODY_BYTES(overrides?: CallOverrides): Promise<BigNumber>;
count(overrides?: CallOverrides): Promise<BigNumber>;
enqueue(
_destination: BigNumberish,
_recipient: BytesLike,
@ -163,9 +285,33 @@ export class MockCore extends BaseContract {
isReplica(arg0: string, overrides?: CallOverrides): Promise<BigNumber>;
localDomain(overrides?: CallOverrides): Promise<BigNumber>;
queueContains(
_item: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
queueEnd(overrides?: CallOverrides): Promise<BigNumber>;
queueLength(overrides?: CallOverrides): Promise<BigNumber>;
root(overrides?: CallOverrides): Promise<BigNumber>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
tree(overrides?: CallOverrides): Promise<BigNumber>;
};
populateTransaction: {
MAX_MESSAGE_BODY_BYTES(
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
count(overrides?: CallOverrides): Promise<PopulatedTransaction>;
enqueue(
_destination: BigNumberish,
_recipient: BytesLike,
@ -181,5 +327,23 @@ export class MockCore extends BaseContract {
): Promise<PopulatedTransaction>;
localDomain(overrides?: CallOverrides): Promise<PopulatedTransaction>;
queueContains(
_item: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
queueEnd(overrides?: CallOverrides): Promise<PopulatedTransaction>;
queueLength(overrides?: CallOverrides): Promise<PopulatedTransaction>;
root(overrides?: CallOverrides): Promise<PopulatedTransaction>;
sequences(
arg0: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
tree(overrides?: CallOverrides): Promise<PopulatedTransaction>;
};
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -101,7 +101,7 @@ const _abi = [
];
const _bytecode =
"0x60c060405234801561001057600080fd5b5060405161045d38038061045d8339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606083811b821660805282901b1660a0526040805163095ea7b360e01b81526001600160a01b038084166004830152600019602483015291519184169163095ea7b39160448082019260009290919082900301818387803b1580156100a957600080fd5b505af11580156100bd573d6000803e3d6000fd5b50505050505060805160601c60a05160601c6103626100fb6000398061023e52806102e052508061014152806101fb52806102bc52506103626000f3fe60806040526004361061005a5760003560e01c80633fc8cef3116100435780633fc8cef3146100ad578063e78cea92146100eb578063ec93e5f0146101005761005a565b806303c1d2831461005f5780632e96d5a31461008a575b600080fd5b6100886004803603604081101561007557600080fd5b5063ffffffff813516906020013561013f565b005b610088600480360360208110156100a057600080fd5b503563ffffffff166102a5565b3480156100b957600080fd5b506100c26102ba565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100f757600080fd5b506100c26102de565b6100886004803603604081101561011657600080fd5b50803563ffffffff16906020013573ffffffffffffffffffffffffffffffffffffffff16610302565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101a757600080fd5b505af11580156101bb573d6000803e3d6000fd5b5050604080517f1cabf08f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000008116600483015234602483015263ffffffff881660448301526064820187905291517f00000000000000000000000000000000000000000000000000000000000000009092169450631cabf08f9350608480820193506000929182900301818387803b15801561028957600080fd5b505af115801561029d573d6000803e3d6000fd5b505050505050565b6102b7816102b233610313565b61013f565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b61030f826102b283610313565b5050565b73ffffffffffffffffffffffffffffffffffffffff169056fea264697066735822122060b0da4be9749743111e1d704519850d315c2eb6ebec18513739155b296f8eb264736f6c63430007060033";
"0x60c060405234801561001057600080fd5b5060405161045d38038061045d8339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606083811b821660805282901b1660a0526040805163095ea7b360e01b81526001600160a01b038084166004830152600019602483015291519184169163095ea7b39160448082019260009290919082900301818387803b1580156100a957600080fd5b505af11580156100bd573d6000803e3d6000fd5b50505050505060805160601c60a05160601c6103626100fb6000398061023e52806102e052508061014152806101fb52806102bc52506103626000f3fe60806040526004361061005a5760003560e01c80633fc8cef3116100435780633fc8cef3146100ad578063e78cea92146100eb578063ec93e5f0146101005761005a565b806303c1d2831461005f5780632e96d5a31461008a575b600080fd5b6100886004803603604081101561007557600080fd5b5063ffffffff813516906020013561013f565b005b610088600480360360208110156100a057600080fd5b503563ffffffff166102a5565b3480156100b957600080fd5b506100c26102ba565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100f757600080fd5b506100c26102de565b6100886004803603604081101561011657600080fd5b50803563ffffffff16906020013573ffffffffffffffffffffffffffffffffffffffff16610302565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156101a757600080fd5b505af11580156101bb573d6000803e3d6000fd5b5050604080517f1cabf08f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000008116600483015234602483015263ffffffff881660448301526064820187905291517f00000000000000000000000000000000000000000000000000000000000000009092169450631cabf08f9350608480820193506000929182900301818387803b15801561028957600080fd5b505af115801561029d573d6000803e3d6000fd5b505050505050565b6102b7816102b233610313565b61013f565b50565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b61030f826102b283610313565b5050565b73ffffffffffffffffffffffffffffffffffffffff169056fea264697066735822122002ab32a61061fde5f3969e3f3dac2bd14b6c40774352376e4b7e80963710cf9b64736f6c63430007060033";
export class ETHHelper__factory extends ContractFactory {
constructor(signer?: Signer) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save