prysm-pulse/beacon-chain/blockchain/chain_info_test.go

99 lines
2.5 KiB
Go
Raw Normal View History

Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
package blockchain
import (
"bytes"
"context"
"reflect"
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
"testing"
"time"
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
testDB "github.com/prysmaticlabs/prysm/beacon-chain/db/testing"
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
"github.com/prysmaticlabs/prysm/shared/params"
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
)
// Ensure Service implements chain info interface.
var _ = ChainInfoRetriever(&Service{})
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
func TestFinalizedCheckpt_Nil(t *testing.T) {
c := setupBeaconChain(t, nil)
if !bytes.Equal(c.FinalizedCheckpt().Root, params.BeaconConfig().ZeroHash[:]) {
t.Error("Incorrect pre chain start value")
}
}
func TestHeadRoot_Nil(t *testing.T) {
c := setupBeaconChain(t, nil)
if !bytes.Equal(c.HeadRoot(), params.BeaconConfig().ZeroHash[:]) {
t.Error("Incorrect pre chain start value")
}
}
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
func TestFinalizedCheckpt_CanRetrieve(t *testing.T) {
db := testDB.SetupDB(t)
defer testDB.TeardownDB(t, db)
ctx := context.Background()
c := setupBeaconChain(t, db)
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
if err := c.forkChoiceStore.GenesisStore(ctx, &ethpb.Checkpoint{}, &ethpb.Checkpoint{}); err != nil {
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
t.Fatal(err)
}
if c.FinalizedCheckpt().Epoch != 0 {
t.Errorf("Finalized epoch at genesis should be 0, got: %d", c.FinalizedCheckpt().Epoch)
}
}
func TestHeadSlot_CanRetrieve(t *testing.T) {
c := &Service{}
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
c.headSlot = 100
if c.HeadSlot() != 100 {
t.Errorf("Wanted head slot: %d, got: %d", 100, c.HeadSlot())
}
}
func TestHeadRoot_CanRetrieve(t *testing.T) {
c := &Service{canonicalRoots: make(map[uint64][]byte)}
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
c.headSlot = 100
c.canonicalRoots[c.headSlot] = []byte{'A'}
if !bytes.Equal([]byte{'A'}, c.HeadRoot()) {
t.Errorf("Wanted head root: %v, got: %d", []byte{'A'}, c.HeadRoot())
}
}
func TestHeadBlock_CanRetrieve(t *testing.T) {
b := &ethpb.BeaconBlock{Slot: 1}
c := &Service{headBlock: b}
if !reflect.DeepEqual(b, c.HeadBlock()) {
t.Error("incorrect head block received")
}
}
func TestHeadState_CanRetrieve(t *testing.T) {
s := &pb.BeaconState{Slot: 2}
c := &Service{headState: s}
if !reflect.DeepEqual(s, c.HeadState()) {
t.Error("incorrect head state received")
}
}
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
func TestCanonicalRoot_CanRetrieve(t *testing.T) {
c := &Service{canonicalRoots: make(map[uint64][]byte)}
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
slot := uint64(123)
r := []byte{'B'}
c.canonicalRoots[slot] = r
if !bytes.Equal(r, c.CanonicalRoot(slot)) {
Part 7 of update fork choice - chain info access (#3263) * Implemented new fork choice service and helpers * Added rest of the tests * Lint * Add back helpers test * Add benchmark tests * Add yaml driven framework tests * Reformatted to doc, helpers and metrics.go * include new getter for block * create block filters from indices * give every block index a unique bucket * construct block indices by bucket mmap * almost done save for the block filters * include block filters, need a few more small touches for fetching the proper indices by bucket * full functionality to filter by parent root * tests pass when using the same logic as attestations * todo * proper todo formatting * first minimum slot range filter * slot range filters pass * more filter criteria passing * tests passing * add todos * all block tests pass and work * rem fmt * range retrieval test * fixed test conditions * Implemented new receive block methods * Comments * Remove mark evil block * instantiate the other buckets * simplify bucket lookups * deprecate non map code * revamp to remove old index prefixes * create indices from data * create indices from data * fetch block roots by slot range * better abstractions * simpler abstractions * roots rename * comment * preston feedback * Fixed existing tests * allow blocks without parent root * Cleaned up a few things * Removed todo * Lint * Cleaned up a few things * A few functions don't need to be exported * Gaz * Fixed visibility * Review feedback * Review feedback part1 * Raul's feedback, refactored OnBlock and OnAttestation to its own file * Fixed grammar * Lint * Renamed to receive_block.go * Use time.Time * Preston's feedback, removed OnTick and Store.time * Dont have to cast it to kv * add block caching layer * runlock * lockinggg * Fixed * Avoid 2 fetches of the same data * latest votes map * Gaz * Test passes * Lint * Fixed db set up * Fixed all the tests * Gazelle * Added tests * Remove todo * remove kv * Last clean up * Last clean up Last clean up * Lint * Preston's feedback * Starting * Gazelle
2019-08-21 19:50:27 +00:00
t.Errorf("Wanted head root: %v, got: %d", []byte{'A'}, c.CanonicalRoot(slot))
}
}
func TestGenesisTime_CanRetrieve(t *testing.T) {
c := &Service{}
c.genesisTime = time.Unix(100, 0)
if c.GenesisTime() != time.Unix(100, 0) {
t.Error("incorrect genesis time received")
}
}