Skip to content

Commit

Permalink
feat(f3): display the initial power table CID in the F3 manifest (#12626
Browse files Browse the repository at this point in the history
)

Also, add it to the manifest if not already set.
  • Loading branch information
Stebalien authored Oct 22, 2024
1 parent 38e4d91 commit bc8c29b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
16 changes: 14 additions & 2 deletions chain/lf3/f3.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,20 @@ func (fff *F3) GetLatestCert(ctx context.Context) (*certs.FinalityCertificate, e
return fff.inner.GetLatestCert(ctx)
}

func (fff *F3) GetManifest() *manifest.Manifest {
return fff.inner.Manifest()
func (fff *F3) GetManifest(ctx context.Context) *manifest.Manifest {
m := fff.inner.Manifest()
if m.InitialPowerTable.Defined() {
return m
}
cert0, err := fff.inner.GetCert(ctx, 0)
if err != nil {
return m
}

var mCopy = *m
m = &mCopy
m.InitialPowerTable = cert0.ECChain.Base().PowerTable
return m
}

func (fff *F3) GetPowerTable(ctx context.Context, tsk types.TipSetKey) (gpbft.PowerEntries, error) {
Expand Down
7 changes: 4 additions & 3 deletions cli/f3.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,14 @@ func prettyPrintManifest(out io.Writer, manifest *manifest.Manifest) error {
Protocol Version: {{.ProtocolVersion}}
Paused: {{.Pause}}
Initial Instance: {{.InitialInstance}}
Initial Power Table: {{if .InitialPowerTable.Defined}}{{.InitialPowerTable}}{{else}}unknown{{end}}
Bootstrap Epoch: {{.BootstrapEpoch}}
Network Name: {{.NetworkName}}
Ignore EC Power: {{.IgnoreECPower}}
Committee Lookback: {{.CommitteeLookback}}
Catch Up Alignment: {{.CatchUpAlignment}}
GPBFT Delta: {{.Gpbft.Delta}}
GPBFT Delta: {{.Gpbft.Delta}}
GPBFT Delta BackOff Exponent: {{.Gpbft.DeltaBackOffExponent}}
GPBFT Max Lookahead Rounds: {{.Gpbft.MaxLookaheadRounds}}
GPBFT Rebroadcast Backoff Base: {{.Gpbft.RebroadcastBackoffBase}}
Expand All @@ -171,8 +172,8 @@ func prettyPrintManifest(out io.Writer, manifest *manifest.Manifest) error {
EC Head Lookback: {{.EC.HeadLookback}}
EC Finalize: {{.EC.Finalize}}
Certificate Exchange Client Timeout: {{.CertificateExchange.ClientRequestTimeout}}
Certificate Exchange Server Timeout: {{.CertificateExchange.ServerRequestTimeout}}
Certificate Exchange Client Timeout: {{.CertificateExchange.ClientRequestTimeout}}
Certificate Exchange Server Timeout: {{.CertificateExchange.ServerRequestTimeout}}
Certificate Exchange Min Poll Interval: {{.CertificateExchange.MinimumPollInterval}}
Certificate Exchange Max Poll Interval: {{.CertificateExchange.MaximumPollInterval}}
`
Expand Down
4 changes: 2 additions & 2 deletions node/impl/full/f3.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ func (f3api *F3API) F3GetLatestCertificate(ctx context.Context) (*certs.Finality
return f3api.F3.GetLatestCert(ctx)
}

func (f3api *F3API) F3GetManifest(context.Context) (*manifest.Manifest, error) {
func (f3api *F3API) F3GetManifest(ctx context.Context) (*manifest.Manifest, error) {
if f3api.F3 == nil {
return nil, api.ErrF3Disabled
}
return f3api.F3.GetManifest(), nil
return f3api.F3.GetManifest(ctx), nil
}

func (f3api *F3API) F3IsRunning(context.Context) (bool, error) {
Expand Down

0 comments on commit bc8c29b

Please sign in to comment.