diff --git a/adapters/core2p2p/receipt.go b/adapters/core2p2p/receipt.go index 24bc43476e..223f02e445 100644 --- a/adapters/core2p2p/receipt.go +++ b/adapters/core2p2p/receipt.go @@ -103,9 +103,10 @@ func AdaptExecutionResources(er *core.ExecutionResources) *gen.Receipt_Execution return nil } - var l1Gas, l1DataGas, totalL1Gas *felt.Felt + var l1Gas, l2Gas, l1DataGas, totalL1Gas *felt.Felt if da := er.DataAvailability; da != nil { // todo(kirill) check that it might be null l1Gas = new(felt.Felt).SetUint64(da.L1Gas) + l2Gas = new(felt.Felt).SetUint64(da.L2Gas) l1DataGas = new(felt.Felt).SetUint64(da.L1DataGas) } if tgs := er.TotalGasConsumed; tgs != nil { @@ -129,6 +130,7 @@ func AdaptExecutionResources(er *core.ExecutionResources) *gen.Receipt_Execution Steps: uint32(er.Steps), MemoryHoles: uint32(er.MemoryHoles), L1Gas: AdaptFelt(l1Gas), + L2Gas: AdaptFelt(l2Gas), L1DataGas: AdaptFelt(l1DataGas), TotalL1Gas: AdaptFelt(totalL1Gas), } diff --git a/adapters/core2p2p/transaction.go b/adapters/core2p2p/transaction.go index 9529ec4c21..0fa2c5ac12 100644 --- a/adapters/core2p2p/transaction.go +++ b/adapters/core2p2p/transaction.go @@ -161,8 +161,9 @@ func adaptResourceLimits(bounds core.ResourceBounds) *gen.ResourceLimits { func adaptResourceBounds(rb map[core.Resource]core.ResourceBounds) *gen.ResourceBounds { return &gen.ResourceBounds{ - L1Gas: adaptResourceLimits(rb[core.ResourceL1Gas]), - L2Gas: adaptResourceLimits(rb[core.ResourceL2Gas]), + L1Gas: adaptResourceLimits(rb[core.ResourceL1Gas]), + L1DataGas: adaptResourceLimits(rb[core.ResourceL1DataGas]), + L2Gas: adaptResourceLimits(rb[core.ResourceL2Gas]), } } diff --git a/adapters/p2p2core/receipt.go b/adapters/p2p2core/receipt.go index 6fdbe405e7..b2ab862862 100644 --- a/adapters/p2p2core/receipt.go +++ b/adapters/p2p2core/receipt.go @@ -58,12 +58,14 @@ func adaptExecutionResources(er *gen.Receipt_ExecutionResources) *core.Execution }, DataAvailability: &core.DataAvailability{ L1Gas: feltToUint64(er.L1Gas), + L2Gas: feltToUint64(er.L2Gas), L1DataGas: feltToUint64(er.L1DataGas), }, MemoryHoles: uint64(er.MemoryHoles), Steps: uint64(er.Steps), // todo SPEC 32 -> 64 bytes TotalGasConsumed: &core.GasConsumed{ L1Gas: feltToUint64(er.TotalL1Gas), + L2Gas: feltToUint64(er.L2Gas), // total_l1_data_gas = l1_data_gas, because there's only one place that can generate l1_data_gas costs L1DataGas: feltToUint64(er.L1DataGas), }, diff --git a/adapters/sn2core/sn2core.go b/adapters/sn2core/sn2core.go index f3c4b7e405..003fa31931 100644 --- a/adapters/sn2core/sn2core.go +++ b/adapters/sn2core/sn2core.go @@ -90,6 +90,7 @@ func adaptGasConsumed(response *starknet.GasConsumed) *core.GasConsumed { return &core.GasConsumed{ L1Gas: response.L1Gas, L1DataGas: response.L1DataGas, + L2Gas: response.L2Gas, } } diff --git a/core/receipt.go b/core/receipt.go index 0e0f071f96..92f3e85f44 100644 --- a/core/receipt.go +++ b/core/receipt.go @@ -12,6 +12,7 @@ import ( type GasConsumed struct { L1Gas uint64 L1DataGas uint64 + L2Gas uint64 } type TransactionReceipt struct { diff --git a/core/transaction.go b/core/transaction.go index 1b05b1f936..bd7caacfe2 100644 --- a/core/transaction.go +++ b/core/transaction.go @@ -106,6 +106,7 @@ type ExecutionResources struct { type DataAvailability struct { L1Gas uint64 L1DataGas uint64 + L2Gas uint64 } type BuiltinInstanceCounter struct { diff --git a/starknet/transaction.go b/starknet/transaction.go index 3584336aa4..9b35a083a7 100644 --- a/starknet/transaction.go +++ b/starknet/transaction.go @@ -220,6 +220,7 @@ type ExecutionResources struct { type DataAvailability struct { L1Gas uint64 `json:"l1_gas"` L1DataGas uint64 `json:"l1_data_gas"` + L2Gas uint64 `json:"l2_gas"` } type BuiltinInstanceCounter struct { @@ -240,6 +241,7 @@ type BuiltinInstanceCounter struct { type GasConsumed struct { L1Gas uint64 `json:"l1_gas"` L1DataGas uint64 `json:"l1_data_gas"` + L2Gas uint64 `json:"l2_gas"` } type TransactionReceipt struct {