diff --git a/x/wasm/types/proposal.go b/x/wasm/types/proposal.go index 2e4bcc375b..4a34761cfb 100644 --- a/x/wasm/types/proposal.go +++ b/x/wasm/types/proposal.go @@ -39,6 +39,7 @@ var EnableAllProposals = []ProposalType{ ProposalTypeClearAdmin, ProposalTypePinCodes, ProposalTypeUnpinCodes, + ProposalTypeUpdateInstantiateConfig, } // ConvertToProposals maps each key to a ProposalType and returns a typed list. @@ -571,10 +572,16 @@ func (p UpdateInstantiateConfigProposal) ValidateBasic() error { if len(p.CodeUpdates) == 0 { return sdkerrors.Wrap(ErrEmpty, "code updates") } + dedup := make(map[uint64]bool) for _, codeUpdate := range p.CodeUpdates { + _, found := dedup[codeUpdate.CodeID] + if found { + return sdkerrors.Wrapf(ErrDuplicate, "duplicate code: %d", codeUpdate.CodeID) + } if err := codeUpdate.InstantiatePermission.ValidateBasic(); err != nil { return sdkerrors.Wrap(err, "instantiate permission") } + dedup[codeUpdate.CodeID] = true } return nil }