Skip to content

Commit

Permalink
[STAB-24] Migrate over to cosmos version now that performance improve…
Browse files Browse the repository at this point in the history
…ment had been released. (#1007)
  • Loading branch information
lcwik authored Jan 31, 2024
1 parent 9000323 commit bc57835
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions protocol/app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
}

anteDecorators := NewAnteDecoratorChain(options)

// TODO(STAB-24): This change can be reverted to using ChainAnteDecorators again once
// https://github.com/cosmos/cosmos-sdk/pull/16076 is merged, released, and we pick-up the SDK version containing
// the change.
anteHandlers := make([]sdk.AnteHandler, len(anteDecorators)+1)
// Install the terminator ante handler.
anteHandlers[len(anteDecorators)] = func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) {
return ctx, nil
}
for i := 0; i < len(anteDecorators); i++ {
// Make a copy of the value to ensure that we can hold a reference to it. This avoids the golang common mistake:
// https://github.com/golang/go/wiki/CommonMistakes#using-goroutines-on-loop-iterator-variables
ii := i
anteHandlers[ii] = func(ctx sdk.Context, tx sdk.Tx, simulate bool) (sdk.Context, error) {
return anteDecorators[ii].AnteHandle(ctx, tx, simulate, anteHandlers[ii+1])
}
}

return anteHandlers[0], nil
return sdk.ChainAnteDecorators(anteDecorators...), nil
}

// NewAnteDecoratorChain returns a list of AnteDecorators in the expected application chain ordering
Expand Down

0 comments on commit bc57835

Please sign in to comment.