Skip to content

Commit faa299b

Browse files
entropidelictaturosatiuri-99JuArceMauroToscano
authored
feat: integrate batcher with payment system (#519)
Co-authored-by: Santos Rosati <rosatisantos@gmail.com> Co-authored-by: Urix <43704209+uri-99@users.noreply.github.com> Co-authored-by: JuArce <52429267+JuArce@users.noreply.github.com> Co-authored-by: MauroFab <maurotoscano2@gmail.com> Co-authored-by: Mauro Toscano <12560266+MauroToscano@users.noreply.github.com> Co-authored-by: Tatu <65305492+srosati@users.noreply.github.com>
1 parent aef7f8a commit faa299b

22 files changed

Lines changed: 704 additions & 2166 deletions

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ __BATCHER__:
175175

176176
BURST_SIZE=5
177177

178-
batcher_fund_service_manager_balance:
179-
@. ./scripts/fund_batcher_balance_in_aligned_devnet.sh
178+
user_fund_payment_service:
179+
@. ./scripts/user_fund_payment_service_devnet.sh
180180

181181
./batcher/aligned-batcher/.env:
182182
@echo "To start the Batcher ./batcher/aligned-batcher/.env needs to be manually set"; false;
183183

184-
batcher_start: ./batcher/aligned-batcher/.env batcher_fund_service_manager_balance
184+
batcher_start: ./batcher/aligned-batcher/.env user_fund_payment_service
185185
@echo "Starting Batcher..."
186186
@cargo +nightly-2024-04-17 run --manifest-path ./batcher/aligned-batcher/Cargo.toml --release -- --config ./config-files/config-batcher.yaml --env-file ./batcher/aligned-batcher/.env
187187

batcher/Cargo.lock

Lines changed: 6 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

batcher/aligned-batcher-lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
ethers = { version = "2.0", features = ["ws", "rustls"] }
7+
ethers = { tag = "v2.0.15-fix-reconnections", features = ["ws", "rustls"], git = "https://github.com/yetanotherco/ethers-rs.git" }
88
anyhow = "1.0.83"
99
log = { version = "0.4.21"}
1010
serde = { version = "1.0.201", features = ["derive"] }

batcher/aligned-batcher-lib/src/types/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,12 @@ impl ClientMessage {
158158
pub fn verify_signature(&self) -> Result<Address, SignatureError> {
159159
let hashed_leaf =
160160
VerificationCommitmentBatch::hash_data(&self.verification_data.clone().into());
161-
let recovered = self.signature.recover(hashed_leaf)?;
162-
self.signature.verify(hashed_leaf, recovered)?;
161+
162+
// IMPORTANT: If the `.to_vec()` conversion is not made for `hashed_leaf`, the recovered
163+
// address from the signature will not be the same as the one who signed. This is a bug in
164+
// the ethers-rs library
165+
let recovered = self.signature.recover(hashed_leaf.to_vec())?;
166+
self.signature.verify(hashed_leaf.to_vec(), recovered)?;
163167
Ok(recovered)
164168
}
165169
}

batcher/aligned-batcher/src/config/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use serde::Deserialize;
22

3-
#[derive(Debug, Deserialize)]
3+
#[derive(Clone, Debug, Deserialize)]
44
pub struct ECDSAConfig {
55
pub private_key_store_path: String,
66
pub private_key_store_password: String,
@@ -36,6 +36,8 @@ impl ConfigFromYaml {
3636
pub struct Addresses {
3737
#[serde(rename = "alignedLayerServiceManager")]
3838
pub aligned_layer_service_manager: String,
39+
#[serde(rename = "batcherPaymentService")]
40+
pub batcher_payment_service: String,
3941
}
4042

4143
#[derive(Debug, Deserialize)]

0 commit comments

Comments
 (0)