From c250d0e2129ecbf630de9c0d970b134d853c3ba5 Mon Sep 17 00:00:00 2001 From: rianhughes Date: Wed, 22 Nov 2023 12:03:16 +0200 Subject: [PATCH] Add validation and fields --- rpc/types_transaction_receipt.go | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/rpc/types_transaction_receipt.go b/rpc/types_transaction_receipt.go index d3db91a7..cd50c58a 100644 --- a/rpc/types_transaction_receipt.go +++ b/rpc/types_transaction_receipt.go @@ -367,19 +367,30 @@ type ExecutionResources struct { // The number of unused memory cells (each cell is roughly equivalent to a step) MemoryHoles int `json:"memory_holes,omitempty"` // The number of RANGE_CHECK builtin instances - RangeCheckApps int `json:"range_check_builtin_applications"` + RangeCheckApps int `json:"range_check_builtin_applications,omitempty"` // The number of Pedersen builtin instances - PedersenApps int `json:"pedersen_builtin_applications"` + PedersenApps int `json:"pedersen_builtin_applications,omitempty"` // The number of Poseidon builtin instances - PoseidonApps int `json:"poseidon_builtin_applications"` + PoseidonApps int `json:"poseidon_builtin_applications,omitempty"` // The number of EC_OP builtin instances - ECOPApps int `json:"ec_op_builtin_applications"` + ECOPApps int `json:"ec_op_builtin_applications,omitempty"` // The number of ECDSA builtin instances - ECDSAApps int `json:"ecdsa_builtin_applications"` + ECDSAApps int `json:"ecdsa_builtin_applications,omitempty"` // The number of BITWISE builtin instances - BitwiseApps int `json:"bitwise_builtin_applications"` + BitwiseApps int `json:"bitwise_builtin_applications,omitempty"` // The number of KECCAK builtin instances - KeccakApps int `json:"keccak_builtin_applications"` + KeccakApps int `json:"keccak_builtin_applications,omitempty"` + // The number of accesses to the segment arena + SegmentArenaBuiltin int `json:"segment_arena_builtin,omitempty"` +} + +func (er *ExecutionResources) Validation() bool { + if er.Steps == 0 || er.MemoryHoles == 0 || er.RangeCheckApps == 0 || er.PedersenApps == 0 || + er.PoseidonApps == 0 || er.ECOPApps == 0 || er.ECDSAApps == 0 || er.BitwiseApps == 0 || + er.KeccakApps == 0 || er.SegmentArenaBuiltin == 0 { + return false + } + return true } // Hash returns the transaction hash of the PendingCommonTransactionReceiptProperties.