Skip to content

Commit 05bf35d

Browse files
committed
add lookback checks to check_consensus_block_proposals task
1 parent cec1132 commit 05bf35d

File tree

3 files changed

+44
-5
lines changed

3 files changed

+44
-5
lines changed

pkg/coordinator/tasks/check_consensus_block_proposals/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package checkconsensusblockproposals
33
import "math/big"
44

55
type Config struct {
6+
CheckLookback int `yaml:"checkLookback" json:"checkLookback"`
67
BlockCount int `yaml:"blockCount" json:"blockCount"`
78
GraffitiPattern string `yaml:"graffitiPattern" json:"graffitiPattern"`
89
ValidatorNamePattern string `yaml:"validatorNamePattern" json:"validatorNamePattern"`
@@ -55,7 +56,8 @@ type Config struct {
5556

5657
func DefaultConfig() Config {
5758
return Config{
58-
BlockCount: 1,
59+
CheckLookback: 1,
60+
BlockCount: 1,
5961
}
6062
}
6163

pkg/coordinator/tasks/check_consensus_block_proposals/task.go

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,33 @@ func (t *Task) Execute(ctx context.Context) error {
115115
}
116116

117117
// check current block
118-
if blocks := consensusPool.GetBlockCache().GetCachedBlocks(); len(blocks) > 0 {
119-
if checkBlockMatch(blocks[0]) {
120-
return nil
118+
if t.config.CheckLookback > 0 {
119+
if blocks := consensusPool.GetBlockCache().GetCachedBlocks(); len(blocks) > 0 {
120+
lookbackBlocks := []*consensus.Block{}
121+
block := blocks[0]
122+
123+
for {
124+
lookbackBlocks = append(lookbackBlocks, block)
125+
if len(lookbackBlocks) >= t.config.CheckLookback {
126+
break
127+
}
128+
129+
parentRoot := block.GetParentRoot()
130+
if parentRoot == nil {
131+
break
132+
}
133+
134+
block = consensusPool.GetBlockCache().GetCachedBlockByRoot(*parentRoot)
135+
if block == nil {
136+
break
137+
}
138+
}
139+
140+
for i := len(lookbackBlocks) - 1; i >= 0; i-- {
141+
if checkBlockMatch(lookbackBlocks[i]) {
142+
return nil
143+
}
144+
}
121145
}
122146
}
123147

playbooks/pectra-dev/eip7002-all.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,18 @@ tasks:
392392
configVars:
393393
expectBlsChanges: "| [{publicKey: .tasks.validator_pubkeys.outputs.pubkeys[3], address: .tasks.wallet_details.outputs.address}]"
394394

395+
# wait for balance to be <= 32ETH (await withdrawal after bls change)
396+
- name: check_consensus_validator_status
397+
title: "Wait for key 3 balance to be <= 32.01 ETH"
398+
id: key3_status
399+
timeout: 30m
400+
config:
401+
validatorStatus:
402+
- active_ongoing
403+
maxValidatorBalance: 32010000000
404+
configVars:
405+
validatorPubKey: "tasks.validator_pubkeys.outputs.pubkeys[3]"
406+
395407
# generate withdrawal & wait for inclusion
396408
- name: run_task_background
397409
title: "Generate EL triggered partial withdrawal for key 3 & track inclusion"
@@ -421,13 +433,14 @@ tasks:
421433
- name: run_task_options
422434
title: "Monitor chain for 30min, expect no withdrawal with >= 0.1 ETH for key 3"
423435
config:
424-
invertResult: true
436+
expectFailure: true
425437
task:
426438
name: check_consensus_block_proposals
427439
title: "Check for >= 0.1 ETH withdrawal for key 3 (expect failure)"
428440
timeout: 30m
429441
config:
430442
minWithdrawalCount: 1
443+
checkLookback: 0
431444
configVars:
432445
expectWithdrawals: "| [{publicKey: .tasks.validator_pubkeys.outputs.pubkeys[3], address: .tasks.wallet_details.outputs.address, minAmount: 100000000}]"
433446

0 commit comments

Comments
 (0)