Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes committed Nov 22, 2023
2 parents 457bea3 + 7b39d75 commit a71523f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 37 deletions.
4 changes: 2 additions & 2 deletions rpc/types_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
9 changes: 7 additions & 2 deletions rpc/types_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand All @@ -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 {
Expand All @@ -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
Expand Down
41 changes: 8 additions & 33 deletions rpc/types_transaction_receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rpc

import (
"encoding/json"
"errors"
"fmt"
"strconv"

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a71523f

Please sign in to comment.