Skip to content

Commit

Permalink
Merge branch 'main' into rpcv06-receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhughes authored Nov 22, 2023
2 parents 057f4b9 + 7b39d75 commit cdd63dd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 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
29 changes: 20 additions & 9 deletions rpc/types_transaction_receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,23 +374,34 @@ type PendingCommonTransactionReceiptProperties struct {

type ExecutionResources struct {
// The number of Cairo steps used
Steps NumAsHex `json:"steps"`
Steps int `json:"steps"`
// The number of unused memory cells (each cell is roughly equivalent to a step)
MemoryHoles NumAsHex `json:"memory_holes,omitempty"`
MemoryHoles int `json:"memory_holes,omitempty"`
// The number of RANGE_CHECK builtin instances
RangeCheckApps NumAsHex `json:"range_check_builtin_applications"`
RangeCheckApps int `json:"range_check_builtin_applications,omitempty"`
// The number of Pedersen builtin instances
PedersenApps NumAsHex `json:"pedersen_builtin_applications"`
PedersenApps int `json:"pedersen_builtin_applications,omitempty"`
// The number of Poseidon builtin instances
PoseidonApps NumAsHex `json:"poseidon_builtin_applications"`
PoseidonApps int `json:"poseidon_builtin_applications,omitempty"`
// The number of EC_OP builtin instances
ECOPApps NumAsHex `json:"ec_op_builtin_applications"`
ECOPApps int `json:"ec_op_builtin_applications,omitempty"`
// The number of ECDSA builtin instances
ECDSAApps NumAsHex `json:"ecdsa_builtin_applications"`
ECDSAApps int `json:"ecdsa_builtin_applications,omitempty"`
// The number of BITWISE builtin instances
BitwiseApps NumAsHex `json:"bitwise_builtin_applications"`
BitwiseApps int `json:"bitwise_builtin_applications,omitempty"`
// The number of KECCAK builtin instances
KeccakApps NumAsHex `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.
Expand Down

0 comments on commit cdd63dd

Please sign in to comment.