Skip to content

Commit

Permalink
Introduce v5 actors
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed May 10, 2021
1 parent 63189cd commit b5da265
Show file tree
Hide file tree
Showing 51 changed files with 1,922 additions and 111 deletions.
9 changes: 7 additions & 2 deletions api/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ var TwoFull = DefaultFullOpts(2)

var FullNodeWithLatestActorsAt = func(upgradeHeight abi.ChainEpoch) FullNodeOpts {
if upgradeHeight == -1 {
upgradeHeight = 3
// Attention: Update this when introducing new actor versions or your tests will be sad
upgradeHeight = 4
}

return FullNodeOpts{
Expand All @@ -138,8 +139,12 @@ var FullNodeWithLatestActorsAt = func(upgradeHeight abi.ChainEpoch) FullNodeOpts
Migration: stmgr.UpgradeActorsV3,
}, {
Network: network.Version12,
Height: upgradeHeight,
Height: 3,
Migration: stmgr.UpgradeActorsV4,
}, {
Network: network.Version13,
Height: upgradeHeight,
Migration: stmgr.UpgradeActorsV5,
}})
},
}
Expand Down
Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/miner.json.gz
Binary file not shown.
Binary file modified build/openrpc/worker.json.gz
Binary file not shown.
15 changes: 9 additions & 6 deletions build/params_2k.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var UpgradeIgnitionHeight = abi.ChainEpoch(-2)
var UpgradeRefuelHeight = abi.ChainEpoch(-3)
var UpgradeTapeHeight = abi.ChainEpoch(-4)

var UpgradeActorsV2Height = abi.ChainEpoch(10)
var UpgradeAssemblyHeight = abi.ChainEpoch(10)
var UpgradeLiftoffHeight = abi.ChainEpoch(-5)

var UpgradeKumquatHeight = abi.ChainEpoch(15)
Expand All @@ -33,11 +33,13 @@ var UpgradePersianHeight = abi.ChainEpoch(25)
var UpgradeOrangeHeight = abi.ChainEpoch(27)
var UpgradeClausHeight = abi.ChainEpoch(30)

var UpgradeActorsV3Height = abi.ChainEpoch(35)
var UpgradeTrustHeight = abi.ChainEpoch(35)

var UpgradeNorwegianHeight = abi.ChainEpoch(40)

var UpgradeActorsV4Height = abi.ChainEpoch(45)
var UpgradeTurboHeight = abi.ChainEpoch(45)

var UpgradeHyperdriveHeight = abi.ChainEpoch(50)

var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
Expand Down Expand Up @@ -68,16 +70,17 @@ func init() {
UpgradeIgnitionHeight = getUpgradeHeight("LOTUS_IGNITION_HEIGHT", UpgradeIgnitionHeight)
UpgradeRefuelHeight = getUpgradeHeight("LOTUS_REFUEL_HEIGHT", UpgradeRefuelHeight)
UpgradeTapeHeight = getUpgradeHeight("LOTUS_TAPE_HEIGHT", UpgradeTapeHeight)
UpgradeActorsV2Height = getUpgradeHeight("LOTUS_ACTORSV2_HEIGHT", UpgradeActorsV2Height)
UpgradeAssemblyHeight = getUpgradeHeight("LOTUS_ACTORSV2_HEIGHT", UpgradeAssemblyHeight)
UpgradeLiftoffHeight = getUpgradeHeight("LOTUS_LIFTOFF_HEIGHT", UpgradeLiftoffHeight)
UpgradeKumquatHeight = getUpgradeHeight("LOTUS_KUMQUAT_HEIGHT", UpgradeKumquatHeight)
UpgradeCalicoHeight = getUpgradeHeight("LOTUS_CALICO_HEIGHT", UpgradeCalicoHeight)
UpgradePersianHeight = getUpgradeHeight("LOTUS_PERSIAN_HEIGHT", UpgradePersianHeight)
UpgradeOrangeHeight = getUpgradeHeight("LOTUS_ORANGE_HEIGHT", UpgradeOrangeHeight)
UpgradeClausHeight = getUpgradeHeight("LOTUS_CLAUS_HEIGHT", UpgradeClausHeight)
UpgradeActorsV3Height = getUpgradeHeight("LOTUS_ACTORSV3_HEIGHT", UpgradeActorsV3Height)
UpgradeTrustHeight = getUpgradeHeight("LOTUS_ACTORSV3_HEIGHT", UpgradeTrustHeight)
UpgradeNorwegianHeight = getUpgradeHeight("LOTUS_NORWEGIAN_HEIGHT", UpgradeNorwegianHeight)
UpgradeActorsV4Height = getUpgradeHeight("LOTUS_ACTORSV4_HEIGHT", UpgradeActorsV4Height)
UpgradeTurboHeight = getUpgradeHeight("LOTUS_ACTORSV4_HEIGHT", UpgradeTurboHeight)
UpgradeHyperdriveHeight = getUpgradeHeight("LOTUS_HYPERDRIVE_HEIGHT", UpgradeHyperdriveHeight)

BuildType |= Build2k
}
Expand Down
9 changes: 5 additions & 4 deletions build/params_butterfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const UpgradeSmokeHeight = -2
const UpgradeIgnitionHeight = -3
const UpgradeRefuelHeight = -4

var UpgradeActorsV2Height = abi.ChainEpoch(30)
var UpgradeAssemblyHeight = abi.ChainEpoch(30)

const UpgradeTapeHeight = 60
const UpgradeLiftoffHeight = -5
Expand All @@ -32,9 +32,10 @@ const UpgradeCalicoHeight = 120
const UpgradePersianHeight = 150
const UpgradeClausHeight = 180
const UpgradeOrangeHeight = 210
const UpgradeActorsV3Height = 240
const UpgradeNorwegianHeight = UpgradeActorsV3Height + (builtin2.EpochsInHour * 12)
const UpgradeActorsV4Height = 8922
const UpgradeTrustHeight = 240
const UpgradeNorwegianHeight = UpgradeTrustHeight + (builtin2.EpochsInHour * 12)
const UpgradeTurboHeight = 8922
const UpgradeHyperdriveHeight = 9999999

func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2 << 30))
Expand Down
8 changes: 5 additions & 3 deletions build/params_calibnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const UpgradeSmokeHeight = -2
const UpgradeIgnitionHeight = -3
const UpgradeRefuelHeight = -4

var UpgradeActorsV2Height = abi.ChainEpoch(30)
var UpgradeAssemblyHeight = abi.ChainEpoch(30)

const UpgradeTapeHeight = 60

Expand All @@ -40,10 +40,12 @@ const UpgradeClausHeight = 250

const UpgradeOrangeHeight = 300

const UpgradeActorsV3Height = 600
const UpgradeTrustHeight = 600
const UpgradeNorwegianHeight = 114000

const UpgradeActorsV4Height = 193789
const UpgradeTurboHeight = 193789

const UpgradeHyperdriveHeight = 9999999

func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(32 << 30))
Expand Down
17 changes: 8 additions & 9 deletions build/params_mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const UpgradeSmokeHeight = 51000
const UpgradeIgnitionHeight = 94000
const UpgradeRefuelHeight = 130800

const UpgradeActorsV2Height = 138720
const UpgradeAssemblyHeight = 138720

const UpgradeTapeHeight = 140760

Expand All @@ -54,13 +54,16 @@ const UpgradeOrangeHeight = 336458
const UpgradeClausHeight = 343200

// 2021-03-04T00:00:30Z
var UpgradeActorsV3Height = abi.ChainEpoch(550321)
const UpgradeTrustHeight = 550321

// 2021-04-12T22:00:00Z
const UpgradeNorwegianHeight = 665280

// 2021-04-29T06:00:00Z
var UpgradeActorsV4Height = abi.ChainEpoch(712320)
const UpgradeTurboHeight = 712320

// ???
var UpgradeHyperdriveHeight = abi.ChainEpoch(9999999)

func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 40))
Expand All @@ -69,12 +72,8 @@ func init() {
SetAddressNetwork(address.Mainnet)
}

if os.Getenv("LOTUS_DISABLE_V3_ACTOR_MIGRATION") == "1" {
UpgradeActorsV3Height = math.MaxInt64
}

if os.Getenv("LOTUS_DISABLE_V4_ACTOR_MIGRATION") == "1" {
UpgradeActorsV4Height = math.MaxInt64
if os.Getenv("LOTUS_DISABLE_HYPERDRIVE") == "1" {
UpgradeHyperdriveHeight = math.MaxInt64
}

Devnet = false
Expand Down
7 changes: 4 additions & 3 deletions build/params_nerpanet.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const UpgradeRefuelHeight = -3

const UpgradeLiftoffHeight = -5

const UpgradeActorsV2Height = 30 // critical: the network can bootstrap from v1 only
const UpgradeAssemblyHeight = 30 // critical: the network can bootstrap from v1 only
const UpgradeTapeHeight = 60

const UpgradeKumquatHeight = 90
Expand All @@ -39,9 +39,10 @@ const UpgradeClausHeight = 250

const UpgradeOrangeHeight = 300

const UpgradeActorsV3Height = 600
const UpgradeTrustHeight = 600
const UpgradeNorwegianHeight = 999999
const UpgradeActorsV4Height = 99999999
const UpgradeTurboHeight = 99999999
const UpgradeHyperdriveHeight = 999999999

func init() {
// Minimum block production power is set to 4 TiB
Expand Down
2 changes: 1 addition & 1 deletion build/params_shared_vals.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const UnixfsLinksPerLevel = 1024
// Consensus / Network

const AllowableClockDriftSecs = uint64(1)
const NewestNetworkVersion = network.Version11
const NewestNetworkVersion = network.Version13
const ActorUpgradeNetworkVersion = network.Version4

// Epochs
Expand Down
29 changes: 15 additions & 14 deletions build/params_testground.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,21 @@ var (
UpgradeBreezeHeight abi.ChainEpoch = -1
BreezeGasTampingDuration abi.ChainEpoch = 0

UpgradeSmokeHeight abi.ChainEpoch = -1
UpgradeIgnitionHeight abi.ChainEpoch = -2
UpgradeRefuelHeight abi.ChainEpoch = -3
UpgradeTapeHeight abi.ChainEpoch = -4
UpgradeActorsV2Height abi.ChainEpoch = 10
UpgradeLiftoffHeight abi.ChainEpoch = -5
UpgradeKumquatHeight abi.ChainEpoch = -6
UpgradeCalicoHeight abi.ChainEpoch = -7
UpgradePersianHeight abi.ChainEpoch = -8
UpgradeOrangeHeight abi.ChainEpoch = -9
UpgradeClausHeight abi.ChainEpoch = -10
UpgradeActorsV3Height abi.ChainEpoch = -11
UpgradeNorwegianHeight abi.ChainEpoch = -12
UpgradeActorsV4Height abi.ChainEpoch = -13
UpgradeSmokeHeight abi.ChainEpoch = -1
UpgradeIgnitionHeight abi.ChainEpoch = -2
UpgradeRefuelHeight abi.ChainEpoch = -3
UpgradeTapeHeight abi.ChainEpoch = -4
UpgradeAssemblyHeight abi.ChainEpoch = 10
UpgradeLiftoffHeight abi.ChainEpoch = -5
UpgradeKumquatHeight abi.ChainEpoch = -6
UpgradeCalicoHeight abi.ChainEpoch = -7
UpgradePersianHeight abi.ChainEpoch = -8
UpgradeOrangeHeight abi.ChainEpoch = -9
UpgradeClausHeight abi.ChainEpoch = -10
UpgradeTrustHeight abi.ChainEpoch = -11
UpgradeNorwegianHeight abi.ChainEpoch = -12
UpgradeTurboHeight abi.ChainEpoch = -13
UpgradeHyperdriveHeight abi.ChainEpoch = -13

DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
Expand Down
7 changes: 4 additions & 3 deletions chain/actors/agen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import (
"golang.org/x/xerrors"
)

var latestVersion = 4
var latestVersion = 5

var versions = []int{0, 2, 3, latestVersion}
var versions = []int{0, 2, 3, 4, latestVersion}

var versionImports = map[int]string{
0: "/",
2: "/v2/",
3: "/v3/",
latestVersion: "/v4/",
4: "/v4/",
latestVersion: "/v5/",
}

var actors = map[string][]int{
Expand Down
9 changes: 9 additions & 0 deletions chain/actors/builtin/account/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"

builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"

builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
)

func init() {
Expand All @@ -37,6 +39,10 @@ func init() {
builtin.RegisterActorState(builtin4.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load4(store, root)
})

builtin.RegisterActorState(builtin5.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
return load5(store, root)
})
}

var Methods = builtin4.MethodsAccount
Expand All @@ -56,6 +62,9 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
case builtin4.AccountActorCodeID:
return load4(store, act.Head)

case builtin5.AccountActorCodeID:
return load5(store, act.Head)

}
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
Expand Down
30 changes: 30 additions & 0 deletions chain/actors/builtin/account/v5.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package account

import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"

"github.com/filecoin-project/lotus/chain/actors/adt"

account5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/account"
)

var _ State = (*state5)(nil)

func load5(store adt.Store, root cid.Cid) (State, error) {
out := state5{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}

type state5 struct {
account5.State
store adt.Store
}

func (s *state5) PubkeyAddress() (address.Address, error) {
return s.Address, nil
}
Loading

0 comments on commit b5da265

Please sign in to comment.