@@ -9,37 +9,24 @@ import (
99 "google.golang.org/protobuf/types/known/anypb"
1010
1111 errorsmod "cosmossdk.io/errors"
12- storetypes "cosmossdk.io/store/types"
1312 txsigning "cosmossdk.io/x/tx/signing"
1413 codectypes "github.com/cosmos/cosmos-sdk/codec/types"
1514 sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
1615 "github.com/cosmos/cosmos-sdk/types/tx/signing"
1716 "github.com/cosmos/cosmos-sdk/x/auth/ante"
1817 authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
19- authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
2018 txpolicy "github.com/pushchain/push-chain-node/app/txpolicy"
2119)
2220
2321type AccountInitDecorator struct {
2422 ak AccountKeeper
2523 signModeHandler * txsigning.HandlerMap
26- sigGasConsumer SignatureVerificationGasConsumer
2724}
2825
29- // SignatureVerificationGasConsumer charges gas for a single signature, matching
30- // the ante.SignatureVerificationGasConsumer contract used by the SDK's
31- // SigGasConsumeDecorator.
32- type SignatureVerificationGasConsumer func (meter storetypes.GasMeter , sig signing.SignatureV2 , params authtypes.Params ) error
33-
34- func NewAccountInitDecorator (ak AccountKeeper , signModeHandler * txsigning.HandlerMap , sigGasConsumer SignatureVerificationGasConsumer ) AccountInitDecorator {
35- if sigGasConsumer == nil {
36- sigGasConsumer = ante .DefaultSigVerificationGasConsumer
37- }
38-
26+ func NewAccountInitDecorator (ak AccountKeeper , signModeHandler * txsigning.HandlerMap ) AccountInitDecorator {
3927 return AccountInitDecorator {
4028 ak : ak ,
4129 signModeHandler : signModeHandler ,
42- sigGasConsumer : sigGasConsumer ,
4330 }
4431}
4532
@@ -122,9 +109,11 @@ func (aid AccountInitDecorator) verifySignatureForNewAccount(ctx sdk.Context, tx
122109
123110 // Enforce the signature count limit before doing any verification work.
124111 // This decorator short-circuits the ante chain for new accounts, so
125- // ante.ValidateSigCountDecorator never runs for them; without this an
126- // unpriced gasless tx could carry an arbitrarily large multisig key and
127- // force the node to verify every sub-signature for free.
112+ // ante.ValidateSigCountDecorator never runs for them; without this hard cap
113+ // a gasless tx could carry an arbitrarily large multisig key and force the
114+ // node to verify every sub-signature. Gas is deliberately NOT consumed here:
115+ // gasless txs skip fee deduction entirely, so charging gas would cost an
116+ // attacker nothing - the count cap is what actually bounds the work.
128117 sigCount := 0
129118 for _ , sig := range sigs {
130119 if sig .PubKey == nil {
@@ -162,16 +151,6 @@ func (aid AccountInitDecorator) verifySignatureForNewAccount(ctx sdk.Context, tx
162151 "pubKey does not match signer address %s with signer index: %d" , sdk .AccAddress (signers [i ]).String (), i )
163152 }
164153
165- // Charge gas for the signature, as ante.SigGasConsumeDecorator would
166- // have done had the ante chain not been short-circuited.
167- if err := aid .sigGasConsumer (ctx .GasMeter (), signing.SignatureV2 {
168- PubKey : pubKey ,
169- Data : sig .Data ,
170- Sequence : sig .Sequence ,
171- }, params ); err != nil {
172- return err
173- }
174-
175154 // retrieve signer data
176155 chainID := ctx .ChainID ()
177156 var accSequence uint64 = 0
0 commit comments