Skip to content

Commit 4bcc4db

Browse files
authored
Updated consolidation rules for devnet5 (#8876)
- 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]>
1 parent 83d0ce5 commit 4bcc4db

File tree

10 files changed

+15
-18
lines changed

10 files changed

+15
-18
lines changed

data/beaconrestapi/src/test/resources/tech/pegasys/teku/beaconrestapi/handlers/v1/config/mainnetConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"GENESIS_FORK_VERSION" : "0x00000000",
132132
"KZG_COMMITMENT_INCLUSION_PROOF_DEPTH" : "17",
133133
"DEPOSIT_NETWORK_ID" : "1",
134-
"MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD" : "1",
134+
"MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD" : "2",
135135
"MAX_REQUEST_BLOCKS_DENEB" : "128",
136136
"BLOB_SIDECAR_SUBNET_COUNT" : "6",
137137
"SYNC_COMMITTEE_SUBNET_COUNT" : "4",

eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/DefaultOperationProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void processWithdrawalRequest(
160160
}
161161

162162
@Override
163-
public void processConsolidationRequest(
163+
public void processConsolidationRequests(
164164
final MutableBeaconState state, final List<ConsolidationRequest> consolidationRequests)
165165
throws BlockProcessingException {
166166
spec.getBlockProcessor(state.getSlot())

eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void processDepositRequest(MutableBeaconState state, List<DepositRequest> deposi
7373
void processWithdrawalRequest(MutableBeaconState state, List<WithdrawalRequest> withdrawalRequest)
7474
throws BlockProcessingException;
7575

76-
void processConsolidationRequest(
76+
void processConsolidationRequests(
7777
MutableBeaconState state, List<ConsolidationRequest> consolidationRequest)
7878
throws BlockProcessingException;
7979
}

eth-reference-tests/src/referenceTest/java/tech/pegasys/teku/reference/common/operations/OperationsTestExecutor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ private void processOperation(
320320
case WITHDRAWAL -> processWithdrawal(testDefinition, state, processor);
321321
case DEPOSIT_REQUEST -> processDepositRequest(testDefinition, state, processor);
322322
case WITHDRAWAL_REQUEST -> processWithdrawalRequest(testDefinition, state, processor);
323-
case CONSOLIDATION_REQUEST -> processConsolidation(testDefinition, state, processor);
323+
case CONSOLIDATION_REQUEST -> processConsolidations(testDefinition, state, processor);
324324
default ->
325325
throw new UnsupportedOperationException(
326326
"Operation " + operation + " not implemented in OperationTestExecutor");
@@ -381,7 +381,7 @@ private void processWithdrawalRequest(
381381
processor.processWithdrawalRequest(state, withdrawalRequests.asList());
382382
}
383383

384-
private void processConsolidation(
384+
private void processConsolidations(
385385
final TestDefinition testDefinition,
386386
final MutableBeaconState state,
387387
final OperationProcessor processor)
@@ -394,7 +394,7 @@ private void processConsolidation(
394394
final SszList<ConsolidationRequest> consolidationRequests =
395395
loadSsz(testDefinition, dataFileName, consolidationRequestsSchema);
396396

397-
processor.processConsolidationRequest(state, consolidationRequests.asList());
397+
processor.processConsolidationRequests(state, consolidationRequests.asList());
398398
}
399399

400400
private SignedVoluntaryExit loadVoluntaryExit(final TestDefinition testDefinition) {

ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/electra/block/BlockProcessorElectra.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ private void processConsolidationRequest(
491491
return;
492492
}
493493

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

563-
// Churn any target excess active balance of target and raise its max
564-
if (predicatesElectra.hasEth1WithdrawalCredential(targetValidator)) {
565-
beaconStateMutatorsElectra.switchToCompoundingValidator(state, targetValidatorIndex);
566-
}
567-
568563
LOG.debug("process_consolidation_request: created {}", pendingConsolidation);
569564
}
570565

ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/mainnet/electra.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
3030
# `uint64(2**3)` (= 8)
3131
MAX_ATTESTATIONS_ELECTRA: 8
3232
# `uint64(2**0)` (= 1)
33-
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
33+
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 2
3434

3535
# Execution
3636
# ---------------------------------------------------------------

ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/minimal/electra.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
3030
# `uint64(2**3)` (= 8)
3131
MAX_ATTESTATIONS_ELECTRA: 8
3232
# `uint64(2**0)` (= 1)
33-
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
33+
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 2
3434

3535
# Execution
3636
# ---------------------------------------------------------------

ethereum/spec/src/main/resources/tech/pegasys/teku/spec/config/presets/swift/electra.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MAX_ATTESTER_SLASHINGS_ELECTRA: 1
3030
# `uint64(2**3)` (= 8)
3131
MAX_ATTESTATIONS_ELECTRA: 8
3232
# `uint64(2**0)` (= 1)
33-
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 1
33+
MAX_CONSOLIDATION_REQUESTS_PER_PAYLOAD: 2
3434

3535
# Execution
3636
# ---------------------------------------------------------------

fuzz/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dependencies {
2+
api 'com.fasterxml.jackson.core:jackson-databind'
23
implementation project(':ethereum:networks')
34
implementation project(':ethereum:spec')
45
implementation testFixtures(project(':ethereum:spec'))
@@ -10,6 +11,7 @@ dependencies {
1011

1112
testImplementation 'org.xerial.snappy:snappy-java'
1213
testImplementation testFixtures(project(':ethereum:spec'))
14+
testImplementation project(':infrastructure:json')
1315
}
1416

1517

fuzz/src/main/java/tech/pegasys/teku/fuzz/FuzzUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ public Optional<byte[]> fuzzBlockHeader(final byte[] input) {
182182
deserialize(input, BlockHeaderFuzzInput.createType(specVersion));
183183

184184
try {
185-
BeaconState postState =
185+
final BeaconState postState =
186186
structuredInput
187187
.getState()
188188
.updated(
189189
state ->
190190
spec.getBlockProcessor(state.getSlot())
191191
.processBlockHeader(state, structuredInput.getBlock()));
192-
Bytes output = postState.sszSerialize();
192+
final Bytes output = postState.sszSerialize();
193193
return Optional.of(output.toArrayUnsafe());
194194
} catch (BlockProcessingException e) {
195195
// "expected error"

0 commit comments

Comments
 (0)