Merge pull request #1421 from filecoin-project/fix/gas-limit-type
change gas limit to be a normal int64
This commit is contained in:
commit
3676daf7dc
@ -416,7 +416,7 @@ func getRandomMessages(cg *ChainGen) ([]*types.SignedMessage, error) {
|
|||||||
|
|
||||||
Method: 0,
|
Method: 0,
|
||||||
|
|
||||||
GasLimit: types.NewInt(10000),
|
GasLimit: 10000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ func doExecValue(ctx context.Context, vm *vm.VM, to, from address.Address, value
|
|||||||
From: from,
|
From: from,
|
||||||
Method: method,
|
Method: method,
|
||||||
Params: params,
|
Params: params,
|
||||||
GasLimit: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
Value: value,
|
Value: value,
|
||||||
Nonce: act.Nonce,
|
Nonce: act.Nonce,
|
||||||
|
@ -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: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
Method: builtin.MethodsMarket.AddBalance,
|
Method: builtin.MethodsMarket.AddBalance,
|
||||||
Params: params,
|
Params: params,
|
||||||
})
|
})
|
||||||
|
@ -26,8 +26,8 @@ func (sm *StateManager) CallRaw(ctx context.Context, msg *types.Message, bstate
|
|||||||
return nil, xerrors.Errorf("failed to set up vm: %w", err)
|
return nil, xerrors.Errorf("failed to set up vm: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.GasLimit == types.EmptyInt {
|
if msg.GasLimit == 0 {
|
||||||
msg.GasLimit = types.NewInt(10000000000)
|
msg.GasLimit = 10000000000
|
||||||
}
|
}
|
||||||
if msg.GasPrice == types.EmptyInt {
|
if msg.GasPrice == types.EmptyInt {
|
||||||
msg.GasPrice = types.NewInt(0)
|
msg.GasPrice = types.NewInt(0)
|
||||||
@ -38,7 +38,7 @@ func (sm *StateManager) CallRaw(ctx context.Context, msg *types.Message, bstate
|
|||||||
|
|
||||||
if span.IsRecordingEvents() {
|
if span.IsRecordingEvents() {
|
||||||
span.AddAttributes(
|
span.AddAttributes(
|
||||||
trace.Int64Attribute("gas_limit", int64(msg.GasLimit.Uint64())),
|
trace.Int64Attribute("gas_limit", msg.GasLimit),
|
||||||
trace.Int64Attribute("gas_price", int64(msg.GasPrice.Uint64())),
|
trace.Int64Attribute("gas_price", int64(msg.GasPrice.Uint64())),
|
||||||
trace.StringAttribute("value", msg.Value.String()),
|
trace.StringAttribute("value", msg.Value.String()),
|
||||||
)
|
)
|
||||||
|
@ -181,7 +181,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: types.NewInt(10000),
|
GasLimit: 10000,
|
||||||
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())
|
||||||
@ -208,7 +208,7 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
Method: 2,
|
Method: 2,
|
||||||
Params: nil,
|
Params: nil,
|
||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
GasLimit: types.NewInt(10000),
|
GasLimit: 10000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
nonce++
|
nonce++
|
||||||
|
@ -228,7 +228,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, pstate cid.Cid, bms []B
|
|||||||
Nonce: sysAct.Nonce,
|
Nonce: sysAct.Nonce,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(1 << 30),
|
GasLimit: 1 << 30,
|
||||||
Method: builtin.MethodsReward.AwardBlockReward,
|
Method: builtin.MethodsReward.AwardBlockReward,
|
||||||
Params: params,
|
Params: params,
|
||||||
}
|
}
|
||||||
@ -260,7 +260,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, pstate cid.Cid, bms []B
|
|||||||
Nonce: ca.Nonce,
|
Nonce: ca.Nonce,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(1 << 30), // Make super sure this is never too little
|
GasLimit: 1 << 30, // Make super sure this is never too little
|
||||||
Method: builtin.MethodsCron.EpochTick,
|
Method: builtin.MethodsCron.EpochTick,
|
||||||
Params: nil,
|
Params: nil,
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,8 @@ func (cs *ChainStore) call(ctx context.Context, msg *types.Message, ts *types.Ti
|
|||||||
return nil, xerrors.Errorf("failed to set up vm: %w", err)
|
return nil, xerrors.Errorf("failed to set up vm: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.GasLimit == types.EmptyInt {
|
if msg.GasLimit == 0 {
|
||||||
msg.GasLimit = types.NewInt(10000000000)
|
msg.GasLimit = 10000000000
|
||||||
}
|
}
|
||||||
if msg.GasPrice == types.EmptyInt {
|
if msg.GasPrice == types.EmptyInt {
|
||||||
msg.GasPrice = types.NewInt(0)
|
msg.GasPrice = types.NewInt(0)
|
||||||
|
@ -656,9 +656,15 @@ func (t *Message) MarshalCBOR(w io.Writer) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// t.GasLimit (big.Int) (struct)
|
// t.GasLimit (int64) (int64)
|
||||||
if err := t.GasLimit.MarshalCBOR(w); err != nil {
|
if t.GasLimit >= 0 {
|
||||||
return err
|
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.GasLimit))); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajNegativeInt, uint64(-t.GasLimit)-1)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// t.Method (abi.MethodNum) (uint64)
|
// t.Method (abi.MethodNum) (uint64)
|
||||||
@ -746,14 +752,30 @@ func (t *Message) UnmarshalCBOR(r io.Reader) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// t.GasLimit (big.Int) (struct)
|
// t.GasLimit (int64) (int64)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
maj, extra, err := cbg.CborReadHeader(br)
|
||||||
if err := t.GasLimit.UnmarshalCBOR(br); err != nil {
|
var extraI int64
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
switch maj {
|
||||||
|
case cbg.MajUnsignedInt:
|
||||||
|
extraI = int64(extra)
|
||||||
|
if extraI < 0 {
|
||||||
|
return fmt.Errorf("int64 positive overflow")
|
||||||
|
}
|
||||||
|
case cbg.MajNegativeInt:
|
||||||
|
extraI = int64(extra)
|
||||||
|
if extraI < 0 {
|
||||||
|
return fmt.Errorf("int64 negative oveflow")
|
||||||
|
}
|
||||||
|
extraI = -1 - extraI
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("wrong type for int64 field: %d", maj)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.GasLimit = int64(extraI)
|
||||||
}
|
}
|
||||||
// t.Method (abi.MethodNum) (uint64)
|
// t.Method (abi.MethodNum) (uint64)
|
||||||
|
|
||||||
@ -1043,9 +1065,15 @@ func (t *MessageReceipt) MarshalCBOR(w io.Writer) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// t.GasUsed (big.Int) (struct)
|
// t.GasUsed (int64) (int64)
|
||||||
if err := t.GasUsed.MarshalCBOR(w); err != nil {
|
if t.GasUsed >= 0 {
|
||||||
return err
|
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajUnsignedInt, uint64(t.GasUsed))); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if _, err := w.Write(cbg.CborEncodeMajorType(cbg.MajNegativeInt, uint64(-t.GasUsed)-1)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1107,14 +1135,30 @@ func (t *MessageReceipt) UnmarshalCBOR(r io.Reader) error {
|
|||||||
if _, err := io.ReadFull(br, t.Return); err != nil {
|
if _, err := io.ReadFull(br, t.Return); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// t.GasUsed (big.Int) (struct)
|
// t.GasUsed (int64) (int64)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
maj, extra, err := cbg.CborReadHeader(br)
|
||||||
if err := t.GasUsed.UnmarshalCBOR(br); err != nil {
|
var extraI int64
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
switch maj {
|
||||||
|
case cbg.MajUnsignedInt:
|
||||||
|
extraI = int64(extra)
|
||||||
|
if extraI < 0 {
|
||||||
|
return fmt.Errorf("int64 positive overflow")
|
||||||
|
}
|
||||||
|
case cbg.MajNegativeInt:
|
||||||
|
extraI = int64(extra)
|
||||||
|
if extraI < 0 {
|
||||||
|
return fmt.Errorf("int64 negative oveflow")
|
||||||
|
}
|
||||||
|
extraI = -1 - extraI
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("wrong type for int64 field: %d", maj)
|
||||||
|
}
|
||||||
|
|
||||||
|
t.GasUsed = int64(extraI)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ type Message struct {
|
|||||||
Value BigInt
|
Value BigInt
|
||||||
|
|
||||||
GasPrice BigInt
|
GasPrice BigInt
|
||||||
GasLimit BigInt
|
GasLimit int64
|
||||||
|
|
||||||
Method abi.MethodNum
|
Method abi.MethodNum
|
||||||
Params []byte
|
Params []byte
|
||||||
@ -87,7 +87,7 @@ func (m *Message) Cid() cid.Cid {
|
|||||||
func (m *Message) RequiredFunds() BigInt {
|
func (m *Message) RequiredFunds() BigInt {
|
||||||
return BigAdd(
|
return BigAdd(
|
||||||
m.Value,
|
m.Value,
|
||||||
BigMul(m.GasPrice, m.GasLimit),
|
BigMul(m.GasPrice, NewInt(uint64(m.GasLimit))),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ import (
|
|||||||
type MessageReceipt struct {
|
type MessageReceipt struct {
|
||||||
ExitCode exitcode.ExitCode
|
ExitCode exitcode.ExitCode
|
||||||
Return []byte
|
Return []byte
|
||||||
GasUsed BigInt
|
GasUsed int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
|
func (mr *MessageReceipt) Equals(o *MessageReceipt) bool {
|
||||||
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && BigCmp(mr.GasUsed, o.GasUsed) == 0
|
return mr.ExitCode == o.ExitCode && bytes.Equal(mr.Return, o.Return) && mr.GasUsed == o.GasUsed
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ func MkMessage(from, to address.Address, nonce uint64, w *wallet.Wallet) *types.
|
|||||||
From: from,
|
From: from,
|
||||||
Value: types.NewInt(1),
|
Value: types.NewInt(1),
|
||||||
Nonce: nonce,
|
Nonce: nonce,
|
||||||
GasLimit: types.NewInt(1),
|
GasLimit: 1,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ func BenchmarkSerializeMessage(b *testing.B) {
|
|||||||
Nonce: 197,
|
Nonce: 197,
|
||||||
Method: 1231254,
|
Method: 1231254,
|
||||||
Params: []byte("some bytes, idk. probably at least ten of them"),
|
Params: []byte("some bytes, idk. probably at least ten of them"),
|
||||||
GasLimit: NewInt(126723),
|
GasLimit: 126723,
|
||||||
GasPrice: NewInt(1776234),
|
GasPrice: NewInt(1776234),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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: types.NewInt(9992969384),
|
GasLimit: 9992969384,
|
||||||
Nonce: 123123,
|
Nonce: 123123,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
|
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
|
||||||
@ -53,7 +54,7 @@ func (a *Applier) ApplyMessage(eCtx *vtypes.ExecutionContext, state vstate.VMWra
|
|||||||
mr := vtypes.MessageReceipt{
|
mr := vtypes.MessageReceipt{
|
||||||
ExitCode: exitcode.ExitCode(ret.ExitCode),
|
ExitCode: exitcode.ExitCode(ret.ExitCode),
|
||||||
ReturnValue: ret.Return,
|
ReturnValue: ret.Return,
|
||||||
GasUsed: ret.GasUsed,
|
GasUsed: big.NewInt(ret.GasUsed),
|
||||||
}
|
}
|
||||||
|
|
||||||
return mr, nil
|
return mr, nil
|
||||||
@ -91,7 +92,7 @@ func (a *Applier) ApplyTipSetMessages(state vstate.VMWrapper, blocks []vtypes.Bl
|
|||||||
ExitCode: exitcode.ExitCode(ret.ExitCode),
|
ExitCode: exitcode.ExitCode(ret.ExitCode),
|
||||||
ReturnValue: ret.Return,
|
ReturnValue: ret.Return,
|
||||||
|
|
||||||
GasUsed: ret.GasUsed,
|
GasUsed: big.NewInt(ret.GasUsed),
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -130,7 +131,7 @@ func toLotusMsg(msg *vtypes.Message) *types.Message {
|
|||||||
|
|
||||||
Value: types.BigInt{Int: msg.Value.Int},
|
Value: types.BigInt{Int: msg.Value.Int},
|
||||||
GasPrice: types.BigInt{Int: msg.GasPrice.Int},
|
GasPrice: types.BigInt{Int: msg.GasPrice.Int},
|
||||||
GasLimit: types.NewInt(uint64(msg.GasLimit)),
|
GasLimit: msg.GasLimit,
|
||||||
|
|
||||||
Params: msg.Params,
|
Params: msg.Params,
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ type Runtime struct {
|
|||||||
height abi.ChainEpoch
|
height abi.ChainEpoch
|
||||||
cst cbor.IpldStore
|
cst cbor.IpldStore
|
||||||
|
|
||||||
gasAvailable types.BigInt
|
gasAvailable int64
|
||||||
gasUsed types.BigInt
|
gasUsed int64
|
||||||
|
|
||||||
sys runtime.Syscalls
|
sys runtime.Syscalls
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ func (rt *Runtime) internalSend(to address.Address, method abi.MethodNum, value
|
|||||||
mr := types.MessageReceipt{
|
mr := types.MessageReceipt{
|
||||||
ExitCode: exitcode.ExitCode(aerrors.RetCode(errSend)),
|
ExitCode: exitcode.ExitCode(aerrors.RetCode(errSend)),
|
||||||
Return: ret,
|
Return: ret,
|
||||||
GasUsed: types.EmptyInt,
|
GasUsed: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
er := ExecutionResult{
|
er := ExecutionResult{
|
||||||
@ -421,10 +421,9 @@ func (rt *Runtime) stateCommit(oldh, newh cid.Cid) aerrors.ActorError {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rt *Runtime) ChargeGas(amount uint64) {
|
func (rt *Runtime) ChargeGas(toUse int64) {
|
||||||
toUse := types.NewInt(amount)
|
rt.gasUsed = rt.gasUsed + toUse
|
||||||
rt.gasUsed = types.BigAdd(rt.gasUsed, toUse)
|
if rt.gasUsed > rt.gasAvailable {
|
||||||
if rt.gasUsed.GreaterThan(rt.gasAvailable) {
|
rt.Abortf(exitcode.SysErrOutOfGas, "not enough gas: used=%d, available=%d", rt.gasUsed, rt.gasAvailable)
|
||||||
rt.Abortf(exitcode.SysErrOutOfGas, "not enough gas: used=%s, available=%s", rt.gasUsed, rt.gasAvailable)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ func ResolveToKeyAddr(state types.StateTree, cst cbor.IpldStore, addr address.Ad
|
|||||||
var _ cbor.IpldBlockstore = (*gasChargingBlocks)(nil)
|
var _ cbor.IpldBlockstore = (*gasChargingBlocks)(nil)
|
||||||
|
|
||||||
type gasChargingBlocks struct {
|
type gasChargingBlocks struct {
|
||||||
chargeGas func(uint64)
|
chargeGas func(int64)
|
||||||
under cbor.IpldBlockstore
|
under cbor.IpldBlockstore
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,13 +101,13 @@ func (bs *gasChargingBlocks) Get(c cid.Cid) (block.Block, error) {
|
|||||||
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(uint64(len(blk.RawData())) * gasGetPerByte)
|
bs.chargeGas(int64(len(blk.RawData())) * gasGetPerByte)
|
||||||
|
|
||||||
return blk, nil
|
return blk, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *gasChargingBlocks) Put(blk block.Block) error {
|
func (bs *gasChargingBlocks) Put(blk block.Block) error {
|
||||||
bs.chargeGas(gasPutObj + uint64(len(blk.RawData()))*gasPutPerByte)
|
bs.chargeGas(gasPutObj + int64(len(blk.RawData()))*gasPutPerByte)
|
||||||
|
|
||||||
if err := bs.under.Put(blk); err != nil {
|
if err := bs.under.Put(blk); err != nil {
|
||||||
return aerrors.Escalate(err, "failed to write data to disk")
|
return aerrors.Escalate(err, "failed to write data to disk")
|
||||||
@ -115,7 +115,7 @@ func (bs *gasChargingBlocks) Put(blk block.Block) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, origin address.Address, originNonce uint64, usedGas types.BigInt, icc int64) *Runtime {
|
func (vm *VM) makeRuntime(ctx context.Context, msg *types.Message, origin address.Address, originNonce uint64, usedGas int64, icc int64) *Runtime {
|
||||||
rt := &Runtime{
|
rt := &Runtime{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
vm: vm,
|
vm: vm,
|
||||||
@ -184,7 +184,7 @@ type ApplyRet struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
||||||
gasCharge uint64) ([]byte, aerrors.ActorError, *Runtime) {
|
gasCharge int64) ([]byte, aerrors.ActorError, *Runtime) {
|
||||||
|
|
||||||
st := vm.cstate
|
st := vm.cstate
|
||||||
|
|
||||||
@ -206,12 +206,12 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gasUsed := types.NewInt(gasCharge)
|
gasUsed := gasCharge
|
||||||
origin := msg.From
|
origin := msg.From
|
||||||
on := msg.Nonce
|
on := msg.Nonce
|
||||||
var icc int64 = 0
|
var icc int64 = 0
|
||||||
if parent != nil {
|
if parent != nil {
|
||||||
gasUsed = types.BigAdd(parent.gasUsed, gasUsed)
|
gasUsed = parent.gasUsed + gasUsed
|
||||||
origin = parent.origin
|
origin = parent.origin
|
||||||
on = parent.originNonce
|
on = parent.originNonce
|
||||||
icc = parent.internalCallCounter + 1
|
icc = parent.internalCallCounter + 1
|
||||||
@ -240,8 +240,11 @@ func (vm *VM) send(ctx context.Context, msg *types.Message, parent *Runtime,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkMessage(msg *types.Message) error {
|
func checkMessage(msg *types.Message) error {
|
||||||
if msg.GasLimit == types.EmptyInt {
|
if msg.GasLimit == 0 {
|
||||||
return xerrors.Errorf("message gas no gas limit set")
|
return xerrors.Errorf("message has no gas limit set")
|
||||||
|
}
|
||||||
|
if msg.GasLimit < 0 {
|
||||||
|
return xerrors.Errorf("message has negative gas limit")
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg.GasPrice == types.EmptyInt {
|
if msg.GasPrice == types.EmptyInt {
|
||||||
@ -274,8 +277,8 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("could not serialize message: %w", err)
|
return nil, xerrors.Errorf("could not serialize message: %w", err)
|
||||||
}
|
}
|
||||||
msgGasCost := uint64(len(serMsg)) * gasPerMessageByte
|
msgGasCost := int64(len(serMsg)) * gasPerMessageByte
|
||||||
if msgGasCost > msg.GasLimit.Uint64() {
|
if msgGasCost > msg.GasLimit {
|
||||||
return &ApplyRet{
|
return &ApplyRet{
|
||||||
MessageReceipt: types.MessageReceipt{
|
MessageReceipt: types.MessageReceipt{
|
||||||
ExitCode: exitcode.SysErrOutOfGas,
|
ExitCode: exitcode.SysErrOutOfGas,
|
||||||
@ -312,7 +315,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
gascost := types.BigMul(msg.GasLimit, msg.GasPrice)
|
gascost := types.BigMul(types.NewInt(uint64(msg.GasLimit)), msg.GasPrice)
|
||||||
totalCost := types.BigAdd(gascost, msg.Value)
|
totalCost := types.BigAdd(gascost, msg.Value)
|
||||||
if fromActor.Balance.LessThan(totalCost) {
|
if fromActor.Balance.LessThan(totalCost) {
|
||||||
return &ApplyRet{
|
return &ApplyRet{
|
||||||
@ -340,7 +343,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var errcode uint8
|
var errcode uint8
|
||||||
var gasUsed types.BigInt
|
var gasUsed int64
|
||||||
|
|
||||||
if errcode = aerrors.RetCode(actorErr); errcode != 0 {
|
if errcode = aerrors.RetCode(actorErr); errcode != 0 {
|
||||||
gasUsed = msg.GasLimit
|
gasUsed = msg.GasLimit
|
||||||
@ -351,7 +354,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
|
|||||||
} else {
|
} else {
|
||||||
gasUsed = rt.gasUsed
|
gasUsed = rt.gasUsed
|
||||||
// refund unused gas
|
// refund unused gas
|
||||||
refund := types.BigMul(types.BigSub(msg.GasLimit, gasUsed), msg.GasPrice)
|
refund := types.BigMul(types.NewInt(uint64(msg.GasLimit-gasUsed)), msg.GasPrice)
|
||||||
if err := Transfer(gasHolder, fromActor, refund); err != nil {
|
if err := Transfer(gasHolder, fromActor, refund); err != nil {
|
||||||
return nil, xerrors.Errorf("failed to refund gas")
|
return nil, xerrors.Errorf("failed to refund gas")
|
||||||
}
|
}
|
||||||
@ -362,7 +365,7 @@ func (vm *VM) ApplyMessage(ctx context.Context, msg *types.Message) (*ApplyRet,
|
|||||||
return nil, xerrors.Errorf("getting burnt funds actor failed: %w", err)
|
return nil, xerrors.Errorf("getting burnt funds actor failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
gasReward := types.BigMul(msg.GasPrice, gasUsed)
|
gasReward := types.BigMul(msg.GasPrice, types.NewInt(uint64(gasUsed)))
|
||||||
if err := Transfer(gasHolder, rwAct, gasReward); err != nil {
|
if err := Transfer(gasHolder, rwAct, gasReward); 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)
|
||||||
}
|
}
|
||||||
|
@ -796,7 +796,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: types.NewInt(10000000),
|
GasLimit: 10000000,
|
||||||
Method: builtin.MethodsPower.ReportConsensusFault,
|
Method: builtin.MethodsPower.ReportConsensusFault,
|
||||||
Params: params,
|
Params: params,
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ var msigCreateCmd = &cli.Command{
|
|||||||
Method: builtin.MethodsInit.Exec,
|
Method: builtin.MethodsInit.Exec,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
GasLimit: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
Value: types.BigInt(filval),
|
Value: types.BigInt(filval),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ var msigProposeCmd = &cli.Command{
|
|||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
Method: builtin.MethodsMultisig.Propose,
|
Method: builtin.MethodsMultisig.Propose,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: types.NewInt(100000),
|
GasLimit: 100000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ var msigApproveCmd = &cli.Command{
|
|||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
Method: builtin.MethodsMultisig.Approve,
|
Method: builtin.MethodsMultisig.Approve,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: types.NewInt(100000),
|
GasLimit: 100000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ var sendCmd = &cli.Command{
|
|||||||
From: fromAddr,
|
From: fromAddr,
|
||||||
To: toAddr,
|
To: toAddr,
|
||||||
Value: types.BigInt(val),
|
Value: types.BigInt(val),
|
||||||
GasLimit: types.NewInt(1000),
|
GasLimit: 1000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ var stateReplaySetCmd = &cli.Command{
|
|||||||
fmt.Println("Replay receipt:")
|
fmt.Println("Replay receipt:")
|
||||||
fmt.Printf("Exit code: %d\n", res.MsgRct.ExitCode)
|
fmt.Printf("Exit code: %d\n", res.MsgRct.ExitCode)
|
||||||
fmt.Printf("Return: %x\n", res.MsgRct.Return)
|
fmt.Printf("Return: %x\n", res.MsgRct.Return)
|
||||||
fmt.Printf("Gas Used: %s\n", res.MsgRct.GasUsed)
|
fmt.Printf("Gas Used: %d\n", res.MsgRct.GasUsed)
|
||||||
if res.MsgRct.ExitCode != 0 {
|
if res.MsgRct.ExitCode != 0 {
|
||||||
fmt.Printf("Error message: %q\n", res.Error)
|
fmt.Printf("Error message: %q\n", res.Error)
|
||||||
}
|
}
|
||||||
@ -849,7 +849,7 @@ var stateWaitMsgCmd = &cli.Command{
|
|||||||
|
|
||||||
fmt.Printf("message was executed in tipset: %s", mw.TipSet.Cids())
|
fmt.Printf("message was executed in tipset: %s", mw.TipSet.Cids())
|
||||||
fmt.Printf("Exit Code: %d", mw.Receipt.ExitCode)
|
fmt.Printf("Exit Code: %d", mw.Receipt.ExitCode)
|
||||||
fmt.Printf("Gas Used: %s", mw.Receipt.GasUsed)
|
fmt.Printf("Gas Used: %d", mw.Receipt.GasUsed)
|
||||||
fmt.Printf("Return: %x", mw.Receipt.Return)
|
fmt.Printf("Return: %x", mw.Receipt.Return)
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
@ -928,7 +928,7 @@ var stateCallCmd = &cli.Command{
|
|||||||
From: froma,
|
From: froma,
|
||||||
To: toa,
|
To: toa,
|
||||||
Value: types.BigInt(value),
|
Value: types.BigInt(value),
|
||||||
GasLimit: types.NewInt(10000000000),
|
GasLimit: 10000000000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
Method: abi.MethodNum(method),
|
Method: abi.MethodNum(method),
|
||||||
Params: params,
|
Params: params,
|
||||||
|
@ -3,11 +3,12 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
|
|
||||||
"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/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -76,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: types.NewInt(100000),
|
GasLimit: 100000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ create temp table msgs (like messages excluding constraints) on commit drop;
|
|||||||
m.Nonce,
|
m.Nonce,
|
||||||
m.Value.String(),
|
m.Value.String(),
|
||||||
m.GasPrice.String(),
|
m.GasPrice.String(),
|
||||||
m.GasLimit.String(),
|
m.GasLimit,
|
||||||
m.Method,
|
m.Method,
|
||||||
m.Params,
|
m.Params,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
@ -706,7 +706,7 @@ create temp table recs (like receipts excluding constraints) on commit drop;
|
|||||||
c.state.String(),
|
c.state.String(),
|
||||||
c.idx,
|
c.idx,
|
||||||
m.ExitCode,
|
m.ExitCode,
|
||||||
m.GasUsed.String(),
|
m.GasUsed,
|
||||||
m.Return,
|
m.Return,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -279,7 +279,7 @@ type Message struct {
|
|||||||
Value sbig
|
Value sbig
|
||||||
|
|
||||||
GasPrice sbig
|
GasPrice sbig
|
||||||
GasLimit sbig
|
GasLimit int64
|
||||||
|
|
||||||
Method abi.MethodNum
|
Method abi.MethodNum
|
||||||
Params []byte
|
Params []byte
|
||||||
@ -324,7 +324,7 @@ func (h *handler) messages(filter string, args ...interface{}) (out []types.Mess
|
|||||||
Nonce: r.Nonce,
|
Nonce: r.Nonce,
|
||||||
Value: types.BigInt(r.Value),
|
Value: types.BigInt(r.Value),
|
||||||
GasPrice: types.BigInt(r.GasPrice),
|
GasPrice: types.BigInt(r.GasPrice),
|
||||||
GasLimit: types.BigInt(r.GasLimit),
|
GasLimit: r.GasLimit,
|
||||||
Method: r.Method,
|
Method: r.Method,
|
||||||
Params: r.Params,
|
Params: r.Params,
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ func (h *handler) send(w http.ResponseWriter, r *http.Request) {
|
|||||||
To: to,
|
To: to,
|
||||||
|
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(1000),
|
GasLimit: 1000,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
@ -256,7 +256,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
|
|||||||
To: owner,
|
To: owner,
|
||||||
|
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(1000),
|
GasLimit: 1000,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
@ -285,7 +285,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
|
|||||||
Method: builtin.MethodsPower.CreateMiner,
|
Method: builtin.MethodsPower.CreateMiner,
|
||||||
Params: params,
|
Params: params,
|
||||||
|
|
||||||
GasLimit: types.NewInt(10000000),
|
GasLimit: 10000000,
|
||||||
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: types.NewInt(1000),
|
GasLimit: 1000,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
Nonce: i,
|
Nonce: i,
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
|
|||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(100000000),
|
GasLimit: 100000000,
|
||||||
}
|
}
|
||||||
|
|
||||||
smsg, err := api.MpoolPushMessage(ctx, msg)
|
smsg, err := api.MpoolPushMessage(ctx, msg)
|
||||||
@ -571,7 +571,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: types.NewInt(10000000),
|
GasLimit: 10000000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ var rewardsRedeemCmd = &cli.Command{
|
|||||||
Nonce: workerNonce,
|
Nonce: workerNonce,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
GasLimit: types.NewInt(100000),
|
GasLimit: 100000,
|
||||||
Method: builtin.MethodsReward.WithdrawReward,
|
Method: builtin.MethodsReward.WithdrawReward,
|
||||||
Params: params,
|
Params: params,
|
||||||
})
|
})
|
||||||
|
@ -124,7 +124,7 @@ func (n *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: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
Method: builtin.MethodsMarket.AddBalance,
|
Method: builtin.MethodsMarket.AddBalance,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -75,7 +75,7 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
|
|||||||
From: worker,
|
From: worker,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
Method: builtin.MethodsMarket.PublishStorageDeals,
|
Method: builtin.MethodsMarket.PublishStorageDeals,
|
||||||
Params: params,
|
Params: params,
|
||||||
})
|
})
|
||||||
@ -163,7 +163,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: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
Method: builtin.MethodsMarket.AddBalance,
|
Method: builtin.MethodsMarket.AddBalance,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -43,7 +43,7 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 3,
|
Nonce: 3,
|
||||||
Value: types.NewInt(500),
|
Value: types.NewInt(500),
|
||||||
GasLimit: types.NewInt(50),
|
GasLimit: 50,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
types.Message{
|
types.Message{
|
||||||
@ -51,7 +51,7 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 4,
|
Nonce: 4,
|
||||||
Value: types.NewInt(500),
|
Value: types.NewInt(500),
|
||||||
GasLimit: types.NewInt(50),
|
GasLimit: 50,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
types.Message{
|
types.Message{
|
||||||
@ -59,7 +59,7 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 1,
|
Nonce: 1,
|
||||||
Value: types.NewInt(800),
|
Value: types.NewInt(800),
|
||||||
GasLimit: types.NewInt(100),
|
GasLimit: 100,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
types.Message{
|
types.Message{
|
||||||
@ -67,7 +67,7 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 0,
|
Nonce: 0,
|
||||||
Value: types.NewInt(800),
|
Value: types.NewInt(800),
|
||||||
GasLimit: types.NewInt(100),
|
GasLimit: 100,
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
types.Message{
|
types.Message{
|
||||||
@ -75,7 +75,7 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
To: a1,
|
To: a1,
|
||||||
Nonce: 2,
|
Nonce: 2,
|
||||||
Value: types.NewInt(150),
|
Value: types.NewInt(150),
|
||||||
GasLimit: types.NewInt(100),
|
GasLimit: (100),
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -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: types.NewInt(500),
|
GasLimit: 500,
|
||||||
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: types.NewInt(100000),
|
GasLimit: 100000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,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: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, 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: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +84,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: types.NewInt(1000000),
|
GasLimit: 1000000,
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ func (s *FPoStScheduler) declareFaults(ctx context.Context, fc uint64, params *m
|
|||||||
Method: builtin.MethodsMiner.DeclareTemporaryFaults,
|
Method: builtin.MethodsMiner.DeclareTemporaryFaults,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(10000000), // i dont know help
|
GasLimit: 10000000, // i dont know help
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,8 +258,8 @@ func (s *FPoStScheduler) submitPost(ctx context.Context, proof *abi.OnChainPoStV
|
|||||||
From: s.worker,
|
From: s.worker,
|
||||||
Method: builtin.MethodsMiner.SubmitWindowedPoSt,
|
Method: builtin.MethodsMiner.SubmitWindowedPoSt,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late
|
Value: types.NewInt(1000), // currently hard-coded late fee in actor, returned if not late
|
||||||
GasLimit: types.NewInt(10000000), // i dont know help
|
GasLimit: 10000000, // i dont know help
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ func checkSeal(ctx context.Context, maddr address.Address, si SectorInfo, api se
|
|||||||
From: maddr,
|
From: maddr,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(9999999999),
|
GasLimit: 9999999999,
|
||||||
Method: builtin.MethodsMarket.ComputeDataCommitment,
|
Method: builtin.MethodsMarket.ComputeDataCommitment,
|
||||||
Params: ccparams,
|
Params: ccparams,
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
|
|||||||
Method: builtin.MethodsMiner.PreCommitSector,
|
Method: builtin.MethodsMiner.PreCommitSector,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
|
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
|
||||||
GasLimit: types.NewInt(1000000 /* i dont know help */),
|
GasLimit: 1000000, /* i dont know help */
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo)
|
|||||||
Method: builtin.MethodsMiner.ProveCommitSector,
|
Method: builtin.MethodsMiner.ProveCommitSector,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
|
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
|
||||||
GasLimit: types.NewInt(1000000 /* i dont know help */),
|
GasLimit: 1000000, /* i dont know help */
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ func (m *Sealing) handleFaulty(ctx statemachine.Context, sector SectorInfo) erro
|
|||||||
Method: builtin.MethodsMiner.DeclareTemporaryFaults,
|
Method: builtin.MethodsMiner.DeclareTemporaryFaults,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
|
Value: types.NewInt(0), // TODO: need to ensure sufficient collateral
|
||||||
GasLimit: types.NewInt(1000000 /* i dont know help */),
|
GasLimit: 1000000, /* i dont know help */
|
||||||
GasPrice: types.NewInt(1),
|
GasPrice: types.NewInt(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user