Skip to content

Commit

Permalink
test(f3): f3 integration tests (#12486)
Browse files Browse the repository at this point in the history
Co-authored-by: Alfonso de la Rocha <adlrocha@tutamail.com>
Co-authored-by: Jakub Sztandera <oss@kubuxu.com>
  • Loading branch information
3 people committed Sep 20, 2024
1 parent 060e058 commit a30d024
Show file tree
Hide file tree
Showing 24 changed files with 1,201 additions and 537 deletions.
6 changes: 6 additions & 0 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-f3/certs"
"github.com/filecoin-project/go-f3/gpbft"
"github.com/filecoin-project/go-f3/manifest"
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
Expand Down Expand Up @@ -912,10 +913,15 @@ type FullNode interface {
F3GetCertificate(ctx context.Context, instance uint64) (*certs.FinalityCertificate, error) //perm:read
// F3GetLatestCertificate returns the latest finality certificate
F3GetLatestCertificate(ctx context.Context) (*certs.FinalityCertificate, error) //perm:read
// F3GetGetManifest returns the current manifest being used for F3
F3GetManifest(ctx context.Context) (*manifest.Manifest, error) //perm:read
// F3GetECPowerTable returns a F3 specific power table for use in standalone F3 nodes.
F3GetECPowerTable(ctx context.Context, tsk types.TipSetKey) (gpbft.PowerEntries, error) //perm:read
// F3GetF3PowerTable returns a F3 specific power table.
F3GetF3PowerTable(ctx context.Context, tsk types.TipSetKey) (gpbft.PowerEntries, error) //perm:read
// F3IsRunning returns true if the F3 instance is running, false if it's not running but
// it's enabled, and an error when disabled entirely.
F3IsRunning(ctx context.Context) (bool, error) //perm:read
}

// EthSubscriber is the reverse interface to the client, called after EthSubscribe
Expand Down
2 changes: 2 additions & 0 deletions api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-f3/certs"
"github.com/filecoin-project/go-f3/gpbft"
"github.com/filecoin-project/go-f3/manifest"
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
Expand Down Expand Up @@ -416,6 +417,7 @@ func init() {
ToHeight: epochPtr(1020),
})
addExample(&certs.FinalityCertificate{})
addExample(&manifest.Manifest{})
addExample(gpbft.ActorID(1000))
}

Expand Down
31 changes: 31 additions & 0 deletions api/mocks/mock_full.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/buildconstants/params_2k.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ var WhitelistedBlock = cid.Undef

var F3Enabled = true

const ManifestServerID = "12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG"
var F3ManifestServerID = MustParseID("12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG")

var F3BootstrapEpoch abi.ChainEpoch = 1000

Expand Down
4 changes: 3 additions & 1 deletion build/buildconstants/params_butterfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ const Eip155ChainId = 3141592
var WhitelistedBlock = cid.Undef

const F3Enabled = true
const ManifestServerID = "12D3KooWJr9jy4ngtJNR7JC1xgLFra3DjEtyxskRYWvBK9TC3Yn6"

var F3ManifestServerID = MustParseID("12D3KooWJr9jy4ngtJNR7JC1xgLFra3DjEtyxskRYWvBK9TC3Yn6")

const F3BootstrapEpoch abi.ChainEpoch = 1000

// F3Consensus set whether F3 should checkpoint tipsets finalized by F3. This
Expand Down
4 changes: 3 additions & 1 deletion build/buildconstants/params_calibnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ const Eip155ChainId = 314159
var WhitelistedBlock = cid.Undef

const F3Enabled = true
const ManifestServerID = "12D3KooWS9vD9uwm8u2uPyJV32QBAhKAmPYwmziAgr3Xzk2FU1Mr"

var F3ManifestServerID = MustParseID("12D3KooWS9vD9uwm8u2uPyJV32QBAhKAmPYwmziAgr3Xzk2FU1Mr")

const F3BootstrapEpoch abi.ChainEpoch = UpgradeWaffleHeight + 100

// F3Consensus set whether F3 should checkpoint tipsets finalized by F3. This
Expand Down
4 changes: 3 additions & 1 deletion build/buildconstants/params_interop.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ const Eip155ChainId = 3141592
var WhitelistedBlock = cid.Undef

const F3Enabled = true
const ManifestServerID = "12D3KooWQJ2rdVnG4okDUB6yHQhAjNutGNemcM7XzqC9Eo4z9Jce"

var F3ManifestServerID = MustParseID("12D3KooWQJ2rdVnG4okDUB6yHQhAjNutGNemcM7XzqC9Eo4z9Jce")

const F3BootstrapEpoch abi.ChainEpoch = 1000

// F3Consensus set whether F3 should checkpoint tipsets finalized by F3. This
Expand Down
4 changes: 3 additions & 1 deletion build/buildconstants/params_mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ const Eip155ChainId = 314
// WhitelistedBlock skips checks on message validity in this block to sidestep the zero-bls signature
var WhitelistedBlock = cid.MustParse("bafy2bzaceapyg2uyzk7vueh3xccxkuwbz3nxewjyguoxvhx77malc2lzn2ybi")

// The F3 manifest server ID, if any.
var F3ManifestServerID = MustParseID("12D3KooWENMwUF9YxvQxar7uBWJtZkA6amvK4xWmKXfSiHUo2Qq7")

const F3Enabled = true
const ManifestServerID = "12D3KooWENMwUF9YxvQxar7uBWJtZkA6amvK4xWmKXfSiHUo2Qq7"
const F3BootstrapEpoch abi.ChainEpoch = -1

// F3Consensus set whether F3 should checkpoint tipsets finalized by F3. This
Expand Down
13 changes: 7 additions & 6 deletions build/buildconstants/params_testground.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"math/big"

"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/peer"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network"
Expand Down Expand Up @@ -120,12 +121,12 @@ var (

ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a")

WhitelistedBlock = cid.Undef
BootstrappersFile = ""
GenesisFile = ""
F3Enabled = false
ManifestServerID = ""
F3BootstrapEpoch abi.ChainEpoch = -1
WhitelistedBlock = cid.Undef
BootstrappersFile = ""
GenesisFile = ""
F3Enabled = false
F3ManifestServerID peer.ID = ""
F3BootstrapEpoch abi.ChainEpoch = -1

// F3Consensus set whether F3 should checkpoint tipsets finalized by F3. This
// flag has no effect if F3 is not enabled.
Expand Down
9 changes: 9 additions & 0 deletions build/buildconstants/shared_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package buildconstants

import (
logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p/core/peer"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
Expand Down Expand Up @@ -31,3 +32,11 @@ func IsNearUpgrade(epoch, upgradeEpoch abi.ChainEpoch) bool {
}
return epoch > upgradeEpoch-policy.ChainFinality && epoch < upgradeEpoch+policy.ChainFinality
}

func MustParseID(id string) peer.ID {
p, err := peer.Decode(id)
if err != nil {
panic(err)
}
return p
}
Loading

0 comments on commit a30d024

Please sign in to comment.