Skip to content

Commit

Permalink
Regenerate code from specification file
Browse files Browse the repository at this point in the history
  • Loading branch information
algo-dev-service committed Sep 14, 2023
1 parent c039b84 commit c39b13d
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 0 deletions.
17 changes: 17 additions & 0 deletions client/v2/common/models/application_initial_states.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package models

// ApplicationInitialStates an application's initial global/local/box states that
// were accessed during simulation.
type ApplicationInitialStates struct {
// AppBoxes an application's global/local/box state.
AppBoxes ApplicationKVStorage `json:"app-boxes,omitempty"`

// AppGlobals an application's global/local/box state.
AppGlobals ApplicationKVStorage `json:"app-globals,omitempty"`

// AppLocals an application's initial local states tied to different accounts.
AppLocals []ApplicationKVStorage `json:"app-locals,omitempty"`

// Id application index.
Id uint64 `json:"id"`
}
10 changes: 10 additions & 0 deletions client/v2/common/models/application_k_v_storage.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package models

// ApplicationKVStorage an application's global/local/box state.
type ApplicationKVStorage struct {
// Account the address of the account associated with the local state.
Account string `json:"account,omitempty"`

// Kvs key-Value pairs representing application states.
Kvs []AvmKeyValue `json:"kvs"`
}
22 changes: 22 additions & 0 deletions client/v2/common/models/application_state_operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package models

// ApplicationStateOperation an operation against an application's global/local/box
// state.
type ApplicationStateOperation struct {
// Account for local state changes, the address of the account associated with the
// local state.
Account string `json:"account,omitempty"`

// AppStateType type of application state. Value `g` is **global state**, `l` is
// **local state**, `b` is **boxes**.
AppStateType string `json:"app-state-type"`

// Key the key (name) of the global/local/box state.
Key []byte `json:"key"`

// NewValue represents an AVM value.
NewValue AvmValue `json:"new-value,omitempty"`

// Operation operation type. Value `w` is **write**, `d` is **delete**.
Operation string `json:"operation"`
}
10 changes: 10 additions & 0 deletions client/v2/common/models/avm_key_value.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package models

// AvmKeyValue represents an AVM key-value pair in an application store.
type AvmKeyValue struct {
// Key
Key []byte `json:"key"`

// Value represents an AVM value.
Value AvmValue `json:"value"`
}
9 changes: 9 additions & 0 deletions client/v2/common/models/simulate_initial_states.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package models

// SimulateInitialStates initial states of resources that were accessed during
// simulation.
type SimulateInitialStates struct {
// AppInitialStates the initial states of accessed application before simulation.
// The order of this array is arbitrary.
AppInitialStates []ApplicationInitialStates `json:"app-initial-states,omitempty"`
}
6 changes: 6 additions & 0 deletions client/v2/common/models/simulate_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ type SimulateRequest struct {
// transaction group.
ExtraOpcodeBudget uint64 `json:"extra-opcode-budget,omitempty"`

// Round if provided, specifies the round preceding the simulation. State changes
// through this round will be used to run this simulation. Usually only the 4 most
// recent rounds will be available (controlled by the node config value
// MaxAcctLookback). If not specified, defaults to the latest available round.
Round uint64 `json:"round,omitempty"`

// TxnGroups the transaction groups to simulate.
TxnGroups []SimulateRequestTransactionGroup `json:"txn-groups"`
}
3 changes: 3 additions & 0 deletions client/v2/common/models/simulate_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ type SimulateResponse struct {
// ExecTraceConfig an object that configures simulation execution trace.
ExecTraceConfig SimulateTraceConfig `json:"exec-trace-config,omitempty"`

// InitialStates initial states of resources that were accessed during simulation.
InitialStates SimulateInitialStates `json:"initial-states,omitempty"`

// LastRound the round immediately preceding this simulation. State changes through
// this round were used to run this simulation.
LastRound uint64 `json:"last-round"`
Expand Down
4 changes: 4 additions & 0 deletions client/v2/common/models/simulate_trace_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ type SimulateTraceConfig struct {
// StackChange a boolean option enabling returning stack changes together with
// execution trace during simulation.
StackChange bool `json:"stack-change,omitempty"`

// StateChange a boolean option enabling returning application state changes
// (global, local, and box changes) with the execution trace during simulation.
StateChange bool `json:"state-change,omitempty"`
}
3 changes: 3 additions & 0 deletions client/v2/common/models/simulation_opcode_trace_unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ type SimulationOpcodeTraceUnit struct {

// StackPopCount the number of deleted stack values by this opcode.
StackPopCount uint64 `json:"stack-pop-count,omitempty"`

// StateChanges the operations against the current application's states.
StateChanges []ApplicationStateOperation `json:"state-changes,omitempty"`
}
11 changes: 11 additions & 0 deletions client/v2/common/models/simulation_transaction_exec_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ package models
// SimulationTransactionExecTrace the execution trace of calling an app or a logic
// sig, containing the inner app call trace in a recursive way.
type SimulationTransactionExecTrace struct {
// ApprovalProgramHash sHA512_256 hash digest of the approval program executed in
// transaction.
ApprovalProgramHash []byte `json:"approval-program-hash,omitempty"`

// ApprovalProgramTrace program trace that contains a trace of opcode effects in an
// approval program.
ApprovalProgramTrace []SimulationOpcodeTraceUnit `json:"approval-program-trace,omitempty"`

// ClearStateProgramHash sHA512_256 hash digest of the clear state program executed
// in transaction.
ClearStateProgramHash []byte `json:"clear-state-program-hash,omitempty"`

// ClearStateProgramTrace program trace that contains a trace of opcode effects in
// a clear state program.
ClearStateProgramTrace []SimulationOpcodeTraceUnit `json:"clear-state-program-trace,omitempty"`
Expand All @@ -15,6 +23,9 @@ type SimulationTransactionExecTrace struct {
// trace of any inner transactions executed.
InnerTrace []SimulationTransactionExecTrace `json:"inner-trace,omitempty"`

// LogicSigHash sHA512_256 hash digest of the logic sig executed in transaction.
LogicSigHash []byte `json:"logic-sig-hash,omitempty"`

// LogicSigTrace program trace that contains a trace of opcode effects in a logic
// sig.
LogicSigTrace []SimulationOpcodeTraceUnit `json:"logic-sig-trace,omitempty"`
Expand Down

0 comments on commit c39b13d

Please sign in to comment.