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: Aptos Settelement Layer #7

Merged
merged 13 commits into from
Aug 21, 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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ionia"]
path = ionia
url = git@github.com:sota-zk-labs/ionia.git
20 changes: 18 additions & 2 deletions Cargo.lock

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

34 changes: 19 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[workspace]
resolver = "2"
members = [
"crates/orchestrator",
"crates/da-clients/da-client-interface",
"crates/da-clients/ethereum",
"crates/prover-services/prover-client-interface",
"crates/prover-services/gps-fact-checker",
"crates/prover-services/sharp-service",
"crates/utils",
"crates/settlement-clients/settlement-client-interface",
"crates/settlement-clients/ethereum",
"crates/settlement-clients/starknet",
"e2e-tests",
"crates/settlement-clients/aptos",
"crates/orchestrator",
"crates/da-clients/da-client-interface",
"crates/da-clients/ethereum",
"crates/prover-services/prover-client-interface",
"crates/prover-services/gps-fact-checker",
"crates/prover-services/sharp-service",
"crates/utils",
"crates/settlement-clients/settlement-client-interface",
"crates/settlement-clients/ethereum",
"crates/settlement-clients/starknet",
"crates/settlement-clients/aptos",
"e2e-tests",
]

[workspace.package]
Expand Down Expand Up @@ -55,15 +55,16 @@ arc-swap = { version = "1.7.1" }
num-traits = "0.2"
lazy_static = "1.4.0"
stark_evm_adapter = "0.1.1"
hex = "0.4"
hex = "0.4.3"
itertools = "0.13.0"
mockall = "0.13.0"
testcontainers = "0.21.1"
once_cell = "1.19.0"

# Cairo VM
cairo-vm = { version = "1.0.0-rc5", features = [
"extensive_hints",
"cairo-1-hints",
"extensive_hints",
"cairo-1-hints",
] }

# TODO: we currently use the Moonsong fork & the os-output-serde branch so we
Expand Down Expand Up @@ -91,6 +92,9 @@ sharp-service = { path = "crates/prover-services/sharp-service" }
orchestrator = { path = "crates/orchestrator" }

aptos-sdk = { git = "https://github.com/aptos-labs/aptos-core" }
aptos-testcontainer = { git = "https://github.com/sota-zk-labs/aptos-testcontainer", branch = "master", features = [
"testing",
] }

[patch.crates-io]
merlin = { git = "https://github.com/aptos-labs/merlin" }
Expand Down
9 changes: 5 additions & 4 deletions crates/settlement-clients/aptos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ edition.workspace = true
authors.workspace = true

[dependencies]
alloy = { git = "https://github.com/alloy-rs/alloy", rev = "68952c0" }
alloy = { workspace = true }
anyhow = "1.0.86"
aptos-sdk = { workspace = true }
aptos-testcontainer = { workspace = true }
async-trait = { workspace = true }
color-eyre = { workspace = true }
dotenvy = { workspace = true }
hex = "0.4.3"
hex = { workspace = true }
mockall = { workspace = true }
once_cell = "1.19.0"
once_cell = { workspace = true }
settlement-client-interface = { workspace = true }
tokio = { workspace = true }
url = "2.5.2"
utils = { workspace = true }
5 changes: 2 additions & 3 deletions crates/settlement-clients/aptos/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use dotenvy::dotenv;

use settlement_client_interface::SettlementConfig;
use utils::env_utils::get_env_var_or_panic;

pub struct AptosSettlementConfig {
pub node_url: String,
pub private_key: String,
pub account_address: String,
pub module_address: String,
pub chain_id: String,
}
Expand All @@ -15,9 +15,8 @@ impl SettlementConfig for AptosSettlementConfig {
dotenv().expect("Failed to load .env file");
let node_url = get_env_var_or_panic("APTOS_NODE_URL");
let private_key = get_env_var_or_panic("APTOS_PRIVATE_KEY");
let account_address = get_env_var_or_panic("APTOS_ACCOUNT_ADDRESS");
let module_address = get_env_var_or_panic("APTOS_MODULE_ADDRESS");
let chain_id = get_env_var_or_panic("CHAIN_ID");
AptosSettlementConfig { chain_id, node_url, private_key, account_address, module_address }
AptosSettlementConfig { chain_id, node_url, private_key, module_address }
}
}
10 changes: 0 additions & 10 deletions crates/settlement-clients/aptos/src/conversion.rs

This file was deleted.

25 changes: 25 additions & 0 deletions crates/settlement-clients/aptos/src/helper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use std::time::SystemTime;

use aptos_sdk::transaction_builder::TransactionBuilder;
use aptos_sdk::types::chain_id::ChainId;
use aptos_sdk::types::LocalAccount;
use aptos_sdk::types::transaction::{SignedTransaction, TransactionPayload};

pub(crate) fn build_transaction(
payload: TransactionPayload,
sender: &LocalAccount,
chain_id: ChainId,
) -> SignedTransaction {
let i = sender.increment_sequence_number();
let tx = TransactionBuilder::new(
payload,
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs() + 60,
chain_id,
)
.sender(sender.address())
.sequence_number(i)
.max_gas_amount(100000)
zk-steve marked this conversation as resolved.
Show resolved Hide resolved
.gas_unit_price(100)
.build();
sender.sign_transaction(tx)
}
Loading