From dc83296a1595d018f9d0928515f61e10451e8f58 Mon Sep 17 00:00:00 2001 From: elizabeth Date: Thu, 27 Jun 2024 15:54:24 -0400 Subject: [PATCH 1/4] bump astria and penumbra deps --- Cargo.lock | 60 ++++++++++++------- crates/relayer/Cargo.toml | 8 +-- crates/relayer/src/chain/astria/endpoint.rs | 46 ++++++++++---- .../relayer/src/keyring/ed25519_key_pair.rs | 19 ++++-- crates/relayer/src/transfer.rs | 34 +++++++---- tools/test-framework/Cargo.toml | 2 +- 6 files changed, 110 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 92bd8daea6..0c9978904a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,30 +358,34 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "astria-core" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?rev=21cc874ca499c1f4afa8576f8640a9c8deac7690#21cc874ca499c1f4afa8576f8640a9c8deac7690" +source = "git+https://github.com/astriaorg/astria?rev=0f7faa802046c5314a423c20d037ebe8c4852189#0f7faa802046c5314a423c20d037ebe8c4852189" dependencies = [ "astria-merkle", "base64 0.21.7", + "bech32 0.11.0", "bytes", "celestia-tendermint", "ed25519-consensus", + "hex", "ibc-types", "indexmap 2.2.6", "pbjson-types", "penumbra-ibc", "penumbra-proto", "prost 0.12.3", + "rand", "sha2 0.10.8", "tendermint", "tendermint-proto", "thiserror", "tracing", + "zeroize", ] [[package]] name = "astria-merkle" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?rev=21cc874ca499c1f4afa8576f8640a9c8deac7690#21cc874ca499c1f4afa8576f8640a9c8deac7690" +source = "git+https://github.com/astriaorg/astria?rev=0f7faa802046c5314a423c20d037ebe8c4852189#0f7faa802046c5314a423c20d037ebe8c4852189" dependencies = [ "sha2 0.10.8", ] @@ -389,7 +393,7 @@ dependencies = [ [[package]] name = "astria-sequencer-client" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?rev=21cc874ca499c1f4afa8576f8640a9c8deac7690#21cc874ca499c1f4afa8576f8640a9c8deac7690" +source = "git+https://github.com/astriaorg/astria?rev=0f7faa802046c5314a423c20d037ebe8c4852189#0f7faa802046c5314a423c20d037ebe8c4852189" dependencies = [ "astria-core", "async-trait", @@ -578,6 +582,12 @@ version = "0.10.0-beta" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" +[[package]] +name = "bech32" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" + [[package]] name = "bincode" version = "1.3.3" @@ -1356,8 +1366,8 @@ dependencies = [ [[package]] name = "decaf377-fmd" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "ark-ff", "ark-serialize", @@ -1370,8 +1380,8 @@ dependencies = [ [[package]] name = "decaf377-ka" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "ark-ff", "decaf377 0.5.0", @@ -3495,8 +3505,8 @@ checksum = "36bae92c60fa2398ce4678b98b2c4b5a7c61099961ca1fa305aec04a9ad28922" [[package]] name = "penumbra-asset" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "anyhow", "ark-ff", @@ -3533,14 +3543,15 @@ dependencies = [ [[package]] name = "penumbra-ibc" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "anyhow", "ark-ff", "async-trait", "base64 0.21.7", "blake2b_simd 1.0.2", + "futures", "hex", "ibc-proto", "ibc-types", @@ -3560,14 +3571,15 @@ dependencies = [ "sha2 0.10.8", "tendermint", "tendermint-light-client-verifier", + "time", "tower", "tracing", ] [[package]] name = "penumbra-keys" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "aes", "anyhow", @@ -3610,8 +3622,8 @@ dependencies = [ [[package]] name = "penumbra-num" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "anyhow", "ark-ff", @@ -3646,8 +3658,8 @@ dependencies = [ [[package]] name = "penumbra-proto" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "anyhow", "async-trait", @@ -3673,8 +3685,8 @@ dependencies = [ [[package]] name = "penumbra-sct" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "anyhow", "ark-ff", @@ -3685,12 +3697,14 @@ dependencies = [ "bincode", "blake2b_simd 1.0.2", "bytes", + "chrono", "decaf377 0.5.0", "decaf377-rdsa", "hex", "im", "metrics", "once_cell", + "pbjson-types", "penumbra-keys", "penumbra-proto", "penumbra-tct", @@ -3704,8 +3718,8 @@ dependencies = [ [[package]] name = "penumbra-tct" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "ark-ed-on-bls12-377", "ark-ff", @@ -3732,8 +3746,8 @@ dependencies = [ [[package]] name = "penumbra-txhash" -version = "0.69.1" -source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.69.1#b3e62ece950a55f25982c962c88dcfec0b603174" +version = "0.78.0" +source = "git+https://github.com/penumbra-zone/penumbra.git?tag=v0.78.0#14959350abcb8cfbf33f9aedc7463fccfd8e3f9f" dependencies = [ "anyhow", "blake2b_simd 1.0.2", diff --git a/crates/relayer/Cargo.toml b/crates/relayer/Cargo.toml index d361d3c254..e64b032fee 100644 --- a/crates/relayer/Cargo.toml +++ b/crates/relayer/Cargo.toml @@ -24,13 +24,13 @@ 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", rev = "21cc874ca499c1f4afa8576f8640a9c8deac7690" } -astria-sequencer-client = { git = "https://github.com/astriaorg/astria", rev = "21cc874ca499c1f4afa8576f8640a9c8deac7690", features = [ "http" ] } +astria-core = { git = "https://github.com/astriaorg/astria", rev = "0f7faa802046c5314a423c20d037ebe8c4852189" } +astria-sequencer-client = { git = "https://github.com/astriaorg/astria", rev = "0f7faa802046c5314a423c20d037ebe8c4852189", features = [ "http" ] } ed25519-consensus = "2.1.0" ibc-types = "0.12.0" jmt = "0.6" -penumbra-ibc = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.69.1", default-features = false } -penumbra-proto = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.69.1" } +penumbra-ibc = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.78.0", default-features = false } +penumbra-proto = { git = "https://github.com/penumbra-zone/penumbra.git", tag = "v0.78.0" } pbjson-types = "0.6" subtle-encoding = "0.5" diff --git a/crates/relayer/src/chain/astria/endpoint.rs b/crates/relayer/src/chain/astria/endpoint.rs index 98586f2a73..5c210fc8c6 100644 --- a/crates/relayer/src/chain/astria/endpoint.rs +++ b/crates/relayer/src/chain/astria/endpoint.rs @@ -231,13 +231,16 @@ impl AstriaEndpoint { async fn broadcast_messages(&mut self, tracked_msgs: TrackedMsgs) -> Result { use astria_core::{ - generated::sequencer::v1::Ics20Withdrawal as RawIcs20Withdrawal, - sequencer::v1::{ - transaction::{ - action::Ics20Withdrawal, - Action, - }, - Address, + crypto::{ + SigningKey, + VerificationKey, + }, + generated::protocol::transaction::v1alpha1::Ics20Withdrawal as RawIcs20Withdrawal, + primitive::v1::Address, + protocol::transaction::v1alpha1::{ + action::Ics20Withdrawal, + Action, + TransactionParams, UnsignedTransaction, }, }; @@ -270,7 +273,12 @@ impl AstriaEndpoint { let signing_key: ed25519_consensus::SigningKey = (*self.get_key()?.signing_key().as_bytes()).into(); // TODO cache this - let address = Address::from_verification_key(signing_key.verification_key()); + let verification_key = VerificationKey::from(signing_key.verification_key()); + let address = Address::builder() + .verification_key(&verification_key) + .prefix("astria") + .try_build() + .map_err(|e| Error::other(e.into()))?; let nonce = self .sequencer_client .get_latest_nonce(address) @@ -278,11 +286,14 @@ impl AstriaEndpoint { .map_err(|e| Error::other(Box::new(e)))?; let unsigned_tx = UnsignedTransaction { - nonce: nonce.nonce, + params: TransactionParams::builder() + .nonce(nonce.nonce) + .chain_id(self.id().to_string()) + .build(), actions, }; - let signed_tx = unsigned_tx.into_signed(&signing_key); + let signed_tx = unsigned_tx.into_signed(&SigningKey::from(signing_key)); let tx_bytes = signed_tx.into_raw().encode_to_vec(); let resp = self @@ -586,7 +597,10 @@ impl ChainEndpoint for AstriaEndpoint { _key_name: Option<&str>, denom: Option<&str>, ) -> Result { - use astria_core::sequencer::v1::account::AssetBalance; + use astria_core::{ + crypto::VerificationKey, + protocol::account::v1alpha1::AssetBalance, + }; use astria_sequencer_client::{ Address, SequencerClientExt as _, @@ -594,12 +608,18 @@ impl ChainEndpoint for AstriaEndpoint { let signing_key: ed25519_consensus::SigningKey = (*self.get_key()?.signing_key().as_bytes()).into(); // TODO cache this - let address = Address::from_verification_key(signing_key.verification_key()); + let verification_key = VerificationKey::from(signing_key.verification_key()); + let address = Address::builder() + .verification_key(&verification_key) + .prefix("astria") + .try_build() + .map_err(|e| Error::other(e.into()))?; let balance = self .block_on(self.sequencer_client.get_latest_balance(address)) .map_err(|e| Error::other(Box::new(e)))?; - let denom = denom.unwrap_or(astria_core::sequencer::v1::asset::DEFAULT_NATIVE_ASSET_DENOM); + // TODO: fetch this from the sequencer node via abci query + let denom = denom.unwrap_or("nria"); let balance: Vec = balance .balances diff --git a/crates/relayer/src/keyring/ed25519_key_pair.rs b/crates/relayer/src/keyring/ed25519_key_pair.rs index 6c8ec1a1e3..b086547396 100644 --- a/crates/relayer/src/keyring/ed25519_key_pair.rs +++ b/crates/relayer/src/keyring/ed25519_key_pair.rs @@ -158,12 +158,19 @@ impl SigningKeyPair for Ed25519KeyPair { bs58::encode(&self.signing_key.verifying_key()).into_string() } Ed25519AddressType::Astria => { - hex::encode(astria_core::sequencer::v1::Address::from_verification_key( - ed25519_consensus::VerificationKey::try_from( - self.signing_key.verifying_key().to_bytes(), - ) - .expect("can convert between ed25519 keys"), - )) + use astria_core::{ + crypto::VerificationKey, + primitive::v1::Address, + }; + 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()) + .prefix("astria") + .try_build() + .expect("can build astria address from ed25519 public key"); + address.to_string() } } } diff --git a/crates/relayer/src/transfer.rs b/crates/relayer/src/transfer.rs index 4a6be237c7..54c91f16df 100644 --- a/crates/relayer/src/transfer.rs +++ b/crates/relayer/src/transfer.rs @@ -195,21 +195,29 @@ fn build_transfer_message_astria( timeout_height: TimeoutHeight, timeout_timestamp: Timestamp, ) -> Any { - use astria_core::sequencer::v1::asset::default_native_asset_id; + use astria_core::primitive::v1::Address; + let sender: Address = sender + .to_string() + .parse() + .expect("can parse astria bech32m sender address"); let timeout_height = match timeout_height { // TODO: update astria IbcHeight to support optional? - TimeoutHeight::At(height) => astria_core::generated::sequencer::v1::IbcHeight { - revision_number: height.revision_number(), - revision_height: height.revision_height(), - }, - TimeoutHeight::Never => astria_core::generated::sequencer::v1::IbcHeight { - revision_number: 0, - revision_height: u64::MAX, - }, + TimeoutHeight::At(height) => { + astria_core::generated::protocol::transaction::v1alpha1::IbcHeight { + revision_number: height.revision_number(), + revision_height: height.revision_height(), + } + } + TimeoutHeight::Never => { + astria_core::generated::protocol::transaction::v1alpha1::IbcHeight { + revision_number: 0, + revision_height: u64::MAX, + } + } }; - let msg = astria_core::generated::sequencer::v1::Ics20Withdrawal { + let msg = astria_core::generated::protocol::transaction::v1alpha1::Ics20Withdrawal { source_channel: src_channel_id.to_string(), denom: denom, amount: Some( @@ -218,10 +226,12 @@ fn build_transfer_message_astria( .into(), ), destination_chain_address: receiver.to_string(), - return_address: hex::decode(sender.to_string()).expect("sender address is hex"), + return_address: Some(sender.to_raw()), timeout_height: Some(timeout_height), timeout_time: timeout_timestamp.nanoseconds(), - fee_asset_id: default_native_asset_id().as_ref().to_vec(), + fee_asset: "nria".to_string(), // TODO: make this configurable + memo: String::new(), + bridge_address: None, }; Any { diff --git a/tools/test-framework/Cargo.toml b/tools/test-framework/Cargo.toml index f4bfc60324..c29cb6aa89 100644 --- a/tools/test-framework/Cargo.toml +++ b/tools/test-framework/Cargo.toml @@ -17,7 +17,7 @@ description = """ ibc-relayer-types = { version = "=0.26.4", path = "../../crates/relayer-types" } ibc-relayer = { version = "=0.26.4", path = "../../crates/relayer" } ibc-relayer-cli = { version = "=1.7.4", path = "../../crates/relayer-cli" } -ibc-proto = { version = "0.40.0", features = ["serde"] } +ibc-proto = { version = "0.41.0", features = ["serde"] } tendermint-rpc = { version = "0.34.0", features = ["http-client", "websocket-client"] } http = "0.2.9" From 71d288428e81b9cafb83ed27e3a51ea088694c93 Mon Sep 17 00:00:00 2001 From: elizabeth Date: Fri, 28 Jun 2024 16:29:08 -0400 Subject: [PATCH 2/4] bump astria dep to latest --- Cargo.lock | 6 +++--- crates/relayer/Cargo.toml | 4 ++-- crates/relayer/src/chain/astria/endpoint.rs | 8 +++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c9978904a..5af8dc2bb7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -358,7 +358,7 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "astria-core" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?rev=0f7faa802046c5314a423c20d037ebe8c4852189#0f7faa802046c5314a423c20d037ebe8c4852189" +source = "git+https://github.com/astriaorg/astria?rev=e73db6304c0146c9891a77fbc24b92d49f3eb211#e73db6304c0146c9891a77fbc24b92d49f3eb211" dependencies = [ "astria-merkle", "base64 0.21.7", @@ -385,7 +385,7 @@ dependencies = [ [[package]] name = "astria-merkle" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?rev=0f7faa802046c5314a423c20d037ebe8c4852189#0f7faa802046c5314a423c20d037ebe8c4852189" +source = "git+https://github.com/astriaorg/astria?rev=e73db6304c0146c9891a77fbc24b92d49f3eb211#e73db6304c0146c9891a77fbc24b92d49f3eb211" dependencies = [ "sha2 0.10.8", ] @@ -393,7 +393,7 @@ dependencies = [ [[package]] name = "astria-sequencer-client" version = "0.1.0" -source = "git+https://github.com/astriaorg/astria?rev=0f7faa802046c5314a423c20d037ebe8c4852189#0f7faa802046c5314a423c20d037ebe8c4852189" +source = "git+https://github.com/astriaorg/astria?rev=e73db6304c0146c9891a77fbc24b92d49f3eb211#e73db6304c0146c9891a77fbc24b92d49f3eb211" dependencies = [ "astria-core", "async-trait", diff --git a/crates/relayer/Cargo.toml b/crates/relayer/Cargo.toml index e64b032fee..015ea5edf1 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", rev = "0f7faa802046c5314a423c20d037ebe8c4852189" } -astria-sequencer-client = { git = "https://github.com/astriaorg/astria", rev = "0f7faa802046c5314a423c20d037ebe8c4852189", features = [ "http" ] } +astria-core = { git = "https://github.com/astriaorg/astria", rev = "e73db6304c0146c9891a77fbc24b92d49f3eb211" } +astria-sequencer-client = { git = "https://github.com/astriaorg/astria", rev = "e73db6304c0146c9891a77fbc24b92d49f3eb211", 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 5c210fc8c6..2c013cba33 100644 --- a/crates/relayer/src/chain/astria/endpoint.rs +++ b/crates/relayer/src/chain/astria/endpoint.rs @@ -273,7 +273,8 @@ impl AstriaEndpoint { let signing_key: ed25519_consensus::SigningKey = (*self.get_key()?.signing_key().as_bytes()).into(); // TODO cache this - let verification_key = VerificationKey::from(signing_key.verification_key()); + let verification_key = VerificationKey::try_from(signing_key.verification_key().to_bytes()) + .map_err(|e| Error::other(e.into()))?; let address = Address::builder() .verification_key(&verification_key) .prefix("astria") @@ -293,7 +294,7 @@ impl AstriaEndpoint { actions, }; - let signed_tx = unsigned_tx.into_signed(&SigningKey::from(signing_key)); + let signed_tx = unsigned_tx.into_signed(&SigningKey::from(signing_key.to_bytes())); let tx_bytes = signed_tx.into_raw().encode_to_vec(); let resp = self @@ -608,7 +609,8 @@ impl ChainEndpoint for AstriaEndpoint { let signing_key: ed25519_consensus::SigningKey = (*self.get_key()?.signing_key().as_bytes()).into(); // TODO cache this - let verification_key = VerificationKey::from(signing_key.verification_key()); + let verification_key = VerificationKey::try_from(signing_key.verification_key().to_bytes()) + .map_err(|e| Error::other(e.into()))?; let address = Address::builder() .verification_key(&verification_key) .prefix("astria") From 113499ee741a95be8572f4723b0cf61b40b41989 Mon Sep 17 00:00:00 2001 From: elizabeth Date: Mon, 1 Jul 2024 19:52:18 -0400 Subject: [PATCH 3/4] address comments --- crates/relayer/src/event.rs | 2 ++ crates/relayer/src/keyring/ed25519_key_pair.rs | 15 +++++++++++++++ crates/relayer/src/transfer.rs | 14 +++++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/crates/relayer/src/event.rs b/crates/relayer/src/event.rs index 3f9decf6af..fa3fff5e54 100644 --- a/crates/relayer/src/event.rs +++ b/crates/relayer/src/event.rs @@ -503,6 +503,8 @@ mod tests { timestamp::Timestamp, }; + use super::*; + #[test] fn extract_header() { let header = get_dummy_ics07_header(); diff --git a/crates/relayer/src/keyring/ed25519_key_pair.rs b/crates/relayer/src/keyring/ed25519_key_pair.rs index b086547396..93d8374322 100644 --- a/crates/relayer/src/keyring/ed25519_key_pair.rs +++ b/crates/relayer/src/keyring/ed25519_key_pair.rs @@ -183,3 +183,18 @@ impl SigningKeyPair for Ed25519KeyPair { self } } + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn ed25519_keypair_astria_account() { + let signing_key = ed25519_dalek::SigningKey::from_bytes(&[99u8; 32]); + let keypair = Ed25519KeyPair { + signing_key, + address_type: Ed25519AddressType::Astria, + }; + let _address = keypair.account(); + } +} diff --git a/crates/relayer/src/transfer.rs b/crates/relayer/src/transfer.rs index 54c91f16df..d22e879ef8 100644 --- a/crates/relayer/src/transfer.rs +++ b/crates/relayer/src/transfer.rs @@ -195,9 +195,13 @@ fn build_transfer_message_astria( timeout_height: TimeoutHeight, timeout_timestamp: Timestamp, ) -> Any { - use astria_core::primitive::v1::Address; + use astria_core::primitive::v1::{ + asset::Denom, + Address, + }; + let sender: Address = sender - .to_string() + .as_ref() .parse() .expect("can parse astria bech32m sender address"); @@ -229,7 +233,11 @@ fn build_transfer_message_astria( return_address: Some(sender.to_raw()), timeout_height: Some(timeout_height), timeout_time: timeout_timestamp.nanoseconds(), - fee_asset: "nria".to_string(), // TODO: make this configurable + // TODO: make this configurable + fee_asset: "nria" + .parse::() + .expect("nria is a valid denom") + .to_string(), memo: String::new(), bridge_address: None, }; From c70e7712cf66962f16741d863b4eed980b0a625e Mon Sep 17 00:00:00 2001 From: elizabeth Date: Mon, 1 Jul 2024 19:53:00 -0400 Subject: [PATCH 4/4] update todo --- crates/relayer/src/chain/astria/endpoint.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/relayer/src/chain/astria/endpoint.rs b/crates/relayer/src/chain/astria/endpoint.rs index 2c013cba33..d159c5adfd 100644 --- a/crates/relayer/src/chain/astria/endpoint.rs +++ b/crates/relayer/src/chain/astria/endpoint.rs @@ -620,7 +620,7 @@ impl ChainEndpoint for AstriaEndpoint { .block_on(self.sequencer_client.get_latest_balance(address)) .map_err(|e| Error::other(Box::new(e)))?; - // TODO: fetch this from the sequencer node via abci query + // TODO: set this via the config let denom = denom.unwrap_or("nria"); let balance: Vec = balance