diff --git a/Cargo.lock b/Cargo.lock index e94dab4de2..bbf0ad84ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -584,9 +584,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.0.0-alpha.4" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41898277107b0d3f027593697912977397eba6ac39a55bdd2eb02c1d5d5013b5" +checksum = "9897ef0f1bd2362169de6d7e436ea2237dc1085d7d1e4db75f4be34d86f309d1" dependencies = [ "borsh-derive", "cfg_aliases", @@ -594,12 +594,12 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.0.0-alpha.4" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413cb435569fe499e89235f758304e0e7198016baa351d8f5827ea0f40526ce0" +checksum = "478b41ff04256c5c8330f3dfdaaae2a5cc976a8e75088bafa4625b0d0208de8c" dependencies = [ "once_cell", - "proc-macro-crate 1.3.1", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 2.0.38", @@ -608,8 +608,8 @@ dependencies = [ [[package]] name = "borsh-ext" -version = "1.0.0-alpha.4" -source = "git+https://github.com/heliaxdev/borsh-ext?tag=v1.0.0-alpha.4#6bebf357002f96574ac37a28f547b6c88e91b799" +version = "1.2.0" +source = "git+https://github.com/heliaxdev/borsh-ext?tag=v1.2.0#a62fee3e847e512cad9ac0f1fd5a900e5db9ba37" dependencies = [ "borsh", ] @@ -2473,32 +2473,53 @@ dependencies = [ [[package]] name = "ibc" -version = "0.47.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "184eb22140cb4143bbcf7ddc8fdfeb9cc058ef73a6066f8ea78162e69d3565d1" +checksum = "429b6aca6624a9364878e28c90311438c2621a8270942d80732b2651ac38ac74" +dependencies = [ + "ibc-apps", + "ibc-clients", + "ibc-core", + "ibc-core-host-cosmos", + "ibc-derive", + "ibc-primitives", +] + +[[package]] +name = "ibc-app-transfer" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b177b343385d9654d99be4709b5ed1574d41f91dfa4044b2d26d688be4179d7c" +dependencies = [ + "ibc-app-transfer-types", + "ibc-core", + "serde-json-wasm", +] + +[[package]] +name = "ibc-app-transfer-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95f92a3eda225e5c86e7bb6501c95986583ac541c4369d3c528349d81390f947" dependencies = [ - "bytes", "derive_more", "displaydoc", - "ibc-derive", - "ibc-proto 0.37.1", - "ics23", - "num-traits", + "ibc-core", + "ibc-proto 0.38.0", "primitive-types", - "prost 0.12.1", "serde", - "serde-json-wasm", - "serde_derive", - "sha2 0.10.8", - "subtle-encoding", - "tendermint", - "tendermint-light-client-verifier", - "tendermint-proto", - "time", - "tracing", "uint", ] +[[package]] +name = "ibc-apps" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4be40d55ed2dea9f2d05b902a3586f20850c723e4bdbfc4fb0ebe7a66ca5e40" +dependencies = [ + "ibc-app-transfer", +] + [[package]] name = "ibc-chain-registry" version = "0.26.1" @@ -2518,11 +2539,342 @@ dependencies = [ "tracing", ] +[[package]] +name = "ibc-client-tendermint" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "119aa5873214228bf69bded3f20022b9ae1bc35b6841d295afcd73e53db05ccf" +dependencies = [ + "ibc-client-tendermint-types", + "ibc-core-client", + "ibc-core-commitment-types", + "ibc-core-handler-types", + "ibc-core-host", + "ibc-primitives", + "prost 0.12.1", + "serde", + "tendermint", + "tendermint-light-client-verifier", +] + +[[package]] +name = "ibc-client-tendermint-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f21679016931b332b295a761e65cc122dc6fbfb98444148b681ad3aaa474665" +dependencies = [ + "bytes", + "displaydoc", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto 0.38.0", + "prost 0.12.1", + "serde", + "tendermint", + "tendermint-light-client-verifier", + "tendermint-proto", +] + +[[package]] +name = "ibc-clients" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685c660323e93107a136aa3dbc412b7fa2eafd315c2fe71184096a43800f8ca5" +dependencies = [ + "ibc-client-tendermint", +] + +[[package]] +name = "ibc-core" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "100d9d0aa67432c5078a8a1c818e3fc990a193be6d35ed0abeda5b340d16c1da" +dependencies = [ + "ibc-core-channel", + "ibc-core-client", + "ibc-core-commitment-types", + "ibc-core-connection", + "ibc-core-handler", + "ibc-core-host", + "ibc-core-router", + "ibc-primitives", +] + +[[package]] +name = "ibc-core-channel" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebaa37629ac029f914dfe552ab5dad01ddb240ec885ed0ae68221cbea4e9bfc" +dependencies = [ + "ibc-core-channel-types", + "ibc-core-client", + "ibc-core-commitment-types", + "ibc-core-connection", + "ibc-core-handler-types", + "ibc-core-host", + "ibc-core-router", + "ibc-primitives", + "prost 0.12.1", +] + +[[package]] +name = "ibc-core-channel-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2ba72c56c411b1e0ce6dc3f5e1fa1de9e6c84891f425b7be8a9e1705964378" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-connection-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto 0.38.0", + "prost 0.12.1", + "serde", + "sha2 0.10.8", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-client" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c4fac8e05201795073dee8c93d5afe9dfeac9aec2412b4a2b0c5f0d1e1d725" +dependencies = [ + "ibc-core-client-context", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-handler-types", + "ibc-core-host", + "ibc-primitives", + "prost 0.12.1", +] + +[[package]] +name = "ibc-core-client-context" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b82abd9489021730d59ab2d00e9438d3711e8e78ecba4d083b64f833301682b" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-handler-types", + "ibc-core-host-types", + "ibc-derive", + "ibc-primitives", + "prost 0.12.1", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-client-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bafdbf6db5dab4c8ad610b6940e23b4f8abd0a6ac5e8e2801415a95defd4a583" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-commitment-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto 0.38.0", + "prost 0.12.1", + "serde", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-commitment-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed4256b0216fc49024bac7e01c61b9bb055e31914ffe9ce6f468d7ce496a9357" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-primitives", + "ibc-proto 0.38.0", + "ics23", + "prost 0.12.1", + "serde", + "subtle-encoding", +] + +[[package]] +name = "ibc-core-connection" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e237b70b9ba0177a4e59ac9048fffac2ac44c334703cc0ae403ad221450850" +dependencies = [ + "ibc-core-client", + "ibc-core-connection-types", + "ibc-core-handler-types", + "ibc-core-host", + "ibc-primitives", + "prost 0.12.1", +] + +[[package]] +name = "ibc-core-connection-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca841416fa29626423917099092f3698ae2735074cb3fe42936ddf6b2ccbf2f7" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto 0.38.0", + "prost 0.12.1", + "serde", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-handler" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47e5e5a006aa0fc87ec3f5fb1e0ef6dd5aeea5079fa927d799d526c44329987" +dependencies = [ + "ibc-core-channel", + "ibc-core-client", + "ibc-core-commitment-types", + "ibc-core-connection", + "ibc-core-handler-types", + "ibc-core-host", + "ibc-core-router", + "ibc-primitives", +] + +[[package]] +name = "ibc-core-handler-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3d59a8a5eb2069530c42783b4fef63472a89e0e9242334351df1bb58aaf542" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-channel-types", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-connection-types", + "ibc-core-host-types", + "ibc-core-router-types", + "ibc-primitives", + "ibc-proto 0.38.0", + "prost 0.12.1", + "serde", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-host" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aa63c895c0e5a75e42fe859b8fd4250c12bfa8b9c6b114f94c927ecfad38a03" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-channel-types", + "ibc-core-client-context", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-connection-types", + "ibc-core-handler-types", + "ibc-core-host-types", + "ibc-primitives", + "prost 0.12.1", + "subtle-encoding", +] + +[[package]] +name = "ibc-core-host-cosmos" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a325862af6c20b0df3d27c072a2d802a7232dc1666214d738cdfbd9a9c99720" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-app-transfer-types", + "ibc-client-tendermint", + "ibc-core-client-context", + "ibc-core-client-types", + "ibc-core-commitment-types", + "ibc-core-connection-types", + "ibc-core-handler-types", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto 0.38.0", + "prost 0.12.1", + "serde", + "sha2 0.10.8", + "subtle-encoding", + "tendermint", +] + +[[package]] +name = "ibc-core-host-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616955da310febbe93c0569a2feebd9f57cafed3eee5a56b0c3bb953a75f6089" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-primitives", + "serde", +] + +[[package]] +name = "ibc-core-router" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31fe115da73e0616bdb44400fa6b11ca251648d070c4ff419d58e27804d30243" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-channel-types", + "ibc-core-host-types", + "ibc-core-router-types", + "ibc-primitives", + "prost 0.12.1", + "subtle-encoding", +] + +[[package]] +name = "ibc-core-router-types" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d1fbb0bbbdeafa7ac989ba1693ed46d22e0e3eb0bdae478544e31157a4fdba6" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-core-host-types", + "ibc-primitives", + "ibc-proto 0.38.0", + "ics23", + "prost 0.12.1", + "serde", + "subtle-encoding", + "tendermint", +] + [[package]] name = "ibc-derive" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92f1528535e9ca495badb76c143bdd4763c1c9d987f59d1f8b47963ba0c11674" +checksum = "df07bf5bc1e65e291506b7497633e07967e49b36a8db10cda77a8fd686eb4548" dependencies = [ "darling", "proc-macro2", @@ -2547,11 +2899,26 @@ dependencies = [ "tonic", ] +[[package]] +name = "ibc-primitives" +version = "0.48.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5edea4685267fd68514c87e7aa3a62712340c4cff6903f088a9ab571428a08a" +dependencies = [ + "derive_more", + "displaydoc", + "ibc-proto 0.38.0", + "prost 0.12.1", + "serde", + "tendermint", + "time", +] + [[package]] name = "ibc-proto" -version = "0.37.1" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63042806bb2f662ca1c68026231900cfe13361136ddfd0dd09bcb315056a22b8" +checksum = "93cbf4cbe9e5113cc7c70f3208a7029b2205c629502cbb2ae7ea0a09a97d3005" dependencies = [ "base64 0.21.4", "bytes", @@ -2890,7 +3257,7 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "index-set" version = "0.8.0" -source = "git+https://github.com/heliaxdev/index-set?tag=v0.8.0#0c218cc300c1bb7a1acf34f21b6e9d489df5fda8" +source = "git+https://github.com/heliaxdev/index-set?tag=v0.8.1#b0d928f83cf0d465ccda299d131e8df2859b5184" dependencies = [ "borsh", "serde", @@ -3122,8 +3489,8 @@ dependencies = [ [[package]] name = "masp_note_encryption" -version = "0.2.0" -source = "git+https://github.com/anoma/masp?rev=77e009626f3f52fe83c81ec6ee38fc2547d38da3#77e009626f3f52fe83c81ec6ee38fc2547d38da3" +version = "1.0.0" +source = "git+https://github.com/anoma/masp?tag=v1.0.0#c3c6047a9c9da54058afc71219b913ac9f79e48b" dependencies = [ "borsh", "chacha20", @@ -3135,8 +3502,8 @@ dependencies = [ [[package]] name = "masp_primitives" -version = "0.9.0" -source = "git+https://github.com/anoma/masp?rev=77e009626f3f52fe83c81ec6ee38fc2547d38da3#77e009626f3f52fe83c81ec6ee38fc2547d38da3" +version = "1.0.0" +source = "git+https://github.com/anoma/masp?tag=v1.0.0#c3c6047a9c9da54058afc71219b913ac9f79e48b" dependencies = [ "aes", "bip0039", @@ -3166,8 +3533,8 @@ dependencies = [ [[package]] name = "masp_proofs" -version = "0.9.0" -source = "git+https://github.com/anoma/masp?rev=77e009626f3f52fe83c81ec6ee38fc2547d38da3#77e009626f3f52fe83c81ec6ee38fc2547d38da3" +version = "1.0.0" +source = "git+https://github.com/anoma/masp?tag=v1.0.0#c3c6047a9c9da54058afc71219b913ac9f79e48b" dependencies = [ "bellman", "blake2b_simd", @@ -3301,8 +3668,8 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "namada_core" -version = "0.27.0" -source = "git+https://github.com/anoma/namada?tag=v0.27.0#47c887c501c47f15929221c3858220d51731962b" +version = "0.28.0" +source = "git+https://github.com/anoma/namada?tag=v0.28.0#9562c1602be0c7a9e40cc486cc673203b6737a98" dependencies = [ "ark-bls12-381", "ark-serialize", @@ -3318,7 +3685,6 @@ dependencies = [ "eyre", "ibc", "ibc-derive", - "ibc-proto 0.37.1", "ics23", "impl-num-traits", "index-set", @@ -3352,8 +3718,8 @@ dependencies = [ [[package]] name = "namada_ethereum_bridge" -version = "0.27.0" -source = "git+https://github.com/anoma/namada?tag=v0.27.0#47c887c501c47f15929221c3858220d51731962b" +version = "0.28.0" +source = "git+https://github.com/anoma/namada?tag=v0.28.0#9562c1602be0c7a9e40cc486cc673203b6737a98" dependencies = [ "borsh", "borsh-ext", @@ -3374,8 +3740,8 @@ dependencies = [ [[package]] name = "namada_macros" -version = "0.27.0" -source = "git+https://github.com/anoma/namada?tag=v0.27.0#47c887c501c47f15929221c3858220d51731962b" +version = "0.28.0" +source = "git+https://github.com/anoma/namada?tag=v0.28.0#9562c1602be0c7a9e40cc486cc673203b6737a98" dependencies = [ "proc-macro2", "quote", @@ -3384,22 +3750,23 @@ dependencies = [ [[package]] name = "namada_proof_of_stake" -version = "0.27.0" -source = "git+https://github.com/anoma/namada?tag=v0.27.0#47c887c501c47f15929221c3858220d51731962b" +version = "0.28.0" +source = "git+https://github.com/anoma/namada?tag=v0.28.0#9562c1602be0c7a9e40cc486cc673203b6737a98" dependencies = [ "borsh", "data-encoding", "derivative", "namada_core", "once_cell", + "serde", "thiserror", "tracing", ] [[package]] name = "namada_sdk" -version = "0.27.0" -source = "git+https://github.com/anoma/namada?tag=v0.27.0#47c887c501c47f15929221c3858220d51731962b" +version = "0.28.0" +source = "git+https://github.com/anoma/namada?tag=v0.28.0#9562c1602be0c7a9e40cc486cc673203b6737a98" dependencies = [ "async-trait", "bimap", @@ -5268,7 +5635,7 @@ dependencies = [ [[package]] name = "sparse-merkle-tree" version = "0.3.1-pre" -source = "git+https://github.com/heliaxdev/sparse-merkle-tree?rev=aed81070ce2c83a41e1c6bada757347f33ef8eb6#aed81070ce2c83a41e1c6bada757347f33ef8eb6" +source = "git+https://github.com/heliaxdev/sparse-merkle-tree?rev=515687fe7884cb365067ac86c66ac3613de176bb#515687fe7884cb365067ac86c66ac3613de176bb" dependencies = [ "borsh", "cfg-if 1.0.0", diff --git a/crates/relayer/Cargo.toml b/crates/relayer/Cargo.toml index 80696c12c9..f7857d9276 100644 --- a/crates/relayer/Cargo.toml +++ b/crates/relayer/Cargo.toml @@ -111,7 +111,7 @@ default-features = false [dependencies.namada_sdk] git = "https://github.com/anoma/namada" -tag = "v0.27.0" +tag = "v0.28.0" features = ["std"] [dev-dependencies] diff --git a/crates/relayer/src/chain/namada.rs b/crates/relayer/src/chain/namada.rs index 1e5a7d4dac..b9853ac069 100644 --- a/crates/relayer/src/chain/namada.rs +++ b/crates/relayer/src/chain/namada.rs @@ -48,7 +48,7 @@ use namada_sdk::proof_of_stake::OwnedPosParams; use namada_sdk::queries::Client as SdkClient; use namada_sdk::wallet::Store; use namada_sdk::wallet::Wallet; -use namada_sdk::{rpc, NamadaImpl}; +use namada_sdk::{rpc, Namada, NamadaImpl}; use tendermint::block::Height as TmHeight; use tendermint::{node, Time}; use tendermint_light_client::types::LightBlock as TMLightBlock; @@ -90,13 +90,8 @@ pub mod wallet; pub struct NamadaChain { /// Reuse CosmosSdkConfig for tendermint's light clients config: CosmosSdkConfig, - rpc_client: HttpClient, - /// Wallet for Namada context just reading the added keys - wallet: Wallet, - /// Shielded context for Namada context - shielded_ctx: ShieldedContext, - /// Namada native token - native_token: Address, + /// Namada context + ctx: NamadaImpl, light_client: TmLightClient, rt: Arc, keybase: KeyRing, @@ -104,18 +99,6 @@ pub struct NamadaChain { } impl NamadaChain { - fn namada_ctx( - &mut self, - ) -> NamadaImpl<'_, HttpClient, wallet::NullWalletUtils, FsShieldedUtils, NullIo> { - NamadaImpl::native_new( - &self.rpc_client, - &mut self.wallet, - &mut self.shielded_ctx, - &NullIo, - self.native_token.clone(), - ) - } - fn config(&self) -> &CosmosSdkConfig { &self.config } @@ -130,7 +113,7 @@ impl NamadaChain { let node_info = self .rt - .block_on(fetch_node_info(&self.rpc_client, &self.config))?; + .block_on(fetch_node_info(self.ctx.client(), &self.config))?; let compat_mode = CompatMode::from_version(node_info.version).unwrap_or(CompatMode::V0_37); use crate::config::EventSourceMode as Mode; @@ -144,7 +127,7 @@ impl NamadaChain { ), Mode::Pull { interval } => EventSource::rpc( self.config.id.clone(), - self.rpc_client.clone(), + self.ctx.client().clone(), *interval, self.rt.clone(), ), @@ -173,7 +156,7 @@ impl NamadaChain { fn get_latest_block_time(&self) -> Result { let status = self .rt - .block_on(SdkClient::status(&self.rpc_client)) + .block_on(SdkClient::status(self.ctx.client())) .map_err(|e| Error::rpc(self.config.rpc_addr.clone(), e))?; Ok(status .sync_info @@ -244,12 +227,11 @@ impl ChainEndpoint for NamadaChain { ..config }; + let ctx = NamadaImpl::native_new(rpc_client, wallet, shielded_ctx, NullIo, native_token); + Ok(Self { config, - rpc_client, - wallet, - shielded_ctx, - native_token, + ctx, light_client, rt, keybase, @@ -263,7 +245,7 @@ impl ChainEndpoint for NamadaChain { fn health_check(&mut self) -> Result { self.rt - .block_on(SdkClient::health(&self.rpc_client)) + .block_on(SdkClient::health(self.ctx.client())) .map_err(|e| { Error::health_check_json_rpc( self.config.id.clone(), @@ -422,7 +404,7 @@ impl ChainEndpoint for NamadaChain { let owner = Address::decode(owner).map_err(|_| NamadaError::address_decode(owner.to_string()))?; - let default_token = self.native_token.to_string(); + let default_token = self.ctx.native_token().to_string(); let denom = denom.unwrap_or(&default_token); let token = Address::decode(denom).map_err(|_| NamadaError::address_decode(denom.to_string()))?; @@ -537,7 +519,7 @@ impl ChainEndpoint for NamadaChain { let status = self .rt - .block_on(SdkClient::status(&self.rpc_client)) + .block_on(SdkClient::status(self.ctx.client())) .map_err(|e| Error::rpc(self.config.rpc_addr.clone(), e))?; if status.sync_info.catching_up { @@ -1115,8 +1097,8 @@ impl ChainEndpoint for NamadaChain { }; let rpc_call = match height.value() { - 0 => SdkClient::latest_block(&self.rpc_client), - _ => SdkClient::block(&self.rpc_client, height), + 0 => SdkClient::latest_block(self.ctx.client()), + _ => SdkClient::block(self.ctx.client(), height), }; let response = self .rt diff --git a/crates/relayer/src/chain/namada/query.rs b/crates/relayer/src/chain/namada/query.rs index 5901387ebb..fed38a75c3 100644 --- a/crates/relayer/src/chain/namada/query.rs +++ b/crates/relayer/src/chain/namada/query.rs @@ -9,6 +9,7 @@ use namada_sdk::core::types::address::{Address, InternalAddress}; use namada_sdk::core::types::storage::{BlockHeight, Epoch, Key, PrefixValue}; use namada_sdk::queries::{Client as SdkClient, RPC}; use namada_sdk::rpc; +use namada_sdk::Namada; use tendermint::block::Height as TmHeight; use crate::chain::endpoint::ChainEndpoint; @@ -36,7 +37,7 @@ impl NamadaChain { let (value, proof) = self .rt .block_on(rpc::query_storage_value_bytes( - &self.rpc_client, + self.ctx.client(), &key, height, is_proven, @@ -60,7 +61,7 @@ impl NamadaChain { .block_on( // We can't use rpc::query_storage_prefix` because we need byte data RPC.shell() - .storage_prefix(&self.rpc_client, None, None, false, &prefix), + .storage_prefix(self.ctx.client(), None, None, false, &prefix), ) .map_err(NamadaError::query)?; Ok(response.data) @@ -68,7 +69,7 @@ impl NamadaChain { pub fn query_epoch(&self) -> Result { self.rt - .block_on(rpc::query_epoch(&self.rpc_client)) + .block_on(rpc::query_epoch(self.ctx.client())) .map_err(|e| Error::namada(NamadaError::namada(e))) } @@ -80,7 +81,7 @@ impl NamadaChain { let event = self .rt .block_on(RPC.shell().ibc_client_update( - &self.rpc_client, + self.ctx.client(), &request.client_id.as_str().parse().unwrap(), &height, )) @@ -113,7 +114,7 @@ impl NamadaChain { match self .rt .block_on(RPC.shell().applied( - &self.rpc_client, + self.ctx.client(), &tx_hash.try_into().expect("Invalid tx hash"), )) .map_err(NamadaError::query)? @@ -191,7 +192,7 @@ impl NamadaChain { .rt .block_on( RPC.shell().ibc_packet( - &self.rpc_client, + self.ctx.client(), &request .event_id .as_str() @@ -250,7 +251,7 @@ impl NamadaChain { .map_err(|_| Error::invalid_height_no_source())?; let response = self .rt - .block_on(SdkClient::block_results(&self.rpc_client, tm_height)) + .block_on(SdkClient::block_results(self.ctx.client(), tm_height)) .map_err(|e| Error::rpc(self.config.rpc_addr.clone(), e))?; let events = response diff --git a/crates/relayer/src/chain/namada/tx.rs b/crates/relayer/src/chain/namada/tx.rs index fd132bfe48..4acf1dda18 100644 --- a/crates/relayer/src/chain/namada/tx.rs +++ b/crates/relayer/src/chain/namada/tx.rs @@ -10,7 +10,6 @@ use namada_sdk::borsh::BorshDeserialize; use namada_sdk::core::ledger::parameters::storage as parameter_storage; use namada_sdk::core::types::address::{Address, ImplicitAddress}; use namada_sdk::core::types::chain::ChainId; -use namada_sdk::core::types::key::RefTo; use namada_sdk::core::types::transaction::GasLimit; use namada_sdk::{signing, tx, Namada}; use tendermint_rpc::endpoint::broadcast::tx_sync::Response; @@ -44,7 +43,7 @@ impl NamadaChain { let gas_limit = GasLimit::try_from_slice(&value).map_err(NamadaError::borsh_decode)?; let namada_key = self.get_key()?; - let relayer_key_pair = namada_key.secret_key; + let relayer_public_key = namada_key.secret_key.to_public(); let relayer_addr = namada_key.address; let tx_args = TxArgs { @@ -57,7 +56,7 @@ impl NamadaChain { ledger_address: (), initialized_account_alias: None, wallet_alias_force: false, - wrapper_fee_payer: Some(relayer_key_pair.clone()), + wrapper_fee_payer: Some(relayer_public_key.clone()), fee_amount: None, fee_token, fee_unshield: None, @@ -65,17 +64,15 @@ impl NamadaChain { expiration: None, disposable_signing_key: false, chain_id: Some(chain_id), - signing_keys: vec![relayer_key_pair], + signing_keys: vec![relayer_public_key], signatures: vec![], tx_reveal_code_path: PathBuf::from(tx::TX_REVEAL_PK), - verification_key: None, password: None, use_device: false, }; let rt = self.rt.clone(); rt.block_on(self.submit_reveal_aux(&tx_args, &relayer_addr))?; - let namada_ctx = self.namada_ctx(); let args = TxCustom { tx: tx_args.clone(), code_path: Some(PathBuf::from(tx::TX_IBC_WASM)), @@ -84,13 +81,16 @@ impl NamadaChain { owner: relayer_addr.clone(), }; let (mut tx, signing_data, _epoch) = rt - .block_on(args.build(&namada_ctx)) - .map_err(NamadaError::namada)?; - rt.block_on(namada_ctx.sign(&mut tx, &args.tx, signing_data, signing::default_sign)) + .block_on(args.build(&self.ctx)) .map_err(NamadaError::namada)?; + rt.block_on( + self.ctx + .sign(&mut tx, &args.tx, signing_data, signing::default_sign, ()), + ) + .map_err(NamadaError::namada)?; let decrypted_hash = tx.raw_header_hash().to_string(); let response = rt - .block_on(namada_ctx.submit(tx, &args.tx)) + .block_on(self.ctx.submit(tx, &args.tx)) .map_err(NamadaError::namada)?; match response { @@ -147,26 +147,26 @@ impl NamadaChain { async fn submit_reveal_aux(&mut self, args: &TxArgs, address: &Address) -> Result<(), Error> { if let Address::Implicit(ImplicitAddress(pkh)) = address { - let key = self - .wallet - .find_key_by_pkh(pkh, args.clone().password) + let public_key = self + .ctx + .wallet() + .await + .find_public_key(pkh.to_string()) .map_err(|e| NamadaError::namada(namada_sdk::error::Error::Other(e.to_string())))?; - let public_key = key.ref_to(); - if tx::is_reveal_pk_needed(&self.rpc_client, address, args.force) + if tx::is_reveal_pk_needed(self.ctx.client(), address, args.force) .await .map_err(NamadaError::namada)? { - let namada_ctx = self.namada_ctx(); let (mut tx, signing_data, _epoch) = - tx::build_reveal_pk(&namada_ctx, args, &public_key) + tx::build_reveal_pk(&self.ctx, args, &public_key) .await .map_err(NamadaError::namada)?; - namada_ctx - .sign(&mut tx, args, signing_data, signing::default_sign) + self.ctx + .sign(&mut tx, args, signing_data, signing::default_sign, ()) .await .map_err(NamadaError::namada)?; - namada_ctx + self.ctx .submit(tx, args) .await .map_err(NamadaError::namada)?;