From 42e30d44270db05d8433d618815198b96e250686 Mon Sep 17 00:00:00 2001 From: Richard Janis Goldschmidt Date: Wed, 16 Oct 2024 15:39:22 +0200 Subject: [PATCH 1/3] chore: set astria dependencies to development branch --- Cargo.lock | 29 +++++++++++++++++-- crates/relayer/Cargo.toml | 4 +-- crates/relayer/src/chain/astria/endpoint.rs | 26 ++++++++--------- .../relayer/src/keyring/ed25519_key_pair.rs | 4 +-- crates/relayer/src/transfer.rs | 9 +++--- 5 files changed, 47 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a7aa63c819..b6015b8dba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -409,7 +409,7 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "astria-core" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?tag=sequencer-v0.16.0#6251eaae61cb0f22b4c9f1f6cf6dcbf980a8c95f" +source = "git+https://github.com/astriaorg/astria?branch=ENG-912/rename-signed-transaction#60c0026253ca53999cf3b582c956f0836c5fe366" dependencies = [ "astria-merkle", "base64 0.21.7", @@ -433,10 +433,19 @@ dependencies = [ "zeroize", ] +[[package]] +name = "astria-eyre" +version = "0.1.0" +source = "git+https://github.com/astriaorg/astria?branch=ENG-912/rename-signed-transaction#60c0026253ca53999cf3b582c956f0836c5fe366" +dependencies = [ + "eyre", + "itoa", +] + [[package]] name = "astria-merkle" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?tag=sequencer-v0.16.0#6251eaae61cb0f22b4c9f1f6cf6dcbf980a8c95f" +source = "git+https://github.com/astriaorg/astria?branch=ENG-912/rename-signed-transaction#60c0026253ca53999cf3b582c956f0836c5fe366" dependencies = [ "sha2 0.10.8", ] @@ -444,13 +453,15 @@ dependencies = [ [[package]] name = "astria-sequencer-client" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?tag=sequencer-v0.16.0#6251eaae61cb0f22b4c9f1f6cf6dcbf980a8c95f" +source = "git+https://github.com/astriaorg/astria?branch=ENG-912/rename-signed-transaction#60c0026253ca53999cf3b582c956f0836c5fe366" dependencies = [ "astria-core", + "astria-eyre", "async-trait", "futures", "futures-util", "hex", + "humantime", "prost 0.12.6", "tendermint", "tendermint-proto", @@ -459,6 +470,7 @@ dependencies = [ "tokio", "tokio-stream", "tracing", + "tryhard", ] [[package]] @@ -5591,6 +5603,17 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tryhard" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9f0a709784e86923586cff0d872dba54cd2d2e116b3bc57587d15737cfce9d" +dependencies = [ + "futures", + "pin-project-lite", + "tokio", +] + [[package]] name = "tungstenite" version = "0.20.1" diff --git a/crates/relayer/Cargo.toml b/crates/relayer/Cargo.toml index 6b252fe9d4..ac6401fc97 100644 --- a/crates/relayer/Cargo.toml +++ b/crates/relayer/Cargo.toml @@ -24,8 +24,8 @@ ibc-proto = { version = "0.41.0", features = ["serde"] } ibc-telemetry = { version = "0.26.4", path = "../telemetry", optional = true } ibc-relayer-types = { version = "0.26.4", path = "../relayer-types", features = ["mocks"] } -astria-core = { git = "https://github.com/astriaorg/astria", tag = "sequencer-v0.16.0" } -astria-sequencer-client = { git = "https://github.com/astriaorg/astria", tag = "sequencer-v0.16.0", features = [ "http" ] } +astria-core = { git = "https://github.com/astriaorg/astria", branch = "ENG-912/rename-signed-transaction" } +astria-sequencer-client = { git = "https://github.com/astriaorg/astria", branch = "ENG-912/rename-signed-transaction", features = [ "http" ] } ed25519-consensus = "2.1.0" ibc-types = "0.12.0" jmt = "0.6" diff --git a/crates/relayer/src/chain/astria/endpoint.rs b/crates/relayer/src/chain/astria/endpoint.rs index e4bebbde63..b3f1c24ee7 100644 --- a/crates/relayer/src/chain/astria/endpoint.rs +++ b/crates/relayer/src/chain/astria/endpoint.rs @@ -235,13 +235,12 @@ impl AstriaEndpoint { SigningKey, VerificationKey, }, - generated::protocol::transactions::v1alpha1::Ics20Withdrawal as RawIcs20Withdrawal, + generated::protocol::transaction::v1alpha1::Ics20Withdrawal as RawIcs20Withdrawal, primitive::v1::Address, protocol::transaction::v1alpha1::{ action::Ics20Withdrawal, Action, - TransactionParams, - UnsignedTransaction, + TransactionBody, }, Protobuf as _, }; @@ -287,20 +286,19 @@ impl AstriaEndpoint { .await .map_err(|e| Error::other(Box::new(e)))?; - let unsigned_tx = UnsignedTransaction { - params: TransactionParams::builder() - .nonce(nonce.nonce) - .chain_id(self.id().to_string()) - .build(), - actions, - }; - - let signed_tx = unsigned_tx.into_signed(&SigningKey::from(signing_key.to_bytes())); - let tx_bytes = signed_tx.into_raw().encode_to_vec(); + let tx = TransactionBody::builder() + .nonce(nonce.nonce) + .chain_id(self.id().to_string()) + .actions(actions) + .try_build() + .map_err(|e| Error::other_with_string(format!("{e:?}")))? + .sign(&SigningKey::from(signing_key.to_bytes())) + .into_raw() + .encode_to_vec(); let resp = self .sequencer_client - .broadcast_tx_sync(tx_bytes) + .broadcast_tx_sync(tx) .await .map_err(|e| Error::other(e.into()))?; Ok(resp) diff --git a/crates/relayer/src/keyring/ed25519_key_pair.rs b/crates/relayer/src/keyring/ed25519_key_pair.rs index 93d8374322..97de500148 100644 --- a/crates/relayer/src/keyring/ed25519_key_pair.rs +++ b/crates/relayer/src/keyring/ed25519_key_pair.rs @@ -165,8 +165,8 @@ impl SigningKeyPair for Ed25519KeyPair { let verification_key = VerificationKey::try_from(self.signing_key.verifying_key().to_bytes()) .expect("can convert ed25519 public key bytes to astria verification key"); - let address = Address::builder() - .array(verification_key.address_bytes()) + let address: Address = Address::builder() + .array(*verification_key.address_bytes()) .prefix("astria") .try_build() .expect("can build astria address from ed25519 public key"); diff --git a/crates/relayer/src/transfer.rs b/crates/relayer/src/transfer.rs index b776f68e57..3608f03e49 100644 --- a/crates/relayer/src/transfer.rs +++ b/crates/relayer/src/transfer.rs @@ -208,22 +208,22 @@ fn build_transfer_message_astria( let timeout_height = match timeout_height { // TODO: update astria IbcHeight to support optional? TimeoutHeight::At(height) => { - astria_core::generated::protocol::transactions::v1alpha1::IbcHeight { + astria_core::generated::protocol::transaction::v1alpha1::IbcHeight { revision_number: height.revision_number(), revision_height: height.revision_height(), } } TimeoutHeight::Never => { - astria_core::generated::protocol::transactions::v1alpha1::IbcHeight { + astria_core::generated::protocol::transaction::v1alpha1::IbcHeight { revision_number: 0, revision_height: u64::MAX, } } }; - let msg = astria_core::generated::protocol::transactions::v1alpha1::Ics20Withdrawal { + let msg = astria_core::generated::protocol::transaction::v1alpha1::Ics20Withdrawal { source_channel: src_channel_id.to_string(), - denom: denom, + denom, amount: Some( u128::try_from(amount.0) .expect("amount can fit into u128") @@ -240,6 +240,7 @@ fn build_transfer_message_astria( .to_string(), memo: String::new(), bridge_address: None, + use_compat_address: false, }; Any { From 42391a1554a790d979e028e2e746e705b99aed63 Mon Sep 17 00:00:00 2001 From: Richard Janis Goldschmidt Date: Wed, 16 Oct 2024 16:29:51 +0200 Subject: [PATCH 2/3] set msrv to 1.81, docker to rust:1.81-buster --- ci/release/hermes.Dockerfile | 2 +- crates/relayer/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/release/hermes.Dockerfile b/ci/release/hermes.Dockerfile index fdec4ac082..46c1e991f0 100644 --- a/ci/release/hermes.Dockerfile +++ b/ci/release/hermes.Dockerfile @@ -3,7 +3,7 @@ # Usage: (from the root of the working copy) # $ docker build . -t informalsystems/hermes -f ci/release/hermes.Dockerfile -FROM rust:1-buster AS build-env +FROM rust:1.81-buster AS build-env ARG TAG diff --git a/crates/relayer/Cargo.toml b/crates/relayer/Cargo.toml index ac6401fc97..bb2b51c41c 100644 --- a/crates/relayer/Cargo.toml +++ b/crates/relayer/Cargo.toml @@ -7,7 +7,7 @@ readme = "README.md" keywords = ["blockchain", "consensus", "cosmos", "ibc", "tendermint"] repository = "https://github.com/informalsystems/hermes" authors = ["Informal Systems "] -rust-version = "1.71" +rust-version = "1.81" description = """ Implementation of an IBC Relayer in Rust, as a library """ From f6189cd832a7378499488ea61e4015513562fad7 Mon Sep 17 00:00:00 2001 From: Richard Janis Goldschmidt Date: Wed, 16 Oct 2024 16:34:15 +0200 Subject: [PATCH 3/3] bookworm, not buster --- ci/release/hermes.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/release/hermes.Dockerfile b/ci/release/hermes.Dockerfile index 46c1e991f0..77b78f605f 100644 --- a/ci/release/hermes.Dockerfile +++ b/ci/release/hermes.Dockerfile @@ -3,7 +3,7 @@ # Usage: (from the root of the working copy) # $ docker build . -t informalsystems/hermes -f ci/release/hermes.Dockerfile -FROM rust:1.81-buster AS build-env +FROM rust:1.81-bookworm AS build-env ARG TAG