mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 10:12:19 +00:00
798bbbdc82
* coldstart flags for validator * WIP beacon node flags * wip beacon chain, flag fix in validator, arg fix in validator * checkpoint * Added interop service * working on mock chainstart * save the state lol * fix tests * Save genesis validators * gaz * fix validator help flags * WaitForChainStart actually waits for genesis time * cold start fixes * cache * change back * allow for genesis state too * remove logs * increase mmap size * dont process if head doesn't exist * add 10ms tolerance * enable libp2p debug at debug, fix pubsub * works with checkpt * initialize justified and finalized in db * Removed preloadStatePath from blockchain service * Clean up * Write to disk for now post state * revert b466dd536f8eadbdae2264a545a755370223d917 * Builds * Only RPC test fails now * use minimal config, no demo config * clean up branch * Lint * resolve lint * more lint fixes * lint * fix viz * Fixing RPC test * skip before epoch 2 * RPC time out * Fixed ordering * rename * remove some dbg statements * ensure index is correct * fix some panics * getting closer * fix tests * Fix private key * Fixed RPC test * Fixed beacon chain build for docker * Add interop.go to validator go_image * Fixed docker build * handle errors * skip test, skip disconnecting peers * Fixed docker build * tolerance for attestation processing * revert copy * clearer err message parse * fix launching from dep contract
53 lines
1.4 KiB
Go
53 lines
1.4 KiB
Go
package interop
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/state"
|
|
eth "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
"github.com/prysmaticlabs/prysm/shared/trieutil"
|
|
)
|
|
|
|
func TestGenerateGenesisState(t *testing.T) {
|
|
numValidators := uint64(64)
|
|
privKeys, pubKeys, err := DeterministicallyGenerateKeys(0 /*startIndex*/, numValidators)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
depositDataItems, depositDataRoots, err := DepositDataFromKeys(privKeys, pubKeys)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
trie, err := trieutil.GenerateTrieFromItems(
|
|
depositDataRoots,
|
|
int(params.BeaconConfig().DepositContractTreeDepth),
|
|
)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
deposits, err := GenerateDepositsFromData(depositDataItems, trie)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
root := trie.Root()
|
|
genesisState, err := state.GenesisBeaconState(deposits, 0, ð.Eth1Data{
|
|
DepositRoot: root[:],
|
|
DepositCount: uint64(len(deposits)),
|
|
BlockHash: mockEth1BlockHash,
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
want := int(numValidators)
|
|
if len(genesisState.Validators) != want {
|
|
t.Errorf("Wanted %d validators, received %d", want, len(genesisState.Validators))
|
|
}
|
|
if len(genesisState.Validators) != want {
|
|
t.Errorf("Wanted %d validators, received %v", want, len(genesisState.Validators))
|
|
}
|
|
if genesisState.GenesisTime != 0 {
|
|
t.Errorf("Wanted genesis time 0, received %d", genesisState.GenesisTime)
|
|
}
|
|
}
|