Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tsnonce preventing multisignature bug #2453

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions protocol/x/accountplus/ante/timestampnonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ func IsTimestampNonceTx(ctx sdk.Context, tx sdk.Tx) (bool, error) {
return false, err
}

if len(signatures) != 1 {
return false, errorsmod.Wrap(sdkerrors.ErrTxDecode, "more than one signature")
// multi signature cannot contain timestamp nonce
if len(signatures) > 1 {
for _, sig := range signatures {
if accountpluskeeper.IsTimestampNonce(sig.Sequence) {
return false, errorsmod.Wrap(sdkerrors.ErrTxDecode, "multi signature contains timestampnonce")
}
}
}

return accountpluskeeper.IsTimestampNonce(signatures[0].Sequence), nil
return len(signatures) == 1 && accountpluskeeper.IsTimestampNonce(signatures[0].Sequence), nil
}
7 changes: 6 additions & 1 deletion protocol/x/accountplus/ante/timestampnonce_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ func TestIsTimestampNonceTx(t *testing.T) {
expectedResult: true,
expectedErr: false,
},
"Returns error for more than one signature": {
"Returns false with no error if multisignature with regular seq number": {
seqs: []uint64{1, 1},
expectedResult: false,
expectedErr: false,
},
"Returns error for multisignature with timestamp nonce": {
seqs: []uint64{keeper.TimestampNonceSequenceCutoff, keeper.TimestampNonceSequenceCutoff},
expectedResult: false,
expectedErr: true,
Expand Down
Loading