Skip to content

Commit

Permalink
keep only MessageIdFormat. Make a generic bech32m MessageIdFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
anstylian committed Nov 20, 2024
1 parent b342260 commit 18b845d
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 393 deletions.
18 changes: 2 additions & 16 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ rust-version = "1.78.0" # be sure there is an optimizer release supporting this
edition = "2021"

[workspace.dependencies]
aleo-types = { path = "packages/aleo-types" }
alloy-primitives = { version = "0.7.6", default-features = false, features = ["std"] }
alloy-sol-types = { version = "0.7.6", default-features = false, features = ["std"] }
anyhow = "1.0.89"
Expand Down
1 change: 0 additions & 1 deletion ampd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ rust-version = { workspace = true }
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
aleo-types = { workspace = true }
async-trait = "0.1.59"
axelar-wasm-std = { workspace = true }
axum = "0.7.5"
Expand Down
2 changes: 1 addition & 1 deletion contracts/voting-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ optimize = """docker run --rm -v "$(pwd)":/code \
"""

[dependencies]
aleo-types = { workspace = true }
axelar-wasm-std = { workspace = true, features = ["derive"] }
client = { workspace = true }
cosmwasm-schema = { workspace = true }
Expand All @@ -54,6 +53,7 @@ thiserror = { workspace = true }
[dev-dependencies]
alloy-primitives = { version = "0.7.7", features = ["getrandom"] }
assert_ok = { workspace = true }
bech32 = { workspace = true }
cw-multi-test = "0.15.1"
goldie = { workspace = true }
integration-tests = { workspace = true }
Expand Down
12 changes: 11 additions & 1 deletion contracts/voting-verifier/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ mod test {
assert_err_contains, err_contains, nonempty, MajorityThreshold, Threshold,
VerificationStatus,
};
use bech32::{Bech32m, Hrp};
use cosmwasm_std::testing::{
mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage,
};
Expand Down Expand Up @@ -263,7 +264,16 @@ mod test {
.to_string()
.parse()
.unwrap(),
MessageIdFormat::AleoTransaction => unreachable!(),
MessageIdFormat::Bech32m => {
let data = format!("{id}-{index}");
let prefix = "bech32m";
let hrp = Hrp::parse(prefix).expect("valid hrp");
bech32::encode::<Bech32m>(hrp, data.as_bytes())
.unwrap()
.to_string()
.parse()
.unwrap()
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions contracts/voting-verifier/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::str::FromStr;
use std::vec::Vec;

use axelar_wasm_std::msg_id::{
AleoMessageId, Base58SolanaTxSignatureAndEventIndex, Base58TxDigestAndEventIndex, HexTxHash,
Base58SolanaTxSignatureAndEventIndex, Base58TxDigestAndEventIndex, Bech32mFormat, HexTxHash,
HexTxHashAndEventIndex, MessageIdFormat,
};
use axelar_wasm_std::voting::{PollId, Vote};
Expand Down Expand Up @@ -186,10 +186,10 @@ fn parse_message_id(

Ok((id.tx_hash_as_hex(), 0))
}
MessageIdFormat::AleoTransaction => {
let aleo_message_id = AleoMessageId::from_str(message_id)
MessageIdFormat::Bech32m => {
let bech32m_message_id = Bech32mFormat::from_str(message_id)
.map_err(|_| ContractError::InvalidMessageID(message_id.into()))?;
Ok((aleo_message_id.to_string().try_into()?, 0))
Ok((bech32m_message_id.to_string().try_into()?, 0))
}
}
}
Expand Down
19 changes: 0 additions & 19 deletions packages/aleo-types/Cargo.toml

This file was deleted.

68 changes: 0 additions & 68 deletions packages/aleo-types/src/address.rs

This file was deleted.

38 changes: 0 additions & 38 deletions packages/aleo-types/src/lib.rs

This file was deleted.

67 changes: 0 additions & 67 deletions packages/aleo-types/src/transaction.rs

This file was deleted.

67 changes: 0 additions & 67 deletions packages/aleo-types/src/transition.rs

This file was deleted.

Loading

0 comments on commit 18b845d

Please sign in to comment.