-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* F3-370: integrate F3 dynamic manifest * F3-370: make linter happy * Set manifest sender identities * Decode manifest sender peer ID from string before using it Peer ID is of type string internally but the internal string representation is not the same as the encoded string representation. Therefore, the latter needs to be decoded and cannot be casted to the former. Otherwise, it will represent a different ID. * `make gen` the pain of my life --------- Co-authored-by: adlrocha <[email protected]> Co-authored-by: Masih H. Derkani <[email protected]>
- Loading branch information
1 parent
d9c24f6
commit e773b37
Showing
12 changed files
with
108 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package lf3 | ||
|
||
import ( | ||
"time" | ||
|
||
pubsub "github.com/libp2p/go-libp2p-pubsub" | ||
"github.com/libp2p/go-libp2p/core/peer" | ||
|
||
"github.com/filecoin-project/go-f3/gpbft" | ||
"github.com/filecoin-project/go-f3/manifest" | ||
|
||
"github.com/filecoin-project/lotus/build" | ||
"github.com/filecoin-project/lotus/chain/stmgr" | ||
"github.com/filecoin-project/lotus/chain/store" | ||
"github.com/filecoin-project/lotus/node/modules/dtypes" | ||
) | ||
|
||
func NewManifestProvider(nn dtypes.NetworkName, cs *store.ChainStore, sm *stmgr.StateManager, ps *pubsub.PubSub) manifest.ManifestProvider { | ||
m := manifest.LocalDevnetManifest() | ||
m.NetworkName = gpbft.NetworkName(nn) | ||
m.ECDelay = 2 * time.Duration(build.BlockDelaySecs) * time.Second | ||
m.ECPeriod = m.ECDelay | ||
m.BootstrapEpoch = int64(build.F3BootstrapEpoch) | ||
m.ECFinality = int64(build.Finality) | ||
m.CommiteeLookback = 5 | ||
|
||
ec := &ecWrapper{ | ||
ChainStore: cs, | ||
StateManager: sm, | ||
} | ||
|
||
switch manifestServerID, err := peer.Decode(build.ManifestServerID); { | ||
case err != nil: | ||
log.Warnw("Cannot decode F3 manifest sever identity; falling back on static manifest provider", "err", err) | ||
return manifest.NewStaticManifestProvider(m) | ||
default: | ||
return manifest.NewDynamicManifestProvider(m, ps, ec, manifestServerID) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters