mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
588dea83b7
* test coverage and updates to config twiddlers * LoadChainConfigFile error if SetActive conflicts * lint * wip working around test issues * more fixes, mass test updates * lint * linting * thanks deepsource! * fix undeclared vars * fixing more undefined * fix a bug, make a bug, repeat * gaz * use stock mainnet in case fork schedule matters * remove unused KnownConfigs * post-merge cleanup * eliminating OverrideBeaconConfig outside tests * more cleanup of OverrideBeaconConfig outside tests * config for interop w/ genesis gen support * improve var name * API on package instead of exported value * cleanup remainders of "registry" naming * Nishant feedback * add ropstein to configset * lint * lint #2 * ✂️ * revert accidental commented line * check if active is nil (replace called on empty) * Nishant feedback * replace OverrideBeaconConfig call * update interop instructions w/ new flag * don't let interop replace config set via cli flags Co-authored-by: kasey <kasey@users.noreply.github.com>
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
package kv
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state/genesis"
|
|
"github.com/prysmaticlabs/prysm/config/params"
|
|
"github.com/prysmaticlabs/prysm/consensus-types/wrapper"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
"github.com/prysmaticlabs/prysm/testing/util"
|
|
)
|
|
|
|
func TestSaveOrigin(t *testing.T) {
|
|
params.SetupTestConfigCleanup(t)
|
|
// Embedded Genesis works with Mainnet config
|
|
params.OverrideBeaconConfig(params.MainnetConfig().Copy())
|
|
|
|
ctx := context.Background()
|
|
db := setupDB(t)
|
|
|
|
st, err := genesis.State(params.MainnetName)
|
|
require.NoError(t, err)
|
|
|
|
sb, err := st.MarshalSSZ()
|
|
require.NoError(t, err)
|
|
require.NoError(t, db.LoadGenesis(ctx, sb))
|
|
|
|
// this is necessary for mainnet, because LoadGenesis is short-circuited by the embedded state,
|
|
// so the genesis root key is never written to the db.
|
|
require.NoError(t, db.EnsureEmbeddedGenesis(ctx))
|
|
|
|
cst, err := util.NewBeaconState()
|
|
require.NoError(t, err)
|
|
csb, err := cst.MarshalSSZ()
|
|
require.NoError(t, err)
|
|
cb := util.NewBeaconBlock()
|
|
scb, err := wrapper.WrappedSignedBeaconBlock(cb)
|
|
require.NoError(t, err)
|
|
cbb, err := scb.MarshalSSZ()
|
|
require.NoError(t, err)
|
|
require.NoError(t, db.SaveOrigin(ctx, csb, cbb))
|
|
|
|
broot, err := scb.Block().HashTreeRoot()
|
|
require.NoError(t, err)
|
|
require.Equal(t, true, db.IsFinalizedBlock(ctx, broot))
|
|
}
|