Delete GasPrice from this world
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
+7
-7
@@ -430,22 +430,22 @@ var chainListCmd = &cli.Command{
|
||||
psum := big.NewInt(0)
|
||||
for _, m := range msgs.BlsMessages {
|
||||
limitSum += m.GasLimit
|
||||
psum = big.Add(psum, m.GasPrice)
|
||||
psum = big.Add(psum, m.GasPremium)
|
||||
}
|
||||
|
||||
for _, m := range msgs.SecpkMessages {
|
||||
limitSum += m.Message.GasLimit
|
||||
psum = big.Add(psum, m.Message.GasPrice)
|
||||
psum = big.Add(psum, m.Message.GasPremium)
|
||||
}
|
||||
|
||||
lenmsgs := len(msgs.BlsMessages) + len(msgs.SecpkMessages)
|
||||
|
||||
avgprice := big.Zero()
|
||||
avgpremium := big.Zero()
|
||||
if lenmsgs > 0 {
|
||||
avgprice = big.Div(psum, big.NewInt(int64(lenmsgs)))
|
||||
avgpremium = big.Div(psum, big.NewInt(int64(lenmsgs)))
|
||||
}
|
||||
|
||||
fmt.Printf("\t%s: \t%d msgs, gasLimit: %d / %d (%0.2f%%), avgPrice: %s\n", b.Miner, len(msgs.BlsMessages)+len(msgs.SecpkMessages), limitSum, build.BlockGasLimit, 100*float64(limitSum)/float64(build.BlockGasLimit), avgprice)
|
||||
fmt.Printf("\t%s: \t%d msgs, gasLimit: %d / %d (%0.2f%%), avgPrice: %s\n", b.Miner, len(msgs.BlsMessages)+len(msgs.SecpkMessages), limitSum, build.BlockGasLimit, 100*float64(limitSum)/float64(build.BlockGasLimit), avgpremium)
|
||||
}
|
||||
if i < len(tss)-1 {
|
||||
msgs, err := api.ChainGetParentMessages(ctx, tss[i+1].Blocks()[0].Cid())
|
||||
@@ -1030,9 +1030,9 @@ var chainGasPriceCmd = &cli.Command{
|
||||
|
||||
nb := []int{1, 2, 3, 5, 10, 20, 50, 100, 300}
|
||||
for _, nblocks := range nb {
|
||||
addr := builtin.SystemActorAddr // TODO: make real when used in GasEstimateGasPrice
|
||||
addr := builtin.SystemActorAddr // TODO: make real when used in GasEsitmateGasPremium
|
||||
|
||||
est, err := api.GasEstimateGasPrice(ctx, uint64(nblocks), addr, 10000, types.EmptyTSK)
|
||||
est, err := api.GasEsitmateGasPremium(ctx, uint64(nblocks), addr, 10000, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
+15
-3
@@ -246,8 +246,12 @@ var mpoolReplaceCmd = &cli.Command{
|
||||
Name: "replace",
|
||||
Usage: "replace a message in the mempool",
|
||||
Flags: []cli.Flag{
|
||||
&cli.Int64Flag{
|
||||
Name: "gas-price",
|
||||
&cli.StringFlag{
|
||||
Name: "gas-feecap",
|
||||
Usage: "gas feecap for new message",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "gas-premium",
|
||||
Usage: "gas price for new message",
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
@@ -304,7 +308,15 @@ var mpoolReplaceCmd = &cli.Command{
|
||||
msg := found.Message
|
||||
|
||||
msg.GasLimit = cctx.Int64("gas-limit")
|
||||
msg.GasPrice = types.NewInt(uint64(cctx.Int64("gas-price")))
|
||||
msg.GasPremium, err = types.BigFromString(cctx.String("gas-premium"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing gas-premium: %w", err)
|
||||
}
|
||||
// TODO: estiamte fee cap here
|
||||
msg.GasFeeCap, err = types.BigFromString(cctx.String("gas-feecap"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("parsing gas-feecap: %w", err)
|
||||
}
|
||||
|
||||
smsg, err := api.WalletSignMessage(ctx, msg.From, &msg)
|
||||
if err != nil {
|
||||
|
||||
+18
-8
@@ -27,10 +27,15 @@ var sendCmd = &cli.Command{
|
||||
Usage: "optionally specify the account to send funds from",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "gas-price",
|
||||
Name: "gas-premium",
|
||||
Usage: "specify gas price to use in AttoFIL",
|
||||
Value: "0",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "gas-feecap",
|
||||
Usage: "specify gas fee cap to use in AttoFIL",
|
||||
Value: "0",
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "gas-limit",
|
||||
Usage: "specify gas limit",
|
||||
@@ -99,6 +104,10 @@ var sendCmd = &cli.Command{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gfc, err := types.BigFromString(cctx.String("gas-feecap"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
method := abi.MethodNum(cctx.Uint64("method"))
|
||||
|
||||
@@ -122,13 +131,14 @@ var sendCmd = &cli.Command{
|
||||
}
|
||||
|
||||
msg := &types.Message{
|
||||
From: fromAddr,
|
||||
To: toAddr,
|
||||
Value: types.BigInt(val),
|
||||
GasPrice: gp,
|
||||
GasLimit: cctx.Int64("gas-limit"),
|
||||
Method: method,
|
||||
Params: params,
|
||||
From: fromAddr,
|
||||
To: toAddr,
|
||||
Value: types.BigInt(val),
|
||||
GasPremium: gp,
|
||||
GasFeeCap: gfc,
|
||||
GasLimit: cctx.Int64("gas-limit"),
|
||||
Method: method,
|
||||
Params: params,
|
||||
}
|
||||
|
||||
if cctx.Int64("nonce") > 0 {
|
||||
|
||||
+7
-8
@@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"html/template"
|
||||
"io"
|
||||
"os"
|
||||
@@ -15,6 +14,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
"github.com/multiformats/go-multihash"
|
||||
@@ -1383,13 +1384,11 @@ var stateCallCmd = &cli.Command{
|
||||
}
|
||||
|
||||
ret, err := api.StateCall(ctx, &types.Message{
|
||||
From: froma,
|
||||
To: toa,
|
||||
Value: types.BigInt(value),
|
||||
GasLimit: 10000000000,
|
||||
GasPrice: types.NewInt(0),
|
||||
Method: abi.MethodNum(method),
|
||||
Params: params,
|
||||
From: froma,
|
||||
To: toa,
|
||||
Value: types.BigInt(value),
|
||||
Method: abi.MethodNum(method),
|
||||
Params: params,
|
||||
}, ts.Key())
|
||||
if err != nil {
|
||||
return fmt.Errorf("state call failed: %s", err)
|
||||
|
||||
Reference in New Issue
Block a user