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

Open
wants to merge 29 commits into
base: arith-dev
Choose a base branch
from
Open

CREATE tests #1572

wants to merge 29 commits into from

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
@@ -206,6 +206,7 @@ public CreateSection(Hub hub, MessageFrame frame) {
if (failedCreate) {
finalContextFragment = ContextFragment.nonExecutionProvidesEmptyReturnData(hub);
scenarioFragment.setScenario(CREATE_FAILURE_CONDITION_WONT_REVERT);
commonValues.payGasPaidOutOfPocket(hub);
Copy link
Collaborator Author

@OlivierBBB OlivierBBB Dec 2, 2024

Choose a reason for hiding this comment

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

omission

preOpcodeCreateeSnapshot,
preOpcodeCreateeSnapshot,
preOpcodeCreatorSnapshot,
preOpcodeCreatorSnapshot,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

typo

currentAddress,
salt,
hash,
longToUnsignedBigInteger(frame.getWorldUpdater().get(currentAddress).getNonce()));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Even though it's unnecessary, the nonce is part of the HUB -> RLPADDR lookup for CREATE2.

@@ -134,6 +142,7 @@ private void traceCreate2(int stamp, RlpAddrOperation chunk, Trace trace) {
.saltLo(chunk.salt().orElseThrow().slice(LLARGE, LLARGE))
.kecHi(chunk.keccak().orElseThrow().slice(0, LLARGE))
.kecLo(chunk.keccak().orElseThrow().slice(LLARGE, LLARGE))
.nonce(nonceBytes)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We trace the nonce in all cases.

Address address,
Bytes32 salt,
Bytes32 kec,
BigInteger nonce) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adding the nonce to the interface

}

long gasMinusUpfront = currentGas - upfrontGasCost;
return gasMinusUpfront - gasMinusUpfront / 64;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a genuine mistake. the 63/64-ths business happens after paying the upfront gas cost.


final long gasMinusUpfrontGasCost = currentGas - upfrontGasCost;

return gasMinusUpfrontGasCost - gasMinusUpfrontGasCost / 64;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same mistake for CREATE2

public ToyAccount raiseNonceBy(long k) {
long updatedNonce = this.getNonce() + k;
return new ToyAccount(this.parent, this.getAddress(), updatedNonce, this.balance, this.balance);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Bandaid

We unconditionally import account.nonce() to the RLPADDR module. We must
therefore also include the nonce to disambiguate duplicate CREATE2's
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant