From 2d2b7f4beca2ac90cafaed953af8e9001b57898f Mon Sep 17 00:00:00 2001 From: lightclient Date: Fri, 5 Jan 2024 13:40:11 -0700 Subject: [PATCH] cmd/utils,beacon: fix flag typo and fix light client tests --- beacon/light/chain_test.go | 20 ++++++++++---------- cmd/utils/flags.go | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/beacon/light/chain_test.go b/beacon/light/chain_test.go index 8bee55343e..4ce2a73628 100644 --- a/beacon/light/chain_test.go +++ b/beacon/light/chain_test.go @@ -38,7 +38,7 @@ func TestStore(t *testing.T) { current = newSyncCommitteeSigner() _ = newSyncCommitteeSigner() base = store{ - config: SepoliaChainConfig, + config: params.SepoliaChainConfig, finalized: &types.Header{}, optimistic: &types.Header{}, current: current.committee(), @@ -127,12 +127,12 @@ func TestFakeStateRoot(t *testing.T) { // syncCommitteeSigner represents a SyncCommittee and allows for signing // functionality on behalf of the committee. type syncCommitteeSigner struct { - config *ChainConfig + config *params.ChainConfig members []*bls.SecretKey } func newSyncCommitteeSigner() *syncCommitteeSigner { - c := &syncCommitteeSigner{config: SepoliaChainConfig} + c := &syncCommitteeSigner{config: params.SepoliaChainConfig} for i := 0; i < params.SyncCommitteeSize; i++ { var sk bls.SecretKey if err := sk.Deserialize(rand32()); err != nil { @@ -174,7 +174,7 @@ func (c *syncCommitteeSigner) signHeader(header *types.Header, quorum float32) t // Compute aggregate signature. var ( - domain = c.config.Domain(SyncCommitteeDomain, header.Slot) + domain = c.config.Domain(params.SyncCommitteeDomain, header.Slot) root = computeSigningRoot(header.Hash(), domain) sigs = make([]*bls.Signature, count) keys = make([]*bls.Pubkey, count) @@ -240,7 +240,7 @@ func makeHeader(parent *types.Header) *types.Header { // updateGen is an interface representing different test generators. type updateGen interface { - gen(*types.Header) []*LightClientUpdate + gen(*types.Header) []*types.LightClientUpdate error() *error } @@ -255,12 +255,12 @@ type single struct { } // gen generates a single LightClientUpdate given the generation parameters. -func (u *single) gen(parent *types.Header) []*LightClientUpdate { +func (u *single) gen(parent *types.Header) []*types.LightClientUpdate { if u.header == nil { u.header = makeHeader(parent) } var ( - finalizedHeader *LightClientHeader + finalizedHeader *types.LightClientHeader finalizedBranch *merkle.Values next *types.SerializedSyncCommittee nextBranch *merkle.Values @@ -271,14 +271,14 @@ func (u *single) gen(parent *types.Header) []*LightClientUpdate { } root, fb, nb := fakeStateRoot(u.finalized.Hash(), u.next.Root()) u.header.StateRoot = root - finalizedHeader = &LightClientHeader{Header: *u.finalized} + finalizedHeader = &types.LightClientHeader{Header: *u.finalized} finalizedBranch = &fb next = u.next nextBranch = &nb } - return []*LightClientUpdate{ + return []*types.LightClientUpdate{ { - AttestedHeader: LightClientHeader{*u.header}, + AttestedHeader: types.LightClientHeader{Header: *u.header}, SyncAggregate: u.signer.signHeader(u.header, u.quorum), SignatureSlot: u.header.Slot, FinalizedHeader: finalizedHeader, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 64a9a476a6..97c7f6e22a 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -921,7 +921,7 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server. Category: flags.BeaconCategory, } BeaconTrustedBlockRootFlag = &cli.StringFlag{ - Name: "beacon.wss", + Name: "beacon.wsc", Usage: "root of trusted block within the weak-subjectivity window", Category: flags.BeaconCategory, }