diff --git a/aggregator/pkg/server.go b/aggregator/pkg/server.go index 4ec6488d05..9138e188d5 100644 --- a/aggregator/pkg/server.go +++ b/aggregator/pkg/server.go @@ -3,6 +3,7 @@ package pkg import ( "context" "encoding/hex" + "errors" "fmt" "net/http" "net/rpc" @@ -48,6 +49,17 @@ func (agg *Aggregator) ProcessOperatorSignedTaskResponseV2(signedTaskResponse *t "SenderAddress", "0x"+hex.EncodeToString(signedTaskResponse.SenderAddress[:]), "BatchIdentifierHash", "0x"+hex.EncodeToString(signedTaskResponse.BatchIdentifierHash[:]), "operatorId", hex.EncodeToString(signedTaskResponse.OperatorId[:])) + + if signedTaskResponse.BlsSignature.G1Point == nil { + agg.logger.Warn("invalid operator response with nil signature", + "BatchMerkleRoot", "0x"+hex.EncodeToString(signedTaskResponse.BatchMerkleRoot[:]), + "SenderAddress", "0x"+hex.EncodeToString(signedTaskResponse.SenderAddress[:]), + "BatchIdentifierHash", "0x"+hex.EncodeToString(signedTaskResponse.BatchIdentifierHash[:]), + "operatorId", hex.EncodeToString(signedTaskResponse.OperatorId[:])) + *reply = 1 + return errors.New("invalid response: nil signature") + } + taskIndex := uint32(0) // The Aggregator may receive the Task Identifier after the operators. diff --git a/batcher/aligned-batcher/src/lib.rs b/batcher/aligned-batcher/src/lib.rs index 0b6f7c0d85..71dfcb5e3d 100644 --- a/batcher/aligned-batcher/src/lib.rs +++ b/batcher/aligned-batcher/src/lib.rs @@ -25,9 +25,9 @@ use std::time::Duration; use aligned_sdk::core::constants::{ ADDITIONAL_SUBMISSION_GAS_COST_PER_PROOF, BATCHER_SUBMISSION_BASE_GAS_COST, BUMP_BACKOFF_FACTOR, BUMP_MAX_RETRIES, BUMP_MAX_RETRY_DELAY, BUMP_MIN_RETRY_DELAY, - CONNECTION_TIMEOUT, DEFAULT_MAX_FEE_PER_PROOF, ETHEREUM_CALL_BACKOFF_FACTOR, - ETHEREUM_CALL_MAX_RETRIES, ETHEREUM_CALL_MAX_RETRY_DELAY, ETHEREUM_CALL_MIN_RETRY_DELAY, - GAS_PRICE_PERCENTAGE_MULTIPLIER, PERCENTAGE_DIVIDER, + CBOR_ARRAY_MAX_OVERHEAD, CONNECTION_TIMEOUT, DEFAULT_MAX_FEE_PER_PROOF, + ETHEREUM_CALL_BACKOFF_FACTOR, ETHEREUM_CALL_MAX_RETRIES, ETHEREUM_CALL_MAX_RETRY_DELAY, + ETHEREUM_CALL_MIN_RETRY_DELAY, GAS_PRICE_PERCENTAGE_MULTIPLIER, PERCENTAGE_DIVIDER, RESPOND_TO_TASK_FEE_LIMIT_PERCENTAGE_MULTIPLIER, }; use aligned_sdk::core::types::{ @@ -114,6 +114,16 @@ impl Batcher { let s3_client = s3::create_client(upload_endpoint).await; let config = ConfigFromYaml::new(config_file); + // Ensure max_batch_bytes_size can at least hold one proof of max_proof_size, + // including the overhead introduced by serialization + assert!( + config.batcher.max_proof_size + CBOR_ARRAY_MAX_OVERHEAD + <= config.batcher.max_batch_byte_size, + "max_batch_bytes_size ({}) not big enough for one max_proof_size ({}) proof", + config.batcher.max_batch_byte_size, + config.batcher.max_proof_size + ); + let deployment_output = ContractDeploymentOutput::new(config.aligned_layer_deployment_config_file_path); diff --git a/batcher/aligned-batcher/src/types/batch_queue.rs b/batcher/aligned-batcher/src/types/batch_queue.rs index a32957a548..5c2056eadb 100644 --- a/batcher/aligned-batcher/src/types/batch_queue.rs +++ b/batcher/aligned-batcher/src/types/batch_queue.rs @@ -1,6 +1,9 @@ use aligned_sdk::{ communication::serialization::cbor_serialize, - core::types::{NoncedVerificationData, VerificationDataCommitment}, + core::{ + constants::CBOR_ARRAY_MAX_OVERHEAD, + types::{NoncedVerificationData, VerificationDataCommitment}, + }, }; use ethers::types::{Address, Signature, U256}; use priority_queue::PriorityQueue; @@ -132,7 +135,10 @@ pub(crate) fn calculate_batch_size(batch_queue: &BatchQueue) -> Result respondToTaskFeeLimit modifier pub const DEFAULT_AGGREGATOR_FEE_PERCENTAGE_MULTIPLIER: u128 = 125; // feeForAggregator modifier diff --git a/docker/aggregator.Dockerfile b/docker/aggregator.Dockerfile index 646554eec2..ab31ff6052 100644 --- a/docker/aggregator.Dockerfile +++ b/docker/aggregator.Dockerfile @@ -10,6 +10,7 @@ COPY metrics ./metrics COPY contracts/bindings/ ./contracts/bindings RUN go get github.com/ethereum/go-ethereum@latest +RUN go get github.com/gorilla/websocket@v1.5.1 RUN go build -o ./aligned-layer-aggregator aggregator/cmd/main.go FROM debian:bookworm-slim