Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade to new v1 protos #19

Merged
merged 5 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
pull_request:
branches:
- astria

env:
REGISTRY: ghcr.io
Expand Down
29 changes: 26 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ci/release/hermes.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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-bookworm AS build-env

ARG TAG

Expand Down
6 changes: 3 additions & 3 deletions crates/relayer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ readme = "README.md"
keywords = ["blockchain", "consensus", "cosmos", "ibc", "tendermint"]
repository = "https://github.com/informalsystems/hermes"
authors = ["Informal Systems <[email protected]>"]
rust-version = "1.71"
rust-version = "1.81"
description = """
Implementation of an IBC Relayer in Rust, as a library
"""
Expand All @@ -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 = "joroshiba/proto-v1-upgrade" }
astria-sequencer-client = { git = "https://github.com/astriaorg/astria", branch = "joroshiba/proto-v1-upgrade", features = [ "http" ] }
ed25519-consensus = "2.1.0"
ibc-types = "0.12.0"
jmt = "0.6"
Expand Down
30 changes: 14 additions & 16 deletions crates/relayer/src/chain/astria/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,12 @@ impl AstriaEndpoint {
SigningKey,
VerificationKey,
},
generated::protocol::transactions::v1alpha1::Ics20Withdrawal as RawIcs20Withdrawal,
generated::protocol::transaction::v1::Ics20Withdrawal as RawIcs20Withdrawal,
primitive::v1::Address,
protocol::transaction::v1alpha1::{
protocol::transaction::v1::{
action::Ics20Withdrawal,
Action,
TransactionParams,
UnsignedTransaction,
TransactionBody,
},
Protobuf as _,
};
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -601,7 +599,7 @@ impl ChainEndpoint for AstriaEndpoint {
) -> Result<Balance, Error> {
use astria_core::{
crypto::VerificationKey,
protocol::account::v1alpha1::AssetBalance,
protocol::account::v1::AssetBalance,
};
use astria_sequencer_client::{
Address,
Expand Down
4 changes: 2 additions & 2 deletions crates/relayer/src/keyring/ed25519_key_pair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
9 changes: 5 additions & 4 deletions crates/relayer/src/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::v1::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::v1::IbcHeight {
revision_number: 0,
revision_height: u64::MAX,
}
}
};

let msg = astria_core::generated::protocol::transactions::v1alpha1::Ics20Withdrawal {
let msg = astria_core::generated::protocol::transaction::v1::Ics20Withdrawal {
source_channel: src_channel_id.to_string(),
denom: denom,
denom,
amount: Some(
u128::try_from(amount.0)
.expect("amount can fit into u128")
Expand All @@ -240,6 +240,7 @@ fn build_transfer_message_astria(
.to_string(),
memo: String::new(),
bridge_address: None,
use_compat_address: false,
};

Any {
Expand Down
Loading