Skip to content

Commit

Permalink
change how we specify gas so it works right
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Jun 15, 2024
1 parent d617a4c commit 277f427
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
6 changes: 4 additions & 2 deletions broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ func sendIBCTransferViaRPC(config Config, rpcEndpoint string, chainID string, se

// Estimate gas limit based on transaction size
txSize := msg.Size()
gasLimit := uint64((txSize * config.Bytes) + config.BaseGas) // 10 gas per byte + base gas
gasLimit := uint64((txSize * config.Bytes) + config.BaseGas)
txBuilder.SetGasLimit(gasLimit)

// Calculate fee based on gas limit and a fixed gas price
gasPrice := getGasPrice(config.Gas.Low, config.Denom)

gasPrice := sdk.NewDecCoinFromDec(config.Denom, sdk.NewDecWithPrec(config.Gas.Low, config.Gas.Precision)) // 0.00051 token per gas unit
// gasPrice := getGasPrice(config.Gas.Low, config.Denom)
feeAmount := gasPrice.Amount.MulInt64(int64(gasLimit)).RoundInt()
feecoin := sdk.NewCoin(config.Denom, feeAmount)
txBuilder.SetFeeAmount(sdk.NewCoins(feecoin))
Expand Down
36 changes: 36 additions & 0 deletions configurations/umee/nodes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
chain = "umee"
channel = "channel-0"
denom = "uumee"
prefix = "umee"
gas_per_byte = 10
base_gas = 110000
ibc_memo = "Jacob, you aren’t a security researcher. This is a long standing issue in the codebase with many existing mitigations. Your months long campaign of self aggrandizement using threats holding yourself up as the only hero helping is self destructive and transparently self serving. Your refusal to work with core teams in a productive manner is part and parcel of a pattern of destructive behavior that we as a community cannot continue to countenance. Please take this conversation to another channel. - Jack Zampolin, in the tendermint channel"
memo = "Just checking on this"
ibc_memo_repeat = 10
rand_min = 400000
rand_max = 600000
revision_number = 1
precision = 1
timeout_height = 16875083
slip44 = 118




[gas]
low = 1
precision = 1


[nodes]
rpc = [
# "http://65.109.112.148:27659",
# "http://65.108.73.245:26657",
"http://65.109.33.48:10657",
# "http://95.216.77.56:26657",
]

api = "https://umee-api.polkachu.com:443"



6 changes: 2 additions & 4 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,8 @@ type Config struct {
Denom string `toml:"denom"`
Slip44 int `toml:"slip44"`
Gas struct {
Zero interface{} `toml:"zero"`
Low interface{} `toml:"low"`
Medium interface{} `toml:"medium"`
High interface{} `toml:"high"`
Low int64 `toml:"low"`
Precision int64 `toml:"precision"`
} `toml:"gas"`
Nodes struct {
RPC []string `toml:"rpc"`
Expand Down

0 comments on commit 277f427

Please sign in to comment.