From 74bd461105257684cbd9bcd39baef68a96230925 Mon Sep 17 00:00:00 2001 From: Bruno Wu Date: Wed, 31 Jan 2024 12:57:36 +0000 Subject: [PATCH] ZIL-5548: Bridge listening to finalized blocks + legacy gas estimation config + disable p2p (#355) * Code for getting blocks * Fixed getting and submitting events to chain * update * Update block querying * Add legacy gas estimation to config * updating printing and some scripts * Update cd with new arguments * disable P2p --- products/bridge/bridge-validators/Cargo.lock | 87 +- products/bridge/bridge-validators/Cargo.toml | 3 +- .../bridge-validators/abi/ChainGateway.json | 116 +- .../bridge/bridge-validators/abi/Target.json | 518 +--- .../abi/ValidatorManager.json | 2117 ++--------------- products/bridge/bridge-validators/config.toml | 32 +- .../bridge-validators/docker-compose.yaml | 15 +- .../infra/cd/base/config-leader.toml | 16 +- .../infra/cd/base/config.toml | 25 +- .../infra/cd/base/deployment.yaml | 2 +- .../infra/config-leader.toml | 16 +- .../bridge-validators/infra/config.toml | 25 +- .../bridge/bridge-validators/src/block.rs | 185 ++ .../bridge-validators/src/bridge_node.rs | 66 +- .../bridge/bridge-validators/src/client.rs | 4 + products/bridge/bridge-validators/src/main.rs | 3 + .../bridge/bridge-validators/src/p2p_node.rs | 196 +- .../bridge-validators/src/validator_node.rs | 8 +- .../script/deploy.target.s.sol | 2 +- .../script/deploy.target.zqt.s.sol | 22 + .../bridge/smart-contracts/script/relay.s.sol | 6 +- .../smart-contracts/script/relay.zqt.s.sol | 8 +- 22 files changed, 777 insertions(+), 2695 deletions(-) create mode 100644 products/bridge/bridge-validators/src/block.rs create mode 100644 products/bridge/smart-contracts/script/deploy.target.zqt.s.sol diff --git a/products/bridge/bridge-validators/Cargo.lock b/products/bridge/bridge-validators/Cargo.lock index a5a94b17e..d1a59fa80 100644 --- a/products/bridge/bridge-validators/Cargo.lock +++ b/products/bridge/bridge-validators/Cargo.lock @@ -233,15 +233,37 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -410,6 +432,7 @@ name = "bridge-validator" version = "0.1.0" dependencies = [ "anyhow", + "async-stream", "async-trait", "clap", "ethers", @@ -606,7 +629,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -845,7 +868,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -986,7 +1009,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -1110,7 +1133,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -1265,7 +1288,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.41", + "syn 2.0.48", "toml", "walkdir", ] @@ -1283,7 +1306,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -1309,7 +1332,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.41", + "syn 2.0.48", "tempfile", "thiserror", "tiny-keccak", @@ -1647,7 +1670,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -2650,7 +2673,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -3072,7 +3095,7 @@ dependencies = [ "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -3317,7 +3340,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -3355,7 +3378,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -3454,7 +3477,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -3516,9 +3539,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -3543,7 +3566,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -3640,9 +3663,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -4154,7 +4177,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -4399,7 +4422,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -4441,9 +4464,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -4530,7 +4553,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -4622,7 +4645,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -4756,7 +4779,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -5029,7 +5052,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -5063,7 +5086,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5432,7 +5455,7 @@ checksum = "b3c129550b3e6de3fd0ba67ba5c81818f9805e58b8d7fee80a3a59d2c9fc601a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] @@ -5452,7 +5475,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.48", ] [[package]] diff --git a/products/bridge/bridge-validators/Cargo.toml b/products/bridge/bridge-validators/Cargo.toml index fa4abfff3..b3720a22b 100644 --- a/products/bridge/bridge-validators/Cargo.toml +++ b/products/bridge/bridge-validators/Cargo.toml @@ -7,7 +7,8 @@ edition = "2021" [dependencies] anyhow = "1.0.75" -async-trait = "0.1.74" +async-stream = "0.3.5" +async-trait = "0.1.77" clap = { version = "4.4.11", features = ["derive"] } ethers = { version = "2.0.11", features = ["ws"] } ethers-contract = "2.0.11" diff --git a/products/bridge/bridge-validators/abi/ChainGateway.json b/products/bridge/bridge-validators/abi/ChainGateway.json index 079ee5643..40bf4bfdc 100644 --- a/products/bridge/bridge-validators/abi/ChainGateway.json +++ b/products/bridge/bridge-validators/abi/ChainGateway.json @@ -10,13 +10,6 @@ ], "stateMutability": "nonpayable" }, - { - "type": "function", - "name": "depositFee", - "inputs": [], - "outputs": [], - "stateMutability": "payable" - }, { "type": "function", "name": "dispatch", @@ -47,32 +40,34 @@ }, { "type": "function", - "name": "feeDeposit", - "inputs": [{ "name": "", "type": "address", "internalType": "address" }], - "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], - "stateMutability": "view" - }, - { - "type": "function", - "name": "feeRefund", - "inputs": [{ "name": "", "type": "address", "internalType": "address" }], + "name": "nonce", + "inputs": [], "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "view" }, { "type": "function", - "name": "nonce", + "name": "owner", "inputs": [], - "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, { "type": "function", - "name": "refundFee", - "inputs": [], + "name": "register", + "inputs": [ + { "name": "newTarget", "type": "address", "internalType": "address" } + ], "outputs": [], "stateMutability": "nonpayable" }, + { + "type": "function", + "name": "registered", + "inputs": [{ "name": "", "type": "address", "internalType": "address" }], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, { "type": "function", "name": "relay", @@ -106,6 +101,31 @@ "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], "stateMutability": "nonpayable" }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { "name": "newOwner", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "unregister", + "inputs": [ + { "name": "removeTarget", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "validatorManager", @@ -119,15 +139,6 @@ ], "stateMutability": "view" }, - { - "type": "function", - "name": "withdrawFee", - "inputs": [ - { "name": "amount", "type": "uint256", "internalType": "uint256" } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, { "type": "event", "name": "Dispatched", @@ -165,6 +176,25 @@ ], "anonymous": false }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, { "type": "event", "name": "Relayed", @@ -203,7 +233,31 @@ "anonymous": false }, { "type": "error", "name": "AlreadyDispatched", "inputs": [] }, - { "type": "error", "name": "InsufficientMinFeeDeposit", "inputs": [] }, { "type": "error", "name": "NonContractCaller", "inputs": [] }, - { "type": "error", "name": "NotValidator", "inputs": [] } + { + "type": "error", + "name": "NotRegistered", + "inputs": [ + { + "name": "targetAddress", + "type": "address", + "internalType": "address" + } + ] + }, + { "type": "error", "name": "NotValidator", "inputs": [] }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ] + } ] diff --git a/products/bridge/bridge-validators/abi/Target.json b/products/bridge/bridge-validators/abi/Target.json index 33327f2b7..7937e875e 100644 --- a/products/bridge/bridge-validators/abi/Target.json +++ b/products/bridge/bridge-validators/abi/Target.json @@ -1,476 +1,56 @@ -{ - "abi": [ - { - "type": "function", - "name": "count", - "inputs": [], - "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], - "stateMutability": "view" - }, - { - "type": "function", - "name": "foo", - "inputs": [], - "outputs": [{ "name": "", "type": "string", "internalType": "string" }], - "stateMutability": "pure" - }, - { - "type": "function", - "name": "increment", - "inputs": [], - "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], - "stateMutability": "nonpayable" - }, - { - "type": "event", - "name": "Incremented", - "inputs": [ - { - "name": "count", - "type": "uint256", - "indexed": false, - "internalType": "uint256" - } - ], - "anonymous": false - } - ], - "bytecode": { - "object": "0x60808060405234610016576101a2908161001c8239f35b600080fdfe6080604090808252600436101561001557600080fd5b600090813560e01c90816306661abd1461015257508063c2985578146100ae5763d09de08a1461004457600080fd5b346100ab57806003193601126100ab578054916000198314610097576001602093018092557f20d8a6f5a693f9d1d627a598e8820f7a55ee74c183aa8f1a30e8d4e8dd9a8d84838251848152a151908152f35b634e487b7160e01b82526011600452602482fd5b80fd5b50903461014e578160031936011261014e57805181810181811067ffffffffffffffff82111761013a578252600b81526020906a1a195b1b1bc81ddbdc9b1960aa1b8282015282519382859384528251928382860152825b84811061012457505050828201840152601f01601f19168101030190f35b8181018301518882018801528795508201610106565b634e487b7160e01b84526041600452602484fd5b5080fd5b90503461014e578160031936011261014e57602091548152f3fea2646970667358221220f45d776fef4932b5d28221644318cb721cbbba29ce2bc07103ba0482b71937fa64736f6c63430008140033", - "sourceMap": "72:288:7:-:0;;;;;;;;;;;;;;;;;", - "linkReferences": {} +[ + { + "type": "constructor", + "inputs": [ + { + "name": "gatewayContract", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" }, - "deployedBytecode": { - "object": "0x6080604090808252600436101561001557600080fd5b600090813560e01c90816306661abd1461015257508063c2985578146100ae5763d09de08a1461004457600080fd5b346100ab57806003193601126100ab578054916000198314610097576001602093018092557f20d8a6f5a693f9d1d627a598e8820f7a55ee74c183aa8f1a30e8d4e8dd9a8d84838251848152a151908152f35b634e487b7160e01b82526011600452602482fd5b80fd5b50903461014e578160031936011261014e57805181810181811067ffffffffffffffff82111761013a578252600b81526020906a1a195b1b1bc81ddbdc9b1960aa1b8282015282519382859384528251928382860152825b84811061012457505050828201840152601f01601f19168101030190f35b8181018301518882018801528795508201610106565b634e487b7160e01b84526041600452602484fd5b5080fd5b90503461014e578160031936011261014e57602091548152f3fea2646970667358221220f45d776fef4932b5d28221644318cb721cbbba29ce2bc07103ba0482b71937fa64736f6c63430008140033", - "sourceMap": "72:288:7:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;72:288:7;;;;;;;;;;;309:20;72:288;;;;;;309:20;72:288;;;;;;-1:-1:-1;;;72:288:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;72:288:7;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;72:288:7;;;;;;;;-1:-1:-1;;72:288:7;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;72:288:7;;;;;-1:-1:-1;;;72:288:7;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;", - "linkReferences": {} + { + "type": "function", + "name": "count", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" }, - "methodIdentifiers": { - "count()": "06661abd", - "foo()": "c2985578", - "increment()": "d09de08a" + { + "type": "function", + "name": "foo", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "pure" }, - "rawMetadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"Incremented\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"foo\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"increment\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"foundry/test/Target.sol\":\"Target\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/=node_modules/@openzeppelin/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":hardhat/=node_modules/hardhat/\"],\"viaIR\":true},\"sources\":{\"foundry/test/Target.sol\":{\"keccak256\":\"0x8c5da0f765bd32a225606d9bc5dcd4f80b57cdd926b1fb8cd3528706d8b9c878\",\"license\":\"MIT OR Apache-2.0\",\"urls\":[\"bzz-raw://3a3355e6356147f9baa150824141279e9b956ec0ac2a222711065b850e2ee73b\",\"dweb:/ipfs/QmfDfw4ZKvtiB697CF3Z7if7XPKf3dwWscwg59n8BrLpA1\"]}},\"version\":1}", - "metadata": { - "compiler": { "version": "0.8.20+commit.a1b79de6" }, - "language": "Solidity", - "output": { - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "count", - "type": "uint256", - "indexed": false - } - ], - "type": "event", - "name": "Incremented", - "anonymous": false - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "count", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ] - }, - { - "inputs": [], - "stateMutability": "pure", - "type": "function", - "name": "foo", - "outputs": [ - { "internalType": "string", "name": "", "type": "string" } - ] - }, - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "name": "increment", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ] - } - ], - "devdoc": { "kind": "dev", "methods": {}, "version": 1 }, - "userdoc": { "kind": "user", "methods": {}, "version": 1 } - }, - "settings": { - "remappings": [ - "@openzeppelin/=node_modules/@openzeppelin/", - "ds-test/=lib/forge-std/lib/ds-test/src/", - "forge-std/=lib/forge-std/src/", - "hardhat/=node_modules/hardhat/" - ], - "optimizer": { "enabled": true, "runs": 200 }, - "metadata": { "bytecodeHash": "ipfs" }, - "compilationTarget": { "foundry/test/Target.sol": "Target" }, - "libraries": {}, - "viaIR": true - }, - "sources": { - "foundry/test/Target.sol": { - "keccak256": "0x8c5da0f765bd32a225606d9bc5dcd4f80b57cdd926b1fb8cd3528706d8b9c878", - "urls": [ - "bzz-raw://3a3355e6356147f9baa150824141279e9b956ec0ac2a222711065b850e2ee73b", - "dweb:/ipfs/QmfDfw4ZKvtiB697CF3Z7if7XPKf3dwWscwg59n8BrLpA1" - ], - "license": "MIT OR Apache-2.0" - } - }, - "version": 1 + { + "type": "function", + "name": "gateway", + "inputs": [], + "outputs": [ + { "name": "", "type": "address", "internalType": "contract ChainGateway" } + ], + "stateMutability": "view" }, - "ast": { - "absolutePath": "foundry/test/Target.sol", - "id": 763, - "exportedSymbols": { "Target": [762] }, - "nodeType": "SourceUnit", - "src": "46:315:7", - "nodes": [ - { - "id": 734, - "nodeType": "PragmaDirective", - "src": "46:24:7", - "nodes": [], - "literals": ["solidity", "^", "0.8", ".20"] - }, + { + "type": "function", + "name": "increment", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "Incremented", + "inputs": [ { - "id": 762, - "nodeType": "ContractDefinition", - "src": "72:288:7", - "nodes": [ - { - "id": 736, - "nodeType": "VariableDeclaration", - "src": "94:17:7", - "nodes": [], - "constant": false, - "functionSelector": "06661abd", - "mutability": "mutable", - "name": "count", - "nameLocation": "106:5:7", - "scope": 762, - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 735, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "94:4:7", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "public" - }, - { - "id": 740, - "nodeType": "EventDefinition", - "src": "117:30:7", - "nodes": [], - "anonymous": false, - "eventSelector": "20d8a6f5a693f9d1d627a598e8820f7a55ee74c183aa8f1a30e8d4e8dd9a8d84", - "name": "Incremented", - "nameLocation": "123:11:7", - "parameters": { - "id": 739, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 738, - "indexed": false, - "mutability": "mutable", - "name": "count", - "nameLocation": "140:5:7", - "nodeType": "VariableDeclaration", - "scope": 740, - "src": "135:10:7", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 737, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "135:4:7", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "134:12:7" - } - }, - { - "id": 748, - "nodeType": "FunctionDefinition", - "src": "153:90:7", - "nodes": [], - "body": { - "id": 747, - "nodeType": "Block", - "src": "206:37:7", - "nodes": [], - "statements": [ - { - "expression": { - "hexValue": "68656c6c6f20776f726c64", - "id": 745, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "string", - "lValueRequested": false, - "nodeType": "Literal", - "src": "223:13:7", - "typeDescriptions": { - "typeIdentifier": "t_stringliteral_47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad", - "typeString": "literal_string \"hello world\"" - }, - "value": "hello world" - }, - "functionReturnParameters": 744, - "id": 746, - "nodeType": "Return", - "src": "216:20:7" - } - ] - }, - "functionSelector": "c2985578", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "foo", - "nameLocation": "162:3:7", - "parameters": { - "id": 741, - "nodeType": "ParameterList", - "parameters": [], - "src": "165:2:7" - }, - "returnParameters": { - "id": 744, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 743, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 748, - "src": "191:13:7", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_string_memory_ptr", - "typeString": "string" - }, - "typeName": { - "id": 742, - "name": "string", - "nodeType": "ElementaryTypeName", - "src": "191:6:7", - "typeDescriptions": { - "typeIdentifier": "t_string_storage_ptr", - "typeString": "string" - } - }, - "visibility": "internal" - } - ], - "src": "190:15:7" - }, - "scope": 762, - "stateMutability": "pure", - "virtual": false, - "visibility": "external" - }, - { - "id": 761, - "nodeType": "FunctionDefinition", - "src": "249:109:7", - "nodes": [], - "body": { - "id": 760, - "nodeType": "Block", - "src": "294:64:7", - "nodes": [], - "statements": [ - { - "eventCall": { - "arguments": [ - { - "id": 755, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": true, - "src": "321:7:7", - "subExpression": { - "id": 754, - "name": "count", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 736, - "src": "323:5:7", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - ], - "id": 753, - "name": "Incremented", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 740, - "src": "309:11:7", - "typeDescriptions": { - "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$returns$__$", - "typeString": "function (uint256)" - } - }, - "id": 756, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "309:20:7", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 757, - "nodeType": "EmitStatement", - "src": "304:25:7" - }, - { - "expression": { - "id": 758, - "name": "count", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 736, - "src": "346:5:7", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 752, - "id": 759, - "nodeType": "Return", - "src": "339:12:7" - } - ] - }, - "functionSelector": "d09de08a", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "increment", - "nameLocation": "258:9:7", - "parameters": { - "id": 749, - "nodeType": "ParameterList", - "parameters": [], - "src": "267:2:7" - }, - "returnParameters": { - "id": 752, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 751, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 761, - "src": "288:4:7", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 750, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "288:4:7", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "287:6:7" - }, - "scope": 762, - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "external" - } - ], - "abstract": false, - "baseContracts": [], - "canonicalName": "Target", - "contractDependencies": [], - "contractKind": "contract", - "fullyImplemented": true, - "linearizedBaseContracts": [762], - "name": "Target", - "nameLocation": "81:6:7", - "scope": 763, - "usedErrors": [], - "usedEvents": [740] + "name": "count", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "license": "MIT OR Apache-2.0" - }, - "id": 7 -} + "anonymous": false + } +] diff --git a/products/bridge/bridge-validators/abi/ValidatorManager.json b/products/bridge/bridge-validators/abi/ValidatorManager.json index d71f5f40e..10ececa26 100644 --- a/products/bridge/bridge-validators/abi/ValidatorManager.json +++ b/products/bridge/bridge-validators/abi/ValidatorManager.json @@ -1,1992 +1,151 @@ -{ - "abi": [ - { - "type": "constructor", - "inputs": [ - { - "name": "validators", - "type": "address[]", - "internalType": "address[]" - } - ], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "addValidator", - "inputs": [ - { "name": "user", "type": "address", "internalType": "address" } - ], - "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "getValidators", - "inputs": [], - "outputs": [ - { "name": "", "type": "address[]", "internalType": "address[]" } - ], - "stateMutability": "view" - }, - { - "type": "function", - "name": "isValidator", - "inputs": [ - { "name": "user", "type": "address", "internalType": "address" } - ], - "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], - "stateMutability": "view" - }, - { - "type": "function", - "name": "owner", - "inputs": [], - "outputs": [{ "name": "", "type": "address", "internalType": "address" }], - "stateMutability": "view" - }, - { - "type": "function", - "name": "removeValidator", - "inputs": [ - { "name": "user", "type": "address", "internalType": "address" } - ], - "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "renounceOwnership", - "inputs": [], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "transferOwnership", - "inputs": [ - { "name": "newOwner", "type": "address", "internalType": "address" } - ], - "outputs": [], - "stateMutability": "nonpayable" - }, - { - "type": "function", - "name": "validateMessageWithSupermajority", - "inputs": [ - { - "name": "ethSignedMessageHash", - "type": "bytes32", - "internalType": "bytes32" - }, - { "name": "signatures", "type": "bytes[]", "internalType": "bytes[]" } - ], - "outputs": [], - "stateMutability": "view" - }, - { - "type": "function", - "name": "validatorsSize", - "inputs": [], - "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], - "stateMutability": "view" - }, - { - "type": "event", - "name": "OwnershipTransferred", - "inputs": [ - { - "name": "previousOwner", - "type": "address", - "indexed": true, - "internalType": "address" - }, - { - "name": "newOwner", - "type": "address", - "indexed": true, - "internalType": "address" - } - ], - "anonymous": false - }, - { "type": "error", "name": "ECDSAInvalidSignature", "inputs": [] }, - { - "type": "error", - "name": "ECDSAInvalidSignatureLength", - "inputs": [ - { "name": "length", "type": "uint256", "internalType": "uint256" } - ] - }, - { - "type": "error", - "name": "ECDSAInvalidSignatureS", - "inputs": [{ "name": "s", "type": "bytes32", "internalType": "bytes32" }] - }, - { "type": "error", "name": "InvalidValidatorOrSignatures", "inputs": [] }, - { "type": "error", "name": "NoSupermajority", "inputs": [] }, - { "type": "error", "name": "NonUniqueOrUnorderedSignatures", "inputs": [] }, - { - "type": "error", - "name": "OwnableInvalidOwner", - "inputs": [ - { "name": "owner", "type": "address", "internalType": "address" } - ] - }, - { - "type": "error", - "name": "OwnableUnauthorizedAccount", - "inputs": [ - { "name": "account", "type": "address", "internalType": "address" } - ] - } - ], - "bytecode": { - "object": "0x6040608081523461019d57610afe8038038061001a816101b8565b928339810190602090818184031261019d5780516001600160401b039182821161019d57019280601f8501121561019d5783519182116101a25760059382851b9084806100688185016101b8565b80968152019282010192831161019d578401905b82821061017e5750505033156101665760008054336001600160a01b031982168117835591936001600160a01b03939092909184167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08680a3805194845b8681106100ef57875161089c90816102628239f35b825181101561015257848482841b850101511633868854160361013b57610115906101dd565b506000198114610127576001016100da565b634e487b7160e01b86526011600452602486fd5b885163118cdaa760e01b8152336004820152602490fd5b634e487b7160e01b86526032600452602486fd5b8351631e4fbdf760e01b815260006004820152602490fd5b81516001600160a01b038116810361019d57815290840190840161007c565b600080fd5b634e487b7160e01b600052604160045260246000fd5b6040519190601f01601f191682016001600160401b038111838210176101a257604052565b600090808252600260205260408220541560001461025d576001918254680100000000000000008110156102495783810180855581101561023557908260409285835260208320015583549281526002602052205590565b634e487b7160e01b82526032600452602482fd5b634e487b7160e01b82526041600452602482fd5b509056fe6040608081526004908136101561001557600080fd5b600091823560e01c806340a141ff146104be5780634d238c8e14610484578063715018a61461042a5780638da5cb5b14610402578063b7ab4db514610350578063d3de131d14610184578063e36d526514610161578063f2fde38b146100d35763facd743b1461008457600080fd5b346100cf5760203660031901126100cf57356001600160a01b03811692908390036100cc57506100c36020926000526002602052604060002054151590565b90519015158152f35b80fd5b8280fd5b5090346100cf5760203660031901126100cf576001600160a01b0382358181169391929084900361015d57610106610530565b831561014757505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8480fd5b5050346101805781600319360112610180576020906001549051908152f35b5080fd5b5090346100cf57806003193601126100cf57602467ffffffffffffffff8135843582821161034c573660238301121561034c57818601359280841161034857600591368686851b860101116103445788939293899360421981360301915b878610610255575050505050505060038102908082046003149015171561024357600154918260011b928084046002149015171561023257501115610225578280f35b51631023582160e11b8152fd5b634e487b7160e01b86526011855285fd5b50634e487b7160e01b84526011835283fd5b8886881b8301013583811215610340578201908c8a8301359287841161018057604491828201928536038413610180578e519260209161029e601f8901601f19168401866104f8565b87855287369201011161018057856102cb966102c29583860137830101528661055c565b90939193610628565b6001600160a01b038281169116811115610330576102f6906000526002602052604060002054151590565b156103205794600019811461030e57600101946101e2565b634e487b7160e01b8c5260118b52888cfd5b895163388063eb60e11b81528b90fd5b8a516302f7e52760e21b81528c90fd5b8c80fd5b8880fd5b8780fd5b8680fd5b50503461018057816003193601126101805780516001805480835281855260208084019592939186907fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690855b8181106103ef57505050826103b39103836104f8565b8451948186019282875251809352850195925b8281106103d35785870386f35b83516001600160a01b03168752958101959281019284016103c6565b825484529284019291870191870161039d565b505034610180578160031936011261018057905490516001600160a01b039091168152602090f35b83346100cc57806003193601126100cc57610443610530565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346100cf5760203660031901126100cf57356001600160a01b03811692908390036100cc57506100c36020926104b9610530565b6106fa565b50346100cf5760203660031901126100cf57356001600160a01b03811692908390036100cc57506100c36020926104f3610530565b61077c565b90601f8019910116810190811067ffffffffffffffff82111761051a57604052565b634e487b7160e01b600052604160045260246000fd5b6000546001600160a01b0316330361054457565b60405163118cdaa760e01b8152336004820152602490fd5b815191906041830361058d5761058692506020820151906060604084015193015160001a90610598565b9192909190565b505060009160029190565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161061c57926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156106105780516001600160a01b0381161561060757918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b6004811015610697578061063a575050565b600181036106545760405163f645eedf60e01b8152600490fd5b600281036106755760405163fce698f760e01b815260048101839052602490fd5b60031461067f5750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fd5b6001548110156106e45760016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60190600090565b634e487b7160e01b600052603260045260246000fd5b600081815260026020526040812054610777576001546801000000000000000081101561076357908261074f610738846001604096016001556106ad565b819391549060031b91821b91600019901b19161790565b905560015492815260026020522055600190565b634e487b7160e01b82526041600452602482fd5b905090565b6000818152600260205260408120549091908015610861576000199080820181811161084d576001549083820191821161083957818103610805575b50505060015480156107f1578101906107d0826106ad565b909182549160031b1b19169055600155815260026020526040812055600190565b634e487b7160e01b84526031600452602484fd5b610823610814610738936106ad565b90549060031b1c9283926106ad565b90558452600260205260408420553880806107b8565b634e487b7160e01b86526011600452602486fd5b634e487b7160e01b85526011600452602485fd5b50509056fea26469706673582212202a1bcf704b756b89d4ef6b9fa86e34c46483d66609bd05d50912619eefd5d90564736f6c63430008140033", - "sourceMap": "302:1522:8:-:0;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;559:10;;;;1273:26:44;1269:95;;-1:-1:-1;302:1522:8;;559:10;-1:-1:-1;;;;;;302:1522:8;;;;;;-1:-1:-1;;;;;;;302:1522:8;-1:-1:-1;;302:1522:8;;;;3052:40:44;-1:-1:-1;;3052:40:44;302:1522:8;;637:10;;649:20;;;;;;302:1522;;;;;;;;;671:3;302:1522;;;;;;;;;;;;;;;;;559:10;302:1522;;;;1855:23:44;1851:101;;8409:50:58;;;:::i;:::-;-1:-1:-1;;;302:1522:8;;;;;;637:10;;302:1522;-1:-1:-1;;;302:1522:8;;;;;;;;1851:101:44;302:1522:8;;-1:-1:-1;;;1901:40:44;;559:10:8;1901:40:44;;;302:1522:8;;;1901:40:44;302:1522:8;-1:-1:-1;;;302:1522:8;;;;;;;;1269:95:44;302:1522:8;;-1:-1:-1;;;1322:31:44;;-1:-1:-1;1322:31:44;;;302:1522:8;;;1322:31:44;302:1522:8;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;;;;;;;;;-1:-1:-1;302:1522:8;;;;;;-1:-1:-1;302:1522:8;;;;;-1:-1:-1;302:1522:8;;;;;;;;-1:-1:-1;;302:1522:8;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;;:::o;2241:406:58:-;-1:-1:-1;302:1522:8;;;;4360:14:58;302:1522:8;;;;;;4360:26:58;2320:321;302:1522:8;;;913:11;302:1522;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4360:14:58;302:1522:8;;;;2576:11:58;:::o;302:1522:8:-;-1:-1:-1;;;302:1522:8;;;;;;;;;-1:-1:-1;;;302:1522:8;;;;;;;;2320:321:58;2618:12;;:::o", - "linkReferences": {} +[ + { + "type": "constructor", + "inputs": [ + { "name": "_owner", "type": "address", "internalType": "address" } + ], + "stateMutability": "nonpayable" }, - "deployedBytecode": { - "object": "0x6040608081526004908136101561001557600080fd5b600091823560e01c806340a141ff146104be5780634d238c8e14610484578063715018a61461042a5780638da5cb5b14610402578063b7ab4db514610350578063d3de131d14610184578063e36d526514610161578063f2fde38b146100d35763facd743b1461008457600080fd5b346100cf5760203660031901126100cf57356001600160a01b03811692908390036100cc57506100c36020926000526002602052604060002054151590565b90519015158152f35b80fd5b8280fd5b5090346100cf5760203660031901126100cf576001600160a01b0382358181169391929084900361015d57610106610530565b831561014757505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8480fd5b5050346101805781600319360112610180576020906001549051908152f35b5080fd5b5090346100cf57806003193601126100cf57602467ffffffffffffffff8135843582821161034c573660238301121561034c57818601359280841161034857600591368686851b860101116103445788939293899360421981360301915b878610610255575050505050505060038102908082046003149015171561024357600154918260011b928084046002149015171561023257501115610225578280f35b51631023582160e11b8152fd5b634e487b7160e01b86526011855285fd5b50634e487b7160e01b84526011835283fd5b8886881b8301013583811215610340578201908c8a8301359287841161018057604491828201928536038413610180578e519260209161029e601f8901601f19168401866104f8565b87855287369201011161018057856102cb966102c29583860137830101528661055c565b90939193610628565b6001600160a01b038281169116811115610330576102f6906000526002602052604060002054151590565b156103205794600019811461030e57600101946101e2565b634e487b7160e01b8c5260118b52888cfd5b895163388063eb60e11b81528b90fd5b8a516302f7e52760e21b81528c90fd5b8c80fd5b8880fd5b8780fd5b8680fd5b50503461018057816003193601126101805780516001805480835281855260208084019592939186907fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690855b8181106103ef57505050826103b39103836104f8565b8451948186019282875251809352850195925b8281106103d35785870386f35b83516001600160a01b03168752958101959281019284016103c6565b825484529284019291870191870161039d565b505034610180578160031936011261018057905490516001600160a01b039091168152602090f35b83346100cc57806003193601126100cc57610443610530565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346100cf5760203660031901126100cf57356001600160a01b03811692908390036100cc57506100c36020926104b9610530565b6106fa565b50346100cf5760203660031901126100cf57356001600160a01b03811692908390036100cc57506100c36020926104f3610530565b61077c565b90601f8019910116810190811067ffffffffffffffff82111761051a57604052565b634e487b7160e01b600052604160045260246000fd5b6000546001600160a01b0316330361054457565b60405163118cdaa760e01b8152336004820152602490fd5b815191906041830361058d5761058692506020820151906060604084015193015160001a90610598565b9192909190565b505060009160029190565b91907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841161061c57926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa156106105780516001600160a01b0381161561060757918190565b50809160019190565b604051903d90823e3d90fd5b50505060009160039190565b6004811015610697578061063a575050565b600181036106545760405163f645eedf60e01b8152600490fd5b600281036106755760405163fce698f760e01b815260048101839052602490fd5b60031461067f5750565b602490604051906335e2f38360e21b82526004820152fd5b634e487b7160e01b600052602160045260246000fd5b6001548110156106e45760016000527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60190600090565b634e487b7160e01b600052603260045260246000fd5b600081815260026020526040812054610777576001546801000000000000000081101561076357908261074f610738846001604096016001556106ad565b819391549060031b91821b91600019901b19161790565b905560015492815260026020522055600190565b634e487b7160e01b82526041600452602482fd5b905090565b6000818152600260205260408120549091908015610861576000199080820181811161084d576001549083820191821161083957818103610805575b50505060015480156107f1578101906107d0826106ad565b909182549160031b1b19169055600155815260026020526040812055600190565b634e487b7160e01b84526031600452602484fd5b610823610814610738936106ad565b90549060031b1c9283926106ad565b90558452600260205260408420553880806107b8565b634e487b7160e01b86526011600452602486fd5b634e487b7160e01b85526011600452602485fd5b50509056fea26469706673582212202a1bcf704b756b89d4ef6b9fa86e34c46483d66609bd05d50912619eefd5d90564736f6c63430008140033", - "sourceMap": "302:1522:8:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;302:1522:8;;;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;8974:55:58;;302:1522:8;8974:55:58;-1:-1:-1;302:1522:8;4360:14:58;302:1522:8;;;-1:-1:-1;302:1522:8;;4360:26:58;;4264:129;;8974:55;302:1522:8;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;302:1522:8;;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;;;;;;1500:62:44;;:::i;:::-;2627:22;;2623:91;;-1:-1:-1;;302:1522:8;;-1:-1:-1;;;;;;302:1522:8;;;;;;;3052:40:44;302:1522:8;;3052:40:44;302:1522:8;;2623:91:44;302:1522:8;-1:-1:-1;;;2672:31:44;;;;;302:1522:8;;;;;2672:31:44;302:1522:8;;;;;;;;;;;;;;;;;;;;1520:11;302:1522;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1116:31:7;;;;1163:10;302:1522:8;;;;;;;1158:458:7;1175:21;;;;;;302:1522:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;681:1:7;302:1522:8;;;;;;;653:29:7;;1630:41;1626:122;;302:1522:8;;;1626:122:7;302:1522:8;-1:-1:-1;;;1694:43:7;;;302:1522:8;-1:-1:-1;;;302:1522:8;;;;;;;;-1:-1:-1;;;;302:1522:8;;;;;;;1198:3:7;302:1522:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;302:1522:8;;;;;:::i;:::-;;;;;;;;;;;;;3915:8:54;302:1522:8;3859:27:54;302:1522:8;;;;;;;;;3859:27:54;;:::i;:::-;3915:8;;;;;:::i;:::-;-1:-1:-1;;;;;302:1522:8;;;;;1295:20:7;;;1291:145;;8974:55:58;;-1:-1:-1;302:1522:8;4360:14:58;302:1522:8;;;-1:-1:-1;302:1522:8;;4360:26:58;;4264:129;;8974:55;1453:22:7;1449:124;;1198:3;-1:-1:-1;;302:1522:8;;;;;;1163:10:7;;;302:1522:8;-1:-1:-1;;;302:1522:8;;;;;;;;1449:124:7;302:1522:8;;-1:-1:-1;;;1502:56:7;;302:1522:8;;1502:56:7;1291:145;302:1522:8;;-1:-1:-1;;;1342:79:7;;302:1522:8;;1342:79:7;302:1522:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1295:11;302:1522;;;;;;;;;;;;;1295:11;;302:1522;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;;;;;;;;;;;;;1500:62:44;;:::i;:::-;302:1522:8;;-1:-1:-1;;;;;;302:1522:8;;;;;;-1:-1:-1;;;;;302:1522:8;3052:40:44;302:1522:8;;3052:40:44;302:1522:8;;;;;;;;;-1:-1:-1;;302:1522:8;;;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;1500:62:44;8409:50:58;302:1522:8;1500:62:44;;;:::i;:::-;8409:50:58;:::i;302:1522:8:-;;;;;;;-1:-1:-1;;302:1522:8;;;;;-1:-1:-1;;;;;302:1522:8;;;;;;;;;1500:62:44;8730:53:58;302:1522:8;1500:62:44;;;:::i;:::-;8730:53:58;:::i;302:1522:8:-;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;1796:162:44;1710:6;302:1522:8;-1:-1:-1;;;;;302:1522:8;735:10:51;1855:23:44;1851:101;;1796:162::o;1851:101::-;302:1522:8;;-1:-1:-1;;;1901:40:44;;735:10:51;1901:40:44;;;302:1522:8;;;1901:40:44;2129:766:54;302:1522:8;;;2129:766:54;2276:2;2256:22;;2276:2;;2739:25;2539:180;;;;;;;;;;;;;;;-1:-1:-1;2539:180:54;2739:25;;:::i;:::-;2732:32;;;;;:::o;2252:637::-;2795:83;;2811:1;2795:83;2815:35;2795:83;;:::o;5140:1530::-;;;6199:66;6186:79;;6182:164;;302:1522:8;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6457:24:54;;;;;;;;;;;;;;-1:-1:-1;;;;;302:1522:8;;6495:20:54;6491:113;;6614:49;;5140:1530;:::o;6491:113::-;6531:62;;;6457:24;6531:62;;:::o;6457:24::-;302:1522:8;;;;;;;;;;6182:164:54;6281:54;;;6297:1;6281:54;6301:30;6281:54;;:::o;7196:532::-;302:1522:8;;;;;;7282:29:54;;;7327:7;;:::o;7278:444::-;302:1522:8;7378:38:54;;302:1522:8;;;;-1:-1:-1;;;7439:23:54;;302:1522:8;;7439:23:54;7374:348;7492:35;7483:44;;7492:35;;302:1522:8;;-1:-1:-1;;;7550:46:54;;302:1522:8;7550:46:54;;302:1522:8;;;;;7550:46:54;7479:243;7626:30;7617:39;7613:109;;7479:243;7196:532::o;7613:109::-;302:1522:8;;;;7679:32:54;;;;;;302:1522:8;7679:32:54;;302:1522:8;7679:32:54;302:1522:8;;;;7291:20:54;302:1522:8;;;;;7291:20:54;302:1522:8;;913:11;302:1522;;;;;;913:11;-1:-1:-1;302:1522:8;;;;-1:-1:-1;302:1522:8;:::o;:::-;;;;;;;;;;;;2241:406:58;-1:-1:-1;302:1522:8;;;4360:14:58;302:1522:8;;;;;;;;913:11;302:1522;;;;;;;;;;;;913:11;302:1522;;;913:11;302:1522;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;913:11;302:1522;;;;4360:14:58;302:1522:8;;;;913:11;2576::58;:::o;302:1522:8:-;-1:-1:-1;;;302:1522:8;;;;;;;;2320:321:58;2618:12;;;:::o;2815:1368::-;-1:-1:-1;302:1522:8;;;3010:14:58;302:1522:8;;;;;;-1:-1:-1;;302:1522:8;3046:13:58;;;;-1:-1:-1;;302:1522:8;;;;;;;;;1125:11;302:1522;;;;;;;;;;3521:23:58;;;3517:378;;3042:1135;302:1522:8;;;1125:11;302:1522;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;1125:11;302:1522;;;3010:14:58;302:1522:8;;;;;;1125:11;4112::58;:::o;302:1522:8:-;-1:-1:-1;;;302:1522:8;;;;;;;;3517:378:58;302:1522:8;3584:22:58;3705:23;3584:22;;:::i;:::-;302:1522:8;;;;;;3705:23:58;;;;:::i;302:1522:8:-;;;;;3010:14:58;302:1522:8;;;;;;3517:378:58;;;;;302:1522:8;-1:-1:-1;;;302:1522:8;;;;;;;;;-1:-1:-1;;;302:1522:8;;;;;;;;3042:1135:58;4154:12;;;:::o", - "linkReferences": {} + { + "type": "function", + "name": "addValidator", + "inputs": [ + { "name": "user", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" }, - "methodIdentifiers": { - "addValidator(address)": "4d238c8e", - "getValidators()": "b7ab4db5", - "isValidator(address)": "facd743b", - "owner()": "8da5cb5b", - "removeValidator(address)": "40a141ff", - "renounceOwnership()": "715018a6", - "transferOwnership(address)": "f2fde38b", - "validateMessageWithSupermajority(bytes32,bytes[])": "d3de131d", - "validatorsSize()": "e36d5265" + { + "type": "function", + "name": "getValidators", + "inputs": [], + "outputs": [ + { "name": "", "type": "address[]", "internalType": "address[]" } + ], + "stateMutability": "view" }, - "rawMetadata": "{\"compiler\":{\"version\":\"0.8.20+commit.a1b79de6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ECDSAInvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"length\",\"type\":\"uint256\"}],\"name\":\"ECDSAInvalidSignatureLength\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"ECDSAInvalidSignatureS\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidValidatorOrSignatures\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NoSupermajority\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonUniqueOrUnorderedSignatures\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"OwnableInvalidOwner\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"OwnableUnauthorizedAccount\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"addValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"isValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"}],\"name\":\"removeValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"ethSignedMessageHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"signatures\",\"type\":\"bytes[]\"}],\"name\":\"validateMessageWithSupermajority\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorsSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ECDSAInvalidSignature()\":[{\"details\":\"The signature derives the `address(0)`.\"}],\"ECDSAInvalidSignatureLength(uint256)\":[{\"details\":\"The signature has an invalid length.\"}],\"ECDSAInvalidSignatureS(bytes32)\":[{\"details\":\"The signature has an S value that is in the upper half order.\"}],\"OwnableInvalidOwner(address)\":[{\"details\":\"The owner is not a valid owner account. (eg. `address(0)`)\"}],\"OwnableUnauthorizedAccount(address)\":[{\"details\":\"The caller account is not authorized to perform an operation.\"}]},\"kind\":\"dev\",\"methods\":{\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/core/ValidatorManager.sol\":\"ValidatorManager\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[\":@openzeppelin/=node_modules/@openzeppelin/\",\":ds-test/=lib/forge-std/lib/ds-test/src/\",\":forge-std/=lib/forge-std/src/\",\":hardhat/=node_modules/hardhat/\"],\"viaIR\":true},\"sources\":{\"contracts/core/SignatureValidator.sol\":{\"keccak256\":\"0xd054113638103158424a9278336e2b96bfc20554fca8b84b2884ff27fa4d9816\",\"license\":\"MIT OR Apache-2.0\",\"urls\":[\"bzz-raw://24911131b14dce650c4b4631144ce2348a3d89a3783999164dab9fdd1c5fcb50\",\"dweb:/ipfs/QmWXncUaccVMAQiV8Tn1MR9A9GmabFYscsPifcHComnL5u\"]},\"contracts/core/ValidatorManager.sol\":{\"keccak256\":\"0xc714a5886e6f23328df953d3f4086af832c8c432f55183279b9a1bec5b4b1dd8\",\"license\":\"MIT OR Apache-2.0\",\"urls\":[\"bzz-raw://3c83c2ea3cd55f064e87d42f0189bfdf8fb0d168786197c9ef3e8ec51ceeed81\",\"dweb:/ipfs/QmdJoKQSnS6fbyaEiZvnCf8CHBeycoBPy7D8bRVtmbwg2C\"]},\"node_modules/@openzeppelin/contracts/access/Ownable.sol\":{\"keccak256\":\"0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6\",\"dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a\"]},\"node_modules/@openzeppelin/contracts/utils/Context.sol\":{\"keccak256\":\"0x75a4ee64c68dbd5f38bddd06e664a64c8271b4caa554fb6f0607dfd672bb4bf3\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://0c4e6cb30d3601e2f7af5af09e265508147cb275a8dcd99d6f7363645cc56867\",\"dweb:/ipfs/QmNgFkoXNWoUbAyw71rr1sKQ95Rj2GfvYiWg79xEYDn2NY\"]},\"node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"keccak256\":\"0xeed0a08b0b091f528356cbc7245891a4c748682d4f6a18055e8e6ca77d12a6cf\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ba80ba06c8e6be852847e4c5f4492cef801feb6558ae09ed705ff2e04ea8b13c\",\"dweb:/ipfs/QmXRJDv3xHLVQCVXg1ZvR35QS9sij5y9NDWYzMfUfAdTHF\"]},\"node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"keccak256\":\"0x86c1470cbfd878491e5de030072b647352d36bd27122cffb928970b1945282aa\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ad85dd393ee0a1917c57046abc5155f51f77844b2c6a42c05c1b8dd26d6ff3c1\",\"dweb:/ipfs/QmNqYc8To2NdnpP6E1tGz7t6A7beuENde5yovwov5pW1fA\"]}},\"version\":1}", - "metadata": { - "compiler": { "version": "0.8.20+commit.a1b79de6" }, - "language": "Solidity", - "output": { - "abi": [ - { - "inputs": [ - { - "internalType": "address[]", - "name": "validators", - "type": "address[]" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { "inputs": [], "type": "error", "name": "ECDSAInvalidSignature" }, - { - "inputs": [ - { "internalType": "uint256", "name": "length", "type": "uint256" } - ], - "type": "error", - "name": "ECDSAInvalidSignatureLength" - }, - { - "inputs": [ - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "type": "error", - "name": "ECDSAInvalidSignatureS" - }, - { - "inputs": [], - "type": "error", - "name": "InvalidValidatorOrSignatures" - }, - { "inputs": [], "type": "error", "name": "NoSupermajority" }, - { - "inputs": [], - "type": "error", - "name": "NonUniqueOrUnorderedSignatures" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" } - ], - "type": "error", - "name": "OwnableInvalidOwner" - }, - { - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } - ], - "type": "error", - "name": "OwnableUnauthorizedAccount" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "previousOwner", - "type": "address", - "indexed": true - }, - { - "internalType": "address", - "name": "newOwner", - "type": "address", - "indexed": true - } - ], - "type": "event", - "name": "OwnershipTransferred", - "anonymous": false - }, - { - "inputs": [ - { "internalType": "address", "name": "user", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "addValidator", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }] - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "getValidators", - "outputs": [ - { "internalType": "address[]", "name": "", "type": "address[]" } - ] - }, - { - "inputs": [ - { "internalType": "address", "name": "user", "type": "address" } - ], - "stateMutability": "view", - "type": "function", - "name": "isValidator", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }] - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "owner", - "outputs": [ - { "internalType": "address", "name": "", "type": "address" } - ] - }, - { - "inputs": [ - { "internalType": "address", "name": "user", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "removeValidator", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }] - }, - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "function", - "name": "renounceOwnership" - }, - { - "inputs": [ - { "internalType": "address", "name": "newOwner", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "function", - "name": "transferOwnership" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "ethSignedMessageHash", - "type": "bytes32" - }, - { - "internalType": "bytes[]", - "name": "signatures", - "type": "bytes[]" - } - ], - "stateMutability": "view", - "type": "function", - "name": "validateMessageWithSupermajority" - }, - { - "inputs": [], - "stateMutability": "view", - "type": "function", - "name": "validatorsSize", - "outputs": [ - { "internalType": "uint256", "name": "", "type": "uint256" } - ] - } - ], - "devdoc": { - "kind": "dev", - "methods": { - "owner()": { "details": "Returns the address of the current owner." }, - "renounceOwnership()": { - "details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner." - }, - "transferOwnership(address)": { - "details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner." - } - }, - "version": 1 - }, - "userdoc": { "kind": "user", "methods": {}, "version": 1 } - }, - "settings": { - "remappings": [ - "@openzeppelin/=node_modules/@openzeppelin/", - "ds-test/=lib/forge-std/lib/ds-test/src/", - "forge-std/=lib/forge-std/src/", - "hardhat/=node_modules/hardhat/" - ], - "optimizer": { "enabled": true, "runs": 200 }, - "metadata": { "bytecodeHash": "ipfs" }, - "compilationTarget": { - "contracts/core/ValidatorManager.sol": "ValidatorManager" - }, - "libraries": {}, - "viaIR": true - }, - "sources": { - "contracts/core/SignatureValidator.sol": { - "keccak256": "0xd054113638103158424a9278336e2b96bfc20554fca8b84b2884ff27fa4d9816", - "urls": [ - "bzz-raw://24911131b14dce650c4b4631144ce2348a3d89a3783999164dab9fdd1c5fcb50", - "dweb:/ipfs/QmWXncUaccVMAQiV8Tn1MR9A9GmabFYscsPifcHComnL5u" - ], - "license": "MIT OR Apache-2.0" - }, - "contracts/core/ValidatorManager.sol": { - "keccak256": "0xc714a5886e6f23328df953d3f4086af832c8c432f55183279b9a1bec5b4b1dd8", - "urls": [ - "bzz-raw://3c83c2ea3cd55f064e87d42f0189bfdf8fb0d168786197c9ef3e8ec51ceeed81", - "dweb:/ipfs/QmdJoKQSnS6fbyaEiZvnCf8CHBeycoBPy7D8bRVtmbwg2C" - ], - "license": "MIT OR Apache-2.0" - }, - "node_modules/@openzeppelin/contracts/access/Ownable.sol": { - "keccak256": "0xff6d0bb2e285473e5311d9d3caacb525ae3538a80758c10649a4d61029b017bb", - "urls": [ - "bzz-raw://8ed324d3920bb545059d66ab97d43e43ee85fd3bd52e03e401f020afb0b120f6", - "dweb:/ipfs/QmfEckWLmZkDDcoWrkEvMWhms66xwTLff9DDhegYpvHo1a" - ], - "license": "MIT" - }, - "node_modules/@openzeppelin/contracts/utils/Context.sol": { - "keccak256": "0x75a4ee64c68dbd5f38bddd06e664a64c8271b4caa554fb6f0607dfd672bb4bf3", - "urls": [ - "bzz-raw://0c4e6cb30d3601e2f7af5af09e265508147cb275a8dcd99d6f7363645cc56867", - "dweb:/ipfs/QmNgFkoXNWoUbAyw71rr1sKQ95Rj2GfvYiWg79xEYDn2NY" - ], - "license": "MIT" - }, - "node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { - "keccak256": "0xeed0a08b0b091f528356cbc7245891a4c748682d4f6a18055e8e6ca77d12a6cf", - "urls": [ - "bzz-raw://ba80ba06c8e6be852847e4c5f4492cef801feb6558ae09ed705ff2e04ea8b13c", - "dweb:/ipfs/QmXRJDv3xHLVQCVXg1ZvR35QS9sij5y9NDWYzMfUfAdTHF" - ], - "license": "MIT" - }, - "node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { - "keccak256": "0x86c1470cbfd878491e5de030072b647352d36bd27122cffb928970b1945282aa", - "urls": [ - "bzz-raw://ad85dd393ee0a1917c57046abc5155f51f77844b2c6a42c05c1b8dd26d6ff3c1", - "dweb:/ipfs/QmNqYc8To2NdnpP6E1tGz7t6A7beuENde5yovwov5pW1fA" - ], - "license": "MIT" + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "validators", + "type": "address[]", + "internalType": "address[]" } - }, - "version": 1 + ], + "outputs": [], + "stateMutability": "nonpayable" }, - "ast": { - "absolutePath": "contracts/core/ValidatorManager.sol", - "id": 1237, - "exportedSymbols": { - "EnumerableSet": [53345], - "Ownable": [51314], - "SignatureValidator": [1100], - "ValidatorManager": [1236] - }, - "nodeType": "SourceUnit", - "src": "46:1779:8", - "nodes": [ - { - "id": 1102, - "nodeType": "PragmaDirective", - "src": "46:24:8", - "nodes": [], - "literals": ["solidity", "^", "0.8", ".20"] - }, - { - "id": 1104, - "nodeType": "ImportDirective", - "src": "72:86:8", - "nodes": [], - "absolutePath": "node_modules/@openzeppelin/contracts/utils/structs/EnumerableSet.sol", - "file": "@openzeppelin/contracts/utils/structs/EnumerableSet.sol", - "nameLocation": "-1:-1:-1", - "scope": 1237, - "sourceUnit": 53346, - "symbolAliases": [ - { - "foreign": { - "id": 1103, - "name": "EnumerableSet", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 53345, - "src": "80:13:8", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" - }, + { + "type": "function", + "name": "isValidator", + "inputs": [ + { "name": "user", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "removeValidator", + "inputs": [ + { "name": "user", "type": "address", "internalType": "address" } + ], + "outputs": [{ "name": "", "type": "bool", "internalType": "bool" }], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { "name": "newOwner", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "validateMessageWithSupermajority", + "inputs": [ { - "id": 1106, - "nodeType": "ImportDirective", - "src": "159:67:8", - "nodes": [], - "absolutePath": "node_modules/@openzeppelin/contracts/access/Ownable.sol", - "file": "@openzeppelin/contracts/access/Ownable.sol", - "nameLocation": "-1:-1:-1", - "scope": 1237, - "sourceUnit": 51315, - "symbolAliases": [ - { - "foreign": { - "id": 1105, - "name": "Ownable", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 51314, - "src": "167:7:8", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" + "name": "ethSignedMessageHash", + "type": "bytes32", + "internalType": "bytes32" }, + { "name": "signatures", "type": "bytes[]", "internalType": "bytes[]" } + ], + "outputs": [], + "stateMutability": "view" + }, + { + "type": "function", + "name": "validatorsSize", + "inputs": [], + "outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }], + "stateMutability": "view" + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ { - "id": 1108, - "nodeType": "ImportDirective", - "src": "227:73:8", - "nodes": [], - "absolutePath": "contracts/core/SignatureValidator.sol", - "file": "contracts/core/SignatureValidator.sol", - "nameLocation": "-1:-1:-1", - "scope": 1237, - "sourceUnit": 1101, - "symbolAliases": [ - { - "foreign": { - "id": 1107, - "name": "SignatureValidator", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1100, - "src": "235:18:8", - "typeDescriptions": {} - }, - "nameLocation": "-1:-1:-1" - } - ], - "unitAlias": "" + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "id": 1236, - "nodeType": "ContractDefinition", - "src": "302:1522:8", - "nodes": [ - { - "id": 1114, - "nodeType": "UsingForDirective", - "src": "345:49:8", - "nodes": [], - "global": false, - "libraryName": { - "id": 1111, - "name": "EnumerableSet", - "nameLocations": ["351:13:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 53345, - "src": "351:13:8" - }, - "typeName": { - "id": 1113, - "nodeType": "UserDefinedTypeName", - "pathNode": { - "id": 1112, - "name": "EnumerableSet.AddressSet", - "nameLocations": ["369:13:8", "383:10:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 53058, - "src": "369:24:8" - }, - "referencedDeclaration": 53058, - "src": "369:24:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage_ptr", - "typeString": "struct EnumerableSet.AddressSet" - } - } - }, - { - "id": 1118, - "nodeType": "UsingForDirective", - "src": "399:54:8", - "nodes": [], - "global": false, - "libraryName": { - "id": 1115, - "name": "SignatureValidator", - "nameLocations": ["405:18:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 1100, - "src": "405:18:8" - }, - "typeName": { - "id": 1117, - "nodeType": "UserDefinedTypeName", - "pathNode": { - "id": 1116, - "name": "EnumerableSet.AddressSet", - "nameLocations": ["428:13:8", "442:10:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 53058, - "src": "428:24:8" - }, - "referencedDeclaration": 53058, - "src": "428:24:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage_ptr", - "typeString": "struct EnumerableSet.AddressSet" - } - } - }, - { - "id": 1121, - "nodeType": "VariableDeclaration", - "src": "459:44:8", - "nodes": [], - "constant": false, - "mutability": "mutable", - "name": "_validators", - "nameLocation": "492:11:8", - "scope": 1236, - "stateVariable": true, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage", - "typeString": "struct EnumerableSet.AddressSet" - }, - "typeName": { - "id": 1120, - "nodeType": "UserDefinedTypeName", - "pathNode": { - "id": 1119, - "name": "EnumerableSet.AddressSet", - "nameLocations": ["459:13:8", "473:10:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 53058, - "src": "459:24:8" - }, - "referencedDeclaration": 53058, - "src": "459:24:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage_ptr", - "typeString": "struct EnumerableSet.AddressSet" - } - }, - "visibility": "private" - }, - { - "id": 1155, - "nodeType": "FunctionDefinition", - "src": "510:224:8", - "nodes": [], - "body": { - "id": 1154, - "nodeType": "Block", - "src": "571:163:8", - "nodes": [], - "statements": [ - { - "assignments": [1132], - "declarations": [ - { - "constant": false, - "id": 1132, - "mutability": "mutable", - "name": "validatorsLength", - "nameLocation": "586:16:8", - "nodeType": "VariableDeclaration", - "scope": 1154, - "src": "581:21:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 1131, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "581:4:8", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 1135, - "initialValue": { - "expression": { - "id": 1133, - "name": "validators", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1124, - "src": "605:10:8", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", - "typeString": "address[] memory" - } - }, - "id": 1134, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "616:6:8", - "memberName": "length", - "nodeType": "MemberAccess", - "src": "605:17:8", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "VariableDeclarationStatement", - "src": "581:41:8" - }, - { - "body": { - "id": 1152, - "nodeType": "Block", - "src": "676:52:8", - "statements": [ - { - "expression": { - "arguments": [ - { - "baseExpression": { - "id": 1147, - "name": "validators", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1124, - "src": "703:10:8", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", - "typeString": "address[] memory" - } - }, - "id": 1149, - "indexExpression": { - "id": 1148, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1137, - "src": "714:1:8", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "nodeType": "IndexAccess", - "src": "703:13:8", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "id": 1146, - "name": "addValidator", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1170, - "src": "690:12:8", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_address_$returns$_t_bool_$", - "typeString": "function (address) returns (bool)" - } - }, - "id": 1150, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "690:27:8", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 1151, - "nodeType": "ExpressionStatement", - "src": "690:27:8" - } - ] - }, - "condition": { - "commonType": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "id": 1142, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "leftExpression": { - "id": 1140, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1137, - "src": "649:1:8", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "nodeType": "BinaryOperation", - "operator": "<", - "rightExpression": { - "id": 1141, - "name": "validatorsLength", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1132, - "src": "653:16:8", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "src": "649:20:8", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "id": 1153, - "initializationExpression": { - "assignments": [1137], - "declarations": [ - { - "constant": false, - "id": 1137, - "mutability": "mutable", - "name": "i", - "nameLocation": "642:1:8", - "nodeType": "VariableDeclaration", - "scope": 1153, - "src": "637:6:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 1136, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "637:4:8", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "id": 1139, - "initialValue": { - "hexValue": "30", - "id": 1138, - "isConstant": false, - "isLValue": false, - "isPure": true, - "kind": "number", - "lValueRequested": false, - "nodeType": "Literal", - "src": "646:1:8", - "typeDescriptions": { - "typeIdentifier": "t_rational_0_by_1", - "typeString": "int_const 0" - }, - "value": "0" - }, - "nodeType": "VariableDeclarationStatement", - "src": "637:10:8" - }, - "loopExpression": { - "expression": { - "id": 1144, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "nodeType": "UnaryOperation", - "operator": "++", - "prefix": true, - "src": "671:3:8", - "subExpression": { - "id": 1143, - "name": "i", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1137, - "src": "673:1:8", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "id": 1145, - "nodeType": "ExpressionStatement", - "src": "671:3:8" - }, - "nodeType": "ForStatement", - "src": "632:96:8" - } - ] - }, - "implemented": true, - "kind": "constructor", - "modifiers": [ - { - "arguments": [ - { - "expression": { - "id": 1127, - "name": "msg", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": -15, - "src": "559:3:8", - "typeDescriptions": { - "typeIdentifier": "t_magic_message", - "typeString": "msg" - } - }, - "id": 1128, - "isConstant": false, - "isLValue": false, - "isPure": false, - "lValueRequested": false, - "memberLocation": "563:6:8", - "memberName": "sender", - "nodeType": "MemberAccess", - "src": "559:10:8", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "id": 1129, - "kind": "baseConstructorSpecifier", - "modifierName": { - "id": 1126, - "name": "Ownable", - "nameLocations": ["551:7:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 51314, - "src": "551:7:8" - }, - "nodeType": "ModifierInvocation", - "src": "551:19:8" - } - ], - "name": "", - "nameLocation": "-1:-1:-1", - "parameters": { - "id": 1125, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1124, - "mutability": "mutable", - "name": "validators", - "nameLocation": "539:10:8", - "nodeType": "VariableDeclaration", - "scope": 1155, - "src": "522:27:8", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", - "typeString": "address[]" - }, - "typeName": { - "baseType": { - "id": 1122, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "522:7:8", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 1123, - "nodeType": "ArrayTypeName", - "src": "522:9:8", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", - "typeString": "address[]" - } - }, - "visibility": "internal" - } - ], - "src": "521:29:8" - }, - "returnParameters": { - "id": 1130, - "nodeType": "ParameterList", - "parameters": [], - "src": "571:0:8" - }, - "scope": 1236, - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" - }, - { - "id": 1170, - "nodeType": "FunctionDefinition", - "src": "828:113:8", - "nodes": [], - "body": { - "id": 1169, - "nodeType": "Block", - "src": "896:45:8", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [ - { - "id": 1166, - "name": "user", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1157, - "src": "929:4:8", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "expression": { - "id": 1164, - "name": "_validators", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1121, - "src": "913:11:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage", - "typeString": "struct EnumerableSet.AddressSet storage ref" - } - }, - "id": 1165, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberLocation": "925:3:8", - "memberName": "add", - "nodeType": "MemberAccess", - "referencedDeclaration": 53085, - "src": "913:15:8", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_struct$_AddressSet_$53058_storage_ptr_$_t_address_$returns$_t_bool_$attached_to$_t_struct$_AddressSet_$53058_storage_ptr_$", - "typeString": "function (struct EnumerableSet.AddressSet storage pointer,address) returns (bool)" - } - }, - "id": 1167, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "913:21:8", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "functionReturnParameters": 1163, - "id": 1168, - "nodeType": "Return", - "src": "906:28:8" - } - ] - }, - "functionSelector": "4d238c8e", - "implemented": true, - "kind": "function", - "modifiers": [ - { - "id": 1160, - "kind": "modifierInvocation", - "modifierName": { - "id": 1159, - "name": "onlyOwner", - "nameLocations": ["871:9:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 51225, - "src": "871:9:8" - }, - "nodeType": "ModifierInvocation", - "src": "871:9:8" - } - ], - "name": "addValidator", - "nameLocation": "837:12:8", - "parameters": { - "id": 1158, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1157, - "mutability": "mutable", - "name": "user", - "nameLocation": "858:4:8", - "nodeType": "VariableDeclaration", - "scope": 1170, - "src": "850:12:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 1156, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "850:7:8", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "849:14:8" - }, - "returnParameters": { - "id": 1163, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1162, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 1170, - "src": "890:4:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 1161, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "890:4:8", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - } - ], - "src": "889:6:8" - }, - "scope": 1236, - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "public" - }, - { - "id": 1185, - "nodeType": "FunctionDefinition", - "src": "1035:121:8", - "nodes": [], - "body": { - "id": 1184, - "nodeType": "Block", - "src": "1108:48:8", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [ - { - "id": 1181, - "name": "user", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1172, - "src": "1144:4:8", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "expression": { - "id": 1179, - "name": "_validators", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1121, - "src": "1125:11:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage", - "typeString": "struct EnumerableSet.AddressSet storage ref" - } - }, - "id": 1180, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberLocation": "1137:6:8", - "memberName": "remove", - "nodeType": "MemberAccess", - "referencedDeclaration": 53112, - "src": "1125:18:8", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_nonpayable$_t_struct$_AddressSet_$53058_storage_ptr_$_t_address_$returns$_t_bool_$attached_to$_t_struct$_AddressSet_$53058_storage_ptr_$", - "typeString": "function (struct EnumerableSet.AddressSet storage pointer,address) returns (bool)" - } - }, - "id": 1182, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1125:24:8", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "functionReturnParameters": 1178, - "id": 1183, - "nodeType": "Return", - "src": "1118:31:8" - } - ] - }, - "functionSelector": "40a141ff", - "implemented": true, - "kind": "function", - "modifiers": [ - { - "id": 1175, - "kind": "modifierInvocation", - "modifierName": { - "id": 1174, - "name": "onlyOwner", - "nameLocations": ["1083:9:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 51225, - "src": "1083:9:8" - }, - "nodeType": "ModifierInvocation", - "src": "1083:9:8" - } - ], - "name": "removeValidator", - "nameLocation": "1044:15:8", - "parameters": { - "id": 1173, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1172, - "mutability": "mutable", - "name": "user", - "nameLocation": "1068:4:8", - "nodeType": "VariableDeclaration", - "scope": 1185, - "src": "1060:12:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 1171, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1060:7:8", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "1059:14:8" - }, - "returnParameters": { - "id": 1178, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1177, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 1185, - "src": "1102:4:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 1176, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1102:4:8", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - } - ], - "src": "1101:6:8" - }, - "scope": 1236, - "stateMutability": "nonpayable", - "virtual": false, - "visibility": "external" - }, - { - "id": 1196, - "nodeType": "FunctionDefinition", - "src": "1212:110:8", - "nodes": [], - "body": { - "id": 1195, - "nodeType": "Block", - "src": "1278:44:8", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [], - "expression": { - "argumentTypes": [], - "expression": { - "id": 1191, - "name": "_validators", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1121, - "src": "1295:11:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage", - "typeString": "struct EnumerableSet.AddressSet storage ref" - } - }, - "id": 1192, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberLocation": "1307:6:8", - "memberName": "values", - "nodeType": "MemberAccess", - "referencedDeclaration": 53211, - "src": "1295:18:8", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_struct$_AddressSet_$53058_storage_ptr_$returns$_t_array$_t_address_$dyn_memory_ptr_$attached_to$_t_struct$_AddressSet_$53058_storage_ptr_$", - "typeString": "function (struct EnumerableSet.AddressSet storage pointer) view returns (address[] memory)" - } - }, - "id": 1193, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1295:20:8", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", - "typeString": "address[] memory" - } - }, - "functionReturnParameters": 1190, - "id": 1194, - "nodeType": "Return", - "src": "1288:27:8" - } - ] - }, - "functionSelector": "b7ab4db5", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "getValidators", - "nameLocation": "1221:13:8", - "parameters": { - "id": 1186, - "nodeType": "ParameterList", - "parameters": [], - "src": "1234:2:8" - }, - "returnParameters": { - "id": 1190, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1189, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 1196, - "src": "1260:16:8", - "stateVariable": false, - "storageLocation": "memory", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", - "typeString": "address[]" - }, - "typeName": { - "baseType": { - "id": 1187, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1260:7:8", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "id": 1188, - "nodeType": "ArrayTypeName", - "src": "1260:9:8", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", - "typeString": "address[]" - } - }, - "visibility": "internal" - } - ], - "src": "1259:18:8" - }, - "scope": 1236, - "stateMutability": "view", - "virtual": false, - "visibility": "external" - }, - { - "id": 1209, - "nodeType": "FunctionDefinition", - "src": "1328:114:8", - "nodes": [], - "body": { - "id": 1208, - "nodeType": "Block", - "src": "1392:50:8", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [ - { - "id": 1205, - "name": "user", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1198, - "src": "1430:4:8", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_address", - "typeString": "address" - } - ], - "expression": { - "id": 1203, - "name": "_validators", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1121, - "src": "1409:11:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage", - "typeString": "struct EnumerableSet.AddressSet storage ref" - } - }, - "id": 1204, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberLocation": "1421:8:8", - "memberName": "contains", - "nodeType": "MemberAccess", - "referencedDeclaration": 53139, - "src": "1409:20:8", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_struct$_AddressSet_$53058_storage_ptr_$_t_address_$returns$_t_bool_$attached_to$_t_struct$_AddressSet_$53058_storage_ptr_$", - "typeString": "function (struct EnumerableSet.AddressSet storage pointer,address) view returns (bool)" - } - }, - "id": 1206, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1409:26:8", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "functionReturnParameters": 1202, - "id": 1207, - "nodeType": "Return", - "src": "1402:33:8" - } - ] - }, - "functionSelector": "facd743b", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "isValidator", - "nameLocation": "1337:11:8", - "parameters": { - "id": 1199, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1198, - "mutability": "mutable", - "name": "user", - "nameLocation": "1357:4:8", - "nodeType": "VariableDeclaration", - "scope": 1209, - "src": "1349:12:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - }, - "typeName": { - "id": 1197, - "name": "address", - "nodeType": "ElementaryTypeName", - "src": "1349:7:8", - "stateMutability": "nonpayable", - "typeDescriptions": { - "typeIdentifier": "t_address", - "typeString": "address" - } - }, - "visibility": "internal" - } - ], - "src": "1348:14:8" - }, - "returnParameters": { - "id": 1202, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1201, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 1209, - "src": "1386:4:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - }, - "typeName": { - "id": 1200, - "name": "bool", - "nodeType": "ElementaryTypeName", - "src": "1386:4:8", - "typeDescriptions": { - "typeIdentifier": "t_bool", - "typeString": "bool" - } - }, - "visibility": "internal" - } - ], - "src": "1385:6:8" - }, - "scope": 1236, - "stateMutability": "view", - "virtual": false, - "visibility": "external" - }, - { - "id": 1219, - "nodeType": "FunctionDefinition", - "src": "1448:99:8", - "nodes": [], - "body": { - "id": 1218, - "nodeType": "Block", - "src": "1503:44:8", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [], - "expression": { - "argumentTypes": [], - "expression": { - "id": 1214, - "name": "_validators", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1121, - "src": "1520:11:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage", - "typeString": "struct EnumerableSet.AddressSet storage ref" - } - }, - "id": 1215, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberLocation": "1532:6:8", - "memberName": "length", - "nodeType": "MemberAccess", - "referencedDeclaration": 53154, - "src": "1520:18:8", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_struct$_AddressSet_$53058_storage_ptr_$returns$_t_uint256_$attached_to$_t_struct$_AddressSet_$53058_storage_ptr_$", - "typeString": "function (struct EnumerableSet.AddressSet storage pointer) view returns (uint256)" - } - }, - "id": 1216, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1520:20:8", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "functionReturnParameters": 1213, - "id": 1217, - "nodeType": "Return", - "src": "1513:27:8" - } - ] - }, - "functionSelector": "e36d5265", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "validatorsSize", - "nameLocation": "1457:14:8", - "parameters": { - "id": 1210, - "nodeType": "ParameterList", - "parameters": [], - "src": "1471:2:8" - }, - "returnParameters": { - "id": 1213, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1212, - "mutability": "mutable", - "name": "", - "nameLocation": "-1:-1:-1", - "nodeType": "VariableDeclaration", - "scope": 1219, - "src": "1497:4:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - }, - "typeName": { - "id": 1211, - "name": "uint", - "nodeType": "ElementaryTypeName", - "src": "1497:4:8", - "typeDescriptions": { - "typeIdentifier": "t_uint256", - "typeString": "uint256" - } - }, - "visibility": "internal" - } - ], - "src": "1496:6:8" - }, - "scope": 1236, - "stateMutability": "view", - "virtual": false, - "visibility": "external" - }, - { - "id": 1235, - "nodeType": "FunctionDefinition", - "src": "1553:269:8", - "nodes": [], - "body": { - "id": 1234, - "nodeType": "Block", - "src": "1690:132:8", - "nodes": [], - "statements": [ - { - "expression": { - "arguments": [ - { - "id": 1230, - "name": "ethSignedMessageHash", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1221, - "src": "1761:20:8", - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - { - "id": 1231, - "name": "signatures", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1224, - "src": "1795:10:8", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", - "typeString": "bytes calldata[] calldata" - } - } - ], - "expression": { - "argumentTypes": [ - { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - }, - { - "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", - "typeString": "bytes calldata[] calldata" - } - ], - "expression": { - "id": 1227, - "name": "_validators", - "nodeType": "Identifier", - "overloadedDeclarations": [], - "referencedDeclaration": 1121, - "src": "1700:11:8", - "typeDescriptions": { - "typeIdentifier": "t_struct$_AddressSet_$53058_storage", - "typeString": "struct EnumerableSet.AddressSet storage ref" - } - }, - "id": 1229, - "isConstant": false, - "isLValue": true, - "isPure": false, - "lValueRequested": false, - "memberLocation": "1712:35:8", - "memberName": "validateSignaturesWithSupermajority", - "nodeType": "MemberAccess", - "referencedDeclaration": 1099, - "src": "1700:47:8", - "typeDescriptions": { - "typeIdentifier": "t_function_internal_view$_t_struct$_AddressSet_$53058_storage_ptr_$_t_bytes32_$_t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr_$returns$__$attached_to$_t_struct$_AddressSet_$53058_storage_ptr_$", - "typeString": "function (struct EnumerableSet.AddressSet storage pointer,bytes32,bytes calldata[] calldata) view" - } - }, - "id": 1232, - "isConstant": false, - "isLValue": false, - "isPure": false, - "kind": "functionCall", - "lValueRequested": false, - "nameLocations": [], - "names": [], - "nodeType": "FunctionCall", - "src": "1700:115:8", - "tryCall": false, - "typeDescriptions": { - "typeIdentifier": "t_tuple$__$", - "typeString": "tuple()" - } - }, - "id": 1233, - "nodeType": "ExpressionStatement", - "src": "1700:115:8" - } - ] - }, - "functionSelector": "d3de131d", - "implemented": true, - "kind": "function", - "modifiers": [], - "name": "validateMessageWithSupermajority", - "nameLocation": "1562:32:8", - "parameters": { - "id": 1225, - "nodeType": "ParameterList", - "parameters": [ - { - "constant": false, - "id": 1221, - "mutability": "mutable", - "name": "ethSignedMessageHash", - "nameLocation": "1612:20:8", - "nodeType": "VariableDeclaration", - "scope": 1235, - "src": "1604:28:8", - "stateVariable": false, - "storageLocation": "default", - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - }, - "typeName": { - "id": 1220, - "name": "bytes32", - "nodeType": "ElementaryTypeName", - "src": "1604:7:8", - "typeDescriptions": { - "typeIdentifier": "t_bytes32", - "typeString": "bytes32" - } - }, - "visibility": "internal" - }, - { - "constant": false, - "id": 1224, - "mutability": "mutable", - "name": "signatures", - "nameLocation": "1659:10:8", - "nodeType": "VariableDeclaration", - "scope": 1235, - "src": "1642:27:8", - "stateVariable": false, - "storageLocation": "calldata", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_bytes_calldata_ptr_$dyn_calldata_ptr", - "typeString": "bytes[]" - }, - "typeName": { - "baseType": { - "id": 1222, - "name": "bytes", - "nodeType": "ElementaryTypeName", - "src": "1642:5:8", - "typeDescriptions": { - "typeIdentifier": "t_bytes_storage_ptr", - "typeString": "bytes" - } - }, - "id": 1223, - "nodeType": "ArrayTypeName", - "src": "1642:7:8", - "typeDescriptions": { - "typeIdentifier": "t_array$_t_bytes_storage_$dyn_storage_ptr", - "typeString": "bytes[]" - } - }, - "visibility": "internal" - } - ], - "src": "1594:81:8" - }, - "returnParameters": { - "id": 1226, - "nodeType": "ParameterList", - "parameters": [], - "src": "1690:0:8" - }, - "scope": 1236, - "stateMutability": "view", - "virtual": false, - "visibility": "external" - } - ], - "abstract": false, - "baseContracts": [ - { - "baseName": { - "id": 1109, - "name": "Ownable", - "nameLocations": ["331:7:8"], - "nodeType": "IdentifierPath", - "referencedDeclaration": 51314, - "src": "331:7:8" - }, - "id": 1110, - "nodeType": "InheritanceSpecifier", - "src": "331:7:8" - } - ], - "canonicalName": "ValidatorManager", - "contractDependencies": [], - "contractKind": "contract", - "fullyImplemented": true, - "linearizedBaseContracts": [1236, 51314, 53367], - "name": "ValidatorManager", - "nameLocation": "311:16:8", - "scope": 1237, - "usedErrors": [985, 987, 989, 51180, 51185, 52321, 52326, 52331], - "usedEvents": [51191] + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "license": "MIT OR Apache-2.0" + "anonymous": false + }, + { "type": "error", "name": "ECDSAInvalidSignature", "inputs": [] }, + { + "type": "error", + "name": "ECDSAInvalidSignatureLength", + "inputs": [ + { "name": "length", "type": "uint256", "internalType": "uint256" } + ] + }, + { + "type": "error", + "name": "ECDSAInvalidSignatureS", + "inputs": [{ "name": "s", "type": "bytes32", "internalType": "bytes32" }] + }, + { "type": "error", "name": "InvalidValidatorOrSignatures", "inputs": [] }, + { "type": "error", "name": "NoSupermajority", "inputs": [] }, + { "type": "error", "name": "NonUniqueOrUnorderedSignatures", "inputs": [] }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" } + ] }, - "id": 8 -} + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ] + } +] diff --git a/products/bridge/bridge-validators/config.toml b/products/bridge/bridge-validators/config.toml index 295173292..eabb8e9d8 100644 --- a/products/bridge/bridge-validators/config.toml +++ b/products/bridge/bridge-validators/config.toml @@ -2,20 +2,20 @@ # "12D3KooWESbrSPohuw87dQDbJCB8qeeNgJsFD3ahkea3cu41m7bG", # "/ip4/172.16.8.135/tcp/3333", # ] -# BSC Testnet +# BSC Testnet [[chain_configs]] chain_gateway_block_deployed = 36696045 rpc_url = "https://bsc-prebsc-dataseed.bnbchain.org" -validator_manager_address = "0x6a7E0A8CB1b990b7C5E2b3b7f00141a947d9A73B" -chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" +validator_manager_address = "0x3bBa7E3B4b2058d3F3D017FBCC552939d62Eebb5" +chain_gateway_address = "0xCD6D04BB823cBBEd853B43DFe421Be47fc49AbC5" # BSC Mainnet # [[chain_configs]] -# chain_gateway_block_deployed = 35300538 -# rpc_url = "https://bsc-mainnet.core.chainstack.com/f46f3fe682039b2ed570255458dcd7d9" -# validator_manager_address = "0x95ebe761b40042F23b717e1e00ECF6b871f24173" -# chain_gateway_address = "0x3fa391E5a4c1b55D04A1b164fDC67ECEb312B93d" +# chain_gateway_block_deployed = 0 +# rpc_url = "https://bsc-dataseed1.binance.org" +# validator_manager_address = "0x63B6ebD476C84bFDd5DcaCB3f974794FC6C2e721" +# chain_gateway_address = "0x15A3D695EafF8d302eaF0a2e6b7b54F6A440C570" # [[chain_configs]] # rpc_url = "http://localhost:8545" @@ -28,8 +28,18 @@ chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" # chain_gateway_address = "0x4212b368876a54F99c741C8B5b64be2e52a6956b" # Zilliqa Testnet +[[chain_configs]] +chain_gateway_block_deployed = 6542681 +rpc_url = "https://dev-api.zilliqa.com" +validator_manager_address = "0x16bF46CAa709C01053da0d454111E284Ea8291AD" +chain_gateway_address = "0x9e7FF4479511B8C497860633f3E136Fa21C99f5A" +block_instant_finality = true +legacy_gas_estimation = true + +# Zilliqa Mainnet # [[chain_configs]] -# gateway_block_deployed = 6542681 -# rpc_url = "http://evm-api-filters.testnet.zilliqa.com/" -# validator_manager_address = "0xF74C8a0AF3B03d7135C7fFb816774f24d0053A3B" -# chain_gateway_address = "0x3Be6E686397f04901Be15e3e02EDC0c7565e4b13" +# chain_gateway_block_deployed = 0 +# rpc_url = "https://api.zilliqa.com" +# validator_manager_address = "0x8B64A6e53fC3A642E72E9Ac6709AeBc12aAc20f4" +# chain_gateway_address = "0x1690B1e78b98332EC5601A510640f451daf1323F" +# block_instant_finality = true diff --git a/products/bridge/bridge-validators/docker-compose.yaml b/products/bridge/bridge-validators/docker-compose.yaml index f3fbac237..d933d18bf 100644 --- a/products/bridge/bridge-validators/docker-compose.yaml +++ b/products/bridge/bridge-validators/docker-compose.yaml @@ -4,11 +4,10 @@ services: environment: RUST_BACKTRACE: 1 RUST_LOG: info - image: bridge-validator-node + container_name: validatornode0 build: context: . dockerfile: Dockerfile - container_name: validatornode0 volumes: - "./infra/config-leader.toml:/config.toml" command: @@ -20,7 +19,9 @@ services: RUST_BACKTRACE: 1 RUST_LOG: info container_name: validatornode1 - image: bridge-validator-node + build: + context: . + dockerfile: Dockerfile volumes: - "./infra/config.toml:/config.toml" command: @@ -32,7 +33,9 @@ services: RUST_BACKTRACE: 1 RUST_LOG: info container_name: validatornode2 - image: bridge-validator-node + build: + context: . + dockerfile: Dockerfile volumes: - "./infra/config.toml:/config.toml" command: @@ -44,7 +47,9 @@ services: RUST_BACKTRACE: 1 RUST_LOG: info container_name: validatornode3 - image: bridge-validator-node + build: + context: . + dockerfile: Dockerfile volumes: - "./infra/config.toml:/config.toml" command: diff --git a/products/bridge/bridge-validators/infra/cd/base/config-leader.toml b/products/bridge/bridge-validators/infra/cd/base/config-leader.toml index 867358c71..6cf250dbf 100644 --- a/products/bridge/bridge-validators/infra/cd/base/config-leader.toml +++ b/products/bridge/bridge-validators/infra/cd/base/config-leader.toml @@ -2,8 +2,8 @@ [[chain_configs]] chain_gateway_block_deployed = 36696045 rpc_url = "https://bsc-prebsc-dataseed.bnbchain.org" -validator_manager_address = "0x6a7E0A8CB1b990b7C5E2b3b7f00141a947d9A73B" -chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" +validator_manager_address = "0x3bBa7E3B4b2058d3F3D017FBCC552939d62Eebb5" +chain_gateway_address = "0xCD6D04BB823cBBEd853B43DFe421Be47fc49AbC5" # BSC Mainnet # [[chain_configs]] @@ -23,8 +23,10 @@ chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" # chain_gateway_address = "0x4212b368876a54F99c741C8B5b64be2e52a6956b" # Zilliqa Testnet -# [[chain_configs]] -# gateway_block_deployed = 6542681 -# rpc_url = "http://evm-api-filters.testnet.zilliqa.com/" -# validator_manager_address = "0xF74C8a0AF3B03d7135C7fFb816774f24d0053A3B" -# chain_gateway_address = "0x3Be6E686397f04901Be15e3e02EDC0c7565e4b13" +[[chain_configs]] +chain_gateway_block_deployed = 6542681 +rpc_url = "https://dev-api.zilliqa.com" +validator_manager_address = "0x16bF46CAa709C01053da0d454111E284Ea8291AD" +chain_gateway_address = "0x9e7FF4479511B8C497860633f3E136Fa21C99f5A" +block_instant_finality = true +legacy_gas_estimation = true diff --git a/products/bridge/bridge-validators/infra/cd/base/config.toml b/products/bridge/bridge-validators/infra/cd/base/config.toml index 93d0f02b3..5c98e25b8 100644 --- a/products/bridge/bridge-validators/infra/cd/base/config.toml +++ b/products/bridge/bridge-validators/infra/cd/base/config.toml @@ -1,14 +1,13 @@ -bootstrap_address = [ - "12D3KooWESbrSPohuw87dQDbJCB8qeeNgJsFD3ahkea3cu41m7bG", - "/ip4/172.16.8.135/tcp/3333", -] +# bootstrap_address = [ +# "12D3KooWESbrSPohuw87dQDbJCB8qeeNgJsFD3ahkea3cu41m7bG", +# "/ip4/172.16.8.135/tcp/3333", +# ] # BSC Testnet - [[chain_configs]] chain_gateway_block_deployed = 36696045 rpc_url = "https://bsc-prebsc-dataseed.bnbchain.org" -validator_manager_address = "0x6a7E0A8CB1b990b7C5E2b3b7f00141a947d9A73B" -chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" +validator_manager_address = "0x3bBa7E3B4b2058d3F3D017FBCC552939d62Eebb5" +chain_gateway_address = "0xCD6D04BB823cBBEd853B43DFe421Be47fc49AbC5" # BSC Mainnet # [[chain_configs]] @@ -28,8 +27,10 @@ chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" # chain_gateway_address = "0x4212b368876a54F99c741C8B5b64be2e52a6956b" # Zilliqa Testnet -# [[chain_configs]] -# gateway_block_deployed = 6542681 -# rpc_url = "http://evm-api-filters.testnet.zilliqa.com/" -# validator_manager_address = "0xF74C8a0AF3B03d7135C7fFb816774f24d0053A3B" -# chain_gateway_address = "0x3Be6E686397f04901Be15e3e02EDC0c7565e4b13" +[[chain_configs]] +chain_gateway_block_deployed = 6542681 +rpc_url = "https://dev-api.zilliqa.com" +validator_manager_address = "0x16bF46CAa709C01053da0d454111E284Ea8291AD" +chain_gateway_address = "0x9e7FF4479511B8C497860633f3E136Fa21C99f5A" +block_instant_finality = true +legacy_gas_estimation = true diff --git a/products/bridge/bridge-validators/infra/cd/base/deployment.yaml b/products/bridge/bridge-validators/infra/cd/base/deployment.yaml index 8985976de..949d154ff 100644 --- a/products/bridge/bridge-validators/infra/cd/base/deployment.yaml +++ b/products/bridge/bridge-validators/infra/cd/base/deployment.yaml @@ -25,7 +25,7 @@ spec: name: zilliqa-bridge-validator-secret command: ["/bin/bash", "-c"] args: - - ./bridge-validator $PRIVATE_KEY --config-file /etc/bridge/config.toml + - ./bridge-validator $PRIVATE_KEY --config-file /etc/bridge/config.toml --is-leader volumeMounts: - name: config-volume mountPath: /etc/bridge/config.toml diff --git a/products/bridge/bridge-validators/infra/config-leader.toml b/products/bridge/bridge-validators/infra/config-leader.toml index 867358c71..6cf250dbf 100644 --- a/products/bridge/bridge-validators/infra/config-leader.toml +++ b/products/bridge/bridge-validators/infra/config-leader.toml @@ -2,8 +2,8 @@ [[chain_configs]] chain_gateway_block_deployed = 36696045 rpc_url = "https://bsc-prebsc-dataseed.bnbchain.org" -validator_manager_address = "0x6a7E0A8CB1b990b7C5E2b3b7f00141a947d9A73B" -chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" +validator_manager_address = "0x3bBa7E3B4b2058d3F3D017FBCC552939d62Eebb5" +chain_gateway_address = "0xCD6D04BB823cBBEd853B43DFe421Be47fc49AbC5" # BSC Mainnet # [[chain_configs]] @@ -23,8 +23,10 @@ chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" # chain_gateway_address = "0x4212b368876a54F99c741C8B5b64be2e52a6956b" # Zilliqa Testnet -# [[chain_configs]] -# gateway_block_deployed = 6542681 -# rpc_url = "http://evm-api-filters.testnet.zilliqa.com/" -# validator_manager_address = "0xF74C8a0AF3B03d7135C7fFb816774f24d0053A3B" -# chain_gateway_address = "0x3Be6E686397f04901Be15e3e02EDC0c7565e4b13" +[[chain_configs]] +chain_gateway_block_deployed = 6542681 +rpc_url = "https://dev-api.zilliqa.com" +validator_manager_address = "0x16bF46CAa709C01053da0d454111E284Ea8291AD" +chain_gateway_address = "0x9e7FF4479511B8C497860633f3E136Fa21C99f5A" +block_instant_finality = true +legacy_gas_estimation = true diff --git a/products/bridge/bridge-validators/infra/config.toml b/products/bridge/bridge-validators/infra/config.toml index 93d0f02b3..5c98e25b8 100644 --- a/products/bridge/bridge-validators/infra/config.toml +++ b/products/bridge/bridge-validators/infra/config.toml @@ -1,14 +1,13 @@ -bootstrap_address = [ - "12D3KooWESbrSPohuw87dQDbJCB8qeeNgJsFD3ahkea3cu41m7bG", - "/ip4/172.16.8.135/tcp/3333", -] +# bootstrap_address = [ +# "12D3KooWESbrSPohuw87dQDbJCB8qeeNgJsFD3ahkea3cu41m7bG", +# "/ip4/172.16.8.135/tcp/3333", +# ] # BSC Testnet - [[chain_configs]] chain_gateway_block_deployed = 36696045 rpc_url = "https://bsc-prebsc-dataseed.bnbchain.org" -validator_manager_address = "0x6a7E0A8CB1b990b7C5E2b3b7f00141a947d9A73B" -chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" +validator_manager_address = "0x3bBa7E3B4b2058d3F3D017FBCC552939d62Eebb5" +chain_gateway_address = "0xCD6D04BB823cBBEd853B43DFe421Be47fc49AbC5" # BSC Mainnet # [[chain_configs]] @@ -28,8 +27,10 @@ chain_gateway_address = "0x517bBe8f8ca40B71BB88979b132138894801200a" # chain_gateway_address = "0x4212b368876a54F99c741C8B5b64be2e52a6956b" # Zilliqa Testnet -# [[chain_configs]] -# gateway_block_deployed = 6542681 -# rpc_url = "http://evm-api-filters.testnet.zilliqa.com/" -# validator_manager_address = "0xF74C8a0AF3B03d7135C7fFb816774f24d0053A3B" -# chain_gateway_address = "0x3Be6E686397f04901Be15e3e02EDC0c7565e4b13" +[[chain_configs]] +chain_gateway_block_deployed = 6542681 +rpc_url = "https://dev-api.zilliqa.com" +validator_manager_address = "0x16bF46CAa709C01053da0d454111E284Ea8291AD" +chain_gateway_address = "0x9e7FF4479511B8C497860633f3E136Fa21C99f5A" +block_instant_finality = true +legacy_gas_estimation = true diff --git a/products/bridge/bridge-validators/src/block.rs b/products/bridge/bridge-validators/src/block.rs new file mode 100644 index 000000000..1602808ff --- /dev/null +++ b/products/bridge/bridge-validators/src/block.rs @@ -0,0 +1,185 @@ +use std::{marker::PhantomData, time::Duration}; + +use async_stream::try_stream; +use async_trait::async_trait; + +use anyhow::{anyhow, Result}; +use ethers::{ + providers::Middleware, + types::{BlockNumber, Filter, Log, U64}, +}; +use ethers_contract::{parse_log, EthEvent}; +use futures::{Stream, StreamExt, TryStreamExt}; +use tokio::time::interval; +use tracing::{debug, info, warn}; + +use crate::client::ChainClient; + +#[async_trait] +pub trait BlockPolling { + async fn stream_finalized_blocks(&mut self) -> Result<()>; + async fn get_historic_blocks(&self, from: u64, to: u64) -> Result<()>; + + async fn get_events( + &self, + event: Filter, + from_block: BlockNumber, + to_block: BlockNumber, + ) -> Result> + where + D: EthEvent; +} + +#[async_trait] +impl BlockPolling for ChainClient { + async fn stream_finalized_blocks(&mut self) -> Result<()> { + Ok(()) + } + + async fn get_historic_blocks(&self, from: u64, to: u64) -> Result<()> { + let concurrent_requests = futures::stream::iter( + (from..to) + .into_iter() + .map(|block_number| self.client.get_block(block_number)), + ) + .buffer_unordered(3) + .map(|r| { + println!("finished request: {:?}", r); + r + }) + .try_collect::>(); + + let _res = concurrent_requests.await; + + Ok(()) + } + + async fn get_events( + &self, + event: Filter, + from_block: BlockNumber, + to_block: BlockNumber, + ) -> Result> + where + D: EthEvent, + { + let event = event.from_block(from_block).to_block(to_block); + + let logs: Vec = self + .client + .provider() + .request("eth_getLogs", [event]) + .await?; + + let logs = logs + .into_iter() + .map(|log| { + // Parse log values + let mut log = log; + match log["removed"].as_str() { + Some("true") => log["removed"] = serde_json::Value::Bool(true), + Some("false") => log["removed"] = serde_json::Value::Bool(false), + Some(&_) => warn!("invalid parsing"), + None => (), + }; + let log: Log = serde_json::from_value(log)?; + Ok(log) + }) + .collect::>>()?; + + let events: Vec = logs + .into_iter() + .map(|log| Ok(parse_log::(log)?)) + .collect::>>()?; + + return Ok(events); + } +} + +pub struct EventListener { + chain_client: ChainClient, + current_block: U64, + event: Filter, + phantom: PhantomData, +} + +impl EventListener { + pub fn new(chain_client: ChainClient, event: Filter) -> Self { + EventListener { + current_block: 0.into(), + chain_client, + event, + phantom: PhantomData, + } + } + + async fn get_block_number(&self) -> Result { + if self.chain_client.block_instant_finality { + self.chain_client.client.get_block_number().await + } else { + self.chain_client + .client + .get_block(BlockNumber::Finalized) + .await + .map(|block| block.unwrap().number.unwrap()) + } + .map_err(|_| anyhow!("Unable to get block number")) + } + + async fn poll_next_events(&mut self) -> Result> + where + D: EthEvent, + { + let new_block: U64 = match self.get_block_number().await { + Err(_) => return Ok(vec![]), + // Return early if smaller block + Ok(block) if block <= self.current_block => return Ok(vec![]), + Ok(block) => block, + }; + + // `eth_getLogs`'s block_number is inclusive, so `current_block` is already retrieved + let events = self + .chain_client + .get_events( + self.event.clone(), + (self.current_block + 1).into(), + new_block.into(), + ) + .await?; + + debug!( + "Getting from {} to {}, events gathered {:?}", + (self.current_block + 1), + new_block, + events.len(), + ); + if events.len() > 0 { + info!( + "Getting from {} to {}, events gathered {:?}", + (self.current_block + 1), + new_block, + events.len(), + ) + } + + self.current_block = new_block; + + Ok(events) + } + + pub fn listen(mut self) -> impl Stream>> { + let stream = try_stream! { + // TODO: update block interval on config + let mut interval = interval(Duration::from_secs(3)); + self.current_block = self.chain_client.client.get_block_number().await?; + + loop { + interval.tick().await; + + let new_events = self.poll_next_events().await?; + yield new_events + } + }; + Box::pin(stream) + } +} diff --git a/products/bridge/bridge-validators/src/bridge_node.rs b/products/bridge/bridge-validators/src/bridge_node.rs index dcbcb342c..b2a5f775b 100644 --- a/products/bridge/bridge-validators/src/bridge_node.rs +++ b/products/bridge/bridge-validators/src/bridge_node.rs @@ -17,6 +17,7 @@ use tokio_stream::wrappers::UnboundedReceiverStream; use tracing::{info, warn}; use crate::{ + block::{BlockPolling, EventListener}, client::{ChainClient, Client, ContractInitializer}, event::{RelayEvent, RelayEventSignatures}, message::{Dispatch, Dispatched, InboundBridgeMessage, OutboundBridgeMessage, Relay}, @@ -71,36 +72,43 @@ impl BridgeNode { where D: EthEvent, { - let events = event - .address(self.chain_client.chain_gateway_address.into()) - .from_block(self.chain_client.chain_gateway_block_deployed) - .to_block(to_block) - .query() - .await?; - - return Ok(events); + self.chain_client + .get_events( + event.filter, + self.chain_client.chain_gateway_block_deployed.into(), + to_block, + ) + .await } pub async fn sync_historic_events(&mut self) -> Result<()> { - let finalized_block_number = self + let to_block = if self.chain_client.block_instant_finality { + BlockNumber::Latest + } else { + BlockNumber::Finalized + }; + info!("Getting Historic Events {}", to_block); + + let to_block_number = self .chain_client .client - .get_block(BlockNumber::Finalized) + .get_block(to_block) .await? .expect("Latest finalized block should be retrieved") .number .expect("Number should be here"); - println!("Latest Finalised Block {}", finalized_block_number); + dbg!(to_block_number); let chain_gateway: ChainGateway = self.chain_client.get_contract(); let dispatch_events = self .get_historic_events( chain_gateway.event::(), - BlockNumber::Number(finalized_block_number.into()), + BlockNumber::Number(to_block_number.into()), ) .await?; + dbg!(dispatch_events.len()); for dispatch in dispatch_events { self.handle_dispatch_event(dispatch)?; @@ -109,15 +117,17 @@ impl BridgeNode { let relay_events = self .get_historic_events( chain_gateway.event::(), - BlockNumber::Number(finalized_block_number.into()), + BlockNumber::Number(to_block_number.into()), ) .await?; + dbg!(relay_events.len()); + for relay in relay_events { self.handle_relay_event(relay)?; } - Ok(()) + unimplemented!(); } pub async fn listen_events(&mut self) -> Result<()> { @@ -125,20 +135,29 @@ impl BridgeNode { let chain_gateway: ChainGateway = self.chain_client.get_contract(); - // TODO: test if polling finalised block events work - let relayed_events = chain_gateway.event::(); - let dispatched_events = chain_gateway.event::(); + // TODO: polling finalized events + let relayed_filter = chain_gateway.event::().filter; + let dispatched_filter = chain_gateway.event::().filter; + + let relayed_listener: EventListener = + EventListener::new(self.chain_client.clone(), relayed_filter); + let dispatched_listener: EventListener = + EventListener::new(self.chain_client.clone(), dispatched_filter); - let mut relayed_stream = relayed_events.stream().await?; - let mut dispatched_stream = dispatched_events.stream().await?; + let mut relayed_stream = relayed_listener.listen(); + let mut dispatched_stream = dispatched_listener.listen(); loop { select! { - Some(Ok(event)) = relayed_stream.next() => { - self.handle_relay_event(event)?; + Some(Ok(events)) = relayed_stream.next() => { + for event in events { + self.handle_relay_event(event)?; + } }, - Some(Ok(event)) = dispatched_stream.next() => { - self.handle_dispatch_event(event)?; + Some(Ok(events)) = dispatched_stream.next() => { + for event in events { + self.handle_dispatch_event(event)?; + } } Some(message) = self.inbound_message_receiver.next() => { self.handle_bridge_message(message).await?; @@ -243,7 +262,6 @@ impl BridgeNode { /// Handle message, verify and add to storage. /// If has supermajority then submit the transaction. - /// TODO: Also check if it is current leader to dispatch async fn handle_relay(&mut self, echo: &Relay) -> Result<()> { let Relay { signature, event } = echo; let nonce = event.nonce; diff --git a/products/bridge/bridge-validators/src/client.rs b/products/bridge/bridge-validators/src/client.rs index 822ba6a74..8edbb680a 100644 --- a/products/bridge/bridge-validators/src/client.rs +++ b/products/bridge/bridge-validators/src/client.rs @@ -21,6 +21,8 @@ pub struct ChainClient { pub chain_id: U256, pub wallet: LocalWallet, pub chain_gateway_block_deployed: u64, + pub block_instant_finality: bool, + pub legacy_gas_estimation: bool, } impl ChainClient { @@ -39,6 +41,8 @@ impl ChainClient { chain_id, wallet, chain_gateway_block_deployed: config.chain_gateway_block_deployed, + block_instant_finality: config.block_instant_finality.unwrap_or_default(), + legacy_gas_estimation: config.legacy_gas_estimation.unwrap_or_default(), }) } } diff --git a/products/bridge/bridge-validators/src/main.rs b/products/bridge/bridge-validators/src/main.rs index c5b52dfe7..fb76981af 100644 --- a/products/bridge/bridge-validators/src/main.rs +++ b/products/bridge/bridge-validators/src/main.rs @@ -1,3 +1,4 @@ +mod block; mod bridge_node; mod client; mod crypto; @@ -30,6 +31,8 @@ pub struct ChainConfig { pub validator_manager_address: Address, pub chain_gateway_address: Address, pub chain_gateway_block_deployed: u64, + pub block_instant_finality: Option, + pub legacy_gas_estimation: Option, } #[derive(Debug, Clone, Deserialize)] diff --git a/products/bridge/bridge-validators/src/p2p_node.rs b/products/bridge/bridge-validators/src/p2p_node.rs index 784f4c7d2..472d246f4 100644 --- a/products/bridge/bridge-validators/src/p2p_node.rs +++ b/products/bridge/bridge-validators/src/p2p_node.rs @@ -37,7 +37,7 @@ struct Behaviour { pub struct P2pNode { peer_id: PeerId, - swarm: Swarm, + // swarm: Swarm, /// Forward messages to the bridge validators. Only initialised once BridgeNode is created bridge_inbound_message_sender: Option>, /// Bridge nodes get a copy of these senders to propagate messages across the network. @@ -58,39 +58,39 @@ impl P2pNode { let peer_id = PeerId::from(key_pair.public()); info!(%peer_id); - let transport = tcp::tokio::Transport::new(tcp::Config::default()) - .upgrade(upgrade::Version::V1) - .authenticate(noise::Config::new(&key_pair)?) - .multiplex(yamux::Config::default()) - .boxed(); - - let behaviour = Behaviour { - gossipsub: gossipsub::Behaviour::new( - MessageAuthenticity::Signed(key_pair.clone()), - gossipsub::ConfigBuilder::default() - .max_transmit_size(524288) - .build() - .map_err(|e| anyhow!(e))?, - ) - .map_err(|e| anyhow!(e))?, - mdns: mdns::Behaviour::new(Default::default(), peer_id)?, - identify: identify::Behaviour::new(identify::Config::new( - "/ipfs/id/1.0.0".to_owned(), - key_pair.public(), - )), - kademlia: kad::Behaviour::new(peer_id, MemoryStore::new(peer_id)), - }; - - let swarm = Swarm::new( - transport, - behaviour, - peer_id, - swarm::Config::with_tokio_executor(), - ); + // let transport = tcp::tokio::Transport::new(tcp::Config::default()) + // .upgrade(upgrade::Version::V1) + // .authenticate(noise::Config::new(&key_pair)?) + // .multiplex(yamux::Config::default()) + // .boxed(); + + // let behaviour = Behaviour { + // gossipsub: gossipsub::Behaviour::new( + // MessageAuthenticity::Signed(key_pair.clone()), + // gossipsub::ConfigBuilder::default() + // .max_transmit_size(524288) + // .build() + // .map_err(|e| anyhow!(e))?, + // ) + // .map_err(|e| anyhow!(e))?, + // mdns: mdns::Behaviour::new(Default::default(), peer_id)?, + // identify: identify::Behaviour::new(identify::Config::new( + // "/ipfs/id/1.0.0".to_owned(), + // key_pair.public(), + // )), + // kademlia: kad::Behaviour::new(peer_id, MemoryStore::new(peer_id)), + // }; + + // let swarm = Swarm::new( + // transport, + // behaviour, + // peer_id, + // swarm::Config::with_tokio_executor(), + // ); Ok(Self { peer_id, - swarm, + // swarm, bridge_outbound_message_sender, bridge_outbound_message_receiver, bridge_inbound_message_sender: None, @@ -110,9 +110,9 @@ impl P2pNode { } async fn create_and_start_validator_node(&mut self, config: ValidatorNodeConfig) -> Result<()> { - let topic = IdentTopic::new("bridge"); // TODO: change to more specific bridge chains + // let topic = IdentTopic::new("bridge"); // TODO: change to more specific bridge chains - self.swarm.behaviour_mut().gossipsub.subscribe(&topic)?; + // self.swarm.behaviour_mut().gossipsub.subscribe(&topic)?; // Initialise bridge node let mut bridge_node = @@ -120,88 +120,94 @@ impl P2pNode { self.bridge_inbound_message_sender = Some(bridge_node.get_bridge_inbound_message_sender()); - tokio::task::spawn(async move { bridge_node.listen_p2p().await }); + tokio::task::spawn(async move { bridge_node.listen_p2p().await.unwrap() }); Ok(()) } - pub async fn start<'a>(&mut self, config: ValidatorNodeConfig) -> Result<()> { - let addr: Multiaddr = "/ip4/0.0.0.0/tcp/3334".parse().unwrap(); + pub async fn start(&mut self, config: ValidatorNodeConfig) -> Result<()> { + // let addr: Multiaddr = "/ip4/0.0.0.0/tcp/3334".parse().unwrap(); - if let Some((peer, address)) = &config.bootstrap_address { - self.swarm - .behaviour_mut() - .kademlia - .add_address(peer, address.clone()); - self.swarm.behaviour_mut().kademlia.bootstrap()?; - } + // if let Some((peer, address)) = &config.bootstrap_address { + // self.swarm + // .behaviour_mut() + // .kademlia + // .add_address(peer, address.clone()); + // self.swarm.behaviour_mut().kademlia.bootstrap()?; + // } self.create_and_start_validator_node(config).await?; - self.swarm.listen_on(addr)?; + // self.swarm.listen_on(addr)?; println!("Started"); loop { select! { - event = self.swarm.select_next_some() => match event { - SwarmEvent::NewListenAddr { address, .. } => { - info!(%address, "started listening"); - } - SwarmEvent::Behaviour(BehaviourEvent::Mdns(mdns::Event::Discovered(list))) => { - for (peer_id, addr) in list { - info!(%peer_id, %addr, "discovered peer via mDNS"); - self.swarm.behaviour_mut().kademlia.add_address(&peer_id, addr); - self.swarm.behaviour_mut().gossipsub.add_explicit_peer(&peer_id); - } - } - SwarmEvent::Behaviour(BehaviourEvent::Mdns(mdns::Event::Expired(list))) => { - for (peer_id, addr) in list { - self.swarm.behaviour_mut().kademlia.remove_address(&peer_id, &addr); - } - } - SwarmEvent::Behaviour(BehaviourEvent::Identify(identify::Event::Received { info: identify::Info { observed_addr, listen_addrs, .. }, peer_id })) => { - info!("discovered peer via kad, {}, {:?}", &peer_id, &listen_addrs); - for addr in listen_addrs { - self.swarm.behaviour_mut().kademlia.add_address(&peer_id, addr); - } - // Mark the address observed for us by the external peer as confirmed. - // TODO: We shouldn't trust this, instead we should confirm our own address manually or using - // `libp2p-autonat`. - self.swarm.add_external_address(observed_addr); - } - SwarmEvent::Behaviour(BehaviourEvent::Gossipsub(gossipsub::Event::Message{ - message: gossipsub::Message { - source, - data, - .. - }, .. - })) => { - let source = source.expect("message should have a source"); - let message = serde_json::from_slice::(&data).unwrap(); - let message_type = message.name(); - let to = self.peer_id; - debug!(%source, %to, message_type, "broadcast received"); - self.forward_external_message_to_bridge_node(source, message)?; - } - - _ => {}, - }, + // event = self.swarm.select_next_some() => match event { + // SwarmEvent::NewListenAddr { address, .. } => { + // info!(%address, "started listening"); + // } + // SwarmEvent::Behaviour(BehaviourEvent::Mdns(mdns::Event::Discovered(list))) => { + // for (peer_id, addr) in list { + // info!(%peer_id, %addr, "discovered peer via mDNS"); + // self.swarm.behaviour_mut().kademlia.add_address(&peer_id, addr); + // self.swarm.behaviour_mut().gossipsub.add_explicit_peer(&peer_id); + // } + // } + // SwarmEvent::Behaviour(BehaviourEvent::Mdns(mdns::Event::Expired(list))) => { + // for (peer_id, addr) in list { + // self.swarm.behaviour_mut().kademlia.remove_address(&peer_id, &addr); + // } + // } + // SwarmEvent::Behaviour(BehaviourEvent::Identify(identify::Event::Received { info: identify::Info { observed_addr, listen_addrs, .. }, peer_id })) => { + // info!("discovered peer via kad, {}, {:?}", &peer_id, &listen_addrs); + // for addr in listen_addrs { + // self.swarm.behaviour_mut().kademlia.add_address(&peer_id, addr); + // } + // // Mark the address observed for us by the external peer as confirmed. + // // TODO: We shouldn't trust this, instead we should confirm our own address manually or using + // // `libp2p-autonat`. + // self.swarm.add_external_address(observed_addr); + // } + // SwarmEvent::Behaviour(BehaviourEvent::Gossipsub(gossipsub::Event::Message{ + // message: gossipsub::Message { + // source, + // data, + // .. + // }, .. + // })) => { + // let source = source.expect("message should have a source"); + // let message = serde_json::from_slice::(&data).unwrap(); + // let message_type = message.name(); + // let to = self.peer_id; + // debug!(%source, %to, message_type, "broadcast received"); + // self.forward_external_message_to_bridge_node(source, message)?; + // } + + // _ => {}, + // }, message = self.bridge_outbound_message_receiver.next() => { let message = message.expect("message stream should be infinite"); let message_type = message.name(); let data = serde_json::to_vec(&message).unwrap(); let from = self.peer_id; - let topic = IdentTopic::new("bridge"); + // let topic = IdentTopic::new("bridge"); + + // if self.swarm.behaviour().gossipsub.all_peers().count() > 0 { + // debug!(%from, message_type, "broadcasting"); + // match self.swarm.behaviour_mut().gossipsub.publish(topic.hash(), data) { + // Ok(_) => {}, + // Err(e) => { + // error!(%e, "failed to publish message"); + // } + // } + // } else{ + // info!("Not broadcasting"); + // }; + - debug!(%from, message_type, "broadcasting"); - match self.swarm.behaviour_mut().gossipsub.publish(topic.hash(), data) { - Ok(_) => {}, - Err(e) => { - error!(%e, "failed to publish message"); - } - } // Also broadcast the message to ourselves. self.forward_external_message_to_bridge_node(from, message)?; }, diff --git a/products/bridge/bridge-validators/src/validator_node.rs b/products/bridge/bridge-validators/src/validator_node.rs index 3eb8f115e..0cc5fa66f 100644 --- a/products/bridge/bridge-validators/src/validator_node.rs +++ b/products/bridge/bridge-validators/src/validator_node.rs @@ -160,6 +160,12 @@ impl ValidatorNode { event.target_chain_id, event.nonce ); + let function_call = if client.legacy_gas_estimation { + function_call.legacy() + } else { + function_call + }; + // Simulate call, if fails decode error and exit early if let Err(contract_err) = function_call.call().await { match contract_err.decode_contract_revert::() { @@ -180,7 +186,7 @@ impl ValidatorNode { } // Make the actual call - function_call.send().await?.await?; + let txn = function_call.send().await?.log_msg("Pending txn hash"); println!("Transaction Sent {}.{}", event.target_chain_id, event.nonce); Ok(()) diff --git a/products/bridge/smart-contracts/script/deploy.target.s.sol b/products/bridge/smart-contracts/script/deploy.target.s.sol index 9f3b6213d..fe64ded97 100644 --- a/products/bridge/smart-contracts/script/deploy.target.s.sol +++ b/products/bridge/smart-contracts/script/deploy.target.s.sol @@ -11,7 +11,7 @@ import "forge-std/console.sol"; contract Deployment is Script { function run() external { uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_TEST"); - address chainGateway = 0x517bBe8f8ca40B71BB88979b132138894801200a; + address chainGateway = 0xCD6D04BB823cBBEd853B43DFe421Be47fc49AbC5; vm.startBroadcast(deployerPrivateKey); diff --git a/products/bridge/smart-contracts/script/deploy.target.zqt.s.sol b/products/bridge/smart-contracts/script/deploy.target.zqt.s.sol new file mode 100644 index 000000000..9f693155d --- /dev/null +++ b/products/bridge/smart-contracts/script/deploy.target.zqt.s.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +pragma solidity ^0.8.20; + +import {Script} from "forge-std/Script.sol"; +import {Relayer} from "contracts/core/Relayer.sol"; +import {ValidatorManager} from "contracts/core/ValidatorManager.sol"; +import {ChainGateway} from "contracts/core/ChainGateway.sol"; +import {Target} from "foundry/test/Target.sol"; +import "forge-std/console.sol"; + +contract Deployment is Script { + function run() external { + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_TEST"); + address chainGateway = 0x9e7FF4479511B8C497860633f3E136Fa21C99f5A; + + vm.startBroadcast(deployerPrivateKey); + + new Target(chainGateway); + + vm.stopBroadcast(); + } +} diff --git a/products/bridge/smart-contracts/script/relay.s.sol b/products/bridge/smart-contracts/script/relay.s.sol index 460b6ded9..e992aee6f 100644 --- a/products/bridge/smart-contracts/script/relay.s.sol +++ b/products/bridge/smart-contracts/script/relay.s.sol @@ -7,9 +7,9 @@ import {Target} from "foundry/test/Target.sol"; contract Relay is Script { function run() external { - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_TEST"); - address chainGateway = 0x517bBe8f8ca40B71BB88979b132138894801200a; - address target = 0x030B05d6Bf38BAD540B233788cc29a70B01f9300; + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_TESTNET"); + address chainGateway = 0xCD6D04BB823cBBEd853B43DFe421Be47fc49AbC5; + address target = 0x6da9913794Fabe2482CB40cC9d7368f8332A998f; uint targetChainId = 33101; vm.startBroadcast(deployerPrivateKey); diff --git a/products/bridge/smart-contracts/script/relay.zqt.s.sol b/products/bridge/smart-contracts/script/relay.zqt.s.sol index b398a31dd..ee97b01d9 100644 --- a/products/bridge/smart-contracts/script/relay.zqt.s.sol +++ b/products/bridge/smart-contracts/script/relay.zqt.s.sol @@ -7,10 +7,10 @@ import {Target} from "foundry/test/Target.sol"; contract Relay is Script { function run() external { - uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_TEST"); - address chainGateway = 0x3Be6E686397f04901Be15e3e02EDC0c7565e4b13; - address target = 0xFC99557Ca42B3139f7a0eDAcCF84985235631815; - uint targetChainId = 33101; + uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY_TESTNET"); + address chainGateway = 0x9e7FF4479511B8C497860633f3E136Fa21C99f5A; + address target = 0x47eF3cc8B9D54db3A6d8D0175eb117D694575509; + uint targetChainId = 97; vm.startBroadcast(deployerPrivateKey);