Skip to content

Commit d437c83

Browse files
committed
Fix gas estimation for roflmarket.InstanceTopUp
1 parent 857f671 commit d437c83

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

cmd/common/transaction.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,15 @@ 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. Some methods need a higher
269+
// buffer due to gas estimation returning early without simulating
270+
// storage operations.
271+
multiplier := uint64(120) // Default 20%.
272+
switch tx.Call.Method {
273+
case "roflmarket.InstanceTopUp":
274+
multiplier = 150 // 50%.
275+
}
276+
gas = (multiplier * gas) / 100
270277
}
271278

272279
// Compute fee.

0 commit comments

Comments
 (0)