Get PreCommitting to work
This commit is contained in:
parent
578bef4f83
commit
2afe725933
@ -24,22 +24,22 @@ var UpgradeIgnitionHeight = abi.ChainEpoch(-2)
|
||||
var UpgradeRefuelHeight = abi.ChainEpoch(-3)
|
||||
var UpgradeTapeHeight = abi.ChainEpoch(-4)
|
||||
|
||||
var UpgradeAssemblyHeight = abi.ChainEpoch(10)
|
||||
var UpgradeAssemblyHeight = abi.ChainEpoch(5)
|
||||
var UpgradeLiftoffHeight = abi.ChainEpoch(-5)
|
||||
|
||||
var UpgradeKumquatHeight = abi.ChainEpoch(15)
|
||||
var UpgradeCalicoHeight = abi.ChainEpoch(20)
|
||||
var UpgradePersianHeight = abi.ChainEpoch(25)
|
||||
var UpgradeOrangeHeight = abi.ChainEpoch(27)
|
||||
var UpgradeClausHeight = abi.ChainEpoch(30)
|
||||
var UpgradeKumquatHeight = abi.ChainEpoch(6)
|
||||
var UpgradeCalicoHeight = abi.ChainEpoch(7)
|
||||
var UpgradePersianHeight = abi.ChainEpoch(8)
|
||||
var UpgradeOrangeHeight = abi.ChainEpoch(9)
|
||||
var UpgradeClausHeight = abi.ChainEpoch(10)
|
||||
|
||||
var UpgradeTrustHeight = abi.ChainEpoch(35)
|
||||
var UpgradeTrustHeight = abi.ChainEpoch(11)
|
||||
|
||||
var UpgradeNorwegianHeight = abi.ChainEpoch(40)
|
||||
var UpgradeNorwegianHeight = abi.ChainEpoch(12)
|
||||
|
||||
var UpgradeTurboHeight = abi.ChainEpoch(45)
|
||||
var UpgradeTurboHeight = abi.ChainEpoch(13)
|
||||
|
||||
var UpgradeHyperdriveHeight = abi.ChainEpoch(50)
|
||||
var UpgradeHyperdriveHeight = abi.ChainEpoch(14)
|
||||
|
||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
0: DrandMainnet,
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
states2 "github.com/filecoin-project/specs-actors/v2/actors/states"
|
||||
states3 "github.com/filecoin-project/specs-actors/v3/actors/states"
|
||||
states4 "github.com/filecoin-project/specs-actors/v4/actors/states"
|
||||
states5 "github.com/filecoin-project/specs-actors/v5/actors/states"
|
||||
)
|
||||
|
||||
var log = logging.Logger("statetree")
|
||||
@ -191,6 +192,12 @@ func NewStateTree(cst cbor.IpldStore, ver types.StateTreeVersion) (*StateTree, e
|
||||
return nil, xerrors.Errorf("failed to create state tree: %w", err)
|
||||
}
|
||||
hamt = tree.Map
|
||||
case types.StateTreeVersion4:
|
||||
tree, err := states5.NewTree(store)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to create state tree: %w", err)
|
||||
}
|
||||
hamt = tree.Map
|
||||
default:
|
||||
return nil, xerrors.Errorf("unsupported state tree version: %d", ver)
|
||||
}
|
||||
@ -246,6 +253,12 @@ func LoadStateTree(cst cbor.IpldStore, c cid.Cid) (*StateTree, error) {
|
||||
if tree != nil {
|
||||
hamt = tree.Map
|
||||
}
|
||||
case types.StateTreeVersion4:
|
||||
var tree *states5.Tree
|
||||
tree, err = states5.LoadTree(store, root.Actors)
|
||||
if tree != nil {
|
||||
hamt = tree.Map
|
||||
}
|
||||
default:
|
||||
return nil, xerrors.Errorf("unsupported state tree version: %d", root.Version)
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ func upgradeActorsV5Common(
|
||||
|
||||
// Persist the result.
|
||||
newRoot, err := store.Put(ctx, &types.StateRoot{
|
||||
Version: types.StateTreeVersion3,
|
||||
Version: types.StateTreeVersion4,
|
||||
Actors: newHamtRoot,
|
||||
Info: stateRoot.Info,
|
||||
})
|
||||
|
@ -13,8 +13,10 @@ const (
|
||||
StateTreeVersion1
|
||||
// StateTreeVersion2 corresponds to actors v3.
|
||||
StateTreeVersion2
|
||||
// StateTreeVersion3 corresponds to actors >= v4.
|
||||
// StateTreeVersion3 corresponds to actors v4.
|
||||
StateTreeVersion3
|
||||
// StateTreeVersion4 corresponds to actors v5.
|
||||
StateTreeVersion4
|
||||
)
|
||||
|
||||
type StateRoot struct {
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/blockstore"
|
||||
@ -146,10 +147,36 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
ccparams, err := actors.SerializeParams(&market2.ComputeDataCommitmentParams{
|
||||
ts, err := s.delegate.ChainGetTipSet(ctx, tsk)
|
||||
if err != nil {
|
||||
return cid.Cid{}, err
|
||||
}
|
||||
|
||||
// using parent ts because the migration won't be run on the first nv13
|
||||
// tipset we apply StateCall to (because we don't run migrations in StateCall
|
||||
// and just apply to parent state)
|
||||
nv, err := s.delegate.StateNetworkVersion(ctx, ts.Parents())
|
||||
if err != nil {
|
||||
return cid.Cid{}, err
|
||||
}
|
||||
|
||||
var ccparams []byte
|
||||
if nv < network.Version13 {
|
||||
ccparams, err = actors.SerializeParams(&market2.ComputeDataCommitmentParams{
|
||||
DealIDs: deals,
|
||||
SectorType: sectorType,
|
||||
})
|
||||
} else {
|
||||
ccparams, err = actors.SerializeParams(&market5.ComputeDataCommitmentParams{
|
||||
Inputs: []*market5.SectorDataSpec{
|
||||
{
|
||||
DealIDs: deals,
|
||||
SectorType: sectorType,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("computing params for ComputeDataCommitment: %w", err)
|
||||
}
|
||||
@ -169,6 +196,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
|
||||
return cid.Undef, xerrors.Errorf("receipt for ComputeDataCommitment had exit code %d", r.MsgRct.ExitCode)
|
||||
}
|
||||
|
||||
if nv < network.Version13 {
|
||||
var c cbg.CborCid
|
||||
if err := c.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to CborCid: %w", err)
|
||||
@ -177,6 +205,18 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
|
||||
return cid.Cid(c), nil
|
||||
}
|
||||
|
||||
var cr market5.ComputeDataCommitmentReturn
|
||||
if err := cr.UnmarshalCBOR(bytes.NewReader(r.MsgRct.Return)); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal CBOR to CborCid: %w", err)
|
||||
}
|
||||
|
||||
if len(cr.CommDs) != 1 {
|
||||
return cid.Undef, xerrors.Errorf("CommD output must have 1 entry")
|
||||
}
|
||||
|
||||
return cid.Cid(cr.CommDs[0]), nil
|
||||
}
|
||||
|
||||
func (s SealingAPIAdapter) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok sealing.TipSetToken) (*miner.SectorPreCommitOnChainInfo, error) {
|
||||
tsk, err := types.TipSetKeyFromBytes(tok)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user