-
Notifications
You must be signed in to change notification settings - Fork 871
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
Eip 7709 implement gas costs #7983
base: verkle
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,7 +260,7 @@ dependencies { | |
} | ||
verkleRefTestImplemention dependencies.create('ethereum:execution-spec-tests') { | ||
version { | ||
strictly '[email protected].8' | ||
strictly '[email protected].9-alpha-1' | ||
} | ||
artifact { | ||
name = 'fixtures' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,11 +50,18 @@ public OperationResult execute(final MessageFrame frame, final EVM evm) { | |
return new OperationResult(cost, null); | ||
} | ||
|
||
final long remainingGas = frame.getRemainingGas(); | ||
final BlockHashLookup blockHashLookup = frame.getBlockHashLookup(); | ||
final Hash blockHash = blockHashLookup.apply(frame, blockArg.toLong()); | ||
final long lookupCost = remainingGas - frame.getRemainingGas(); | ||
if (Hash.EMPTY.equals(blockHash)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems quite strange to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend |
||
return new OperationResult(lookupCost, ExceptionalHaltReason.INSUFFICIENT_GAS); | ||
} | ||
// give lookupCost back as it will be taken after | ||
frame.incrementRemainingGas(lookupCost); | ||
frame.pushStackItem(blockHash); | ||
|
||
return new OperationResult(cost, null); | ||
return new OperationResult(cost + lookupCost, null); | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it in the spec ? I see that in the first failure we return ZERO and in this one EMPTY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not in the spec but this will not surface to consensus because it will be handled properly in BlockHashOperation. This was the only way I found to stop execution if out of gas. Could have an exception if you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For precompiles execeptional halts (like this one, out of gas) are handled by returning
null
rather thanHash.EMPTY
, which is as valid a response as any other hash.