Merge branch 'master' into feat/compact-sectors-numbers-cmd
This commit is contained in:
commit
f9752d8a0a
@ -54,8 +54,8 @@ func VersionForType(nodeType NodeType) (Version, error) {
|
|||||||
|
|
||||||
// semver versions of the rpc api exposed
|
// semver versions of the rpc api exposed
|
||||||
var (
|
var (
|
||||||
FullAPIVersion0 = newVer(1, 3, 0)
|
FullAPIVersion0 = newVer(1, 3, 1)
|
||||||
FullAPIVersion1 = newVer(2, 1, 0)
|
FullAPIVersion1 = newVer(2, 1, 1)
|
||||||
|
|
||||||
MinerAPIVersion0 = newVer(1, 2, 0)
|
MinerAPIVersion0 = newVer(1, 2, 0)
|
||||||
WorkerAPIVersion0 = newVer(1, 1, 0)
|
WorkerAPIVersion0 = newVer(1, 1, 0)
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -28,18 +28,19 @@ var UpgradeAssemblyHeight = abi.ChainEpoch(-5)
|
|||||||
var UpgradeLiftoffHeight = abi.ChainEpoch(-6)
|
var UpgradeLiftoffHeight = abi.ChainEpoch(-6)
|
||||||
|
|
||||||
var UpgradeKumquatHeight = abi.ChainEpoch(-7)
|
var UpgradeKumquatHeight = abi.ChainEpoch(-7)
|
||||||
var UpgradeCalicoHeight = abi.ChainEpoch(-8)
|
var UpgradePricelistOopsHeight = abi.ChainEpoch(-8)
|
||||||
var UpgradePersianHeight = abi.ChainEpoch(-9)
|
var UpgradeCalicoHeight = abi.ChainEpoch(-9)
|
||||||
var UpgradeOrangeHeight = abi.ChainEpoch(-10)
|
var UpgradePersianHeight = abi.ChainEpoch(-10)
|
||||||
var UpgradeClausHeight = abi.ChainEpoch(-11)
|
var UpgradeOrangeHeight = abi.ChainEpoch(-11)
|
||||||
|
var UpgradeClausHeight = abi.ChainEpoch(-12)
|
||||||
|
|
||||||
var UpgradeTrustHeight = abi.ChainEpoch(-12)
|
var UpgradeTrustHeight = abi.ChainEpoch(-13)
|
||||||
|
|
||||||
var UpgradeNorwegianHeight = abi.ChainEpoch(-13)
|
var UpgradeNorwegianHeight = abi.ChainEpoch(-14)
|
||||||
|
|
||||||
var UpgradeTurboHeight = abi.ChainEpoch(-14)
|
var UpgradeTurboHeight = abi.ChainEpoch(-15)
|
||||||
|
|
||||||
var UpgradeHyperdriveHeight = abi.ChainEpoch(-15)
|
var UpgradeHyperdriveHeight = abi.ChainEpoch(-16)
|
||||||
|
|
||||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||||
0: DrandMainnet,
|
0: DrandMainnet,
|
||||||
|
@ -28,6 +28,7 @@ var UpgradeAssemblyHeight = abi.ChainEpoch(30)
|
|||||||
const UpgradeTapeHeight = 60
|
const UpgradeTapeHeight = 60
|
||||||
const UpgradeLiftoffHeight = -5
|
const UpgradeLiftoffHeight = -5
|
||||||
const UpgradeKumquatHeight = 90
|
const UpgradeKumquatHeight = 90
|
||||||
|
const UpgradePricelistOopsHeight = 119
|
||||||
const UpgradeCalicoHeight = 120
|
const UpgradeCalicoHeight = 120
|
||||||
const UpgradePersianHeight = 150
|
const UpgradePersianHeight = 150
|
||||||
const UpgradeClausHeight = 180
|
const UpgradeClausHeight = 180
|
||||||
|
@ -33,6 +33,8 @@ const UpgradeLiftoffHeight = -5
|
|||||||
|
|
||||||
const UpgradeKumquatHeight = 90
|
const UpgradeKumquatHeight = 90
|
||||||
|
|
||||||
|
const UpgradePricelistOopsHeight = 119
|
||||||
|
|
||||||
const UpgradeCalicoHeight = 120
|
const UpgradeCalicoHeight = 120
|
||||||
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 1)
|
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 1)
|
||||||
|
|
||||||
|
@ -31,18 +31,19 @@ var UpgradeAssemblyHeight = abi.ChainEpoch(-5)
|
|||||||
var UpgradeLiftoffHeight = abi.ChainEpoch(-6)
|
var UpgradeLiftoffHeight = abi.ChainEpoch(-6)
|
||||||
|
|
||||||
var UpgradeKumquatHeight = abi.ChainEpoch(-7)
|
var UpgradeKumquatHeight = abi.ChainEpoch(-7)
|
||||||
var UpgradeCalicoHeight = abi.ChainEpoch(-8)
|
var UpgradePricelistOopsHeight = abi.ChainEpoch(-8)
|
||||||
var UpgradePersianHeight = abi.ChainEpoch(-9)
|
var UpgradeCalicoHeight = abi.ChainEpoch(-9)
|
||||||
var UpgradeOrangeHeight = abi.ChainEpoch(-10)
|
var UpgradePersianHeight = abi.ChainEpoch(-10)
|
||||||
var UpgradeClausHeight = abi.ChainEpoch(-11)
|
var UpgradeOrangeHeight = abi.ChainEpoch(-11)
|
||||||
|
var UpgradeClausHeight = abi.ChainEpoch(-12)
|
||||||
|
|
||||||
var UpgradeTrustHeight = abi.ChainEpoch(-12)
|
var UpgradeTrustHeight = abi.ChainEpoch(-13)
|
||||||
|
|
||||||
var UpgradeNorwegianHeight = abi.ChainEpoch(-13)
|
var UpgradeNorwegianHeight = abi.ChainEpoch(-14)
|
||||||
|
|
||||||
var UpgradeTurboHeight = abi.ChainEpoch(-14)
|
var UpgradeTurboHeight = abi.ChainEpoch(-15)
|
||||||
|
|
||||||
var UpgradeHyperdriveHeight = abi.ChainEpoch(-15)
|
var UpgradeHyperdriveHeight = abi.ChainEpoch(-16)
|
||||||
|
|
||||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||||
0: DrandMainnet,
|
0: DrandMainnet,
|
||||||
|
@ -45,6 +45,7 @@ const UpgradeLiftoffHeight = 148888
|
|||||||
|
|
||||||
const UpgradeKumquatHeight = 170000
|
const UpgradeKumquatHeight = 170000
|
||||||
|
|
||||||
|
const UpgradePricelistOopsHeight = 265199
|
||||||
const UpgradeCalicoHeight = 265200
|
const UpgradeCalicoHeight = 265200
|
||||||
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 60)
|
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 60)
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ const UpgradeTapeHeight = 60
|
|||||||
|
|
||||||
const UpgradeKumquatHeight = 90
|
const UpgradeKumquatHeight = 90
|
||||||
|
|
||||||
|
const UpgradePricelistOopsHeight = 99
|
||||||
const UpgradeCalicoHeight = 100
|
const UpgradeCalicoHeight = 100
|
||||||
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 1)
|
const UpgradePersianHeight = UpgradeCalicoHeight + (builtin2.EpochsInHour * 1)
|
||||||
|
|
||||||
|
@ -89,14 +89,15 @@ var (
|
|||||||
UpgradeAssemblyHeight abi.ChainEpoch = 10
|
UpgradeAssemblyHeight abi.ChainEpoch = 10
|
||||||
UpgradeLiftoffHeight abi.ChainEpoch = -5
|
UpgradeLiftoffHeight abi.ChainEpoch = -5
|
||||||
UpgradeKumquatHeight abi.ChainEpoch = -6
|
UpgradeKumquatHeight abi.ChainEpoch = -6
|
||||||
UpgradeCalicoHeight abi.ChainEpoch = -7
|
UpgradePricelistOopsHeight abi.ChainEpoch = -7
|
||||||
UpgradePersianHeight abi.ChainEpoch = -8
|
UpgradeCalicoHeight abi.ChainEpoch = -8
|
||||||
UpgradeOrangeHeight abi.ChainEpoch = -9
|
UpgradePersianHeight abi.ChainEpoch = -9
|
||||||
UpgradeClausHeight abi.ChainEpoch = -10
|
UpgradeOrangeHeight abi.ChainEpoch = -10
|
||||||
UpgradeTrustHeight abi.ChainEpoch = -11
|
UpgradeClausHeight abi.ChainEpoch = -11
|
||||||
UpgradeNorwegianHeight abi.ChainEpoch = -12
|
UpgradeTrustHeight abi.ChainEpoch = -12
|
||||||
UpgradeTurboHeight abi.ChainEpoch = -13
|
UpgradeNorwegianHeight abi.ChainEpoch = -13
|
||||||
UpgradeHyperdriveHeight abi.ChainEpoch = -13
|
UpgradeTurboHeight abi.ChainEpoch = -14
|
||||||
|
UpgradeHyperdriveHeight abi.ChainEpoch = -15
|
||||||
|
|
||||||
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||||
0: DrandMainnet,
|
0: DrandMainnet,
|
||||||
|
@ -25,7 +25,7 @@ func VersionForNetwork(version network.Version) Version {
|
|||||||
switch version {
|
switch version {
|
||||||
case network.Version0, network.Version1, network.Version2, network.Version3:
|
case network.Version0, network.Version1, network.Version2, network.Version3:
|
||||||
return Version0
|
return Version0
|
||||||
case network.Version4, network.Version5, network.Version6, network.Version7, network.Version8, network.Version9:
|
case network.Version4, network.Version5, network.Version6, network.Version6AndAHalf, network.Version7, network.Version8, network.Version9:
|
||||||
return Version2
|
return Version2
|
||||||
case network.Version10, network.Version11:
|
case network.Version10, network.Version11:
|
||||||
return Version3
|
return Version3
|
||||||
|
@ -11,7 +11,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/chain/vm"
|
"github.com/filecoin-project/lotus/chain/vm"
|
||||||
)
|
)
|
||||||
@ -259,8 +258,14 @@ func (mp *MessagePool) checkMessages(ctx context.Context, msgs []*types.Message,
|
|||||||
Code: api.CheckStatusMessageValidity,
|
Code: api.CheckStatusMessageValidity,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
nv, err := mp.getNtwkVersion(epoch)
|
||||||
if err := m.ValidForBlockInclusion(0, build.NewestNetworkVersion); err != nil {
|
if err != nil {
|
||||||
|
check.OK = false
|
||||||
|
check.Err = fmt.Sprintf("error retrieving network version: %s", err.Error())
|
||||||
|
} else {
|
||||||
|
check.OK = true
|
||||||
|
}
|
||||||
|
if err := m.ValidForBlockInclusion(0, nv); err != nil {
|
||||||
check.OK = false
|
check.OK = false
|
||||||
check.Err = fmt.Sprintf("syntactically invalid message: %s", err.Error())
|
check.Err = fmt.Sprintf("syntactically invalid message: %s", err.Error())
|
||||||
} else {
|
} else {
|
||||||
@ -276,7 +281,7 @@ func (mp *MessagePool) checkMessages(ctx context.Context, msgs []*types.Message,
|
|||||||
// gas checks
|
// gas checks
|
||||||
|
|
||||||
// 4. Min Gas
|
// 4. Min Gas
|
||||||
minGas := vm.PricelistByEpoch(epoch).OnChainMessage(m.ChainLength())
|
minGas := vm.PricelistByVersion(nv).OnChainMessage(m.ChainLength())
|
||||||
|
|
||||||
check = api.MessageCheckStatus{
|
check = api.MessageCheckStatus{
|
||||||
Cid: m.Cid(),
|
Cid: m.Cid(),
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
"github.com/hashicorp/go-multierror"
|
"github.com/hashicorp/go-multierror"
|
||||||
lru "github.com/hashicorp/golang-lru"
|
lru "github.com/hashicorp/golang-lru"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -29,6 +30,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
"github.com/filecoin-project/lotus/chain/store"
|
"github.com/filecoin-project/lotus/chain/store"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/chain/vm"
|
"github.com/filecoin-project/lotus/chain/vm"
|
||||||
@ -147,6 +149,8 @@ type MessagePool struct {
|
|||||||
|
|
||||||
minGasPrice types.BigInt
|
minGasPrice types.BigInt
|
||||||
|
|
||||||
|
getNtwkVersion func(abi.ChainEpoch) (network.Version, error)
|
||||||
|
|
||||||
currentSize int
|
currentSize int
|
||||||
|
|
||||||
// pruneTrigger is a channel used to trigger a mempool pruning
|
// pruneTrigger is a channel used to trigger a mempool pruning
|
||||||
@ -362,6 +366,7 @@ func New(api Provider, ds dtypes.MetadataDS, netName dtypes.NetworkName, j journ
|
|||||||
if j == nil {
|
if j == nil {
|
||||||
j = journal.NilJournal()
|
j = journal.NilJournal()
|
||||||
}
|
}
|
||||||
|
us := stmgr.DefaultUpgradeSchedule()
|
||||||
|
|
||||||
mp := &MessagePool{
|
mp := &MessagePool{
|
||||||
ds: ds,
|
ds: ds,
|
||||||
@ -373,6 +378,7 @@ func New(api Provider, ds dtypes.MetadataDS, netName dtypes.NetworkName, j journ
|
|||||||
pending: make(map[address.Address]*msgSet),
|
pending: make(map[address.Address]*msgSet),
|
||||||
keyCache: make(map[address.Address]address.Address),
|
keyCache: make(map[address.Address]address.Address),
|
||||||
minGasPrice: types.NewInt(0),
|
minGasPrice: types.NewInt(0),
|
||||||
|
getNtwkVersion: us.GetNtwkVersion,
|
||||||
pruneTrigger: make(chan struct{}, 1),
|
pruneTrigger: make(chan struct{}, 1),
|
||||||
pruneCooldown: make(chan struct{}, 1),
|
pruneCooldown: make(chan struct{}, 1),
|
||||||
blsSigCache: cache,
|
blsSigCache: cache,
|
||||||
@ -610,8 +616,7 @@ func (mp *MessagePool) addLocal(ctx context.Context, m *types.SignedMessage) err
|
|||||||
// For non local messages, if the message cannot be included in the next 20 blocks it returns
|
// For non local messages, if the message cannot be included in the next 20 blocks it returns
|
||||||
// a (soft) validation error.
|
// a (soft) validation error.
|
||||||
func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.TipSet, local bool) (bool, error) {
|
func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.TipSet, local bool) (bool, error) {
|
||||||
epoch := curTs.Height()
|
minGas := vm.PricelistByVersion(build.NewestNetworkVersion).OnChainMessage(m.ChainLength())
|
||||||
minGas := vm.PricelistByEpoch(epoch).OnChainMessage(m.ChainLength())
|
|
||||||
|
|
||||||
if err := m.VMMessage().ValidForBlockInclusion(minGas.Total(), build.NewestNetworkVersion); err != nil {
|
if err := m.VMMessage().ValidForBlockInclusion(minGas.Total(), build.NewestNetworkVersion); err != nil {
|
||||||
return false, xerrors.Errorf("message will not be included in a block: %w", err)
|
return false, xerrors.Errorf("message will not be included in a block: %w", err)
|
||||||
|
@ -287,7 +287,7 @@ func TestCheckMessageBig(t *testing.T) {
|
|||||||
From: from,
|
From: from,
|
||||||
Value: types.NewInt(1),
|
Value: types.NewInt(1),
|
||||||
Nonce: 0,
|
Nonce: 0,
|
||||||
GasLimit: 50000000,
|
GasLimit: 60000000,
|
||||||
GasFeeCap: types.NewInt(100),
|
GasFeeCap: types.NewInt(100),
|
||||||
GasPremium: types.NewInt(1),
|
GasPremium: types.NewInt(1),
|
||||||
Params: make([]byte, 41<<10), // 41KiB payload
|
Params: make([]byte, 41<<10), // 41KiB payload
|
||||||
|
@ -749,7 +749,7 @@ func (mp *MessagePool) createMessageChains(actor address.Address, mset map[uint6
|
|||||||
}
|
}
|
||||||
curNonce++
|
curNonce++
|
||||||
|
|
||||||
minGas := vm.PricelistByEpoch(ts.Height()).OnChainMessage(m.ChainLength()).Total()
|
minGas := vm.PricelistByVersion(build.NewestNetworkVersion).OnChainMessage(m.ChainLength()).Total()
|
||||||
if m.Message.GasLimit < minGas {
|
if m.Message.GasLimit < minGas {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,10 @@ func DefaultUpgradeSchedule() UpgradeSchedule {
|
|||||||
Height: build.UpgradeKumquatHeight,
|
Height: build.UpgradeKumquatHeight,
|
||||||
Network: network.Version6,
|
Network: network.Version6,
|
||||||
Migration: nil,
|
Migration: nil,
|
||||||
|
}, {
|
||||||
|
Height: build.UpgradePricelistOopsHeight,
|
||||||
|
Network: network.Version6AndAHalf,
|
||||||
|
Migration: nil,
|
||||||
}, {
|
}, {
|
||||||
Height: build.UpgradeCalicoHeight,
|
Height: build.UpgradeCalicoHeight,
|
||||||
Network: network.Version7,
|
Network: network.Version7,
|
||||||
@ -292,6 +296,18 @@ func (us UpgradeSchedule) Validate() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (us UpgradeSchedule) GetNtwkVersion(e abi.ChainEpoch) (network.Version, error) {
|
||||||
|
// Traverse from newest to oldest returning upgrade active during epoch e
|
||||||
|
for i := len(us) - 1; i >= 0; i-- {
|
||||||
|
u := us[i]
|
||||||
|
// u.Height is the last epoch before u.Network becomes the active version
|
||||||
|
if u.Height < e {
|
||||||
|
return u.Network, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return network.Version0, xerrors.Errorf("Epoch %d has no defined network version", e)
|
||||||
|
}
|
||||||
|
|
||||||
func (sm *StateManager) handleStateForks(ctx context.Context, root cid.Cid, height abi.ChainEpoch, cb ExecMonitor, ts *types.TipSet) (cid.Cid, error) {
|
func (sm *StateManager) handleStateForks(ctx context.Context, root cid.Cid, height abi.ChainEpoch, cb ExecMonitor, ts *types.TipSet) (cid.Cid, error) {
|
||||||
retCid := root
|
retCid := root
|
||||||
var err error
|
var err error
|
||||||
|
@ -17,6 +17,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
|
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
|
||||||
@ -121,7 +122,7 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
|
|
||||||
sm, err := NewStateManagerWithUpgradeSchedule(
|
sm, err := NewStateManagerWithUpgradeSchedule(
|
||||||
cg.ChainStore(), UpgradeSchedule{{
|
cg.ChainStore(), UpgradeSchedule{{
|
||||||
Network: 1,
|
Network: network.Version1,
|
||||||
Height: testForkHeight,
|
Height: testForkHeight,
|
||||||
Migration: func(ctx context.Context, sm *StateManager, cache MigrationCache, cb ExecMonitor,
|
Migration: func(ctx context.Context, sm *StateManager, cache MigrationCache, cb ExecMonitor,
|
||||||
root cid.Cid, height abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
|
root cid.Cid, height abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
|
||||||
@ -250,7 +251,7 @@ func TestForkRefuseCall(t *testing.T) {
|
|||||||
|
|
||||||
sm, err := NewStateManagerWithUpgradeSchedule(
|
sm, err := NewStateManagerWithUpgradeSchedule(
|
||||||
cg.ChainStore(), UpgradeSchedule{{
|
cg.ChainStore(), UpgradeSchedule{{
|
||||||
Network: 1,
|
Network: network.Version1,
|
||||||
Expensive: true,
|
Expensive: true,
|
||||||
Height: testForkHeight,
|
Height: testForkHeight,
|
||||||
Migration: func(ctx context.Context, sm *StateManager, cache MigrationCache, cb ExecMonitor,
|
Migration: func(ctx context.Context, sm *StateManager, cache MigrationCache, cb ExecMonitor,
|
||||||
@ -365,7 +366,7 @@ func TestForkPreMigration(t *testing.T) {
|
|||||||
|
|
||||||
sm, err := NewStateManagerWithUpgradeSchedule(
|
sm, err := NewStateManagerWithUpgradeSchedule(
|
||||||
cg.ChainStore(), UpgradeSchedule{{
|
cg.ChainStore(), UpgradeSchedule{{
|
||||||
Network: 1,
|
Network: network.Version1,
|
||||||
Height: testForkHeight,
|
Height: testForkHeight,
|
||||||
Migration: func(ctx context.Context, sm *StateManager, cache MigrationCache, cb ExecMonitor,
|
Migration: func(ctx context.Context, sm *StateManager, cache MigrationCache, cb ExecMonitor,
|
||||||
root cid.Cid, height abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
|
root cid.Cid, height abi.ChainEpoch, ts *types.TipSet) (cid.Cid, error) {
|
||||||
|
@ -1054,14 +1054,15 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
|
|||||||
return xerrors.Errorf("failed to load base state tree: %w", err)
|
return xerrors.Errorf("failed to load base state tree: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pl := vm.PricelistByEpoch(baseTs.Height())
|
nv := syncer.sm.GetNtwkVersion(ctx, b.Header.Height)
|
||||||
|
pl := vm.PricelistByVersion(nv)
|
||||||
var sumGasLimit int64
|
var sumGasLimit int64
|
||||||
checkMsg := func(msg types.ChainMsg) error {
|
checkMsg := func(msg types.ChainMsg) error {
|
||||||
m := msg.VMMessage()
|
m := msg.VMMessage()
|
||||||
|
|
||||||
// Phase 1: syntactic validation, as defined in the spec
|
// Phase 1: syntactic validation, as defined in the spec
|
||||||
minGas := pl.OnChainMessage(msg.ChainLength())
|
minGas := pl.OnChainMessage(msg.ChainLength())
|
||||||
if err := m.ValidForBlockInclusion(minGas.Total(), syncer.sm.GetNtwkVersion(ctx, b.Header.Height)); err != nil {
|
if err := m.ValidForBlockInclusion(minGas.Total(), nv); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1075,7 +1076,7 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
|
|||||||
// Phase 2: (Partial) semantic validation:
|
// Phase 2: (Partial) semantic validation:
|
||||||
// the sender exists and is an account actor, and the nonces make sense
|
// the sender exists and is an account actor, and the nonces make sense
|
||||||
var sender address.Address
|
var sender address.Address
|
||||||
if syncer.sm.GetNtwkVersion(ctx, b.Header.Height) >= network.Version13 {
|
if nv >= network.Version13 {
|
||||||
sender, err = st.LookupID(m.From)
|
sender, err = st.LookupID(m.From)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -3,12 +3,11 @@ package vm
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
addr "github.com/filecoin-project/go-address"
|
addr "github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
vmr5 "github.com/filecoin-project/specs-actors/v5/actors/runtime"
|
vmr5 "github.com/filecoin-project/specs-actors/v5/actors/runtime"
|
||||||
proof5 "github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
|
proof5 "github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -80,8 +79,8 @@ type Pricelist interface {
|
|||||||
OnVerifyConsensusFault() GasCharge
|
OnVerifyConsensusFault() GasCharge
|
||||||
}
|
}
|
||||||
|
|
||||||
var prices = map[abi.ChainEpoch]Pricelist{
|
var prices = map[network.Version]Pricelist{
|
||||||
abi.ChainEpoch(0): &pricelistV0{
|
network.Version0: &pricelistV0{
|
||||||
computeGasMulti: 1,
|
computeGasMulti: 1,
|
||||||
storageGasMulti: 1000,
|
storageGasMulti: 1000,
|
||||||
|
|
||||||
@ -130,7 +129,7 @@ var prices = map[abi.ChainEpoch]Pricelist{
|
|||||||
verifyPostDiscount: true,
|
verifyPostDiscount: true,
|
||||||
verifyConsensusFault: 495422,
|
verifyConsensusFault: 495422,
|
||||||
},
|
},
|
||||||
abi.ChainEpoch(build.UpgradeCalicoHeight): &pricelistV0{
|
network.Version6AndAHalf: &pricelistV0{
|
||||||
computeGasMulti: 1,
|
computeGasMulti: 1,
|
||||||
storageGasMulti: 1300,
|
storageGasMulti: 1300,
|
||||||
|
|
||||||
@ -208,21 +207,19 @@ var prices = map[abi.ChainEpoch]Pricelist{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// PricelistByEpoch finds the latest prices for the given epoch
|
// PricelistByVersion finds the latest prices for the given network version
|
||||||
func PricelistByEpoch(epoch abi.ChainEpoch) Pricelist {
|
func PricelistByVersion(version network.Version) Pricelist {
|
||||||
// since we are storing the prices as map or epoch to price
|
bestVersion := network.Version0
|
||||||
// we need to get the price with the highest epoch that is lower or equal to the `epoch` arg
|
bestPrice := prices[bestVersion]
|
||||||
bestEpoch := abi.ChainEpoch(0)
|
for nv, pl := range prices {
|
||||||
bestPrice := prices[bestEpoch]
|
// if `nv > bestVersion` and `nv <= version`
|
||||||
for e, pl := range prices {
|
if nv > bestVersion && nv <= version {
|
||||||
// if `e` happened after `bestEpoch` and `e` is earlier or equal to the target `epoch`
|
bestVersion = nv
|
||||||
if e > bestEpoch && e <= epoch {
|
|
||||||
bestEpoch = e
|
|
||||||
bestPrice = pl
|
bestPrice = pl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if bestPrice == nil {
|
if bestPrice == nil {
|
||||||
panic(fmt.Sprintf("bad setup: no gas prices available for epoch %d", epoch))
|
panic(fmt.Sprintf("bad setup: no gas prices available for version %d", version))
|
||||||
}
|
}
|
||||||
return bestPrice
|
return bestPrice
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ var EmptyObjectCid cid.Cid
|
|||||||
|
|
||||||
// TryCreateAccountActor creates account actors from only BLS/SECP256K1 addresses.
|
// TryCreateAccountActor creates account actors from only BLS/SECP256K1 addresses.
|
||||||
func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, address.Address, aerrors.ActorError) {
|
func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, address.Address, aerrors.ActorError) {
|
||||||
if err := rt.chargeGasSafe(PricelistByEpoch(rt.height).OnCreateActor()); err != nil {
|
if err := rt.chargeGasSafe(PricelistByVersion(rt.NetworkVersion()).OnCreateActor()); err != nil {
|
||||||
return nil, address.Undef, err
|
return nil, address.Undef, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, parent *Runti
|
|||||||
gasAvailable: msg.GasLimit,
|
gasAvailable: msg.GasLimit,
|
||||||
depth: 0,
|
depth: 0,
|
||||||
numActorsCreated: 0,
|
numActorsCreated: 0,
|
||||||
pricelist: PricelistByEpoch(vm.blockHeight),
|
pricelist: PricelistByVersion(vm.ntwkVersion(ctx, vm.blockHeight)),
|
||||||
allowInternal: true,
|
allowInternal: true,
|
||||||
callerValidated: false,
|
callerValidated: false,
|
||||||
executionTrace: types.ExecutionTrace{Msg: msg},
|
executionTrace: types.ExecutionTrace{Msg: msg},
|
||||||
@ -424,7 +424,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
pl := PricelistByEpoch(vm.blockHeight)
|
pl := PricelistByVersion(vm.ntwkVersion(ctx, vm.blockHeight))
|
||||||
|
|
||||||
msgGas := pl.OnChainMessage(cmsg.ChainLength())
|
msgGas := pl.OnChainMessage(cmsg.ChainLength())
|
||||||
msgGasCost := msgGas.Total()
|
msgGasCost := msgGas.Total()
|
||||||
|
@ -199,7 +199,7 @@ Response:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"Version": "string value",
|
"Version": "string value",
|
||||||
"APIVersion": 131328,
|
"APIVersion": 131329,
|
||||||
"BlockDelay": 42
|
"BlockDelay": 42
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -144,7 +144,7 @@ Perms: admin
|
|||||||
|
|
||||||
Inputs: `null`
|
Inputs: `null`
|
||||||
|
|
||||||
Response: `131328`
|
Response: `131329`
|
||||||
|
|
||||||
## Add
|
## Add
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ Response:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"Version": "string value",
|
"Version": "string value",
|
||||||
"APIVersion": 131328,
|
"APIVersion": 131329,
|
||||||
"BlockDelay": 42
|
"BlockDelay": 42
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -4634,7 +4634,7 @@ Inputs:
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
Response: `13`
|
Response: `1300`
|
||||||
|
|
||||||
### StateReadState
|
### StateReadState
|
||||||
StateReadState returns the indicated actor's state.
|
StateReadState returns the indicated actor's state.
|
||||||
|
@ -282,7 +282,7 @@ Response:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"Version": "string value",
|
"Version": "string value",
|
||||||
"APIVersion": 131328,
|
"APIVersion": 131329,
|
||||||
"BlockDelay": 42
|
"BlockDelay": 42
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -4855,7 +4855,7 @@ Inputs:
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
Response: `13`
|
Response: `1300`
|
||||||
|
|
||||||
### StateReadState
|
### StateReadState
|
||||||
StateReadState returns the indicated actor's state.
|
StateReadState returns the indicated actor's state.
|
||||||
|
4
go.mod
4
go.mod
@ -40,7 +40,7 @@ require (
|
|||||||
github.com/filecoin-project/go-multistore v0.0.3
|
github.com/filecoin-project/go-multistore v0.0.3
|
||||||
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20
|
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20210614165157-25a6c7769498
|
github.com/filecoin-project/go-paramfetch v0.0.2-0.20210614165157-25a6c7769498
|
||||||
github.com/filecoin-project/go-state-types v0.1.1-0.20210506134452-99b279731c48
|
github.com/filecoin-project/go-state-types v0.1.1-0.20210722133031-ad9bfe54c124
|
||||||
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe
|
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe
|
||||||
github.com/filecoin-project/go-statestore v0.1.1
|
github.com/filecoin-project/go-statestore v0.1.1
|
||||||
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b
|
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b
|
||||||
@ -48,7 +48,7 @@ require (
|
|||||||
github.com/filecoin-project/specs-actors/v2 v2.3.5
|
github.com/filecoin-project/specs-actors/v2 v2.3.5
|
||||||
github.com/filecoin-project/specs-actors/v3 v3.1.1
|
github.com/filecoin-project/specs-actors/v3 v3.1.1
|
||||||
github.com/filecoin-project/specs-actors/v4 v4.0.1
|
github.com/filecoin-project/specs-actors/v4 v4.0.1
|
||||||
github.com/filecoin-project/specs-actors/v5 v5.0.1
|
github.com/filecoin-project/specs-actors/v5 v5.0.2
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506
|
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506
|
||||||
github.com/filecoin-project/test-vectors/schema v0.0.5
|
github.com/filecoin-project/test-vectors/schema v0.0.5
|
||||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
||||||
|
7
go.sum
7
go.sum
@ -305,8 +305,9 @@ github.com/filecoin-project/go-state-types v0.0.0-20200904021452-1883f36ca2f4/go
|
|||||||
github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||||
github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||||
github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||||
github.com/filecoin-project/go-state-types v0.1.1-0.20210506134452-99b279731c48 h1:Jc4OprDp3bRDxbsrXNHPwJabZJM3iDy+ri8/1e0ZnX4=
|
|
||||||
github.com/filecoin-project/go-state-types v0.1.1-0.20210506134452-99b279731c48/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
github.com/filecoin-project/go-state-types v0.1.1-0.20210506134452-99b279731c48/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||||
|
github.com/filecoin-project/go-state-types v0.1.1-0.20210722133031-ad9bfe54c124 h1:veGrNABg/9I7prngrowkhwbvW5d5JN55MNKmbsr5FqA=
|
||||||
|
github.com/filecoin-project/go-state-types v0.1.1-0.20210722133031-ad9bfe54c124/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g=
|
||||||
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe h1:dF8u+LEWeIcTcfUcCf3WFVlc81Fr2JKg8zPzIbBDKDw=
|
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe h1:dF8u+LEWeIcTcfUcCf3WFVlc81Fr2JKg8zPzIbBDKDw=
|
||||||
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
|
||||||
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
|
github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZOinUJB4WARkRfNl10O7kTnI=
|
||||||
@ -331,8 +332,8 @@ github.com/filecoin-project/specs-actors/v4 v4.0.0/go.mod h1:TkHXf/l7Wyw4ZejyXIP
|
|||||||
github.com/filecoin-project/specs-actors/v4 v4.0.1 h1:AiWrtvJZ63MHGe6rn7tPu4nSUY8bA1KDNszqJaD5+Fg=
|
github.com/filecoin-project/specs-actors/v4 v4.0.1 h1:AiWrtvJZ63MHGe6rn7tPu4nSUY8bA1KDNszqJaD5+Fg=
|
||||||
github.com/filecoin-project/specs-actors/v4 v4.0.1/go.mod h1:TkHXf/l7Wyw4ZejyXIPS2rK8bBO0rdwhTZyQQgaglng=
|
github.com/filecoin-project/specs-actors/v4 v4.0.1/go.mod h1:TkHXf/l7Wyw4ZejyXIPS2rK8bBO0rdwhTZyQQgaglng=
|
||||||
github.com/filecoin-project/specs-actors/v5 v5.0.0-20210512015452-4fe3889fff57/go.mod h1:283yBMMUSDB2abcjP/hhrwTkhb9h3sfM6KGrep/ZlBI=
|
github.com/filecoin-project/specs-actors/v5 v5.0.0-20210512015452-4fe3889fff57/go.mod h1:283yBMMUSDB2abcjP/hhrwTkhb9h3sfM6KGrep/ZlBI=
|
||||||
github.com/filecoin-project/specs-actors/v5 v5.0.1 h1:PrYm5AKdMlJ/55eRW5laWcnaX66gyyDYBWvH38kNAMo=
|
github.com/filecoin-project/specs-actors/v5 v5.0.2 h1:pLNFUt9xtFuhrgZZ0tPnzGchAVu4koyCRIopzkx/OP0=
|
||||||
github.com/filecoin-project/specs-actors/v5 v5.0.1/go.mod h1:74euMDIXorusOBs/QL/LNkYsXZdDpLJwojWw6T03pdE=
|
github.com/filecoin-project/specs-actors/v5 v5.0.2/go.mod h1:E0yeEl6Scl6eWeeWmxwQsAufvOAC72H6ELyh2Y62H90=
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw=
|
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw=
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506/go.mod h1:nJRRM7Aa9XVvygr3W9k6xGF46RWzr2zxF/iGoAIfA/g=
|
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506/go.mod h1:nJRRM7Aa9XVvygr3W9k6xGF46RWzr2zxF/iGoAIfA/g=
|
||||||
github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg=
|
github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg=
|
||||||
|
Loading…
Reference in New Issue
Block a user