Add validator_is_connected

This commit is contained in:
Hsiao-Wei Wang 2023-10-26 22:39:24 +08:00
parent 9ce8e3d6e9
commit b9285b8fe7
No known key found for this signature in database
GPG Key ID: AE3D6B174F971DE4
2 changed files with 19 additions and 7 deletions

View File

@ -63,7 +63,10 @@ def test_should_override_forkchoice_update__false(spec, state):
output_store_checks(spec, store, test_steps)
test_steps.append({
'checks': {
'should_override_forkchoice_update': should_override,
'should_override_forkchoice_update': {
'validator_is_connected': True,
'result': should_override,
},
}
})
@ -153,7 +156,10 @@ def test_should_override_forkchoice_update__true(spec, state):
assert spec.is_ffg_competitive(store, head_root, parent_root)
assert spec.is_finalization_ok(store, proposal_slot)
# TODO: proposing_reorg_slot
parent_state_advanced = store.block_states[parent_root].copy()
spec.process_slots(parent_state_advanced, proposal_slot)
proposer_index = spec.get_beacon_proposer_index(parent_state_advanced)
assert spec.validator_is_connected(proposer_index)
# Single slot re-org.
parent_slot_ok = parent_block.slot + 1 == head_block.slot
@ -170,7 +176,10 @@ def test_should_override_forkchoice_update__true(spec, state):
output_store_checks(spec, store, test_steps)
test_steps.append({
'checks': {
'should_override_forkchoice_update': should_override,
'should_override_forkchoice_update': {
'validator_is_connected': True,
'result': should_override,
},
}
})

View File

@ -142,7 +142,7 @@ Optional step for optimistic sync tests.
}
```
This step sets the [`payloadStatus`](https://github.com/ethereum/execution-apis/blob/main/src/engine/specification.md#PayloadStatusV1)
This step sets the [`payloadStatus`](https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#payloadstatusv1)
value that Execution Layer client mock returns in responses to the following Engine API calls:
* [`engine_newPayloadV1(payload)`](https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#engine_newpayloadv1) if `payload.blockHash == payload_info.block_hash`
* [`engine_forkchoiceUpdatedV1(forkchoiceState, ...)`](https://github.com/ethereum/execution-apis/blob/main/src/engine/paris.md#engine_forkchoiceupdatedv1) if `forkchoiceState.headBlockHash == payload_info.block_hash`
@ -182,8 +182,11 @@ proposer_boost_root: string -- Encoded 32-byte value from store.proposer_boost
Additionally, these fields if `get_proposer_head` and `should_override_forkchoice_update` features are implemented:
```yaml
get_proposer_head: string -- Encoded 32-byte value from get_proposer_head(store)
should_override_forkchoice_update: bool -- [New in Bellatrix] the result of `should_override_forkchoice_update(store, head_root)`, where head_root is the result value from get_head(store)
get_proposer_head: string -- Encoded 32-byte value from get_proposer_head(store)
should_override_forkchoice_update: { -- [New in Bellatrix]
validator_is_connected: bool, -- The mocking result of `validator_is_connected(proposer_index)` in this call
result: bool, -- The result of `should_override_forkchoice_update(store, head_root)`, where head_root is the result value from get_head(store)
}
```
For example:
@ -195,7 +198,7 @@ For example:
finalized_checkpoint: {epoch: 2, root: '0x40d32d6283ec11c53317a46808bc88f55657d93b95a1af920403187accf48f4f'}
proposer_boost_root: '0xdaa1d49d57594ced0c35688a6da133abb086d191a2ebdfd736fad95299325aeb'
get_proposer_head: '0xdaa1d49d57594ced0c35688a6da133abb086d191a2ebdfd736fad95299325aeb'
should_override_forkchoice_update: false
should_override_forkchoice_update: {validator_is_connected: false, result: false}
```
*Note*: Each `checks` step may include one or multiple items. Each item has to be checked against the current store.