Skip to content

Commit

Permalink
Updated consolidation rules for devnet5 (#8876)
Browse files Browse the repository at this point in the history
 - updated fuzzUtil to use prettyJson to report diffs for the tests that broke...

 - currently the fuzz utils need some changes, will just raise a draft until we're ready...

fixes #8875

Signed-off-by: Paul Harris <[email protected]>
  • Loading branch information
rolfyone authored Dec 17, 2024
1 parent 83d0ce5 commit 4bcc4db
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"GENESIS_FORK_VERSION" : "0x00000000",
"KZG_COMMITMENT_INCLUSION_PROOF_DEPTH" : "17",
"DEPOSIT_NETWORK_ID" : "1",
"MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD" : "1",
"MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD" : "2",
"MAX_REQUEST_BLOCKS_DENEB" : "128",
"BLOB_SIDECAR_SUBNET_COUNT" : "6",
"SYNC_COMMITTEE_SUBNET_COUNT" : "4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void processWithdrawalRequest(
}

@Override
public void processConsolidationRequest(
public void processConsolidationRequests(
final MutableBeaconState state, final List<ConsolidationRequest> consolidationRequests)
throws BlockProcessingException {
spec.getBlockProcessor(state.getSlot())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void processDepositRequest(MutableBeaconState state, List<DepositRequest> deposi
void processWithdrawalRequest(MutableBeaconState state, List<WithdrawalRequest> withdrawalRequest)
throws BlockProcessingException;

void processConsolidationRequest(
void processConsolidationRequests(
MutableBeaconState state, List<ConsolidationRequest> consolidationRequest)
throws BlockProcessingException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private void processOperation(
case WITHDRAWAL -> processWithdrawal(testDefinition, state, processor);
case DEPOSIT_REQUEST -> processDepositRequest(testDefinition, state, processor);
case WITHDRAWAL_REQUEST -> processWithdrawalRequest(testDefinition, state, processor);
case CONSOLIDATION_REQUEST -> processConsolidation(testDefinition, state, processor);
case CONSOLIDATION_REQUEST -> processConsolidations(testDefinition, state, processor);
default ->
throw new UnsupportedOperationException(
"Operation " + operation + " not implemented in OperationTestExecutor");
Expand Down Expand Up @@ -381,7 +381,7 @@ private void processWithdrawalRequest(
processor.processWithdrawalRequest(state, withdrawalRequests.asList());
}

private void processConsolidation(
private void processConsolidations(
final TestDefinition testDefinition,
final MutableBeaconState state,
final OperationProcessor processor)
Expand All @@ -394,7 +394,7 @@ private void processConsolidation(
final SszList<ConsolidationRequest> consolidationRequests =
loadSsz(testDefinition, dataFileName, consolidationRequestsSchema);

processor.processConsolidationRequest(state, consolidationRequests.asList());
processor.processConsolidationRequests(state, consolidationRequests.asList());
}

private SignedVoluntaryExit loadVoluntaryExit(final TestDefinition testDefinition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ private void processConsolidationRequest(
return;
}

// Verify that target has execution withdrawal credentials
if (!predicatesElectra.hasExecutionWithdrawalCredential(targetValidator)) {
// Verify that target has compounding withdrawal credentials
if (!predicatesElectra.hasCompoundingWithdrawalCredential(targetValidator)) {
LOG.debug("process_consolidation_request: invalid target credentials");
return;
}
Expand Down Expand Up @@ -560,11 +560,6 @@ private void processConsolidationRequest(
SszUInt64.of(UInt64.valueOf(targetValidatorIndex)));
state.getPendingConsolidations().append(pendingConsolidation);

// Churn any target excess active balance of target and raise its max
if (predicatesElectra.hasEth1WithdrawalCredential(targetValidator)) {
beaconStateMutatorsElectra.switchToCompoundingValidator(state, targetValidatorIndex);
}

LOG.debug("process_consolidation_request: created {}", pendingConsolidation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# `uint64(2**3)` (= 8)
MAX_ATTESTATIONS_ELECTRA: 8
# `uint64(2**0)` (= 1)
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 2

# Execution
# ---------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# `uint64(2**3)` (= 8)
MAX_ATTESTATIONS_ELECTRA: 8
# `uint64(2**0)` (= 1)
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 2

# Execution
# ---------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
# `uint64(2**3)` (= 8)
MAX_ATTESTATIONS_ELECTRA: 8
# `uint64(2**0)` (= 1)
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 2

# Execution
# ---------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions fuzz/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dependencies {
api 'com.fasterxml.jackson.core:jackson-databind'
implementation project(':ethereum:networks')
implementation project(':ethereum:spec')
implementation testFixtures(project(':ethereum:spec'))
Expand All @@ -10,6 +11,7 @@ dependencies {

testImplementation 'org.xerial.snappy:snappy-java'
testImplementation testFixtures(project(':ethereum:spec'))
testImplementation project(':infrastructure:json')
}


Expand Down
4 changes: 2 additions & 2 deletions fuzz/src/main/java/tech/pegasys/teku/fuzz/FuzzUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ public Optional<byte[]> fuzzBlockHeader(final byte[] input) {
deserialize(input, BlockHeaderFuzzInput.createType(specVersion));

try {
BeaconState postState =
final BeaconState postState =
structuredInput
.getState()
.updated(
state ->
spec.getBlockProcessor(state.getSlot())
.processBlockHeader(state, structuredInput.getBlock()));
Bytes output = postState.sszSerialize();
final Bytes output = postState.sszSerialize();
return Optional.of(output.toArrayUnsafe());
} catch (BlockProcessingException e) {
// "expected error"
Expand Down

0 comments on commit 4bcc4db

Please sign in to comment.