Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

Commit f145dfd

Browse files
authored
Add support for validation rule OP-080 (#394)
1 parent 85e227c commit f145dfd

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pkg/entrypoint/simulation/simulateutils.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,19 @@ var (
2525
"BASEFEE",
2626
"BLOCKHASH",
2727
"NUMBER",
28-
"SELFBALANCE",
29-
"BALANCE",
3028
"ORIGIN",
3129
"GAS",
3230
"CREATE",
3331
"COINBASE",
3432
"SELFDESTRUCT",
3533
)
3634

35+
// List of opcodes not allowed during validation for unstaked entities.
36+
bannedUnstakedOpCodes = mapset.NewSet(
37+
"SELFBALANCE",
38+
"BALANCE",
39+
)
40+
3741
revertOpCode = "REVERT"
3842
returnOpCode = "RETURN"
3943

pkg/entrypoint/simulation/tracevalidation.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ func TraceSimulateValidation(in *TraceInput) (*TraceOutput, error) {
9393
if bannedOpCodes.Contains(opcode) {
9494
return nil, fmt.Errorf("%s uses banned opcode: %s", title, opcode)
9595
}
96+
97+
if !entity.IsStaked && bannedUnstakedOpCodes.Contains(opcode) {
98+
return nil, fmt.Errorf("unstaked %s uses banned opcode: %s", title, opcode)
99+
}
96100
}
97101

98102
ic.Add(entity.Address)

0 commit comments

Comments
 (0)