Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d55f58e
remove NetworkArg type
PatStiles Dec 10, 2024
bd1139b
add lock
PatStiles Dec 10, 2024
bab051a
pass by copy
PatStiles Jan 2, 2025
8c4049a
remove need for ValueEnum
PatStiles Jan 7, 2025
a289328
fmt + clippy
PatStiles Jan 7, 2025
82fa721
move values to constants
PatStiles Jan 8, 2025
510f6e2
add custom network arg
PatStiles Jan 8, 2025
9b2d37b
fmt
PatStiles Jan 8, 2025
a320ab0
change error messages
PatStiles Jan 8, 2025
587a5fa
enforce custom in right place + fix
PatStiles Jan 10, 2025
1a4ef29
remove clap from cargo.toml
PatStiles Jan 9, 2025
0ac4db3
deprecate batcher_url
PatStiles Jan 10, 2025
c765ecf
deprecate more
PatStiles Jan 10, 2025
2f6da7c
feat: better implementation of this pr
uri-99 Jan 15, 2025
0dab9a1
Merge branch 'staging' into feat/deprecate-batcher-url
uri-99 Jan 16, 2025
ec9685d
chore: cargo fmt
uri-99 Jan 16, 2025
9da8dcc
feat: migrate rust task sender
uri-99 Jan 16, 2025
5873fa4
chore: docs
uri-99 Jan 16, 2025
ceafba5
chore: cargo fmt
uri-99 Jan 16, 2025
ab87086
chore: cargo clippy
uri-99 Jan 16, 2025
51f576a
chore: add error failure on CI
uri-99 Jan 17, 2025
79a3b8a
chore: fix comment
uri-99 Jan 17, 2025
d7dc1c1
fix: debugging error in CI
uri-99 Jan 17, 2025
ce35d41
fix(wip): print .json contents
uri-99 Jan 17, 2025
f05869e
fix: prints
uri-99 Jan 17, 2025
1c3b245
fix: revert CI changes, they are in another pr
uri-99 Jan 17, 2025
8e582ca
Merge branch 'pull_fixes_testnet_17_01' into feat/deprecate-batcher-url
uri-99 Jan 17, 2025
5d32849
fix: docs
uri-99 Jan 17, 2025
5447237
chore: cargo fmt
uri-99 Jan 17, 2025
00a252c
fix: batcher urls
JuArce Jan 17, 2025
cc84f6e
fix: missing new line
JuArce Jan 17, 2025
5bd5fb9
fix: remove mix.lock changes
JuArce Jan 17, 2025
5a5447c
fix: remove mix.lock changes
JuArce Jan 17, 2025
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
13 changes: 6 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,15 @@ task_sender_send_infinite_proofs_devnet:
cargo run --release -- send-infinite-proofs \
--burst-size $(BURST_SIZE) --burst-time-secs $(BURST_TIME_SECS) \
--eth-rpc-url http://localhost:8545 \
--batcher-url ws://localhost:8080 \
--network devnet \
--proofs-dirpath $(CURDIR)/scripts/test_files/task_sender/proofs \
--private-keys-filepath $(CURDIR)/batcher/aligned-task-sender/wallets/devnet

task_sender_test_connections_devnet:
@cd batcher/aligned-task-sender && \
cargo run --release -- test-connections \
--batcher-url ws://localhost:8080 \
--num-senders $(NUM_SENDERS)
--num-senders $(NUM_SENDERS) \
--network devnet

# ===== HOLESKY-STAGE =====
task_sender_generate_and_fund_wallets_holesky_stage:
Expand All @@ -532,21 +531,21 @@ task_sender_send_infinite_proofs_holesky_stage:
cargo run --release -- send-infinite-proofs \
--burst-size $(BURST_SIZE) --burst-time-secs $(BURST_TIME_SECS) \
--eth-rpc-url https://ethereum-holesky-rpc.publicnode.com \
--batcher-url wss://stage.batcher.alignedlayer.com \
--network holesky-stage \
--proofs-dirpath $(CURDIR)/scripts/test_files/task_sender/proofs \
--private-keys-filepath $(CURDIR)/batcher/aligned-task-sender/wallets/holesky-stage

task_sender_test_connections_holesky_stage:
@cd batcher/aligned-task-sender && \
cargo run --release -- test-connections \
--batcher-url wss://stage.batcher.alignedlayer.com \
--num-senders $(NUM_SENDERS)
--num-senders $(NUM_SENDERS) \
--network holesky-stage

__UTILS__:
aligned_get_user_balance_devnet:
@cd batcher/aligned/ && cargo run --release -- get-user-balance \
--user_addr $(USER_ADDR)
--user_addr $(USER_ADDR) \
--network devnet

aligned_get_user_balance_holesky:
@cd batcher/aligned/ && cargo run --release -- get-user-balance \
Expand Down
1 change: 0 additions & 1 deletion alerts/.env.devnet
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# Variables for sender_with_alert.sh
REPETITIONS=8
SENDER_ADDRESS=0x14dC79964da2C08b23698B3D3cc7Ca32193d9955
BATCHER_URL=ws://localhost:8080
RPC_URL=http://localhost:8545
EXPLORER_URL=http://localhost:3000
NETWORK=devnet
Expand Down
1 change: 0 additions & 1 deletion alerts/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ NETWORK=<MAINNET|HOLESKY|STAGE>
# Variables for sender_with_alert.sh
REPETITIONS=<REPETITIONS>
SENDER_ADDRESS=<YOUR_SENDER_ADDRESS>
BATCHER_URL=<BATCHER_URL>
RPC_URL=<RPC_BASE_URL>
EXPLORER_URL=<EXPLORER_BASE_URL>
NETWORK=<NETWORK>
Expand Down
4 changes: 1 addition & 3 deletions alerts/sender_with_alert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# - REPETITIONS
# - EXPLORER_URL
# - SENDER_ADDRESS
# - BATCHER_URL
# - RPC_URL
# - EXPLORER_URL
# - NETWORK
Expand Down Expand Up @@ -92,7 +91,7 @@ do
mkdir -p ./scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs

## Generate Proof
nonce=$(aligned get-user-nonce --batcher_url $BATCHER_URL --user_addr $SENDER_ADDRESS 2>&1 | awk '{print $9}')
nonce=$(aligned get-user-nonce --network $NETWORK --user_addr $SENDER_ADDRESS 2>&1 | awk '{print $9}')
x=$((nonce + 1)) # So we don't have any issues with nonce = 0
echo "Generating proof $x != 0"
go run ./scripts/test_files/gnark_groth16_bn254_infinite_script/cmd/main.go $x
Expand All @@ -108,7 +107,6 @@ do
--proof_generator_addr $SENDER_ADDRESS \
--private_key $PRIVATE_KEY \
--rpc_url $RPC_URL \
--batcher_url $BATCHER_URL \
--network $NETWORK \
--max_fee 0.004ether \
2>&1)
Expand Down
5 changes: 1 addition & 4 deletions batcher/aligned-batcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1522,10 +1522,7 @@ impl Batcher {
Ok(())
}
Err(e) => {
error!(
"Failed to send batch to contract, batch will be lost: {:?}",
e
);
error!("Failed to send batch to contract: {:?}", e);

self.metrics.reverted_batches.inc();
Err(e)
Expand Down
2 changes: 1 addition & 1 deletion batcher/aligned-sdk/src/communication/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub async fn await_batch_verification(
network: Network,
) -> Result<(), errors::SubmitError> {
for _ in 0..RETRIES {
if is_proof_verified(aligned_verification_data, network, rpc_url)
if is_proof_verified(aligned_verification_data, network.clone(), rpc_url)
.await
.is_ok_and(|r| r)
{
Expand Down
22 changes: 22 additions & 0 deletions batcher/aligned-sdk/src/core/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,25 @@ pub const BUMP_MIN_RETRY_DELAY: u64 = 500; // milliseconds
pub const BUMP_MAX_RETRIES: usize = 33; // ~ 1 day
pub const BUMP_BACKOFF_FACTOR: f32 = 2.0;
pub const BUMP_MAX_RETRY_DELAY: u64 = 3600; // seconds

/// NETWORK ADDRESSES ///
/// BatcherPaymentService
pub const BATCHER_PAYMENT_SERVICE_ADDRESS_DEVNET: &str =
"0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650";
pub const BATCHER_PAYMENT_SERVICE_ADDRESS_HOLESKY: &str =
"0x815aeCA64a974297942D2Bbf034ABEe22a38A003";
pub const BATCHER_PAYMENT_SERVICE_ADDRESS_HOLESKY_STAGE: &str =
"0x7577Ec4ccC1E6C529162ec8019A49C13F6DAd98b";
pub const BATCHER_PAYMENT_SERVICE_ADDRESS_MAINNET: &str =
"0xb0567184A52cB40956df6333510d6eF35B89C8de";
/// AlignedServiceManager
pub const ALIGNED_SERVICE_MANAGER_DEVNET: &str = "0x851356ae760d987E095750cCeb3bC6014560891C";
pub const ALIGNED_SERVICE_MANAGER_HOLESKY: &str = "0x58F280BeBE9B34c9939C3C39e0890C81f163B623";
pub const ALIGNED_SERVICE_MANAGER_HOLESKY_STAGE: &str =
"0x9C5231FC88059C086Ea95712d105A2026048c39B";
pub const ALIGNED_SERVICE_MANAGER_MAINNET: &str = "0xeF2A435e5EE44B2041100EF8cbC8ae035166606c";
/// Batcher URL's
pub const BATCHER_URL_DEVNET: &str = "ws://localhost:8080";
pub const BATCHER_URL_HOLESKY: &str = "wss://batcher.alignedlayer.com";
pub const BATCHER_URL_HOLESKY_STAGE: &str = "wss://stage.batcher.alignedlayer.com";
pub const BATCHER_URL_MAINNET: &str = "wss://mainnet.batcher.alignedlayer.com";
54 changes: 40 additions & 14 deletions batcher/aligned-sdk/src/core/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@ use ethers::types::transaction::eip712::Eip712;
use ethers::types::transaction::eip712::Eip712Error;
use ethers::types::Address;
use ethers::types::Signature;
use ethers::types::H160;
use ethers::types::U256;
use lambdaworks_crypto::merkle_tree::{
merkle::MerkleTree, proof::Proof, traits::IsMerkleTreeBackend,
};
use serde::{Deserialize, Serialize};
use sha3::{Digest, Keccak256};

use super::constants::{
ALIGNED_SERVICE_MANAGER_DEVNET, ALIGNED_SERVICE_MANAGER_HOLESKY,
ALIGNED_SERVICE_MANAGER_HOLESKY_STAGE, ALIGNED_SERVICE_MANAGER_MAINNET,
BATCHER_PAYMENT_SERVICE_ADDRESS_DEVNET, BATCHER_PAYMENT_SERVICE_ADDRESS_HOLESKY,
BATCHER_PAYMENT_SERVICE_ADDRESS_HOLESKY_STAGE, BATCHER_PAYMENT_SERVICE_ADDRESS_MAINNET,
BATCHER_URL_DEVNET, BATCHER_URL_HOLESKY, BATCHER_URL_HOLESKY_STAGE, BATCHER_URL_MAINNET,
};
use super::errors::VerifySignatureError;

// VerificationData is a bytes32 instead of a VerificationData struct because in the BatcherPaymentService contract
Expand Down Expand Up @@ -396,27 +404,45 @@ pub enum GetNonceResponseMessage {
InvalidRequest(String),
}

#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone)]
pub enum Network {
Devnet,
Holesky,
HoleskyStage,
Mainnet,
Custom(String, String, String),
}

impl FromStr for Network {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"holesky" => Ok(Network::Holesky),
"holesky-stage" => Ok(Network::HoleskyStage),
"devnet" => Ok(Network::Devnet),
"mainnet" => Ok(Network::Mainnet),
_ => Err(
"Invalid network, possible values are: \"holesky\", \"holesky-stage\", \"devnet\", \"mainnet\""
.to_string(),
),
impl Network {
pub fn get_aligned_service_manager_address(&self) -> ethers::types::H160 {
match self {
Self::Devnet => H160::from_str(ALIGNED_SERVICE_MANAGER_DEVNET).unwrap(),
Self::Holesky => H160::from_str(ALIGNED_SERVICE_MANAGER_HOLESKY).unwrap(),
Self::HoleskyStage => H160::from_str(ALIGNED_SERVICE_MANAGER_HOLESKY_STAGE).unwrap(),
Self::Mainnet => H160::from_str(ALIGNED_SERVICE_MANAGER_MAINNET).unwrap(),
Self::Custom(s, _, _) => H160::from_str(s.as_str()).unwrap(),
}
}

pub fn get_batcher_payment_service_address(&self) -> ethers::types::H160 {
match self {
Self::Devnet => H160::from_str(BATCHER_PAYMENT_SERVICE_ADDRESS_DEVNET).unwrap(),
Self::Holesky => H160::from_str(BATCHER_PAYMENT_SERVICE_ADDRESS_HOLESKY).unwrap(),
Self::HoleskyStage => {
H160::from_str(BATCHER_PAYMENT_SERVICE_ADDRESS_HOLESKY_STAGE).unwrap()
}
Self::Mainnet => H160::from_str(BATCHER_PAYMENT_SERVICE_ADDRESS_MAINNET).unwrap(),
Self::Custom(_, s, _) => H160::from_str(s.as_str()).unwrap(),
}
}

pub fn get_batcher_url(&self) -> &str {
match self {
Self::Devnet => BATCHER_URL_DEVNET,
Self::Holesky => BATCHER_URL_HOLESKY,
Self::HoleskyStage => BATCHER_URL_HOLESKY_STAGE,
Self::Mainnet => BATCHER_URL_MAINNET,
Self::Custom(_, _, s) => s.as_str(),
}
}
}
Expand Down
Loading
Loading