Skip to content

Commit 71f0b90

Browse files
committed
fix signing and tss pkg
1 parent 8b83b0b commit 71f0b90

File tree

7 files changed

+159
-159
lines changed

7 files changed

+159
-159
lines changed

pkg/tss/hash.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func HashRound3Complain(
7171
[]byte("round3Complain"),
7272
pubNonce,
7373
nonceSym,
74-
oneTimePubJ,
74+
oneTimePubI,
7575
oneTimePubJ,
7676
keySym,
7777
),

pkg/tss/hash_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (suite *TSSTestSuite) TestHashRound3Complain() {
4545

4646
// Ensure the hash matches the expected value.
4747
suite.Require().Nil(err)
48-
suite.Require().Equal("955537bd86b09a963c27afff3fb965e897fda379ff04625b953da753843bc63a", hex.EncodeToString(hash))
48+
suite.Require().Equal("1b8081d885dc6226a2737228e91270a27b488475079c3e2e46ba8accdfa928ce", hex.EncodeToString(hash))
4949
}
5050

5151
func (suite *TSSTestSuite) TestHashRound3OwnPubKey() {

pkg/tss/testutil/test_case.go

Lines changed: 143 additions & 143 deletions
Large diffs are not rendered by default.

pkg/tss/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ func (e EncSecretShare) Value() []byte {
650650
return e[0:32]
651651
}
652652

653-
// Value return the nonce part of EncSecretShare
653+
// Nonce return the nonce part of EncSecretShare
654654
func (e EncSecretShare) Nonce() []byte {
655655
return e[32:48]
656656
}

x/bandtss/keeper/msg_server_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ func (s *KeeperTestSuite) TestFailedRequestSignatureReq() {
304304
func() {
305305
s.app.BandtssKeeper.SetCurrentGroupID(ctx, 1)
306306
},
307-
tsstypes.ErrGroupIsNotActive,
307+
types.ErrNoActiveGroup,
308308
},
309309
{
310310
"failure with fee is more than user's limit",
@@ -323,6 +323,7 @@ func (s *KeeperTestSuite) TestFailedRequestSignatureReq() {
323323
for _, tc := range tcs {
324324
s.Run(fmt.Sprintf("Case %s", tc.Msg), func() {
325325
tc.Malleate()
326+
defer tc.PostTest()
326327

327328
balancesBefore := s.app.BankKeeper.GetAllBalances(ctx, bandtesting.FeePayer.Address)
328329
balancesModuleBefore := s.app.BankKeeper.GetAllBalances(
@@ -342,8 +343,6 @@ func (s *KeeperTestSuite) TestFailedRequestSignatureReq() {
342343
// Check if the balances of payer and module account doesn't change
343344
s.Require().Equal(balancesBefore, balancesAfter)
344345
s.Require().Equal(balancesModuleBefore, balancesModuleAfter)
345-
346-
tc.PostTest()
347346
})
348347
}
349348
}

x/bandtss/keeper/signing.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,15 @@ func (k Keeper) HandleCreateSigning(
143143
if err != nil {
144144
return 0, err
145145
}
146+
if currentGroup.Status != tsstypes.GROUP_STATUS_ACTIVE {
147+
return 0, types.ErrNoActiveGroup
148+
}
146149

147150
// charged fee if necessary; If found any coins that exceed limit then return error
148151
feePerSigner := sdk.NewCoins()
149-
totalFee := sdk.NewCoins()
150152
if sender.String() != k.authority {
151153
feePerSigner = k.GetParams(ctx).Fee
152-
totalFee = feePerSigner.MulInt(sdk.NewInt(int64(currentGroup.Threshold)))
154+
totalFee := feePerSigner.MulInt(sdk.NewInt(int64(currentGroup.Threshold)))
153155
for _, fc := range totalFee {
154156
limitAmt := feeLimit.AmountOf(fc.Denom)
155157
if fc.Amount.GT(limitAmt) {
@@ -161,6 +163,12 @@ func (k Keeper) HandleCreateSigning(
161163
)
162164
}
163165
}
166+
167+
// transfer fee to module account.
168+
err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, totalFee)
169+
if err != nil {
170+
return 0, err
171+
}
164172
}
165173

166174
currentGroupSigning, err := k.tssKeeper.CreateSigning(ctx, currentGroup, content)
@@ -183,14 +191,6 @@ func (k Keeper) HandleCreateSigning(
183191
replacingGroupSigningID = replacingGroupSigning.ID
184192
}
185193

186-
// transfer fee to module account.
187-
if !totalFee.IsZero() {
188-
err = k.bankKeeper.SendCoinsFromAccountToModule(ctx, sender, types.ModuleName, totalFee)
189-
if err != nil {
190-
return 0, err
191-
}
192-
}
193-
194194
// save signing info
195195
bandtssSigningID := k.AddSigning(ctx, types.Signing{
196196
Fee: feePerSigner,

x/tss/keeper/signing_endblock.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ func (k Keeper) HandleExpiredSignings(ctx sdk.Context) {
156156

157157
// Remove all partial signatures from the store
158158
k.DeletePartialSignatures(ctx, signing.ID)
159+
k.DeletePartialSignatureCount(ctx, signing.ID)
159160

160161
// Set the last expired signing ID to the current signing ID
161162
k.SetLastExpiredSigningID(ctx, currentSigningID)

0 commit comments

Comments
 (0)