From 2dd7af372cb12b1d1475634be6a95311b336ce5a Mon Sep 17 00:00:00 2001 From: Shahak Shama Date: Tue, 7 Jan 2025 19:33:36 +0200 Subject: [PATCH] add l2 gas support --- p2p/proto/sync/header.proto | 14 ++++++++------ p2p/proto/sync/receipt.proto | 3 ++- p2p/proto/transaction.proto | 5 ++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/p2p/proto/sync/header.proto b/p2p/proto/sync/header.proto index 4e63696..6c461c7 100644 --- a/p2p/proto/sync/header.proto +++ b/p2p/proto/sync/header.proto @@ -20,13 +20,15 @@ message SignedBlockHeader { Patricia events = 9; // By order of issuance. TBD: in receipts? Hash receipts = 10; // By order of issuance. This is a patricia root. No need for length because it's the same length as transactions. string protocol_version = 11; // Starknet version - Uint128 gas_price_fri = 12; - Uint128 gas_price_wei = 13; - Uint128 data_gas_price_fri = 14; - Uint128 data_gas_price_wei = 15; - L1DataAvailabilityMode l1_data_availability_mode = 16; + Uint128 l1_gas_price_fri = 12; + Uint128 l1_gas_price_wei = 13; + Uint128 l1_data_gas_price_fri = 14; + Uint128 l1_data_gas_price_wei = 15; + Uint128 l2_gas_price_fri = 16; + Uint128 l2_gas_price_wei = 17; + L1DataAvailabilityMode l1_data_availability_mode = 18; // for now, we assume a small consensus, so this fits in 1M. Else, these will be repeated and extracted from this message. - repeated ConsensusSignature signatures = 17; + repeated ConsensusSignature signatures = 19; // can be more explicit here about the signature structure as this is not part of account abstraction } diff --git a/p2p/proto/sync/receipt.proto b/p2p/proto/sync/receipt.proto index 239a29b..ebd603c 100644 --- a/p2p/proto/sync/receipt.proto +++ b/p2p/proto/sync/receipt.proto @@ -39,7 +39,8 @@ message Receipt { uint32 memory_holes = 3; Felt252 l1_gas = 4; Felt252 l1_data_gas = 5; - Felt252 total_l1_gas = 6; + Felt252 l2_gas = 6; + Felt252 total_l1_gas = 7; } message Common { diff --git a/p2p/proto/transaction.proto b/p2p/proto/transaction.proto index 5e03b6b..1ef63c7 100644 --- a/p2p/proto/transaction.proto +++ b/p2p/proto/transaction.proto @@ -11,7 +11,10 @@ message ResourceLimits { message ResourceBounds { ResourceLimits l1_gas = 1; - ResourceLimits l2_gas = 2; + // This can be None only in transactions that don't support l2 gas. + // Starting from 0.14.0, MempoolTransaction and ConsensusTransaction shouldn't have None here. + optional ResourceLimits l1_data_gas = 2; + ResourceLimits l2_gas = 3; } message AccountSignature {