Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: not inclusive start block #68

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions crates/aggchain-proof-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -116,7 +122,7 @@ impl AggchainProofBuilder {
request: AggchainProofBuilderRequest,
) -> Result<AggchainProverInputs, Error> {
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)?;

Expand Down
4 changes: 2 additions & 2 deletions crates/aggchain-proof-service/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Binary file modified crates/aggkit-prover-types/src/generated/aggkit.prover.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -35,7 +38,7 @@ pub struct GenerateAggchainProofResponse {
/// Aggchain proof.
#[prost(bytes = "vec", tag = "1")]
pub aggchain_proof: ::prost::alloc::vec::Vec<u8>,
/// 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.
Expand Down
2 changes: 1 addition & 1 deletion crates/aggkit-prover/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl AggchainProofGrpcService for GrpcService {
request: Request<GenerateAggchainProofRequest>,
) -> Result<Response<GenerateAggchainProofResponse>, 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",
Expand Down
7 changes: 5 additions & 2 deletions proto/aggkit/prover/v1/aggchain_proof_generation.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Loading