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

itest: fix FEVM tests for upstream changes #10193

Merged
merged 3 commits into from
Feb 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions itests/fevm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func buildInputFromuint64(number uint64) []byte {
// recursive delegate calls that fail due to gas limits are currently getting to 229 iterations
// before running out of gas
func recursiveDelegatecallFail(ctx context.Context, t *testing.T, client *kit.TestFullNode, filename string, count uint64) {
expectedIterationsBeforeFailing := int(229)
expectedIterationsBeforeFailing := int(228)
fromAddr, idAddr := client.EVM().DeployContractFromFilename(ctx, filename)
t.Log("recursion count - ", count)
inputData := buildInputFromuint64(count)
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestFEVMRecursiveFail(t *testing.T) {
t.Run(fmt.Sprintf("TestFEVMRecursiveFail%d", failCallCount), func(t *testing.T) {
_, wait, err := client.EVM().InvokeContractByFuncName(ctx, fromAddr, idAddr, "recursiveCall(uint256)", buildInputFromuint64(failCallCount))
require.Error(t, err)
require.Equal(t, exitcode.ExitCode(23), wait.Receipt.ExitCode)
require.Equal(t, exitcode.ExitCode(37), wait.Receipt.ExitCode)
})
}
}
Expand Down Expand Up @@ -151,19 +151,19 @@ func TestFEVMRecursive2(t *testing.T) {
}

// TestFEVMBasic does a basic fevm contract installation and invocation
// recursive delegate call succeeds up to 238 times
// recursive delegate call succeeds up to 228 times
func TestFEVMRecursiveDelegatecall(t *testing.T) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test isn't making a lot of sense to me:

  1. recursiveDelegatecallFail has always expected 228 successes, not 238.
  2. If I change the "failure" loop to start at 229, the calls succeed and the test fails. But if I change the success loop to end at 238, the success loop fails.

So there appears to be a gulf between success/failure. This is not good but I'm not sure what's going on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also nit that the comment on top of the test is wrong

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(fixed)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 30 increment in the loop makes it hard to tell what the exact threshold is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@magik6k @Stebalien thanks 100% agree - i reorganized the test #10195


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

filename := "contracts/RecursiveDelegeatecall.hex"

//success with 238 or fewer calls
for i := uint64(1); i <= 238; i += 30 {
//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(238))
recursiveDelegatecallSuccess(ctx, t, client, filename, uint64(228))

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