Skip to content

Commit

Permalink
clean up test for recursive delegate call count. improved readability (
Browse files Browse the repository at this point in the history
  • Loading branch information
snissn authored Feb 6, 2023
1 parent 1ab5305 commit 23eaee4
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions itests/fevm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,26 @@ func TestFEVMRecursive2(t *testing.T) {
require.Equal(t, 2, len(events))
}

// TestFEVMRecursiveDelegateCall tests the maximum delegatecall recursion depth. It currently
// succeeds succeeds up to 228 times.
func TestFEVMRecursiveDelegatecall(t *testing.T) {
// TestFEVMRecursiveDelegatecallCount tests the maximum delegatecall recursion depth. It currently
// succeeds succeeds up to 237 times.
func TestFEVMRecursiveDelegatecallCount(t *testing.T) {

ctx, cancel, client := kit.SetupFEVMTest(t)
defer cancel()

highestSuccessCount := uint64(237)

filename := "contracts/RecursiveDelegeatecall.hex"
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(1))
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(2))
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(10))
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(100))
recursiveDelegatecallSuccess(ctx, t, client, filename, highestSuccessCount)

//success with 228 or fewer calls
for i := uint64(1); i <= 228; i += 30 {
recursiveDelegatecallSuccess(ctx, t, client, filename, i)
}
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(228))
recursiveDelegatecallFail(ctx, t, client, filename, highestSuccessCount+1)
recursiveDelegatecallFail(ctx, t, client, filename, uint64(1000))
recursiveDelegatecallFail(ctx, t, client, filename, uint64(10000000))

for i := uint64(239); i <= 800; i += 40 {
recursiveDelegatecallFail(ctx, t, client, filename, i)
}
}

// TestFEVMBasic does a basic fevm contract installation and invocation
Expand Down

0 comments on commit 23eaee4

Please sign in to comment.