Skip to content

Commit 49d2cf0

Browse files
committed
simulators/eth2/dencun: Tests cases docs
1 parent 86127cb commit 49d2cf0

File tree

4 files changed

+67
-63
lines changed

4 files changed

+67
-63
lines changed

simulators/eth2/dencun/suites/builder/TESTS.md

+18-32
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ Test canonical chain includes deneb payloads built by the builder api.
6565

6666
- For each blob transaction on the execution chain, the blob sidecars are available for the beacon block at the same height
6767
- The beacon block lists the correct commitments for each blob
68-
- After all other verifications are done, the beacon chain is able to finalize the current epoch
6968
- Verify that the builder, up to before Deneb fork, has been able to produce blocks and they have been included in the canonical chain
70-
- Circuit breaker correctly kicks in and disables the builder workflow
71-
- Implicitly verified by missed-slot count
72-
- Builder workflow is re-enabled after the circuit breaker timeout
73-
- There are no more than 10 missed slots on the latest epoch
69+
- After Deneb fork, the builder must be able to include blocks with blobs in the canonical chain, which implicitly verifies:
70+
- Consensus client is able to properly format header requests to the builder
71+
- Consensus client is able to properly format blinded signed requests to the builder
72+
- No signed block contained an invalid format or signature
73+
- Test fails with a timeout if no payload with blobs is produced after the fork
7474

7575
### - Deneb Builder Builds Block With Invalid Beacon Root, Correct State Root
7676

@@ -116,12 +116,10 @@ building payloads with invalid parent beacon block root.
116116

117117
- For each blob transaction on the execution chain, the blob sidecars are available for the beacon block at the same height
118118
- The beacon block lists the correct commitments for each blob
119-
- After all other verifications are done, the beacon chain is able to finalize the current epoch
120119
- Verify that the builder, up to before Deneb fork, has been able to produce blocks and they have been included in the canonical chain
121-
- Circuit breaker correctly kicks in and disables the builder workflow
122-
- Implicitly verified by missed-slot count
123-
- Builder workflow is re-enabled after the circuit breaker timeout
124-
- There are no more than 10 missed slots on the latest epoch
120+
- After Deneb fork, the builder starts producing invalid payloads, verify that:
121+
- None of the produced payloads are included in the canonical chain
122+
- Since action causes missed slot, verify that the circuit breaker correctly kicks in and disables the builder workflow. Builder starts corrupting payloads after fork, hence a single block in the canonical chain after the fork is enough to verify the circuit breaker
125123

126124
### - Deneb Builder Errors Out on Header Requests After Deneb Transition
127125

@@ -167,13 +165,9 @@ returning error on header request after deneb transition.
167165

168166
- For each blob transaction on the execution chain, the blob sidecars are available for the beacon block at the same height
169167
- The beacon block lists the correct commitments for each blob
170-
- After all other verifications are done, the beacon chain is able to finalize the current epoch
171168
- Verify that the builder, up to before Deneb fork, has been able to produce blocks and they have been included in the canonical chain
172-
- After Deneb fork, the builder must be able to include blocks with blobs in the canonical chain, which implicitly verifies:
173-
- Consensus client is able to properly format header requests to the builder
174-
- Consensus client is able to properly format blinded signed requests to the builder
175-
- No signed block contained an invalid format or signature
176-
- There are no more than 1 missed slots on the latest epoch
169+
- After Deneb fork, the builder starts producing invalid payloads, verify that:
170+
- None of the produced payloads are included in the canonical chain
177171

178172
### - Deneb Builder Errors Out on Signed Blinded Beacon Block/Blob Sidecars Submission After Deneb Transition
179173

@@ -219,12 +213,10 @@ returning error on unblinded payload request after deneb transition.
219213

220214
- For each blob transaction on the execution chain, the blob sidecars are available for the beacon block at the same height
221215
- The beacon block lists the correct commitments for each blob
222-
- After all other verifications are done, the beacon chain is able to finalize the current epoch
223216
- Verify that the builder, up to before Deneb fork, has been able to produce blocks and they have been included in the canonical chain
224-
- Circuit breaker correctly kicks in and disables the builder workflow
225-
- Implicitly verified by missed-slot count
226-
- Builder workflow is re-enabled after the circuit breaker timeout
227-
- There are no more than 10 missed slots on the latest epoch
217+
- After Deneb fork, the builder starts producing invalid payloads, verify that:
218+
- None of the produced payloads are included in the canonical chain
219+
- Since action causes missed slot, verify that the circuit breaker correctly kicks in and disables the builder workflow. Builder starts corrupting payloads after fork, hence a single block in the canonical chain after the fork is enough to verify the circuit breaker
228220

229221
### - Deneb Builder Builds Block With Invalid Payload Version
230222

@@ -270,13 +262,9 @@ version is outdated (capella instead of deneb).
270262

271263
- For each blob transaction on the execution chain, the blob sidecars are available for the beacon block at the same height
272264
- The beacon block lists the correct commitments for each blob
273-
- After all other verifications are done, the beacon chain is able to finalize the current epoch
274265
- Verify that the builder, up to before Deneb fork, has been able to produce blocks and they have been included in the canonical chain
275-
- After Deneb fork, the builder must be able to include blocks with blobs in the canonical chain, which implicitly verifies:
276-
- Consensus client is able to properly format header requests to the builder
277-
- Consensus client is able to properly format blinded signed requests to the builder
278-
- No signed block contained an invalid format or signature
279-
- There are no more than 1 missed slots on the latest epoch
266+
- After Deneb fork, the builder starts producing invalid payloads, verify that:
267+
- None of the produced payloads are included in the canonical chain
280268

281269
### - Deneb Builder Builds Block With Invalid Beacon Root, Incorrect State Root
282270

@@ -327,10 +315,8 @@ produced locally and results in an empty slot.
327315

328316
- For each blob transaction on the execution chain, the blob sidecars are available for the beacon block at the same height
329317
- The beacon block lists the correct commitments for each blob
330-
- After all other verifications are done, the beacon chain is able to finalize the current epoch
331318
- Verify that the builder, up to before Deneb fork, has been able to produce blocks and they have been included in the canonical chain
332-
- Circuit breaker correctly kicks in and disables the builder workflow
333-
- Implicitly verified by missed-slot count
334-
- Builder workflow is re-enabled after the circuit breaker timeout
335-
- There are no more than 10 missed slots on the latest epoch
319+
- After Deneb fork, the builder starts producing invalid payloads, verify that:
320+
- None of the produced payloads are included in the canonical chain
321+
- Since action causes missed slot, verify that the circuit breaker correctly kicks in and disables the builder workflow. Builder starts corrupting payloads after fork, hence a single block in the canonical chain after the fork is enough to verify the circuit breaker
336322

simulators/eth2/dencun/suites/builder/config.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package suite_builder
22

33
import (
4-
"fmt"
54
"math/big"
65

76
"github.com/ethereum/hive/simulators/eth2/common/clients"
@@ -110,19 +109,21 @@ func (ts BuilderTestSpec) GetDescription() *utils.Description {
110109
- Nodes have the mock-builder configured as builder endpoint`)
111110
desc.Add(utils.CategoryVerificationsConsensusClient, `
112111
- Verify that the builder, up to before Deneb fork, has been able to produce blocks and they have been included in the canonical chain`)
113-
if ts.InvalidPayloadCaughtBeforeReveal() {
114-
desc.Add(utils.CategoryVerificationsConsensusClient, fmt.Sprintf(`
112+
if ts.BuilderProducesValidPayload() {
113+
desc.Add(utils.CategoryVerificationsConsensusClient, `
115114
- After Deneb fork, the builder must be able to include blocks with blobs in the canonical chain, which implicitly verifies:
116115
- Consensus client is able to properly format header requests to the builder
117116
- Consensus client is able to properly format blinded signed requests to the builder
118117
- No signed block contained an invalid format or signature
119-
- There are no more than %d missed slots on the latest epoch`, MAX_MISSED_SLOTS_NO_CIRCUIT_BREAKER))
118+
- Test fails with a timeout if no payload with blobs is produced after the fork`)
120119
} else {
121-
desc.Add(utils.CategoryVerificationsConsensusClient, fmt.Sprintf(`
122-
- Circuit breaker correctly kicks in and disables the builder workflow
123-
- Implicitly verified by missed-slot count
124-
- Builder workflow is re-enabled after the circuit breaker timeout
125-
- There are no more than %d missed slots on the latest epoch`, MAX_MISSED_SLOTS_BEFORE_CIRCUIT_BREAKER))
120+
desc.Add(utils.CategoryVerificationsConsensusClient, `
121+
- After Deneb fork, the builder starts producing invalid payloads, verify that:
122+
- None of the produced payloads are included in the canonical chain`)
123+
if ts.CausesMissedSlot() {
124+
desc.Add(utils.CategoryVerificationsConsensusClient, `
125+
- Since action causes missed slot, verify that the circuit breaker correctly kicks in and disables the builder workflow. Builder starts corrupting payloads after fork, hence a single block in the canonical chain after the fork is enough to verify the circuit breaker`)
126+
}
126127
}
127128
return desc
128129
}

simulators/eth2/dencun/suites/builder/execution.go

+36-19
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (ts BuilderTestSpec) WaitForFork(
3232
config *tn.Config,
3333
) {
3434
extraSlotsTimeout := beacon.Slot(4)
35-
if !ts.InvalidPayloadCaughtBeforeReveal() {
35+
if ts.CausesMissedSlot() {
3636
// The error cannot be caught by the consensus client until the payload is revealed,
3737
// and the beacon block had been signed. Therefore there will be missed slots
3838
// until the circuit breaker kicks in.
@@ -83,29 +83,46 @@ func (ts BuilderTestSpec) ExecutePostFork(
8383
}
8484
}
8585

86-
func (ts BuilderTestSpec) InvalidPayloadCaughtBeforeReveal() bool {
87-
// If true, the invalid payload should be caught by the consensus client and not be signed.
88-
// The consensus client should fallback to local block production and not miss any slots.
89-
if ts.ErrorOnHeaderRequest {
86+
func (ts BuilderTestSpec) BuilderProducesValidPayload() bool {
87+
// If true, the builder is expected to produce a valid payload that should
88+
// be included in the canonical chain.
89+
if ts.ErrorOnHeaderRequest || ts.InvalidPayloadVersion ||
90+
ts.ErrorOnPayloadReveal || ts.InvalidatePayload != "" ||
91+
ts.InvalidatePayloadAttributes != "" {
92+
return false
93+
}
94+
return true
95+
}
96+
97+
func (ts BuilderTestSpec) CausesMissedSlot() bool {
98+
// If true, the test is expected to cause a missed slot.
99+
if ts.ErrorOnHeaderRequest || ts.InvalidPayloadVersion {
90100
// An error on header request to the builder should fallback to local block production,
91-
// and hence there isn't even a blinded payload to process.
101+
// hence no missed slot.
102+
return false
103+
}
104+
if ts.ErrorOnPayloadReveal {
105+
// An error on payload reveal means that, since the mock builder does _not_ relay unblinded
106+
// payloads to the p2p network, the consensus client will not be able to produce a block
107+
// for the slot, and hence a missed slot is expected.
92108
return true
93109
}
94-
if ts.InvalidPayloadVersion {
95-
// An invalid payload version should be caught by the consensus client
96-
// when the built blinded payload is received.
110+
if ts.InvalidatePayloadAttributes == "" && ts.InvalidatePayload == "" {
111+
// If no payload is invalidated, then no missed slot is expected.
112+
return false
113+
}
114+
if ts.InvalidatePayload != "" {
115+
// An invalid payload cannot be detected by the consensus client until the payload is
116+
// revealed, and the beacon block had been signed. Therefore there will be missed slots.
97117
return true
98118
}
99-
if ts.InvalidatePayloadAttributes != "" {
100-
// An invalid payload attribute modification should be caught by the consensus client
101-
// when the built blinded payload is received most of the times.
102-
if ts.InvalidatePayloadAttributes != mock_builder.INVALIDATE_ATTR_BEACON_ROOT {
103-
// Invalid Beacon Root is special because the modified value is not in the response,
104-
// and hence can only be detected by the consensus client after the payload is
105-
// revealed and executed.
106-
return true
107-
}
119+
if ts.InvalidatePayloadAttributes == mock_builder.INVALIDATE_ATTR_BEACON_ROOT {
120+
// Invalid Beacon Root is special because the modified value is not in the response,
121+
// and hence can only be detected by the consensus client after the payload is
122+
// revealed and executed.
123+
return true
108124
}
125+
// The rest of payload attributes invalidations can be detected by the consensus client
109126
return false
110127
}
111128

@@ -251,7 +268,7 @@ func (ts BuilderTestSpec) Verify(
251268
}
252269

253270
var max_missed_slots uint64 = 0
254-
if ts.InvalidPayloadCaughtBeforeReveal() {
271+
if !ts.CausesMissedSlot() {
255272
// These errors should be caught by the CL client when the built blinded
256273
// payload is received. Hence, a low number of missed slots is expected.
257274
max_missed_slots = MAX_MISSED_SLOTS_NO_CIRCUIT_BREAKER

simulators/eth2/dencun/suites/p2p/gossip/blobs/TESTS.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ delay makes the test more deterministic.
259259
#### Blobber Behavior
260260

261261

262-
- Create an equivocating block by modifying the graffiti
262+
- Create an invalid equivocating block by modifying the graffiti
263263
- Sign both blocks
264264
- Generate the sidecars out of the correct block only
265265
- Broadcast the blob sidecars
@@ -357,7 +357,7 @@ Test chain health if a proposer sends equivocating blob sidecars (equivocating b
357357
#### Blobber Behavior
358358

359359

360-
- Create an equivocating block by modifying the graffiti
360+
- Create an invalid equivocating block by modifying the graffiti
361361
- Sign both blocks
362362
- Generate the sidecars out of the equivocating signed block only
363363
- Broadcast the original signed block only
@@ -406,7 +406,7 @@ Test chain health if a proposer sends equivocating blob sidecars (equivocating b
406406
#### Blobber Behavior
407407

408408

409-
- Create an equivocating block by modifying the graffiti
409+
- Create an invalid equivocating block by modifying the graffiti
410410
- Sign both blocks
411411
- Generate the sidecars out of the equivocating signed block only
412412
- Broadcast the blob sidecars with the equivocating block header

0 commit comments

Comments
 (0)