chore: refactor: rename NewestNetworkVersion

This commit is contained in:
Aayush 2022-09-21 11:55:59 -04:00
parent 347d92b29c
commit 32670e810c
11 changed files with 23 additions and 19 deletions

View File

@ -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{

View File

@ -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 */

View File

@ -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"
@ -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
}

View File

@ -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"

View File

@ -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)
}
@ -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)
}
@ -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)
}
@ -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)
}
@ -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)
}

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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,
}},
}

View File

@ -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
}

View File

@ -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) {

View File

@ -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) {