diff --git a/rpc/types_event.go b/rpc/types_event.go index 04285ae6..ab5a0341 100644 --- a/rpc/types_event.go +++ b/rpc/types_event.go @@ -23,9 +23,9 @@ type EventChunk struct { type EmittedEvent struct { Event // BlockHash the hash of the block in which the event was emitted - BlockHash *felt.Felt `json:"block_hash"` + BlockHash *felt.Felt `json:"block_hash,omitempty"` // BlockNumber the number of the block in which the event was emitted - BlockNumber uint64 `json:"block_number"` + BlockNumber uint64 `json:"block_number,omitempty"` // TransactionHash the transaction that emitted the event TransactionHash *felt.Felt `json:"transaction_hash"` } diff --git a/rpc/types_trace.go b/rpc/types_trace.go index 5c84c22a..3a98588c 100644 --- a/rpc/types_trace.go +++ b/rpc/types_trace.go @@ -65,6 +65,7 @@ type DeployAccountTxnTrace struct { type L1HandlerTxnTrace struct { //the trace of the __execute__ call or constructor call, depending on the transaction type (none for declare transactions) FunctionInvocation FnInvocation `json:"function_invocation"` + StateDiff StateDiff `json:"state_diff"` Type TransactionType `json:"type"` } @@ -79,8 +80,9 @@ const ( type CallType string const ( - LibraryCall CallType = "LIBRARY_CALL" - Call CallType = "CALL" + CallTypeLibraryCall CallType = "LIBRARY_CALL" + CallTypeCall CallType = "CALL" + CallTypeDelegate CallType = "DELEGATE" ) type FnInvocation struct { @@ -107,6 +109,9 @@ type FnInvocation struct { // The messages sent by this invocation to L1 L1Messages []OrderedMsg `json:"messages"` + + // Resources consumed by the internal call + ExecutionResources ExecutionResources `json:"execution_resources"` } // A single pair of transaction hash and corresponding trace diff --git a/rpc/types_transaction_receipt.go b/rpc/types_transaction_receipt.go index 50d37eda..7b35d2ad 100644 --- a/rpc/types_transaction_receipt.go +++ b/rpc/types_transaction_receipt.go @@ -2,7 +2,6 @@ package rpc import ( "encoding/json" - "errors" "fmt" "strconv" @@ -382,41 +381,17 @@ type ExecutionResources struct { // The number of KECCAK builtin instances KeccakApps int `json:"keccak_builtin_applications,omitempty"` // The number of accesses to the segment arena - SegmentArena int `json:"segment_arena_builtin,omitempty"` + SegmentArenaBuiltin int `json:"segment_arena_builtin,omitempty"` } -func (er *ExecutionResources) Validate() error { - if er.Steps == 0 { - return errors.New("steps cannot be zero") +// Validate checks if the fields are non-zero (to match the starknet-specs) +func (er *ExecutionResources) Validate() 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 } - if er.MemoryHoles == 0 { - return errors.New("MemoryHoles cannot be zero") - } - if er.RangeCheckApps == 0 { - return errors.New("RangeCheckApps cannot be zero") - } - if er.PedersenApps == 0 { - return errors.New("PedersenApps cannot be zero") - } - if er.PoseidonApps == 0 { - return errors.New("PoseidonApps cannot be zero") - } - if er.ECOPApps == 0 { - return errors.New("ECOPApps cannot be zero") - } - if er.ECOPApps == 0 { - return errors.New("ECOPApps cannot be zero") - } - if er.BitwiseApps == 0 { - return errors.New("BitwiseApps cannot be zero") - } - if er.KeccakApps == 0 { - return errors.New("KeccakApps cannot be zero") - } - if er.SegmentArena == 0 { - return errors.New("KeccakApps cannot be zero") - } - return nil + return true } // Hash returns the transaction hash of the PendingCommonTransactionReceiptProperties.