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: rust implementation for some of the Cairo types #18

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
117 changes: 117 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions ampd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ serde_json = { workspace = true }
serde_with = "3.2.0"
service-registry = { workspace = true }
sha3 = { workspace = true }
starknet-core = "0.10.0"
starknet-providers = "0.10.0"
sui-json-rpc-types = { git = "https://github.com/mystenlabs/sui", tag = "mainnet-v1.14.2" }
sui-types = { git = "https://github.com/mystenlabs/sui", features = ["test-utils"], tag = "mainnet-v1.14.2" }
# Need to switch to our own fork of tendermint and tendermint-rpc due to event attribute value being nullable.
Expand Down
27 changes: 14 additions & 13 deletions ampd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,28 @@ use std::pin::Pin;
use std::time::Duration;

use block_height_monitor::BlockHeightMonitor;
use broadcaster::accounts::account;
use broadcaster::Broadcaster;
use connection_router_api::ChainName;
use cosmos_sdk_proto::cosmos::{
auth::v1beta1::query_client::QueryClient, tx::v1beta1::service_client::ServiceClient,
};
use cosmos_sdk_proto::cosmos::auth::v1beta1::query_client::QueryClient;
use cosmos_sdk_proto::cosmos::tx::v1beta1::service_client::ServiceClient;
use error_stack::{report, FutureExt, Result, ResultExt};
use event_processor::EventHandler;
use events::Event;
use evm::finalizer::{pick, Finalization};
use evm::json_rpc::EthereumClient;
use queue::queued_broadcaster::{QueuedBroadcaster, QueuedBroadcasterDriver};
use state::StateUpdater;
use thiserror::Error;
use tofnd::grpc::{MultisigClient, SharableEcdsaClient};
use tokio::signal::unix::{signal, SignalKind};
use tokio::sync::oneshot;
use tokio_stream::Stream;
use tokio_util::sync::CancellationToken;
use tracing::info;

use crate::asyncutil::task::{CancellableTask, TaskError, TaskGroup};
use broadcaster::{accounts::account, Broadcaster};
use event_processor::EventHandler;
use events::Event;
use queue::queued_broadcaster::{QueuedBroadcaster, QueuedBroadcasterDriver};
use state::StateUpdater;
use tofnd::grpc::{MultisigClient, SharableEcdsaClient};
use tracing::{info, warn};
use types::TMAddress;

use crate::asyncutil::task::{CancellableTask, TaskError, TaskGroup};
use crate::config::Config;
use crate::state::State;

Expand All @@ -41,6 +40,7 @@ mod handlers;
mod health_check;
mod json_rpc;
mod queue;
pub mod starknet;
pub mod state;
mod sui;
mod tm_client;
Expand Down Expand Up @@ -431,7 +431,8 @@ where
broadcaster.run().change_context(Error::Broadcaster)
}))
.add_task(CancellableTask::create(|_| async move {
// assert: the state updater only stops when all handlers that are updating their states have stopped
// assert: the state updater only stops when all handlers that are updating
// their states have stopped
state_tx
.send(state_updater.run().await)
.map_err(|_| report!(Error::ReturnState))
Expand Down
1 change: 1 addition & 0 deletions ampd/src/starknet/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod types;
Loading
Loading