From 875e634a6361ea9d199c73de6a509d5e91c6034b Mon Sep 17 00:00:00 2001 From: Seun Lanlege Date: Mon, 13 Nov 2023 16:10:47 +0300 Subject: [PATCH] bump hyper::{bridge, client} versions --- Cargo.lock | 4 +-- client/Cargo.toml | 2 +- evm/foundry.toml | 2 +- evm/script/DeployGateway.s.sol | 46 +++++++++++++++++--------------- evm/script/DeployIsmp.s.sol | 11 ++------ evm/script/deploy.sh | 4 +-- evm/src/modules/TokenGateway.sol | 6 +++-- evm/test/CrossChainMessenger.sol | 9 +++---- parachain/node/Cargo.toml | 2 +- 9 files changed, 40 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6aece9bc..d75b42062 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4998,7 +4998,7 @@ dependencies = [ [[package]] name = "hyperbridge" -version = "0.1.8" +version = "0.1.9" dependencies = [ "clap", "cumulus-client-cli", @@ -5123,7 +5123,7 @@ dependencies = [ [[package]] name = "hyperclient" -version = "0.1.8" +version = "0.1.9" dependencies = [ "anyhow", "clap", diff --git a/client/Cargo.toml b/client/Cargo.toml index 38fbf8b05..abcb747f0 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hyperclient" -version = "0.1.8" +version = "0.1.9" edition = "2021" description = "A simple CLI application for sending cross-chain requests through Hyperbridge" repository = "https://github.com/polytope-labs/hyperbridge" diff --git a/evm/foundry.toml b/evm/foundry.toml index 50f8975d9..dce65a284 100644 --- a/evm/foundry.toml +++ b/evm/foundry.toml @@ -13,4 +13,4 @@ base-sepolia = "${BASE_SEPOLIA_RPC_URL}" sepolia = { key = "${SEPOLIA_ETHERSCAN_API_KEY}", chain = 11155111, url = " https://api-sepolia.etherscan.io/api" } optimism-sepolia = { key = "${OPTIMISM_ETHERSCAN_API_KEY}", chain = 11155420, url = "https://api-sepolia-optimism.etherscan.io/api" } arbitrum-sepolia = { key = "${ARBITRUM_ETHERSCAN_API_KEY}", chain = 421614, url = "https://api-sepolia.arbiscan.io/api" } -base-sepolia = { key = "${BASE_ETHERSCAN_API_KEY}", chain = 84532, url = "https://api-sepolia.basescan.org/api" } +base-sepolia = { key = "${ARBITRUM_ETHERSCAN_API_KEY}", chain = 84532, url = "https://base-sepolia.blockscout.com/api?", verifier = "blockscout" } diff --git a/evm/script/DeployGateway.s.sol b/evm/script/DeployGateway.s.sol index 5b483e7fd..b2ba0212d 100644 --- a/evm/script/DeployGateway.s.sol +++ b/evm/script/DeployGateway.s.sol @@ -10,13 +10,12 @@ import "../test/PingModule.sol"; import "../test/CrossChainMessenger.sol"; contract DeployScript is Script { - bytes32 public salt = keccak256(bytes("gargantua-v0.0.5")); + bytes32 public salt = keccak256(bytes("gargantua-v0.0.7")); address public SEPOLIA_HOST = 0x5b5F63C8f3985CaFE1CE53E6374f42AB60dE5a6B; address public ARB_SEPOLIA_HOST = 0x43E136611Cf74E165116a47e6F9C58AFCc80Ec54; address public OP_SEPOLIA_HOST = 0x0124f458900FCd101c4CE31A9772fD2c5e6d65BF; - address public BASE_SEPOLIA_HOST = - 0x87825f839d95c6021c0e821917F93aDB299eD6F8; + address public BASE_SEPOLIA_HOST = 0x87825f839d95c6021c0e821917F93aDB299eD6F8; bytes32 public constant MINTER_ROLE = keccak256("MINTER ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER ROLE"); @@ -24,26 +23,29 @@ contract DeployScript is Script { function run() external { address admin = vm.envAddress("ADMIN"); bytes32 privateKey = vm.envBytes32("PRIVATE_KEY"); + string memory host = vm.envString("HOST"); - vm.createSelectFork("sepolia"); - vm.startBroadcast(uint256(privateKey)); - deployMessenger(SEPOLIA_HOST, admin); - vm.stopBroadcast(); - - vm.createSelectFork("arbitrum-sepolia"); - vm.startBroadcast(uint256(privateKey)); - deployMessenger(ARB_SEPOLIA_HOST, admin); - vm.stopBroadcast(); - - vm.createSelectFork("optimism-sepolia"); - vm.startBroadcast(uint256(privateKey)); - deployMessenger(OP_SEPOLIA_HOST, admin); - vm.stopBroadcast(); - - vm.createSelectFork("base-sepolia"); - vm.startBroadcast(uint256(privateKey)); - deployMessenger(BASE_SEPOLIA_HOST, admin); - vm.stopBroadcast(); + if (Strings.equal(host, "sepolia") || Strings.equal(host, "ethereum")) { + vm.createSelectFork("sepolia"); + vm.startBroadcast(uint256(privateKey)); + deployGateway(SEPOLIA_HOST, admin); + vm.stopBroadcast(); + } else if (Strings.equal(host, "arbitrum-sepolia")) { + vm.createSelectFork("arbitrum-sepolia"); + vm.startBroadcast(uint256(privateKey)); + deployGateway(ARB_SEPOLIA_HOST, admin); + vm.stopBroadcast(); + } else if (Strings.equal(host, "optimism-sepolia")) { + vm.createSelectFork("optimism-sepolia"); + vm.startBroadcast(uint256(privateKey)); + deployGateway(OP_SEPOLIA_HOST, admin); + vm.stopBroadcast(); + } else if (Strings.equal(host, "base-sepolia")) { + vm.createSelectFork("base-sepolia"); + vm.startBroadcast(uint256(privateKey)); + deployGateway(BASE_SEPOLIA_HOST, admin); + vm.stopBroadcast(); + } } function deployMessenger(address host, address admin) public { diff --git a/evm/script/DeployIsmp.s.sol b/evm/script/DeployIsmp.s.sol index 1eab9540a..790e01ef6 100644 --- a/evm/script/DeployIsmp.s.sol +++ b/evm/script/DeployIsmp.s.sol @@ -30,11 +30,7 @@ contract DeployScript is Script { // handler HandlerV1 handler = new HandlerV1{salt: salt}(); // cross-chain governor - GovernorParams memory gParams = GovernorParams({ - admin: admin, - host: address(0), - paraId: paraId - }); + GovernorParams memory gParams = GovernorParams({admin: admin, host: address(0), paraId: paraId}); CrossChainGovernor governor = new CrossChainGovernor{salt: salt}( gParams ); @@ -61,10 +57,7 @@ contract DeployScript is Script { vm.stopBroadcast(); } - function initHost( - string memory host, - HostParams memory params - ) public returns (address) { + function initHost(string memory host, HostParams memory params) public returns (address) { if (Strings.equal(host, "sepolia") || Strings.equal(host, "ethereum")) { EthereumHost host = new EthereumHost{salt: salt}(params); return address(host); diff --git a/evm/script/deploy.sh b/evm/script/deploy.sh index 9332a5fd8..24e4ded88 100755 --- a/evm/script/deploy.sh +++ b/evm/script/deploy.sh @@ -9,7 +9,7 @@ else # load prod .env source .env.prod # deploy - HOST=$1 forge script script/DeployIsmp.s.sol:DeployScript --rpc-url "$1" --broadcast -vvvv --sender="$ADMIN" + HOST=$1 forge script "script/Deploy$2.s.sol:DeployScript" --rpc-url "$1" --broadcast -vvvv --sender="$ADMIN" # verify - HOST=$1 forge script script/DeployIsmp.s.sol:DeployScript --rpc-url "$1" --resume --verify -vvvv --sender="$ADMIN" + HOST=$1 forge script "script/Deploy$2.s.sol:DeployScript" --rpc-url "$1" --resume --verify -vvvv --sender="$ADMIN" fi diff --git a/evm/src/modules/TokenGateway.sol b/evm/src/modules/TokenGateway.sol index 511e56bfd..a5a48df00 100644 --- a/evm/src/modules/TokenGateway.sol +++ b/evm/src/modules/TokenGateway.sol @@ -67,7 +67,8 @@ contract TokenGateway is IIsmpModule { } function onAccept(PostRequest memory request) public onlyIsmpHost { - (address _from, address to, uint256 amount, address tokenContract) = abi.decode(request.body, (address, address, uint256, address)); + (address _from, address to, uint256 amount, address tokenContract) = + abi.decode(request.body, (address, address, uint256, address)); IERC6160Ext20(tokenContract).mint(to, amount, ""); @@ -75,7 +76,8 @@ contract TokenGateway is IIsmpModule { } function onPostTimeout(PostRequest memory request) public onlyIsmpHost { - (address from, address _to, uint256 amount, address tokenContract) = abi.decode(request.body, (address, address, uint256, address)); + (address from, address _to, uint256 amount, address tokenContract) = + abi.decode(request.body, (address, address, uint256, address)); IERC6160Ext20(tokenContract).mint(from, amount, ""); } diff --git a/evm/test/CrossChainMessenger.sol b/evm/test/CrossChainMessenger.sol index bf17357ce..a47e4c25c 100644 --- a/evm/test/CrossChainMessenger.sol +++ b/evm/test/CrossChainMessenger.sol @@ -14,6 +14,7 @@ struct CrossChainMessage { contract CrossChainMessenger is IIsmpModule { event PostReceived(uint256 nonce, bytes source, string message); + error NotAuthorized(); // restricts call to `IIsmpHost` @@ -66,15 +67,11 @@ contract CrossChainMessenger is IIsmpModule { revert("No timeouts for now"); } - function onPostResponse( - PostResponse memory response - ) public view onlyIsmpHost { + function onPostResponse(PostResponse memory response) public view onlyIsmpHost { revert("CrossChainMessenger doesn't emit responses"); } - function onGetResponse( - GetResponse memory response - ) public view onlyIsmpHost { + function onGetResponse(GetResponse memory response) public view onlyIsmpHost { revert("CrossChainMessenger doesn't emit Get Requests"); } diff --git a/parachain/node/Cargo.toml b/parachain/node/Cargo.toml index 217f1d412..eae09272c 100644 --- a/parachain/node/Cargo.toml +++ b/parachain/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hyperbridge" -version = "0.1.8" +version = "0.1.9" authors = ["Polytope Labs "] description = "The hyperbridge coprocessor node" edition = "2021"