Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algod: Simulate endpoint stack-change exposure #5440

Merged
merged 56 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
04dfd93
request and result on config option
ahangsu May 31, 2023
1bae142
default stack change explained from proto io, with more specific info…
ahangsu Jun 1, 2023
c49cd4e
explain function for specific opcodes, during simulation debugger tim…
ahangsu Jun 1, 2023
54b6467
minor, pause on work now
ahangsu Jun 1, 2023
28e8f7b
Merge branch 'master' into simulate-stack-change
ahangsu Jun 5, 2023
4ddbf75
Merge branch 'master' into simulate-stack-change
ahangsu Jun 7, 2023
c6244fc
remove a few copying subroutine
ahangsu Jun 8, 2023
032f1e5
add addition and deletion fields to traceunit response
ahangsu Jun 8, 2023
3f18a5e
teal value representation, not from model
ahangsu Jun 8, 2023
d629ccc
prototyped append added and deleted values to exec trace
ahangsu Jun 8, 2023
9b13eed
minor, refactor tracer append deletion and additions
ahangsu Jun 9, 2023
2aad3ce
first test on stack trace exposure finished
ahangsu Jun 9, 2023
c667472
minor, test reconstruct
ahangsu Jun 9, 2023
2d60052
minor, unit test and reconstruct, move explain to tracer
ahangsu Jun 9, 2023
e60db71
minor, mergeProtos should take one of the explains
ahangsu Jun 9, 2023
3dbef39
e2e test seems to be working
ahangsu Jun 9, 2023
1bf1505
think of a small app using (frame) dig/bury and proto, test specified…
ahangsu Jun 10, 2023
26a3ffd
flakyness test fix
ahangsu Jun 10, 2023
a852fdb
test weird stack manipulation opcode
ahangsu Jun 12, 2023
c051d9a
data labeling for stack trace
ahangsu Jun 12, 2023
3e68479
expose disassembled line in response
ahangsu Jun 13, 2023
ea9469d
PR comment from JJ response
ahangsu Jun 14, 2023
a8499f5
re-order imports, remove unused methods
ahangsu Jun 14, 2023
6a2cb73
Merge branch 'master' into simulate-stack-change
ahangsu Jun 15, 2023
556b95f
remove unused code
ahangsu Jun 15, 2023
02784f8
testing commit, see why segfault in api/server/v2
ahangsu Jun 16, 2023
8b4b2fd
Merge branch 'master' into simulate-stack-change
ahangsu Jun 16, 2023
5997dd2
Revert "testing commit, see why segfault in api/server/v2"
ahangsu Jun 16, 2023
b1316ca
re diff in debugger.go, explain func ptr to instance, rm unnecessary …
ahangsu Jun 20, 2023
61d7313
use conversion subroutine in daemon, separation from simulate package
ahangsu Jun 20, 2023
7b42650
convert to b64 on stack change var
ahangsu Jun 20, 2023
7a13d26
totealvalue
ahangsu Jun 20, 2023
77db8ec
Revert "totealvalue"
ahangsu Jun 21, 2023
f60d611
Merge branch 'master' into simulate-stack-change
ahangsu Jun 21, 2023
97a8041
Merge branch 'master' into simulate-stack-change
ahangsu Jun 21, 2023
05ecc8b
move b64 conversion to rest endpoint export
ahangsu Jun 22, 2023
19a5f5d
Merge branch 'master' into simulate-stack-change
ahangsu Jun 22, 2023
4a2765e
use stackvalue, deprecate tealvalue, modify testcase
ahangsu Jun 23, 2023
ddf9856
Merge branch 'master' into simulate-stack-change
ahangsu Jun 24, 2023
caa07bb
remove disassemble line
ahangsu Jun 24, 2023
328c1c1
Merge branch 'master' into simulate-stack-change
ahangsu Jun 26, 2023
64e4ea8
minor, better guarding
ahangsu Jun 28, 2023
02e23a0
if error in opcode, stack change should record only consumed stack vars
ahangsu Jun 28, 2023
cf311f5
stack value description
ahangsu Jun 28, 2023
c64b63f
update reverse step support, only deletion num suffices
ahangsu Jun 28, 2023
e02b34c
per pr response
ahangsu Jun 29, 2023
0494b19
succinct restclient testcase
ahangsu Jun 29, 2023
7719de3
even more succinct test
ahangsu Jun 29, 2023
0b20c88
pin stack change
ahangsu Jun 29, 2023
03d50b7
test type cast change
ahangsu Jun 29, 2023
2a2f923
pushints and pushbytess support
ahangsu Jun 29, 2023
4301d4b
minor, uint64tobytes
ahangsu Jun 29, 2023
44d3c1d
Merge branch 'master' into simulate-stack-change
ahangsu Jul 5, 2023
85aef31
daemon oas2 endpoint change
ahangsu Jul 5, 2023
5a91762
remove StackChangeExplanation struct def
ahangsu Jul 5, 2023
b2bdb2d
per jjs comments
ahangsu Jul 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
simulateAllowMoreOpcodeBudget bool
simulateExtraOpcodeBudget uint64
simulateEnableRequestTrace bool
simulateStackChange bool
)

func init() {
Expand Down Expand Up @@ -163,6 +164,7 @@
simulateCmd.Flags().BoolVar(&simulateAllowMoreOpcodeBudget, "allow-more-opcode-budget", false, "Apply max extra opcode budget for apps per transaction group (default 320000) during simulation")
simulateCmd.Flags().Uint64Var(&simulateExtraOpcodeBudget, "extra-opcode-budget", 0, "Apply extra opcode budget for apps per transaction group during simulation")
simulateCmd.Flags().BoolVar(&simulateEnableRequestTrace, "trace", false, "Enable simulation time execution trace of app calls")
simulateCmd.Flags().BoolVar(&simulateStackChange, "stack", false, "Report stack change during simulation time")
}

var clerkCmd = &cobra.Command{
Expand Down Expand Up @@ -1366,5 +1368,6 @@
func traceCmdOptionToSimulateTraceConfigModel() simulation.ExecTraceConfig {
return simulation.ExecTraceConfig{
Enable: simulateEnableRequestTrace,
Stack: simulateStackChange,

Check warning on line 1371 in cmd/goal/clerk.go

View check run for this annotation

Codecov / codecov/patch

cmd/goal/clerk.go#L1371

Added line #L1371 was not covered by tests
jannotti marked this conversation as resolved.
Show resolved Hide resolved
}
}
41 changes: 41 additions & 0 deletions daemon/algod/api/algod.oas2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3108,6 +3108,29 @@
}
}
},
"StackValue": {
jannotti marked this conversation as resolved.
Show resolved Hide resolved
"description": "Represents a TEAL value over the stack.",
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"description": "value type. Value `1` refers to **bytes**, value `2` refers to **uint**",
ahangsu marked this conversation as resolved.
Show resolved Hide resolved
"type": "integer"
},
"bytes": {
"description": "bytes value.",
"type": "string",
"format": "byte"
},
"uint": {
"description": "uint value.",
"type": "integer",
"x-algorand-format": "uint64"
}
}
},
"StateDelta": {
"description": "Application state delta.",
"type": "array",
Expand Down Expand Up @@ -3491,6 +3514,10 @@
"enable": {
"description": "A boolean option for opting in execution trace features simulation endpoint.",
"type": "boolean"
},
"stack-change": {
"description": "A boolean option enabling returning stack changes together with execution trace during simulation.",
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -3870,6 +3897,20 @@
"items": {
"type": "integer"
}
},
"deletions": {
"description": "The values deleted by this opcode from the stack.",
"type": "array",
"items": {
"$ref": "#/definitions/StackValue"
}
},
"additions": {
ahangsu marked this conversation as resolved.
Show resolved Hide resolved
"description": "The values added by this opcode to the stack.",
"type": "array",
"items": {
"$ref": "#/definitions/StackValue"
}
}
}
},
Expand Down
42 changes: 42 additions & 0 deletions daemon/algod/api/algod.oas3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1966,6 +1966,10 @@
"enable": {
"description": "A boolean option for opting in execution trace features simulation endpoint.",
"type": "boolean"
},
"stack-change": {
"description": "A boolean option enabling returning stack changes together with execution trace during simulation.",
"type": "boolean"
}
},
"type": "object"
Expand Down Expand Up @@ -2053,6 +2057,20 @@
"SimulationOpcodeTraceUnit": {
"description": "The set of trace information and effect from evaluating a single opcode.",
"properties": {
"additions": {
"description": "The values added by this opcode to the stack.",
"items": {
"$ref": "#/components/schemas/StackValue"
},
"type": "array"
},
"deletions": {
"description": "The values deleted by this opcode from the stack.",
"items": {
"$ref": "#/components/schemas/StackValue"
},
"type": "array"
},
"pc": {
"description": "The program counter of the current opcode being evaluated.",
"type": "integer"
Expand Down Expand Up @@ -2104,6 +2122,30 @@
},
"type": "object"
},
"StackValue": {
"description": "Represents a TEAL value over the stack.",
"properties": {
"bytes": {
"description": "bytes value.",
"format": "byte",
"pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
"type": "string"
},
"type": {
"description": "value type. Value `1` refers to **bytes**, value `2` refers to **uint**",
"type": "integer"
},
"uint": {
"description": "uint value.",
"type": "integer",
"x-algorand-format": "uint64"
}
},
"required": [
"type"
],
"type": "object"
},
"StateDelta": {
"description": "Application state delta.",
"items": {
Expand Down
76 changes: 39 additions & 37 deletions daemon/algod/api/server/v2/generated/data/routes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.