diff --git a/Cargo.lock b/Cargo.lock index a7572a122..080a7898e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5305,7 +5305,7 @@ dependencies = [ [[package]] name = "hyperbridge" -version = "0.3.2" +version = "0.3.3" dependencies = [ "clap", "cumulus-client-cli", @@ -10668,21 +10668,6 @@ dependencies = [ "universal-hash", ] -[[package]] -name = "polygon-pos-prover" -version = "0.1.0" -dependencies = [ - "anyhow", - "dotenv", - "ethers", - "geth-primitives", - "ismp", - "polygon-pos-verifier", - "primitive-types", - "sp-core 28.0.0", - "tokio", -] - [[package]] name = "polygon-pos-verifier" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 0455f6bb8..a8ab62242 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ members = [ "modules/ismp/core", "modules/ismp/testsuite", "modules/ismp/clients/sync-committee", - "modules/ismp/clients/polygon-pos", +# "modules/ismp/clients/polygon-pos", "modules/ismp/clients/casper-ffg", "modules/ismp/pallet/state-machine", @@ -26,8 +26,8 @@ members = [ "modules/consensus/sync-committee/prover", "modules/consensus/sync-committee/verifier", "modules/consensus/sync-committee/primitives", - "modules/consensus/polygon-pos/verifier", - "modules/consensus/polygon-pos/prover", +# "modules/consensus/polygon-pos/verifier", +# "modules/consensus/polygon-pos/prover", "modules/consensus/beefy/primitives", "modules/consensus/beefy/prover", "modules/consensus/geth-primitives", diff --git a/docs/package-lock.json b/docs/package-lock.json index f4d1d7d5e..aac32fde5 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -8,6 +8,7 @@ "name": "hyperbridge", "version": "0.0.0", "dependencies": { + "i": "^0.3.7", "prettier": "^3.2.2", "react": "latest", "react-dom": "latest", @@ -526,6 +527,7 @@ }, "node_modules/@clack/prompts/node_modules/is-unicode-supported": { "version": "1.3.0", + "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -4359,6 +4361,14 @@ "node": ">=10.17.0" } }, + "node_modules/i": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/i/-/i-0.3.7.tgz", + "integrity": "sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==", + "engines": { + "node": ">=0.4" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", diff --git a/docs/package.json b/docs/package.json index 9bbc6d97a..9fdf7906b 100644 --- a/docs/package.json +++ b/docs/package.json @@ -3,12 +3,13 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vocs dev", + "dev": "vocs dev --host", "build": "vocs build", "preview": "vocs preview", "prettier": "npm run prettier" }, "dependencies": { + "i": "^0.3.7", "prettier": "^3.2.2", "react": "latest", "react-dom": "latest", diff --git a/docs/pages/evm/integration.mdx b/docs/pages/evm/integration.mdx index e69de29bb..ac088a07e 100644 --- a/docs/pages/evm/integration.mdx +++ b/docs/pages/evm/integration.mdx @@ -0,0 +1,20 @@ +## Gargantua V1 (Deprecated) + + +| Network | `HandlerV1` | `IsmpHost` | +|:-------------------|:--------------|:-----| +|Ethereum Sepolia | [`0x577efa5c6184E10D54fdA5eB195f7ecA30644082`](https://sepolia.etherscan.io/address/0x577efa5c6184E10D54fdA5eB195f7ecA30644082) | [`0x5b5F63C8f3985CaFE1CE53E6374f42AB60dE5a6B`](https://sepolia.etherscan.io/address/0x5b5F63C8f3985CaFE1CE53E6374f42AB60dE5a6B) | +|Arbitrum Sepolia | [`0x4221D52aa25d80Bb4741D430f16f5769cA99bc58`](https://sepolia.arbiscan.io/address/0x4221D52aa25d80Bb4741D430f16f5769cA99bc58) | [`0x43E136611Cf74E165116a47e6F9C58AFCc80Ec54`](https://sepolia.arbiscan.io/address/0x43E136611Cf74E165116a47e6F9C58AFCc80Ec54) | +|Optimism Sepolia | [`0x4221D52aa25d80Bb4741D430f16f5769cA99bc58`](https://sepolia-optimism.etherscan.io/address/0x4221D52aa25d80Bb4741D430f16f5769cA99bc58) | [`0x0124f458900FCd101c4CE31A9772fD2c5e6d65BF`](https://sepolia-optimism.etherscan.io/address/0x0124f458900FCd101c4CE31A9772fD2c5e6d65BF) | +|Base Sepolia | [`0x3cfb5eE8D00c2620e0A63FD25deAA2d7a671F449`](https://sepolia.basescan.org/address/0x3cfb5eE8D00c2620e0A63FD25deAA2d7a671F449) | [`0x87825f839d95c6021c0e821917F93aDB299eD6F8`](https://sepolia.basescan.org/address/0x87825f839d95c6021c0e821917F93aDB299eD6F8) | + + +## Gargantua V2 + +| Network | `HandlerV1` | `IsmpHost` | +|:-------------------|:--------------|:-----| +|Ethereum Sepolia | [`0xa873b742084F81811693eD86C041583D37c05b43`](https://sepolia.etherscan.io/address/0xa873b742084F81811693eD86C041583D37c05b43) | [`0x9DF353352b469782AB1B0F2CbBFEC41bF1FDbDb3`](https://sepolia.etherscan.io/address/0x9DF353352b469782AB1B0F2CbBFEC41bF1FDbDb3) | +|Arbitrum Sepolia | [`0xFb9CDe6EBA0bBfA0E7ed2603Ea659E3511A98B41`](https://sepolia.arbiscan.io/address/0xFb9CDe6EBA0bBfA0E7ed2603Ea659E3511A98B41) | [`0x424e6971EB1C693cf4296d4bdb42aa0F32a0dd9e`](https://sepolia.arbiscan.io/address/0x424e6971EB1C693cf4296d4bdb42aa0F32a0dd9e) | +|Optimism Sepolia | [`0xa25151598Dc180fc03635858f37bDF8427f47845`](https://sepolia-optimism.etherscan.io/address/0xa25151598Dc180fc03635858f37bDF8427f47845) | [`0x1B58A47e61Ca7604b634CBB00b4e275cCd7c9E95`](https://sepolia-optimism.etherscan.io/address/0x1B58A47e61Ca7604b634CBB00b4e275cCd7c9E95) | +|Base Sepolia | [`0x4B0c9cDA104D131aF12280Bb074d6B456F467C47`](https://sepolia.basescan.org/address/0x4B0c9cDA104D131aF12280Bb074d6B456F467C47) | [`0x4c876500A13cc3825D343b5Ac791d3A4913bF14f`](https://sepolia.basescan.org/address/0x4c876500A13cc3825D343b5Ac791d3A4913bF14f) | +|Bsc Testnet | [`0x43a0BcC347894303f93905cE137CB3b804bE990d`](https://testnet.bscscan.com/address/0x43a0BcC347894303f93905cE137CB3b804bE990d) | [`0x022DDE07A21d8c553978b006D93CDe68ac83e677`](https://testnet.bscscan.com/address/0x022DDE07A21d8c553978b006D93CDe68ac83e677) | diff --git a/docs/pages/network/node.mdx b/docs/pages/network/node.mdx index 20a7e9e74..61b7e59b0 100644 --- a/docs/pages/network/node.mdx +++ b/docs/pages/network/node.mdx @@ -24,7 +24,7 @@ docker run polytopelabs/hyperbridge:latest --chain=messier You can install a prebuilt binary for the hyperbridge node with the following bash script ```bash -wget -q --show-progress https://github.com/polytope-labs/hyperbridge/releases/download/v0.2.0/hyperbridge-x86_64-unknown-linux-gnu.tar.gz +wget -q --show-progress https://github.com/polytope-labs/hyperbridge/releases/download/v0.3.2/hyperbridge-x86_64-unknown-linux-gnu.tar.gz tar -xvzf hyperbridge-x86_64-unknown-linux-gnu.tar.gz # copy to $PATH cp hyperbridge-x86_64-unknown-linux-gnu/hyperbridge $HOME/.local/bin/ @@ -33,7 +33,7 @@ cp hyperbridge-x86_64-unknown-linux-gnu/hyperbridge $HOME/.local/bin/ or a 1-liner shell script ```bash -curl --proto '=https' --tlsv1.2 -LsSf https://github.com/polytope-labs/hyperbridge/releases/download/v0.2.0/hyperbridge-installer.sh | sh +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/polytope-labs/hyperbridge/releases/download/v0.3.2/hyperbridge-installer.sh | sh ``` ## Building from source @@ -101,7 +101,7 @@ Download a local copy of the repo and checkout the latest release tag ```bash git clone https://github.com/polytope-labs/hyperbridge.git cd ./hyperbidge -git checkout v0.2.0 +git checkout v0.3.2 ``` ### Build the node diff --git a/docs/pages/network/relayer.mdx b/docs/pages/network/relayer.mdx index 784a1c5e0..169484d3a 100644 --- a/docs/pages/network/relayer.mdx +++ b/docs/pages/network/relayer.mdx @@ -5,7 +5,38 @@ description: Running the tesseract relayer # Relayers -Critical to the function of Hyperbridge are relayers who transmit requests & responses across it's connected chains. These relayers much like node operators earn rewards for relaying requests. Since request execution fees are paid for ahead of time on the source chain by the initiating application. Relayers can relay and pay for the execution of these requests on the destination chain and redeem their fees on the source chain. This works by the relayer showing state proofs of request delivery to the hyperbridge parachain. Hyperbridge then authorizes the release of the fees to the relayer on the source chain through an ISMP request. +
+ Hyperbridge relayers +
Hyperbridge relayers
+
+ +Critical to the function of Hyperbridge are the relayers who transmit requests & responses across it's connected chains. Unlike popular interoperability protocols, Hyperbridge relayers are fully permissionless. This means, relayers will not need to be staked or whitelisted in order to transmit cross-chain messages. This is as a result of it's first-of-it's kind, fully trust-free design. This service of-course, will not be for free. Hyperbridge permits the applications that leverage it’s secure message passing infrastructure to pay ahead of time for the message delivery & execution. They do so on the source chain of the initiating application. +
+Fees for cross-chain requests are to be paid in stable coins, We’ve chosen the DAI stablecoin for it’s decentralized and censorship-resistant properties. This means users will estimate the cost for message execution & provide what they believe to be a fair amount in DAI to the Hyperbridge contract. (Specifically, the [EvmHost](https://github.com/polytope-labs/hyperbridge/blob/main/evm/src/hosts/EvmHost.sol#L533)) at the time of dispatching a request. Once the request has been finalized by the originating chain and these finality proofs made available to the destination chain. The request becomes eligible for delivery & execution. A relayer will estimate the cost of request delivery and query the fee that has been put up for it’s delivery on the source chain. Depending on their profitability configuration, they’ll either choose to deliver the request or ignore it. +
+If the relayers chooses to deliver the request, then this means they will cover the cost of message delivery and execution. This cost of message delivery is the cost of proof verification of requests & responses. The cost of message execution is the cost of executing the message on the destination module. In the current version of the protocol, relayers are tasked with both delivering and executing the messages. But it is entirely possible in future versions of the protocol that we unbundle message delivery and execution as this may enable more exotic applications. +
+In our chosen design, relayers race to deliver a batch of cross-chain messages to their respective destination chains. This has a few benefits, this effectively mitigates any liveness issues that may arise as a result of some whitelisted relayers going down. This free market design presents a much better UX to end users and applications. The winning relayer, can be decided by a few factors. +
+1. Block notification. + +Relayer are mostly idle, and will only check for new messages to be delivered when the chains they’re interested in receive new consensus messages. The consensus messages, contain proofs that finalizes a new set of block heights. The new block heights, may or may not contain new messages to be delivered from the hyperbridge parachain. Therefore, whichever relayer sees the block where these consensus messages were processed on the destination chain first, can begin the check before everyone else and as a result, deliver the new batch of requests before anyone else. + +2. Query throughput + +We can for the purposes of this criteria assume that every single relayer has received the block notification at the same time. Now they have to do a few things, first they’ll query for the new requests available, next they’ll need to query the fees associated with these requests, and finally query the cost of executing these requests by simulating them individually as a transaction on the full node for it’s destination chain. + +If the relayer is able to query high-performance nodes and has a very fast internet connection, or even better is colocated the nodes in question. You can already see how this provides an edge in being the first to deliver the requests. + +3. MEV + +An unfortunate development in blockchain protocols are validators who auction their blockspace. They do so in order to earn even more money than the underlying protocols already pay them. It’s not impossible that relayers may integrate with validators who auction their blockspace using proposer-builder networks in order to have their bundles always be first in the block. Of-course these relayers would have to pay high priority fees for such shenanigans. But we fully expect relayer competition to eventually reach these levels. +
+ +Once a relayer successfully delivers a batch of requests, they can immediately start claiming the associated fees for these requests. They’ll do so by submitting state proofs of the messages delivered on the destination chain to hyperbridge. Once hyperbridge verifies these proofs, it will make the fees available to the relayer by issuing a request to it’s contracts on the source chain. The relayer will be responsible for delivering this request as it will have no fee attached and will hence be ignored by other relayers. ## Installation @@ -13,20 +44,186 @@ The tesseract relayer is available through the following methods ### Prebuilt binaries -Unavailable at this time +Unavailable at this time. ### Docker Tesseract is available at the official docker repository [`polytopelabs/tesseract`](https://hub.docker.com/r/polytopelabs/tesseract) ```bash -docker run polytopelabs/tesseract:latest --config=/path/to/config +docker run polytopelabs/tesseract:latest --config=/path/to/config --db=/path/to/database ``` ### Building from source? -Unfortunately, tesseract is closed-souce for now. +Unfortunately, tesseract is closed-souce for now. Tesseract source-code will be available on Hyperbridge mainnet launch. + + +## System Requirements + +At the minimum, the hyperbridge relayer should be run on a machine with at least 4GB of RAM and a quad-core cpu. This relayer should also have at least a 100Mb/s connection if it is to query nodes over the internet. + ## Running the relayer -### Config +The tesseract relayer command line interface expects two arguments, which are the paths to it's configuration file and database file. Because it resides in a docker container, you will need to [map the directory](https://docs.docker.com/storage/bind-mounts/#start-a-container-with-a-bind-mount) where you've stored the configuration files on your host into the docker conatiner. Tesseract will write it's database to that directory once it's initialized. + + +```bash +docker run -v /dir/on/host:/home/root polytopelabs/tesseract:latest --config=/home/root/config.toml --db=/home/root/dev.db + +``` + +### Configuration + +The configuration file is a toml file that at the moment, expects the following configuration options: + + +```toml +# Hyperbridge config, required +[hyperbridge] +# Hyperbridge chain spec, either one of Dev, Gargantua or Messier +chain = "Dev" +# Hyperbidge node ws rpc endpoint. +rpc_ws = "ws://127.0.0.1:9944" # example endpoint + +[ethereum] +# configuration type +type = "ethereum_sepolia" +# State machine identifier +state_machine = { Ethereum = "ExecutionLayer" } +# http(s) rpc url for sepolia +rpc_url = "" +# consensus state identifier for sepolia on hyperbridge +consensus_state_id = "ETH0" +# etherscan api key for querying Ethereum token price +etherscan_api_key = "" +# Contract address of the HandlerV1 contract +handler = "" +# Contract address of the IsmpHost contract +ismp_host = "" +# hex-encoded private key for the relayer +signer = "" + +[arbitrum] +# configuration type +type = "arbitrum" +# State machine identifier +state_machine = { Ethereum = "Arbitrum" } +# http(s) rpc url for arbitrum +rpc_url = "" +# consensus state identifier for arbitrum on hyperbridge, L2s use ethereum as their consensus oracle +consensus_state_id = "ETH0" +# etherscan api key for querying Ethereum token price +etherscan_api_key = "" +# Contract address of the HandlerV1 contract +handler = "" +# Contract address of the IsmpHost contract +ismp_host = "" +# hex-encoded private key for the relayer +signer = "" + +[optimism] +# configuration type +type = "optimism" +# State machine identifier +state_machine = { Ethereum = "Optimism" } +# http(s) rpc url for optimism +rpc_url = "" +# consensus state identifier for optimism on hyperbridge, L2s use ethereum as their consensus oracle +consensus_state_id = "ETH0" +# etherscan api key for querying Ethereum token price +etherscan_api_key = "" +# Contract address of the HandlerV1 contract +handler = "" +# Contract address of the IsmpHost contract +ismp_host = "" +# hex-encoded private key for the relayer +signer = "" + +[base] +# configuration type +type = "base" +# State machine identifier +state_machine = { Ethereum = "Base" } +# http(s) rpc url for base +rpc_url = "" +# consensus state identifier for base on hyperbridge, L2s use ethereum as their consensus oracle +consensus_state_id = "ETH0" +# etherscan api key for querying Ethereum token price +etherscan_api_key = "" +# Contract address of the HandlerV1 contract +handler = "" +# Contract address of the IsmpHost contract +ismp_host = "" +# hex-encoded private key for the relayer +signer = "" + +[bsc] +# configuration type +type = "bsc" +# State machine identifier +state_machine = "Bsc" +# http(s) rpc url for binance smart chain +rpc_url = "" +# consensus state identifier for binance smart chain on hyperbridge +consensus_state_id = "BSC0" +# etherscan api key for querying BNB token price +etherscan_api_key = "" +# Contract address of the HandlerV1 contract +handler = "" +# Contract address of the IsmpHost contract +ismp_host = "" +# hex-encoded private key for the relayer +signer = "" + +# Relayer config, required +[relayer] +# Hyperbridge chain spec, either one of Dev, Gargantua or Messier +chain = "Dev" +# Define your profitability configuration. 0 -> 0% i.e relay all requests, even unprofitable ones. 1 -> 1%. ie fees provided for requests must be profitable by at least 1%. etc. +minimum_profit_percentage = 0 +# (Optional) If not empty, will filter requests to be delivered by originating module identifier (eg contract address) +module_filter = [] +# (Optional) If not empty, only deliver to the specied state-machines +delivery_endpoints = [ + { Ethereum = "ExecutionLayer" }, + { Ethereum = "Arbitrum" }, + { Ethereum = "Optimism" }, + { Ethereum = "Base" }, + "Bsc" +] +``` + +It is optional to provide the configuration option for any of the connected chains, The only consequence is your relayer will not deliver requests from the ommitted chain as it has no way of querying the associated fees for requests originating from this chain. + +You can find the up-to-date contract addresses for the `Handler` & `IsmpHost` contracts [here](/evm/integration#gargantua-v2) + +### Withdrawing Fees + +Tesseract maintains a local sqlite database where it keeps track of successfully delivered messages. The withdrawal process happens in two phases, the first phase is the fee accumulation on hyperbridge, then withdrawal on any of the connected chains. +
+In the fee accumulation phase, tesseract submits state proofs of messages all delivered to hyperbridge using the `accumulate_fees` extrinsic on the `RelayerFees` pallet. If the proof verification is successful, the total amount of unclaimed fees for the relayer address will be recorded. +
+The relayer can submit a withdrawal request from hyperbridge to any of the chains where it has unclaimed fees, an ISMP Post request with instructions to credit the relayer on the destination chain is dispatched, the request has a timeout of zero allowing it to be submitted to the destination at any time in the future without any risk of timing out. + +#### Accumulating fees on Hyperbridge +Stop any running relayer instances, run the following command in the terminal and wait for it to complete. The command will submit proofs for messages delivered to all chains present in the config file. + +```bash + docker run -v /dir/on/host:/home/root polytopelabs/tesseract:latest --config=/home/root/config.toml --db=/home/root/dev.db accumulate-fees +``` + +#### Initiating withdrawal from hyperbridge +To initiate a withdrawal from hyperbridge, a relayer needs to submit a `withdraw_fees` extrinsic from the `RelayerFees` pallet on hyperbridge, The transaction takes a `WithdrawalInputData`, this value contains, the amount to be withdrawn, the destination chain and a signature that proves ownership of the account that will be debited. +
+It is possible to use the relayer software to accumulate fees and initiate the withdrawal process with one command, for this to work, the relayer account must have sufficient funds to pay the transaction delivery fees on the withdrawal destination chains. +
+To use this feature run the following command: + +```bash + docker run -v /dir/on/host:/home/root polytopelabs/tesseract:latest --config=/home/root/config.toml --db=/home/root/dev.db accumulate-fees --withdraw +``` + +You can find the code that implements fee accumulation and withdrawals [here](https://github.com/polytope-labs/hyperbridge/blob/c3e940c60b718eaf5ac02a96c4801814a555dcf7/modules/relayer-fees/src/lib.rs#L120) + diff --git a/docs/public/relayer.webp b/docs/public/relayer.webp new file mode 100644 index 000000000..b77c68f1b Binary files /dev/null and b/docs/public/relayer.webp differ diff --git a/modules/ismp/clients/bsc-pos/src/lib.rs b/modules/ismp/clients/bsc-pos/src/lib.rs index f6d37fdd4..009dd512f 100644 --- a/modules/ismp/clients/bsc-pos/src/lib.rs +++ b/modules/ismp/clients/bsc-pos/src/lib.rs @@ -21,7 +21,7 @@ use ismp::{ messaging::{Proof, StateCommitmentHeight}, router::RequestResponse, }; -use ismp_sync_committee::{utils::req_res_to_key, verify_membership, verify_state_proof}; +use ismp_sync_committee::{utils::req_res_receipt_keys, verify_membership, verify_state_proof}; use sp_core::{H160, H256}; use sync_committee_primitives::constants::BlsPublicKey; @@ -192,7 +192,7 @@ impl StateMachineClient for EvmStateMachine { } fn state_trie_key(&self, items: RequestResponse) -> Vec> { - req_res_to_key::(items) + req_res_receipt_keys::(items) } fn verify_state_proof( diff --git a/modules/ismp/clients/polygon-pos/src/lib.rs b/modules/ismp/clients/polygon-pos/src/lib.rs index 5fbc8ca55..44f6c9571 100644 --- a/modules/ismp/clients/polygon-pos/src/lib.rs +++ b/modules/ismp/clients/polygon-pos/src/lib.rs @@ -21,7 +21,7 @@ use ismp::{ messaging::{Proof, StateCommitmentHeight}, router::RequestResponse, }; -use ismp_sync_committee::{utils::req_res_to_key, verify_membership, verify_state_proof}; +use ismp_sync_committee::{utils::req_res_receipt_keys, verify_membership, verify_state_proof}; use pallet::{Config, Headers}; use polygon_pos_verifier::{ primitives::{SPAN_LENGTH, SPRINT_LENGTH}, @@ -354,7 +354,7 @@ impl StateMachineClient for EvmStateMachine { } fn state_trie_key(&self, items: RequestResponse) -> Vec> { - req_res_to_key::(items) + req_res_receipt_keys::(items) } fn verify_state_proof( diff --git a/parachain/chainspec/gargantua.json b/parachain/chainspec/gargantua.json index 0a5424b15..ef726b338 100644 --- a/parachain/chainspec/gargantua.json +++ b/parachain/chainspec/gargantua.json @@ -3,7 +3,6 @@ "id": "gargantua", "chainType": "Live", "bootNodes": [ - "/ip4/34.78.130.110/tcp/30333/p2p/12D3KooWMRRsnAgJ1hjxCj3uJXPkauHqhP2BbbP4M5XF8xVJpeLX", "/ip4/34.22.173.252/tcp/30333/p2p/12D3KooWGuMWMXSj7GUGMRdJAceRHoSuSkWW53b6nebzybUEoauB" ], "telemetryEndpoints": [ @@ -20,7 +19,7 @@ "properties": { "ss58Format": 42, "tokenDecimals": 12, - "tokenSymbol": "XOR" + "tokenSymbol": "tNAND" }, "relay_chain": "rococo", "para_id": 4374, diff --git a/parachain/chainspec/messier.json b/parachain/chainspec/messier.json index 44a613fac..900d3dc02 100644 --- a/parachain/chainspec/messier.json +++ b/parachain/chainspec/messier.json @@ -10,7 +10,7 @@ "properties": { "ss58Format": 42, "tokenDecimals": 12, - "tokenSymbol": "CORE" + "tokenSymbol": "NAND" }, "relay_chain": "kusama", "para_id": 3340, diff --git a/parachain/node/Cargo.toml b/parachain/node/Cargo.toml index 7a0052906..b950c801b 100644 --- a/parachain/node/Cargo.toml +++ b/parachain/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hyperbridge" -version = "0.3.2" +version = "0.3.3" authors = ["Polytope Labs "] description = "The Hyperbridge coprocessor node" repository = "https://github.com/polytope-labs/hyperbridge" diff --git a/parachain/node/src/cli.rs b/parachain/node/src/cli.rs index 0bf4651fc..238616ca0 100644 --- a/parachain/node/src/cli.rs +++ b/parachain/node/src/cli.rs @@ -83,6 +83,8 @@ pub struct Cli { pub no_hardware_benchmarks: bool, /// Should we enable async-backing? + /// + /// NOTE: DEPRECATED, async-backing is enabled by default. #[arg(long)] pub async_backing: bool, diff --git a/parachain/node/src/command.rs b/parachain/node/src/command.rs index 2c96eb90d..e0b43f571 100644 --- a/parachain/node/src/command.rs +++ b/parachain/node/src/command.rs @@ -371,7 +371,6 @@ pub fn run() -> Result<()> { collator_options, id, hwbench, - cli, ) .await .map_err(Into::into) diff --git a/parachain/node/src/service.rs b/parachain/node/src/service.rs index f6136c930..976d571d4 100644 --- a/parachain/node/src/service.rs +++ b/parachain/node/src/service.rs @@ -24,6 +24,7 @@ use crate::runtime_api::{opaque, BaseHostRuntimeApis}; // Cumulus Imports use cumulus_client_collator::service::CollatorService; +use cumulus_client_consensus_aura::collators::lookahead; use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport; use cumulus_client_consensus_proposer::Proposer; use cumulus_client_service::{ @@ -34,7 +35,6 @@ use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId}; use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface}; use polkadot_primitives::ValidationCode; // Substrate Imports -use crate::cli::Cli; use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; use sc_client_api::Backend; use sc_consensus::ImportQueue; @@ -194,7 +194,6 @@ async fn start_node_impl( collator_options: CollatorOptions, para_id: ParaId, hwbench: Option, - cli: Cli, ) -> sc_service::error::Result where Runtime: @@ -380,7 +379,6 @@ where collator_key.expect("Command line arguments do not allow this. qed"), overseer_handle, announce_block, - cli, )?; } @@ -445,7 +443,6 @@ fn start_consensus( collator_key: CollatorPair, overseer_handle: OverseerHandle, announce_block: Arc>) + Send + Sync>, - cli: Cli, ) -> Result<(), sc_service::Error> where Runtime: @@ -477,80 +474,42 @@ where client.clone(), ); - if cli.async_backing { - use cumulus_client_consensus_aura::collators::lookahead; + let params = lookahead::Params { + create_inherent_data_providers: move |_, ()| async move { Ok(()) }, + block_import, + para_client: client.clone(), + para_backend: backend, + relay_client: relay_chain_interface, + code_hash_provider: move |hash| { + client.code_at(hash).ok().map(ValidationCode).map(|c| c.hash()) + }, + sync_oracle, + keystore, + collator_key, + para_id, + overseer_handle, + slot_duration, + relay_chain_slot_duration, + proposer, + collator_service, + // Async backing time + authoring_duration: Duration::from_millis(1500), + }; - let params = lookahead::Params { - create_inherent_data_providers: move |_, ()| async move { Ok(()) }, - block_import, - para_client: client.clone(), - para_backend: backend, - relay_client: relay_chain_interface, - code_hash_provider: move |hash| { - client.code_at(hash).ok().map(ValidationCode).map(|c| c.hash()) - }, - sync_oracle, - keystore, - collator_key, - para_id, - overseer_handle, - slot_duration, - relay_chain_slot_duration, - proposer, - collator_service, - // Async backing time - authoring_duration: Duration::from_millis(1500), - }; - - let fut = lookahead::run::< - opaque::Block, - sp_consensus_aura::sr25519::AuthorityPair, - _, - _, - _, - _, - _, - _, - _, - _, - _, - >(params); - task_manager.spawn_essential_handle().spawn("aura", None, fut); - } else { - use cumulus_client_consensus_aura::collators::basic; - - let params = basic::Params { - create_inherent_data_providers: move |_, ()| async move { Ok(()) }, - block_import, - para_client: client.clone(), - relay_client: relay_chain_interface, - sync_oracle, - keystore, - collator_key, - para_id, - overseer_handle, - slot_duration, - relay_chain_slot_duration, - proposer, - collator_service, - // Very limited proposal time. - authoring_duration: Duration::from_millis(500), - collation_request_receiver: None, - }; - - let fut = basic::run::< - opaque::Block, - sp_consensus_aura::sr25519::AuthorityPair, - _, - _, - _, - _, - _, - _, - _, - >(params); - task_manager.spawn_essential_handle().spawn("aura", None, fut); - } + let fut = lookahead::run::< + opaque::Block, + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + _, + _, + _, + _, + _, + >(params); + task_manager.spawn_essential_handle().spawn("aura", None, fut); Ok(()) } @@ -562,7 +521,6 @@ pub async fn start_parachain_node( collator_options: CollatorOptions, para_id: ParaId, hwbench: Option, - cli: Cli, ) -> sc_service::error::Result { match parachain_config.chain_spec.id() { chain if chain.contains("gargantua") => @@ -572,7 +530,6 @@ pub async fn start_parachain_node( collator_options, para_id, hwbench, - cli, ) .await, chain if chain.contains("messier") => @@ -582,7 +539,6 @@ pub async fn start_parachain_node( collator_options, para_id, hwbench, - cli, ) .await, chain => panic!("Unknown chain with id: {}", chain), diff --git a/scripts/zombienet/local-testnet.toml b/scripts/zombienet/local-testnet.toml index 0363bebbf..93301185a 100644 --- a/scripts/zombienet/local-testnet.toml +++ b/scripts/zombienet/local-testnet.toml @@ -6,8 +6,8 @@ chain = "rococo-local" [[relaychain.nodes]] name = "alice" validator = true -rpc_port = 9932 -ws_port = 9944 +rpc_port = 9912 +ws_port = 9922 args = [ "--enable-offchain-indexing=true", "--pruning=archive", ] @@ -15,22 +15,22 @@ args = [ [[relaychain.nodes]] name = "bob" validator = true -rpc_port = 9933 -ws_port = 9945 +rpc_port = 9913 +ws_port = 9923 args = [] [[relaychain.nodes]] name = "charlie" validator = true -rpc_port = 9934 -ws_port = 9946 +rpc_port = 9914 +ws_port = 9924 args = [] [[relaychain.nodes]] name = "dave" validator = true -rpc_port = 9935 -ws_port = 9947 +rpc_port = 9915 +ws_port = 9925 args = [] [[parachains]] @@ -42,9 +42,9 @@ cumulus_based = true [[parachains.collators]] name = "alice" validator = true -rpc_port = 9955 -ws_port = 9988 -port = 30337 +rpc_port = 8955 +ws_port = 9990 +port = 40337 command = "./target/release/hyperbridge" args = [ "--async-backing -lbasic-authorship=trace,pallet-ismp=trace", "--enable-offchain-indexing=true", "--pruning=archive"