-
Notifications
You must be signed in to change notification settings - Fork 731
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-7685 #7068
EIP-7685 #7068
Conversation
Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java
Outdated
Show resolved
Hide resolved
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockHeader.java
Outdated
Show resolved
Hide resolved
...core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/WithdrawalRequestEncoder.java
Show resolved
Hide resolved
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockBody.java
Outdated
Show resolved
Hide resolved
...s/src/reference-test/java/org/hyperledger/besu/ethereum/vm/BlockchainReferenceTestTools.java
Show resolved
Hide resolved
.../hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/RequestValidatorProvider.java
Outdated
Show resolved
Hide resolved
.../hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/RequestValidatorProvider.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
…nalia/besu into eip-7685-deposits
import org.hyperledger.besu.ethereum.rlp.RLP; | ||
import org.hyperledger.besu.ethereum.rlp.RLPOutput; | ||
|
||
import org.apache.tuweni.bytes.Bytes; | ||
|
||
public class DepositEncoder { | ||
|
||
public static void encode(final Deposit deposit, final RLPOutput rlpOutput) { | ||
public static void encode(final Request request, final RLPOutput rlpOutput) { |
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 like that we are using composition over inheritance with these codecs.
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/RequestEncoder.java
Outdated
Show resolved
Hide resolved
* @throws IllegalArgumentException if the serialized type value does not correspond to any {@link | ||
* RequestType}. | ||
*/ | ||
public static RequestType of(final int serializedTypeValue) { |
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.
Would rather just treat the request type as bytes and just pass the requestType byte in from the RequestDecoder
if (requests == null) { | ||
return Collections.emptyList(); | ||
} | ||
return requests.stream().filter(requestType::isInstance).map(requestType::cast).toList(); |
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.
Can we use the enum RequestType
to filter on instead of filtering by the class?
return validateRequests(block, maybeRequests.get(), receipts); | ||
} | ||
|
||
public boolean validateRoot(final Block block, final Optional<List<Request>> requests) { |
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.
This method isn't being used anywhere
...um/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PragueRequestsValidatorTest.java
Outdated
Show resolved
Hide resolved
@@ -170,16 +166,12 @@ public Optional<Hash> getWithdrawalsRoot() { | |||
} | |||
|
|||
/** | |||
* Returns the block deposits root hash. | |||
* Returns the block request root hash. |
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.
nit: should be requests root hash
* @throws IllegalArgumentException if the provided request is not a WithdrawalRequest. | ||
*/ | ||
public static void encode(final Request request, final RLPOutput rlpOutput) { | ||
if (!(request instanceof WithdrawalRequest withdrawalRequest)) { |
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.
Rather use the Request.getType()
and check it is a deposit rather than doing an instanceof
@@ -91,36 +89,15 @@ public static Hash withdrawalsRoot(final List<Withdrawal> withdrawals) { | |||
} | |||
|
|||
/** | |||
* Generates the deposits root for a list of deposits | |||
* Generates the request root for a list of requests |
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.
nit: request root
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/BodyValidation.java
Outdated
Show resolved
Hide resolved
* RequestType}. | ||
*/ | ||
public static RequestType of(final int serializedTypeValue) { | ||
return Arrays.stream(RequestType.values()) |
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.
Would a switch statement be easier/more performant?
return RequestDecoder.decode(rlpInput); | ||
} | ||
|
||
public void writeTo(final RLPOutput out) { |
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 think we do not need an implementation here!
return Optional.empty(); | ||
} | ||
List<Deposit> deposits = findDepositsFromReceipts(transactionReceipts); | ||
return Optional.of(deposits.stream().map(r -> (Request) r).toList()); |
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.
If RequestProcessor.process
arg type was List<? extends Request>
instead of List<Request>
could avoid the additional iteration to cast to the right type.
...eum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/DepositsValidator.java
Show resolved
Hide resolved
...rc/main/java/org/hyperledger/besu/ethereum/mainnet/requests/RequestProcessorCoordinator.java
Show resolved
Hide resolved
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Description
General purpose execution layer requests eip-7685
This PR implements the generic execution layer requests.
Fixes #6985, #6986 and the last item of #6800
Main changes:
depositsRoot
andwithdrawalRequestRoot
from theblockheader
deposit
andwithdrawal
requests from the block bodyrequestsRoot
in theblockHeader
depoistValidator
andwithdrawalRequestValidator
RequestValidatorCoordinator
andRequestProcessorCoordinator
deposits
andwithdrawalRequests
from block creation and block processing to newDepositProcessor
andWithdrawalRequestProcessor
depositValidatorProvider
andwithdrawalRequestValidatorProvider
byRequestValidadorProvider
This PR does not ensure the logic of
Deposits
andwithdrawalRequests
but encapsulates them into a generic request list that is used to calculate the newrequestRoot
. The engine API has not changed and the requests are still split intodeposits
andwithdrawalRequests
.To do: