Merge pull request #2343 from filecoin-project/feat/more-gas
Make virtual gas real
This commit is contained in:
commit
4553af505f
@ -91,7 +91,7 @@ const VerifSigCacheSize = 32000
|
|||||||
|
|
||||||
// TODO: If this is gonna stay, it should move to specs-actors
|
// TODO: If this is gonna stay, it should move to specs-actors
|
||||||
const BlockMessageLimit = 512
|
const BlockMessageLimit = 512
|
||||||
const BlockGasLimit = 100_000_000_000
|
const BlockGasLimit = 7_500_000_000
|
||||||
|
|
||||||
var DrandConfig = dtypes.DrandConfig{
|
var DrandConfig = dtypes.DrandConfig{
|
||||||
Servers: []string{
|
Servers: []string{
|
||||||
|
@ -468,7 +468,7 @@ func getRandomMessages(cg *ChainGen) ([]*types.SignedMessage, error) {
|
|||||||
|
|
||||||
Method: 0,
|
Method: 0,
|
||||||
|
|
||||||
GasLimit: 10000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Add
|
|||||||
From: wallet,
|
From: wallet,
|
||||||
Value: toAdd,
|
Value: toAdd,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: 1000000,
|
GasLimit: 100_000_000,
|
||||||
Method: builtin.MethodsMarket.AddBalance,
|
Method: builtin.MethodsMarket.AddBalance,
|
||||||
Params: params,
|
Params: params,
|
||||||
})
|
})
|
||||||
|
@ -179,7 +179,7 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
To: builtin.InitActorAddr,
|
To: builtin.InitActorAddr,
|
||||||
Method: builtin.MethodsInit.Exec,
|
Method: builtin.MethodsInit.Exec,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: 10000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
sig, err := cg.Wallet().Sign(ctx, cg.Banker(), m.Cid().Bytes())
|
sig, err := cg.Wallet().Sign(ctx, cg.Banker(), m.Cid().Bytes())
|
||||||
@ -206,7 +206,7 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
Method: 2,
|
Method: 2,
|
||||||
Params: nil,
|
Params: nil,
|
||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
GasLimit: 10000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
nonce++
|
nonce++
|
||||||
|
@ -19,7 +19,7 @@ func TestSignedMessageJsonRoundtrip(t *testing.T) {
|
|||||||
Method: 1235126,
|
Method: 1235126,
|
||||||
Value: types.NewInt(123123),
|
Value: types.NewInt(123123),
|
||||||
GasPrice: types.NewInt(1234),
|
GasPrice: types.NewInt(1234),
|
||||||
GasLimit: 9992969384,
|
GasLimit: 100_000_000,
|
||||||
Nonce: 123123,
|
Nonce: 123123,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ type Pricelist interface {
|
|||||||
OnMethodInvocation(value abi.TokenAmount, methodNum abi.MethodNum) GasCharge
|
OnMethodInvocation(value abi.TokenAmount, methodNum abi.MethodNum) GasCharge
|
||||||
|
|
||||||
// OnIpldGet returns the gas used for storing an object
|
// OnIpldGet returns the gas used for storing an object
|
||||||
OnIpldGet(dataSize int) GasCharge
|
OnIpldGet() GasCharge
|
||||||
// OnIpldPut returns the gas used for storing an object
|
// OnIpldPut returns the gas used for storing an object
|
||||||
OnIpldPut(dataSize int) GasCharge
|
OnIpldPut(dataSize int) GasCharge
|
||||||
|
|
||||||
@ -84,30 +84,35 @@ type Pricelist interface {
|
|||||||
|
|
||||||
var prices = map[abi.ChainEpoch]Pricelist{
|
var prices = map[abi.ChainEpoch]Pricelist{
|
||||||
abi.ChainEpoch(0): &pricelistV0{
|
abi.ChainEpoch(0): &pricelistV0{
|
||||||
onChainMessageBase: 0,
|
onChainMessageComputeBase: 137137,
|
||||||
onChainMessagePerByte: 2,
|
onChainMessageStorageBase: 0, // TODO gas
|
||||||
onChainReturnValuePerByte: 8,
|
onChainMessageStoragePerByte: 2, // TODO gas
|
||||||
sendBase: 5,
|
|
||||||
sendTransferFunds: 5,
|
onChainReturnValuePerByte: 8, // TODO gas
|
||||||
sendInvokeMethod: 10,
|
|
||||||
ipldGetBase: 10,
|
sendBase: 97236,
|
||||||
ipldGetPerByte: 1,
|
sendTransferFunds: 96812,
|
||||||
ipldPutBase: 20,
|
sendTransferOnlyPremium: 347806,
|
||||||
ipldPutPerByte: 2,
|
sendInvokeMethod: -3110,
|
||||||
createActorBase: 40, // IPLD put + 20
|
|
||||||
createActorExtra: 500,
|
ipldGetBase: 417230,
|
||||||
deleteActor: -500, // -createActorExtra
|
ipldPutBase: 396100,
|
||||||
// Dragons: this cost is not persistable, create a LinearCost{a,b} struct that has a `.Cost(x) -> ax + b`
|
ipldPutPerByte: 2, // TODO gas
|
||||||
verifySignature: map[crypto.SigType]func(int64) int64{
|
|
||||||
crypto.SigTypeBLS: func(x int64) int64 { return 3*x + 2 },
|
createActorCompute: 750011,
|
||||||
crypto.SigTypeSecp256k1: func(x int64) int64 { return 3*x + 2 },
|
createActorStorage: 500, // TODO gas
|
||||||
|
deleteActor: -500, // -createActorStorage
|
||||||
|
|
||||||
|
verifySignature: map[crypto.SigType]int64{
|
||||||
|
crypto.SigTypeBLS: 219946580,
|
||||||
|
crypto.SigTypeSecp256k1: 6726720,
|
||||||
},
|
},
|
||||||
hashingBase: 5,
|
|
||||||
hashingPerByte: 2,
|
hashingBase: 110685,
|
||||||
computeUnsealedSectorCidBase: 100,
|
computeUnsealedSectorCidBase: 431890,
|
||||||
verifySealBase: 2000,
|
verifySealBase: 2000, // TODO gas , it VerifySeal syscall is not used
|
||||||
verifyPostBase: 700,
|
verifyPostBase: 2621447835,
|
||||||
verifyConsensusFault: 10,
|
verifyConsensusFault: 495422,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,14 +203,14 @@ func (ps pricedSyscalls) VerifyConsensusFault(h1 []byte, h2 []byte, extra []byte
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ps pricedSyscalls) BatchVerifySeals(inp map[address.Address][]abi.SealVerifyInfo) (map[address.Address][]bool, error) {
|
func (ps pricedSyscalls) BatchVerifySeals(inp map[address.Address][]abi.SealVerifyInfo) (map[address.Address][]bool, error) {
|
||||||
var gasChargeSum GasCharge
|
|
||||||
gasChargeSum.Name = "BatchVerifySeals"
|
|
||||||
count := int64(0)
|
count := int64(0)
|
||||||
for _, svis := range inp {
|
for _, svis := range inp {
|
||||||
count += int64(len(svis))
|
count += int64(len(svis))
|
||||||
}
|
}
|
||||||
gasChargeSum = gasChargeSum.WithExtra(count).WithVirtual(129778623*count+716683250, 0)
|
|
||||||
ps.chargeGas(gasChargeSum) // TODO: this is only called by the cron actor. Should we even charge gas?
|
gasChargeSum := newGasCharge("BatchVerifySeals", 0, 0)
|
||||||
|
gasChargeSum = gasChargeSum.WithExtra(count).WithVirtual(15075005*count+899741502, 0)
|
||||||
|
ps.chargeGas(gasChargeSum) // real gas charged by actors
|
||||||
defer ps.chargeGas(gasOnActorExec)
|
defer ps.chargeGas(gasOnActorExec)
|
||||||
|
|
||||||
return ps.under.BatchVerifySeals(inp)
|
return ps.under.BatchVerifySeals(inp)
|
||||||
|
@ -20,8 +20,9 @@ type pricelistV0 struct {
|
|||||||
// Together, these account for the cost of message propagation and validation,
|
// Together, these account for the cost of message propagation and validation,
|
||||||
// up to but excluding any actual processing by the VM.
|
// up to but excluding any actual processing by the VM.
|
||||||
// This is the cost a block producer burns when including an invalid message.
|
// This is the cost a block producer burns when including an invalid message.
|
||||||
onChainMessageBase int64
|
onChainMessageComputeBase int64
|
||||||
onChainMessagePerByte int64
|
onChainMessageStorageBase int64
|
||||||
|
onChainMessageStoragePerByte int64
|
||||||
|
|
||||||
// Gas cost charged to the originator of a non-nil return value produced
|
// Gas cost charged to the originator of a non-nil return value produced
|
||||||
// by an on-chain message is given by:
|
// by an on-chain message is given by:
|
||||||
@ -41,15 +42,17 @@ type pricelistV0 struct {
|
|||||||
// already accounted for).
|
// already accounted for).
|
||||||
sendTransferFunds int64
|
sendTransferFunds int64
|
||||||
|
|
||||||
|
// Gsa cost charged, in addition to SendBase, if message only transfers funds.
|
||||||
|
sendTransferOnlyPremium int64
|
||||||
|
|
||||||
// Gas cost charged, in addition to SendBase, if a message invokes
|
// Gas cost charged, in addition to SendBase, if a message invokes
|
||||||
// a method on the receiver.
|
// a method on the receiver.
|
||||||
// Accounts for the cost of loading receiver code and method dispatch.
|
// Accounts for the cost of loading receiver code and method dispatch.
|
||||||
sendInvokeMethod int64
|
sendInvokeMethod int64
|
||||||
|
|
||||||
// Gas cost (Base + len*PerByte) for any Get operation to the IPLD store
|
// Gas cost for any Get operation to the IPLD store
|
||||||
// in the runtime VM context.
|
// in the runtime VM context.
|
||||||
ipldGetBase int64
|
ipldGetBase int64
|
||||||
ipldGetPerByte int64
|
|
||||||
|
|
||||||
// Gas cost (Base + len*PerByte) for any Put operation to the IPLD store
|
// Gas cost (Base + len*PerByte) for any Put operation to the IPLD store
|
||||||
// in the runtime VM context.
|
// in the runtime VM context.
|
||||||
@ -64,18 +67,17 @@ type pricelistV0 struct {
|
|||||||
//
|
//
|
||||||
// Note: this costs assume that the extra will be partially or totally refunded while
|
// Note: this costs assume that the extra will be partially or totally refunded while
|
||||||
// the base is covering for the put.
|
// the base is covering for the put.
|
||||||
createActorBase int64
|
createActorCompute int64
|
||||||
createActorExtra int64
|
createActorStorage int64
|
||||||
|
|
||||||
// Gas cost for deleting an actor.
|
// Gas cost for deleting an actor.
|
||||||
//
|
//
|
||||||
// Note: this partially refunds the create cost to incentivise the deletion of the actors.
|
// Note: this partially refunds the create cost to incentivise the deletion of the actors.
|
||||||
deleteActor int64
|
deleteActor int64
|
||||||
|
|
||||||
verifySignature map[crypto.SigType]func(len int64) int64
|
verifySignature map[crypto.SigType]int64
|
||||||
|
|
||||||
hashingBase int64
|
hashingBase int64
|
||||||
hashingPerByte int64
|
|
||||||
|
|
||||||
computeUnsealedSectorCidBase int64
|
computeUnsealedSectorCidBase int64
|
||||||
verifySealBase int64
|
verifySealBase int64
|
||||||
@ -87,57 +89,51 @@ var _ Pricelist = (*pricelistV0)(nil)
|
|||||||
|
|
||||||
// OnChainMessage returns the gas used for storing a message of a given size in the chain.
|
// OnChainMessage returns the gas used for storing a message of a given size in the chain.
|
||||||
func (pl *pricelistV0) OnChainMessage(msgSize int) GasCharge {
|
func (pl *pricelistV0) OnChainMessage(msgSize int) GasCharge {
|
||||||
return newGasCharge("OnChainMessage", 0, pl.onChainMessageBase+pl.onChainMessagePerByte*int64(msgSize)).WithVirtual(77302, 0)
|
return newGasCharge("OnChainMessage", pl.onChainMessageComputeBase,
|
||||||
|
pl.onChainMessageStorageBase+pl.onChainMessageStoragePerByte*int64(msgSize))
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnChainReturnValue returns the gas used for storing the response of a message in the chain.
|
// OnChainReturnValue returns the gas used for storing the response of a message in the chain.
|
||||||
func (pl *pricelistV0) OnChainReturnValue(dataSize int) GasCharge {
|
func (pl *pricelistV0) OnChainReturnValue(dataSize int) GasCharge {
|
||||||
return newGasCharge("OnChainReturnValue", 0, int64(dataSize)*pl.onChainReturnValuePerByte).WithVirtual(107294, 0)
|
return newGasCharge("OnChainReturnValue", 0, int64(dataSize)*pl.onChainReturnValuePerByte)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnMethodInvocation returns the gas used when invoking a method.
|
// OnMethodInvocation returns the gas used when invoking a method.
|
||||||
func (pl *pricelistV0) OnMethodInvocation(value abi.TokenAmount, methodNum abi.MethodNum) GasCharge {
|
func (pl *pricelistV0) OnMethodInvocation(value abi.TokenAmount, methodNum abi.MethodNum) GasCharge {
|
||||||
ret := pl.sendBase
|
ret := pl.sendBase
|
||||||
extra := ""
|
extra := ""
|
||||||
virtGas := int64(1072944)
|
|
||||||
|
|
||||||
if value != abi.NewTokenAmount(0) {
|
|
||||||
// TODO: fix this, it is comparing pointers instead of values
|
|
||||||
// see vv
|
|
||||||
ret += pl.sendTransferFunds
|
|
||||||
}
|
|
||||||
if big.Cmp(value, abi.NewTokenAmount(0)) != 0 {
|
if big.Cmp(value, abi.NewTokenAmount(0)) != 0 {
|
||||||
virtGas += 497495
|
ret += pl.sendTransferFunds
|
||||||
if methodNum == builtin.MethodSend {
|
if methodNum == builtin.MethodSend {
|
||||||
// transfer only
|
// transfer only
|
||||||
virtGas += 973940
|
ret += pl.sendTransferOnlyPremium
|
||||||
}
|
}
|
||||||
extra += "t"
|
extra += "t"
|
||||||
}
|
}
|
||||||
|
|
||||||
if methodNum != builtin.MethodSend {
|
if methodNum != builtin.MethodSend {
|
||||||
ret += pl.sendInvokeMethod
|
|
||||||
extra += "i"
|
extra += "i"
|
||||||
// running actors is cheaper becase we hand over to actors
|
// running actors is cheaper becase we hand over to actors
|
||||||
virtGas += -295779
|
ret += pl.sendInvokeMethod
|
||||||
}
|
}
|
||||||
return newGasCharge("OnMethodInvocation", ret, 0).WithVirtual(virtGas, 0).WithExtra(extra)
|
return newGasCharge("OnMethodInvocation", ret, 0).WithExtra(extra)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnIpldGet returns the gas used for storing an object
|
// OnIpldGet returns the gas used for storing an object
|
||||||
func (pl *pricelistV0) OnIpldGet(dataSize int) GasCharge {
|
func (pl *pricelistV0) OnIpldGet() GasCharge {
|
||||||
return newGasCharge("OnIpldGet", pl.ipldGetBase+int64(dataSize)*pl.ipldGetPerByte, 0).
|
return newGasCharge("OnIpldGet", pl.ipldGetBase, 0)
|
||||||
WithExtra(dataSize).WithVirtual(433685, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnIpldPut returns the gas used for storing an object
|
// OnIpldPut returns the gas used for storing an object
|
||||||
func (pl *pricelistV0) OnIpldPut(dataSize int) GasCharge {
|
func (pl *pricelistV0) OnIpldPut(dataSize int) GasCharge {
|
||||||
return newGasCharge("OnIpldPut", pl.ipldPutBase, int64(dataSize)*pl.ipldPutPerByte).
|
return newGasCharge("OnIpldPut", pl.ipldPutBase, int64(dataSize)*pl.ipldPutPerByte).
|
||||||
WithExtra(dataSize).WithVirtual(88970, 0)
|
WithExtra(dataSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnCreateActor returns the gas used for creating an actor
|
// OnCreateActor returns the gas used for creating an actor
|
||||||
func (pl *pricelistV0) OnCreateActor() GasCharge {
|
func (pl *pricelistV0) OnCreateActor() GasCharge {
|
||||||
return newGasCharge("OnCreateActor", pl.createActorBase, pl.createActorExtra).WithVirtual(65636, 0)
|
return newGasCharge("OnCreateActor", pl.createActorCompute, pl.createActorStorage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnDeleteActor returns the gas used for deleting an actor
|
// OnDeleteActor returns the gas used for deleting an actor
|
||||||
@ -148,50 +144,42 @@ func (pl *pricelistV0) OnDeleteActor() GasCharge {
|
|||||||
// OnVerifySignature
|
// OnVerifySignature
|
||||||
|
|
||||||
func (pl *pricelistV0) OnVerifySignature(sigType crypto.SigType, planTextSize int) (GasCharge, error) {
|
func (pl *pricelistV0) OnVerifySignature(sigType crypto.SigType, planTextSize int) (GasCharge, error) {
|
||||||
costFn, ok := pl.verifySignature[sigType]
|
cost, ok := pl.verifySignature[sigType]
|
||||||
if !ok {
|
if !ok {
|
||||||
return GasCharge{}, fmt.Errorf("cost function for signature type %d not supported", sigType)
|
return GasCharge{}, fmt.Errorf("cost function for signature type %d not supported", sigType)
|
||||||
}
|
}
|
||||||
sigName, _ := sigType.Name()
|
|
||||||
virtGas := int64(0)
|
|
||||||
switch sigType {
|
|
||||||
case crypto.SigTypeBLS:
|
|
||||||
virtGas = 220138570
|
|
||||||
case crypto.SigTypeSecp256k1:
|
|
||||||
virtGas = 7053730
|
|
||||||
}
|
|
||||||
|
|
||||||
return newGasCharge("OnVerifySignature", costFn(int64(planTextSize)), 0).
|
sigName, _ := sigType.Name()
|
||||||
|
return newGasCharge("OnVerifySignature", cost, 0).
|
||||||
WithExtra(map[string]interface{}{
|
WithExtra(map[string]interface{}{
|
||||||
"type": sigName,
|
"type": sigName,
|
||||||
"size": planTextSize,
|
"size": planTextSize,
|
||||||
}).WithVirtual(virtGas, 0), nil
|
}), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnHashing
|
// OnHashing
|
||||||
func (pl *pricelistV0) OnHashing(dataSize int) GasCharge {
|
func (pl *pricelistV0) OnHashing(dataSize int) GasCharge {
|
||||||
return newGasCharge("OnHashing", pl.hashingBase+int64(dataSize)*pl.hashingPerByte, 0).WithExtra(dataSize).WithVirtual(77300, 0)
|
return newGasCharge("OnHashing", pl.hashingBase, 0).WithExtra(dataSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnComputeUnsealedSectorCid
|
// OnComputeUnsealedSectorCid
|
||||||
func (pl *pricelistV0) OnComputeUnsealedSectorCid(proofType abi.RegisteredSealProof, pieces []abi.PieceInfo) GasCharge {
|
func (pl *pricelistV0) OnComputeUnsealedSectorCid(proofType abi.RegisteredSealProof, pieces []abi.PieceInfo) GasCharge {
|
||||||
// TODO: this needs more cost tunning, check with @lotus
|
return newGasCharge("OnComputeUnsealedSectorCid", pl.computeUnsealedSectorCidBase, 0)
|
||||||
return newGasCharge("OnComputeUnsealedSectorCid", pl.computeUnsealedSectorCidBase, 0).WithVirtual(382370, 0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnVerifySeal
|
// OnVerifySeal
|
||||||
func (pl *pricelistV0) OnVerifySeal(info abi.SealVerifyInfo) GasCharge {
|
func (pl *pricelistV0) OnVerifySeal(info abi.SealVerifyInfo) GasCharge {
|
||||||
// TODO: this needs more cost tunning, check with @lotus
|
// TODO: this needs more cost tunning, check with @lotus
|
||||||
return newGasCharge("OnVerifySeal", pl.verifySealBase, 0).WithVirtual(199954003, 0)
|
// this is not used
|
||||||
|
return newGasCharge("OnVerifySeal", pl.verifySealBase, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnVerifyPost
|
// OnVerifyPost
|
||||||
func (pl *pricelistV0) OnVerifyPost(info abi.WindowPoStVerifyInfo) GasCharge {
|
func (pl *pricelistV0) OnVerifyPost(info abi.WindowPoStVerifyInfo) GasCharge {
|
||||||
// TODO: this needs more cost tunning, check with @lotus
|
return newGasCharge("OnVerifyPost", pl.verifyPostBase, 0).WithExtra(len(info.ChallengedSectors))
|
||||||
return newGasCharge("OnVerifyPost", pl.verifyPostBase, 0).WithVirtual(2629471704, 0).WithExtra(len(info.ChallengedSectors))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnVerifyConsensusFault
|
// OnVerifyConsensusFault
|
||||||
func (pl *pricelistV0) OnVerifyConsensusFault() GasCharge {
|
func (pl *pricelistV0) OnVerifyConsensusFault() GasCharge {
|
||||||
return newGasCharge("OnVerifyConsensusFault", pl.verifyConsensusFault, 0).WithVirtual(551935, 0)
|
return newGasCharge("OnVerifyConsensusFault", pl.verifyConsensusFault, 0)
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,10 @@ 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, aerrors.ActorError) {
|
func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, aerrors.ActorError) {
|
||||||
|
if err := rt.chargeGasSafe(PricelistByEpoch(rt.height).OnCreateActor()); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
addrID, err := rt.state.RegisterNewAddress(addr)
|
addrID, err := rt.state.RegisterNewAddress(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, aerrors.Escalate(err, "registering actor address")
|
return nil, aerrors.Escalate(err, "registering actor address")
|
||||||
@ -50,10 +54,6 @@ func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, aer
|
|||||||
}
|
}
|
||||||
// call constructor on account
|
// call constructor on account
|
||||||
|
|
||||||
if err := rt.chargeGasSafe(PricelistByEpoch(rt.height).OnCreateActor()); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
_, aerr = rt.internalSend(builtin.SystemActorAddr, addrID, builtin.MethodsAccount.Constructor, big.Zero(), p)
|
_, aerr = rt.internalSend(builtin.SystemActorAddr, addrID, builtin.MethodsAccount.Constructor, big.Zero(), p)
|
||||||
if aerr != nil {
|
if aerr != nil {
|
||||||
return nil, aerrors.Wrap(aerr, "failed to invoke account constructor")
|
return nil, aerrors.Wrap(aerr, "failed to invoke account constructor")
|
||||||
|
@ -71,12 +71,12 @@ type gasChargingBlocks struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (bs *gasChargingBlocks) Get(c cid.Cid) (block.Block, error) {
|
func (bs *gasChargingBlocks) Get(c cid.Cid) (block.Block, error) {
|
||||||
bs.chargeGas(newGasCharge("OnIpldGetStart", 0, 0))
|
bs.chargeGas(bs.pricelist.OnIpldGet())
|
||||||
blk, err := bs.under.Get(c)
|
blk, err := bs.under.Get(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, aerrors.Escalate(err, "failed to get block from blockstore")
|
return nil, aerrors.Escalate(err, "failed to get block from blockstore")
|
||||||
}
|
}
|
||||||
bs.chargeGas(bs.pricelist.OnIpldGet(len(blk.RawData())))
|
bs.chargeGas(newGasCharge("OnIpldGetEnd", 0, 0).WithExtra(len(blk.RawData())))
|
||||||
bs.chargeGas(gasOnActorExec)
|
bs.chargeGas(gasOnActorExec)
|
||||||
|
|
||||||
return blk, nil
|
return blk, nil
|
||||||
@ -211,7 +211,6 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
|||||||
parent.lastGasCharge = rt.lastGasCharge
|
parent.lastGasCharge = rt.lastGasCharge
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
if gasCharge != nil {
|
if gasCharge != nil {
|
||||||
if err := rt.chargeGasSafe(*gasCharge); err != nil {
|
if err := rt.chargeGasSafe(*gasCharge); err != nil {
|
||||||
// this should never happen
|
// this should never happen
|
||||||
@ -220,10 +219,7 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret, err := func() ([]byte, aerrors.ActorError) {
|
ret, err := func() ([]byte, aerrors.ActorError) {
|
||||||
if aerr := rt.chargeGasSafe(rt.Pricelist().OnMethodInvocation(msg.Value, msg.Method)); aerr != nil {
|
_ = rt.chargeGasSafe(newGasCharge("OnGetActor", 0, 0))
|
||||||
return nil, aerrors.Wrap(aerr, "not enough gas for method invocation")
|
|
||||||
}
|
|
||||||
|
|
||||||
toActor, err := st.GetActor(msg.To)
|
toActor, err := st.GetActor(msg.To)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if xerrors.Is(err, init_.ErrAddressNotFound) {
|
if xerrors.Is(err, init_.ErrAddressNotFound) {
|
||||||
@ -237,6 +233,11 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if aerr := rt.chargeGasSafe(rt.Pricelist().OnMethodInvocation(msg.Value, msg.Method)); aerr != nil {
|
||||||
|
return nil, aerrors.Wrap(aerr, "not enough gas for method invocation")
|
||||||
|
}
|
||||||
|
defer rt.chargeGasSafe(newGasCharge("OnMethodInvocationDone", 0, 0))
|
||||||
|
|
||||||
if types.BigCmp(msg.Value, types.NewInt(0)) != 0 {
|
if types.BigCmp(msg.Value, types.NewInt(0)) != 0 {
|
||||||
if err := vm.transfer(msg.From, msg.To, msg.Value); err != nil {
|
if err := vm.transfer(msg.From, msg.To, msg.Value); err != nil {
|
||||||
return nil, aerrors.Wrap(err, "failed to transfer funds")
|
return nil, aerrors.Wrap(err, "failed to transfer funds")
|
||||||
@ -247,7 +248,6 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
|||||||
var ret []byte
|
var ret []byte
|
||||||
_ = rt.chargeGasSafe(gasOnActorExec)
|
_ = rt.chargeGasSafe(gasOnActorExec)
|
||||||
ret, err := vm.Invoke(toActor, rt, msg.Method, msg.Params)
|
ret, err := vm.Invoke(toActor, rt, msg.Method, msg.Params)
|
||||||
_ = rt.chargeGasSafe(newGasCharge("OnActorExecDone", 0, 0))
|
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@ -441,6 +441,9 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet,
|
|||||||
return nil, xerrors.Errorf("revert state failed: %w", err)
|
return nil, xerrors.Errorf("revert state failed: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rt.finilizeGasTracing()
|
||||||
|
|
||||||
gasUsed = rt.gasUsed
|
gasUsed = rt.gasUsed
|
||||||
if gasUsed < 0 {
|
if gasUsed < 0 {
|
||||||
gasUsed = 0
|
gasUsed = 0
|
||||||
@ -460,8 +463,6 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet,
|
|||||||
return nil, xerrors.Errorf("gas handling math is wrong")
|
return nil, xerrors.Errorf("gas handling math is wrong")
|
||||||
}
|
}
|
||||||
|
|
||||||
rt.finilizeGasTracing()
|
|
||||||
|
|
||||||
return &ApplyRet{
|
return &ApplyRet{
|
||||||
MessageReceipt: types.MessageReceipt{
|
MessageReceipt: types.MessageReceipt{
|
||||||
ExitCode: errcode,
|
ExitCode: errcode,
|
||||||
|
@ -935,7 +935,7 @@ var slashConsensusFault = &cli.Command{
|
|||||||
From: def,
|
From: def,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
GasLimit: 10000000,
|
GasLimit: 100_000_000,
|
||||||
Method: builtin.MethodsMiner.ReportConsensusFault,
|
Method: builtin.MethodsMiner.ReportConsensusFault,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ var sendCmd = &cli.Command{
|
|||||||
From: fromAddr,
|
From: fromAddr,
|
||||||
To: toAddr,
|
To: toAddr,
|
||||||
Value: types.BigInt(val),
|
Value: types.BigInt(val),
|
||||||
GasLimit: 10000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: gp,
|
GasPrice: gp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ func sendSmallFundsTxs(ctx context.Context, api api.FullNode, from address.Addre
|
|||||||
From: from,
|
From: from,
|
||||||
To: sendSet[rand.Intn(20)],
|
To: sendSet[rand.Intn(20)],
|
||||||
Value: types.NewInt(1),
|
Value: types.NewInt(1),
|
||||||
GasLimit: 100000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,16 +405,19 @@ func getExtras(ex interface{}) (*string, *float64) {
|
|||||||
func tallyGasCharges(charges map[string]*stats, et types.ExecutionTrace) {
|
func tallyGasCharges(charges map[string]*stats, et types.ExecutionTrace) {
|
||||||
for i, gc := range et.GasCharges {
|
for i, gc := range et.GasCharges {
|
||||||
name := gc.Name
|
name := gc.Name
|
||||||
if name == "OnIpldGetStart" {
|
if name == "OnIpldGetEnd" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tt := float64(gc.TimeTaken.Nanoseconds())
|
tt := float64(gc.TimeTaken.Nanoseconds())
|
||||||
if name == "OnIpldGet" {
|
if name == "OnIpldGet" {
|
||||||
prev := et.GasCharges[i-1]
|
next := &types.GasTrace{}
|
||||||
if prev.Name != "OnIpldGetStart" {
|
if i+1 < len(et.GasCharges) {
|
||||||
log.Warn("OnIpldGet without OnIpldGetStart")
|
next = et.GasCharges[i+1]
|
||||||
}
|
}
|
||||||
tt += float64(prev.TimeTaken.Nanoseconds())
|
if next.Name != "OnIpldGetEnd" {
|
||||||
|
log.Warn("OnIpldGet without OnIpldGetEnd")
|
||||||
|
}
|
||||||
|
tt += float64(next.TimeTaken.Nanoseconds())
|
||||||
}
|
}
|
||||||
eType, eSize := getExtras(gc.Extra)
|
eType, eSize := getExtras(gc.Extra)
|
||||||
if eType != nil {
|
if eType != nil {
|
||||||
@ -604,7 +607,7 @@ var importAnalyzeCmd = &cli.Command{
|
|||||||
timeInActors := actorExec.timeTaken.Mean() * actorExec.timeTaken.n
|
timeInActors := actorExec.timeTaken.Mean() * actorExec.timeTaken.n
|
||||||
fmt.Printf("Avarage time per epoch in actors: %s (%.1f%%)\n", time.Duration(timeInActors)/time.Duration(totalTipsets), timeInActors/float64(totalTime)*100)
|
fmt.Printf("Avarage time per epoch in actors: %s (%.1f%%)\n", time.Duration(timeInActors)/time.Duration(totalTipsets), timeInActors/float64(totalTime)*100)
|
||||||
}
|
}
|
||||||
if actorExecDone, ok := charges["OnActorExecDone"]; ok {
|
if actorExecDone, ok := charges["OnMethodInvocationDone"]; ok {
|
||||||
timeInActors := actorExecDone.timeTaken.Mean() * actorExecDone.timeTaken.n
|
timeInActors := actorExecDone.timeTaken.Mean() * actorExecDone.timeTaken.n
|
||||||
fmt.Printf("Avarage time per epoch in OnActorExecDone %s (%.1f%%)\n", time.Duration(timeInActors)/time.Duration(totalTipsets), timeInActors/float64(totalTime)*100)
|
fmt.Printf("Avarage time per epoch in OnActorExecDone %s (%.1f%%)\n", time.Duration(timeInActors)/time.Duration(totalTipsets), timeInActors/float64(totalTime)*100)
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) {
|
|||||||
To: to,
|
To: to,
|
||||||
|
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: 10000,
|
GasLimit: 100_000_000,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
@ -355,7 +355,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
|
|||||||
To: owner,
|
To: owner,
|
||||||
|
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: 10000,
|
GasLimit: 100_000_000,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
@ -391,7 +391,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
|
|||||||
Method: builtin.MethodsPower.CreateMiner,
|
Method: builtin.MethodsPower.CreateMiner,
|
||||||
Params: params,
|
Params: params,
|
||||||
|
|
||||||
GasLimit: 10000000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ var noncefix = &cli.Command{
|
|||||||
From: addr,
|
From: addr,
|
||||||
To: addr,
|
To: addr,
|
||||||
Value: types.NewInt(1),
|
Value: types.NewInt(1),
|
||||||
GasLimit: 10000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
Nonce: i,
|
Nonce: i,
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ var verifRegAddVerifierCmd = &cli.Command{
|
|||||||
From: fromk,
|
From: fromk,
|
||||||
Method: builtin.MethodsVerifiedRegistry.AddVerifier,
|
Method: builtin.MethodsVerifiedRegistry.AddVerifier,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
GasLimit: 300000,
|
GasLimit: 100_000_000,
|
||||||
Params: params,
|
Params: params,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ var verifRegVerifyClientCmd = &cli.Command{
|
|||||||
From: fromk,
|
From: fromk,
|
||||||
Method: builtin.MethodsVerifiedRegistry.AddVerifiedClient,
|
Method: builtin.MethodsVerifiedRegistry.AddVerifiedClient,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
GasLimit: 300000,
|
GasLimit: 100_000_000,
|
||||||
Params: params,
|
Params: params,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
|
|||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: gasPrice,
|
GasPrice: gasPrice,
|
||||||
GasLimit: 99999999,
|
GasLimit: 100_000_000,
|
||||||
}
|
}
|
||||||
|
|
||||||
smsg, err := api.MpoolPushMessage(ctx, msg)
|
smsg, err := api.MpoolPushMessage(ctx, msg)
|
||||||
@ -636,7 +636,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
|
|||||||
Method: builtin.MethodsPower.CreateMiner,
|
Method: builtin.MethodsPower.CreateMiner,
|
||||||
Params: params,
|
Params: params,
|
||||||
|
|
||||||
GasLimit: 10000000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: gasPrice,
|
GasPrice: gasPrice,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
go.mod
4
go.mod
@ -15,7 +15,7 @@ require (
|
|||||||
github.com/drand/drand v1.0.3-0.20200714175734-29705eaf09d4
|
github.com/drand/drand v1.0.3-0.20200714175734-29705eaf09d4
|
||||||
github.com/drand/kyber v1.1.1
|
github.com/drand/kyber v1.1.1
|
||||||
github.com/fatih/color v1.8.0
|
github.com/fatih/color v1.8.0
|
||||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200713102302-1bc823b1e01d
|
github.com/filecoin-project/chain-validation v0.0.6-0.20200713115604-652494bba69e
|
||||||
github.com/filecoin-project/filecoin-ffi v0.26.1-0.20200508175440-05b30afeb00d
|
github.com/filecoin-project/filecoin-ffi v0.26.1-0.20200508175440-05b30afeb00d
|
||||||
github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef
|
github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef
|
||||||
github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200424220931-6263827e49f2
|
github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200424220931-6263827e49f2
|
||||||
@ -32,7 +32,7 @@ require (
|
|||||||
github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15
|
github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15
|
||||||
github.com/filecoin-project/specs-actors v0.7.2
|
github.com/filecoin-project/specs-actors v0.7.2
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea
|
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea
|
||||||
github.com/filecoin-project/storage-fsm v0.0.0-20200712045002-6e92d6a6f080
|
github.com/filecoin-project/storage-fsm v0.0.0-20200715191202-7e92e888bf41
|
||||||
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
|
||||||
github.com/go-kit/kit v0.10.0
|
github.com/go-kit/kit v0.10.0
|
||||||
github.com/go-ole/go-ole v1.2.4 // indirect
|
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||||
|
10
go.sum
10
go.sum
@ -215,8 +215,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
|
|||||||
github.com/fatih/color v1.8.0 h1:5bzFgL+oy7JITMTxUPJ00n7VxmYd/PdMp5mHFX40/RY=
|
github.com/fatih/color v1.8.0 h1:5bzFgL+oy7JITMTxUPJ00n7VxmYd/PdMp5mHFX40/RY=
|
||||||
github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8=
|
github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8=
|
||||||
github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E=
|
github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E=
|
||||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200713102302-1bc823b1e01d h1:6mOOHCn8iJfWPRELM7LPE4X9mBmCTvQORsgzsA/u0Wg=
|
github.com/filecoin-project/chain-validation v0.0.6-0.20200713115604-652494bba69e h1:oCdk3QSDcHu3l6dWpZcHhaUVz5RQi1mXNyv8hgcK1zA=
|
||||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200713102302-1bc823b1e01d/go.mod h1:293UFGwKduXCuIC2/5pIepH7lof+L9fNiPku/+arST4=
|
github.com/filecoin-project/chain-validation v0.0.6-0.20200713115604-652494bba69e/go.mod h1:293UFGwKduXCuIC2/5pIepH7lof+L9fNiPku/+arST4=
|
||||||
github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
||||||
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
||||||
github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef h1:Wi5E+P1QfHP8IF27eUiTx5vYfqQZwfPxzq3oFEq8w8U=
|
github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef h1:Wi5E+P1QfHP8IF27eUiTx5vYfqQZwfPxzq3oFEq8w8U=
|
||||||
@ -258,8 +258,6 @@ github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZO
|
|||||||
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b h1:fkRZSPrYpk42PV3/lIXiL0LHetxde7vyYYvSsttQtfg=
|
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b h1:fkRZSPrYpk42PV3/lIXiL0LHetxde7vyYYvSsttQtfg=
|
||||||
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b/go.mod h1:Q0GQOBtKf1oE10eSXSlhN45kDBdGvEcVOqMiffqX+N8=
|
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b/go.mod h1:Q0GQOBtKf1oE10eSXSlhN45kDBdGvEcVOqMiffqX+N8=
|
||||||
github.com/filecoin-project/sector-storage v0.0.0-20200615154852-728a47ab99d6/go.mod h1:M59QnAeA/oV+Z8oHFLoNpGMv0LZ8Rll+vHVXX7GirPM=
|
github.com/filecoin-project/sector-storage v0.0.0-20200615154852-728a47ab99d6/go.mod h1:M59QnAeA/oV+Z8oHFLoNpGMv0LZ8Rll+vHVXX7GirPM=
|
||||||
github.com/filecoin-project/sector-storage v0.0.0-20200625154333-98ef8e4ef246 h1:NfYQRmVRe0LzlNbK5Ket3vbBOwFD5TvtcNtfo/Sd8mg=
|
|
||||||
github.com/filecoin-project/sector-storage v0.0.0-20200625154333-98ef8e4ef246/go.mod h1:8f0hWDzzIi1hKs4IVKH9RnDsO4LEHVz8BNat0okDOuY=
|
|
||||||
github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15 h1:miw6hiusb/MkV1ryoqUKKWnvHhPW00AYtyeCj0L8pqo=
|
github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15 h1:miw6hiusb/MkV1ryoqUKKWnvHhPW00AYtyeCj0L8pqo=
|
||||||
github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15/go.mod h1:salgVdX7qeXFo/xaiEQE29J4pPkjn71T0kt0n+VDBzo=
|
github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15/go.mod h1:salgVdX7qeXFo/xaiEQE29J4pPkjn71T0kt0n+VDBzo=
|
||||||
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA=
|
||||||
@ -274,8 +272,8 @@ github.com/filecoin-project/specs-storage v0.1.0 h1:PkDgTOT5W5Ao7752onjDl4QSv+sg
|
|||||||
github.com/filecoin-project/specs-storage v0.1.0/go.mod h1:Pr5ntAaxsh+sLG/LYiL4tKzvA83Vk5vLODYhfNwOg7k=
|
github.com/filecoin-project/specs-storage v0.1.0/go.mod h1:Pr5ntAaxsh+sLG/LYiL4tKzvA83Vk5vLODYhfNwOg7k=
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea h1:iixjULRQFPn7Q9KlIqfwLJnlAXO10bbkI+xy5GKGdLY=
|
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea h1:iixjULRQFPn7Q9KlIqfwLJnlAXO10bbkI+xy5GKGdLY=
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea/go.mod h1:Pr5ntAaxsh+sLG/LYiL4tKzvA83Vk5vLODYhfNwOg7k=
|
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea/go.mod h1:Pr5ntAaxsh+sLG/LYiL4tKzvA83Vk5vLODYhfNwOg7k=
|
||||||
github.com/filecoin-project/storage-fsm v0.0.0-20200712045002-6e92d6a6f080 h1:WZonjI7/GFLi4NxziBCefS9x7bm8S405RWkmFuDfRLA=
|
github.com/filecoin-project/storage-fsm v0.0.0-20200715191202-7e92e888bf41 h1:K2DI5+IKuY0cOjX/r1Agy6rYcAhU89LVNOjutCUib4g=
|
||||||
github.com/filecoin-project/storage-fsm v0.0.0-20200712045002-6e92d6a6f080/go.mod h1:SXO4VnXG056B/lXHL8HZv54eMqlsyynm+v93BlLwlOY=
|
github.com/filecoin-project/storage-fsm v0.0.0-20200715191202-7e92e888bf41/go.mod h1:TDNjb0HYG2fppxWH5EsiNCZu97iJZNuPYmivSK13Ao0=
|
||||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||||
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 h1:u/UEqS66A5ckRmS4yNpjmVH56sVtS/RfclBAYocb4as=
|
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 h1:u/UEqS66A5ckRmS4yNpjmVH56sVtS/RfclBAYocb4as=
|
||||||
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
|
github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
|
||||||
|
@ -138,7 +138,7 @@ func (c *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address,
|
|||||||
From: addr,
|
From: addr,
|
||||||
Value: amount,
|
Value: amount,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: 1000000,
|
GasLimit: 200_000_000,
|
||||||
Method: builtin.MethodsMarket.AddBalance,
|
Method: builtin.MethodsMarket.AddBalance,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -78,7 +78,7 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
|
|||||||
From: mi.Worker,
|
From: mi.Worker,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: 1000000,
|
GasLimit: 600_000_000,
|
||||||
Method: builtin.MethodsMarket.PublishStorageDeals,
|
Method: builtin.MethodsMarket.PublishStorageDeals,
|
||||||
Params: params,
|
Params: params,
|
||||||
})
|
})
|
||||||
@ -175,7 +175,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address
|
|||||||
From: addr,
|
From: addr,
|
||||||
Value: amount,
|
Value: amount,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: 1000000,
|
GasLimit: 200_000_000,
|
||||||
Method: builtin.MethodsMarket.AddBalance,
|
Method: builtin.MethodsMarket.AddBalance,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func mustIDAddr(i uint64) address.Address {
|
func mustIDAddr(i uint64) address.Address {
|
||||||
@ -26,11 +27,11 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
actors := map[address.Address]*types.Actor{
|
actors := map[address.Address]*types.Actor{
|
||||||
a1: {
|
a1: {
|
||||||
Nonce: 3,
|
Nonce: 3,
|
||||||
Balance: types.NewInt(1200),
|
Balance: types.FromFil(1200),
|
||||||
},
|
},
|
||||||
a2: {
|
a2: {
|
||||||
Nonce: 1,
|
Nonce: 1,
|
||||||
Balance: types.NewInt(1000),
|
Balance: types.FromFil(1000),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,39 +44,39 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
From: a1,
|
From: a1,
|
||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 3,
|
Nonce: 3,
|
||||||
Value: types.NewInt(500),
|
Value: types.FromFil(500),
|
||||||
GasLimit: 50,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
From: a1,
|
From: a1,
|
||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 4,
|
Nonce: 4,
|
||||||
Value: types.NewInt(500),
|
Value: types.FromFil(500),
|
||||||
GasLimit: 50,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
From: a2,
|
From: a2,
|
||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 1,
|
Nonce: 1,
|
||||||
Value: types.NewInt(800),
|
Value: types.FromFil(800),
|
||||||
GasLimit: 100,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
From: a2,
|
From: a2,
|
||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 0,
|
Nonce: 0,
|
||||||
Value: types.NewInt(800),
|
Value: types.FromFil(800),
|
||||||
GasLimit: 100,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
From: a2,
|
From: a2,
|
||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 2,
|
Nonce: 2,
|
||||||
Value: types.NewInt(150),
|
Value: types.FromFil(150),
|
||||||
GasLimit: 100,
|
GasLimit: 100,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
@ -86,9 +87,7 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(outmsgs) != 3 {
|
assert.Len(t, outmsgs, 3, "filtering didnt work as expected")
|
||||||
t.Fatal("filtering didnt work as expected")
|
|
||||||
}
|
|
||||||
|
|
||||||
was, expected := outmsgs[0].Message, msgs[2]
|
was, expected := outmsgs[0].Message, msgs[2]
|
||||||
if was.From != expected.From || was.Nonce != expected.Nonce {
|
if was.From != expected.From || was.Nonce != expected.Nonce {
|
||||||
|
@ -90,6 +90,12 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message) (*t
|
|||||||
if msg.Nonce != 0 {
|
if msg.Nonce != 0 {
|
||||||
return nil, xerrors.Errorf("MpoolPushMessage expects message nonce to be 0, was %d", msg.Nonce)
|
return nil, xerrors.Errorf("MpoolPushMessage expects message nonce to be 0, was %d", msg.Nonce)
|
||||||
}
|
}
|
||||||
|
if msg.GasLimit == 0 {
|
||||||
|
msg.GasLimit = 100_000_000 // TODO: gas limit estimation
|
||||||
|
}
|
||||||
|
if types.BigCmp(msg.GasPrice, types.NewInt(0)) == 0 {
|
||||||
|
msg.GasPrice = types.NewInt(1) // TODO: gas price estimation
|
||||||
|
}
|
||||||
|
|
||||||
return a.Mpool.PushWithNonce(ctx, msg.From, func(from address.Address, nonce uint64) (*types.SignedMessage, error) {
|
return a.Mpool.PushWithNonce(ctx, msg.From, func(from address.Address, nonce uint64) (*types.SignedMessage, error) {
|
||||||
msg.Nonce = nonce
|
msg.Nonce = nonce
|
||||||
|
@ -76,7 +76,7 @@ func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Ad
|
|||||||
Method: builtin.MethodsInit.Exec,
|
Method: builtin.MethodsInit.Exec,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasPrice: gp,
|
GasPrice: gp,
|
||||||
GasLimit: 1000000,
|
GasLimit: 100_000_000,
|
||||||
Value: val,
|
Value: val,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ func (a *MsigAPI) MsigPropose(ctx context.Context, msig address.Address, to addr
|
|||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
Method: builtin.MethodsMultisig.Propose,
|
Method: builtin.MethodsMultisig.Propose,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: 100000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ func (a *MsigAPI) msigApproveOrCancel(ctx context.Context, operation api.MsigPro
|
|||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
Method: msigResponseMethod,
|
Method: msigResponseMethod,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: 100000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +779,7 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
|||||||
From: maddr,
|
From: maddr,
|
||||||
To: builtin.StorageMarketActorAddr,
|
To: builtin.StorageMarketActorAddr,
|
||||||
Method: builtin.MethodsMarket.VerifyDealsForActivation,
|
Method: builtin.MethodsMarket.VerifyDealsForActivation,
|
||||||
GasLimit: 100000000000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
Params: params,
|
Params: params,
|
||||||
}, ts)
|
}, ts)
|
||||||
|
@ -125,7 +125,7 @@ func (a *PaychAPI) PaychClose(ctx context.Context, addr address.Address) (cid.Ci
|
|||||||
Method: builtin.MethodsPaych.Settle,
|
Method: builtin.MethodsPaych.Settle,
|
||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
|
|
||||||
GasLimit: 10000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ func (a *PaychAPI) PaychVoucherSubmit(ctx context.Context, ch address.Address, s
|
|||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
Method: builtin.MethodsPaych.UpdateChannelState,
|
Method: builtin.MethodsPaych.UpdateChannelState,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: 100000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ func testStorageNode(ctx context.Context, t *testing.T, waddr address.Address, a
|
|||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: 1000000,
|
GasLimit: 100_000_000,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = tnd.MpoolPushMessage(ctx, msg)
|
_, err = tnd.MpoolPushMessage(ctx, msg)
|
||||||
|
@ -37,7 +37,7 @@ func (pm *Manager) createPaych(ctx context.Context, from, to address.Address, am
|
|||||||
Value: amt,
|
Value: amt,
|
||||||
Method: builtin.MethodsInit.Exec,
|
Method: builtin.MethodsInit.Exec,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: 1000000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ func (pm *Manager) addFunds(ctx context.Context, ch address.Address, from addres
|
|||||||
From: from,
|
From: from,
|
||||||
Value: amt,
|
Value: amt,
|
||||||
Method: 0,
|
Method: 0,
|
||||||
GasLimit: 1000000,
|
GasLimit: 100_000_000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
|
|||||||
From: maddr,
|
From: maddr,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: 9999999999,
|
GasLimit: 100_000_000,
|
||||||
Method: builtin.MethodsMarket.ComputeDataCommitment,
|
Method: builtin.MethodsMarket.ComputeDataCommitment,
|
||||||
Params: ccparams,
|
Params: ccparams,
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, deadline
|
|||||||
Method: builtin.MethodsMiner.DeclareFaultsRecovered,
|
Method: builtin.MethodsMiner.DeclareFaultsRecovered,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasLimit: 10000000, // i dont know help
|
GasLimit: 100_000_000, // i dont know help
|
||||||
GasPrice: types.NewInt(2),
|
GasPrice: types.NewInt(2),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, deadline uint
|
|||||||
Method: builtin.MethodsMiner.DeclareFaults,
|
Method: builtin.MethodsMiner.DeclareFaults,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0), // TODO: Is there a fee?
|
Value: types.NewInt(0), // TODO: Is there a fee?
|
||||||
GasLimit: 10000000, // i dont know help
|
GasLimit: 100_000_000, // i dont know help
|
||||||
GasPrice: types.NewInt(2),
|
GasPrice: types.NewInt(2),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user