Skip to content

Commit

Permalink
fix(cosmos): avoid low gas estimates when simulated admission fails
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Apr 30, 2023
1 parent 2b2bc96 commit a2a0f9d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion golang/cosmos/ante/vm_admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ func (ad AdmissionDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate boo
for _, msg := range tx.GetMsgs() {
if camsg, ok := msg.(vm.ControllerAdmissionMsg); ok {
if err := camsg.CheckAdmissibility(ctx, ad.data); err != nil {
errors = append(errors, err)
// Only let admission errors interrupt the transaction if we're not
// simulating, otherwise our gas estimation will be too low.
if !simulate {
errors = append(errors, err)
defer func(msg sdk.Msg) {
telemetry.IncrCounterWithLabels(
[]string{"tx", "ante", "admission_refused"},
Expand Down

0 comments on commit a2a0f9d

Please sign in to comment.