From c3e940c60b718eaf5ac02a96c4801814a555dcf7 Mon Sep 17 00:00:00 2001 From: Web3 Philosopher Date: Mon, 26 Feb 2024 11:39:35 +0100 Subject: [PATCH] use debian bookworm-slim (#100) --- Cargo.lock | 3 +- evm/abi/src/generated/host_manager.rs | 82 ++++++++++++++++++- evm/integration-tests/Cargo.toml | 1 + .../src/tests/host_manager.rs | 27 +++--- .../consensus/grandpa/Cargo.toml | 4 +- .../consensus/grandpa/primitives/Cargo.toml | 0 .../grandpa/primitives/src/justification.rs | 0 .../consensus/grandpa/primitives/src/lib.rs | 0 .../consensus/grandpa/prover/Cargo.toml | 0 .../consensus/grandpa/prover/src/lib.rs | 0 .../consensus/grandpa/src/consensus.rs | 0 .../consensus/grandpa/src/lib.rs | 0 .../consensus/grandpa/src/messages.rs | 0 .../consensus/grandpa/verifier/Cargo.toml | 0 .../consensus/grandpa/verifier/src/lib.rs | 0 .../consensus/grandpa/verifier/src/tests.rs | 0 parachain/node/Cargo.toml | 2 +- scripts/docker/Dockerfile | 7 -- scripts/docker/slim.Dockerfile | 2 +- 19 files changed, 99 insertions(+), 29 deletions(-) rename {parachain/modules => modules}/consensus/grandpa/Cargo.toml (92%) rename {parachain/modules => modules}/consensus/grandpa/primitives/Cargo.toml (100%) rename {parachain/modules => modules}/consensus/grandpa/primitives/src/justification.rs (100%) rename {parachain/modules => modules}/consensus/grandpa/primitives/src/lib.rs (100%) rename {parachain/modules => modules}/consensus/grandpa/prover/Cargo.toml (100%) rename {parachain/modules => modules}/consensus/grandpa/prover/src/lib.rs (100%) rename {parachain/modules => modules}/consensus/grandpa/src/consensus.rs (100%) rename {parachain/modules => modules}/consensus/grandpa/src/lib.rs (100%) rename {parachain/modules => modules}/consensus/grandpa/src/messages.rs (100%) rename {parachain/modules => modules}/consensus/grandpa/verifier/Cargo.toml (100%) rename {parachain/modules => modules}/consensus/grandpa/verifier/src/lib.rs (100%) rename {parachain/modules => modules}/consensus/grandpa/verifier/src/tests.rs (100%) delete mode 100644 scripts/docker/Dockerfile diff --git a/Cargo.lock b/Cargo.lock index 15aa03e15..a7572a122 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5305,7 +5305,7 @@ dependencies = [ [[package]] name = "hyperbridge" -version = "0.3.1" +version = "0.3.2" dependencies = [ "clap", "cumulus-client-cli", @@ -5806,6 +5806,7 @@ dependencies = [ "mmr-utils", "once_cell", "pallet-ismp", + "pallet-relayer-fees", "parity-scale-codec", "primitive-types", "rs_merkle", diff --git a/evm/abi/src/generated/host_manager.rs b/evm/abi/src/generated/host_manager.rs index d596288be..c6f7f9186 100644 --- a/evm/abi/src/generated/host_manager.rs +++ b/evm/abi/src/generated/host_manager.rs @@ -16,7 +16,7 @@ pub mod host_manager { ::ethers::core::abi::ethabi::Contract { constructor: ::core::option::Option::Some(::ethers::core::abi::ethabi::Constructor { inputs: ::std::vec![::ethers::core::abi::ethabi::Param { - name: ::std::borrow::ToOwned::to_owned("params"), + name: ::std::borrow::ToOwned::to_owned("managerParams"), kind: ::ethers::core::abi::ethabi::ParamType::Tuple(::std::vec![ ::ethers::core::abi::ethabi::ParamType::Address, ::ethers::core::abi::ethabi::ParamType::Address, @@ -206,6 +206,26 @@ pub mod host_manager { state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, },], ), + ( + ::std::borrow::ToOwned::to_owned("params"), + ::std::vec![::ethers::core::abi::ethabi::Function { + name: ::std::borrow::ToOwned::to_owned("params"), + inputs: ::std::vec![], + outputs: ::std::vec![::ethers::core::abi::ethabi::Param { + name: ::std::string::String::new(), + kind: ::ethers::core::abi::ethabi::ParamType::Tuple(::std::vec![ + ::ethers::core::abi::ethabi::ParamType::Address, + ::ethers::core::abi::ethabi::ParamType::Address, + ::ethers::core::abi::ethabi::ParamType::Uint(256usize), + ],), + internal_type: ::core::option::Option::Some( + ::std::borrow::ToOwned::to_owned("struct HostManagerParams"), + ), + },], + constant: ::core::option::Option::None, + state_mutability: ::ethers::core::abi::ethabi::StateMutability::View, + },], + ), ( ::std::borrow::ToOwned::to_owned("setIsmpHost"), ::std::vec![::ethers::core::abi::ethabi::Function { @@ -317,6 +337,12 @@ pub mod host_manager { .method_hash([18, 178, 82, 79], (p0,)) .expect("method not found (this should never happen)") } + ///Calls the contract's `params` (0xcff0ab96) function + pub fn params(&self) -> ::ethers::contract::builders::ContractCall { + self.0 + .method_hash([207, 240, 171, 150], ()) + .expect("method not found (this should never happen)") + } ///Calls the contract's `setIsmpHost` (0x0e8324a2) function pub fn set_ismp_host( &self, @@ -441,6 +467,20 @@ pub mod host_manager { abi = "onPostResponseTimeout(((bytes,bytes,uint64,bytes,bytes,uint64,bytes,uint64),bytes,uint64,uint64))" )] pub struct OnPostResponseTimeoutCall(pub PostResponse); + ///Container type for all input parameters for the `params` function with signature `params()` + /// and selector `0xcff0ab96` + #[derive( + Clone, + ::ethers::contract::EthCall, + ::ethers::contract::EthDisplay, + Default, + Debug, + PartialEq, + Eq, + Hash, + )] + #[ethcall(name = "params", abi = "params()")] + pub struct ParamsCall; ///Container type for all input parameters for the `setIsmpHost` function with signature /// `setIsmpHost(address)` and selector `0x0e8324a2` #[derive( @@ -466,6 +506,7 @@ pub mod host_manager { OnPostRequestTimeout(OnPostRequestTimeoutCall), OnPostResponse(OnPostResponseCall), OnPostResponseTimeout(OnPostResponseTimeoutCall), + Params(ParamsCall), SetIsmpHost(SetIsmpHostCall), } impl ::ethers::core::abi::AbiDecode for HostManagerCalls { @@ -499,6 +540,9 @@ pub mod host_manager { { return Ok(Self::OnPostResponseTimeout(decoded)); } + if let Ok(decoded) = ::decode(data) { + return Ok(Self::Params(decoded)); + } if let Ok(decoded) = ::decode(data) { return Ok(Self::SetIsmpHost(decoded)); } @@ -516,6 +560,7 @@ pub mod host_manager { Self::OnPostResponse(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::OnPostResponseTimeout(element) => ::ethers::core::abi::AbiEncode::encode(element), + Self::Params(element) => ::ethers::core::abi::AbiEncode::encode(element), Self::SetIsmpHost(element) => ::ethers::core::abi::AbiEncode::encode(element), } } @@ -529,6 +574,7 @@ pub mod host_manager { Self::OnPostRequestTimeout(element) => ::core::fmt::Display::fmt(element, f), Self::OnPostResponse(element) => ::core::fmt::Display::fmt(element, f), Self::OnPostResponseTimeout(element) => ::core::fmt::Display::fmt(element, f), + Self::Params(element) => ::core::fmt::Display::fmt(element, f), Self::SetIsmpHost(element) => ::core::fmt::Display::fmt(element, f), } } @@ -563,9 +609,43 @@ pub mod host_manager { Self::OnPostResponseTimeout(value) } } + impl ::core::convert::From for HostManagerCalls { + fn from(value: ParamsCall) -> Self { + Self::Params(value) + } + } impl ::core::convert::From for HostManagerCalls { fn from(value: SetIsmpHostCall) -> Self { Self::SetIsmpHost(value) } } + ///Container type for all return fields from the `params` function with signature `params()` + /// and selector `0xcff0ab96` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash, + )] + pub struct ParamsReturn(pub HostManagerParams); + ///`HostManagerParams(address,address,uint256)` + #[derive( + Clone, + ::ethers::contract::EthAbiType, + ::ethers::contract::EthAbiCodec, + Default, + Debug, + PartialEq, + Eq, + Hash, + )] + pub struct HostManagerParams { + pub admin: ::ethers::core::types::Address, + pub host: ::ethers::core::types::Address, + pub para_id: ::ethers::core::types::U256, + } } diff --git a/evm/integration-tests/Cargo.toml b/evm/integration-tests/Cargo.toml index c75a849e7..b1fb8a073 100644 --- a/evm/integration-tests/Cargo.toml +++ b/evm/integration-tests/Cargo.toml @@ -39,6 +39,7 @@ pallet-ismp = { path = "../../modules/ismp/pallet" } ismp-solidity-abi = { path = "../abi", features = ["build-abi"] } beefy-prover = { path = "../../modules/consensus/beefy/prover", default-features = false } beefy-verifier-primitives = { path = "../../modules/consensus/beefy/primitives" } +pallet-relayer-fees = { path = "../../modules/relayer-fees" } rs_merkle = { git = "https://github.com/polytope-labs/rs-merkle", branch = "seun/2d-merkle-proofs" } foundry-evm = { git = "https://github.com/polytope-labs/foundry", rev = "068ef4d82e8421f9f96fdc33b061dc4848b7019a" } diff --git a/evm/integration-tests/src/tests/host_manager.rs b/evm/integration-tests/src/tests/host_manager.rs index 6ef3658f6..a867b70c5 100644 --- a/evm/integration-tests/src/tests/host_manager.rs +++ b/evm/integration-tests/src/tests/host_manager.rs @@ -5,10 +5,8 @@ use ismp::{ host::{Ethereum, StateMachine}, router::Post, }; -use ismp_solidity_abi::{ - evm_host::{HostParams, WithdrawParams}, - shared_types::PostRequest, -}; +use ismp_solidity_abi::{evm_host::HostParams, shared_types::PostRequest}; +use pallet_relayer_fees::withdrawal::WithdrawalParams; use primitive_types::{H160, U256}; use std::{env, path::PathBuf}; @@ -18,12 +16,11 @@ async fn test_host_manager_withdraw() -> Result<(), anyhow::Error> { let mut runner = Runner::new(PathBuf::from(&base_dir)); let mut contract = runner.deploy("HostManagerTest").await; - let params = WithdrawParams { - beneficiary: H160::random(), + let params = WithdrawalParams { + beneficiary_address: H160::random().as_bytes().to_vec(), amount: U256::from(500_000_000_000_000_000_000u128), }; - let mut data = vec![0u8]; - data.extend_from_slice(params.encode().as_slice()); + let data = params.abi_encode(); // create post request object let post = Post { @@ -51,12 +48,11 @@ async fn test_host_manager_unauthorized_request() -> Result<(), anyhow::Error> { let mut runner = Runner::new(PathBuf::from(&base_dir)); let mut contract = runner.deploy("HostManagerTest").await; - let params = WithdrawParams { - beneficiary: H160::random(), + let params = WithdrawalParams { + beneficiary_address: H160::random().as_bytes().to_vec(), amount: U256::from(500_000_000_000_000_000_000u128), }; - let mut data = vec![0u8]; - data.extend_from_slice(params.encode().as_slice()); + let data = params.abi_encode(); // create post request object let post = Post { @@ -93,12 +89,11 @@ async fn test_host_manager_insufficient_balance() -> Result<(), anyhow::Error> { let mut runner = Runner::new(PathBuf::from(&base_dir)); let mut contract = runner.deploy("HostManagerTest").await; - let params = WithdrawParams { - beneficiary: H160::random(), + let params = WithdrawalParams { + beneficiary_address: H160::random().as_bytes().to_vec(), amount: U256::from(500_000_000_000_000_000_000u128), }; - let mut data = vec![0u8]; - data.extend_from_slice(params.encode().as_slice()); + let data = params.abi_encode(); // create post request object let post = Post { diff --git a/parachain/modules/consensus/grandpa/Cargo.toml b/modules/consensus/grandpa/Cargo.toml similarity index 92% rename from parachain/modules/consensus/grandpa/Cargo.toml rename to modules/consensus/grandpa/Cargo.toml index 8e7ddbb06..fb403241e 100644 --- a/parachain/modules/consensus/grandpa/Cargo.toml +++ b/modules/consensus/grandpa/Cargo.toml @@ -14,8 +14,8 @@ finality-grandpa = { version = "0.16.0", features = ["derive-codec"], default-fe # polytope labs ismp = { git = "https://github.com/polytope-labs/ismp-rs", branch = "main", default-features = false } -primitives = { package = "ismp-grandpa-primitives", path = "./primitives", default-features = false } -verifier = { package = "ismp-grandpa-verifier", path = "./verifier", default-features = false} +primitives = { package = "ismp-grandpa-primitives", path = "primitives", default-features = false } +verifier = { package = "ismp-grandpa-verifier", path = "verifier", default-features = false} pallet-ismp = { path = "../pallet-ismp", default-features = false } diff --git a/parachain/modules/consensus/grandpa/primitives/Cargo.toml b/modules/consensus/grandpa/primitives/Cargo.toml similarity index 100% rename from parachain/modules/consensus/grandpa/primitives/Cargo.toml rename to modules/consensus/grandpa/primitives/Cargo.toml diff --git a/parachain/modules/consensus/grandpa/primitives/src/justification.rs b/modules/consensus/grandpa/primitives/src/justification.rs similarity index 100% rename from parachain/modules/consensus/grandpa/primitives/src/justification.rs rename to modules/consensus/grandpa/primitives/src/justification.rs diff --git a/parachain/modules/consensus/grandpa/primitives/src/lib.rs b/modules/consensus/grandpa/primitives/src/lib.rs similarity index 100% rename from parachain/modules/consensus/grandpa/primitives/src/lib.rs rename to modules/consensus/grandpa/primitives/src/lib.rs diff --git a/parachain/modules/consensus/grandpa/prover/Cargo.toml b/modules/consensus/grandpa/prover/Cargo.toml similarity index 100% rename from parachain/modules/consensus/grandpa/prover/Cargo.toml rename to modules/consensus/grandpa/prover/Cargo.toml diff --git a/parachain/modules/consensus/grandpa/prover/src/lib.rs b/modules/consensus/grandpa/prover/src/lib.rs similarity index 100% rename from parachain/modules/consensus/grandpa/prover/src/lib.rs rename to modules/consensus/grandpa/prover/src/lib.rs diff --git a/parachain/modules/consensus/grandpa/src/consensus.rs b/modules/consensus/grandpa/src/consensus.rs similarity index 100% rename from parachain/modules/consensus/grandpa/src/consensus.rs rename to modules/consensus/grandpa/src/consensus.rs diff --git a/parachain/modules/consensus/grandpa/src/lib.rs b/modules/consensus/grandpa/src/lib.rs similarity index 100% rename from parachain/modules/consensus/grandpa/src/lib.rs rename to modules/consensus/grandpa/src/lib.rs diff --git a/parachain/modules/consensus/grandpa/src/messages.rs b/modules/consensus/grandpa/src/messages.rs similarity index 100% rename from parachain/modules/consensus/grandpa/src/messages.rs rename to modules/consensus/grandpa/src/messages.rs diff --git a/parachain/modules/consensus/grandpa/verifier/Cargo.toml b/modules/consensus/grandpa/verifier/Cargo.toml similarity index 100% rename from parachain/modules/consensus/grandpa/verifier/Cargo.toml rename to modules/consensus/grandpa/verifier/Cargo.toml diff --git a/parachain/modules/consensus/grandpa/verifier/src/lib.rs b/modules/consensus/grandpa/verifier/src/lib.rs similarity index 100% rename from parachain/modules/consensus/grandpa/verifier/src/lib.rs rename to modules/consensus/grandpa/verifier/src/lib.rs diff --git a/parachain/modules/consensus/grandpa/verifier/src/tests.rs b/modules/consensus/grandpa/verifier/src/tests.rs similarity index 100% rename from parachain/modules/consensus/grandpa/verifier/src/tests.rs rename to modules/consensus/grandpa/verifier/src/tests.rs diff --git a/parachain/node/Cargo.toml b/parachain/node/Cargo.toml index 7d16266f1..7a0052906 100644 --- a/parachain/node/Cargo.toml +++ b/parachain/node/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hyperbridge" -version = "0.3.1" +version = "0.3.2" authors = ["Polytope Labs "] description = "The Hyperbridge coprocessor node" repository = "https://github.com/polytope-labs/hyperbridge" diff --git a/scripts/docker/Dockerfile b/scripts/docker/Dockerfile deleted file mode 100644 index 34c4cdff0..000000000 --- a/scripts/docker/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM paritytech/ci-linux:production - -COPY ./ ./ - -RUN RUSTFLAGS="-C link-args=-Wl,--allow-multiple-definition" cargo build --release -p hyperbridge --features goerli - -ENTRYPOINT ["./target/release/hyperbridge"] diff --git a/scripts/docker/slim.Dockerfile b/scripts/docker/slim.Dockerfile index 9b2b05530..cc99b85f4 100644 --- a/scripts/docker/slim.Dockerfile +++ b/scripts/docker/slim.Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/library/debian:bullseye-slim +FROM docker.io/library/debian:bookworm-slim RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates