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

feat: starknet GMP #731

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
32 changes: 24 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[workspace]
members = [
"ampd",
"contracts/*",
"external-gateways/*",
"integration-tests",
"packages/*"
"ampd",
"contracts/*",
"external-gateways/*",
"integration-tests",
"packages/*",
]
resolver = "2"

Expand All @@ -13,8 +13,12 @@ rust-version = "1.78.0" # be sure there is an optimizer release supporting this
edition = "2021"

[workspace.dependencies]
alloy-primitives = { version = "0.7.6", default-features = false, features = ["std"] }
alloy-sol-types = { version = "0.7.6", default-features = false, features = ["std"] }
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"
assert_ok = "1.0"
axelar-wasm-std = { version = "^1.0.0", path = "packages/axelar-wasm-std" }
Expand All @@ -31,7 +35,9 @@ cw-storage-plus = { version = "1.2.0", features = ["iterator", "macro"] }
cw2 = "1.1.0"
ed25519-dalek = { version = "2.1.1", default-features = false }
error-stack = { version = "0.4.0", features = ["eyre"] }
ethers-contract = { version = "2.0.14", default-features = false, features = ["abigen"] }
ethers-contract = { version = "2.0.14", default-features = false, features = [
"abigen",
] }
ethers-core = "2.0.14"
events = { version = "^1.0.0", path = "packages/events" }
events-derive = { version = "^1.0.0", path = "packages/events-derive" }
Expand Down Expand Up @@ -69,6 +75,11 @@ stellar-xdr = { version = "21.2.0" }
strum = { version = "0.25", default-features = false, features = ["derive"] }
sui-gateway = { version = "^1.0.0", path = "packages/sui-gateway" }
sui-types = { version = "^1.0.0", path = "packages/sui-types" }
starknet-checked-felt = { version = "^1.0.0", path = "packages/starknet-checked-felt" }
starknet-types-core = { version = "0.1.7" }
starknet-types = { version = "^1.0.0", path = "packages/starknet-types" }
starknet-core = "0.12.0"
starknet-providers = "0.12.0"
syn = "2.0.68"
thiserror = "1.0.61"
tofn = { version = "1.1" }
Expand All @@ -77,6 +88,11 @@ tokio-stream = "0.1.11"
tokio-util = "0.7.11"
voting-verifier = { version = "^1.1.0", path = "contracts/voting-verifier" }
axelar-core-std = { version = "^1.0.0", path = "packages/axelar-core-std" }
# Async
futures-concurrency = "7.4"
futures-util = "0.3"
futures = "0.3"
async-trait = "0"

[workspace.lints.clippy]
arithmetic_side_effects = "deny"
Expand Down
19 changes: 15 additions & 4 deletions ampd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ error-stack = { workspace = true }
ethers-contract = { workspace = true }
ethers-core = { workspace = true }
ethers-providers = { version = "2.0.13", default-features = false, features = [
"rustls",
"rustls",
] }
events = { workspace = true }
events-derive = { workspace = true }
Expand All @@ -40,7 +40,9 @@ move-core-types = { git = "https://github.com/mystenlabs/sui", tag = "testnet-v1
multisig = { workspace = true, features = ["library"] }
multiversx-sdk = "0.6.1"
num-traits = { workspace = true }
openssl = { version = "0.10.35", features = ["vendored"] } # Needed to make arm compilation work by forcing vendoring
openssl = { version = "0.10.35", features = [
"vendored",
] } # Needed to make arm compilation work by forcing vendoring
prost = "0.11.9"
prost-types = "0.11.9"
report = { workspace = true }
Expand All @@ -63,7 +65,7 @@ sui-types = { git = "https://github.com/mystenlabs/sui", tag = "testnet-v1.39.1"
# The fix for the issue is at https://github.com/axelarnetwork/tendermint-rs/commit/e97033e20e660a7e707ea86db174ec047bbba50d.
tendermint = { git = "https://github.com/axelarnetwork/tendermint-rs.git", branch = "v0.33.x" }
tendermint-rpc = { git = "https://github.com/axelarnetwork/tendermint-rs.git", branch = "v0.33.x", features = [
"http-client",
"http-client",
] }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["signal"] }
Expand All @@ -73,13 +75,22 @@ toml = "0.5.9"
tonic = "0.9.2"
tracing = { version = "0.1.37", features = ["valuable", "log"] }
tracing-core = { version = "0.1.30", features = ["valuable"] }
tracing-subscriber = { version = "0.3.16", features = ["json", "valuable", "env-filter"] }
tracing-subscriber = { version = "0.3.16", features = [
"json",
"valuable",
"env-filter",
] }
typed-builder = "0.18.2"
url = "2.3.1"
valuable = { version = "0.1.0", features = ["derive"] }
valuable-serde = { version = "0.1.0", features = ["std"] }
voting-verifier = { workspace = true }

starknet-core = { workspace = true }
starknet-providers = { workspace = true }
starknet-types = { workspace = true }
starknet-checked-felt = { workspace = true }

[dev-dependencies]
ed25519-dalek = { workspace = true, features = ["rand_core"] }
elliptic-curve = "0.13.5"
Expand Down
21 changes: 21 additions & 0 deletions ampd/src/handlers/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ pub enum Config {
cosmwasm_contract: TMAddress,
rpc_url: Url,
},
StarknetMsgVerifier {
cosmwasm_contract: TMAddress,
rpc_url: Url,
},
}

fn validate_starknet_msg_verifier_config<'de, D>(configs: &[Config]) -> Result<(), D::Error>
where
D: Deserializer<'de>,
{
match configs
.iter()
.filter(|config| matches!(config, Config::StarknetMsgVerifier { .. }))
.count()
{
count if count > 1 => Err(de::Error::custom(
"only one Starknet msg verifier config is allowed",
)),
_ => Ok(()),
}
}

fn validate_evm_verifier_set_verifier_configs<'de, D>(configs: &[Config]) -> Result<(), D::Error>
Expand Down Expand Up @@ -133,6 +153,7 @@ where
{
let configs: Vec<Config> = Deserialize::deserialize(deserializer)?;

validate_starknet_msg_verifier_config::<D>(&configs)?;
validate_evm_msg_verifier_configs::<D>(&configs)?;
validate_evm_verifier_set_verifier_configs::<D>(&configs)?;

Expand Down
2 changes: 2 additions & 0 deletions ampd/src/handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ pub mod evm_verify_verifier_set;
pub mod multisig;
pub mod mvx_verify_msg;
pub mod mvx_verify_verifier_set;
pub mod starknet_verify_msg;
pub mod starknet_verify_verifier_set;
pub(crate) mod stellar_verify_msg;
pub(crate) mod stellar_verify_verifier_set;
pub mod sui_verify_msg;
Expand Down
Loading