Delete GasPrice from this world

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
Jakub Sztandera
2020-08-06 23:08:42 +02:00
parent 4004c657b9
commit ab08858b45
37 changed files with 205 additions and 220 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ type GasAPI struct {
const MinGasPrice = 1
func (a *GasAPI) GasEstimateGasPrice(ctx context.Context, nblocksincl uint64,
func (a *GasAPI) GasEsitmateGasPremium(ctx context.Context, nblocksincl uint64,
sender address.Address, gaslimit int64, tsk types.TipSetKey) (types.BigInt, error) {
if nblocksincl == 0 {
@@ -68,7 +68,7 @@ func (a *GasAPI) GasEstimateGasPrice(ctx context.Context, nblocksincl uint64,
}
prices = append(prices, gasMeta{
price: msg.VMMessage().GasPrice,
price: msg.VMMessage().GasPremium,
used: r.GasUsed,
})
gasUsed += r.GasUsed
+3 -3
View File
@@ -112,12 +112,12 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message) (*t
msg.GasLimit = int64(float64(gasLimit) * GasMargin)
}
if msg.GasPrice == types.EmptyInt || types.BigCmp(msg.GasPrice, types.NewInt(0)) == 0 {
gasPrice, err := a.GasEstimateGasPrice(ctx, 2, msg.From, msg.GasLimit, types.TipSetKey{})
if msg.GasPremium == types.EmptyInt || types.BigCmp(msg.GasPremium, types.NewInt(0)) == 0 {
gasPrice, err := a.GasEsitmateGasPremium(ctx, 2, msg.From, msg.GasLimit, types.TipSetKey{})
if err != nil {
return nil, xerrors.Errorf("estimating gas price: %w", err)
}
msg.GasPrice = gasPrice
msg.GasPremium = gasPrice
}
if msg.GasPremium == types.EmptyInt || types.BigCmp(msg.GasPremium, types.NewInt(0)) == 0 {
msg.GasPremium = types.NewInt(100)
+5 -10
View File
@@ -45,10 +45,6 @@ func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Ad
return cid.Undef, xerrors.Errorf("must provide source address")
}
if gp == types.EmptyInt {
gp = types.NewInt(0)
}
// Set up constructor parameters for multisig
msigParams := &samsig.ConstructorParams{
Signers: addrs,
@@ -74,12 +70,11 @@ func (a *MsigAPI) MsigCreate(ctx context.Context, req uint64, addrs []address.Ad
// now we create the message to send this with
msg := types.Message{
To: builtin.InitActorAddr,
From: src,
Method: builtin.MethodsInit.Exec,
Params: enc,
Value: val,
GasPrice: gp,
To: builtin.InitActorAddr,
From: src,
Method: builtin.MethodsInit.Exec,
Params: enc,
Value: val,
}
// send the message out to the network
+8 -12
View File
@@ -968,12 +968,10 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
}
ret, err := a.StateManager.Call(ctx, &types.Message{
From: maddr,
To: builtin.StorageMarketActorAddr,
Method: builtin.MethodsMarket.VerifyDealsForActivation,
GasLimit: 0,
GasPrice: types.NewInt(0),
Params: params,
From: maddr,
To: builtin.StorageMarketActorAddr,
Method: builtin.MethodsMarket.VerifyDealsForActivation,
Params: params,
}, ts)
if err != nil {
return types.EmptyInt, err
@@ -1048,12 +1046,10 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
}
ret, err := a.StateManager.Call(ctx, &types.Message{
From: maddr,
To: builtin.StorageMarketActorAddr,
Method: builtin.MethodsMarket.VerifyDealsForActivation,
GasLimit: 0,
GasPrice: types.NewInt(0),
Params: params,
From: maddr,
To: builtin.StorageMarketActorAddr,
Method: builtin.MethodsMarket.VerifyDealsForActivation,
Params: params,
}, ts)
if err != nil {
return types.EmptyInt, err