Add SkipSequenceCheck flag in SignatureV2 for Amino signatures (#7234)

* Add SkipSequenceCheck

* Fix test

* Fix test

* Add explicit amino test

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
Amaury Martiny
2020-09-04 17:49:07 +00:00
committed by GitHub
co-authored by Alexander Bezobchuk
parent 18ac096a54
commit bae1399ebc
5 changed files with 127 additions and 11 deletions
+16 -1
View File
@@ -19,8 +19,23 @@ type SignatureV2 struct {
// the signatures themselves for either single or multi-signatures.
Data SignatureData
// Sequence is the sequence of this account.
// Sequence is the sequence of this account. Only populated in
// SIGN_MODE_DIRECT.
Sequence uint64
// Ugly flag to keep backwards-compatibility with Amino StdSignatures.
// In SIGN_MODE_DIRECT, sequence is in AuthInfo, and will thus be populated
// in the Sequence field above. The ante handler then checks this Sequence
// with the actual sequence on-chain.
// In SIGN_MODE_LEGACY_AMINO_JSON, sequence is signed via StdSignDoc, and
// checked during signature verification. It's not populated in the
// Sequence field above. This flag indicates that the Sequence field should
// be skipped in ante handlers.
// TLDR;
// - false (by default) in SIGN_MODE_DIRECT
// - true in SIGN_MODE_LEGACY_AMINO_JSON
// ref: https://github.com/cosmos/cosmos-sdk/issues/7229
SkipSequenceCheck bool
}
// SignatureDataToProto converts a SignatureData to SignatureDescriptor_Data.