diff --git a/crates/aggchain-proof-builder/src/lib.rs b/crates/aggchain-proof-builder/src/lib.rs index 8387655b..54d9ec13 100644 --- a/crates/aggchain-proof-builder/src/lib.rs +++ b/crates/aggchain-proof-builder/src/lib.rs @@ -39,7 +39,12 @@ pub struct AggchainProofBuilderRequest { /// Aggregated full execution proof for the number of aggregated block /// spans. pub agg_span_proof: SP1ProofWithPublicValues, - /// First block in the aggregated span. + /// Start block of the aggregated span proof. + /// This block must match the end_block of the last proof, to check the + /// consistency between proofs, but it's not proved. The span of blocks + /// processed and proved goes from start_block+1 to end_block both + /// inclusive. + // Proof (start_block, end_block] pub start_block: u64, /// Last block in the aggregated span (inclusive). pub end_block: u64, @@ -59,9 +64,10 @@ pub struct AggchainProofBuilderRequest { #[derive(Clone, Debug)] pub struct AggchainProofBuilderResponse { - /// Generated aggchain proof for the block range. + /// Aggchain proof generated by the `aggchain-proof-builder` service + /// per `agg-sender` request. pub proof: SP1Proof, - /// First block included in the aggchain proof. + /// Start block of the generated aggchain proof. pub start_block: u64, /// Last block included in the aggchain proof. pub end_block: u64, @@ -116,7 +122,7 @@ impl AggchainProofBuilder { request: AggchainProofBuilderRequest, ) -> Result { let _prev_local_exit_root = contracts_client - .get_l2_local_exit_root(request.start_block - 1) + .get_l2_local_exit_root(request.start_block) .await .map_err(Error::L2ChainDataRetrievalError)?; diff --git a/crates/aggchain-proof-service/src/service.rs b/crates/aggchain-proof-service/src/service.rs index 8a9d97eb..447f90ed 100644 --- a/crates/aggchain-proof-service/src/service.rs +++ b/crates/aggchain-proof-service/src/service.rs @@ -22,7 +22,7 @@ use crate::error::Error; #[derive(Default, Clone, Debug)] #[allow(unused)] pub struct AggchainProofServiceRequest { - /// Aggchain proof starting block + /// Start block of the aggchain proof. pub start_block: u64, /// Max number of blocks that the aggchain proof is allowed to contain pub max_block: u64, @@ -44,7 +44,7 @@ pub struct AggchainProofServiceResponse { /// Aggchain proof generated by the `aggchain-proof-builder` service /// per `agg-sender` request. pub proof: SP1Proof, - /// First block in the aggchain proof. + /// Start block of the aggchain proof. pub start_block: u64, /// Last block in the aggchain proof (inclusive). pub end_block: u64, diff --git a/crates/aggkit-prover-types/src/generated/aggkit.prover.bin b/crates/aggkit-prover-types/src/generated/aggkit.prover.bin index 95b01957..c7424455 100644 Binary files a/crates/aggkit-prover-types/src/generated/aggkit.prover.bin and b/crates/aggkit-prover-types/src/generated/aggkit.prover.bin differ diff --git a/crates/aggkit-prover-types/src/generated/aggkit.prover.v1.rs b/crates/aggkit-prover-types/src/generated/aggkit.prover.v1.rs index dce016f7..bd766e95 100644 --- a/crates/aggkit-prover-types/src/generated/aggkit.prover.v1.rs +++ b/crates/aggkit-prover-types/src/generated/aggkit.prover.v1.rs @@ -2,7 +2,10 @@ /// The request message for generating aggchain proof. #[derive(Clone, PartialEq, ::prost::Message)] pub struct GenerateAggchainProofRequest { - /// The start block for which the aggchain proof is requested. + /// Start block of the aggchain proof. + /// This block must match the end_block of the last proof, to check the consistency between proofs, but it's not proved. + /// The span of blocks processed and proved goes from start_block+1 to end_block both inclusive. + /// Proof (start_block, end_block] #[prost(uint64, tag = "1")] pub start_block: u64, /// The max end block for which the aggchain proof is requested. @@ -35,7 +38,7 @@ pub struct GenerateAggchainProofResponse { /// Aggchain proof. #[prost(bytes = "vec", tag = "1")] pub aggchain_proof: ::prost::alloc::vec::Vec, - /// The start block of the aggchain proof. + /// Start block of the aggchain proof. #[prost(uint64, tag = "2")] pub start_block: u64, /// The end block of the aggchain proof. diff --git a/crates/aggkit-prover/src/rpc.rs b/crates/aggkit-prover/src/rpc.rs index 94531372..1156a667 100644 --- a/crates/aggkit-prover/src/rpc.rs +++ b/crates/aggkit-prover/src/rpc.rs @@ -37,7 +37,7 @@ impl AggchainProofGrpcService for GrpcService { request: Request, ) -> Result, Status> { let request = request.into_inner(); - if request.max_end_block < request.start_block { + if request.max_end_block <= request.start_block { let mut error = ErrorDetails::new(); error.add_bad_request_violation( "max_end_block", diff --git a/proto/aggkit/prover/v1/aggchain_proof_generation.proto b/proto/aggkit/prover/v1/aggchain_proof_generation.proto index 7448c299..7f14bdfb 100644 --- a/proto/aggkit/prover/v1/aggchain_proof_generation.proto +++ b/proto/aggkit/prover/v1/aggchain_proof_generation.proto @@ -10,7 +10,10 @@ service AggchainProofService { // The request message for generating aggchain proof. message GenerateAggchainProofRequest { - // The start block for which the aggchain proof is requested. + // Start block of the aggchain proof. + // This block must match the end_block of the last proof, to check the consistency between proofs, but it's not proved. + // The span of blocks processed and proved goes from start_block+1 to end_block both inclusive. + // Proof (start_block, end_block] uint64 start_block = 1; // The max end block for which the aggchain proof is requested. uint64 max_end_block = 2; @@ -30,7 +33,7 @@ message GenerateAggchainProofRequest { message GenerateAggchainProofResponse { // Aggchain proof. bytes aggchain_proof = 1; - // The start block of the aggchain proof. + // Start block of the aggchain proof. uint64 start_block = 2; // The end block of the aggchain proof. uint64 end_block = 3;