From 816bccffb2ecd55d2e6f777d4deb9e2fc7b11706 Mon Sep 17 00:00:00 2001 From: Stefan Iliev <46542846+StefanIliev545@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:53:14 +0300 Subject: [PATCH] Auto funding script (#1543) * Adding is_transfer to the other sql init. * Added deployment script. * Added new scripts. * Fix for test. * short fixes * Removed useless multiplication. * Reduced funding to 0.5 * Added receive function. * Removed hardcoded addresses. * Expanded log. * Fixed bad merge. * Increased gas limit. * Fixed known issues and added gas test that ensures network hasnt produced bad batches. * patched up sim tests. * Moved to hardcoded addresses. * Added a time sleep that seems to be good enough for the tests to pass. * Lint fixes. * Attempt to fix tests. * Fixed line that was overriding the cfg. * Changed gas price for test.' * Fix for faucet test. * reversed change. --------- Co-authored-by: StefanIliev545 --- contracts/config/networks.json | 1 + .../funding/layer1/001_fund_accounts.ts | 39 ++++++++++++ .../001_deploy_cross_chain_messenger.ts | 4 +- .../testnet/layer2/001_whitelist_tokens.ts | 7 ++- .../ManagementContract/ManagementContract.go | 2 +- contracts/generated/MessageBus/MessageBus.go | 2 +- contracts/src/messaging/MessageBus.sol | 2 +- go/enclave/components/batch_executor.go | 2 +- go/enclave/enclave_test.go | 2 +- .../storage/init/edgelessdb/001_init.sql | 2 +- go/node/config.go | 9 +++ go/node/docker_node.go | 1 + go/wallet/wallet.go | 5 ++ .../contract_deployer_test.go | 1 + integration/eth2network/eth2_configs.go | 2 +- integration/faucet/faucet_test.go | 1 + .../networktest/userwallet/userwallet.go | 4 ++ integration/simulation/network/socket.go | 6 ++ integration/simulation/params/params.go | 1 + integration/simulation/params/wallet_utils.go | 16 +++++ integration/simulation/simulation.go | 60 +++++++++++++++++++ testnet/launcher/l2contractdeployer/docker.go | 1 + 22 files changed, 159 insertions(+), 11 deletions(-) create mode 100644 contracts/deployment_scripts/funding/layer1/001_fund_accounts.ts diff --git a/contracts/config/networks.json b/contracts/config/networks.json index 5304128742..3d5c0f90b0 100644 --- a/contracts/config/networks.json +++ b/contracts/config/networks.json @@ -19,6 +19,7 @@ "layer1" : "localGeth" }, "deploy": [ + "deployment_scripts/funding/layer1", "deployment_scripts/messenger/layer1", "deployment_scripts/messenger/layer2", "deployment_scripts/bridge/", diff --git a/contracts/deployment_scripts/funding/layer1/001_fund_accounts.ts b/contracts/deployment_scripts/funding/layer1/001_fund_accounts.ts new file mode 100644 index 0000000000..0c45d38bcd --- /dev/null +++ b/contracts/deployment_scripts/funding/layer1/001_fund_accounts.ts @@ -0,0 +1,39 @@ +import {HardhatRuntimeEnvironment} from 'hardhat/types'; +import {DeployFunction} from 'hardhat-deploy/types'; + + +const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { + const layer1 = hre.companionNetworks.layer1; + + const {deployer} = await hre.getNamedAccounts(); + const l1Accs = await layer1.getNamedAccounts(); + + const messageBusAddress = process.env.MESSAGE_BUS_ADDRESS!! + + const messageBus = (await hre.ethers.getContractFactory('MessageBus')).attach(messageBusAddress) + const prefundAmount = hre.ethers.utils.parseEther("0.5"); + const tx = await messageBus.populateTransaction.sendValueToL2(deployer, prefundAmount, { + value: prefundAmount + }); + + + console.log(`Sending ${prefundAmount} to ${deployer}`); + + const receipt = await layer1.deployments.rawTx({ + from: l1Accs.deployer, + to: messageBusAddress, + value: prefundAmount, + data: tx.data, + log: true, + waitConfirmations: 1, + }); + if (receipt.events?.length === 0) { + console.log(`Account prefunding status = FAILURE NO CROSS CHAIN EVENT`); + } else { + console.log(`Account prefunding status = ${receipt.status}`); + } +}; + +export default func; +func.tags = ['GasPrefunding', 'GasPrefunding_deploy']; +// No dependencies \ No newline at end of file diff --git a/contracts/deployment_scripts/messenger/layer1/001_deploy_cross_chain_messenger.ts b/contracts/deployment_scripts/messenger/layer1/001_deploy_cross_chain_messenger.ts index 007df8b18a..ae7c6562a9 100644 --- a/contracts/deployment_scripts/messenger/layer1/001_deploy_cross_chain_messenger.ts +++ b/contracts/deployment_scripts/messenger/layer1/001_deploy_cross_chain_messenger.ts @@ -14,7 +14,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { deployer } = await hre.companionNetworks.layer1.getNamedAccounts(); // Read the message bus address from the management contract deployment. - const messageBusAddress : string = process.env.MESSAGE_BUS_ADDRESS || "0xa1fdA5f6Df55a326f5f4300F3A716317f0f03110" + const messageBusAddress : string = process.env.MESSAGE_BUS_ADDRESS!! console.log(`Message Bus address ${messageBusAddress}`); // Setup the cross chain messenger and point it to the message bus from the management contract to be used for validation @@ -27,4 +27,4 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { export default func; func.tags = ['CrossChainMessenger', 'CrossChainMessenger_deploy']; -func.dependencies = ['ManagementContract', 'HPERC20']; //TODO: Remove HPERC20, this is only to have matching addresses. +func.dependencies = ['ManagementContract', 'HPERC20', 'GasPrefunding']; //TODO: Remove HPERC20, this is only to have matching addresses. diff --git a/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts b/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts index d4e106d847..397e11db8a 100644 --- a/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts +++ b/contracts/deployment_scripts/testnet/layer2/001_whitelist_tokens.ts @@ -96,9 +96,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { await new Promise(async (resolve, fail)=> { setTimeout(fail, 30_000) const messageBusContract = (await hre.ethers.getContractAt('MessageBus', '0x526c84529b2b8c11f57d93d3f5537aca3aecef9b')); + const gasLimit = await messageBusContract.estimateGas.verifyMessageFinalized(messages[1], { + maxFeePerGas: 2, + }) try { while (await messageBusContract.callStatic.verifyMessageFinalized(messages[1], { maxFeePerGas: 2, + gasLimit: gasLimit.mul(2), + from: l2Accounts.deployer }) != true) { console.log(`Messages not stored on L2 yet, retrying...`); await sleep(1_000); @@ -108,8 +113,6 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { fail(err) } - - resolve(true); }); diff --git a/contracts/generated/ManagementContract/ManagementContract.go b/contracts/generated/ManagementContract/ManagementContract.go index 6f51872731..1e9a2c1fcb 100644 --- a/contracts/generated/ManagementContract/ManagementContract.go +++ b/contracts/generated/ManagementContract/ManagementContract.go @@ -54,7 +54,7 @@ type StructsMetaRollup struct { // ManagementContractMetaData contains all meta data concerning the ManagementContract contract. var ManagementContractMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"messageBusAddress\",\"type\":\"address\"}],\"name\":\"LogManagementContractCreated\",\"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\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"Hash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"AggregatorID\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"LastSequenceNumber\",\"type\":\"uint256\"}],\"internalType\":\"structStructs.MetaRollup\",\"name\":\"r\",\"type\":\"tuple\"},{\"internalType\":\"string\",\"name\":\"_rollupData\",\"type\":\"string\"},{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage[]\",\"name\":\"messages\",\"type\":\"tuple[]\"}],\"internalType\":\"structStructs.HeaderCrossChainData\",\"name\":\"crossChainData\",\"type\":\"tuple\"}],\"name\":\"AddRollup\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"Attested\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GetHostAddresses\",\"outputs\":[{\"internalType\":\"string[]\",\"name\":\"\",\"type\":\"string[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"rollupHash\",\"type\":\"bytes32\"}],\"name\":\"GetRollupByHash\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"Hash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"AggregatorID\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"LastSequenceNumber\",\"type\":\"uint256\"}],\"internalType\":\"structStructs.MetaRollup\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_aggregatorID\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_initSecret\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"_hostAddress\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_genesisAttestation\",\"type\":\"string\"}],\"name\":\"InitializeNetworkSecret\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"IsWithdrawalAvailable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"requestReport\",\"type\":\"string\"}],\"name\":\"RequestNetworkSecret\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"attesterID\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"requesterID\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"attesterSig\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"responseSecret\",\"type\":\"bytes\"},{\"internalType\":\"string\",\"name\":\"hostAddress\",\"type\":\"string\"},{\"internalType\":\"bool\",\"name\":\"verifyAttester\",\"type\":\"bool\"}],\"name\":\"RespondNetworkSecret\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"RetrieveAllBridgeFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastBatchSeqNo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageBus\",\"outputs\":[{\"internalType\":\"contractIMessageBus\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x6080604052600060055534801561001557600080fd5b5061001f3361009f565b60405161002b906100ef565b604051809103906000f080158015610047573d6000803e3d6000fd5b50600780546001600160a01b0319166001600160a01b039290921691821790556040519081527fbd726cf82ac9c3260b1495107182e336e0654b25c10915648c0cc15b2bb72cbf9060200160405180910390a16100fc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611217806118bb83390190565b6117b08061010b6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063a52f433c11610066578063a52f433c1461026b578063bbd79e151461027b578063e34fbfc81461028e578063f2fde38b146102a157600080fd5b80638da5cb5b146102205780638fa0d05314610245578063a1a227fa1461025857600080fd5b806359a90071116100c857806359a9007114610160578063715018a614610175578063728109961461017d5780638236a7ba1461018557600080fd5b8063324ff866146100ef57806343348b2f1461010d578063440c953b14610149575b600080fd5b6100f76102b4565b6040516101049190610fd1565b60405180910390f35b61013961011b366004611060565b6001600160a01b031660009081526002602052604090205460ff1690565b6040519015158152602001610104565b61015260055481565b604051908152602001610104565b61017361016e366004611169565b61038d565b005b610173610417565b610173610482565b6101ed610193366004611210565b6040805160608082018352600080835260208084018290529284018190528481526006835283902083519182018452805480835260018201546001600160a01b031693830193909352600201549281019290925290911491565b60408051921515835281516020808501919091528201516001600160a01b03168382015201516060820152608001610104565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610104565b610173610253366004611229565b610554565b60075461022d906001600160a01b031681565b600454610100900460ff16610139565b6101736102893660046112b0565b6105e3565b61017361029c366004611376565b610748565b6101736102af366004611060565b610767565b60606003805480602002602001604051908101604052809291908181526020016000905b828210156103845783829060005260206000200180546102f7906113b8565b80601f0160208091040260200160405190810160405280929190818152602001828054610323906113b8565b80156103705780601f1061034557610100808354040283529160200191610370565b820191906000526020600020905b81548152906001019060200180831161035357829003601f168201915b5050505050815260200190600101906102d8565b50505050905090565b60045460ff161561039d57600080fd5b60048054600160ff1991821681179092556001600160a01b03881660009081526002602090815260408220805490931684179092556003805493840181559052845161040e927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0191860190610e98565b50505050505050565b6000546001600160a01b031633146104765760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6104806000610849565b565b6000546001600160a01b031633146104dc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046d565b6007546040517f36d2da900000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03909116906336d2da9090602401600060405180830381600087803b15801561053a57600080fd5b505af115801561054e573d6000803e3d6000fd5b50505050565b600260006105686040870160208801611060565b6001600160a01b0316815260208101919091526040016000205460ff166105d15760405162461bcd60e51b815260206004820152601760248201527f61676772656761746f72206e6f74206174746573746564000000000000000000604482015260640161046d565b6105da846108a6565b61054e816108db565b6001600160a01b03861660009081526002602052604090205460ff168061060957600080fd5b81156106d957600061063f8888868860405160200161062b94939291906113f3565b604051602081830303815290604052610995565b9050600061064d82886109d0565b9050886001600160a01b0316816001600160a01b0316146106d65760405162461bcd60e51b815260206004820152602c60248201527f63616c63756c61746564206164647265737320616e642061747465737465724960448201527f4420646f6e74206d617463680000000000000000000000000000000000000000606482015260840161046d565b50505b6001600160a01b03861660009081526002602090815260408220805460ff19166001908117909155600380549182018155909252845161073e927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0191860190610e98565b5050505050505050565b336000908152600160205260409020610762908383610f1c565b505050565b6000546001600160a01b031633146107c15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046d565b6001600160a01b03811661083d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161046d565b61084681610849565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8035600090815260066020526040902081906108c2828261144f565b5050600554604082013511156108465760400135600555565b60006108e7828061149b565b9050905060005b81811015610762576007546001600160a01b0316639730886d610911858061149b565b84818110610921576109216114e5565b905060200281019061093391906114fb565b60016040518363ffffffff1660e01b81526004016109529291906115b4565b600060405180830381600087803b15801561096c57600080fd5b505af1158015610980573d6000803e3d6000fd5b505050508061098e90611681565b90506108ee565b60006109a182516109f4565b826040516020016109b392919061169c565b604051602081830303815290604052805190602001209050919050565b60008060006109df8585610b2e565b915091506109ec81610b9e565b509392505050565b606081610a3457505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610a5e5780610a4881611681565b9150610a579050600a8361170d565b9150610a38565b60008167ffffffffffffffff811115610a7957610a796110c6565b6040519080825280601f01601f191660200182016040528015610aa3576020820181803683370190505b5090505b8415610b2657610ab8600183611721565b9150610ac5600a86611738565b610ad090603061174c565b60f81b818381518110610ae557610ae56114e5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610b1f600a8661170d565b9450610aa7565b949350505050565b600080825160411415610b655760208301516040840151606085015160001a610b5987828585610d59565b94509450505050610b97565b825160401415610b8f5760208301516040840151610b84868383610e46565b935093505050610b97565b506000905060025b9250929050565b6000816004811115610bb257610bb2611764565b1415610bbb5750565b6001816004811115610bcf57610bcf611764565b1415610c1d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161046d565b6002816004811115610c3157610c31611764565b1415610c7f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161046d565b6003816004811115610c9357610c93611764565b1415610cec5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161046d565b6004816004811115610d0057610d00611764565b14156108465760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161046d565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610d905750600090506003610e3d565b8460ff16601b14158015610da857508460ff16601c14155b15610db95750600090506004610e3d565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610e0d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610e3657600060019250925050610e3d565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681610e7c60ff86901c601b61174c565b9050610e8a87828885610d59565b935093505050935093915050565b828054610ea4906113b8565b90600052602060002090601f016020900481019282610ec65760008555610f0c565b82601f10610edf57805160ff1916838001178555610f0c565b82800160010185558215610f0c579182015b82811115610f0c578251825591602001919060010190610ef1565b50610f18929150610f90565b5090565b828054610f28906113b8565b90600052602060002090601f016020900481019282610f4a5760008555610f0c565b82601f10610f635782800160ff19823516178555610f0c565b82800160010185558215610f0c579182015b82811115610f0c578235825591602001919060010190610f75565b5b80821115610f185760008155600101610f91565b60005b83811015610fc0578181015183820152602001610fa8565b8381111561054e5750506000910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561103e57878503603f190184528151805180875261101f818989018a8501610fa5565b601f01601f191695909501860194509285019290850190600101610ff8565b5092979650505050505050565b6001600160a01b038116811461084657600080fd5b60006020828403121561107257600080fd5b813561107d8161104b565b9392505050565b60008083601f84011261109657600080fd5b50813567ffffffffffffffff8111156110ae57600080fd5b602083019150836020828501011115610b9757600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f8301126110ed57600080fd5b813567ffffffffffffffff80821115611108576111086110c6565b604051601f8301601f19908116603f01168101908282118183101715611130576111306110c6565b8160405283815286602085880101111561114957600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806000806080878903121561118257600080fd5b863561118d8161104b565b9550602087013567ffffffffffffffff808211156111aa57600080fd5b6111b68a838b01611084565b909750955060408901359150808211156111cf57600080fd5b6111db8a838b016110dc565b945060608901359150808211156111f157600080fd5b506111fe89828a01611084565b979a9699509497509295939492505050565b60006020828403121561122257600080fd5b5035919050565b60008060008084860360a081121561124057600080fd5b606081121561124e57600080fd5b50849350606085013567ffffffffffffffff8082111561126d57600080fd5b61127988838901611084565b9095509350608087013591508082111561129257600080fd5b508501602081880312156112a557600080fd5b939692955090935050565b60008060008060008060c087890312156112c957600080fd5b86356112d48161104b565b955060208701356112e48161104b565b9450604087013567ffffffffffffffff8082111561130157600080fd5b61130d8a838b016110dc565b9550606089013591508082111561132357600080fd5b61132f8a838b016110dc565b9450608089013591508082111561134557600080fd5b5061135289828a016110dc565b92505060a0870135801515811461136857600080fd5b809150509295509295509295565b6000806020838503121561138957600080fd5b823567ffffffffffffffff8111156113a057600080fd5b6113ac85828601611084565b90969095509350505050565b600181811c908216806113cc57607f821691505b602082108114156113ed57634e487b7160e01b600052602260045260246000fd5b50919050565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250835161142a816028850160208801610fa5565b835190830190611441816028840160208801610fa5565b016028019695505050505050565b813581556001810160208301356114658161104b565b6001600160a01b03811673ffffffffffffffffffffffffffffffffffffffff198354161782555050604082013560028201555050565b6000808335601e198436030181126114b257600080fd5b83018035915067ffffffffffffffff8211156114cd57600080fd5b6020019150600581901b3603821315610b9757600080fd5b634e487b7160e01b600052603260045260246000fd5b6000823560be1983360301811261151157600080fd5b9190910192915050565b803563ffffffff8116811461152f57600080fd5b919050565b6000808335601e1984360301811261154b57600080fd5b830160208101925035905067ffffffffffffffff81111561156b57600080fd5b803603831315610b9757600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b803560ff8116811461152f57600080fd5b60408152600083356115c58161104b565b6001600160a01b03166040830152602084013567ffffffffffffffff81168082146115ef57600080fd5b6060840152506116016040850161151b565b63ffffffff1660808301526116186060850161151b565b63ffffffff1660a08301526116306080850185611534565b60c0808501526116456101008501828461157a565b91505061165460a086016115a3565b60ff1660e084015260209092019290925292915050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156116955761169561166b565b5060010190565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600083516116d481601a850160208801610fa5565b8351908301906116eb81601a840160208801610fa5565b01601a01949350505050565b634e487b7160e01b600052601260045260246000fd5b60008261171c5761171c6116f7565b500490565b6000828210156117335761173361166b565b500390565b600082611747576117476116f7565b500690565b6000821982111561175f5761175f61166b565b500190565b634e487b7160e01b600052602160045260246000fdfea264697066735822122038a4ddddd39f92112fe4d4d8dc34396f1f905ca3dcae2220a147367f95a8c02064736f6c63430008090033608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6111998061007e6000396000f3fe6080604052600436106100b55760003560e01c80638da5cb5b1161006957806399a3ad211161004e57806399a3ad211461026a578063b1454caa1461028a578063f2fde38b146102c35761012d565b80638da5cb5b146102225780639730886d1461024a5761012d565b8063346633fb1161009a578063346633fb146101d857806336d2da90146101ed578063715018a61461020d5761012d565b80630fcfbd111461017557806333a88c72146101a85761012d565b3661012d5760405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201527f636365707420617373657473000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152600b60248201527f756e737570706f727465640000000000000000000000000000000000000000006044820152606401610124565b34801561018157600080fd5b50610195610190366004610ad3565b6102e3565b6040519081526020015b60405180910390f35b3480156101b457600080fd5b506101c86101c3366004610ad3565b610399565b604051901515815260200161019f565b6101eb6101e6366004610b1d565b6103ec565b005b3480156101f957600080fd5b506101eb610208366004610b49565b6104b8565b34801561021957600080fd5b506101eb6105b9565b34801561022e57600080fd5b506000546040516001600160a01b03909116815260200161019f565b34801561025657600080fd5b506101eb610265366004610b66565b61061f565b34801561027657600080fd5b506101eb610285366004610b1d565b6107c3565b34801561029657600080fd5b506102aa6102a5366004610bdc565b6108c5565b60405167ffffffffffffffff909116815260200161019f565b3480156102cf57600080fd5b506101eb6102de366004610b49565b61091e565b600080826040516020016102f79190610cc8565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150806103925760405162461bcd60e51b815260206004820152602160248201527f54686973206d65737361676520776173206e65766572207375626d697474656460448201527f2e000000000000000000000000000000000000000000000000000000000000006064820152608401610124565b9392505050565b600080826040516020016103ad9190610cc8565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915080158015906103e45750428111155b949350505050565b6000341180156103fb57508034145b61046d5760405162461bcd60e51b815260206004820152603060248201527f417474656d7074696e6720746f2073656e642076616c756520776974686f757460448201527f2070726f766964696e67204574686572000000000000000000000000000000006064820152608401610124565b604080513381526001600160a01b0384166020820152348183015290517ff1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a15609181900360600190a15050565b6000546001600160a01b031633146105125760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b6000816001600160a01b03164760405160006040518083038185875af1925050503d806000811461055f576040519150601f19603f3d011682016040523d82523d6000602084013e610564565b606091505b50509050806105b55760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610124565b5050565b6000546001600160a01b031633146106135760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b61061d6000610a00565b565b6000546001600160a01b031633146106795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b60006106858242610dc8565b905060008360405160200161069a9190610cc8565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150156107355760405162461bcd60e51b815260206004820152602160248201527f4d657373616765207375626d6974746564206d6f7265207468616e206f6e636560448201527f21000000000000000000000000000000000000000000000000000000000000006064820152608401610124565b600081815260016020908152604082208490556002919061075890870187610b49565b6001600160a01b0316815260208101919091526040016000908120906107846080870160608801610de0565b63ffffffff168152602080820192909252604001600090812080546001810182559082529190208591600402016107bb8282610fbd565b505050505050565b6000546001600160a01b0316331461081d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461086a576040519150601f19603f3d011682016040523d82523d6000602084013e61086f565b606091505b50509050806108c05760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610124565b505050565b60006108d033610a5d565b90507fb93c37389233beb85a3a726c3f15c2d15533ee74cb602f20f490dfffef7759373382888888888860405161090d97969594939291906110d7565b60405180910390a195945050505050565b6000546001600160a01b031633146109785760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b6001600160a01b0381166109f45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610124565b6109fd81610a00565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600360205260408120805467ffffffffffffffff169160019190610a908385611137565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550919050565b600060c08284031215610acd57600080fd5b50919050565b600060208284031215610ae557600080fd5b813567ffffffffffffffff811115610afc57600080fd5b6103e484828501610abb565b6001600160a01b03811681146109fd57600080fd5b60008060408385031215610b3057600080fd5b8235610b3b81610b08565b946020939093013593505050565b600060208284031215610b5b57600080fd5b813561039281610b08565b60008060408385031215610b7957600080fd5b823567ffffffffffffffff811115610b9057600080fd5b610b9c85828601610abb565b95602094909401359450505050565b63ffffffff811681146109fd57600080fd5b60ff811681146109fd57600080fd5b8035610bd781610bbd565b919050565b600080600080600060808688031215610bf457600080fd5b8535610bff81610bab565b94506020860135610c0f81610bab565b9350604086013567ffffffffffffffff80821115610c2c57600080fd5b818801915088601f830112610c4057600080fd5b813581811115610c4f57600080fd5b896020828501011115610c6157600080fd5b6020830195508094505050506060860135610c7b81610bbd565b809150509295509295909350565b67ffffffffffffffff811681146109fd57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260008235610cd981610b08565b6001600160a01b0381166020840152506020830135610cf781610c89565b67ffffffffffffffff808216604085015260408501359150610d1882610bab565b63ffffffff808316606086015260608601359250610d3583610bab565b80831660808601525060808501359150601e19853603018212610d5757600080fd5b90840190813581811115610d6a57600080fd5b803603861315610d7957600080fd5b60c060a0860152610d9160e086018260208601610c9f565b92505050610da160a08501610bcc565b60ff811660c0850152509392505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610ddb57610ddb610db2565b500190565b600060208284031215610df257600080fd5b813561039281610bab565b60008135610e0a81610bab565b92915050565b6000808335601e19843603018112610e2757600080fd5b83018035915067ffffffffffffffff821115610e4257600080fd5b602001915036819003821315610e5757600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610e8857607f821691505b60208210811415610acd57634e487b7160e01b600052602260045260246000fd5b601f8211156108c057600081815260208120601f850160051c81016020861015610ed05750805b601f850160051c820191505b818110156107bb57828155600101610edc565b67ffffffffffffffff831115610f0757610f07610e5e565b610f1b83610f158354610e74565b83610ea9565b6000601f841160018114610f4f5760008515610f375750838201355b600019600387901b1c1916600186901b178355610fa9565b600083815260209020601f19861690835b82811015610f805786850135825560209485019460019092019101610f60565b5086821015610f9d5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008135610e0a81610bbd565b8135610fc881610b08565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff198216178355602084013561100081610c89565b7bffffffffffffffff00000000000000000000000000000000000000008160a01b1690507fffffffff000000000000000000000000000000000000000000000000000000008184828516171785556040860135925061105e83610bab565b921760e09190911b90911617815561109661107b60608401610dfd565b6001830163ffffffff821663ffffffff198254161781555050565b6110a36080830183610e10565b6110b1818360028601610eef565b50506105b56110c260a08401610fb0565b6003830160ff821660ff198254161781555050565b6001600160a01b038816815267ffffffffffffffff87166020820152600063ffffffff808816604084015280871660608401525060c0608083015261112060c083018587610c9f565b905060ff831660a083015298975050505050505050565b600067ffffffffffffffff80831681851680830382111561115a5761115a610db2565b0194935050505056fea26469706673582212204868f18db57f2e292dc3fdf06859212bc2d7ea36d25fe06123502512a3035fcd64736f6c63430008090033", + Bin: "0x6080604052600060055534801561001557600080fd5b5061001f3361009f565b60405161002b906100ef565b604051809103906000f080158015610047573d6000803e3d6000fd5b50600780546001600160a01b0319166001600160a01b039290921691821790556040519081527fbd726cf82ac9c3260b1495107182e336e0654b25c10915648c0cc15b2bb72cbf9060200160405180910390a16100fc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61121d806118bb83390190565b6117b08061010b6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638da5cb5b1161008c578063a52f433c11610066578063a52f433c1461026b578063bbd79e151461027b578063e34fbfc81461028e578063f2fde38b146102a157600080fd5b80638da5cb5b146102205780638fa0d05314610245578063a1a227fa1461025857600080fd5b806359a90071116100c857806359a9007114610160578063715018a614610175578063728109961461017d5780638236a7ba1461018557600080fd5b8063324ff866146100ef57806343348b2f1461010d578063440c953b14610149575b600080fd5b6100f76102b4565b6040516101049190610fd1565b60405180910390f35b61013961011b366004611060565b6001600160a01b031660009081526002602052604090205460ff1690565b6040519015158152602001610104565b61015260055481565b604051908152602001610104565b61017361016e366004611169565b61038d565b005b610173610417565b610173610482565b6101ed610193366004611210565b6040805160608082018352600080835260208084018290529284018190528481526006835283902083519182018452805480835260018201546001600160a01b031693830193909352600201549281019290925290911491565b60408051921515835281516020808501919091528201516001600160a01b03168382015201516060820152608001610104565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610104565b610173610253366004611229565b610554565b60075461022d906001600160a01b031681565b600454610100900460ff16610139565b6101736102893660046112b0565b6105e3565b61017361029c366004611376565b610748565b6101736102af366004611060565b610767565b60606003805480602002602001604051908101604052809291908181526020016000905b828210156103845783829060005260206000200180546102f7906113b8565b80601f0160208091040260200160405190810160405280929190818152602001828054610323906113b8565b80156103705780601f1061034557610100808354040283529160200191610370565b820191906000526020600020905b81548152906001019060200180831161035357829003601f168201915b5050505050815260200190600101906102d8565b50505050905090565b60045460ff161561039d57600080fd5b60048054600160ff1991821681179092556001600160a01b03881660009081526002602090815260408220805490931684179092556003805493840181559052845161040e927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0191860190610e98565b50505050505050565b6000546001600160a01b031633146104765760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6104806000610849565b565b6000546001600160a01b031633146104dc5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046d565b6007546040517f36d2da900000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03909116906336d2da9090602401600060405180830381600087803b15801561053a57600080fd5b505af115801561054e573d6000803e3d6000fd5b50505050565b600260006105686040870160208801611060565b6001600160a01b0316815260208101919091526040016000205460ff166105d15760405162461bcd60e51b815260206004820152601760248201527f61676772656761746f72206e6f74206174746573746564000000000000000000604482015260640161046d565b6105da846108a6565b61054e816108db565b6001600160a01b03861660009081526002602052604090205460ff168061060957600080fd5b81156106d957600061063f8888868860405160200161062b94939291906113f3565b604051602081830303815290604052610995565b9050600061064d82886109d0565b9050886001600160a01b0316816001600160a01b0316146106d65760405162461bcd60e51b815260206004820152602c60248201527f63616c63756c61746564206164647265737320616e642061747465737465724960448201527f4420646f6e74206d617463680000000000000000000000000000000000000000606482015260840161046d565b50505b6001600160a01b03861660009081526002602090815260408220805460ff19166001908117909155600380549182018155909252845161073e927fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0191860190610e98565b5050505050505050565b336000908152600160205260409020610762908383610f1c565b505050565b6000546001600160a01b031633146107c15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161046d565b6001600160a01b03811661083d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161046d565b61084681610849565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8035600090815260066020526040902081906108c2828261144f565b5050600554604082013511156108465760400135600555565b60006108e7828061149b565b9050905060005b81811015610762576007546001600160a01b0316639730886d610911858061149b565b84818110610921576109216114e5565b905060200281019061093391906114fb565b60016040518363ffffffff1660e01b81526004016109529291906115b4565b600060405180830381600087803b15801561096c57600080fd5b505af1158015610980573d6000803e3d6000fd5b505050508061098e90611681565b90506108ee565b60006109a182516109f4565b826040516020016109b392919061169c565b604051602081830303815290604052805190602001209050919050565b60008060006109df8585610b2e565b915091506109ec81610b9e565b509392505050565b606081610a3457505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115610a5e5780610a4881611681565b9150610a579050600a8361170d565b9150610a38565b60008167ffffffffffffffff811115610a7957610a796110c6565b6040519080825280601f01601f191660200182016040528015610aa3576020820181803683370190505b5090505b8415610b2657610ab8600183611721565b9150610ac5600a86611738565b610ad090603061174c565b60f81b818381518110610ae557610ae56114e5565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350610b1f600a8661170d565b9450610aa7565b949350505050565b600080825160411415610b655760208301516040840151606085015160001a610b5987828585610d59565b94509450505050610b97565b825160401415610b8f5760208301516040840151610b84868383610e46565b935093505050610b97565b506000905060025b9250929050565b6000816004811115610bb257610bb2611764565b1415610bbb5750565b6001816004811115610bcf57610bcf611764565b1415610c1d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161046d565b6002816004811115610c3157610c31611764565b1415610c7f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161046d565b6003816004811115610c9357610c93611764565b1415610cec5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161046d565b6004816004811115610d0057610d00611764565b14156108465760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161046d565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115610d905750600090506003610e3d565b8460ff16601b14158015610da857508460ff16601c14155b15610db95750600090506004610e3d565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610e0d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610e3657600060019250925050610e3d565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681610e7c60ff86901c601b61174c565b9050610e8a87828885610d59565b935093505050935093915050565b828054610ea4906113b8565b90600052602060002090601f016020900481019282610ec65760008555610f0c565b82601f10610edf57805160ff1916838001178555610f0c565b82800160010185558215610f0c579182015b82811115610f0c578251825591602001919060010190610ef1565b50610f18929150610f90565b5090565b828054610f28906113b8565b90600052602060002090601f016020900481019282610f4a5760008555610f0c565b82601f10610f635782800160ff19823516178555610f0c565b82800160010185558215610f0c579182015b82811115610f0c578235825591602001919060010190610f75565b5b80821115610f185760008155600101610f91565b60005b83811015610fc0578181015183820152602001610fa8565b8381111561054e5750506000910152565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561103e57878503603f190184528151805180875261101f818989018a8501610fa5565b601f01601f191695909501860194509285019290850190600101610ff8565b5092979650505050505050565b6001600160a01b038116811461084657600080fd5b60006020828403121561107257600080fd5b813561107d8161104b565b9392505050565b60008083601f84011261109657600080fd5b50813567ffffffffffffffff8111156110ae57600080fd5b602083019150836020828501011115610b9757600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f8301126110ed57600080fd5b813567ffffffffffffffff80821115611108576111086110c6565b604051601f8301601f19908116603f01168101908282118183101715611130576111306110c6565b8160405283815286602085880101111561114957600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806000806080878903121561118257600080fd5b863561118d8161104b565b9550602087013567ffffffffffffffff808211156111aa57600080fd5b6111b68a838b01611084565b909750955060408901359150808211156111cf57600080fd5b6111db8a838b016110dc565b945060608901359150808211156111f157600080fd5b506111fe89828a01611084565b979a9699509497509295939492505050565b60006020828403121561122257600080fd5b5035919050565b60008060008084860360a081121561124057600080fd5b606081121561124e57600080fd5b50849350606085013567ffffffffffffffff8082111561126d57600080fd5b61127988838901611084565b9095509350608087013591508082111561129257600080fd5b508501602081880312156112a557600080fd5b939692955090935050565b60008060008060008060c087890312156112c957600080fd5b86356112d48161104b565b955060208701356112e48161104b565b9450604087013567ffffffffffffffff8082111561130157600080fd5b61130d8a838b016110dc565b9550606089013591508082111561132357600080fd5b61132f8a838b016110dc565b9450608089013591508082111561134557600080fd5b5061135289828a016110dc565b92505060a0870135801515811461136857600080fd5b809150509295509295509295565b6000806020838503121561138957600080fd5b823567ffffffffffffffff8111156113a057600080fd5b6113ac85828601611084565b90969095509350505050565b600181811c908216806113cc57607f821691505b602082108114156113ed57634e487b7160e01b600052602260045260246000fd5b50919050565b60006bffffffffffffffffffffffff19808760601b168352808660601b16601484015250835161142a816028850160208801610fa5565b835190830190611441816028840160208801610fa5565b016028019695505050505050565b813581556001810160208301356114658161104b565b6001600160a01b03811673ffffffffffffffffffffffffffffffffffffffff198354161782555050604082013560028201555050565b6000808335601e198436030181126114b257600080fd5b83018035915067ffffffffffffffff8211156114cd57600080fd5b6020019150600581901b3603821315610b9757600080fd5b634e487b7160e01b600052603260045260246000fd5b6000823560be1983360301811261151157600080fd5b9190910192915050565b803563ffffffff8116811461152f57600080fd5b919050565b6000808335601e1984360301811261154b57600080fd5b830160208101925035905067ffffffffffffffff81111561156b57600080fd5b803603831315610b9757600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b803560ff8116811461152f57600080fd5b60408152600083356115c58161104b565b6001600160a01b03166040830152602084013567ffffffffffffffff81168082146115ef57600080fd5b6060840152506116016040850161151b565b63ffffffff1660808301526116186060850161151b565b63ffffffff1660a08301526116306080850185611534565b60c0808501526116456101008501828461157a565b91505061165460a086016115a3565b60ff1660e084015260209092019290925292915050565b634e487b7160e01b600052601160045260246000fd5b60006000198214156116955761169561166b565b5060010190565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600083516116d481601a850160208801610fa5565b8351908301906116eb81601a840160208801610fa5565b01601a01949350505050565b634e487b7160e01b600052601260045260246000fd5b60008261171c5761171c6116f7565b500490565b6000828210156117335761173361166b565b500390565b600082611747576117476116f7565b500690565b6000821982111561175f5761175f61166b565b500190565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220765a7ef4618209e73eb05a59f3e255a5f44cbbae8b2bc601c9dbeb0bbe6df36464736f6c63430008090033608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61119f8061007e6000396000f3fe6080604052600436106100b55760003560e01c80638da5cb5b1161006957806399a3ad211161004e57806399a3ad2114610270578063b1454caa14610290578063f2fde38b146102c95761012e565b80638da5cb5b146102285780639730886d146102505761012e565b8063346633fb1161009a578063346633fb146101de57806336d2da90146101f3578063715018a6146102135761012e565b80630fcfbd111461017b57806333a88c72146101ae5761012e565b3661012e576040517f346633fb0000000000000000000000000000000000000000000000000000000081523360048201523460248201819052309163346633fb91906044016000604051808303818588803b15801561011357600080fd5b505af1158015610127573d6000803e3d6000fd5b5050505050005b60405162461bcd60e51b815260206004820152600b60248201527f756e737570706f7274656400000000000000000000000000000000000000000060448201526064015b60405180910390fd5b34801561018757600080fd5b5061019b610196366004610ad9565b6102e9565b6040519081526020015b60405180910390f35b3480156101ba57600080fd5b506101ce6101c9366004610ad9565b61039f565b60405190151581526020016101a5565b6101f16101ec366004610b23565b6103f2565b005b3480156101ff57600080fd5b506101f161020e366004610b4f565b6104be565b34801561021f57600080fd5b506101f16105bf565b34801561023457600080fd5b506000546040516001600160a01b0390911681526020016101a5565b34801561025c57600080fd5b506101f161026b366004610b6c565b610625565b34801561027c57600080fd5b506101f161028b366004610b23565b6107c9565b34801561029c57600080fd5b506102b06102ab366004610be2565b6108cb565b60405167ffffffffffffffff90911681526020016101a5565b3480156102d557600080fd5b506101f16102e4366004610b4f565b610924565b600080826040516020016102fd9190610cce565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150806103985760405162461bcd60e51b815260206004820152602160248201527f54686973206d65737361676520776173206e65766572207375626d697474656460448201527f2e000000000000000000000000000000000000000000000000000000000000006064820152608401610172565b9392505050565b600080826040516020016103b39190610cce565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915080158015906103ea5750428111155b949350505050565b60003411801561040157508034145b6104735760405162461bcd60e51b815260206004820152603060248201527f417474656d7074696e6720746f2073656e642076616c756520776974686f757460448201527f2070726f766964696e67204574686572000000000000000000000000000000006064820152608401610172565b604080513381526001600160a01b0384166020820152348183015290517ff1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a15609181900360600190a15050565b6000546001600160a01b031633146105185760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b6000816001600160a01b03164760405160006040518083038185875af1925050503d8060008114610565576040519150601f19603f3d011682016040523d82523d6000602084013e61056a565b606091505b50509050806105bb5760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610172565b5050565b6000546001600160a01b031633146106195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b6106236000610a06565b565b6000546001600160a01b0316331461067f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b600061068b8242610dce565b90506000836040516020016106a09190610cce565b60408051601f198184030181529181528151602092830120600081815260019093529120549091501561073b5760405162461bcd60e51b815260206004820152602160248201527f4d657373616765207375626d6974746564206d6f7265207468616e206f6e636560448201527f21000000000000000000000000000000000000000000000000000000000000006064820152608401610172565b600081815260016020908152604082208490556002919061075e90870187610b4f565b6001600160a01b03168152602081019190915260400160009081209061078a6080870160608801610de6565b63ffffffff168152602080820192909252604001600090812080546001810182559082529190208591600402016107c18282610fc3565b505050505050565b6000546001600160a01b031633146108235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610870576040519150601f19603f3d011682016040523d82523d6000602084013e610875565b606091505b50509050806108c65760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610172565b505050565b60006108d633610a63565b90507fb93c37389233beb85a3a726c3f15c2d15533ee74cb602f20f490dfffef7759373382888888888860405161091397969594939291906110dd565b60405180910390a195945050505050565b6000546001600160a01b0316331461097e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b6001600160a01b0381166109fa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610172565b610a0381610a06565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600360205260408120805467ffffffffffffffff169160019190610a96838561113d565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550919050565b600060c08284031215610ad357600080fd5b50919050565b600060208284031215610aeb57600080fd5b813567ffffffffffffffff811115610b0257600080fd5b6103ea84828501610ac1565b6001600160a01b0381168114610a0357600080fd5b60008060408385031215610b3657600080fd5b8235610b4181610b0e565b946020939093013593505050565b600060208284031215610b6157600080fd5b813561039881610b0e565b60008060408385031215610b7f57600080fd5b823567ffffffffffffffff811115610b9657600080fd5b610ba285828601610ac1565b95602094909401359450505050565b63ffffffff81168114610a0357600080fd5b60ff81168114610a0357600080fd5b8035610bdd81610bc3565b919050565b600080600080600060808688031215610bfa57600080fd5b8535610c0581610bb1565b94506020860135610c1581610bb1565b9350604086013567ffffffffffffffff80821115610c3257600080fd5b818801915088601f830112610c4657600080fd5b813581811115610c5557600080fd5b896020828501011115610c6757600080fd5b6020830195508094505050506060860135610c8181610bc3565b809150509295509295909350565b67ffffffffffffffff81168114610a0357600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260008235610cdf81610b0e565b6001600160a01b0381166020840152506020830135610cfd81610c8f565b67ffffffffffffffff808216604085015260408501359150610d1e82610bb1565b63ffffffff808316606086015260608601359250610d3b83610bb1565b80831660808601525060808501359150601e19853603018212610d5d57600080fd5b90840190813581811115610d7057600080fd5b803603861315610d7f57600080fd5b60c060a0860152610d9760e086018260208601610ca5565b92505050610da760a08501610bd2565b60ff811660c0850152509392505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610de157610de1610db8565b500190565b600060208284031215610df857600080fd5b813561039881610bb1565b60008135610e1081610bb1565b92915050565b6000808335601e19843603018112610e2d57600080fd5b83018035915067ffffffffffffffff821115610e4857600080fd5b602001915036819003821315610e5d57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610e8e57607f821691505b60208210811415610ad357634e487b7160e01b600052602260045260246000fd5b601f8211156108c657600081815260208120601f850160051c81016020861015610ed65750805b601f850160051c820191505b818110156107c157828155600101610ee2565b67ffffffffffffffff831115610f0d57610f0d610e64565b610f2183610f1b8354610e7a565b83610eaf565b6000601f841160018114610f555760008515610f3d5750838201355b600019600387901b1c1916600186901b178355610faf565b600083815260209020601f19861690835b82811015610f865786850135825560209485019460019092019101610f66565b5086821015610fa35760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008135610e1081610bc3565b8135610fce81610b0e565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff198216178355602084013561100681610c8f565b7bffffffffffffffff00000000000000000000000000000000000000008160a01b1690507fffffffff000000000000000000000000000000000000000000000000000000008184828516171785556040860135925061106483610bb1565b921760e09190911b90911617815561109c61108160608401610e03565b6001830163ffffffff821663ffffffff198254161781555050565b6110a96080830183610e16565b6110b7818360028601610ef5565b50506105bb6110c860a08401610fb6565b6003830160ff821660ff198254161781555050565b6001600160a01b038816815267ffffffffffffffff87166020820152600063ffffffff808816604084015280871660608401525060c0608083015261112660c083018587610ca5565b905060ff831660a083015298975050505050505050565b600067ffffffffffffffff80831681851680830382111561116057611160610db8565b0194935050505056fea2646970667358221220a54aad59b2972196a793838aab3ac603764d8f10f53f8b069358ac232fba77fe64736f6c63430008090033", } // ManagementContractABI is the input ABI used to generate the binding from. diff --git a/contracts/generated/MessageBus/MessageBus.go b/contracts/generated/MessageBus/MessageBus.go index 3a60a7e03a..464bede112 100644 --- a/contracts/generated/MessageBus/MessageBus.go +++ b/contracts/generated/MessageBus/MessageBus.go @@ -42,7 +42,7 @@ type StructsCrossChainMessage struct { // MessageBusMetaData contains all meta data concerning the MessageBus contract. var MessageBusMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"name\":\"LogMessagePublished\",\"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\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"ValueTransfer\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"}],\"name\":\"getMessageTimeOfFinality\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"name\":\"publishMessage\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"receiveValueFromL2\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"retrieveAllFunds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"sendValueToL2\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"finalAfterTimestamp\",\"type\":\"uint256\"}],\"name\":\"storeCrossChainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"sequence\",\"type\":\"uint64\"},{\"internalType\":\"uint32\",\"name\":\"nonce\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"topic\",\"type\":\"uint32\"},{\"internalType\":\"bytes\",\"name\":\"payload\",\"type\":\"bytes\"},{\"internalType\":\"uint8\",\"name\":\"consistencyLevel\",\"type\":\"uint8\"}],\"internalType\":\"structStructs.CrossChainMessage\",\"name\":\"crossChainMessage\",\"type\":\"tuple\"}],\"name\":\"verifyMessageFinalized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6111998061007e6000396000f3fe6080604052600436106100b55760003560e01c80638da5cb5b1161006957806399a3ad211161004e57806399a3ad211461026a578063b1454caa1461028a578063f2fde38b146102c35761012d565b80638da5cb5b146102225780639730886d1461024a5761012d565b8063346633fb1161009a578063346633fb146101d857806336d2da90146101ed578063715018a61461020d5761012d565b80630fcfbd111461017557806333a88c72146101a85761012d565b3661012d5760405162461bcd60e51b815260206004820152602c60248201527f74686520576f726d686f6c6520636f6e747261637420646f6573206e6f74206160448201527f636365707420617373657473000000000000000000000000000000000000000060648201526084015b60405180910390fd5b60405162461bcd60e51b815260206004820152600b60248201527f756e737570706f727465640000000000000000000000000000000000000000006044820152606401610124565b34801561018157600080fd5b50610195610190366004610ad3565b6102e3565b6040519081526020015b60405180910390f35b3480156101b457600080fd5b506101c86101c3366004610ad3565b610399565b604051901515815260200161019f565b6101eb6101e6366004610b1d565b6103ec565b005b3480156101f957600080fd5b506101eb610208366004610b49565b6104b8565b34801561021957600080fd5b506101eb6105b9565b34801561022e57600080fd5b506000546040516001600160a01b03909116815260200161019f565b34801561025657600080fd5b506101eb610265366004610b66565b61061f565b34801561027657600080fd5b506101eb610285366004610b1d565b6107c3565b34801561029657600080fd5b506102aa6102a5366004610bdc565b6108c5565b60405167ffffffffffffffff909116815260200161019f565b3480156102cf57600080fd5b506101eb6102de366004610b49565b61091e565b600080826040516020016102f79190610cc8565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150806103925760405162461bcd60e51b815260206004820152602160248201527f54686973206d65737361676520776173206e65766572207375626d697474656460448201527f2e000000000000000000000000000000000000000000000000000000000000006064820152608401610124565b9392505050565b600080826040516020016103ad9190610cc8565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915080158015906103e45750428111155b949350505050565b6000341180156103fb57508034145b61046d5760405162461bcd60e51b815260206004820152603060248201527f417474656d7074696e6720746f2073656e642076616c756520776974686f757460448201527f2070726f766964696e67204574686572000000000000000000000000000000006064820152608401610124565b604080513381526001600160a01b0384166020820152348183015290517ff1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a15609181900360600190a15050565b6000546001600160a01b031633146105125760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b6000816001600160a01b03164760405160006040518083038185875af1925050503d806000811461055f576040519150601f19603f3d011682016040523d82523d6000602084013e610564565b606091505b50509050806105b55760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610124565b5050565b6000546001600160a01b031633146106135760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b61061d6000610a00565b565b6000546001600160a01b031633146106795760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b60006106858242610dc8565b905060008360405160200161069a9190610cc8565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150156107355760405162461bcd60e51b815260206004820152602160248201527f4d657373616765207375626d6974746564206d6f7265207468616e206f6e636560448201527f21000000000000000000000000000000000000000000000000000000000000006064820152608401610124565b600081815260016020908152604082208490556002919061075890870187610b49565b6001600160a01b0316815260208101919091526040016000908120906107846080870160608801610de0565b63ffffffff168152602080820192909252604001600090812080546001810182559082529190208591600402016107bb8282610fbd565b505050505050565b6000546001600160a01b0316331461081d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461086a576040519150601f19603f3d011682016040523d82523d6000602084013e61086f565b606091505b50509050806108c05760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610124565b505050565b60006108d033610a5d565b90507fb93c37389233beb85a3a726c3f15c2d15533ee74cb602f20f490dfffef7759373382888888888860405161090d97969594939291906110d7565b60405180910390a195945050505050565b6000546001600160a01b031633146109785760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610124565b6001600160a01b0381166109f45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610124565b6109fd81610a00565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600360205260408120805467ffffffffffffffff169160019190610a908385611137565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550919050565b600060c08284031215610acd57600080fd5b50919050565b600060208284031215610ae557600080fd5b813567ffffffffffffffff811115610afc57600080fd5b6103e484828501610abb565b6001600160a01b03811681146109fd57600080fd5b60008060408385031215610b3057600080fd5b8235610b3b81610b08565b946020939093013593505050565b600060208284031215610b5b57600080fd5b813561039281610b08565b60008060408385031215610b7957600080fd5b823567ffffffffffffffff811115610b9057600080fd5b610b9c85828601610abb565b95602094909401359450505050565b63ffffffff811681146109fd57600080fd5b60ff811681146109fd57600080fd5b8035610bd781610bbd565b919050565b600080600080600060808688031215610bf457600080fd5b8535610bff81610bab565b94506020860135610c0f81610bab565b9350604086013567ffffffffffffffff80821115610c2c57600080fd5b818801915088601f830112610c4057600080fd5b813581811115610c4f57600080fd5b896020828501011115610c6157600080fd5b6020830195508094505050506060860135610c7b81610bbd565b809150509295509295909350565b67ffffffffffffffff811681146109fd57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260008235610cd981610b08565b6001600160a01b0381166020840152506020830135610cf781610c89565b67ffffffffffffffff808216604085015260408501359150610d1882610bab565b63ffffffff808316606086015260608601359250610d3583610bab565b80831660808601525060808501359150601e19853603018212610d5757600080fd5b90840190813581811115610d6a57600080fd5b803603861315610d7957600080fd5b60c060a0860152610d9160e086018260208601610c9f565b92505050610da160a08501610bcc565b60ff811660c0850152509392505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610ddb57610ddb610db2565b500190565b600060208284031215610df257600080fd5b813561039281610bab565b60008135610e0a81610bab565b92915050565b6000808335601e19843603018112610e2757600080fd5b83018035915067ffffffffffffffff821115610e4257600080fd5b602001915036819003821315610e5757600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610e8857607f821691505b60208210811415610acd57634e487b7160e01b600052602260045260246000fd5b601f8211156108c057600081815260208120601f850160051c81016020861015610ed05750805b601f850160051c820191505b818110156107bb57828155600101610edc565b67ffffffffffffffff831115610f0757610f07610e5e565b610f1b83610f158354610e74565b83610ea9565b6000601f841160018114610f4f5760008515610f375750838201355b600019600387901b1c1916600186901b178355610fa9565b600083815260209020601f19861690835b82811015610f805786850135825560209485019460019092019101610f60565b5086821015610f9d5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008135610e0a81610bbd565b8135610fc881610b08565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff198216178355602084013561100081610c89565b7bffffffffffffffff00000000000000000000000000000000000000008160a01b1690507fffffffff000000000000000000000000000000000000000000000000000000008184828516171785556040860135925061105e83610bab565b921760e09190911b90911617815561109661107b60608401610dfd565b6001830163ffffffff821663ffffffff198254161781555050565b6110a36080830183610e10565b6110b1818360028601610eef565b50506105b56110c260a08401610fb0565b6003830160ff821660ff198254161781555050565b6001600160a01b038816815267ffffffffffffffff87166020820152600063ffffffff808816604084015280871660608401525060c0608083015261112060c083018587610c9f565b905060ff831660a083015298975050505050505050565b600067ffffffffffffffff80831681851680830382111561115a5761115a610db2565b0194935050505056fea26469706673582212204868f18db57f2e292dc3fdf06859212bc2d7ea36d25fe06123502512a3035fcd64736f6c63430008090033", + Bin: "0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61119f8061007e6000396000f3fe6080604052600436106100b55760003560e01c80638da5cb5b1161006957806399a3ad211161004e57806399a3ad2114610270578063b1454caa14610290578063f2fde38b146102c95761012e565b80638da5cb5b146102285780639730886d146102505761012e565b8063346633fb1161009a578063346633fb146101de57806336d2da90146101f3578063715018a6146102135761012e565b80630fcfbd111461017b57806333a88c72146101ae5761012e565b3661012e576040517f346633fb0000000000000000000000000000000000000000000000000000000081523360048201523460248201819052309163346633fb91906044016000604051808303818588803b15801561011357600080fd5b505af1158015610127573d6000803e3d6000fd5b5050505050005b60405162461bcd60e51b815260206004820152600b60248201527f756e737570706f7274656400000000000000000000000000000000000000000060448201526064015b60405180910390fd5b34801561018757600080fd5b5061019b610196366004610ad9565b6102e9565b6040519081526020015b60405180910390f35b3480156101ba57600080fd5b506101ce6101c9366004610ad9565b61039f565b60405190151581526020016101a5565b6101f16101ec366004610b23565b6103f2565b005b3480156101ff57600080fd5b506101f161020e366004610b4f565b6104be565b34801561021f57600080fd5b506101f16105bf565b34801561023457600080fd5b506000546040516001600160a01b0390911681526020016101a5565b34801561025c57600080fd5b506101f161026b366004610b6c565b610625565b34801561027c57600080fd5b506101f161028b366004610b23565b6107c9565b34801561029c57600080fd5b506102b06102ab366004610be2565b6108cb565b60405167ffffffffffffffff90911681526020016101a5565b3480156102d557600080fd5b506101f16102e4366004610b4f565b610924565b600080826040516020016102fd9190610cce565b60408051601f19818403018152918152815160209283012060008181526001909352912054909150806103985760405162461bcd60e51b815260206004820152602160248201527f54686973206d65737361676520776173206e65766572207375626d697474656460448201527f2e000000000000000000000000000000000000000000000000000000000000006064820152608401610172565b9392505050565b600080826040516020016103b39190610cce565b60408051601f1981840301815291815281516020928301206000818152600190935291205490915080158015906103ea5750428111155b949350505050565b60003411801561040157508034145b6104735760405162461bcd60e51b815260206004820152603060248201527f417474656d7074696e6720746f2073656e642076616c756520776974686f757460448201527f2070726f766964696e67204574686572000000000000000000000000000000006064820152608401610172565b604080513381526001600160a01b0384166020820152348183015290517ff1365f826a788d6c1a955db0eed5ba8642674219c4771f8c65918617511a15609181900360600190a15050565b6000546001600160a01b031633146105185760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b6000816001600160a01b03164760405160006040518083038185875af1925050503d8060008114610565576040519150601f19603f3d011682016040523d82523d6000602084013e61056a565b606091505b50509050806105bb5760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610172565b5050565b6000546001600160a01b031633146106195760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b6106236000610a06565b565b6000546001600160a01b0316331461067f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b600061068b8242610dce565b90506000836040516020016106a09190610cce565b60408051601f198184030181529181528151602092830120600081815260019093529120549091501561073b5760405162461bcd60e51b815260206004820152602160248201527f4d657373616765207375626d6974746564206d6f7265207468616e206f6e636560448201527f21000000000000000000000000000000000000000000000000000000000000006064820152608401610172565b600081815260016020908152604082208490556002919061075e90870187610b4f565b6001600160a01b03168152602081019190915260400160009081209061078a6080870160608801610de6565b63ffffffff168152602080820192909252604001600090812080546001810182559082529190208591600402016107c18282610fc3565b505050505050565b6000546001600160a01b031633146108235760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610870576040519150601f19603f3d011682016040523d82523d6000602084013e610875565b606091505b50509050806108c65760405162461bcd60e51b815260206004820152601460248201527f6661696c65642073656e64696e672076616c75650000000000000000000000006044820152606401610172565b505050565b60006108d633610a63565b90507fb93c37389233beb85a3a726c3f15c2d15533ee74cb602f20f490dfffef7759373382888888888860405161091397969594939291906110dd565b60405180910390a195945050505050565b6000546001600160a01b0316331461097e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610172565b6001600160a01b0381166109fa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610172565b610a0381610a06565b50565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381166000908152600360205260408120805467ffffffffffffffff169160019190610a96838561113d565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550919050565b600060c08284031215610ad357600080fd5b50919050565b600060208284031215610aeb57600080fd5b813567ffffffffffffffff811115610b0257600080fd5b6103ea84828501610ac1565b6001600160a01b0381168114610a0357600080fd5b60008060408385031215610b3657600080fd5b8235610b4181610b0e565b946020939093013593505050565b600060208284031215610b6157600080fd5b813561039881610b0e565b60008060408385031215610b7f57600080fd5b823567ffffffffffffffff811115610b9657600080fd5b610ba285828601610ac1565b95602094909401359450505050565b63ffffffff81168114610a0357600080fd5b60ff81168114610a0357600080fd5b8035610bdd81610bc3565b919050565b600080600080600060808688031215610bfa57600080fd5b8535610c0581610bb1565b94506020860135610c1581610bb1565b9350604086013567ffffffffffffffff80821115610c3257600080fd5b818801915088601f830112610c4657600080fd5b813581811115610c5557600080fd5b896020828501011115610c6757600080fd5b6020830195508094505050506060860135610c8181610bc3565b809150509295509295909350565b67ffffffffffffffff81168114610a0357600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260008235610cdf81610b0e565b6001600160a01b0381166020840152506020830135610cfd81610c8f565b67ffffffffffffffff808216604085015260408501359150610d1e82610bb1565b63ffffffff808316606086015260608601359250610d3b83610bb1565b80831660808601525060808501359150601e19853603018212610d5d57600080fd5b90840190813581811115610d7057600080fd5b803603861315610d7f57600080fd5b60c060a0860152610d9760e086018260208601610ca5565b92505050610da760a08501610bd2565b60ff811660c0850152509392505050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610de157610de1610db8565b500190565b600060208284031215610df857600080fd5b813561039881610bb1565b60008135610e1081610bb1565b92915050565b6000808335601e19843603018112610e2d57600080fd5b83018035915067ffffffffffffffff821115610e4857600080fd5b602001915036819003821315610e5d57600080fd5b9250929050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680610e8e57607f821691505b60208210811415610ad357634e487b7160e01b600052602260045260246000fd5b601f8211156108c657600081815260208120601f850160051c81016020861015610ed65750805b601f850160051c820191505b818110156107c157828155600101610ee2565b67ffffffffffffffff831115610f0d57610f0d610e64565b610f2183610f1b8354610e7a565b83610eaf565b6000601f841160018114610f555760008515610f3d5750838201355b600019600387901b1c1916600186901b178355610faf565b600083815260209020601f19861690835b82811015610f865786850135825560209485019460019092019101610f66565b5086821015610fa35760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008135610e1081610bc3565b8135610fce81610b0e565b6001600160a01b038116905081548173ffffffffffffffffffffffffffffffffffffffff198216178355602084013561100681610c8f565b7bffffffffffffffff00000000000000000000000000000000000000008160a01b1690507fffffffff000000000000000000000000000000000000000000000000000000008184828516171785556040860135925061106483610bb1565b921760e09190911b90911617815561109c61108160608401610e03565b6001830163ffffffff821663ffffffff198254161781555050565b6110a96080830183610e16565b6110b7818360028601610ef5565b50506105bb6110c860a08401610fb6565b6003830160ff821660ff198254161781555050565b6001600160a01b038816815267ffffffffffffffff87166020820152600063ffffffff808816604084015280871660608401525060c0608083015261112660c083018587610ca5565b905060ff831660a083015298975050505050505050565b600067ffffffffffffffff80831681851680830382111561116057611160610db8565b0194935050505056fea2646970667358221220a54aad59b2972196a793838aab3ac603764d8f10f53f8b069358ac232fba77fe64736f6c63430008090033", } // MessageBusABI is the input ABI used to generate the binding from. diff --git a/contracts/src/messaging/MessageBus.sol b/contracts/src/messaging/MessageBus.sol index 668877072f..cbab6063bd 100644 --- a/contracts/src/messaging/MessageBus.sol +++ b/contracts/src/messaging/MessageBus.sol @@ -134,6 +134,6 @@ contract MessageBus is IMessageBus, Ownable { } receive() external payable { - revert("the Wormhole contract does not accept assets"); + this.sendValueToL2{value: msg.value}(msg.sender, msg.value); } } diff --git a/go/enclave/components/batch_executor.go b/go/enclave/components/batch_executor.go index 3d75a8ff95..a00530b5f9 100644 --- a/go/enclave/components/batch_executor.go +++ b/go/enclave/components/batch_executor.go @@ -95,7 +95,7 @@ func (executor *batchExecutor) payL1Fees(stateDB *state.StateDB, context *BatchE continue } if accBalance.Cmp(cost) == -1 { - executor.logger.Info("insufficient account balance for tx", log.TxKey, tx.Hash(), "addr", sender.Hex()) + executor.logger.Info(fmt.Sprintf("insufficient account balance for tx - want: %d have: %d", cost, accBalance), log.TxKey, tx.Hash(), "addr", sender.Hex()) continue } stateDB.SubBalance(*sender, cost) diff --git a/go/enclave/enclave_test.go b/go/enclave/enclave_test.go index 3b18d6dc92..521fe0b86d 100644 --- a/go/enclave/enclave_test.go +++ b/go/enclave/enclave_test.go @@ -38,7 +38,7 @@ const _testEnclavePublicKeyHex = "034d3b7e63a8bcd532ee3d1d6ecad9d67fca7821981a04 // _successfulRollupGasPrice can be deterministically calculated when evaluating the management smart contract. // It should change only when there are changes to the smart contract or if the gas estimation algorithm is modified. // Other changes would mean something is broken. -const _successfulRollupGasPrice = 371816 +const _successfulRollupGasPrice = 372008 var _enclavePubKey *ecies.PublicKey diff --git a/go/enclave/storage/init/edgelessdb/001_init.sql b/go/enclave/storage/init/edgelessdb/001_init.sql index aa49dafc87..098ff49602 100644 --- a/go/enclave/storage/init/edgelessdb/001_init.sql +++ b/go/enclave/storage/init/edgelessdb/001_init.sql @@ -44,7 +44,7 @@ create table if not exists obsdb.l1_msg id INTEGER AUTO_INCREMENT, message varbinary(1024) NOT NULL, block binary(16) NOT NULL, - is_transfer boolean NOT NULL, + is_transfer boolean NOT NULL, INDEX (block), primary key (id) ); diff --git a/go/node/config.go b/go/node/config.go index def6a4bc32..3131294d28 100644 --- a/go/node/config.go +++ b/go/node/config.go @@ -52,6 +52,7 @@ type Config struct { batchInterval string rollupInterval string l1ChainID int + obscuroGenesis string } func NewNodeConfig(opts ...Option) *Config { @@ -59,6 +60,7 @@ func NewNodeConfig(opts ...Option) *Config { batchInterval: "1s", rollupInterval: "3s", l1ChainID: 1337, + obscuroGenesis: "{}", } for _, opt := range opts { @@ -84,6 +86,7 @@ func (c *Config) ToEnclaveConfig() *config.EnclaveConfig { cfg.LogLevel = c.logLevel cfg.Address = fmt.Sprintf("%s:%d", _localhost, c.enclaveWSPort) cfg.DebugNamespaceEnabled = c.debugNamespaceEnabled + cfg.ObscuroGenesis = c.obscuroGenesis if c.nodeType == "sequencer" && c.coinbaseAddress != "" { cfg.GasPaymentAddress = gethcommon.HexToAddress(c.coinbaseAddress) @@ -323,3 +326,9 @@ func WithL1ChainID(i int) Option { c.l1ChainID = i } } + +func WithObscuroGenesis(g string) Option { + return func(c *Config) { + c.obscuroGenesis = g + } +} diff --git a/go/node/docker_node.go b/go/node/docker_node.go index 4f1a6d296c..51ab8bdfec 100644 --- a/go/node/docker_node.go +++ b/go/node/docker_node.go @@ -181,6 +181,7 @@ func (d *DockerNode) startEnclave() error { "-maxBatchSize=25600", "-maxRollupSize=65536", fmt.Sprintf("-logLevel=%d", d.cfg.logLevel), + "-obscuroGenesis", "{}", ) if d.cfg.sgxEnabled { diff --git a/go/wallet/wallet.go b/go/wallet/wallet.go index 1b69552655..24547839ae 100644 --- a/go/wallet/wallet.go +++ b/go/wallet/wallet.go @@ -20,6 +20,7 @@ type Wallet interface { Address() common.Address // SignTransaction returns a signed transaction SignTransaction(tx types.TxData) (*types.Transaction, error) + SignTransactionForChainID(tx types.TxData, chainID *big.Int) (*types.Transaction, error) // SetNonce overrides the current nonce // The GetTransactionCount is expected to be the next nonce to use in a transaction, not the current account GetTransactionCount @@ -71,6 +72,10 @@ func (m *inMemoryWallet) SignTransaction(tx types.TxData) (*types.Transaction, e return types.SignNewTx(m.prvKey, types.NewLondonSigner(m.chainID), tx) } +func (m *inMemoryWallet) SignTransactionForChainID(tx types.TxData, chainID *big.Int) (*types.Transaction, error) { + return types.SignNewTx(m.prvKey, types.NewLondonSigner(chainID), tx) +} + // Address returns the current wallet address func (m *inMemoryWallet) Address() common.Address { return m.pubKeyAddr diff --git a/integration/contractdeployer/contract_deployer_test.go b/integration/contractdeployer/contract_deployer_test.go index 8763545a53..398254b03c 100644 --- a/integration/contractdeployer/contract_deployer_test.go +++ b/integration/contractdeployer/contract_deployer_test.go @@ -142,6 +142,7 @@ func createObscuroNetwork(t *testing.T, startPort int) { ERC20ContractLib: ethereummock.NewERC20ContractLibMock(), Wallets: wallets, StartPort: startPort, + WithPrefunding: true, } simStats := stats.NewStats(simParams.NumberOfNodes) obscuroNetwork := network.NewNetworkOfSocketNodes(wallets) diff --git a/integration/eth2network/eth2_configs.go b/integration/eth2network/eth2_configs.go index 3dd8ecf175..582095f855 100644 --- a/integration/eth2network/eth2_configs.go +++ b/integration/eth2network/eth2_configs.go @@ -106,7 +106,7 @@ func generateGenesis(blockTimeSecs int, chainID int, signerAddrs, prefundedAddrs // add the prefunded prefundedAddrs for _, account := range prefundedAddrs { - genesisJSON["alloc"].(map[string]interface{})[account] = map[string]string{"balance": "10000000000000000000000"} + genesisJSON["alloc"].(map[string]interface{})[account] = map[string]string{"balance": "7500000000000000000000000000000"} } // set the block prod speed diff --git a/integration/faucet/faucet_test.go b/integration/faucet/faucet_test.go index 354b340309..5d072634d8 100644 --- a/integration/faucet/faucet_test.go +++ b/integration/faucet/faucet_test.go @@ -86,6 +86,7 @@ func createObscuroNetwork(t *testing.T, startPort int) { ERC20ContractLib: ethereummock.NewERC20ContractLibMock(), Wallets: wallets, StartPort: startPort, + WithPrefunding: true, } obscuroNetwork := network.NewNetworkOfSocketNodes(wallets) diff --git a/integration/networktest/userwallet/userwallet.go b/integration/networktest/userwallet/userwallet.go index 5faba24d47..99d0603b2d 100644 --- a/integration/networktest/userwallet/userwallet.go +++ b/integration/networktest/userwallet/userwallet.go @@ -146,6 +146,10 @@ func (s *UserWallet) SignTransaction(tx types.TxData) (*types.Transaction, error return types.SignNewTx(s.privateKey, types.NewLondonSigner(s.chainID), tx) } +func (s *UserWallet) SignTransactionForChainID(tx types.TxData, chainID *big.Int) (*types.Transaction, error) { + return types.SignNewTx(s.privateKey, types.NewLondonSigner(chainID), tx) +} + func (s *UserWallet) GetNonce() uint64 { return s.nonce } diff --git a/integration/simulation/network/socket.go b/integration/simulation/network/socket.go index 504ed52e90..9784365802 100644 --- a/integration/simulation/network/socket.go +++ b/integration/simulation/network/socket.go @@ -79,6 +79,11 @@ func (n *networkOfSocketNodes) Create(simParams *params.SimParams, _ *stats.Stat isInboundP2PDisabled = i == simParams.NodeWithInboundP2PDisabled } + genesis := "{}" + if simParams.WithPrefunding { + genesis = "" + } + // create the nodes nodes[i] = noderunner.NewInMemNode( node.NewNodeConfig( @@ -100,6 +105,7 @@ func (n *networkOfSocketNodes) Create(simParams *params.SimParams, _ *stats.Stat node.WithLogLevel(4), node.WithDebugNamespaceEnabled(true), node.WithL1BlockTime(simParams.AvgBlockDuration), + node.WithObscuroGenesis(genesis), ), ) diff --git a/integration/simulation/params/params.go b/integration/simulation/params/params.go index c58361ffdc..e550820b6a 100644 --- a/integration/simulation/params/params.go +++ b/integration/simulation/params/params.go @@ -38,6 +38,7 @@ type SimParams struct { StoppingDelay time.Duration // How long to wait between injection and verification NodeWithInboundP2PDisabled int + WithPrefunding bool } type L1SetupData struct { diff --git a/integration/simulation/params/wallet_utils.go b/integration/simulation/params/wallet_utils.go index 27e69aaad6..cd2b1d9ed7 100644 --- a/integration/simulation/params/wallet_utils.go +++ b/integration/simulation/params/wallet_utils.go @@ -29,6 +29,12 @@ type SimToken struct { L2ContractAddress *common.Address } +type L1PrefundWallets struct { + HOC wallet.Wallet + POC wallet.Wallet + Faucet wallet.Wallet +} + type SimWallets struct { MCOwnerWallet wallet.Wallet // owner of the management contract deployed on Ethereum NodeWallets []wallet.Wallet // the keys used by the obscuro nodes to submit rollups to Eth @@ -41,6 +47,8 @@ type SimWallets struct { L2FaucetWallet wallet.Wallet // the wallet of the L2 faucet L2FeesWallet wallet.Wallet Tokens map[testcommon.ERC20]*SimToken // The supported tokens + + PrefundedEthWallets L1PrefundWallets } func NewSimWallets(nrSimWallets int, nNodes int, ethereumChainID int64, obscuroChainID int64) *SimWallets { @@ -100,6 +108,11 @@ func NewSimWallets(nrSimWallets int, nNodes int, ethereumChainID int64, obscuroC testcommon.HOC: &hoc, testcommon.POC: &poc, }, + PrefundedEthWallets: L1PrefundWallets{ + HOC: datagenerator.RandomWallet(ethereumChainID), + POC: datagenerator.RandomWallet(ethereumChainID), + Faucet: datagenerator.RandomWallet(ethereumChainID), + }, } } @@ -109,6 +122,9 @@ func (w *SimWallets) AllEthWallets() []wallet.Wallet { ethWallets = append(ethWallets, token.L1Owner) } ethWallets = append(ethWallets, w.GasBridgeWallet) + ethWallets = append(ethWallets, w.PrefundedEthWallets.POC) + ethWallets = append(ethWallets, w.PrefundedEthWallets.HOC) + ethWallets = append(ethWallets, w.PrefundedEthWallets.Faucet) return append(append(append(w.NodeWallets, w.SimEthWallets...), w.MCOwnerWallet), ethWallets...) } diff --git a/integration/simulation/simulation.go b/integration/simulation/simulation.go index 4c4a5c6b64..376d20c0ea 100644 --- a/integration/simulation/simulation.go +++ b/integration/simulation/simulation.go @@ -9,8 +9,10 @@ import ( "time" "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" + "github.com/obscuronet/go-obscuro/contracts/generated/MessageBus" "github.com/obscuronet/go-obscuro/go/common" "github.com/obscuronet/go-obscuro/go/common/errutil" "github.com/obscuronet/go-obscuro/go/common/log" @@ -56,6 +58,7 @@ func (s *Simulation) Start() { // Arbitrary sleep to wait for RPC clients to get up and running time.Sleep(1 * time.Second) + s.bridgeFundingToObscuro() s.trackLogs() // Create log subscriptions, to validate that they're working correctly later. s.prefundObscuroAccounts() // Prefund every L2 wallet s.deployObscuroERC20s() // Deploy the Obscuro HOC and POC ERC20 contracts @@ -116,6 +119,63 @@ func (s *Simulation) waitForObscuroGenesisOnL1() { } } +func (s *Simulation) bridgeFundingToObscuro() { + if s.Params.IsInMem { + return + } + + destAddr := s.Params.L1SetupData.MessageBusAddr + value, _ := big.NewInt(0).SetString("7400000000000000000000000000000", 10) + + wallets := []wallet.Wallet{ + s.Params.Wallets.PrefundedEthWallets.Faucet, + s.Params.Wallets.PrefundedEthWallets.HOC, + s.Params.Wallets.PrefundedEthWallets.POC, + } + + receivers := []gethcommon.Address{ + gethcommon.HexToAddress("0xA58C60cc047592DE97BF1E8d2f225Fc5D959De77"), + gethcommon.HexToAddress("0x987E0a0692475bCc5F13D97E700bb43c1913EFfe"), + gethcommon.HexToAddress("0xDEe530E22045939e6f6a0A593F829e35A140D3F1"), + } + + ethClient := s.RPCHandles.RndEthClient() + + busCtr, err := MessageBus.NewMessageBus(destAddr, ethClient.EthClient()) + if err != nil { + panic(err) + } + + for idx, wallet := range wallets { + opts, err := bind.NewKeyedTransactorWithChainID(wallet.PrivateKey(), wallet.ChainID()) + if err != nil { + panic(err) + } + opts.Value = value + + _, err = busCtr.SendValueToL2(opts, receivers[idx], value) + if err != nil { + panic(err) + } + } + + time.Sleep(3 * time.Second) + // todo - fix the wait group, for whatever reason it does not find a receipt... + /*wg := sync.WaitGroup{} + for _, tx := range transactions { + wg.Add(1) + transaction := tx + go func() { + defer wg.Done() + err := testcommon.AwaitReceiptEth(s.ctx, s.RPCHandles.RndEthClient(), transaction.Hash(), 20*time.Second) + if err != nil { + panic(err) + } + }() + } + wg.Wait()*/ +} + // We subscribe to logs on every client for every wallet. func (s *Simulation) trackLogs() { // In-memory clients cannot handle subscriptions for now. diff --git a/testnet/launcher/l2contractdeployer/docker.go b/testnet/launcher/l2contractdeployer/docker.go index 248e73d04a..5c04959d9a 100644 --- a/testnet/launcher/l2contractdeployer/docker.go +++ b/testnet/launcher/l2contractdeployer/docker.go @@ -54,6 +54,7 @@ func (n *ContractDeployer) Start() error { "saveDeployments" : true, "companionNetworks" : { "layer1" : "layer1" }, "deploy": [ + "deployment_scripts/funding/layer1", "deployment_scripts/messenger/layer1", "deployment_scripts/messenger/layer2", "deployment_scripts/bridge/",