fix(x/accounts/lockup): prevent double withdraw (backport #21619) (#21641)

Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot] 2024-09-11 08:13:55 +00:00 committed by GitHub
parent 6598689583
commit 7c3945f262
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 96 additions and 55 deletions

View File

@ -5,6 +5,8 @@ import (
"context"
"errors"
"fmt"
"maps"
"slices"
"time"
"github.com/cosmos/gogoproto/proto"
@ -254,6 +256,10 @@ func (bva *BaseLockup) SendCoins(
hs := bva.headerService.HeaderInfo(ctx)
if err := msg.Amount.Validate(); err != nil {
return nil, err
}
lockedCoins, err := getLockedCoinsFunc(ctx, hs.Time, msg.Amount.Denoms()...)
if err != nil {
return nil, err
@ -294,15 +300,21 @@ func (bva *BaseLockup) WithdrawUnlockedCoins(
return nil, err
}
// deduplicate the denoms
denoms := make(map[string]struct{})
for _, denom := range msg.Denoms {
denoms[denom] = struct{}{}
}
uniqueDenoms := slices.Collect(maps.Keys(denoms))
hs := bva.headerService.HeaderInfo(ctx)
lockedCoins, err := getLockedCoinsFunc(ctx, hs.Time, msg.Denoms...)
lockedCoins, err := getLockedCoinsFunc(ctx, hs.Time, uniqueDenoms...)
if err != nil {
return nil, err
}
amount := sdk.Coins{}
for _, denom := range msg.Denoms {
for _, denom := range uniqueDenoms {
balance, err := bva.getBalance(ctx, fromAddress, denom)
if err != nil {
return nil, err

View File

@ -231,12 +231,16 @@ func TestPeriodicAccountWithdrawUnlockedCoins(t *testing.T) {
Time: startTime.Add(time.Minute * 1),
})
_, err = acc.WithdrawUnlockedCoins(sdkCtx, &lockuptypes.MsgWithdraw{
// withdraw unlocked token
resp, err := acc.WithdrawUnlockedCoins(sdkCtx, &lockuptypes.MsgWithdraw{
Withdrawer: "owner",
ToAddress: "receiver",
Denoms: []string{"test"},
Denoms: []string{"test", "test"}, // duplicate tokens should be ignored
})
require.NoError(t, err)
require.Equal(t, resp.AmountReceived.Len(), 1)
require.Equal(t, resp.AmountReceived, sdk.NewCoins(sdk.NewCoin("test", math.NewInt(5))))
require.Equal(t, resp.Receiver, "receiver")
}
func TestPeriodicAccountGetLockCoinInfo(t *testing.T) {

View File

@ -100,7 +100,7 @@ func (VoteOption) EnumDescriptor() ([]byte, []int) {
// MsgInit is used to initialize a multisig account.
type MsgInit struct {
Members []*Member `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
Config *Config `protobuf:"bytes,2,opt,name=Config,proto3" json:"Config,omitempty"`
Config *Config `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
}
func (m *MsgInit) Reset() { *m = MsgInit{} }
@ -187,6 +187,7 @@ func (m *MsgInitResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgInitResponse proto.InternalMessageInfo
// MsgCreateProposal creates a new proposal.
type MsgCreateProposal struct {
Proposal *Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"`
}
@ -231,6 +232,7 @@ func (m *MsgCreateProposal) GetProposal() *Proposal {
return nil
}
// MsgCreateProposalResponse is the response returned after creating a proposal.
type MsgCreateProposalResponse struct {
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
}
@ -275,6 +277,7 @@ func (m *MsgCreateProposalResponse) GetProposalId() uint64 {
return 0
}
// MsgVote is used to vote on a proposal.
type MsgVote struct {
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
Vote VoteOption `protobuf:"varint,2,opt,name=vote,proto3,enum=cosmos.accounts.defaults.multisig.v1.VoteOption" json:"vote,omitempty"`
@ -327,6 +330,7 @@ func (m *MsgVote) GetVote() VoteOption {
return VoteOption_VOTE_OPTION_UNSPECIFIED
}
// MsgVoteResponse is the response returned after voting on a proposal.
type MsgVoteResponse struct {
}
@ -363,6 +367,7 @@ func (m *MsgVoteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgVoteResponse proto.InternalMessageInfo
// MsgExecuteProposal is used to execute a proposal.
type MsgExecuteProposal struct {
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
}
@ -407,6 +412,7 @@ func (m *MsgExecuteProposal) GetProposalId() uint64 {
return 0
}
// MsgExecuteProposalResponse is the response returned after executing a proposal.
type MsgExecuteProposalResponse struct {
Responses []*any.Any `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"`
}
@ -456,7 +462,7 @@ type MsgUpdateConfig struct {
// only the members that are changing are required, if their weight is 0, they are removed.
UpdateMembers []*Member `protobuf:"bytes,1,rep,name=update_members,json=updateMembers,proto3" json:"update_members,omitempty"`
// not all fields from Config can be changed
Config *Config `protobuf:"bytes,2,opt,name=Config,proto3" json:"Config,omitempty"`
Config *Config `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
}
func (m *MsgUpdateConfig) Reset() { *m = MsgUpdateConfig{} }
@ -506,6 +512,7 @@ func (m *MsgUpdateConfig) GetConfig() *Config {
return nil
}
// MsgUpdateConfigResponse is the response returned after updating the config.
type MsgUpdateConfigResponse struct {
}
@ -542,6 +549,7 @@ func (m *MsgUpdateConfigResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgUpdateConfigResponse proto.InternalMessageInfo
// Member defines the member of the multisig account.
type Member struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
Weight uint64 `protobuf:"varint,2,opt,name=weight,proto3" json:"weight,omitempty"`
@ -594,6 +602,7 @@ func (m *Member) GetWeight() uint64 {
return 0
}
// Config defines the configuration of the multisig account.
type Config struct {
Threshold int64 `protobuf:"varint,1,opt,name=threshold,proto3" json:"threshold,omitempty"`
Quorum int64 `protobuf:"varint,2,opt,name=quorum,proto3" json:"quorum,omitempty"`
@ -673,6 +682,7 @@ func (m *Config) GetEarlyExecution() bool {
return false
}
// Proposal defines the structure of a proposal.
type Proposal struct {
Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"`
Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"`
@ -833,6 +843,7 @@ func (m *QuerySequenceResponse) GetSequence() uint64 {
return 0
}
// QueryConfig is the request for the account config.
type QueryConfig struct {
}
@ -872,7 +883,7 @@ var xxx_messageInfo_QueryConfig proto.InternalMessageInfo
// QueryConfigResponse returns the config of the account.
type QueryConfigResponse struct {
Members []*Member `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
Config *Config `protobuf:"bytes,2,opt,name=Config,proto3" json:"Config,omitempty"`
Config *Config `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"`
}
func (m *QueryConfigResponse) Reset() { *m = QueryConfigResponse{} }
@ -922,6 +933,7 @@ func (m *QueryConfigResponse) GetConfig() *Config {
return nil
}
// QueryProposal is the request for a proposal.
type QueryProposal struct {
ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"`
}
@ -966,6 +978,7 @@ func (m *QueryProposal) GetProposalId() uint64 {
return 0
}
// QueryProposalResponse returns the proposal.
type QueryProposalResponse struct {
Proposal *Proposal `protobuf:"bytes,1,opt,name=proposal,proto3" json:"proposal,omitempty"`
}
@ -1039,7 +1052,7 @@ func init() {
}
var fileDescriptor_e6da8796717704d7 = []byte{
// 865 bytes of a gzipped FileDescriptorProto
// 867 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x6f, 0xe3, 0x44,
0x14, 0xaf, 0x9b, 0x6e, 0x9a, 0xbe, 0xd2, 0x24, 0x9d, 0x96, 0xad, 0x9b, 0x5d, 0xb2, 0xc5, 0x20,
0xb1, 0xaa, 0x16, 0xa7, 0x9b, 0xc2, 0x8d, 0x4b, 0xda, 0xb8, 0x28, 0xab, 0x4d, 0x6c, 0xc6, 0x69,
@ -1053,48 +1066,48 @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, 0x6c, 0x4c, 0x3b, 0x3b, 0x07, 0xf6, 0xb0, 0xd3, 0x1b, 0xd4, 0x17,
0x11, 0x82, 0xea, 0x74, 0x60, 0x60, 0xd6, 0x4b, 0x07, 0x47, 0xbf, 0x5f, 0x36, 0x95, 0xb7, 0x97,
0x4d, 0xe5, 0xaf, 0xcb, 0xa6, 0xf2, 0xe3, 0x55, 0x73, 0xe1, 0xed, 0x55, 0x73, 0xe1, 0xcf, 0xab,
0xe6, 0xc2, 0x77, 0xcf, 0xb2, 0x86, 0x32, 0xef, 0x95, 0x1e, 0xd0, 0xd6, 0x9b, 0x77, 0xff, 0x65,
0x9c, 0x96, 0xc5, 0x4b, 0xdb, 0xff, 0x27, 0x00, 0x00, 0xff, 0xff, 0x70, 0x44, 0x04, 0xfe, 0x94,
0x08, 0x00, 0x00,
}
func (m *MsgInit) Marshal() (dAtA []byte, err error) {

View File

@ -3,7 +3,6 @@ syntax = "proto3";
package cosmos.accounts.defaults.multisig.v1;
import "google/protobuf/any.proto";
import "cosmos/msg/v1/msg.proto";
import "cosmos_proto/cosmos.proto";
option go_package = "cosmossdk.io/x/accounts/defaults/multisig/v1";
@ -11,31 +10,37 @@ option go_package = "cosmossdk.io/x/accounts/defaults/multisig/v1";
// MsgInit is used to initialize a multisig account.
message MsgInit {
repeated Member members = 1;
Config Config = 2;
Config config = 2;
}
// MsgInitResponse is the response returned after account initialization.
message MsgInitResponse {}
// MsgCreateProposal creates a new proposal.
message MsgCreateProposal {
Proposal proposal = 1;
}
// MsgCreateProposalResponse is the response returned after creating a proposal.
message MsgCreateProposalResponse {
uint64 proposal_id = 1;
}
// MsgVote is used to vote on a proposal.
message MsgVote {
uint64 proposal_id = 1;
VoteOption vote = 2;
}
// MsgVoteResponse is the response returned after voting on a proposal.
message MsgVoteResponse {}
// MsgExecuteProposal is used to execute a proposal.
message MsgExecuteProposal {
uint64 proposal_id = 1;
}
// MsgExecuteProposalResponse is the response returned after executing a proposal.
message MsgExecuteProposalResponse {
repeated google.protobuf.Any responses = 1;
}
@ -46,11 +51,13 @@ message MsgUpdateConfig {
repeated Member update_members = 1;
// not all fields from Config can be changed
Config Config = 2;
Config config = 2;
}
// MsgUpdateConfigResponse is the response returned after updating the config.
message MsgUpdateConfigResponse {}
// Member defines the member of the multisig account.
message Member {
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
uint64 weight = 2;
@ -59,6 +66,7 @@ message Member {
// when aggregating on-chain I can only use the address
// off-chain would send a tx directly, won't create a proposal.
// Config defines the configuration of the multisig account.
message Config {
int64 threshold = 1;
@ -74,6 +82,7 @@ message Config {
bool early_execution = 5;
}
// Proposal defines the structure of a proposal.
message Proposal {
string title = 1;
string summary = 2;
@ -94,19 +103,22 @@ message QuerySequenceResponse {
uint64 sequence = 1;
}
// QueryConfig is the request for the account config.
message QueryConfig {}
// QueryConfigResponse returns the config of the account.
message QueryConfigResponse {
repeated Member members = 1;
Config Config = 2;
Config config = 2;
}
// QueryProposal is the request for a proposal.
message QueryProposal {
uint64 proposal_id = 1;
}
// QueryProposalResponse returns the proposal.
message QueryProposalResponse {
Proposal proposal = 1;
}