mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/utils,beacon: fix flag typo and fix light client tests
This commit is contained in:
parent
70e2451c57
commit
2d2b7f4bec
2 changed files with 11 additions and 11 deletions
|
|
@ -38,7 +38,7 @@ func TestStore(t *testing.T) {
|
||||||
current = newSyncCommitteeSigner()
|
current = newSyncCommitteeSigner()
|
||||||
_ = newSyncCommitteeSigner()
|
_ = newSyncCommitteeSigner()
|
||||||
base = store{
|
base = store{
|
||||||
config: SepoliaChainConfig,
|
config: params.SepoliaChainConfig,
|
||||||
finalized: &types.Header{},
|
finalized: &types.Header{},
|
||||||
optimistic: &types.Header{},
|
optimistic: &types.Header{},
|
||||||
current: current.committee(),
|
current: current.committee(),
|
||||||
|
|
@ -127,12 +127,12 @@ func TestFakeStateRoot(t *testing.T) {
|
||||||
// syncCommitteeSigner represents a SyncCommittee and allows for signing
|
// syncCommitteeSigner represents a SyncCommittee and allows for signing
|
||||||
// functionality on behalf of the committee.
|
// functionality on behalf of the committee.
|
||||||
type syncCommitteeSigner struct {
|
type syncCommitteeSigner struct {
|
||||||
config *ChainConfig
|
config *params.ChainConfig
|
||||||
members []*bls.SecretKey
|
members []*bls.SecretKey
|
||||||
}
|
}
|
||||||
|
|
||||||
func newSyncCommitteeSigner() *syncCommitteeSigner {
|
func newSyncCommitteeSigner() *syncCommitteeSigner {
|
||||||
c := &syncCommitteeSigner{config: SepoliaChainConfig}
|
c := &syncCommitteeSigner{config: params.SepoliaChainConfig}
|
||||||
for i := 0; i < params.SyncCommitteeSize; i++ {
|
for i := 0; i < params.SyncCommitteeSize; i++ {
|
||||||
var sk bls.SecretKey
|
var sk bls.SecretKey
|
||||||
if err := sk.Deserialize(rand32()); err != nil {
|
if err := sk.Deserialize(rand32()); err != nil {
|
||||||
|
|
@ -174,7 +174,7 @@ func (c *syncCommitteeSigner) signHeader(header *types.Header, quorum float32) t
|
||||||
|
|
||||||
// Compute aggregate signature.
|
// Compute aggregate signature.
|
||||||
var (
|
var (
|
||||||
domain = c.config.Domain(SyncCommitteeDomain, header.Slot)
|
domain = c.config.Domain(params.SyncCommitteeDomain, header.Slot)
|
||||||
root = computeSigningRoot(header.Hash(), domain)
|
root = computeSigningRoot(header.Hash(), domain)
|
||||||
sigs = make([]*bls.Signature, count)
|
sigs = make([]*bls.Signature, count)
|
||||||
keys = make([]*bls.Pubkey, 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.
|
// updateGen is an interface representing different test generators.
|
||||||
type updateGen interface {
|
type updateGen interface {
|
||||||
gen(*types.Header) []*LightClientUpdate
|
gen(*types.Header) []*types.LightClientUpdate
|
||||||
error() *error
|
error() *error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,12 +255,12 @@ type single struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// gen generates a single LightClientUpdate given the generation parameters.
|
// 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 {
|
if u.header == nil {
|
||||||
u.header = makeHeader(parent)
|
u.header = makeHeader(parent)
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
finalizedHeader *LightClientHeader
|
finalizedHeader *types.LightClientHeader
|
||||||
finalizedBranch *merkle.Values
|
finalizedBranch *merkle.Values
|
||||||
next *types.SerializedSyncCommittee
|
next *types.SerializedSyncCommittee
|
||||||
nextBranch *merkle.Values
|
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())
|
root, fb, nb := fakeStateRoot(u.finalized.Hash(), u.next.Root())
|
||||||
u.header.StateRoot = root
|
u.header.StateRoot = root
|
||||||
finalizedHeader = &LightClientHeader{Header: *u.finalized}
|
finalizedHeader = &types.LightClientHeader{Header: *u.finalized}
|
||||||
finalizedBranch = &fb
|
finalizedBranch = &fb
|
||||||
next = u.next
|
next = u.next
|
||||||
nextBranch = &nb
|
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),
|
SyncAggregate: u.signer.signHeader(u.header, u.quorum),
|
||||||
SignatureSlot: u.header.Slot,
|
SignatureSlot: u.header.Slot,
|
||||||
FinalizedHeader: finalizedHeader,
|
FinalizedHeader: finalizedHeader,
|
||||||
|
|
|
||||||
|
|
@ -921,7 +921,7 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server.
|
||||||
Category: flags.BeaconCategory,
|
Category: flags.BeaconCategory,
|
||||||
}
|
}
|
||||||
BeaconTrustedBlockRootFlag = &cli.StringFlag{
|
BeaconTrustedBlockRootFlag = &cli.StringFlag{
|
||||||
Name: "beacon.wss",
|
Name: "beacon.wsc",
|
||||||
Usage: "root of trusted block within the weak-subjectivity window",
|
Usage: "root of trusted block within the weak-subjectivity window",
|
||||||
Category: flags.BeaconCategory,
|
Category: flags.BeaconCategory,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue