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

CREATE tests #1572

Merged
merged 52 commits into from
Dec 7, 2024
Merged

CREATE tests #1572

merged 52 commits into from
Dec 7, 2024

Conversation

OlivierBBB
Copy link
Collaborator

No description provided.

@OlivierBBB OlivierBBB self-assigned this Nov 27, 2024
Not that the nonce is required, but it's part of the lookup

  HUB -> RLPADDR
We unconditionally import account.nonce() to the RLPADDR module. We must
therefore also include the nonce to disambiguate duplicate CREATE2's
case THIRTY_TWO -> program.push(0x20);
case MSIZE -> program.op(MSIZE);
case MAX -> program.push("ff".repeat(32));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here you may consider to do the following.

Modify the enum to:

public enum SizeParameter {
  ZERO(0),
  TWELVE(12), // - 3 - 1
  THIRTEEN(13), // - 3 + 0
  FOURTEEN(14), // - 3 + 1
  THIRTY_TWO(32),
  MSIZE,
  MAX;

 public int getValue() {
        if (this == MSIZE || this == MAX) {
            throw new UnsupportedOperationException("...");
        }
        return this.value;
    }

  public boolean isAnyOf(SizeParameter... sizeParameters) {
    for (SizeParameter sizeParameter : sizeParameters) {
      if (this == sizeParameter) {
        return true;
      }
    }
    return false;
  }

  public boolean willRaiseException() {
    return this.isAnyOf(MAX);
  }
}

Then, the code above would become:

 switch (sizeParameter) {
      case MSIZE -> program.op(MSIZE);
      case MAX -> program.push("ff".repeat(32));
      deafult -> program.push(sizeParameter.getValue();
    }

However, it is not a big deal to leave it as it is, but this could be a good approach for the future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Another approach may be using Either, where you basically either store an int or another type, that could be an enum, but it is probably not worth facing that complexity for this simple scenario.

Copy link
Collaborator

@lorenzogentile404 lorenzogentile404 Dec 4, 2024

Choose a reason for hiding this comment

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

also, what translates to an integer may have a more meaningful name rather than ZERO, TWELVE etc.

@@ -625,7 +625,7 @@ public void traceContextEnter(MessageFrame frame) {
frameType,
newChildContextNumber(),
this.deploymentStatusOf(frame.getContractAddress()),
frame.getValue(),
frame.getApparentValue(),
Copy link
Collaborator Author

@OlivierBBB OlivierBBB Dec 6, 2024

Choose a reason for hiding this comment

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

Important bug fix, required e.g. for DELEGATECALL to provide the CallFrame with the correct value i.e. callValue

OlivierBBB and others added 5 commits December 6, 2024 19:20
Otherwise the project doesn't work properly with updated constraints
triggers

  scenario/CALL_FAILURE_WILL_REVERT

using a self call and only 2 or 3 iterations (and blows up for
STATICCALL) with an exception.
@OlivierBBB OlivierBBB merged commit 92580b4 into arith-dev Dec 7, 2024
7 checks passed
@OlivierBBB OlivierBBB deleted the CREATE-tests branch December 7, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants