From 477e8d959dc0163f37872e24f7567e3c77aa127b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orkun=20K=C3=BCl=C3=A7e?= Date: Tue, 15 Nov 2022 14:32:41 +0300 Subject: [PATCH] Provide source, builder and codehash information in store code proposal message --- docs/proto/proto-docs.md | 3 + go.mod | 2 + go.sum | 3 + proto/cosmwasm/wasm/v1/proposal.proto | 8 + x/wasm/client/cli/gov_tx.go | 57 ++++++ x/wasm/client/cli/gov_tx_test.go | 61 ++++++ x/wasm/client/cli/tx.go | 3 + x/wasm/client/proposal_handler_test.go | 74 ++++++- x/wasm/client/rest/gov.go | 11 + x/wasm/types/proposal.go | 16 +- x/wasm/types/proposal.pb.go | 266 +++++++++++++++++++------ x/wasm/types/proposal_test.go | 6 + x/wasm/types/test_fixtures.go | 9 + 13 files changed, 454 insertions(+), 65 deletions(-) diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index ef464a9f38..cccc7e2534 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -1024,6 +1024,9 @@ StoreCodeProposal gov proposal content type to submit WASM code to the system | `wasm_byte_code` | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | | `instantiate_permission` | [AccessConfig](#cosmwasm.wasm.v1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | | `unpin_code` | [bool](#bool) | | UnpinCode code on upload, optional | +| `source` | [string](#string) | | Source is the URL where the code is hosted | +| `builder` | [string](#string) | | Builder is the docker image used to build the code deterministically, used for smart contract verification | +| `code_hash` | [bytes](#bytes) | | CodeHash is the SHA256 sum of the code outputted by builder, used for smart contract verification | diff --git a/go.mod b/go.mod index 8f8e9be538..511e715875 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/cosmos/iavl v0.19.4 github.com/cosmos/ibc-go/v3 v3.3.1 github.com/cosmos/interchain-accounts v0.1.0 + github.com/docker/distribution v2.8.1+incompatible github.com/dvsekhvalnov/jose2go v1.5.0 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 @@ -95,6 +96,7 @@ require ( github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect diff --git a/go.sum b/go.sum index d4e73f726b..e41e79cb4a 100644 --- a/go.sum +++ b/go.sum @@ -212,6 +212,8 @@ github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WA github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= @@ -587,6 +589,7 @@ github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 h1:rc3tiVYb5z54aKaDfakKn0dDjIyPpTtszkjuMzyt7ec= github.com/opencontainers/runc v1.1.3 h1:vIXrkId+0/J2Ymu2m7VjGvbSlAId9XNRPhn2p4b+d8w= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= diff --git a/proto/cosmwasm/wasm/v1/proposal.proto b/proto/cosmwasm/wasm/v1/proposal.proto index a4e57b7dd9..30fa2d99af 100644 --- a/proto/cosmwasm/wasm/v1/proposal.proto +++ b/proto/cosmwasm/wasm/v1/proposal.proto @@ -26,6 +26,14 @@ message StoreCodeProposal { AccessConfig instantiate_permission = 7; // UnpinCode code on upload, optional bool unpin_code = 8; + // Source is the URL where the code is hosted + string source = 9; + // Builder is the docker image used to build the code deterministically, used + // for smart contract verification + string builder = 10; + // CodeHash is the SHA256 sum of the code outputted by builder, used for smart + // contract verification + bytes code_hash = 11; } // InstantiateContractProposal gov proposal content type to instantiate a diff --git a/x/wasm/client/cli/gov_tx.go b/x/wasm/client/cli/gov_tx.go index 131ccda57d..8ed3107eac 100644 --- a/x/wasm/client/cli/gov_tx.go +++ b/x/wasm/client/cli/gov_tx.go @@ -1,7 +1,11 @@ package cli import ( + "bytes" + "crypto/sha256" "fmt" + "github.com/docker/distribution/reference" + "net/url" "strconv" "strings" @@ -13,6 +17,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/pkg/errors" "github.com/spf13/cobra" + flag "github.com/spf13/pflag" "github.com/CosmWasm/wasmd/x/wasm/types" ) @@ -45,6 +50,10 @@ func ProposalStoreCodeCmd() *cobra.Command { return err } + source, builder, codeHash, err := parseCodeInfoFlags(src.WASMByteCode, cmd.Flags()) + if err != nil { + return err + } content := types.StoreCodeProposal{ Title: proposalTitle, Description: proposalDescr, @@ -52,6 +61,9 @@ func ProposalStoreCodeCmd() *cobra.Command { WASMByteCode: src.WASMByteCode, InstantiatePermission: src.InstantiatePermission, UnpinCode: unpinCode, + Source: source, + Builder: builder, + CodeHash: codeHash, } msg, err := govtypes.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) @@ -73,6 +85,9 @@ func ProposalStoreCodeCmd() *cobra.Command { cmd.Flags().String(flagInstantiateByAddress, "", "Only this address can instantiate a contract instance from the code, optional") cmd.Flags().Bool(flagUnpinCode, false, "Unpin code on upload, optional") cmd.Flags().StringSlice(flagInstantiateByAnyOfAddress, []string{}, "Any of the addresses can instantiate a contract from the code, optional") + cmd.Flags().String(flagSource, "", "Code Source URL is a valid absolute HTTPS URI to the contract's source code,") + cmd.Flags().String(flagBuilder, "", "Builder is a valid docker image name with tag, such as \"cosmwasm/workspace-optimizer:0.12.9\"") + cmd.Flags().BytesHex(flagCodeHash, []byte{}, "CodeHash is the sha256 hash of the wasm code") // proposal flags cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") @@ -81,6 +96,48 @@ func ProposalStoreCodeCmd() *cobra.Command { return cmd } +func parseCodeInfoFlags(wasm []byte, flags *flag.FlagSet) (string, string, []byte, error) { + source, err := flags.GetString(flagSource) + if err != nil { + return "", "", []byte{}, fmt.Errorf("source: %s", err) + } + builder, err := flags.GetString(flagBuilder) + if err != nil { + return "", "", []byte{}, fmt.Errorf("builder: %s", err) + } + codeHash, err := flags.GetBytesHex(flagCodeHash) + if err != nil { + return "", "", []byte{}, fmt.Errorf("codeHash: %s", err) + } + + // if any set require others to be set + if len(source) != 0 || len(builder) != 0 || len(codeHash) != 0 { + if source == "" { + return "", "", []byte{}, fmt.Errorf("source is required") + } + if _, err = url.ParseRequestURI(source); err != nil { + return "", "", []byte{}, fmt.Errorf("source: %s", err) + } + if builder == "" { + return "", "", []byte{}, fmt.Errorf("builder is required") + } + if _, err := reference.ParseDockerRef(builder); err != nil { + return "", "", []byte{}, fmt.Errorf("builder: %s", err) + } + if len(codeHash) == 0 { + return "", "", []byte{}, fmt.Errorf("code hash is required") + } + // wasm is unzipped in parseStoreCodeArgs + // checksum generation will be decoupled here + // reference https://github.com/CosmWasm/wasmvm/issues/359 + checksum := sha256.Sum256(wasm) + if !bytes.Equal(checksum[:], codeHash[:]) { + return "", "", []byte{}, fmt.Errorf("code-hash mismatch: %X, checksum: %X", codeHash, checksum) + } + } + return source, builder, codeHash, nil +} + func ProposalInstantiateContractCmd() *cobra.Command { cmd := &cobra.Command{ Use: "instantiate-contract [code_id_int64] [json_encoded_init_args] --label [text] --title [text] --description [text] --run-as [address] --admin [address,optional] --amount [coins,optional]", diff --git a/x/wasm/client/cli/gov_tx_test.go b/x/wasm/client/cli/gov_tx_test.go index 7c8600e07f..f5d227788f 100644 --- a/x/wasm/client/cli/gov_tx_test.go +++ b/x/wasm/client/cli/gov_tx_test.go @@ -1,6 +1,7 @@ package cli import ( + "os" "testing" "github.com/stretchr/testify/assert" @@ -95,3 +96,63 @@ func TestParseAccessConfigUpdates(t *testing.T) { }) } } + +func TestParseCodeInfoFlags(t *testing.T) { + correctSource := "https://github.com/CosmWasm/wasmd/blob/main/x/wasm/keeper/testdata/hackatom.wasm" + correctBuilderRef := "cosmwasm/workspace-optimizer:0.12.9" + + wasmBin, err := os.ReadFile("../../keeper/testdata/hackatom.wasm") + require.NoError(t, err) + + checksumStr := "13a1fc994cc6d1c81b746ee0c0ff6f90043875e0bf1d9be6b7d779fc978dc2a5" + + specs := map[string]struct { + args []string + expErr bool + }{ + "source missing": { + args: []string{"--builder=" + correctBuilderRef, "--code-hash=" + checksumStr}, + expErr: true, + }, + "builder missing": { + args: []string{"--code-source-url=" + correctSource, "--code-hash=" + checksumStr}, + expErr: true, + }, + "code hash missing": { + args: []string{"--code-source-url=" + correctSource, "--builder=" + correctBuilderRef}, + expErr: true, + }, + "source format wrong": { + args: []string{"--code-source-url=" + "format_wrong", "--builder=" + correctBuilderRef, "--code-hash=" + checksumStr}, + expErr: true, + }, + "builder format wrong": { + args: []string{"--code-source-url=" + correctSource, "--builder=" + "format//", "--code-hash=" + checksumStr}, + expErr: true, + }, + "code hash wrong": { + args: []string{"--code-source-url=" + correctSource, "--builder=" + correctBuilderRef, "--code-hash=" + "AA"}, + expErr: true, + }, + "happy path, none set": { + args: []string{}, + expErr: false, + }, + "happy path all set": { + args: []string{"--code-source-url=" + correctSource, "--builder=" + correctBuilderRef, "--code-hash=" + checksumStr}, + expErr: false, + }, + } + for name, spec := range specs { + t.Run(name, func(t *testing.T) { + flags := ProposalStoreCodeCmd().Flags() + require.NoError(t, flags.Parse(spec.args)) + _, _, _, gotErr := parseCodeInfoFlags(wasmBin, flags) + if spec.expErr { + require.Error(t, gotErr) + return + } + require.NoError(t, gotErr) + }) + } +} diff --git a/x/wasm/client/cli/tx.go b/x/wasm/client/cli/tx.go index 13a7005770..7d5ae9c239 100644 --- a/x/wasm/client/cli/tx.go +++ b/x/wasm/client/cli/tx.go @@ -25,6 +25,9 @@ import ( const ( flagAmount = "amount" flagLabel = "label" + flagSource = "code-source-url" + flagBuilder = "builder" + flagCodeHash = "code-hash" flagAdmin = "admin" flagNoAdmin = "no-admin" flagFixMsg = "fix-msg" diff --git a/x/wasm/client/proposal_handler_test.go b/x/wasm/client/proposal_handler_test.go index 3e82c62e07..c1dc02d7a3 100644 --- a/x/wasm/client/proposal_handler_test.go +++ b/x/wasm/client/proposal_handler_test.go @@ -62,7 +62,8 @@ func TestGovRestHandlers(t *testing.T) { "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", "wasm_byte_code": []byte("valid wasm byte code"), "source": "https://example.com/", - "builder": "my/builder:tag", + "builder": "cosmwasm/workspace-optimizer:v0.12.9", + "code_hash": "2badc56e12711c6387b3b7f9842f1e17a244f5fe354900920362f6668f266125", "instantiate_permission": dict{ "permission": "OnlyAddress", "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", @@ -82,7 +83,8 @@ func TestGovRestHandlers(t *testing.T) { "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", "wasm_byte_code": []byte("valid wasm byte code"), "source": "https://example.com/", - "builder": "my/builder:tag", + "builder": "cosmwasm/workspace-optimizer:v0.12.9", + "code_hash": "2badc56e12711c6387b3b7f9842f1e17a244f5fe354900920362f6668f266125", "deposit": []dict{{"denom": "ustake", "amount": "10"}}, "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", "base_req": aBaseReq, @@ -98,7 +100,8 @@ func TestGovRestHandlers(t *testing.T) { "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", "wasm_byte_code": []byte("valid wasm byte code"), "source": "https://example.com/", - "builder": "my/builder:tag", + "builder": "cosmwasm/workspace-optimizer:v0.12.9", + "code_hash": "2badc56e12711c6387b3b7f9842f1e17a244f5fe354900920362f6668f266125", "instantiate_permission": dict{ "permission": "Nobody", "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", @@ -118,7 +121,8 @@ func TestGovRestHandlers(t *testing.T) { "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", "wasm_byte_code": []byte("valid wasm byte code"), "source": "https://example.com/", - "builder": "my/builder:tag", + "code_hash": "2badc56e12711c6387b3b7f9842f1e17a244f5fe354900920362f6668f266125", + "builder": "cosmwasm/workspace-optimizer:v0.12.9", "instantiate_permission": dict{ "permission": "OnlyAddress", "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", @@ -137,8 +141,68 @@ func TestGovRestHandlers(t *testing.T) { "type": "store-code", "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", "wasm_byte_code": "", + "builder": "cosmwasm/workspace-optimizer:v0.12.9", "source": "https://example.com/", - "builder": "my/builder:tag", + "code_hash": "2badc56e12711c6387b3b7f9842f1e17a244f5fe354900920362f6668f266125", + "instantiate_permission": dict{ + "permission": "OnlyAddress", + "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", + }, + "deposit": []dict{{"denom": "ustake", "amount": "10"}}, + "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", + "base_req": aBaseReq, + }, + expCode: http.StatusBadRequest, + }, + "store-code with incomplete content data: no builder": { + srcPath: "/gov/proposals/wasm_store_code", + srcBody: dict{ + "title": "Test Proposal", + "description": "My proposal", + "type": "store-code", + "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + "wasm_byte_code": "", + "source": "https://example.com/", + "code_hash": "2badc56e12711c6387b3b7f9842f1e17a244f5fe354900920362f6668f266125", + "instantiate_permission": dict{ + "permission": "OnlyAddress", + "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", + }, + "deposit": []dict{{"denom": "ustake", "amount": "10"}}, + "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", + "base_req": aBaseReq, + }, + expCode: http.StatusBadRequest, + }, + "store-code with incomplete content data: no code hash": { + srcPath: "/gov/proposals/wasm_store_code", + srcBody: dict{ + "title": "Test Proposal", + "description": "My proposal", + "type": "store-code", + "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + "wasm_byte_code": "", + "builder": "cosmwasm/workspace-optimizer:v0.12.9", + "source": "https://example.com/", + "instantiate_permission": dict{ + "permission": "OnlyAddress", + "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", + }, + "deposit": []dict{{"denom": "ustake", "amount": "10"}}, + "proposer": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", + "base_req": aBaseReq, + }, + expCode: http.StatusBadRequest, + }, + "store-code with incomplete content data: no source": { + srcPath: "/gov/proposals/wasm_store_code", + srcBody: dict{ + "title": "Test Proposal", + "description": "My proposal", + "type": "store-code", + "run_as": "cosmos100dejzacpanrldpjjwksjm62shqhyss44jf5xz", + "wasm_byte_code": "", + "builder": "cosmwasm/workspace-optimizer:v0.12.9", "instantiate_permission": dict{ "permission": "OnlyAddress", "address": "cosmos1ve557a5g9yw2g2z57js3pdmcvd5my6g8ze20np", diff --git a/x/wasm/client/rest/gov.go b/x/wasm/client/rest/gov.go index 3a27d2f0d7..c57e3a9ac5 100644 --- a/x/wasm/client/rest/gov.go +++ b/x/wasm/client/rest/gov.go @@ -30,6 +30,14 @@ type StoreCodeProposalJSONReq struct { // UnpinCode indicates if the code should not be pinned as part of the proposal. UnpinCode bool `json:"unpin_code" yaml:"unpin_code"` + + // Source is the URL where the code is hosted + Source string `json:"source" yaml:"source"` + // Builder is the docker image used to build the code deterministically, used for smart + // contract verification + Builder string `json:"builder" yaml:"builder"` + // CodeHash is the SHA256 sum of the code outputted by optimizer, used for smart contract verification + CodeHash []byte `json:"code_hash" yaml:"code_hash"` } func (s StoreCodeProposalJSONReq) Content() govtypes.Content { @@ -40,6 +48,9 @@ func (s StoreCodeProposalJSONReq) Content() govtypes.Content { WASMByteCode: s.WASMByteCode, InstantiatePermission: s.InstantiatePermission, UnpinCode: s.UnpinCode, + Source: s.Source, + Builder: s.Builder, + CodeHash: s.CodeHash, } } diff --git a/x/wasm/types/proposal.go b/x/wasm/types/proposal.go index 0b8f943264..791dbb728d 100644 --- a/x/wasm/types/proposal.go +++ b/x/wasm/types/proposal.go @@ -94,8 +94,11 @@ func NewStoreCodeProposal( wasmBz []byte, permission *AccessConfig, unpinCode bool, + source string, + builder string, + codeHash []byte, ) *StoreCodeProposal { - return &StoreCodeProposal{title, description, runAs, wasmBz, permission, unpinCode} + return &StoreCodeProposal{title, description, runAs, wasmBz, permission, unpinCode, source, builder, codeHash} } // ProposalRoute returns the routing key of a parameter change proposal. @@ -138,7 +141,10 @@ func (p StoreCodeProposal) String() string { Description: %s Run as: %s WasmCode: %X -`, p.Title, p.Description, p.RunAs, p.WASMByteCode) + Source: %s + Builder: %s + Code Hash: %X +`, p.Title, p.Description, p.RunAs, p.WASMByteCode, p.Source, p.Builder, p.CodeHash) } // MarshalYAML pretty prints the wasm byte code @@ -149,12 +155,18 @@ func (p StoreCodeProposal) MarshalYAML() (interface{}, error) { RunAs string `yaml:"run_as"` WASMByteCode string `yaml:"wasm_byte_code"` InstantiatePermission *AccessConfig `yaml:"instantiate_permission"` + Source string `yaml:"source"` + Builder string `yaml:"builder"` + CodeHash string `yaml:"code_hash"` }{ Title: p.Title, Description: p.Description, RunAs: p.RunAs, WASMByteCode: base64.StdEncoding.EncodeToString(p.WASMByteCode), InstantiatePermission: p.InstantiatePermission, + Source: p.Source, + Builder: p.Builder, + CodeHash: base64.StdEncoding.EncodeToString(p.CodeHash), }, nil } diff --git a/x/wasm/types/proposal.pb.go b/x/wasm/types/proposal.pb.go index 27a9ed0b9f..9240ab3f40 100644 --- a/x/wasm/types/proposal.pb.go +++ b/x/wasm/types/proposal.pb.go @@ -17,9 +17,8 @@ import ( ) // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal - var ( + _ = proto.Marshal _ = fmt.Errorf _ = math.Inf ) @@ -44,6 +43,14 @@ type StoreCodeProposal struct { InstantiatePermission *AccessConfig `protobuf:"bytes,7,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission,omitempty"` // UnpinCode code on upload, optional UnpinCode bool `protobuf:"varint,8,opt,name=unpin_code,json=unpinCode,proto3" json:"unpin_code,omitempty"` + // Source is the URL where the code is hosted + Source string `protobuf:"bytes,9,opt,name=source,proto3" json:"source,omitempty"` + // Builder is the docker image used to build the code deterministically, used + // for smart contract verification + Builder string `protobuf:"bytes,10,opt,name=builder,proto3" json:"builder,omitempty"` + // CodeHash is the SHA256 sum of the code outputted by builder, used for smart + // contract verification + CodeHash []byte `protobuf:"bytes,11,opt,name=code_hash,json=codeHash,proto3" json:"code_hash,omitempty"` } func (m *StoreCodeProposal) Reset() { *m = StoreCodeProposal{} } @@ -663,62 +670,65 @@ func init() { func init() { proto.RegisterFile("cosmwasm/wasm/v1/proposal.proto", fileDescriptor_be6422d717c730cb) } var fileDescriptor_be6422d717c730cb = []byte{ - // 877 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0xcd, 0x6e, 0xe3, 0x44, - 0x1c, 0xcf, 0xe4, 0xc3, 0x49, 0xa6, 0x11, 0x04, 0x6f, 0xda, 0x0d, 0x05, 0xec, 0xc8, 0x8b, 0x56, - 0xbe, 0xe0, 0x90, 0x22, 0x21, 0xe0, 0x16, 0x07, 0x0e, 0x5d, 0x51, 0xa9, 0x72, 0x55, 0xad, 0x04, - 0x12, 0xd1, 0xc4, 0x9e, 0x7a, 0x2d, 0xe2, 0x19, 0xcb, 0x33, 0x6e, 0xb7, 0x6f, 0x01, 0x12, 0xe2, - 0xb4, 0x0f, 0x80, 0xb8, 0x20, 0xee, 0x3c, 0x40, 0xc5, 0x69, 0x8f, 0x2b, 0x21, 0x19, 0x36, 0x7d, - 0x83, 0x1e, 0x39, 0xa1, 0x99, 0x71, 0xb2, 0x69, 0x77, 0xdb, 0xdd, 0x15, 0x4d, 0xa5, 0xbd, 0x38, - 0x99, 0xf9, 0x7f, 0xfd, 0xe6, 0xa7, 0xff, 0x17, 0x34, 0x7d, 0xca, 0xe2, 0x23, 0xc4, 0xe2, 0xbe, - 0xfc, 0x1c, 0x0e, 0xfa, 0x49, 0x4a, 0x13, 0xca, 0xd0, 0xd4, 0x49, 0x52, 0xca, 0xa9, 0xde, 0x9e, - 0x2b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, 0xb5, 0xf7, 0x93, 0xff, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x50, 0x71, 0x76, 0x67, 0x7f, 0x0b, 0x00, 0x00, + // 922 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x56, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0xcf, 0xe4, 0x8f, 0xe3, 0xbc, 0x44, 0x10, 0xbc, 0x69, 0xd7, 0x74, 0xc1, 0x8e, 0xbc, 0x68, + 0xe5, 0x0b, 0x0e, 0x29, 0x12, 0x02, 0x6e, 0x71, 0x40, 0xa2, 0x2b, 0x2a, 0x55, 0xae, 0xaa, 0x95, + 0x40, 0x22, 0x9a, 0xd8, 0xd3, 0xc4, 0x22, 0xf1, 0x44, 0x1e, 0xbb, 0xdd, 0x7e, 0x0b, 0x90, 0x10, + 0x27, 0x3e, 0x00, 0xe2, 0x82, 0xb8, 0xf3, 0x01, 0x2a, 0x4e, 0x7b, 0x5c, 0x09, 0xc9, 0xb0, 0xe9, + 0x91, 0x5b, 0x8f, 0x9c, 0xd0, 0xcc, 0x38, 0x21, 0xed, 0x6e, 0xbb, 0xbb, 0xa2, 0x59, 0x89, 0x8b, + 0x93, 0x37, 0xef, 0xcd, 0xbc, 0xdf, 0xfb, 0xe9, 0xfd, 0x03, 0xd3, 0xa7, 0x6c, 0x7a, 0x8c, 0xd9, + 0xb4, 0x23, 0x3e, 0x47, 0xdd, 0xce, 0x2c, 0xa6, 0x33, 0xca, 0xf0, 0xc4, 0x99, 0xc5, 0x34, 0xa1, + 0x5a, 0x73, 0x61, 0xe0, 0x88, 0xcf, 0x51, 0x77, 0xab, 0x35, 0xa2, 0x23, 0x2a, 0x94, 0x1d, 0xfe, + 0x4f, 0xda, 0x6d, 0x19, 0xdc, 0x8e, 0xb2, 0xce, 0x10, 0x33, 0xd2, 0x39, 0xea, 0x0e, 0x49, 0x82, + 0xbb, 0x1d, 0x9f, 0x86, 0x51, 0xae, 0x7f, 0xeb, 0x29, 0x47, 0xc9, 0xc9, 0x8c, 0x30, 0xa9, 0xb5, + 0xfe, 0x2a, 0xc2, 0x1b, 0xfb, 0x09, 0x8d, 0x49, 0x9f, 0x06, 0x64, 0x2f, 0x47, 0xa0, 0xb5, 0xa0, + 0x92, 0x84, 0xc9, 0x84, 0xe8, 0xa8, 0x8d, 0xec, 0x9a, 0x27, 0x05, 0xad, 0x0d, 0xf5, 0x80, 0x30, + 0x3f, 0x0e, 0x67, 0x49, 0x48, 0x23, 0xbd, 0x28, 0x74, 0xab, 0x47, 0xda, 0x06, 0x28, 0x71, 0x1a, + 0x0d, 0x30, 0xd3, 0x4b, 0xf2, 0x62, 0x9c, 0x46, 0x3d, 0xa6, 0x7d, 0x00, 0xaf, 0x71, 0xdf, 0x83, + 0xe1, 0x49, 0x42, 0x06, 0x3e, 0x0d, 0x88, 0x5e, 0x6e, 0x23, 0xbb, 0xe1, 0x36, 0xe7, 0x99, 0xd9, + 0x78, 0xd0, 0xdb, 0xdf, 0x75, 0x4f, 0x12, 0x01, 0xc0, 0x6b, 0x70, 0xbb, 0x85, 0xa4, 0x1d, 0xc0, + 0x66, 0x18, 0xb1, 0x04, 0x47, 0x49, 0x88, 0x13, 0x32, 0x98, 0x91, 0x78, 0x1a, 0x32, 0xc6, 0x7d, + 0x57, 0xdb, 0xc8, 0xae, 0x6f, 0x1b, 0xce, 0x65, 0x8e, 0x9c, 0x9e, 0xef, 0x13, 0xc6, 0xfa, 0x34, + 0x3a, 0x0c, 0x47, 0xde, 0xc6, 0xca, 0xed, 0xbd, 0xe5, 0x65, 0xed, 0x6d, 0x80, 0x34, 0x9a, 0x85, + 0x91, 0x84, 0xa2, 0xb6, 0x91, 0xad, 0x7a, 0x35, 0x71, 0x22, 0xbc, 0x6e, 0x82, 0xc2, 0x68, 0x1a, + 0xfb, 0x44, 0xaf, 0x89, 0x20, 0x72, 0x49, 0xd3, 0xa1, 0x3a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xa7, 0x6c, 0xfa, 0x60, 0xb1, 0x3f, 0x07, + 0x9d, 0x87, 0x72, 0x8f, 0x16, 0x4f, 0x0f, 0x15, 0xb1, 0x45, 0xbf, 0xff, 0x4f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xc1, 0xe5, 0x51, 0x98, 0xce, 0x0b, 0x00, 0x00, } func (this *StoreCodeProposal) Equal(that interface{}) bool { @@ -758,6 +768,15 @@ func (this *StoreCodeProposal) Equal(that interface{}) bool { if this.UnpinCode != that1.UnpinCode { return false } + if this.Source != that1.Source { + return false + } + if this.Builder != that1.Builder { + return false + } + if !bytes.Equal(this.CodeHash, that1.CodeHash) { + return false + } return true } @@ -1206,6 +1225,27 @@ func (m *StoreCodeProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.CodeHash) > 0 { + i -= len(m.CodeHash) + copy(dAtA[i:], m.CodeHash) + i = encodeVarintProposal(dAtA, i, uint64(len(m.CodeHash))) + i-- + dAtA[i] = 0x5a + } + if len(m.Builder) > 0 { + i -= len(m.Builder) + copy(dAtA[i:], m.Builder) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Builder))) + i-- + dAtA[i] = 0x52 + } + if len(m.Source) > 0 { + i -= len(m.Source) + copy(dAtA[i:], m.Source) + i = encodeVarintProposal(dAtA, i, uint64(len(m.Source))) + i-- + dAtA[i] = 0x4a + } if m.UnpinCode { i-- if m.UnpinCode { @@ -1965,6 +2005,18 @@ func (m *StoreCodeProposal) Size() (n int) { if m.UnpinCode { n += 2 } + l = len(m.Source) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.Builder) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } + l = len(m.CodeHash) + if l > 0 { + n += 1 + l + sovProposal(uint64(l)) + } return n } @@ -2502,6 +2554,104 @@ func (m *StoreCodeProposal) Unmarshal(dAtA []byte) error { } } m.UnpinCode = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Source = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Builder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Builder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProposal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthProposal + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthProposal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CodeHash = append(m.CodeHash[:0], dAtA[iNdEx:postIndex]...) + if m.CodeHash == nil { + m.CodeHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipProposal(dAtA[iNdEx:]) diff --git a/x/wasm/types/proposal_test.go b/x/wasm/types/proposal_test.go index 6657d11412..e5e5db5f6d 100644 --- a/x/wasm/types/proposal_test.go +++ b/x/wasm/types/proposal_test.go @@ -647,6 +647,9 @@ func TestProposalStrings(t *testing.T) { Description: Bar Run as: cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4 WasmCode: 0102030405060708090A + Source: https://example.com/ + Builder: cosmwasm/workspace-optimizer:v0.12.8 + Code Hash: D9B69D739E9ED76EF5D5CEB7F3B6F76FB7FDF38D9FD5ED7B6B6E387F97DEDF9E3DD34F76D37EB67FAEBAF1FDBAEB5DB9 `, }, "instantiate contract": { @@ -763,6 +766,9 @@ description: Bar run_as: cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4 wasm_byte_code: AQIDBAUGBwgJCg== instantiate_permission: null +source: https://example.com/ +builder: cosmwasm/workspace-optimizer:v0.12.8 +code_hash: 2badc56e12711c6387b3b7f9842f1e17a244f5fe354900920362f6668f266125 `, }, "instantiate contract": { diff --git a/x/wasm/types/test_fixtures.go b/x/wasm/types/test_fixtures.go index c37b6d9ddf..6d1bb73a80 100644 --- a/x/wasm/types/test_fixtures.go +++ b/x/wasm/types/test_fixtures.go @@ -3,6 +3,7 @@ package types import ( "bytes" "crypto/sha256" + "encoding/base64" "encoding/json" "math/rand" @@ -200,11 +201,19 @@ func MsgExecuteContractFixture(mutators ...func(*MsgExecuteContract)) *MsgExecut func StoreCodeProposalFixture(mutators ...func(*StoreCodeProposal)) *StoreCodeProposal { const anyAddress = "cosmos1qyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs2m6sx4" + codeHash, err := base64.StdEncoding.DecodeString("2badc56e12711c6387b3b7f9842f1e17a244f5fe354900920362f6668f266125") + if err != nil { + panic(err) + } + p := &StoreCodeProposal{ Title: "Foo", Description: "Bar", RunAs: anyAddress, WASMByteCode: []byte{0x0}, + Source: "https://example.com/", + Builder: "cosmwasm/workspace-optimizer:v0.12.8", + CodeHash: codeHash, } for _, m := range mutators { m(p)