Skip to content

Commit e9a6062

Browse files
authored
Merge pull request #673 from oasisprotocol/ptrus/feature/gas-estimate-instancetopup
Fix gas estimation for roflmarket.InstanceTopUp
2 parents 857f671 + 91aa647 commit e9a6062

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cmd/common/transaction.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,16 @@ func PrepareParatimeTransaction(ctx context.Context, npa *NPASelection, account
265265
return 0, nil, "", fmt.Errorf("failed to estimate gas: %w", err)
266266
}
267267

268-
// Inflate the estimate by 20% for good measure.
269-
gas = (120 * gas) / 100
268+
// Inflate the estimate for good measure.
269+
var multiplier uint64
270+
switch tx.Call.Method {
271+
case "roflmarket.InstanceTopUp":
272+
// Needs a higher buffer due to gas estimation returning early without simulating storage operations.
273+
multiplier = 150 // 50%.
274+
default:
275+
multiplier = 120 // 20%.
276+
}
277+
gas = (multiplier * gas) / 100
270278
}
271279

272280
// Compute fee.

0 commit comments

Comments
 (0)