Skip to content

Commit 5f0f585

Browse files
authored
chore: upgrade to the latest go-f3 and allow F3 chain exchange topics (filecoin-project#12893)
Upgrade to the latest go-f3 and allow F3 chain exchange topics Upgrade to the latest `go-f3` and add the F3 chain exchange topics to the allowed topic list for both static and dynamic manifests. Fixes filecoin-project/go-f3#809
1 parent 95b0378 commit 5f0f585

File tree

15 files changed

+167
-23
lines changed

15 files changed

+167
-23
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
- feat: automatically detect if the genesis is zstd compressed. ([filecoin-project/lotus#12885](https://github.com/filecoin-project/lotus/pull/12885)
1919

20+
- chore: upgrade to the latest go-f3 and allow F3 chain exchange topics ([filecoin-project/lotus#12893](https://github.com/filecoin-project/lotus/pull/12893)
21+
22+
2023
# UNRELEASED v.1.32.0
2124

2225
See https://github.com/filecoin-project/lotus/blob/release/v1.32.0/CHANGELOG.md

api/docgen-openrpc/openrpc.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import (
1313
"github.com/ipfs/go-cid"
1414
meta_schema "github.com/open-rpc/meta-schema"
1515

16+
"github.com/filecoin-project/go-f3/gpbft"
17+
1618
"github.com/filecoin-project/lotus/api/docgen"
1719
"github.com/filecoin-project/lotus/build"
1820
)
@@ -29,6 +31,40 @@ const integerD = `{
2931
"description": "Number is a number"
3032
}`
3133

34+
const f3ECChain = `{
35+
"items": {
36+
"additionalProperties": false,
37+
"properties": {
38+
"Commitments": {
39+
"items": {
40+
"description": "Number is a number",
41+
"title": "number",
42+
"type": "number"
43+
},
44+
"maxItems": 32,
45+
"minItems": 32,
46+
"type": "array"
47+
},
48+
"Epoch": {
49+
"title": "number",
50+
"type": "number"
51+
},
52+
"Key": {
53+
"media": {
54+
"binaryEncoding": "base64"
55+
},
56+
"type": "string"
57+
},
58+
"PowerTable": {
59+
"title": "Content Identifier",
60+
"type": "string"
61+
}
62+
},
63+
"type": "object"
64+
},
65+
"type": "array"
66+
}`
67+
3268
const cidCidD = `{"title": "Content Identifier", "type": "string", "description": "Cid represents a self-describing content addressed identifier. It is formed by a Version, a Codec (which indicates a multicodec-packed content type) and a Multihash."}`
3369

3470
func Generate(out io.Writer, iface, pkg string, ainfo docgen.ApiASTInfo, outGzip bool) error {
@@ -84,6 +120,7 @@ func OpenRPCSchemaTypeMapper(ty reflect.Type) *jsonschema.Type {
84120
// Use a slice instead of a map because it preserves order, as a logic safeguard/fallback.
85121
dict := []schemaDictEntry{
86122
{cid.Cid{}, cidCidD},
123+
{gpbft.ECChain{}, f3ECChain},
87124
}
88125

89126
for _, d := range dict {

api/docgen/docgen.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,13 @@ func init() {
107107

108108
f3Cert := certs.FinalityCertificate{
109109
GPBFTInstance: 0,
110-
ECChain: []gpbft.TipSet{
111-
{
112-
Epoch: 0,
113-
Key: tsk.Bytes(),
114-
PowerTable: c,
110+
ECChain: &gpbft.ECChain{
111+
TipSets: []*gpbft.TipSet{
112+
{
113+
Epoch: 0,
114+
Key: tsk.Bytes(),
115+
PowerTable: c,
116+
},
115117
},
116118
},
117119
SupplementalData: gpbft.SupplementalData{

build/genesis/butterflynet.car.zst

413 KB
Binary file not shown.

build/openrpc/full.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7588,7 +7588,9 @@
75887588
"Gpbft": {
75897589
"Delta": 0,
75907590
"DeltaBackOffExponent": 0,
7591+
"QualityDeltaMultiplier": 0,
75917592
"MaxLookaheadRounds": 0,
7593+
"ChainProposedLength": 0,
75927594
"RebroadcastBackoffBase": 0,
75937595
"RebroadcastBackoffExponent": 0,
75947596
"RebroadcastBackoffSpread": 0,
@@ -7607,6 +7609,18 @@
76077609
"ServerRequestTimeout": 0,
76087610
"MinimumPollInterval": 0,
76097611
"MaximumPollInterval": 0
7612+
},
7613+
"PubSub": {
7614+
"CompressionEnabled": false
7615+
},
7616+
"ChainExchange": {
7617+
"SubscriptionBufferSize": 0,
7618+
"MaxChainLength": 0,
7619+
"MaxInstanceLookahead": 0,
7620+
"MaxDiscoveredChainsPerInstance": 0,
7621+
"MaxWantedChainsPerInstance": 0,
7622+
"RebroadcastInterval": 0,
7623+
"MaxTimestampAge": 0
76107624
}
76117625
}
76127626
],
@@ -7642,6 +7656,40 @@
76427656
},
76437657
"type": "object"
76447658
},
7659+
"ChainExchange": {
7660+
"additionalProperties": false,
7661+
"properties": {
7662+
"MaxChainLength": {
7663+
"title": "number",
7664+
"type": "number"
7665+
},
7666+
"MaxDiscoveredChainsPerInstance": {
7667+
"title": "number",
7668+
"type": "number"
7669+
},
7670+
"MaxInstanceLookahead": {
7671+
"title": "number",
7672+
"type": "number"
7673+
},
7674+
"MaxTimestampAge": {
7675+
"title": "number",
7676+
"type": "number"
7677+
},
7678+
"MaxWantedChainsPerInstance": {
7679+
"title": "number",
7680+
"type": "number"
7681+
},
7682+
"RebroadcastInterval": {
7683+
"title": "number",
7684+
"type": "number"
7685+
},
7686+
"SubscriptionBufferSize": {
7687+
"title": "number",
7688+
"type": "number"
7689+
}
7690+
},
7691+
"type": "object"
7692+
},
76457693
"CommitteeLookback": {
76467694
"title": "number",
76477695
"type": "number"
@@ -7704,6 +7752,10 @@
77047752
"Gpbft": {
77057753
"additionalProperties": false,
77067754
"properties": {
7755+
"ChainProposedLength": {
7756+
"title": "number",
7757+
"type": "number"
7758+
},
77077759
"Delta": {
77087760
"title": "number",
77097761
"type": "number"
@@ -7715,6 +7767,9 @@
77157767
"title": "number",
77167768
"type": "number"
77177769
},
7770+
"QualityDeltaMultiplier": {
7771+
"type": "number"
7772+
},
77187773
"RebroadcastBackoffBase": {
77197774
"title": "number",
77207775
"type": "number"
@@ -7752,6 +7807,15 @@
77527807
"ProtocolVersion": {
77537808
"title": "number",
77547809
"type": "number"
7810+
},
7811+
"PubSub": {
7812+
"additionalProperties": false,
7813+
"properties": {
7814+
"CompressionEnabled": {
7815+
"type": "boolean"
7816+
}
7817+
},
7818+
"type": "object"
77557819
}
77567820
},
77577821
"type": [

chain/lf3/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ func NewManifest(
6666
MinimumPollInterval: ecPeriod,
6767
MaximumPollInterval: 4 * ecPeriod,
6868
},
69+
PubSub: manifest.DefaultPubSubConfig,
70+
ChainExchange: manifest.DefaultChainExchangeConfig,
6971
}
7072
}
7173

chain/lf3/f3.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func (fff *F3) GetLatestCert(ctx context.Context) (*certs.FinalityCertificate, e
187187
func (fff *F3) GetManifest(ctx context.Context) (*manifest.Manifest, error) {
188188
m := fff.inner.Manifest()
189189
if m == nil {
190-
return nil, xerrors.New("no known network manifest")
190+
return nil, manifest.ErrNoManifest
191191
}
192192
if m.InitialPowerTable.Defined() {
193193
return m, nil

cli/templates/f3_finality_cert.go.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ Power Table:
33
Next: {{.SupplementalData.PowerTable}}
44
Delta: {{ptDiffToString .PowerTableDelta}}
55
Finalized Chain:
6-
Length: {{ $chainLength := len .ECChain -}}{{ $chainLength }}
6+
Length: {{ $chainLength := len .ECChain.TipSets -}}{{ $chainLength }}
77
Epochs: {{ .ECChain.Base.Epoch -}}-{{ .ECChain.Head.Epoch }}
88
Chain:
99
{{- $maxTipSets := 10 -}}
1010
{{- $maxTipSetKeys := 2 -}}
11-
{{- range $i, $tipset := .ECChain -}}
11+
{{- range $i, $tipset := .ECChain.TipSets -}}
1212
{{- if lt $i $maxTipSets -}}
1313
{{- if lt (add $i 1) $chainLength }}
1414
├──

cli/templates/f3_manifest.go.tmpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Manifest:
1111

1212
GPBFT Delta: {{.Gpbft.Delta}}
1313
GPBFT Delta BackOff Exponent: {{.Gpbft.DeltaBackOffExponent}}
14+
GPBFT Quality Delta Multiplier: {{.Gpbft.QualityDeltaMultiplier}}
1415
GPBFT Max Lookahead Rounds: {{.Gpbft.MaxLookaheadRounds}}
16+
GPBFT Chain Proposed Length: {{.Gpbft.ChainProposedLength}}
1517
GPBFT Rebroadcast Backoff Base: {{.Gpbft.RebroadcastBackoffBase}}
1618
GPBFT Rebroadcast Backoff Exponent: {{.Gpbft.RebroadcastBackoffExponent}}
1719
GPBFT Rebroadcast Backoff Spread: {{.Gpbft.RebroadcastBackoffSpread}}
@@ -27,3 +29,13 @@ Manifest:
2729
Certificate Exchange Server Timeout: {{.CertificateExchange.ServerRequestTimeout}}
2830
Certificate Exchange Min Poll Interval: {{.CertificateExchange.MinimumPollInterval}}
2931
Certificate Exchange Max Poll Interval: {{.CertificateExchange.MaximumPollInterval}}
32+
33+
PubSub Compression Enabled: {{.PubSub.CompressionEnabled}}
34+
35+
Chain Exchange Subscription Buffer Size: {{.ChainExchange.SubscriptionBufferSize}}
36+
Chain Exchange Max Chain Length: {{.ChainExchange.MaxChainLength}}
37+
Chain Exchange Max Instance Lookahead: {{.ChainExchange.MaxInstanceLookahead}}
38+
Chain Exchange Max Discovered Chains Per Instance: {{.ChainExchange.MaxDiscoveredChainsPerInstance}}
39+
Chain Exchange Max Wanted Chains Per Instance: {{.ChainExchange.MaxWantedChainsPerInstance}}
40+
Chain Exchange Rebroadcast Interval: {{.ChainExchange.RebroadcastInterval}}
41+
Chain Exchange Max Timestamp Age: {{.ChainExchange.MaxTimestampAge}}

documentation/en/api-v1-unstable-methods.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,7 +2624,9 @@ Response:
26242624
"Gpbft": {
26252625
"Delta": 0,
26262626
"DeltaBackOffExponent": 0,
2627+
"QualityDeltaMultiplier": 0,
26272628
"MaxLookaheadRounds": 0,
2629+
"ChainProposedLength": 0,
26282630
"RebroadcastBackoffBase": 0,
26292631
"RebroadcastBackoffExponent": 0,
26302632
"RebroadcastBackoffSpread": 0,
@@ -2643,6 +2645,18 @@ Response:
26432645
"ServerRequestTimeout": 0,
26442646
"MinimumPollInterval": 0,
26452647
"MaximumPollInterval": 0
2648+
},
2649+
"PubSub": {
2650+
"CompressionEnabled": false
2651+
},
2652+
"ChainExchange": {
2653+
"SubscriptionBufferSize": 0,
2654+
"MaxChainLength": 0,
2655+
"MaxInstanceLookahead": 0,
2656+
"MaxDiscoveredChainsPerInstance": 0,
2657+
"MaxWantedChainsPerInstance": 0,
2658+
"RebroadcastInterval": 0,
2659+
"MaxTimestampAge": 0
26462660
}
26472661
}
26482662
```

0 commit comments

Comments
 (0)