-
Notifications
You must be signed in to change notification settings - Fork 867
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
Datahash opcode #4933
Datahash opcode #4933
Conversation
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.
looks good, please check my comments/questions
@@ -753,6 +768,7 @@ private static Bytes32 computeSenderRecoveryHash( | |||
preimage = frontierPreimage(nonce, gasPrice, gasLimit, to, value, payload, chainId); | |||
break; | |||
case EIP1559: | |||
case EIP4844: |
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.
idk too much about the recovery hash, so just asking if the versionedHashes
should be ignored or taken in consideration here
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.
I'm also unclear, but i think this will make more sense when we merge in the SSZ serialization
@@ -979,6 +995,7 @@ public static class Builder { | |||
protected Optional<BigInteger> chainId = Optional.empty(); | |||
|
|||
protected Optional<BigInteger> v = Optional.empty(); | |||
protected Optional<List<Hash>> versionedHashes; |
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.
it seems simpler and more efficient to treat this likewise maxPriorityFeePerGas
and similar optional field, keeping it null
by default and using Optional.ofNullable
in the build
method
evm/src/main/java/org/hyperledger/besu/evm/operation/DataHashOperation.java
Outdated
Show resolved
Hide resolved
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.
One thing is unclear to me, if the chain is post-cancun, and they pass in a legacy or 1559 transaction should the datahash opcode be available? i.e. should it act as though there were zero hashes and always return zero or should it throw an invalid opcode if a 1559 tx calls a contract with the opcode?
Currently it looks like we are coded for the latter. This doesn't seem like the valid set of opcodes should be a function of the transaction format.
evm/src/main/java/org/hyperledger/besu/evm/operation/DataHashOperation.java
Outdated
Show resolved
Hide resolved
Yes! I struggled with this as well while implementing it, and in hindsight i think I like returning zero instead. That way at least contract authors using DATAHASH can choose to accept or not pre-4844 transactions without a halt. I will change this and bring it up for discussion and see if test cases to cover this are planned. |
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java
Outdated
Show resolved
Hide resolved
...um/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java
Outdated
Show resolved
Hide resolved
…ventsImplTest Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
…s, wtf Signed-off-by: Justin Florentine <justin+github@florentine.us>
… dns Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
…blic constructor. Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
evm/src/main/java/org/hyperledger/besu/evm/operation/DataHashOperation.java
Outdated
Show resolved
Hide resolved
evm/src/test/java/org/hyperledger/besu/evm/operations/DataHashOperationTest.java
Outdated
Show resolved
Hide resolved
evm/src/test/java/org/hyperledger/besu/evm/operations/DataHashOperationTest.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@Test | ||
public void failsOnVersionIndexOutOFBounds() { |
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.
fail
in tests indicates to me an exception raised, rather than a zero push.
public void pushesZeroOnVersionInexOutOfBounds() {
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.
Return need to be null exceptional halt reason, and some minor test changes (perhaps we should add the null exceptional halt to the last two unit tests for the data hash)
…peration.java Co-authored-by: Danno Ferrin <danno.ferrin@shemnon.com> Signed-off-by: Justin Florentine <justin+github@florentine.us>
…OperationTest.java Co-authored-by: Danno Ferrin <danno.ferrin@shemnon.com> Signed-off-by: Justin Florentine <justin+github@florentine.us>
…OperationTest.java Co-authored-by: Danno Ferrin <danno.ferrin@shemnon.com> Signed-off-by: Justin Florentine <justin+github@florentine.us>
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.
Doesn't o.h.b.e.m.MainnetProtocolSpecs#cancunDefinition
need to set the transactionValidatorBuilder to add support for the new BLOB
tx?
For the future, maybe we could came up with a different design for the Transaction/MessageFrame that doesn't carry so many Optional
s all around.
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java
Outdated
Show resolved
Hide resolved
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/Transaction.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Implements new DATAHASH opcode in EVM Signed-off-by: Justin Florentine <justin+github@florentine.us>
Implements new DATAHASH opcode in EVM Signed-off-by: Justin Florentine <justin+github@florentine.us>
Don't merge till https://github.com/hyperledger/besu/pull/4931/files has been merged.