Skip to content

Commit

Permalink
refactor(ampd): switch from horizon to rpc client for Stellar (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
haiyizxx authored Nov 14, 2024
1 parent 2561ddb commit fc6a657
Show file tree
Hide file tree
Showing 13 changed files with 259 additions and 204 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[Full Changelog](https://github.com/axelarnetwork/axelar-amplifier/compare/ampd-v1.2.0..HEAD)

- Change event index in message ids from u32 to u64. Emit message id from voting verifier [#666](https://github.com/axelarnetwork/axelar-amplifier/pull/666)
- Ampd switch from horizon to RPC client for Stellar verifier [#694](https://github.com/axelarnetwork/axelar-amplifier/pull/694)

#### v1.3.0 Migration Notes

Expand Down
155 changes: 110 additions & 45 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 ampd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ serde_with = "3.2.0"
service-registry-api = { workspace = true }
sha3 = { workspace = true }
stellar = { workspace = true }
stellar-rs = "0.3.2"
stellar-rpc-client = "21.4.0"
stellar-xdr = { workspace = true, features = ["serde_json"] }
sui-gateway = { workspace = true }
sui-json-rpc-types = { git = "https://github.com/mystenlabs/sui", tag = "mainnet-v1.26.2" }
Expand Down
8 changes: 4 additions & 4 deletions ampd/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ mod tests {
[[handlers]]
type = 'StellarMsgVerifier'
cosmwasm_contract = '{}'
http_url = 'http://localhost:8000'
rpc_url = 'http://localhost:7545'
[[handlers]]
type = 'StellarVerifierSetVerifier'
cosmwasm_contract = '{}'
http_url = 'http://localhost:8000'
rpc_url = 'http://localhost:7545'
",
TMAddress::random(PREFIX),
TMAddress::random(PREFIX),
Expand Down Expand Up @@ -342,13 +342,13 @@ mod tests {
cosmwasm_contract: TMAddress::from(
AccountId::new("axelar", &[0u8; 32]).unwrap(),
),
http_url: Url::from_str("http://127.0.0.1").unwrap(),
rpc_url: Url::from_str("http://127.0.0.1").unwrap(),
},
HandlerConfig::StellarVerifierSetVerifier {
cosmwasm_contract: TMAddress::from(
AccountId::new("axelar", &[0u8; 32]).unwrap(),
),
http_url: Url::from_str("http://127.0.0.1").unwrap(),
rpc_url: Url::from_str("http://127.0.0.1").unwrap(),
},
],
..Config::default()
Expand Down
12 changes: 6 additions & 6 deletions ampd/src/handlers/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ pub enum Config {
},
StellarMsgVerifier {
cosmwasm_contract: TMAddress,
http_url: Url,
rpc_url: Url,
},
StellarVerifierSetVerifier {
cosmwasm_contract: TMAddress,
http_url: Url,
rpc_url: Url,
},
}

Expand Down Expand Up @@ -275,11 +275,11 @@ mod tests {
let configs = vec![
Config::StellarMsgVerifier {
cosmwasm_contract: TMAddress::random(PREFIX),
http_url: "http://localhost:8080/".parse().unwrap(),
rpc_url: "http://localhost:7545/".parse().unwrap(),
},
Config::StellarMsgVerifier {
cosmwasm_contract: TMAddress::random(PREFIX),
http_url: "http://localhost:8080/".parse().unwrap(),
rpc_url: "http://localhost:7545/".parse().unwrap(),
},
];

Expand All @@ -292,11 +292,11 @@ mod tests {
let configs = vec![
Config::StellarVerifierSetVerifier {
cosmwasm_contract: TMAddress::random(PREFIX),
http_url: "http://localhost:8080/".parse().unwrap(),
rpc_url: "http://localhost:7545/".parse().unwrap(),
},
Config::StellarVerifierSetVerifier {
cosmwasm_contract: TMAddress::random(PREFIX),
http_url: "http://localhost:8080/".parse().unwrap(),
rpc_url: "http://localhost:7545/".parse().unwrap(),
},
];

Expand Down
4 changes: 2 additions & 2 deletions ampd/src/handlers/stellar_verify_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use voting_verifier::msg::ExecuteMsg;
use crate::event_processor::EventHandler;
use crate::handlers::errors::Error;
use crate::handlers::errors::Error::DeserializeEvent;
use crate::stellar::http_client::Client;
use crate::stellar::rpc_client::Client;
use crate::stellar::verifier::verify_message;
use crate::types::TMAddress;

Expand Down Expand Up @@ -185,7 +185,7 @@ mod tests {
use super::PollStartedEvent;
use crate::event_processor::EventHandler;
use crate::handlers::tests::{into_structured_event, participants};
use crate::stellar::http_client::Client;
use crate::stellar::rpc_client::Client;
use crate::types::{EVMAddress, Hash, TMAddress};
use crate::PREFIX;

Expand Down
Loading

0 comments on commit fc6a657

Please sign in to comment.