Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow starting networks from arbitrary actor versions #6305

Merged
merged 1 commit into from
May 26, 2021

Conversation

arajasek
Copy link
Contributor

@arajasek arajasek commented May 20, 2021

Fixes #5817

Allowed me to get to height 1500 on a devnet starting from v4 actors, so I'm gonna call this a win.

@@ -24,20 +24,20 @@ var UpgradeIgnitionHeight = abi.ChainEpoch(-2)
var UpgradeRefuelHeight = abi.ChainEpoch(-3)
var UpgradeTapeHeight = abi.ChainEpoch(-4)

var UpgradeActorsV2Height = abi.ChainEpoch(10)
var UpgradeLiftoffHeight = abi.ChainEpoch(-5)
var UpgradeActorsV2Height = abi.ChainEpoch(-5)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed these thinking we could make devnets start from latest nv by default, but can undo that.

@@ -366,6 +376,45 @@ func (s *state{{.v}}) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (Secto
return fromV{{.v}}SectorPreCommitOnChainInfo(sp), nil
}

func (s *state{{.v}}) EraseAllUnproven() error {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only objectively horrible hack I had to add to make this work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least the only one that isn't super easy to remove later.

@@ -662,37 +662,6 @@ func (vm *VM) Flush(ctx context.Context) (cid.Cid, error) {
return root, nil
}

// MutateState usage: MutateState(ctx, idAddr, func(cst cbor.IpldStore, st *ActorStateType) error {...})
func (vm *VM) MutateState(ctx context.Context, addr address.Address, fn interface{}) error {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite happy that this is dead.


// TODO: Get from build
// TODO: make a list/schedule of these.
var GenesisNetworkVersion = func() network.Version {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy this is gone

@arajasek
Copy link
Contributor Author

This is against master and so has v4 actors as latest, will probably open the same against feat/nv13 to start up networks from v5.

@BigLep BigLep requested a review from magik6k May 20, 2021 18:18
Comment on lines 16 to 20
var versionImports = map[int]string{
0: "/",
2: "/v2/",
3: "/v3/",
latestVersion: "/v4/",
0: "/",
2: "/v2/",
3: "/v3/",
lotusactors.LatestVersion: "/v4/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just generate this from lotusactors.Versions? (1 less thing to do manually every time)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 38 to 63
func MakeState(store adt.Store, av actors.Version, addr address.Address) (State, error) {
switch av {
{{range .versions}}
case actors.Version{{.}}:
return make{{.}}(store, addr)
{{end}}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}

func GetActorCodeID(av actors.Version) (cid.Cid, error) {
switch av {
{{range .versions}}
case actors.Version{{.}}:
return builtin{{.}}.AccountActorCodeID, nil
{{end}}
}

return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
}

type State interface {
cbor.Marshaler

PubkeyAddress() (address.Address, error)
GetState() interface{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed tabs with spaces (use tabs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also done

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh spaces...

@magik6k magik6k enabled auto-merge May 26, 2021 08:09
@magik6k magik6k merged commit 930f2b4 into master May 26, 2021
@magik6k magik6k deleted the asr/genesis-actor branch May 26, 2021 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow starting networks from arbitrary actor versions
3 participants