re-enable all but the finalization tests for block pool in mainnet presets

This commit is contained in:
Dustin Brody 2020-05-05 11:18:44 +02:00 committed by tersec
parent 2d691b2e14
commit d6c76f6b2f
2 changed files with 170 additions and 163 deletions

View File

@ -30,6 +30,17 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
+ Smoke test initialize_beacon_state_from_eth1 [Preset: mainnet] OK + Smoke test initialize_beacon_state_from_eth1 [Preset: mainnet] OK
``` ```
OK: 1/1 Fail: 0/1 Skip: 0/1 OK: 1/1 Fail: 0/1 Skip: 0/1
## Block pool processing [Preset: mainnet]
```diff
+ Can add same block twice [Preset: mainnet] OK
+ Reverse order block add & get [Preset: mainnet] OK
+ Simple block add&get [Preset: mainnet] OK
+ getRef returns nil for missing blocks OK
+ loadTailState gets genesis block on first load [Preset: mainnet] OK
+ updateHead updates head and headState [Preset: mainnet] OK
+ updateStateData sanity [Preset: mainnet] OK
```
OK: 7/7 Fail: 0/7 Skip: 0/7
## Block processing [Preset: mainnet] ## Block processing [Preset: mainnet]
```diff ```diff
+ Attestation gets processed at epoch [Preset: mainnet] OK + Attestation gets processed at epoch [Preset: mainnet] OK
@ -242,4 +253,4 @@ OK: 4/4 Fail: 0/4 Skip: 0/4
OK: 8/8 Fail: 0/8 Skip: 0/8 OK: 8/8 Fail: 0/8 Skip: 0/8
---TOTAL--- ---TOTAL---
OK: 149/152 Fail: 3/152 Skip: 0/152 OK: 156/159 Fail: 3/159 Skip: 0/159

View File

@ -8,10 +8,10 @@
{.used.} {.used.}
import import
unittest, chronicles, chronicles, options, sequtils, unittest,
./testutil, ./testutil, ./testblockutil,
../beacon_chain/spec/datatypes, ../beacon_chain/spec/[datatypes, digest, helpers],
../beacon_chain/[beacon_node_types, block_pool, ssz] ../beacon_chain/[beacon_node_types, block_pool, state_transition, ssz]
suiteReport "BlockRef and helpers" & preset(): suiteReport "BlockRef and helpers" & preset():
timedTest "isAncestorOf sanity" & preset(): timedTest "isAncestorOf sanity" & preset():
@ -82,27 +82,20 @@ suiteReport "BlockSlot and helpers" & preset():
s24.parent == BlockSlot(blck: s2, slot: Slot(3)) s24.parent == BlockSlot(blck: s2, slot: Slot(3))
s24.parent.parent == s22 s24.parent.parent == s22
when const_preset == "minimal": # Too much stack space used on mainnet
import
options, sequtils,
./testblockutil,
../beacon_chain/state_transition,
../beacon_chain/spec/[digest, helpers, validator]
suiteReport "Block pool processing" & preset(): suiteReport "Block pool processing" & preset():
setup: setup:
var var
db = makeTestDB(SLOTS_PER_EPOCH) db = makeTestDB(SLOTS_PER_EPOCH)
pool = BlockPool.init(db) pool = BlockPool.init(db)
state = newClone(pool.loadTailState().data) stateData = newClone(pool.loadTailState())
b1 = addTestBlock(state.data, pool.tail.root) b1 = addTestBlock(stateData.data.data, pool.tail.root)
b1Root = hash_tree_root(b1.message) b1Root = hash_tree_root(b1.message)
b2 = addTestBlock(state.data, b1Root) b2 = addTestBlock(stateData.data.data, b1Root)
b2Root {.used.} = hash_tree_root(b2.message) b2Root {.used.} = hash_tree_root(b2.message)
# addTestBlock(...) operates on BeaconState, so doesn't update root # addTestBlock(...) operates on BeaconState, so doesn't update root
# TODO fix addTestBlock to work on HashedBeaconState directly # TODO fix addTestBlock to work on HashedBeaconState directly
state.root = hash_tree_root(state.data) stateData.data.root = hash_tree_root(stateData.data.data)
timedTest "getRef returns nil for missing blocks": timedTest "getRef returns nil for missing blocks":
check: check:
@ -139,14 +132,14 @@ when const_preset == "minimal": # Too much stack space used on mainnet
pool.heads[0].blck == b2Add pool.heads[0].blck == b2Add
# Skip one slot to get a gap # Skip one slot to get a gap
process_slots(state[], state.data.slot + 1) process_slots(stateData.data, stateData.data.data.slot + 1)
let let
b4 = addTestBlock(state.data, b2Root) b4 = addTestBlock(stateData.data.data, b2Root)
b4Root = hash_tree_root(b4.message) b4Root = hash_tree_root(b4.message)
b4Add = pool.add(b4Root, b4) b4Add = pool.add(b4Root, b4)
# TODO fix addTestBlock to work on HashedBeaconState # TODO fix addTestBlock to work on HashedBeaconState
state.root = hash_tree_root(state.data) stateData.data.root = hash_tree_root(stateData.data.data)
check: check:
b4Add.parent == b2Add b4Add.parent == b2Add
@ -288,6 +281,9 @@ when const_preset == "minimal": # Too much stack space used on mainnet
tmpState.blck == b1Add.parent tmpState.blck == b1Add.parent
tmpState.data.data.slot == bs1.parent.slot tmpState.data.data.slot == bs1.parent.slot
when const_preset == "minimal": # These require some minutes in mainnet
import ../beacon_chain/spec/validator
suiteReport "BlockPool finalization tests" & preset(): suiteReport "BlockPool finalization tests" & preset():
setup: setup:
var var