[MINOR] Rename deposit to depositRequest (#7145)

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
pull/7152/head
Gabriel-Trintinalia 6 months ago committed by GitHub
parent fb25f180b0
commit 2df721619a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java
  2. 2
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4.java
  3. 28
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/DepositRequestParameter.java
  4. 12
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/EnginePayloadParameter.java
  5. 25
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/EngineGetPayloadResultV4.java
  6. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineGetPayloadTest.java
  7. 22
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayloadTest.java
  8. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineGetPayloadV4Test.java
  9. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV3Test.java
  10. 52
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/EngineNewPayloadV4Test.java
  11. 8
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/DepositParameterTestFixture.java
  12. 14
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/parameters/DepositRequestRequestParameterTest.java
  13. 40
      ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java
  14. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/BlockBody.java
  15. 7
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/DepositRequest.java
  16. 14
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/DepositRequestDecoder.java
  17. 16
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/DepositRequestEncoder.java
  18. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/RequestDecoder.java
  19. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/encoding/RequestEncoder.java
  20. 13
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/DepositRequestProcessor.java
  21. 34
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/DepositRequestValidator.java
  22. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/MainnetRequestsValidator.java
  23. 15
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/requests/RequestUtil.java
  24. 22
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/DepositRequestRequestDecoderTest.java
  25. 14
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/encoding/DepositRequestRequestEncoderTest.java
  26. 65
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DepositRequestValidatorTest.java
  27. 8
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockBodyValidatorTest.java
  28. 6
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/task/GetBodiesFromPeerTaskTest.java
  29. 4
      ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/T8nExecutor.java
  30. 2
      plugin-api/build.gradle
  31. 2
      plugin-api/src/main/java/org/hyperledger/besu/plugin/data/DepositRequest.java

@ -35,7 +35,7 @@ import org.hyperledger.besu.ethereum.BlockProcessingResult;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.ExecutionEngineJsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.DepositParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.DepositRequestParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.EnginePayloadParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalRequestParameter;
@ -161,12 +161,12 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
reqId, new JsonRpcError(INVALID_PARAMS, "Invalid withdrawals"));
}
final Optional<List<Request>> maybeDeposits =
Optional.ofNullable(blockParam.getDeposits())
.map(ds -> ds.stream().map(DepositParameter::toDeposit).collect(toList()));
final Optional<List<Request>> maybeDepositRequests =
Optional.ofNullable(blockParam.getDepositRequests())
.map(ds -> ds.stream().map(DepositRequestParameter::toDeposit).collect(toList()));
if (!getDepositRequestValidator(
protocolSchedule.get(), blockParam.getTimestamp(), blockParam.getBlockNumber())
.validateParameter(maybeDeposits)) {
.validateParameter(maybeDepositRequests)) {
return new JsonRpcErrorResponse(
reqId, new JsonRpcError(INVALID_PARAMS, "Invalid deposit request"));
}
@ -186,7 +186,7 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
}
Optional<List<Request>> maybeRequests =
RequestUtil.combine(maybeDeposits, maybeWithdrawalRequests);
RequestUtil.combine(maybeDepositRequests, maybeWithdrawalRequests);
if (mergeContext.get().isSyncing()) {
LOG.debug("We are syncing");

@ -63,7 +63,7 @@ public class EngineNewPayloadV4 extends AbstractEngineNewPayload {
} else if (maybeBeaconBlockRootParam.isEmpty()) {
return ValidationResult.invalid(
RpcErrorType.INVALID_PARAMS, "Missing parent beacon block root field");
} else if (payloadParameter.getDeposits() == null) {
} else if (payloadParameter.getDepositRequests() == null) {
return ValidationResult.invalid(RpcErrorType.INVALID_PARAMS, "Missing deposit field");
} else {
return ValidationResult.valid();

@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters;
import org.hyperledger.besu.datatypes.BLSPublicKey;
import org.hyperledger.besu.datatypes.BLSSignature;
import org.hyperledger.besu.datatypes.GWei;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import java.util.Objects;
@ -28,7 +28,7 @@ import io.vertx.core.json.JsonObject;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt64;
public class DepositParameter {
public class DepositRequestParameter {
private final String pubkey;
@ -39,7 +39,7 @@ public class DepositParameter {
private final String index;
@JsonCreator
public DepositParameter(
public DepositRequestParameter(
@JsonProperty("pubkey") final String pubkey,
@JsonProperty("withdrawalCredentials") final String withdrawalCredentials,
@JsonProperty("amount") final String amount,
@ -52,17 +52,17 @@ public class DepositParameter {
this.index = index;
}
public static DepositParameter fromDeposit(final Deposit deposit) {
return new DepositParameter(
deposit.getPubkey().toString(),
deposit.getWithdrawalCredentials().toString(),
deposit.getAmount().toShortHexString(),
deposit.getSignature().toString(),
deposit.getIndex().toBytes().toQuantityHexString());
public static DepositRequestParameter fromDeposit(final DepositRequest depositRequest) {
return new DepositRequestParameter(
depositRequest.getPubkey().toString(),
depositRequest.getWithdrawalCredentials().toString(),
depositRequest.getAmount().toShortHexString(),
depositRequest.getSignature().toString(),
depositRequest.getIndex().toBytes().toQuantityHexString());
}
public Deposit toDeposit() {
return new Deposit(
public DepositRequest toDeposit() {
return new DepositRequest(
BLSPublicKey.fromHexString(pubkey),
Bytes32.fromHexString(withdrawalCredentials),
GWei.fromHexString(amount),
@ -108,7 +108,7 @@ public class DepositParameter {
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DepositParameter that = (DepositParameter) o;
final DepositRequestParameter that = (DepositRequestParameter) o;
return Objects.equals(pubkey, that.pubkey)
&& Objects.equals(withdrawalCredentials, that.withdrawalCredentials)
&& Objects.equals(amount, that.amount)
@ -123,7 +123,7 @@ public class DepositParameter {
@Override
public String toString() {
return "DepositParameter{"
return "DepositRequestParameter{"
+ "pubKey='"
+ pubkey
+ '\''

@ -43,7 +43,7 @@ public class EnginePayloadParameter {
private final List<WithdrawalParameter> withdrawals;
private final Long blobGasUsed;
private final String excessBlobGas;
private final List<DepositParameter> deposits;
private final List<DepositRequestParameter> depositRequests;
private final List<WithdrawalRequestParameter> withdrawalRequests;
/**
@ -66,7 +66,7 @@ public class EnginePayloadParameter {
* @param withdrawals Array of Withdrawal
* @param blobGasUsed QUANTITY, 64 Bits
* @param excessBlobGas QUANTITY, 64 Bits
* @param deposits List of deposit parameters.
* @param depositRequests List of deposit parameters.
* @param withdrawalRequestParameters List of withdrawal requests parameters.
*/
@JsonCreator
@ -88,7 +88,7 @@ public class EnginePayloadParameter {
@JsonProperty("withdrawals") final List<WithdrawalParameter> withdrawals,
@JsonProperty("blobGasUsed") final UnsignedLongParameter blobGasUsed,
@JsonProperty("excessBlobGas") final String excessBlobGas,
@JsonProperty("depositRequests") final List<DepositParameter> deposits,
@JsonProperty("depositRequests") final List<DepositRequestParameter> depositRequests,
@JsonProperty("withdrawalRequests")
final List<WithdrawalRequestParameter> withdrawalRequestParameters) {
this.blockHash = blockHash;
@ -108,7 +108,7 @@ public class EnginePayloadParameter {
this.withdrawals = withdrawals;
this.blobGasUsed = blobGasUsed == null ? null : blobGasUsed.getValue();
this.excessBlobGas = excessBlobGas;
this.deposits = deposits;
this.depositRequests = depositRequests;
this.withdrawalRequests = withdrawalRequestParameters;
}
@ -180,8 +180,8 @@ public class EnginePayloadParameter {
return excessBlobGas;
}
public List<DepositParameter> getDeposits() {
return deposits;
public List<DepositRequestParameter> getDepositRequests() {
return depositRequests;
}
public List<WithdrawalRequestParameter> getWithdrawalRequests() {

@ -14,11 +14,11 @@
*/
package org.hyperledger.besu.ethereum.api.jsonrpc.internal.results;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.DepositParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.DepositRequestParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalRequestParameter;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.WithdrawalRequest;
@ -42,12 +42,12 @@ public class EngineGetPayloadResultV4 {
final BlockHeader header,
final List<String> transactions,
final Optional<List<Withdrawal>> withdrawals,
final Optional<List<Deposit>> deposits,
final Optional<List<DepositRequest>> depositRequests,
final Optional<List<WithdrawalRequest>> withdrawalRequests,
final String blockValue,
final BlobsBundleV1 blobsBundle) {
this.executionPayload =
new PayloadResult(header, transactions, withdrawals, deposits, withdrawalRequests);
new PayloadResult(header, transactions, withdrawals, depositRequests, withdrawalRequests);
this.blockValue = blockValue;
this.blobsBundle = blobsBundle;
this.shouldOverrideBuilder = false;
@ -94,14 +94,14 @@ public class EngineGetPayloadResultV4 {
protected final List<String> transactions;
private final List<WithdrawalParameter> withdrawals;
private final List<DepositParameter> deposits;
private final List<DepositRequestParameter> depositRequests;
private final List<WithdrawalRequestParameter> withdrawalRequests;
public PayloadResult(
final BlockHeader header,
final List<String> transactions,
final Optional<List<Withdrawal>> withdrawals,
final Optional<List<Deposit>> deposits,
final Optional<List<DepositRequest>> depositRequests,
final Optional<List<WithdrawalRequest>> withdrawalRequests) {
this.blockNumber = Quantity.create(header.getNumber());
this.blockHash = header.getHash().toString();
@ -125,10 +125,13 @@ public class EngineGetPayloadResultV4 {
.map(WithdrawalParameter::fromWithdrawal)
.collect(Collectors.toList()))
.orElse(null);
this.deposits =
deposits
this.depositRequests =
depositRequests
.map(
ds -> ds.stream().map(DepositParameter::fromDeposit).collect(Collectors.toList()))
ds ->
ds.stream()
.map(DepositRequestParameter::fromDeposit)
.collect(Collectors.toList()))
.orElse(null);
this.withdrawalRequests =
withdrawalRequests
@ -216,8 +219,8 @@ public class EngineGetPayloadResultV4 {
}
@JsonGetter(value = "depositRequests")
public List<DepositParameter> getDeposits() {
return deposits;
public List<DepositRequestParameter> getDepositRequests() {
return depositRequests;
}
@JsonGetter(value = "withdrawalRequests")

@ -105,7 +105,7 @@ public abstract class AbstractEngineGetPayloadTest extends AbstractScheduledApiT
Collections.emptyList(),
Optional.of(Collections.emptyList()),
Optional.empty()));
private static final Block mockBlockWithDeposits =
private static final Block mockBlockWithDepositRequests =
new Block(
mockHeader,
new BlockBody(
@ -116,8 +116,8 @@ public abstract class AbstractEngineGetPayloadTest extends AbstractScheduledApiT
protected static final BlockWithReceipts mockBlockWithReceiptsAndWithdrawals =
new BlockWithReceipts(mockBlockWithWithdrawals, Collections.emptyList());
protected static final BlockWithReceipts mockBlockWithReceiptsAndDeposits =
new BlockWithReceipts(mockBlockWithDeposits, Collections.emptyList());
protected static final BlockWithReceipts mockBlockWithReceiptsAndDepositRequests =
new BlockWithReceipts(mockBlockWithDepositRequests, Collections.emptyList());
@Mock protected ProtocolContext protocolContext;

@ -38,7 +38,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequest;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.ExecutionEngineJsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.DepositParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.DepositRequestParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.EnginePayloadParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.UnsignedLongParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalParameter;
@ -54,7 +54,7 @@ import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.WithdrawalRequest;
@ -410,7 +410,7 @@ public abstract class AbstractEngineNewPayloadTest extends AbstractScheduledApiT
final BlockHeader header,
final List<String> txs,
final List<WithdrawalParameter> withdrawals,
final List<DepositParameter> deposits,
final List<DepositRequestParameter> depositRequests,
final List<WithdrawalRequestParameter> withdrawalRequests) {
return new EnginePayloadParameter(
header.getHash(),
@ -430,18 +430,18 @@ public abstract class AbstractEngineNewPayloadTest extends AbstractScheduledApiT
withdrawals,
header.getBlobGasUsed().map(UnsignedLongParameter::new).orElse(null),
header.getExcessBlobGas().map(BlobGas::toHexString).orElse(null),
deposits,
depositRequests,
withdrawalRequests);
}
protected BlockHeader setupValidPayload(
final BlockProcessingResult value,
final Optional<List<Withdrawal>> maybeWithdrawals,
final Optional<List<Deposit>> maybeDeposits,
final Optional<List<DepositRequest>> maybeDepositRequests,
final Optional<List<WithdrawalRequest>> maybeWithdrawalRequests) {
BlockHeader mockHeader =
createBlockHeader(maybeWithdrawals, maybeDeposits, maybeWithdrawalRequests);
createBlockHeader(maybeWithdrawals, maybeDepositRequests, maybeWithdrawalRequests);
when(blockchain.getBlockByHash(mockHeader.getHash())).thenReturn(Optional.empty());
// when(blockchain.getBlockHeader(mockHeader.getParentHash()))
// .thenReturn(Optional.of(mock(BlockHeader.class)));
@ -474,21 +474,21 @@ public abstract class AbstractEngineNewPayloadTest extends AbstractScheduledApiT
protected BlockHeader createBlockHeader(
final Optional<List<Withdrawal>> maybeWithdrawals,
final Optional<List<Deposit>> maybeDeposits,
final Optional<List<DepositRequest>> maybeDepositRequests,
final Optional<List<WithdrawalRequest>> maybeWithdrawalRequests) {
return createBlockHeaderFixture(maybeWithdrawals, maybeDeposits, maybeWithdrawalRequests)
return createBlockHeaderFixture(maybeWithdrawals, maybeDepositRequests, maybeWithdrawalRequests)
.buildHeader();
}
protected BlockHeaderTestFixture createBlockHeaderFixture(
final Optional<List<Withdrawal>> maybeWithdrawals,
final Optional<List<Deposit>> maybeDeposits,
final Optional<List<DepositRequest>> maybeDepositRequests,
final Optional<List<WithdrawalRequest>> maybeWithdrawalRequests) {
Optional<List<Request>> maybeRequests;
if (maybeDeposits.isPresent() || maybeWithdrawalRequests.isPresent()) {
if (maybeDepositRequests.isPresent() || maybeWithdrawalRequests.isPresent()) {
List<Request> requests = new ArrayList<>();
maybeDeposits.ifPresent(requests::addAll);
maybeDepositRequests.ifPresent(requests::addAll);
maybeWithdrawalRequests.ifPresent(requests::addAll);
maybeRequests = Optional.of(requests);
} else {

@ -71,7 +71,7 @@ public class EngineGetPayloadV4Test extends AbstractEngineGetPayloadTest {
super.before();
lenient()
.when(mergeContext.retrieveBlockById(mockPid))
.thenReturn(Optional.of(mockBlockWithReceiptsAndDeposits));
.thenReturn(Optional.of(mockBlockWithReceiptsAndDepositRequests));
when(protocolContext.safeConsensusContext(Mockito.any())).thenReturn(Optional.of(mergeContext));
this.method =
new EngineGetPayloadV4(
@ -146,7 +146,7 @@ public class EngineGetPayloadV4Test extends AbstractEngineGetPayloadTest {
assertThat(r.getResult()).isInstanceOf(EngineGetPayloadResultV4.class);
final EngineGetPayloadResultV4 res = (EngineGetPayloadResultV4) r.getResult();
assertThat(res.getExecutionPayload().getWithdrawals()).isNotNull();
assertThat(res.getExecutionPayload().getDeposits()).isNotNull();
assertThat(res.getExecutionPayload().getDepositRequests()).isNotNull();
assertThat(res.getExecutionPayload().getWithdrawalRequests()).isNotNull();
assertThat(res.getExecutionPayload().getHash())
.isEqualTo(header.getHash().toString());

@ -44,7 +44,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.EnginePayloadS
import org.hyperledger.besu.ethereum.core.BlobTestFixture;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionTestFixture;
import org.hyperledger.besu.ethereum.core.Withdrawal;
@ -150,7 +150,7 @@ public class EngineNewPayloadV3Test extends EngineNewPayloadV2Test {
@Override
protected BlockHeader createBlockHeader(
final Optional<List<Withdrawal>> maybeWithdrawals,
final Optional<List<Deposit>> maybeDeposits,
final Optional<List<DepositRequest>> maybeDepositRequests,
final Optional<List<WithdrawalRequest>> maybeWithdrawalRequests) {
BlockHeader parentBlockHeader =
new BlockHeaderTestFixture()

@ -33,19 +33,19 @@ import org.hyperledger.besu.ethereum.BlockProcessingOutputs;
import org.hyperledger.besu.ethereum.BlockProcessingResult;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequest;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.DepositParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.DepositRequestParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.EnginePayloadParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.WithdrawalRequestParameter;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcError;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.WithdrawalRequest;
import org.hyperledger.besu.ethereum.mainnet.BodyValidation;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositsValidator;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestValidator;
import org.hyperledger.besu.ethereum.mainnet.requests.RequestsValidatorCoordinator;
import org.hyperledger.besu.ethereum.mainnet.requests.WithdrawalRequestValidator;
import org.hyperledger.besu.evm.gascalculator.PragueGasCalculator;
@ -92,8 +92,8 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test {
}
@Test
public void shouldReturnValidIfDepositsIsNull_WhenDepositsProhibited() {
final List<DepositParameter> deposits = null;
public void shouldReturnValidIfDepositRequestsIsNull_WhenDepositRequestsProhibited() {
final List<DepositRequestParameter> depositRequests = null;
mockProhibitedRequestsValidator();
BlockHeader mockHeader =
@ -108,22 +108,23 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test {
when(mergeCoordinator.getLatestValidAncestor(mockHeader))
.thenReturn(Optional.of(mockHeader.getHash()));
var resp = resp(mockEnginePayload(mockHeader, Collections.emptyList(), null, deposits, null));
var resp =
resp(mockEnginePayload(mockHeader, Collections.emptyList(), null, depositRequests, null));
assertValidResponse(mockHeader, resp);
}
@Test
public void shouldReturnInvalidIfDepositsIsNull_WhenDepositsAllowed() {
final List<DepositParameter> deposits = null;
mockAllowedDepositsRequestValidator();
public void shouldReturnInvalidIfDepositRequestsIsNull_WhenDepositRequestsAllowed() {
final List<DepositRequestParameter> depositRequests = null;
mockAllowedDepositRequestsRequestValidator();
var resp =
resp(
mockEnginePayload(
createBlockHeader(Optional.empty(), Optional.empty(), Optional.empty()),
Collections.emptyList(),
null,
deposits,
depositRequests,
null));
assertThat(fromErrorResp(resp).getCode()).isEqualTo(INVALID_PARAMS.getCode());
@ -131,15 +132,16 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test {
}
@Test
public void shouldReturnValidIfDepositsIsNotNull_WhenDepositsAllowed() {
final List<DepositParameter> depositsParam = List.of(DEPOSIT_PARAM_1);
final List<Request> deposits = List.of(DEPOSIT_PARAM_1.toDeposit());
public void shouldReturnValidIfDepositRequestsIsNotNull_WhenDepositRequestsAllowed() {
final List<DepositRequestParameter> depositRequestsParam = List.of(DEPOSIT_PARAM_1);
final List<Request> depositRequests = List.of(DEPOSIT_PARAM_1.toDeposit());
mockAllowedDepositsRequestValidator();
mockAllowedDepositRequestsRequestValidator();
BlockHeader mockHeader =
setupValidPayload(
new BlockProcessingResult(
Optional.of(new BlockProcessingOutputs(null, List.of(), Optional.of(deposits)))),
Optional.of(
new BlockProcessingOutputs(null, List.of(), Optional.of(depositRequests)))),
Optional.empty(),
Optional.of(List.of(DEPOSIT_PARAM_1.toDeposit())),
Optional.empty());
@ -148,14 +150,16 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test {
when(mergeCoordinator.getLatestValidAncestor(mockHeader))
.thenReturn(Optional.of(mockHeader.getHash()));
var resp =
resp(mockEnginePayload(mockHeader, Collections.emptyList(), null, depositsParam, null));
resp(
mockEnginePayload(
mockHeader, Collections.emptyList(), null, depositRequestsParam, null));
assertValidResponse(mockHeader, resp);
}
@Test
public void shouldReturnInvalidIfDepositsIsNotNull_WhenDepositsProhibited() {
final List<DepositParameter> deposits = List.of();
public void shouldReturnInvalidIfDepositRequestsIsNotNull_WhenDepositRequestsProhibited() {
final List<DepositRequestParameter> depositRequests = List.of();
lenient()
.when(protocolSpec.getRequestsValidatorCoordinator())
.thenReturn(RequestsValidatorCoordinator.empty());
@ -167,7 +171,7 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test {
Optional.empty(), Optional.of(Collections.emptyList()), Optional.empty()),
Collections.emptyList(),
null,
deposits,
depositRequests,
null));
final JsonRpcError jsonRpcError = fromErrorResp(resp);
@ -264,7 +268,7 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test {
@Override
protected BlockHeader createBlockHeader(
final Optional<List<Withdrawal>> maybeWithdrawals,
final Optional<List<Deposit>> maybeDeposits,
final Optional<List<DepositRequest>> maybeDepositRequests,
final Optional<List<WithdrawalRequest>> maybeWithdrawalRequests) {
BlockHeader parentBlockHeader =
new BlockHeaderTestFixture()
@ -275,9 +279,9 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test {
.buildHeader();
Optional<List<Request>> maybeRequests;
if (maybeDeposits.isPresent() || maybeWithdrawalRequests.isPresent()) {
if (maybeDepositRequests.isPresent() || maybeWithdrawalRequests.isPresent()) {
List<Request> requests = new ArrayList<>();
maybeDeposits.ifPresent(requests::addAll);
maybeDepositRequests.ifPresent(requests::addAll);
maybeWithdrawalRequests.ifPresent(requests::addAll);
maybeRequests = Optional.of(requests);
} else {
@ -315,10 +319,10 @@ public class EngineNewPayloadV4Test extends EngineNewPayloadV3Test {
when(protocolSpec.getRequestsValidatorCoordinator()).thenReturn(validator);
}
private void mockAllowedDepositsRequestValidator() {
private void mockAllowedDepositRequestsRequestValidator() {
var validator =
new RequestsValidatorCoordinator.Builder()
.addValidator(RequestType.DEPOSIT, new DepositsValidator(depositContractAddress))
.addValidator(RequestType.DEPOSIT, new DepositRequestValidator(depositContractAddress))
.build();
when(protocolSpec.getRequestsValidatorCoordinator()).thenReturn(validator);
}

@ -16,14 +16,14 @@ package org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters;
public class DepositParameterTestFixture {
public static final DepositParameter DEPOSIT_PARAM_1 =
public static final DepositRequestParameter DEPOSIT_PARAM_1 =
createDeposit(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e",
"0x0017a7fcf06faf493d30bbe2632ea7c2383cd86825e12797165de7aa35589483",
"0x773594000",
"0xa889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb5",
"0x1");
static final DepositParameter DEPOSIT_PARAM_2 =
static final DepositRequestParameter DEPOSIT_PARAM_2 =
createDeposit(
"0x8706d19a62f28a6a6549f96c5adaebac9124a61d44868ec94f6d2d707c6a2f82c9162071231dfeb40e24bfde4ffdf243",
"0x006a8dc800c6d8dd6977ef53264e2d030350f0145a91bcd167b4f1c3ea21b271",
@ -31,12 +31,12 @@ public class DepositParameterTestFixture {
"0x801b08ca107b623eca32ee9f9111b4e50eb9cfe19e38204b72de7dc04c5a5e00f61bab96f10842576f66020ce851083f1583dd9a6b73301bea6c245cf51f27cf96aeb018852c5f70bf485d16b957cfe49ca008913346b431e7653ae3ddb23b07",
"0x3");
private static DepositParameter createDeposit(
private static DepositRequestParameter createDeposit(
final String pubKey,
final String withdrawalCredentials,
final String amount,
final String signature,
final String index) {
return new DepositParameter(pubKey, withdrawalCredentials, amount, signature, index);
return new DepositRequestParameter(pubKey, withdrawalCredentials, amount, signature, index);
}
}

@ -20,18 +20,18 @@ import static org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.Depo
import org.hyperledger.besu.datatypes.BLSPublicKey;
import org.hyperledger.besu.datatypes.BLSSignature;
import org.hyperledger.besu.datatypes.GWei;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt64;
import org.junit.jupiter.api.Test;
public class DepositParameterTest {
public class DepositRequestRequestParameterTest {
@Test
public void toDeposit() {
Deposit expected =
new Deposit(
DepositRequest expected =
new DepositRequest(
BLSPublicKey.fromHexString(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e"),
Bytes32.fromHexString(
@ -45,8 +45,8 @@ public class DepositParameterTest {
@Test
public void fromDeposit() {
Deposit deposit =
new Deposit(
DepositRequest depositRequest =
new DepositRequest(
BLSPublicKey.fromHexString(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e"),
Bytes32.fromHexString(
@ -56,6 +56,6 @@ public class DepositParameterTest {
"0xa889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb5"),
UInt64.ONE);
assertThat(DepositParameter.fromDeposit(deposit)).isEqualTo(DEPOSIT_PARAM_1);
assertThat(DepositRequestParameter.fromDeposit(depositRequest)).isEqualTo(DEPOSIT_PARAM_1);
}
}

@ -47,7 +47,7 @@ import org.hyperledger.besu.ethereum.core.BlobTestFixture;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture;
import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters;
@ -76,7 +76,7 @@ import org.hyperledger.besu.ethereum.mainnet.ProtocolSpecAdapters;
import org.hyperledger.besu.ethereum.mainnet.WithdrawalsProcessor;
import org.hyperledger.besu.ethereum.mainnet.feemarket.CancunFeeMarket;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestProcessor;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositsValidator;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestValidator;
import org.hyperledger.besu.ethereum.mainnet.requests.RequestProcessorCoordinator;
import org.hyperledger.besu.ethereum.mainnet.requests.RequestsValidatorCoordinator;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
@ -106,7 +106,7 @@ abstract class AbstractBlockCreatorTest {
protected EthScheduler ethScheduler = new DeterministicEthScheduler();
@Test
void findDepositsFromReceipts() {
void findDepositRequestsFromReceipts() {
BlockDataGenerator blockDataGenerator = new BlockDataGenerator();
TransactionReceipt receiptWithoutDeposit1 = blockDataGenerator.receipt();
TransactionReceipt receiptWithoutDeposit2 = blockDataGenerator.receipt();
@ -122,8 +122,8 @@ abstract class AbstractBlockCreatorTest {
List<TransactionReceipt> receipts =
List.of(receiptWithoutDeposit1, receiptWithDeposit, receiptWithoutDeposit2);
Deposit expectedDeposit =
new Deposit(
DepositRequest expectedDepositRequest =
new DepositRequest(
BLSPublicKey.fromHexString(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e"),
Bytes32.fromHexString(
@ -132,17 +132,17 @@ abstract class AbstractBlockCreatorTest {
BLSSignature.fromHexString(
"0xa889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb5"),
UInt64.valueOf(539967));
final List<Deposit> expectedDeposits = List.of(expectedDeposit);
final List<DepositRequest> expectedDepositRequests = List.of(expectedDepositRequest);
var depositsFromReceipts =
var depositRequestsFromReceipts =
new DepositRequestProcessor(DEFAULT_DEPOSIT_CONTRACT_ADDRESS).process(null, receipts);
assertThat(depositsFromReceipts.get()).isEqualTo(expectedDeposits);
assertThat(depositRequestsFromReceipts.get()).isEqualTo(expectedDepositRequests);
}
@Test
void withAllowedDepositsAndContractAddress_DepositsAreParsed() {
void withAllowedDepositRequestsAndContractAddress_DepositRequestsAreParsed() {
final AbstractBlockCreator blockCreator =
blockCreatorWithAllowedDeposits(DEFAULT_DEPOSIT_CONTRACT_ADDRESS);
blockCreatorWithAllowedDepositRequests(DEFAULT_DEPOSIT_CONTRACT_ADDRESS);
final BlockCreationResult blockCreationResult =
blockCreator.createBlock(
@ -154,15 +154,15 @@ abstract class AbstractBlockCreatorTest {
1L,
false);
List<Request> deposits = emptyList();
final Hash requestsRoot = BodyValidation.requestsRoot(deposits);
List<Request> depositRequests = emptyList();
final Hash requestsRoot = BodyValidation.requestsRoot(depositRequests);
assertThat(blockCreationResult.getBlock().getHeader().getRequestsRoot()).hasValue(requestsRoot);
assertThat(blockCreationResult.getBlock().getBody().getRequests()).hasValue(deposits);
assertThat(blockCreationResult.getBlock().getBody().getRequests()).hasValue(depositRequests);
}
@Test
void withAllowedDepositsAndNoContractAddress_DepositsAreNotParsed() {
final AbstractBlockCreator blockCreator = blockCreatorWithAllowedDeposits(null);
void withAllowedDepositRequestsAndNoContractAddress_DepositRequestsAreNotParsed() {
final AbstractBlockCreator blockCreator = blockCreatorWithAllowedDepositRequests(null);
final BlockCreationResult blockCreationResult =
blockCreator.createBlock(
@ -179,8 +179,8 @@ abstract class AbstractBlockCreatorTest {
}
@Test
void withProhibitedDeposits_DepositsAreNotParsed() {
final AbstractBlockCreator blockCreator = blockCreatorWithProhibitedDeposits();
void withProhibitedDepositRequests_DepositRequestsAreNotParsed() {
final AbstractBlockCreator blockCreator = blockCreatorWithProhibitedDepositRequests();
final BlockCreationResult blockCreationResult =
blockCreator.createBlock(
@ -196,7 +196,7 @@ abstract class AbstractBlockCreatorTest {
assertThat(blockCreationResult.getBlock().getBody().getRequests()).isEmpty();
}
private AbstractBlockCreator blockCreatorWithAllowedDeposits(
private AbstractBlockCreator blockCreatorWithAllowedDepositRequests(
final Address depositContractAddress) {
final ProtocolSpecAdapters protocolSpecAdapters =
ProtocolSpecAdapters.create(
@ -207,7 +207,7 @@ abstract class AbstractBlockCreatorTest {
new RequestsValidatorCoordinator.Builder()
.addValidator(
RequestType.DEPOSIT,
new DepositsValidator((depositContractAddress)))
new DepositRequestValidator((depositContractAddress)))
.build())
.requestProcessorCoordinator(
new RequestProcessorCoordinator.Builder()
@ -218,7 +218,7 @@ abstract class AbstractBlockCreatorTest {
return createBlockCreator(protocolSpecAdapters);
}
private AbstractBlockCreator blockCreatorWithProhibitedDeposits() {
private AbstractBlockCreator blockCreatorWithProhibitedDepositRequests() {
final ProtocolSpecAdapters protocolSpecAdapters =
ProtocolSpecAdapters.create(0, specBuilder -> specBuilder);
return createBlockCreator(protocolSpecAdapters);

@ -147,7 +147,7 @@ public class BlockBody implements org.hyperledger.besu.plugin.data.BlockBody {
/**
* Read all fields from the block body expecting no list wrapping them. An example of a valid body
* would be: [txs],[ommers],[withdrawals],[deposits] this method is called directly when importing
* would be: [txs],[ommers],[withdrawals],[requests] this method is called directly when importing
* a single block
*
* @param input The RLP-encoded input

@ -25,7 +25,8 @@ import java.util.Objects;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt64;
public class Deposit extends Request implements org.hyperledger.besu.plugin.data.Deposit {
public class DepositRequest extends Request
implements org.hyperledger.besu.plugin.data.DepositRequest {
private final BLSPublicKey pubkey;
private final Bytes32 depositWithdrawalCredentials;
@ -33,7 +34,7 @@ public class Deposit extends Request implements org.hyperledger.besu.plugin.data
private final BLSSignature signature;
private final UInt64 index;
public Deposit(
public DepositRequest(
final BLSPublicKey pubkey,
final Bytes32 depositWithdrawalCredentials,
final GWei amount,
@ -96,7 +97,7 @@ public class Deposit extends Request implements org.hyperledger.besu.plugin.data
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final Deposit that = (Deposit) o;
final DepositRequest that = (DepositRequest) o;
return Objects.equals(pubkey, that.pubkey)
&& Objects.equals(depositWithdrawalCredentials, that.depositWithdrawalCredentials)
&& Objects.equals(amount, that.amount)

@ -17,8 +17,8 @@ package org.hyperledger.besu.ethereum.core.encoding;
import org.hyperledger.besu.datatypes.BLSPublicKey;
import org.hyperledger.besu.datatypes.BLSSignature;
import org.hyperledger.besu.datatypes.GWei;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositContract;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPInput;
import org.hyperledger.besu.evm.log.Log;
@ -30,9 +30,9 @@ import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt64;
import org.web3j.tx.Contract;
public class DepositDecoder {
public class DepositRequestDecoder {
public static Deposit decode(final RLPInput rlpInput) {
public static DepositRequest decode(final RLPInput rlpInput) {
rlpInput.enterList();
final BLSPublicKey publicKey = BLSPublicKey.readFrom(rlpInput);
final Bytes32 depositWithdrawalCredential = Bytes32.wrap(rlpInput.readBytes());
@ -41,10 +41,10 @@ public class DepositDecoder {
final UInt64 index = UInt64.valueOf(rlpInput.readBigIntegerScalar());
rlpInput.leaveList();
return new Deposit(publicKey, depositWithdrawalCredential, amount, signature, index);
return new DepositRequest(publicKey, depositWithdrawalCredential, amount, signature, index);
}
public static Deposit decodeFromLog(final Log log) {
public static DepositRequest decodeFromLog(final Log log) {
Contract.EventValuesWithLog eventValues = DepositContract.staticExtractDepositEventWithLog(log);
final byte[] rawPublicKey = (byte[]) eventValues.getNonIndexedValues().get(0).getValue();
final byte[] rawWithdrawalCredential =
@ -53,7 +53,7 @@ public class DepositDecoder {
final byte[] rawSignature = (byte[]) eventValues.getNonIndexedValues().get(3).getValue();
final byte[] rawIndex = (byte[]) eventValues.getNonIndexedValues().get(4).getValue();
return new Deposit(
return new DepositRequest(
BLSPublicKey.wrap(Bytes.wrap(rawPublicKey)),
Bytes32.wrap(Bytes.wrap(rawWithdrawalCredential)),
GWei.of(
@ -64,7 +64,7 @@ public class DepositDecoder {
UInt64.valueOf(Bytes.wrap(rawIndex).reverse().toLong()));
}
public static Deposit decodeOpaqueBytes(final Bytes input) {
public static DepositRequest decodeOpaqueBytes(final Bytes input) {
return decode(RLP.input(input));
}
}

@ -14,25 +14,25 @@
*/
package org.hyperledger.besu.ethereum.core.encoding;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.rlp.RLP;
import org.hyperledger.besu.ethereum.rlp.RLPOutput;
import org.apache.tuweni.bytes.Bytes;
public class DepositEncoder {
public class DepositRequestEncoder {
public static void encode(final Request request, final RLPOutput rlpOutput) {
if (!(request instanceof Deposit deposit)) {
if (!(request instanceof DepositRequest depositRequest)) {
throw new IllegalArgumentException("The provided request is not of type deposit.");
}
rlpOutput.startList();
rlpOutput.writeBytes(deposit.getPubkey());
rlpOutput.writeBytes(deposit.getWithdrawalCredentials());
rlpOutput.writeUInt64Scalar(deposit.getAmount());
rlpOutput.writeBytes(deposit.getSignature());
rlpOutput.writeUInt64Scalar(deposit.getIndex());
rlpOutput.writeBytes(depositRequest.getPubkey());
rlpOutput.writeBytes(depositRequest.getWithdrawalCredentials());
rlpOutput.writeUInt64Scalar(depositRequest.getAmount());
rlpOutput.writeBytes(depositRequest.getSignature());
rlpOutput.writeUInt64Scalar(depositRequest.getIndex());
rlpOutput.endList();
}

@ -41,7 +41,7 @@ public class RequestDecoder {
RequestType.WITHDRAWAL,
WithdrawalRequestDecoder::decode,
RequestType.DEPOSIT,
DepositDecoder::decode);
DepositRequestDecoder::decode);
/**
* Decodes a request from its RLP encoded bytes.

@ -38,7 +38,7 @@ public class RequestEncoder {
RequestType.WITHDRAWAL,
WithdrawalRequestEncoder::encode,
RequestType.DEPOSIT,
DepositEncoder::encode);
DepositRequestEncoder::encode);
/**
* Encodes a Request into the provided RLPOutput.

@ -15,11 +15,11 @@
package org.hyperledger.besu.ethereum.mainnet.requests;
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.encoding.DepositDecoder;
import org.hyperledger.besu.ethereum.core.encoding.DepositRequestDecoder;
import java.util.Collections;
import java.util.List;
@ -44,19 +44,20 @@ public class DepositRequestProcessor implements RequestProcessor {
if (depositContractAddress.isEmpty()) {
return Optional.empty();
}
List<Deposit> deposits = findDepositsFromReceipts(transactionReceipts);
return Optional.of(deposits);
List<DepositRequest> depositRequests = findDepositRequestsFromReceipts(transactionReceipts);
return Optional.of(depositRequests);
}
@VisibleForTesting
List<Deposit> findDepositsFromReceipts(final List<TransactionReceipt> transactionReceipts) {
List<DepositRequest> findDepositRequestsFromReceipts(
final List<TransactionReceipt> transactionReceipts) {
return depositContractAddress
.map(
address ->
transactionReceipts.stream()
.flatMap(receipt -> receipt.getLogsList().stream())
.filter(log -> address.equals(log.getLogger()))
.map(DepositDecoder::decodeFromLog)
.map(DepositRequestDecoder::decodeFromLog)
.toList())
.orElse(Collections.emptyList());
}

@ -18,10 +18,10 @@ import static org.hyperledger.besu.ethereum.mainnet.requests.RequestUtil.getDepo
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.encoding.DepositDecoder;
import org.hyperledger.besu.ethereum.core.encoding.DepositRequestDecoder;
import org.hyperledger.besu.evm.log.Log;
import java.util.ArrayList;
@ -32,44 +32,46 @@ import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DepositsValidator implements RequestValidator {
public class DepositRequestValidator implements RequestValidator {
private static final Logger LOG = LoggerFactory.getLogger(DepositsValidator.class);
private static final Logger LOG = LoggerFactory.getLogger(DepositRequestValidator.class);
private final Address depositContractAddress;
public DepositsValidator(final Address depositContractAddress) {
public DepositRequestValidator(final Address depositContractAddress) {
this.depositContractAddress = depositContractAddress;
}
@Override
public boolean validateParameter(final Optional<List<Request>> deposits) {
return deposits.isPresent();
public boolean validateParameter(final Optional<List<Request>> depositRequests) {
return depositRequests.isPresent();
}
public boolean validateDeposits(
public boolean validateDepositRequests(
final Block block,
final List<Deposit> actualDeposits,
final List<DepositRequest> actualDepositRequests,
final List<TransactionReceipt> receipts) {
List<Deposit> expectedDeposits = new ArrayList<>();
List<DepositRequest> expectedDepositRequests = new ArrayList<>();
for (TransactionReceipt receipt : receipts) {
for (Log log : receipt.getLogsList()) {
if (depositContractAddress.equals(log.getLogger())) {
Deposit deposit = DepositDecoder.decodeFromLog(log);
expectedDeposits.add(deposit);
DepositRequest depositRequest = DepositRequestDecoder.decodeFromLog(log);
expectedDepositRequests.add(depositRequest);
}
}
}
boolean isValid = actualDeposits.equals(expectedDeposits);
boolean isValid = actualDepositRequests.equals(expectedDepositRequests);
if (!isValid) {
LOG.warn(
"Deposits validation failed. Deposits from block body do not match deposits from logs. Block hash: {}",
block.getHash());
LOG.debug(
"Deposits from logs: {}, deposits from block body: {}", expectedDeposits, actualDeposits);
"Deposits from logs: {}, deposits from block body: {}",
expectedDepositRequests,
actualDepositRequests);
}
return isValid;
@ -78,7 +80,7 @@ public class DepositsValidator implements RequestValidator {
@Override
public boolean validate(
final Block block, final List<Request> requests, final List<TransactionReceipt> receipts) {
var deposits = getDepositRequests(Optional.of(requests)).orElse(Collections.emptyList());
return validateDeposits(block, deposits, receipts);
var depositRequests = getDepositRequests(Optional.of(requests)).orElse(Collections.emptyList());
return validateDepositRequests(block, depositRequests, receipts);
}
}

@ -22,7 +22,7 @@ public class MainnetRequestsValidator {
final Address depositContractAddress) {
return new RequestsValidatorCoordinator.Builder()
.addValidator(RequestType.WITHDRAWAL, new WithdrawalRequestValidator())
.addValidator(RequestType.DEPOSIT, new DepositsValidator(depositContractAddress))
.addValidator(RequestType.DEPOSIT, new DepositRequestValidator(depositContractAddress))
.build();
}

@ -14,7 +14,7 @@
*/
package org.hyperledger.besu.ethereum.mainnet.requests;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.WithdrawalRequest;
@ -42,8 +42,9 @@ public class RequestUtil {
return requests.stream().filter(requestType::isInstance).map(requestType::cast).toList();
}
public static Optional<List<Deposit>> getDepositRequests(final Optional<List<Request>> requests) {
return requests.map(r -> filterRequestsOfType(r, Deposit.class));
public static Optional<List<DepositRequest>> getDepositRequests(
final Optional<List<Request>> requests) {
return requests.map(r -> filterRequestsOfType(r, DepositRequest.class));
}
public static Optional<List<WithdrawalRequest>> getWithdrawalRequests(
@ -54,19 +55,19 @@ public class RequestUtil {
/**
* Combines two optional lists of requests into a single optional list.
*
* @param maybeDeposits Optional list of deposit requests.
* @param maybeDepositRequests Optional list of deposit requests.
* @param maybeWithdrawalRequest Optional list of withdrawal requests.
* @return An Optional containing the combined list of requests, or an empty Optional if both
* inputs are empty.
*/
public static Optional<List<Request>> combine(
final Optional<List<Request>> maybeDeposits,
final Optional<List<Request>> maybeDepositRequests,
final Optional<List<Request>> maybeWithdrawalRequest) {
if (maybeDeposits.isEmpty() && maybeWithdrawalRequest.isEmpty()) {
if (maybeDepositRequests.isEmpty() && maybeWithdrawalRequest.isEmpty()) {
return Optional.empty();
}
List<Request> requests = new ArrayList<>();
maybeDeposits.ifPresent(requests::addAll);
maybeDepositRequests.ifPresent(requests::addAll);
maybeWithdrawalRequest.ifPresent(requests::addAll);
return Optional.of(requests);
}

@ -20,7 +20,7 @@ import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.BLSPublicKey;
import org.hyperledger.besu.datatypes.BLSSignature;
import org.hyperledger.besu.datatypes.GWei;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.evm.log.Log;
import org.hyperledger.besu.evm.log.LogTopic;
@ -31,11 +31,11 @@ import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt64;
import org.junit.jupiter.api.Test;
class DepositDecoderTest {
class DepositRequestRequestDecoderTest {
@Test
void shouldDecodeDeposit() {
final Deposit expectedDeposit =
new Deposit(
final DepositRequest expectedDepositRequest =
new DepositRequest(
BLSPublicKey.fromHexString(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e"),
Bytes32.fromHexString(
@ -45,12 +45,12 @@ class DepositDecoderTest {
"0xa889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb5"),
UInt64.ONE);
final Deposit deposit =
DepositDecoder.decodeOpaqueBytes(
final DepositRequest depositRequest =
DepositRequestDecoder.decodeOpaqueBytes(
Bytes.fromHexString(
"0xf8bbb0b10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416ea00017a7fcf06faf493d30bbe2632ea7c2383cd86825e12797165de7aa35589483850773594000b860a889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb501"));
assertThat(deposit).isEqualTo(expectedDeposit);
assertThat(depositRequest).isEqualTo(expectedDepositRequest);
}
@Test
@ -65,10 +65,10 @@ class DepositDecoderTest {
"0x00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030b10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200017a7fcf06faf493d30bbe2632ea7c2383cd86825e12797165de7aa35589483000000000000000000000000000000000000000000000000000000000000000800405973070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060a889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb500000000000000000000000000000000000000000000000000000000000000083f3d080000000000000000000000000000000000000000000000000000000000");
final Log log = new Log(address, data, topics);
final Deposit deposit = DepositDecoder.decodeFromLog(log);
final DepositRequest depositRequest = DepositRequestDecoder.decodeFromLog(log);
final Deposit expectedDeposit =
new Deposit(
final DepositRequest expectedDepositRequest =
new DepositRequest(
BLSPublicKey.fromHexString(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e"),
Bytes32.fromHexString(
@ -78,6 +78,6 @@ class DepositDecoderTest {
"0xa889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb5"),
UInt64.valueOf(539967));
assertThat(deposit).isEqualTo(expectedDeposit);
assertThat(depositRequest).isEqualTo(expectedDepositRequest);
}
}

@ -19,19 +19,19 @@ import static org.assertj.core.api.Assertions.assertThat;
import org.hyperledger.besu.datatypes.BLSPublicKey;
import org.hyperledger.besu.datatypes.BLSSignature;
import org.hyperledger.besu.datatypes.GWei;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32;
import org.apache.tuweni.units.bigints.UInt64;
import org.junit.jupiter.api.Test;
class DepositEncoderTest {
class DepositRequestRequestEncoderTest {
private final String expectedDepositEncodedBytes =
"f8bbb0b10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416ea00017a7fcf06faf493d30bbe2632ea7c2383cd86825e12797165de7aa35589483850773594000b860a889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb501";
final Deposit deposit =
new Deposit(
final DepositRequest depositRequest =
new DepositRequest(
BLSPublicKey.fromHexString(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e"),
Bytes32.fromHexString(
@ -43,19 +43,19 @@ class DepositEncoderTest {
@Test
void shouldEncodeDeposit() {
final Bytes encoded = DepositEncoder.encodeOpaqueBytes(deposit);
final Bytes encoded = DepositRequestEncoder.encodeOpaqueBytes(depositRequest);
assertThat(encoded).isEqualTo(Bytes.fromHexString(expectedDepositEncodedBytes));
}
@Test
void shouldEncodeDepositRequest() {
final Bytes encoded = RequestEncoder.encodeOpaqueBytes(deposit);
final Bytes encoded = RequestEncoder.encodeOpaqueBytes(depositRequest);
// Request encoding is Request = RequestType ++ RequestData
assertThat(encoded)
.isEqualTo(
Bytes.fromHexString(
String.format(
"0x%02X%s",
deposit.getType().getSerializedType(), expectedDepositEncodedBytes)));
depositRequest.getType().getSerializedType(), expectedDepositEncodedBytes)));
}
}

@ -23,10 +23,10 @@ import org.hyperledger.besu.datatypes.GWei;
import org.hyperledger.besu.datatypes.RequestType;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositsValidator;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestValidator;
import org.hyperledger.besu.ethereum.mainnet.requests.RequestsValidatorCoordinator;
import org.hyperledger.besu.ethereum.mainnet.requests.WithdrawalRequestValidator;
import org.hyperledger.besu.evm.log.Log;
@ -41,20 +41,20 @@ import org.apache.tuweni.units.bigints.UInt64;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
public class DepositsValidatorTest {
public class DepositRequestValidatorTest {
private final BlockDataGenerator blockDataGenerator = new BlockDataGenerator();
private static Deposit DEPOSIT_1;
private static Deposit DEPOSIT_2;
private static DepositRequest depositRequest1;
private static DepositRequest depositRequest2;
private static Log LOG_1;
private static Log LOG_2;
private static Address DEPOSIT_CONTRACT_ADDRESS;
private static RequestsValidatorCoordinator requestsValidatorCoordinator;
private static DepositsValidator depositsValidator;
private static DepositRequestValidator depositRequestValidator;
@BeforeAll
public static void setup() {
DEPOSIT_1 =
new Deposit(
depositRequest1 =
new DepositRequest(
BLSPublicKey.fromHexString(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e"),
Bytes32.fromHexString(
@ -64,8 +64,8 @@ public class DepositsValidatorTest {
"0xa889db8300194050a2636c92a95bc7160515867614b7971a9500cdb62f9c0890217d2901c3241f86fac029428fc106930606154bd9e406d7588934a5f15b837180b17194d6e44bd6de23e43b163dfe12e369dcc75a3852cd997963f158217eb5"),
UInt64.valueOf(539967));
DEPOSIT_2 =
new Deposit(
depositRequest2 =
new DepositRequest(
BLSPublicKey.fromHexString(
"0x8706d19a62f28a6a6549f96c5adaebac9124a61d44868ec94f6d2d707c6a2f82c9162071231dfeb40e24bfde4ffdf243"),
Bytes32.fromHexString(
@ -97,8 +97,8 @@ public class DepositsValidatorTest {
}
@Test
public void validateAllowedDeposits() {
final List<Request> request = List.of(DEPOSIT_1, DEPOSIT_2);
public void validateAllowedDepositRequests() {
final List<Request> request = List.of(depositRequest1, depositRequest2);
final BlockDataGenerator.BlockOptions blockOptions =
BlockDataGenerator.BlockOptions.create()
.setRequests(Optional.of(request))
@ -113,9 +113,9 @@ public class DepositsValidatorTest {
}
@Test
public void validateAllowedDepositsSeparateReceipts() {
public void validateAllowedDepositRequestsSeparateReceipts() {
final List<Request> requests = List.of(DEPOSIT_1, DEPOSIT_2);
final List<Request> requests = List.of(depositRequest1, depositRequest2);
final BlockDataGenerator.BlockOptions blockOptions =
BlockDataGenerator.BlockOptions.create()
@ -135,9 +135,9 @@ public class DepositsValidatorTest {
}
@Test
public void invalidateAllowedDeposits() {
public void invalidateAllowedDepositRequests() {
final BlockDataGenerator.BlockOptions blockOptions =
BlockDataGenerator.BlockOptions.create().setRequests(Optional.of(List.of(DEPOSIT_1)));
BlockDataGenerator.BlockOptions.create().setRequests(Optional.of(List.of(depositRequest1)));
final Block block = blockDataGenerator.block(blockOptions);
final TransactionReceipt receipt1 =
@ -149,10 +149,10 @@ public class DepositsValidatorTest {
}
@Test
public void invalidateAllowedDepositsMissingLogInReceipt() {
public void invalidateAllowedDepositRequestsMissingLogInReceipt() {
final BlockDataGenerator.BlockOptions blockOptions =
BlockDataGenerator.BlockOptions.create()
.setRequests(Optional.of(List.of(DEPOSIT_1, DEPOSIT_2)));
.setRequests(Optional.of(List.of(depositRequest1, depositRequest2)));
final Block block = blockDataGenerator.block(blockOptions);
final TransactionReceipt receipt1 =
@ -164,9 +164,9 @@ public class DepositsValidatorTest {
}
@Test
public void invalidateAllowedDepositsExtraLogInReceipt() {
public void invalidateAllowedDepositRequestsExtraLogInReceipt() {
final BlockDataGenerator.BlockOptions blockOptions =
BlockDataGenerator.BlockOptions.create().setRequests(Optional.of(List.of(DEPOSIT_1)));
BlockDataGenerator.BlockOptions.create().setRequests(Optional.of(List.of(depositRequest1)));
final Block block = blockDataGenerator.block(blockOptions);
final TransactionReceipt receipt1 =
@ -178,10 +178,10 @@ public class DepositsValidatorTest {
}
@Test
public void invalidateAllowedDepositsWrongOrder() {
public void invalidateAllowedDepositRequestsWrongOrder() {
final BlockDataGenerator.BlockOptions blockOptions =
BlockDataGenerator.BlockOptions.create()
.setRequests(Optional.of(List.of(DEPOSIT_1, DEPOSIT_2)));
.setRequests(Optional.of(List.of(depositRequest1, depositRequest2)));
final Block block = blockDataGenerator.block(blockOptions);
final TransactionReceipt receipt1 =
@ -193,11 +193,11 @@ public class DepositsValidatorTest {
}
@Test
public void invalidateAllowedDepositsMismatchContractAddress() {
public void invalidateAllowedDepositRequestsMismatchContractAddress() {
final BlockDataGenerator.BlockOptions blockOptions =
BlockDataGenerator.BlockOptions.create()
.setRequests(Optional.of(List.of(DEPOSIT_1, DEPOSIT_2)));
.setRequests(Optional.of(List.of(depositRequest1, depositRequest2)));
final Block block = blockDataGenerator.block(blockOptions);
final TransactionReceipt receipt1 =
@ -210,24 +210,25 @@ public class DepositsValidatorTest {
@Test
public void validateAllowedDepositParams() {
final Optional<List<Request>> deposits = Optional.of(List.of(DEPOSIT_1, DEPOSIT_2));
assertThat(depositsValidator.validateParameter(deposits)).isTrue();
final Optional<List<Request>> depositRequests =
Optional.of(List.of(depositRequest1, depositRequest2));
assertThat(depositRequestValidator.validateParameter(depositRequests)).isTrue();
final Optional<List<Request>> emptyDeposits = Optional.of(List.of());
assertThat(depositsValidator.validateParameter(emptyDeposits)).isTrue();
final Optional<List<Request>> emptyDepositRequests = Optional.of(List.of());
assertThat(depositRequestValidator.validateParameter(emptyDepositRequests)).isTrue();
}
@Test
public void invalidateAllowedDepositParams() {
final Optional<List<Request>> deposits = Optional.empty();
assertThat(depositsValidator.validateParameter(deposits)).isFalse();
final Optional<List<Request>> depositRequests = Optional.empty();
assertThat(depositRequestValidator.validateParameter(depositRequests)).isFalse();
}
static RequestsValidatorCoordinator createAllowDepositValidator() {
depositsValidator = new DepositsValidator(DEPOSIT_CONTRACT_ADDRESS);
depositRequestValidator = new DepositRequestValidator(DEPOSIT_CONTRACT_ADDRESS);
return new RequestsValidatorCoordinator.Builder()
.addValidator(RequestType.WITHDRAWAL, new WithdrawalRequestValidator())
.addValidator(RequestType.DEPOSIT, depositsValidator)
.addValidator(RequestType.DEPOSIT, depositRequestValidator)
.build();
}
}

@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator.BlockOptions;
import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositsValidator;
import org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestValidator;
import org.hyperledger.besu.ethereum.mainnet.requests.RequestsValidatorCoordinator;
import org.hyperledger.besu.evm.log.LogsBloomFilter;
@ -53,7 +53,7 @@ class MainnetBlockBodyValidatorTest {
@Mock private ProtocolSchedule protocolSchedule;
@Mock private ProtocolSpec protocolSpec;
@Mock private WithdrawalsValidator withdrawalsValidator;
@Mock private DepositsValidator depositsValidator;
@Mock private DepositRequestValidator depositRequestValidator;
@Mock private RequestsValidatorCoordinator requestValidator;
@BeforeEach
@ -64,7 +64,9 @@ class MainnetBlockBodyValidatorTest {
lenient().when(withdrawalsValidator.validateWithdrawals(any())).thenReturn(true);
lenient().when(withdrawalsValidator.validateWithdrawalsRoot(any())).thenReturn(true);
lenient().when(depositsValidator.validateDeposits(any(), any(), any())).thenReturn(true);
lenient()
.when(depositRequestValidator.validateDepositRequests(any(), any(), any()))
.thenReturn(true);
lenient().when(protocolSpec.getRequestsValidatorCoordinator()).thenReturn(requestValidator);
lenient().when(requestValidator.validate(any(), any(), any())).thenReturn(true);

@ -24,7 +24,7 @@ import org.hyperledger.besu.datatypes.GWei;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.core.WithdrawalRequest;
@ -89,9 +89,9 @@ public class GetBodiesFromPeerTaskTest extends PeerMessageTaskTest<List<Block>>
}
@Test
public void assertBodyIdentifierUsesDepositsToGenerateBodyIdentifiers() {
public void assertBodyIdentifierUsesDepositRequestsToGenerateBodyIdentifiers() {
final Request deposit =
new Deposit(
new DepositRequest(
BLSPublicKey.fromHexString(
"0xb10a4a15bf67b328c9b101d09e5c6ee6672978fdad9ef0d9e2ceffaee99223555d8601f0cb3bcc4ce1af9864779a416e"),
Bytes32.fromHexString(

@ -32,7 +32,7 @@ import org.hyperledger.besu.datatypes.VersionedHash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Deposit;
import org.hyperledger.besu.ethereum.core.DepositRequest;
import org.hyperledger.besu.ethereum.core.Request;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
@ -466,7 +466,7 @@ public class T8nExecutor {
resultObject.put("requestsRoot", requestRoot.toHexString());
var deposits = resultObject.putArray("depositRequests");
RequestUtil.filterRequestsOfType(maybeRequests.orElse(List.of()), Deposit.class)
RequestUtil.filterRequestsOfType(maybeRequests.orElse(List.of()), DepositRequest.class)
.forEach(
deposit -> {
var obj = deposits.addObject();

@ -70,7 +70,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'zgPAgf+ZxefbnCE9aYEQ5QoeBVsHySi3u+BlhHNHqn8='
knownHash = 'p8jZoKgvi9o8JpVLXTlwh9HoIot4A62hKFHwSOaTF+k='
}
check.dependsOn('checkAPIChanges')

@ -27,7 +27,7 @@ import org.apache.tuweni.units.bigints.UInt64;
* to beacon chain.
*/
@Unstable
public interface Deposit {
public interface DepositRequest {
/**
* Public key of the address that sends the deposit
Loading…
Cancel
Save