Skip to content

Commit

Permalink
chore: refactor: rename NewestNetworkVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Sep 21, 2022
1 parent 882c00b commit f23065a
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func init() {
addExample(&textSelExample)
addExample(&apiSelExample)
addExample(network.ReachabilityPublic)
addExample(build.NewestNetworkVersion)
addExample(build.TestNetworkVersion)
addExample(map[string]int{"name": 42})
addExample(map[string]time.Time{"name": time.Unix(1615243938, 0).UTC()})
addExample(&types.ExecutionTrace{
Expand Down
6 changes: 3 additions & 3 deletions build/params_shared_vals.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ const UnixfsLinksPerLevel = 1024

const AllowableClockDriftSecs = uint64(1)

// TODO: This is still terrible...What's the impact of updating this before mainnet actually upgrades
// Used by tests and some obscure tooling
/* inline-gen template
const NewestNetworkVersion = network.Version{{.latestNetworkVersion}}
const TestNetworkVersion = network.Version{{.latestNetworkVersion}}
/* inline-gen start */

const NewestNetworkVersion = network.Version17
const TestNetworkVersion = network.Version17

/* inline-gen end */

Expand Down
6 changes: 6 additions & 0 deletions chain/messagepool/messagepool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"

"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/consensus/filcns"
"github.com/filecoin-project/lotus/chain/messagepool/gasguess"
"github.com/filecoin-project/lotus/chain/types"
Expand Down Expand Up @@ -166,6 +168,10 @@ func (tma *testMpoolAPI) StateAccountKeyAtFinality(ctx context.Context, addr add
return addr, nil
}

func (tma *testMpoolAPI) StateNetworkVersion(ctx context.Context, h abi.ChainEpoch) network.Version {
return build.TestNetworkVersion
}

func (tma *testMpoolAPI) MessagesForBlock(ctx context.Context, h *types.BlockHeader) ([]*types.Message, []*types.SignedMessage, error) {
return nil, tma.bmsgs[h.Cid()], nil
}
Expand Down
6 changes: 2 additions & 4 deletions chain/messagepool/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import (
"context"
"time"

"github.com/filecoin-project/go-state-types/abi"

"github.com/filecoin-project/go-state-types/network"

"github.com/ipfs/go-cid"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"golang.org/x/xerrors"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network"

"github.com/filecoin-project/lotus/chain/messagesigner"
"github.com/filecoin-project/lotus/chain/stmgr"
Expand Down
10 changes: 5 additions & 5 deletions chain/state/statetree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func BenchmarkStateTreeSet(b *testing.B) {
func BenchmarkStateTreeSetFlush(b *testing.B) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001
cst := cbor.NewMemCborStore()
sv, err := VersionForNetwork(build.NewestNetworkVersion)
sv, err := VersionForNetwork(build.TestNetworkVersion)
if err != nil {
b.Fatal(err)
}
Expand Down Expand Up @@ -85,7 +85,7 @@ func TestResolveCache(t *testing.T) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
//stm: @CHAIN_STATETREE_SNAPSHOT_001, @CHAIN_STATETREE_SNAPSHOT_CLEAR_001
cst := cbor.NewMemCborStore()
sv, err := VersionForNetwork(build.NewestNetworkVersion)
sv, err := VersionForNetwork(build.TestNetworkVersion)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -189,7 +189,7 @@ func BenchmarkStateTree10kGetActor(b *testing.B) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
//stm: @CHAIN_STATETREE_FLUSH_001
cst := cbor.NewMemCborStore()
sv, err := VersionForNetwork(build.NewestNetworkVersion)
sv, err := VersionForNetwork(build.TestNetworkVersion)
if err != nil {
b.Fatal(err)
}
Expand Down Expand Up @@ -237,7 +237,7 @@ func BenchmarkStateTree10kGetActor(b *testing.B) {
func TestSetCache(t *testing.T) {
//stm: @CHAIN_STATETREE_SET_ACTOR_001, @CHAIN_STATETREE_GET_ACTOR_001, @CHAIN_STATETREE_VERSION_FOR_NETWORK_001
cst := cbor.NewMemCborStore()
sv, err := VersionForNetwork(build.NewestNetworkVersion)
sv, err := VersionForNetwork(build.TestNetworkVersion)
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -282,7 +282,7 @@ func TestSnapshots(t *testing.T) {
ctx := context.Background()
cst := cbor.NewMemCborStore()

sv, err := VersionForNetwork(build.NewestNetworkVersion)
sv, err := VersionForNetwork(build.TestNetworkVersion)
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus-bench/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ func bps(sectorSize abi.SectorSize, sectorNum int, d time.Duration) string {
}

func spt(ssize abi.SectorSize) abi.RegisteredSealProof {
spt, err := miner.SealProofTypeFromSectorSize(ssize, build.NewestNetworkVersion)
spt, err := miner.SealProofTypeFromSectorSize(ssize, build.TestNetworkVersion)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus-seed/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ var genesisSetActorVersionCmd = &cli.Command{
}

nv := network.Version(cctx.Int("network-version"))
if nv > build.NewestNetworkVersion {
if nv > build.TestNetworkVersion {
return xerrors.Errorf("invalid network version: %d", nv)
}

Expand Down
2 changes: 1 addition & 1 deletion itests/kit/ensemble_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var DefaultEnsembleOpts = ensembleOpts{
pastOffset: 10000000 * time.Second, // time sufficiently in the past to trigger catch-up mining.
upgradeSchedule: stmgr.UpgradeSchedule{{
Height: -1,
Network: build.NewestNetworkVersion,
Network: build.TestNetworkVersion,
}},
}

Expand Down
4 changes: 2 additions & 2 deletions lotuspond/spawn.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (api *api) Spawn() (nodeInfo, error) {
}

sbroot := filepath.Join(dir, "preseal")
spt, err := miner.SealProofTypeFromSectorSize(2<<10, build.NewestNetworkVersion)
spt, err := miner.SealProofTypeFromSectorSize(2<<10, build.TestNetworkVersion)
if err != nil {
return nodeInfo{}, err
}
Expand Down Expand Up @@ -78,7 +78,7 @@ func (api *api) Spawn() (nodeInfo, error) {
template.VerifregRootKey = gen.DefaultVerifregRootkeyActor
template.RemainderAccount = gen.DefaultRemainderAccountActor
template.NetworkName = "pond-" + uuid.New().String()
template.NetworkVersion = build.NewestNetworkVersion
template.NetworkVersion = build.TestNetworkVersion

tb, err := json.Marshal(&template)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion paychmgr/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,5 @@ func (pchapi *mockPaychAPI) addSigningKey(key []byte) {
}

func (pchapi *mockPaychAPI) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
return build.NewestNetworkVersion, nil
return build.TestNetworkVersion, nil
}
2 changes: 1 addition & 1 deletion storage/pipeline/precommit_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func fakeConfigGetter(stub *fakeConfigStub) dtypes.GetSealingConfigFunc {
}

func (f *fakeChain) StateNetworkVersion(ctx context.Context, tsk types.TipSetKey) (network.Version, error) {
return build.NewestNetworkVersion, nil
return build.TestNetworkVersion, nil
}

func (f *fakeChain) ChainHead(ctx context.Context) (*types.TipSet, error) {
Expand Down
2 changes: 1 addition & 1 deletion storage/wdpost/wdpost_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (m *mockStorageMinerAPI) StateMinerInfo(ctx context.Context, a address.Addr
}

func (m *mockStorageMinerAPI) StateNetworkVersion(ctx context.Context, key types.TipSetKey) (network.Version, error) {
return build.NewestNetworkVersion, nil
return build.TestNetworkVersion, nil
}

func (m *mockStorageMinerAPI) StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) {
Expand Down

0 comments on commit f23065a

Please sign in to comment.