Use actor state addresses
This commit is contained in:
parent
819180f739
commit
a876a0ba44
@ -7,6 +7,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/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
|
||||||
@ -65,6 +66,12 @@ type DealProposals interface {
|
|||||||
decode(*cbg.Deferred) (*DealProposal, error)
|
decode(*cbg.Deferred) (*DealProposal, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PublishStorageDealsParams = market0.PublishStorageDealsParams
|
||||||
|
type PublishStorageDealsReturn = market0.PublishStorageDealsReturn
|
||||||
|
type VerifyDealsForActivationParams = market0.VerifyDealsForActivationParams
|
||||||
|
|
||||||
|
type ClientDealProposal = market0.ClientDealProposal
|
||||||
|
|
||||||
type DealState struct {
|
type DealState struct {
|
||||||
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
|
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
|
||||||
LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated
|
LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated
|
||||||
|
@ -6,6 +6,12 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
|
||||||
|
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -19,7 +25,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||||
@ -109,7 +114,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
}
|
}
|
||||||
|
|
||||||
params := mustEnc(constructorParams)
|
params := mustEnc(constructorParams)
|
||||||
rval, err := doExecValue(ctx, vm, builtin.StoragePowerActorAddr, m.Owner, m.PowerBalance, builtin.MethodsPower.CreateMiner, params)
|
rval, err := doExecValue(ctx, vm, power.Address, m.Owner, m.PowerBalance, builtin.MethodsPower.CreateMiner, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, xerrors.Errorf("failed to create genesis miner: %w", err)
|
return cid.Undef, xerrors.Errorf("failed to create genesis miner: %w", err)
|
||||||
}
|
}
|
||||||
@ -141,7 +146,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
|
|
||||||
if m.MarketBalance.GreaterThan(big.Zero()) {
|
if m.MarketBalance.GreaterThan(big.Zero()) {
|
||||||
params := mustEnc(&minerInfos[i].maddr)
|
params := mustEnc(&minerInfos[i].maddr)
|
||||||
_, err := doExecValue(ctx, vm, builtin.StorageMarketActorAddr, m.Worker, m.MarketBalance, builtin.MethodsMarket.AddBalance, params)
|
_, err := doExecValue(ctx, vm, market.Address, m.Worker, m.MarketBalance, builtin.MethodsMarket.AddBalance, params)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, xerrors.Errorf("failed to create genesis miner (add balance): %w", err)
|
return cid.Undef, xerrors.Errorf("failed to create genesis miner (add balance): %w", err)
|
||||||
}
|
}
|
||||||
@ -153,7 +158,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
publish := func(params *market.PublishStorageDealsParams) error {
|
publish := func(params *market.PublishStorageDealsParams) error {
|
||||||
fmt.Printf("publishing %d storage deals on miner %s with worker %s\n", len(params.Deals), params.Deals[0].Proposal.Provider, m.Worker)
|
fmt.Printf("publishing %d storage deals on miner %s with worker %s\n", len(params.Deals), params.Deals[0].Proposal.Provider, m.Worker)
|
||||||
|
|
||||||
ret, err := doExecValue(ctx, vm, builtin.StorageMarketActorAddr, m.Worker, big.Zero(), builtin.MethodsMarket.PublishStorageDeals, mustEnc(params))
|
ret, err := doExecValue(ctx, vm, market.Address, m.Worker, big.Zero(), builtin.MethodsMarket.PublishStorageDeals, mustEnc(params))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to create genesis miner (publish deals): %w", err)
|
return xerrors.Errorf("failed to create genesis miner (publish deals): %w", err)
|
||||||
}
|
}
|
||||||
@ -210,7 +215,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power0.State) error {
|
err = vm.MutateState(ctx, power.Address, func(cst cbor.IpldStore, st *power0.State) error {
|
||||||
st.TotalQualityAdjPower = qaPow
|
st.TotalQualityAdjPower = qaPow
|
||||||
st.TotalRawBytePower = rawPow
|
st.TotalRawBytePower = rawPow
|
||||||
|
|
||||||
@ -222,7 +227,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
return cid.Undef, xerrors.Errorf("mutating state: %w", err)
|
return cid.Undef, xerrors.Errorf("mutating state: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = vm.MutateState(ctx, builtin.RewardActorAddr, func(sct cbor.IpldStore, st *reward0.State) error {
|
err = vm.MutateState(ctx, reward.Address, func(sct cbor.IpldStore, st *reward0.State) error {
|
||||||
*st = *reward0.ConstructState(qaPow)
|
*st = *reward0.ConstructState(qaPow)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -252,7 +257,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
sectorWeight := miner0.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, dweight.DealWeight, dweight.VerifiedDealWeight)
|
sectorWeight := miner0.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, dweight.DealWeight, dweight.VerifiedDealWeight)
|
||||||
|
|
||||||
// we've added fake power for this sector above, remove it now
|
// we've added fake power for this sector above, remove it now
|
||||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power0.State) error {
|
err = vm.MutateState(ctx, power.Address, func(cst cbor.IpldStore, st *power0.State) error {
|
||||||
st.TotalQualityAdjPower = types.BigSub(st.TotalQualityAdjPower, sectorWeight) //nolint:scopelint
|
st.TotalQualityAdjPower = types.BigSub(st.TotalQualityAdjPower, sectorWeight) //nolint:scopelint
|
||||||
st.TotalRawBytePower = types.BigSub(st.TotalRawBytePower, types.NewInt(uint64(m.SectorSize)))
|
st.TotalRawBytePower = types.BigSub(st.TotalRawBytePower, types.NewInt(uint64(m.SectorSize)))
|
||||||
return nil
|
return nil
|
||||||
@ -295,7 +300,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
Sectors: []abi.SectorNumber{preseal.SectorID},
|
Sectors: []abi.SectorNumber{preseal.SectorID},
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = doExecValue(ctx, vm, minerInfos[i].maddr, builtin.StoragePowerActorAddr, big.Zero(), builtin.MethodsMiner.ConfirmSectorProofsValid, mustEnc(confirmParams))
|
_, err = doExecValue(ctx, vm, minerInfos[i].maddr, power.Address, big.Zero(), builtin.MethodsMiner.ConfirmSectorProofsValid, mustEnc(confirmParams))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
|
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
|
||||||
}
|
}
|
||||||
@ -304,7 +309,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sanity-check total network power
|
// Sanity-check total network power
|
||||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power0.State) error {
|
err = vm.MutateState(ctx, power.Address, func(cst cbor.IpldStore, st *power0.State) error {
|
||||||
if !st.TotalRawBytePower.Equals(rawPow) {
|
if !st.TotalRawBytePower.Equals(rawPow) {
|
||||||
return xerrors.Errorf("st.TotalRawBytePower doesn't match previously calculated rawPow")
|
return xerrors.Errorf("st.TotalRawBytePower doesn't match previously calculated rawPow")
|
||||||
}
|
}
|
||||||
@ -344,7 +349,7 @@ func (fr *fakeRand) GetBeaconRandomness(ctx context.Context, personalization cry
|
|||||||
}
|
}
|
||||||
|
|
||||||
func currentTotalPower(ctx context.Context, vm *vm.VM, maddr address.Address) (*power0.CurrentTotalPowerReturn, error) {
|
func currentTotalPower(ctx context.Context, vm *vm.VM, maddr address.Address) (*power0.CurrentTotalPowerReturn, error) {
|
||||||
pwret, err := doExecValue(ctx, vm, builtin.StoragePowerActorAddr, maddr, big.Zero(), builtin.MethodsPower.CurrentTotalPower, nil)
|
pwret, err := doExecValue(ctx, vm, power.Address, maddr, big.Zero(), builtin.MethodsPower.CurrentTotalPower, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -356,33 +361,33 @@ func currentTotalPower(ctx context.Context, vm *vm.VM, maddr address.Address) (*
|
|||||||
return &pwr, nil
|
return &pwr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dealWeight(ctx context.Context, vm *vm.VM, maddr address.Address, dealIDs []abi.DealID, sectorStart, sectorExpiry abi.ChainEpoch) (market.VerifyDealsForActivationReturn, error) {
|
func dealWeight(ctx context.Context, vm *vm.VM, maddr address.Address, dealIDs []abi.DealID, sectorStart, sectorExpiry abi.ChainEpoch) (market0.VerifyDealsForActivationReturn, error) {
|
||||||
params := &market.VerifyDealsForActivationParams{
|
params := &market.VerifyDealsForActivationParams{
|
||||||
DealIDs: dealIDs,
|
DealIDs: dealIDs,
|
||||||
SectorStart: sectorStart,
|
SectorStart: sectorStart,
|
||||||
SectorExpiry: sectorExpiry,
|
SectorExpiry: sectorExpiry,
|
||||||
}
|
}
|
||||||
|
|
||||||
var dealWeights market.VerifyDealsForActivationReturn
|
var dealWeights market0.VerifyDealsForActivationReturn
|
||||||
ret, err := doExecValue(ctx, vm,
|
ret, err := doExecValue(ctx, vm,
|
||||||
builtin.StorageMarketActorAddr,
|
market.Address,
|
||||||
maddr,
|
maddr,
|
||||||
abi.NewTokenAmount(0),
|
abi.NewTokenAmount(0),
|
||||||
builtin.MethodsMarket.VerifyDealsForActivation,
|
builtin.MethodsMarket.VerifyDealsForActivation,
|
||||||
mustEnc(params),
|
mustEnc(params),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return market.VerifyDealsForActivationReturn{}, err
|
return market0.VerifyDealsForActivationReturn{}, err
|
||||||
}
|
}
|
||||||
if err := dealWeights.UnmarshalCBOR(bytes.NewReader(ret)); err != nil {
|
if err := dealWeights.UnmarshalCBOR(bytes.NewReader(ret)); err != nil {
|
||||||
return market.VerifyDealsForActivationReturn{}, err
|
return market0.VerifyDealsForActivationReturn{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return dealWeights, nil
|
return dealWeights, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func currentEpochBlockReward(ctx context.Context, vm *vm.VM, maddr address.Address) (*reward0.ThisEpochRewardReturn, error) {
|
func currentEpochBlockReward(ctx context.Context, vm *vm.VM, maddr address.Address) (*reward0.ThisEpochRewardReturn, error) {
|
||||||
rwret, err := doExecValue(ctx, vm, builtin.RewardActorAddr, maddr, big.Zero(), builtin.MethodsReward.ThisEpochReward, nil)
|
rwret, err := doExecValue(ctx, vm, reward.Address, maddr, big.Zero(), builtin.MethodsReward.ThisEpochReward, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||||
"github.com/filecoin-project/lotus/chain/events"
|
"github.com/filecoin-project/lotus/chain/events"
|
||||||
"github.com/filecoin-project/lotus/chain/events/state"
|
"github.com/filecoin-project/lotus/chain/events/state"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -151,7 +152,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Add
|
|||||||
}
|
}
|
||||||
|
|
||||||
smsg, err := fm.api.MpoolPushMessage(ctx, &types.Message{
|
smsg, err := fm.api.MpoolPushMessage(ctx, &types.Message{
|
||||||
To: builtin.StorageMarketActorAddr,
|
To: market.Address,
|
||||||
From: wallet,
|
From: wallet,
|
||||||
Value: toAdd,
|
Value: toAdd,
|
||||||
Method: builtin.MethodsMarket.AddBalance,
|
Method: builtin.MethodsMarket.AddBalance,
|
||||||
|
@ -17,6 +17,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ func (fapi *fakeAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, s
|
|||||||
func addFundsMsg(toAdd abi.TokenAmount, addr address.Address, wallet address.Address) *types.Message {
|
func addFundsMsg(toAdd abi.TokenAmount, addr address.Address, wallet address.Address) *types.Message {
|
||||||
params, _ := actors.SerializeParams(&addr)
|
params, _ := actors.SerializeParams(&addr)
|
||||||
return &types.Message{
|
return &types.Message{
|
||||||
To: builtin.StorageMarketActorAddr,
|
To: market.Address,
|
||||||
From: wallet,
|
From: wallet,
|
||||||
Value: toAdd,
|
Value: toAdd,
|
||||||
Method: builtin.MethodsMarket.AddBalance,
|
Method: builtin.MethodsMarket.AddBalance,
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||||
|
lotusinit "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
"github.com/filecoin-project/lotus/chain/gen"
|
"github.com/filecoin-project/lotus/chain/gen"
|
||||||
"github.com/filecoin-project/lotus/chain/stmgr"
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
. "github.com/filecoin-project/lotus/chain/stmgr"
|
. "github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
@ -168,7 +169,7 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
|
|
||||||
m := &types.Message{
|
m := &types.Message{
|
||||||
From: cg.Banker(),
|
From: cg.Banker(),
|
||||||
To: builtin.InitActorAddr,
|
To: lotusinit.Address,
|
||||||
Method: builtin.MethodsInit.Exec,
|
Method: builtin.MethodsInit.Exec,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: types.TestGasLimit,
|
GasLimit: types.TestGasLimit,
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/state"
|
"github.com/filecoin-project/lotus/chain/state"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
|
||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
)
|
)
|
||||||
@ -35,7 +34,7 @@ func (cs *ChainStore) Weight(ctx context.Context, ts *types.TipSet) (types.BigIn
|
|||||||
return types.NewInt(0), xerrors.Errorf("load state tree: %w", err)
|
return types.NewInt(0), xerrors.Errorf("load state tree: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
act, err := state.GetActor(builtin.StoragePowerActorAddr)
|
act, err := state.GetActor(power.Address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.NewInt(0), xerrors.Errorf("get power actor: %w", err)
|
return types.NewInt(0), xerrors.Errorf("get power actor: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,6 @@ import (
|
|||||||
"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/lotus/extern/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
blst "github.com/supranational/blst/bindings/go"
|
blst "github.com/supranational/blst/bindings/go"
|
||||||
|
|
||||||
@ -640,7 +639,7 @@ func (syncer *Syncer) ValidateTipSet(ctx context.Context, fts *store.FullTipSet)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (syncer *Syncer) minerIsValid(ctx context.Context, maddr address.Address, baseTs *types.TipSet) error {
|
func (syncer *Syncer) minerIsValid(ctx context.Context, maddr address.Address, baseTs *types.TipSet) error {
|
||||||
act, err := syncer.sm.LoadActor(ctx, builtin.StoragePowerActorAddr, baseTs)
|
act, err := syncer.sm.LoadActor(ctx, power.Address, baseTs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to load power actor: %w", err)
|
return xerrors.Errorf("failed to load power actor: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/account"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/account"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
|
||||||
"github.com/filecoin-project/lotus/chain/state"
|
"github.com/filecoin-project/lotus/chain/state"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/lib/blockstore"
|
"github.com/filecoin-project/lotus/lib/blockstore"
|
||||||
@ -493,7 +494,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet,
|
|||||||
return nil, xerrors.Errorf("failed to burn base fee: %w", err)
|
return nil, xerrors.Errorf("failed to burn base fee: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := vm.transferFromGasHolder(builtin.RewardActorAddr, gasHolder, gasOutputs.MinerTip); err != nil {
|
if err := vm.transferFromGasHolder(reward.Address, gasHolder, gasOutputs.MinerTip); err != nil {
|
||||||
return nil, xerrors.Errorf("failed to give miner gas reward: %w", err)
|
return nil, xerrors.Errorf("failed to give miner gas reward: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||||
tutils "github.com/filecoin-project/specs-actors/support/testing"
|
tutils "github.com/filecoin-project/specs-actors/support/testing"
|
||||||
|
|
||||||
|
lotusinit "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
||||||
paychmock "github.com/filecoin-project/lotus/chain/actors/builtin/paych/mock"
|
paychmock "github.com/filecoin-project/lotus/chain/actors/builtin/paych/mock"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -60,7 +61,7 @@ func TestPaychGetCreateChannelMsg(t *testing.T) {
|
|||||||
|
|
||||||
pushedMsg := mock.pushedMessages(mcid)
|
pushedMsg := mock.pushedMessages(mcid)
|
||||||
require.Equal(t, from, pushedMsg.Message.From)
|
require.Equal(t, from, pushedMsg.Message.From)
|
||||||
require.Equal(t, builtin.InitActorAddr, pushedMsg.Message.To)
|
require.Equal(t, lotusinit.Address, pushedMsg.Message.To)
|
||||||
require.Equal(t, amt, pushedMsg.Message.Value)
|
require.Equal(t, amt, pushedMsg.Message.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +713,7 @@ func TestPaychGetMergeAddFunds(t *testing.T) {
|
|||||||
// Check create message amount is correct
|
// Check create message amount is correct
|
||||||
createMsg := mock.pushedMessages(createMsgCid)
|
createMsg := mock.pushedMessages(createMsgCid)
|
||||||
require.Equal(t, from, createMsg.Message.From)
|
require.Equal(t, from, createMsg.Message.From)
|
||||||
require.Equal(t, builtin.InitActorAddr, createMsg.Message.To)
|
require.Equal(t, lotusinit.Address, createMsg.Message.To)
|
||||||
require.Equal(t, createAmt, createMsg.Message.Value)
|
require.Equal(t, createAmt, createMsg.Message.Value)
|
||||||
|
|
||||||
// Check merged add funds amount is the sum of the individual
|
// Check merged add funds amount is the sum of the individual
|
||||||
@ -808,7 +809,7 @@ func TestPaychGetMergeAddFundsCtxCancelOne(t *testing.T) {
|
|||||||
// Check create message amount is correct
|
// Check create message amount is correct
|
||||||
createMsg := mock.pushedMessages(createMsgCid)
|
createMsg := mock.pushedMessages(createMsgCid)
|
||||||
require.Equal(t, from, createMsg.Message.From)
|
require.Equal(t, from, createMsg.Message.From)
|
||||||
require.Equal(t, builtin.InitActorAddr, createMsg.Message.To)
|
require.Equal(t, lotusinit.Address, createMsg.Message.To)
|
||||||
require.Equal(t, createAmt, createMsg.Message.Value)
|
require.Equal(t, createAmt, createMsg.Message.Value)
|
||||||
|
|
||||||
// Check merged add funds amount only includes the second add funds amount
|
// Check merged add funds amount only includes the second add funds amount
|
||||||
@ -890,7 +891,7 @@ func TestPaychGetMergeAddFundsCtxCancelAll(t *testing.T) {
|
|||||||
// Check create message amount is correct
|
// Check create message amount is correct
|
||||||
createMsg := mock.pushedMessages(createMsgCid)
|
createMsg := mock.pushedMessages(createMsgCid)
|
||||||
require.Equal(t, from, createMsg.Message.From)
|
require.Equal(t, from, createMsg.Message.From)
|
||||||
require.Equal(t, builtin.InitActorAddr, createMsg.Message.To)
|
require.Equal(t, lotusinit.Address, createMsg.Message.To)
|
||||||
require.Equal(t, createAmt, createMsg.Message.Value)
|
require.Equal(t, createAmt, createMsg.Message.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,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/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
lotusinit "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -400,7 +401,7 @@ func (ca *channelAccessor) createPaych(ctx context.Context, amt types.BigInt) (c
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg := &types.Message{
|
msg := &types.Message{
|
||||||
To: builtin.InitActorAddr,
|
To: lotusinit.Address,
|
||||||
From: ca.from,
|
From: ca.from,
|
||||||
Value: amt,
|
Value: amt,
|
||||||
Method: builtin.MethodsInit.Exec,
|
Method: builtin.MethodsInit.Exec,
|
||||||
|
Loading…
Reference in New Issue
Block a user