Skip to content

Commit f0cc51e

Browse files
committed
Merge branch 'staging' into 1401-1414-aggregator-retry-improvements
2 parents 62f1fff + ff0bac6 commit f0cc51e

29 files changed

Lines changed: 3628 additions & 250 deletions

File tree

Makefile

Lines changed: 100 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ anvil_start_with_block_time:
132132
@echo "Starting Anvil..."
133133
anvil --load-state contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json --block-time 7
134134

135+
anvil_start_with_block_time_with_more_prefunded_accounts:
136+
@echo "Starting Anvil..."
137+
anvil --load-state contracts/scripts/anvil/state/alignedlayer-deployed-anvil-state.json --block-time 7 -a 2000
138+
135139
_AGGREGATOR_:
136140

137141
aggregator_start:
@@ -284,7 +288,7 @@ verifier_disable:
284288

285289
__BATCHER__:
286290

287-
BURST_SIZE=5
291+
BURST_SIZE ?= 5
288292

289293
user_fund_payment_service:
290294
@. ./scripts/user_fund_payment_service_devnet.sh
@@ -301,6 +305,11 @@ batcher_start_local: user_fund_payment_service
301305
@$(MAKE) run_storage &
302306
@cargo run --manifest-path ./batcher/aligned-batcher/Cargo.toml --release -- --config ./config-files/config-batcher.yaml --env-file ./batcher/aligned-batcher/.env.dev
303307

308+
batcher_start_local_no_fund:
309+
@echo "Starting Batcher..."
310+
@$(MAKE) run_storage &
311+
@cargo run --manifest-path ./batcher/aligned-batcher/Cargo.toml --release -- --config ./config-files/config-batcher.yaml --env-file ./batcher/aligned-batcher/.env.dev
312+
304313
install_batcher:
305314
@cargo install --path batcher/aligned-batcher
306315

@@ -448,6 +457,82 @@ batcher_send_burst_groth16: batcher/target/release/aligned
448457
@mkdir -p scripts/test_files/gnark_groth16_bn254_infinite_script/infinite_proofs
449458
@./batcher/aligned/send_burst_tasks.sh $(BURST_SIZE) $(START_COUNTER)
450459

460+
461+
__TASK_SENDER__:
462+
BURST_TIME_SECS ?= 3
463+
464+
task_sender_generate_groth16_proofs:
465+
@cd batcher/aligned-task-sender && \
466+
cargo run --release -- generate-proofs \
467+
--number-of-proofs $(NUMBER_OF_PROOFS) --proof-type groth16 \
468+
--dir-to-save-proofs $(CURDIR)/scripts/test_files/task_sender/proofs
469+
470+
# ===== DEVNET =====
471+
task_sender_fund_wallets_devnet:
472+
@cd batcher/aligned-task-sender && \
473+
cargo run --release -- generate-and-fund-wallets \
474+
--eth-rpc-url http://localhost:8545 \
475+
--network devnet \
476+
--amount-to-deposit 1 \
477+
--amount-to-deposit-to-aligned 0.9999 \
478+
--private-keys-filepath $(CURDIR)/batcher/aligned-task-sender/wallets/devnet
479+
480+
task_sender_send_infinite_proofs_devnet:
481+
@cd batcher/aligned-task-sender && \
482+
cargo run --release -- send-infinite-proofs \
483+
--burst-size $(BURST_SIZE) --burst-time-secs $(BURST_TIME_SECS) \
484+
--eth-rpc-url http://localhost:8545 \
485+
--batcher-url ws://localhost:8080 \
486+
--network devnet \
487+
--proofs-dirpath $(CURDIR)/scripts/test_files/task_sender/proofs \
488+
--private-keys-filepath $(CURDIR)/batcher/aligned-task-sender/wallets/devnet
489+
490+
task_sender_test_connections_devnet:
491+
@cd batcher/aligned-task-sender && \
492+
cargo run --release -- test-connections \
493+
--batcher-url ws://localhost:8080 \
494+
--num-senders $(NUM_SENDERS)
495+
496+
# ===== HOLESKY-STAGE =====
497+
task_sender_generate_and_fund_wallets_holesky_stage:
498+
@cd batcher/aligned-task-sender && \
499+
cargo run --release -- generate-and-fund-wallets \
500+
--eth-rpc-url https://ethereum-holesky-rpc.publicnode.com \
501+
--network holesky-stage \
502+
--funding-wallet-private-key $(FUNDING_WALLET_PRIVATE_KEY) \
503+
--number-wallets $(NUM_WALLETS) \
504+
--amount-to-deposit $(AMOUNT_TO_DEPOSIT) \
505+
--amount-to-deposit-to-aligned $(AMOUNT_TO_DEPOSIT_TO_ALIGNED) \
506+
--private-keys-filepath $(CURDIR)/batcher/aligned-task-sender/wallets/holesky-stage
507+
508+
task_sender_send_infinite_proofs_holesky_stage:
509+
@cd batcher/aligned-task-sender && \
510+
cargo run --release -- send-infinite-proofs \
511+
--burst-size $(BURST_SIZE) --burst-time-secs $(BURST_TIME_SECS) \
512+
--eth-rpc-url https://ethereum-holesky-rpc.publicnode.com \
513+
--batcher-url wss://stage.batcher.alignedlayer.com \
514+
--network holesky-stage \
515+
--proofs-dirpath $(CURDIR)/scripts/test_files/task_sender/proofs \
516+
--private-keys-filepath $(CURDIR)/batcher/aligned-task-sender/wallets/holesky-stage
517+
518+
task_sender_test_connections_holesky_stage:
519+
@cd batcher/aligned-task-sender && \
520+
cargo run --release -- test-connections \
521+
--batcher-url wss://stage.batcher.alignedlayer.com \
522+
--num-senders $(NUM_SENDERS)
523+
524+
__UTILS__:
525+
aligned_get_user_balance_devnet:
526+
@cd batcher/aligned/ && cargo run --release -- get-user-balance \
527+
--user_addr $(USER_ADDR)
528+
529+
aligned_get_user_balance_holesky:
530+
@cd batcher/aligned/ && cargo run --release -- get-user-balance \
531+
--rpc_url https://ethereum-holesky-rpc.publicnode.com \
532+
--network holesky \
533+
--user_addr $(USER_ADDR)
534+
535+
451536
__GENERATE_PROOFS__:
452537
# TODO add a default proving system
453538

@@ -1092,6 +1177,20 @@ ansible_batcher_deploy: ## Deploy the Batcher. Parameters: INVENTORY, KEYSTORE
10921177
-i $(INVENTORY) \
10931178
-e "keystore_path=$(KEYSTORE)"
10941179

1180+
ansible_aggregator_create_env: ## Create empty variables files for the Aggregator deploy
1181+
@cp -n infra/ansible/playbooks/ini/config-aggregator.ini.example infra/ansible/playbooks/ini/config-aggregator.ini
1182+
@echo "Config files for the Aggregator created in infra/ansible/playbooks/ini"
1183+
@echo "Please complete the values and run make ansible_aggregator_deploy"
1184+
1185+
ansible_aggregator_deploy: ## Deploy the Operator. Parameters: INVENTORY
1186+
@if [ -z "$(INVENTORY)" ] || [ -z "$(ECDSA_KEYSTORE)" ] || [ -z "$(BLS_KEYSTORE)" ]; then \
1187+
echo "Error: INVENTORY, ECDSA_KEYSTORE, BLS_KEYSTORE must be set."; \
1188+
exit 1; \
1189+
fi
1190+
@ansible-playbook infra/ansible/playbooks/aggregator.yaml \
1191+
-i $(INVENTORY) \
1192+
-e "ecdsa_keystore_path=$(ECDSA_KEYSTORE)" \
1193+
-e "bls_keystore_path=$(BLS_KEYSTORE)"
10951194

10961195
ansible_operator_create_env: ## Create empty variables files for the Operator deploy
10971196
@cp -n infra/ansible/playbooks/ini/config-operator.ini.example infra/ansible/playbooks/ini/config-operator.ini

aggregator/pkg/aggregator.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@ type Aggregator struct {
7474
// Note: In case of a reboot it can start from 0 again
7575
nextBatchIndex uint32
7676

77-
// Mutex to protect batchesIdentifierHashByIdx, batchesIdxByIdentifierHash and nextBatchIndex
77+
// Mutex to protect:
78+
// - batchesIdentifierHashByIdx
79+
// - batchesIdxByIdentifierHash
80+
// - batchCreatedBlockByIdx
81+
// - batchDataByIdentifierHash
82+
// - nextBatchIndex
7883
taskMutex *sync.Mutex
7984

8085
// Mutex to protect ethereum wallet
@@ -443,6 +448,8 @@ func (agg *Aggregator) ClearTasksFromMaps() {
443448
agg.logger.Warn("No old tasks found")
444449
continue // Retry in the next iteration
445450
}
451+
agg.taskMutex.Lock()
452+
agg.AggregatorConfig.BaseConfig.Logger.Info("- Locked Resources: Cleaning finalized tasks")
446453

447454
taskIdxToDelete := agg.batchesIdxByIdentifierHash[*oldTaskIdHash]
448455
agg.logger.Info("Old task found", "taskIndex", taskIdxToDelete)
@@ -460,6 +467,8 @@ func (agg *Aggregator) ClearTasksFromMaps() {
460467
}
461468
}
462469
lastIdxDeleted = taskIdxToDelete
470+
agg.taskMutex.Unlock()
471+
agg.AggregatorConfig.BaseConfig.Logger.Info("- Unlocked Resources: Cleaning finalized tasks")
463472
agg.AggregatorConfig.BaseConfig.Logger.Info("Done cleaning finalized tasks from maps")
464473
}
465474
}

0 commit comments

Comments
 (0)