Skip to content

Commit d0c8f67

Browse files
committed
Merge changes
2 parents 29abaa4 + 4dc0c96 commit d0c8f67

File tree

43 files changed

+711
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+711
-137
lines changed

.github/workflows/foundry-gas-diff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }}
3636

3737
- name: Compare gas reports
38-
uses: Rubilmax/foundry-gas-diff@v3.16
38+
uses: Rubilmax/foundry-gas-diff@v3.21
3939
with:
4040
summaryQuantile: 0.9 # only display the 10% most significant gas diffs in the summary (defaults to 20%)
4141
sortCriteria: avg,max # sort diff rows by criteria

.github/workflows/send-proofs-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- '**.md'
1111

1212
concurrency:
13-
group: pull_request-${{ github.event.pull_request.number }}
13+
group: ${{ github.event_name == 'merge_group' && format('merge_group-{0}', github.event.merge_group.head_sha) || format('pull_request-{0}', github.event.pull_request.number) }}
1414
cancel-in-progress: true
1515

1616
jobs:

Makefile

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ CONFIG_FILE?=config-files/config.yaml
77
export OPERATOR_ADDRESS ?= $(shell yq -r '.operator.address' $(CONFIG_FILE))
88
AGG_CONFIG_FILE?=config-files/config-aggregator.yaml
99

10-
OPERATOR_VERSION=v0.13.0
10+
OPERATOR_VERSION=v0.14.0
11+
EIGEN_SDK_GO_VERSION_TESTNET=v0.2.0-beta.1
12+
EIGEN_SDK_GO_VERSION_MAINNET=v0.1.13
1113

1214
ifeq ($(OS),Linux)
1315
BUILD_ALL_FFI = $(MAKE) build_all_ffi_linux
@@ -30,6 +32,16 @@ ifeq ($(OS),Darwin)
3032
BUILD_OPERATOR = $(MAKE) build_operator_macos
3133
endif
3234

35+
ifeq ($(ENVIRONMENT), devnet)
36+
GET_SDK_VERSION = $(MAKE) operator_set_eigen_sdk_go_version_devnet
37+
else ifeq ($(ENVIRONMENT), testnet)
38+
GET_SDK_VERSION = $(MAKE) operator_set_eigen_sdk_go_version_testnet
39+
else ifeq ($(ENVIRONMENT), mainnet)
40+
GET_SDK_VERSION = $(MAKE) operator_set_eigen_sdk_go_version_mainnet
41+
else
42+
GET_SDK_VERSION = $(MAKE) operator_set_eigen_sdk_go_version_error
43+
endif
44+
3345

3446
FFI_FOR_RELEASE ?= true
3547

@@ -140,7 +152,13 @@ anvil_start_with_block_time_with_more_prefunded_accounts:
140152

141153
_AGGREGATOR_:
142154

155+
build_aggregator:
156+
$(GET_SDK_VERSION)
157+
@echo "Building aggregator"
158+
@go build -o ./build/aligned-aggregator ./aggregator/cmd/main.go
159+
143160
aggregator_start:
161+
$(GET_SDK_VERSION)
144162
@echo "Starting Aggregator..."
145163
@go run aggregator/cmd/main.go --config $(AGG_CONFIG_FILE) \
146164
2>&1 | zap-pretty
@@ -156,15 +174,31 @@ test_go_retries:
156174
__OPERATOR__:
157175

158176
operator_start:
177+
$(GET_SDK_VERSION)
159178
@echo "Starting Operator..."
160179
go run operator/cmd/main.go start --config $(CONFIG_FILE) \
161180
2>&1 | zap-pretty
162181

182+
operator_set_eigen_sdk_go_version_testnet:
183+
@echo "Setting Eigen SDK version to: $(EIGEN_SDK_GO_VERSION_TESTNET)"
184+
go get github.com/Layr-Labs/eigensdk-go@$(EIGEN_SDK_GO_VERSION_TESTNET)
185+
186+
operator_set_eigen_sdk_go_version_devnet: operator_set_eigen_sdk_go_version_mainnet
187+
188+
operator_set_eigen_sdk_go_version_mainnet:
189+
@echo "Setting Eigen SDK version to: $(EIGEN_SDK_GO_VERSION_MAINNET)"
190+
go get github.com/Layr-Labs/eigensdk-go@$(EIGEN_SDK_GO_VERSION_MAINNET)
191+
192+
operator_set_eigen_sdk_go_version_error:
193+
@echo "Error setting Eigen SDK version, missing ENVIRONMENT. Possible values for ENVIRONMENT=<devnet|testnet|mainnet>"
194+
exit 1
195+
163196
operator_full_registration: operator_get_eth operator_register_with_eigen_layer operator_mint_mock_tokens operator_deposit_into_mock_strategy operator_whitelist_devnet operator_register_with_aligned_layer
164197

165-
operator_register_and_start: operator_full_registration operator_start
198+
operator_register_and_start: $(GET_SDK_VERSION) operator_full_registration operator_start
166199

167200
build_operator: deps
201+
$(GET_SDK_VERSION)
168202
$(BUILD_OPERATOR)
169203

170204
build_operator_macos:
@@ -178,6 +212,7 @@ build_operator_linux:
178212
@echo "Operator built into /operator/build/aligned-operator"
179213

180214
update_operator:
215+
$(GET_SDK_VERSION)
181216
@echo "Updating Operator..."
182217
@./scripts/fetch_latest_release.sh
183218
@make build_operator

aggregator/pkg/server.go

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package pkg
33
import (
44
"context"
55
"encoding/hex"
6+
"errors"
67
"fmt"
78
"net/http"
89
"net/rpc"
@@ -48,6 +49,17 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
4849
"SenderAddress", "0x"+hex.EncodeToString(signedTaskResponse.SenderAddress[:]),
4950
"BatchIdentifierHash", "0x"+hex.EncodeToString(signedTaskResponse.BatchIdentifierHash[:]),
5051
"operatorId", hex.EncodeToString(signedTaskResponse.OperatorId[:]))
52+
53+
if signedTaskResponse.BlsSignature.G1Point == nil {
54+
agg.logger.Warn("invalid operator response with nil signature",
55+
"BatchMerkleRoot", "0x"+hex.EncodeToString(signedTaskResponse.BatchMerkleRoot[:]),
56+
"SenderAddress", "0x"+hex.EncodeToString(signedTaskResponse.SenderAddress[:]),
57+
"BatchIdentifierHash", "0x"+hex.EncodeToString(signedTaskResponse.BatchIdentifierHash[:]),
58+
"operatorId", hex.EncodeToString(signedTaskResponse.OperatorId[:]))
59+
*reply = 1
60+
return errors.New("invalid response: nil signature")
61+
}
62+
5163
taskIndex := uint32(0)
5264

5365
// The Aggregator may receive the Task Identifier after the operators.
@@ -69,7 +81,7 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
6981
defer cancel() // Ensure the cancel function is called to release resources
7082

7183
// Create a channel to signal when the task is done
72-
done := make(chan struct{})
84+
done := make(chan uint8)
7385

7486
agg.logger.Info("Starting bls signature process")
7587
go func() {
@@ -80,9 +92,11 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
8092

8193
if err != nil {
8294
agg.logger.Warnf("BLS aggregation service error: %s", err)
95+
done<- 1
8396
// todo shouldn't we here close the channel with a reply = 1?
8497
} else {
8598
agg.logger.Info("BLS process succeeded")
99+
done<- 0
86100
}
87101

88102
close(done)
@@ -94,10 +108,10 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t
94108
case <-ctx.Done():
95109
// The context's deadline was exceeded or it was canceled
96110
agg.logger.Info("Bls process timed out, operator signature will be lost. Batch may not reach quorum")
97-
case <-done:
111+
case res := <-done:
98112
// The task completed successfully
99-
agg.logger.Info("Bls context finished correctly")
100-
*reply = 0
113+
agg.logger.Info("Bls context finished on time")
114+
*reply = res
101115
}
102116

103117
return nil

alerts/balance_alerts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ do
3838
fi
3939
balance_alert=true
4040
else
41-
message="🟩 INFO: Wallet $WALLET_ADDRESS balance ($balance_eth ETH) is above $BALANCE_THRESHOLD ETH"
41+
message="🟩 INFO: $WALLET_NAME ($NETWORK) Wallet $WALLET_ADDRESS balance ($balance_eth ETH) is above $BALANCE_THRESHOLD ETH"
4242
printf "$message\n"
4343
if [ "$balance_alert" = true ]; then
4444
send_slack_message "$message"

alerts/contract_alerts.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ do
4141
if [ -z "$new_batch_logs" ]; then
4242
printf "No new batches logs found\n"
4343
if [ "$no_new_batches_alert" = false ]; then
44-
message="🚨 ALERT: No new batches in Service Manager since block $from_block"
44+
message="🚨 $NETWORK ALERT: No new batches in Service Manager since block $from_block"
45+
printf "$message\n"
4546
send_slack_message "$message"
4647
send_telegram_message "$message"
4748
send_pagerduty_alert "$message"
@@ -50,7 +51,8 @@ do
5051
else
5152
printf "New batches logs found\n"
5253
if [ "$no_new_batches_alert" = true ]; then
53-
message="🟩 INFO: Batches creation resumed in Service Manager since block $from_block"
54+
message="🟩 $NETWORK INFO: Batches creation resumed in Service Manager since block $from_block"
55+
printf "$message\n"
5456
send_slack_message "$message"
5557
send_telegram_message "$message"
5658
fi
@@ -61,7 +63,8 @@ do
6163
if [ -z "$verified_batch_logs" ]; then
6264
printf "No verified batches logs found\n"
6365
if [ "$no_verified_batches_alert" = false ]; then
64-
message="🚨 ALERT: No verified batches in Service Manager since block $from_block"
66+
message="🚨 $NETWORK ALERT: No verified batches in Service Manager since block $from_block"
67+
printf "$message\n"
6568
send_slack_message "$message"
6669
send_telegram_message "$message"
6770
send_pagerduty_alert "$message"
@@ -70,7 +73,8 @@ do
7073
else
7174
printf "Verified batches logs found\n"
7275
if [ "$no_verified_batches_alert" = true ]; then
73-
message="🟩 INFO: Batches verification resumed in Service Manager since block $from_block"
76+
message="🟩 $NETWORK INFO: Batches verification resumed in Service Manager since block $from_block"
77+
printf "$message\n"
7478
send_slack_message "$message"
7579
send_telegram_message "$message"
7680
fi

alerts/sender_with_alert.sh

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,15 @@ do
9292

9393
## Generate Proof
9494
nonce=$(aligned get-user-nonce --network $NETWORK --user_addr $SENDER_ADDRESS 2>&1 | awk '{print $9}')
95+
echo $nonce
96+
if ! [[ "$nonce" =~ ^[0-9]+$ ]]; then
97+
echo "Failed getting user nonce, retrying in 10 seconds"
98+
sleep 10
99+
continue
100+
fi
101+
95102
x=$((nonce + 1)) # So we don't have any issues with nonce = 0
96-
echo "Generating proof $x != 0"
103+
echo "Generating proof $x != 0, nonce: $nonce"
97104
go run ./scripts/test_files/gnark_groth16_bn254_infinite_script/cmd/main.go $x
98105

99106
## Send Proof
@@ -112,7 +119,26 @@ do
112119
2>&1)
113120

114121
echo "$submit"
115-
122+
123+
submit_errors=$(echo "$submit" | grep -oE 'ERROR[^]]*]([^[]*)' | sed 's/^[^]]*]//;s/[[:space:]]*$//')
124+
125+
# Loop through each error found and print with the custom message
126+
is_error=0
127+
while IFS= read -r error; do
128+
if [[ -n "$error" ]]; then
129+
slack_error_message="Error submitting proof to $NETWORK: $error"
130+
send_slack_message "$slack_error_message"
131+
is_error=1
132+
fi
133+
done <<< "$submit_errors"
134+
135+
if [ $is_error -eq 1 ]; then
136+
echo "Error submitting proofs to $NETWORK, retrying in 60 seconds"
137+
send_slack_message "Error submitting proofs to $NETWORK, retrying in 60 seconds"
138+
sleep 60
139+
continue
140+
fi
141+
116142
echo "Waiting $VERIFICATION_WAIT_TIME seconds for verification"
117143
sleep $VERIFICATION_WAIT_TIME
118144

batcher/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

batcher/aligned-batcher/src/lib.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ use std::time::Duration;
2626
use aligned_sdk::core::constants::{
2727
ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF, BATCHER_SUBMISSION_BASE_GAS_COST,
2828
BUMP_BACKOFF_FACTOR, BUMP_MAX_RETRIES, BUMP_MAX_RETRY_DELAY, BUMP_MIN_RETRY_DELAY,
29-
CONNECTION_TIMEOUT, DEFAULT_MAX_FEE_PER_PROOF, ETHEREUM_CALL_BACKOFF_FACTOR,
30-
ETHEREUM_CALL_MAX_RETRIES, ETHEREUM_CALL_MAX_RETRY_DELAY, ETHEREUM_CALL_MIN_RETRY_DELAY,
31-
GAS_PRICE_PERCENTAGE_MULTIPLIER, PERCENTAGE_DIVIDER,
29+
CBOR_ARRAY_MAX_OVERHEAD, CONNECTION_TIMEOUT, DEFAULT_MAX_FEE_PER_PROOF,
30+
ETHEREUM_CALL_BACKOFF_FACTOR, ETHEREUM_CALL_MAX_RETRIES, ETHEREUM_CALL_MAX_RETRY_DELAY,
31+
ETHEREUM_CALL_MIN_RETRY_DELAY, GAS_PRICE_PERCENTAGE_MULTIPLIER, PERCENTAGE_DIVIDER,
3232
RESPOND_TO_TASK_FEE_LIMIT_PERCENTAGE_MULTIPLIER,
3333
};
3434
use aligned_sdk::core::types::{
@@ -115,6 +115,16 @@ impl Batcher {
115115
let s3_client = s3::create_client(upload_endpoint).await;
116116

117117
let config = ConfigFromYaml::new(config_file);
118+
// Ensure max_batch_bytes_size can at least hold one proof of max_proof_size,
119+
// including the overhead introduced by serialization
120+
assert!(
121+
config.batcher.max_proof_size + CBOR_ARRAY_MAX_OVERHEAD
122+
<= config.batcher.max_batch_byte_size,
123+
"max_batch_bytes_size ({}) not big enough for one max_proof_size ({}) proof",
124+
config.batcher.max_batch_byte_size,
125+
config.batcher.max_proof_size
126+
);
127+
118128
let deployment_output =
119129
ContractDeploymentOutput::new(config.aligned_layer_deployment_config_file_path);
120130

batcher/aligned-batcher/src/types/batch_queue.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use aligned_sdk::{
22
communication::serialization::cbor_serialize,
3-
core::types::{NoncedVerificationData, VerificationDataCommitment},
3+
core::{
4+
constants::CBOR_ARRAY_MAX_OVERHEAD,
5+
types::{NoncedVerificationData, VerificationDataCommitment},
6+
},
47
};
58
use ethers::types::{Address, Signature, U256};
69
use priority_queue::PriorityQueue;
@@ -132,7 +135,10 @@ pub(crate) fn calculate_batch_size(batch_queue: &BatchQueue) -> Result<usize, Ba
132135
});
133136

134137
if let ControlFlow::Continue(batch_size) = folded_result {
135-
Ok(batch_size)
138+
// We over-estimate the size of the batch by at most 8 bytes.
139+
// This saves us from a scenario where we actually try to send more
140+
// than the maximum allowed bytes and get rejected by operators.
141+
Ok(CBOR_ARRAY_MAX_OVERHEAD + batch_size)
136142
} else {
137143
Err(BatcherError::SerializationError(String::from(
138144
"Could not calculate size of batch",

0 commit comments

Comments
 (0)