wormchain: add migrating contracts with vaa
This commit is contained in:
parent
f6825e242e
commit
aac92a19e7
|
@ -25,8 +25,8 @@ ARG GO_BUILD_ARGS=-race
|
||||||
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
|
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
|
||||||
cd node && \
|
cd node && \
|
||||||
go build ${GO_BUILD_ARGS} -gcflags="all=-N -l" --ldflags '-extldflags "-Wl,--allow-multiple-definition" -X "github.com/certusone/wormhole/node/cmd/guardiand.Build=dev"' -mod=readonly -o /guardiand github.com/certusone/wormhole/node && \
|
go build ${GO_BUILD_ARGS} -gcflags="all=-N -l" --ldflags '-extldflags "-Wl,--allow-multiple-definition" -X "github.com/certusone/wormhole/node/cmd/guardiand.Build=dev"' -mod=readonly -o /guardiand github.com/certusone/wormhole/node && \
|
||||||
go get github.com/CosmWasm/wasmvm@v1.0.0 && \
|
go get github.com/CosmWasm/wasmvm@v1.1.1 && \
|
||||||
cp /go/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.0.0/api/libwasmvm.x86_64.so /usr/lib/
|
cp /go/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.1.1/internal/api/libwasmvm.x86_64.so /usr/lib/
|
||||||
|
|
||||||
# Only export the final binary (+ shared objects). This reduces the image size
|
# Only export the final binary (+ shared objects). This reduces the image size
|
||||||
# from ~1GB to ~150MB.
|
# from ~1GB to ~150MB.
|
||||||
|
|
|
@ -210,6 +210,18 @@ func wormchainInstantiateContract(req *nodev1.WormchainInstantiateContract, time
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// wormchainMigrateContract converts a nodev1.WormchainMigrateContract to its canonical VAA representation
|
||||||
|
func wormchainMigrateContract(req *nodev1.WormchainMigrateContract, timestamp time.Time, guardianSetIndex uint32, nonce uint32, sequence uint64) (*vaa.VAA, error) {
|
||||||
|
instantiationParams_hash := vaa.CreateMigrateCosmwasmContractHash(req.CodeId, req.Contract, []byte(req.InstantiationMsg))
|
||||||
|
|
||||||
|
v := vaa.CreateGovernanceVAA(timestamp, nonce, sequence, guardianSetIndex,
|
||||||
|
vaa.BodyWormchainInstantiateContract{
|
||||||
|
InstantiationParamsHash: instantiationParams_hash,
|
||||||
|
}.Serialize())
|
||||||
|
|
||||||
|
return v, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *nodePrivilegedService) InjectGovernanceVAA(ctx context.Context, req *nodev1.InjectGovernanceVAARequest) (*nodev1.InjectGovernanceVAAResponse, error) {
|
func (s *nodePrivilegedService) InjectGovernanceVAA(ctx context.Context, req *nodev1.InjectGovernanceVAARequest) (*nodev1.InjectGovernanceVAAResponse, error) {
|
||||||
s.logger.Info("governance VAA injected via admin socket", zap.String("request", req.String()))
|
s.logger.Info("governance VAA injected via admin socket", zap.String("request", req.String()))
|
||||||
|
|
||||||
|
@ -236,6 +248,8 @@ func (s *nodePrivilegedService) InjectGovernanceVAA(ctx context.Context, req *no
|
||||||
v, err = wormchainStoreCode(payload.WormchainStoreCode, timestamp, req.CurrentSetIndex, message.Nonce, message.Sequence)
|
v, err = wormchainStoreCode(payload.WormchainStoreCode, timestamp, req.CurrentSetIndex, message.Nonce, message.Sequence)
|
||||||
case *nodev1.GovernanceMessage_WormchainInstantiateContract:
|
case *nodev1.GovernanceMessage_WormchainInstantiateContract:
|
||||||
v, err = wormchainInstantiateContract(payload.WormchainInstantiateContract, timestamp, req.CurrentSetIndex, message.Nonce, message.Sequence)
|
v, err = wormchainInstantiateContract(payload.WormchainInstantiateContract, timestamp, req.CurrentSetIndex, message.Nonce, message.Sequence)
|
||||||
|
case *nodev1.GovernanceMessage_WormchainMigrateContract:
|
||||||
|
v, err = wormchainMigrateContract(payload.WormchainMigrateContract, timestamp, req.CurrentSetIndex, message.Nonce, message.Sequence)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unsupported VAA type: %T", payload))
|
panic(fmt.Sprintf("unsupported VAA type: %T", payload))
|
||||||
}
|
}
|
||||||
|
|
34
node/go.mod
34
node/go.mod
|
@ -27,10 +27,10 @@ require (
|
||||||
github.com/mr-tron/base58 v1.2.0
|
github.com/mr-tron/base58 v1.2.0
|
||||||
github.com/multiformats/go-multiaddr v0.6.0
|
github.com/multiformats/go-multiaddr v0.6.0
|
||||||
github.com/near/borsh-go v0.3.0
|
github.com/near/borsh-go v0.3.0
|
||||||
github.com/prometheus/client_golang v1.12.2
|
github.com/prometheus/client_golang v1.14.0
|
||||||
github.com/spf13/cobra v1.6.0
|
github.com/spf13/cobra v1.6.0
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/spf13/viper v1.13.0
|
github.com/spf13/viper v1.14.0
|
||||||
github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969
|
github.com/status-im/keycard-go v0.0.0-20200402102358-957c09536969
|
||||||
github.com/stretchr/testify v1.8.1
|
github.com/stretchr/testify v1.8.1
|
||||||
github.com/tendermint/tendermint v0.34.24
|
github.com/tendermint/tendermint v0.34.24
|
||||||
|
@ -48,12 +48,12 @@ require (
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go/logging v1.4.2
|
cloud.google.com/go/logging v1.4.2
|
||||||
cloud.google.com/go/pubsub v1.25.1
|
cloud.google.com/go/pubsub v1.25.1
|
||||||
github.com/CosmWasm/wasmd v0.28.0
|
github.com/CosmWasm/wasmd v0.30.0
|
||||||
github.com/algorand/go-algorand-sdk v1.23.0
|
github.com/algorand/go-algorand-sdk v1.23.0
|
||||||
github.com/benbjohnson/clock v1.3.0
|
github.com/benbjohnson/clock v1.3.0
|
||||||
github.com/blendle/zapdriver v1.3.1
|
github.com/blendle/zapdriver v1.3.1
|
||||||
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
|
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
|
||||||
github.com/cosmos/cosmos-sdk v0.45.9
|
github.com/cosmos/cosmos-sdk v0.45.11
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
|
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
|
||||||
github.com/test-go/testify v1.1.4
|
github.com/test-go/testify v1.1.4
|
||||||
|
@ -61,6 +61,7 @@ require (
|
||||||
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220926172624-4b38dc650bb0
|
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220926172624-4b38dc650bb0
|
||||||
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
|
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e
|
||||||
golang.org/x/text v0.4.0
|
golang.org/x/text v0.4.0
|
||||||
|
nhooyr.io/websocket v1.8.7
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
@ -74,8 +75,8 @@ require (
|
||||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
|
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
|
||||||
github.com/99designs/keyring v1.2.1 // indirect
|
github.com/99designs/keyring v1.2.1 // indirect
|
||||||
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
|
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
|
||||||
github.com/CosmWasm/wasmvm v1.0.0 // indirect
|
github.com/CosmWasm/wasmvm v1.1.1 // indirect
|
||||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
github.com/StackExchange/wmi v1.2.1 // indirect
|
||||||
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
|
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
|
||||||
github.com/Workiva/go-datastructures v1.0.53 // indirect
|
github.com/Workiva/go-datastructures v1.0.53 // indirect
|
||||||
github.com/algorand/go-codec/codec v1.1.8 // indirect
|
github.com/algorand/go-codec/codec v1.1.8 // indirect
|
||||||
|
@ -96,10 +97,12 @@ require (
|
||||||
github.com/containerd/cgroups v1.0.4 // indirect
|
github.com/containerd/cgroups v1.0.4 // indirect
|
||||||
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534 // indirect
|
github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534 // indirect
|
||||||
github.com/cosmos/btcutil v1.0.5 // indirect
|
github.com/cosmos/btcutil v1.0.5 // indirect
|
||||||
|
github.com/cosmos/cosmos-proto v1.0.0-alpha8 // indirect
|
||||||
github.com/cosmos/go-bip39 v1.0.0 // indirect
|
github.com/cosmos/go-bip39 v1.0.0 // indirect
|
||||||
|
github.com/cosmos/gogoproto v1.4.3 // indirect
|
||||||
github.com/cosmos/gorocksdb v1.2.0 // indirect
|
github.com/cosmos/gorocksdb v1.2.0 // indirect
|
||||||
github.com/cosmos/iavl v0.19.3 // indirect
|
github.com/cosmos/iavl v0.19.4 // indirect
|
||||||
github.com/cosmos/ibc-go/v3 v3.3.0 // indirect
|
github.com/cosmos/ibc-go/v4 v4.2.0 // indirect
|
||||||
github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect
|
github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect
|
||||||
github.com/creachadair/taskgroup v0.3.2 // indirect
|
github.com/creachadair/taskgroup v0.3.2 // indirect
|
||||||
github.com/danieljoos/wincred v1.1.2 // indirect
|
github.com/danieljoos/wincred v1.1.2 // indirect
|
||||||
|
@ -111,6 +114,7 @@ require (
|
||||||
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
||||||
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
||||||
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
|
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
|
||||||
|
github.com/docker/distribution v2.8.1+incompatible // indirect
|
||||||
github.com/docker/go-units v0.5.0 // indirect
|
github.com/docker/go-units v0.5.0 // indirect
|
||||||
github.com/dustin/go-humanize v1.0.0 // indirect
|
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||||
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
|
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
|
||||||
|
@ -119,7 +123,7 @@ require (
|
||||||
github.com/felixge/httpsnoop v1.0.2 // indirect
|
github.com/felixge/httpsnoop v1.0.2 // indirect
|
||||||
github.com/flynn/noise v1.0.0 // indirect
|
github.com/flynn/noise v1.0.0 // indirect
|
||||||
github.com/francoispqt/gojay v1.2.13 // indirect
|
github.com/francoispqt/gojay v1.2.13 // indirect
|
||||||
github.com/fsnotify/fsnotify v1.5.4 // indirect
|
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||||
github.com/gagliardetto/binary v0.7.3 // indirect
|
github.com/gagliardetto/binary v0.7.3 // indirect
|
||||||
github.com/gagliardetto/treeout v0.1.4 // indirect
|
github.com/gagliardetto/treeout v0.1.4 // indirect
|
||||||
github.com/go-kit/kit v0.12.0 // indirect
|
github.com/go-kit/kit v0.12.0 // indirect
|
||||||
|
@ -136,7 +140,7 @@ require (
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/golang/protobuf v1.5.2 // indirect
|
github.com/golang/protobuf v1.5.2 // indirect
|
||||||
github.com/golang/snappy v0.0.4 // indirect
|
github.com/golang/snappy v0.0.4 // indirect
|
||||||
github.com/google/btree v1.0.1 // indirect
|
github.com/google/btree v1.1.2 // indirect
|
||||||
github.com/google/flatbuffers v1.12.0 // indirect
|
github.com/google/flatbuffers v1.12.0 // indirect
|
||||||
github.com/google/go-cmp v0.5.9 // indirect
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
github.com/google/go-querystring v1.0.0 // indirect
|
github.com/google/go-querystring v1.0.0 // indirect
|
||||||
|
@ -225,7 +229,8 @@ require (
|
||||||
github.com/nxadm/tail v1.4.8 // indirect
|
github.com/nxadm/tail v1.4.8 // indirect
|
||||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||||
github.com/onsi/ginkgo v1.16.5 // indirect
|
github.com/onsi/ginkgo v1.16.5 // indirect
|
||||||
github.com/onsi/gomega v1.19.0 // indirect
|
github.com/onsi/gomega v1.20.0 // indirect
|
||||||
|
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||||
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
|
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
|
||||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||||
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
|
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
|
||||||
|
@ -235,7 +240,7 @@ require (
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 // indirect
|
github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 // indirect
|
||||||
github.com/prometheus/client_model v0.2.0 // indirect
|
github.com/prometheus/client_model v0.3.0 // indirect
|
||||||
github.com/prometheus/common v0.37.0 // indirect
|
github.com/prometheus/common v0.37.0 // indirect
|
||||||
github.com/prometheus/procfs v0.8.0 // indirect
|
github.com/prometheus/procfs v0.8.0 // indirect
|
||||||
github.com/prometheus/tsdb v0.7.1 // indirect
|
github.com/prometheus/tsdb v0.7.1 // indirect
|
||||||
|
@ -250,7 +255,7 @@ require (
|
||||||
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
|
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
|
||||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
|
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
|
||||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||||
github.com/spf13/afero v1.8.2 // indirect
|
github.com/spf13/afero v1.9.2 // indirect
|
||||||
github.com/spf13/cast v1.5.0 // indirect
|
github.com/spf13/cast v1.5.0 // indirect
|
||||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||||
github.com/streamingfast/logging v0.0.0-20220813175024-b4fbb0e893df // indirect
|
github.com/streamingfast/logging v0.0.0-20220813175024-b4fbb0e893df // indirect
|
||||||
|
@ -290,7 +295,6 @@ require (
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
lukechampine.com/blake3 v1.1.7 // indirect
|
lukechampine.com/blake3 v1.1.7 // indirect
|
||||||
nhooyr.io/websocket v1.8.7 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Needed for cosmos-sdk based chains. See
|
// Needed for cosmos-sdk based chains. See
|
||||||
|
@ -301,6 +305,6 @@ replace github.com/wormhole-foundation/wormhole/sdk => ../sdk
|
||||||
|
|
||||||
replace github.com/wormhole-foundation/wormchain => ../wormchain
|
replace github.com/wormhole-foundation/wormchain => ../wormchain
|
||||||
|
|
||||||
replace github.com/CosmWasm/wasmd v0.28.0 => github.com/wormhole-foundation/wasmd v0.28.0-wormhole-2
|
replace github.com/CosmWasm/wasmd v0.30.0 => github.com/wormhole-foundation/wasmd v0.30.0-wormchain-1
|
||||||
|
|
||||||
replace github.com/cosmos/cosmos-sdk => github.com/wormhole-foundation/cosmos-sdk v0.45.9-wormhole
|
replace github.com/cosmos/cosmos-sdk => github.com/wormhole-foundation/cosmos-sdk v0.45.9-wormhole
|
||||||
|
|
268
node/go.sum
268
node/go.sum
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -88,6 +88,7 @@ message GovernanceMessage {
|
||||||
|
|
||||||
WormchainStoreCode wormchain_store_code = 14;
|
WormchainStoreCode wormchain_store_code = 14;
|
||||||
WormchainInstantiateContract wormchain_instantiate_contract = 15;
|
WormchainInstantiateContract wormchain_instantiate_contract = 15;
|
||||||
|
WormchainMigrateContract wormchain_migrate_contract = 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,6 +167,17 @@ message WormchainInstantiateContract {
|
||||||
string instantiation_msg = 3;
|
string instantiation_msg = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message WormchainMigrateContract {
|
||||||
|
// CodeID is the reference to the stored WASM code that the contract should migrate to.
|
||||||
|
uint64 code_id = 1;
|
||||||
|
|
||||||
|
// The address of the contract being migrated.
|
||||||
|
string contract = 2;
|
||||||
|
|
||||||
|
// Msg json encoded message to be passed to the contract on migration
|
||||||
|
string instantiation_msg = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message FindMissingMessagesRequest {
|
message FindMissingMessagesRequest {
|
||||||
// Emitter chain ID to iterate.
|
// Emitter chain ID to iterate.
|
||||||
uint32 emitter_chain = 1;
|
uint32 emitter_chain = 1;
|
||||||
|
|
|
@ -57,3 +57,33 @@ func CreateInstatiateCosmwasmContractHash(codeId uint64, label string, msg []byt
|
||||||
|
|
||||||
return expected_hash
|
return expected_hash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compute the hash for cosmwasm contract migration params.
|
||||||
|
// The hash is keccak256 hash(hash(hash(BigEndian(CodeID)), Contract), Msg).
|
||||||
|
// We compute the nested hash so there is no chance of bytes leaking between CodeID, Contract, and Msg.
|
||||||
|
func CreateMigrateCosmwasmContractHash(codeId uint64, contract string, msg []byte) [32]byte {
|
||||||
|
var expected_hash [32]byte
|
||||||
|
|
||||||
|
// hash(BigEndian(CodeID))
|
||||||
|
var codeId_hash [32]byte
|
||||||
|
keccak := sha3.NewLegacyKeccak256()
|
||||||
|
if err := binary.Write(keccak, binary.BigEndian, codeId); err != nil {
|
||||||
|
panic(fmt.Sprintf("failed to write binary data (%d): %v", codeId, err))
|
||||||
|
}
|
||||||
|
keccak.Sum(codeId_hash[:0])
|
||||||
|
keccak.Reset()
|
||||||
|
|
||||||
|
// hash(hash(BigEndian(CodeID)), Label)
|
||||||
|
var codeIdContract_hash [32]byte
|
||||||
|
keccak.Write(codeId_hash[:])
|
||||||
|
keccak.Write([]byte(contract))
|
||||||
|
keccak.Sum(codeIdContract_hash[:0])
|
||||||
|
keccak.Reset()
|
||||||
|
|
||||||
|
// hash(hash(hash(BigEndian(CodeID)), Label), Msg)
|
||||||
|
keccak.Write(codeIdContract_hash[:])
|
||||||
|
keccak.Write(msg)
|
||||||
|
keccak.Sum(expected_hash[:0])
|
||||||
|
|
||||||
|
return expected_hash
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ var (
|
||||||
// Wormchain cosmwasm governance actions
|
// Wormchain cosmwasm governance actions
|
||||||
ActionStoreCode GovernanceAction = 1
|
ActionStoreCode GovernanceAction = 1
|
||||||
ActionInstantiateContract GovernanceAction = 2
|
ActionInstantiateContract GovernanceAction = 2
|
||||||
|
ActionMigrateContract GovernanceAction = 3
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
@ -62,6 +63,11 @@ type (
|
||||||
BodyWormchainInstantiateContract struct {
|
BodyWormchainInstantiateContract struct {
|
||||||
InstantiationParamsHash [32]byte
|
InstantiationParamsHash [32]byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BodyWormchainInstantiateContract is a governance message to migrate a cosmwasm contract on wormchain
|
||||||
|
BodyWormchainMigrateContract struct {
|
||||||
|
MigrationParamsHash [32]byte
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b BodyContractUpgrade) Serialize() []byte {
|
func (b BodyContractUpgrade) Serialize() []byte {
|
||||||
|
@ -118,6 +124,10 @@ func (r BodyWormchainInstantiateContract) Serialize() []byte {
|
||||||
return serializeBridgeGovernanceVaa(WasmdModuleStr, ActionInstantiateContract, ChainIDWormchain, r.InstantiationParamsHash[:])
|
return serializeBridgeGovernanceVaa(WasmdModuleStr, ActionInstantiateContract, ChainIDWormchain, r.InstantiationParamsHash[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r BodyWormchainMigrateContract) Serialize() []byte {
|
||||||
|
return serializeBridgeGovernanceVaa(WasmdModuleStr, ActionMigrateContract, ChainIDWormchain, r.MigrationParamsHash[:])
|
||||||
|
}
|
||||||
|
|
||||||
func serializeBridgeGovernanceVaa(module string, actionId GovernanceAction, chainId ChainID, payload []byte) []byte {
|
func serializeBridgeGovernanceVaa(module string, actionId GovernanceAction, chainId ChainID, payload []byte) []byte {
|
||||||
if len(module) > 32 {
|
if len(module) > 32 {
|
||||||
panic("module longer than 32 byte")
|
panic("module longer than 32 byte")
|
||||||
|
|
|
@ -117,3 +117,9 @@ func TestBodyWormchainInstantiateContractSerialize(t *testing.T) {
|
||||||
expected := "0000000000000000000000000000000000000000005761736d644d6f64756c65020c200102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20"
|
expected := "0000000000000000000000000000000000000000005761736d644d6f64756c65020c200102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20"
|
||||||
assert.Equal(t, expected, hex.EncodeToString(actual.Serialize()))
|
assert.Equal(t, expected, hex.EncodeToString(actual.Serialize()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestBodyWormchainMigrateContractSerialize(t *testing.T) {
|
||||||
|
actual := BodyWormchainMigrateContract{MigrationParamsHash: dummyBytes}
|
||||||
|
expected := "0000000000000000000000000000000000000000005761736d644d6f64756c65030c200102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20"
|
||||||
|
assert.Equal(t, expected, hex.EncodeToString(actual.Serialize()))
|
||||||
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ COPY ./sdk /sdk
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# copy over c bindings (libwasmvm.x86_64.so, etc)
|
# copy over c bindings (libwasmvm.x86_64.so, etc)
|
||||||
RUN cp -r /go/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.0.0/api/* /usr/lib
|
RUN cp -r /go/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.1.1/internal/api/* /usr/lib
|
||||||
|
|
||||||
COPY ./wormchain .
|
COPY ./wormchain .
|
||||||
|
|
||||||
|
|
|
@ -69,14 +69,14 @@ import (
|
||||||
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
|
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
|
||||||
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
|
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
|
||||||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
||||||
"github.com/cosmos/ibc-go/v3/modules/apps/transfer"
|
transfer "github.com/cosmos/ibc-go/v4/modules/apps/transfer"
|
||||||
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
|
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
|
||||||
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
|
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
|
||||||
ibc "github.com/cosmos/ibc-go/v3/modules/core"
|
ibc "github.com/cosmos/ibc-go/v4/modules/core"
|
||||||
ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client"
|
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
|
||||||
ibcporttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
|
ibcporttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
|
||||||
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
|
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
|
||||||
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
|
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
abci "github.com/tendermint/tendermint/abci/types"
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
|
|
|
@ -28,6 +28,9 @@ func (b *BankViewKeeperHandler) GetAllBalances(ctx sdk.Context, addr sdk.AccAddr
|
||||||
func (b *BankViewKeeperHandler) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin {
|
func (b *BankViewKeeperHandler) GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin {
|
||||||
return b.Keeper.GetBalance(ctx, addr, denom)
|
return b.Keeper.GetBalance(ctx, addr, denom)
|
||||||
}
|
}
|
||||||
|
func (b *BankViewKeeperHandler) GetSupply(ctx sdk.Context, denom string) sdk.Coin {
|
||||||
|
return b.Keeper.GetSupply(ctx, denom)
|
||||||
|
}
|
||||||
|
|
||||||
func (b *BurnerHandler) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error {
|
func (b *BurnerHandler) BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error {
|
||||||
return b.Keeper.BurnCoins(ctx, moduleName, amt)
|
return b.Keeper.BurnCoins(ctx, moduleName, amt)
|
||||||
|
|
|
@ -6,12 +6,12 @@ import (
|
||||||
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
|
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
||||||
ibcappkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
|
ibcappkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
|
||||||
connectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"
|
connectiontypes "github.com/cosmos/ibc-go/v4/modules/core/03-connection/types"
|
||||||
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/04-channel/keeper"
|
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/04-channel/keeper"
|
||||||
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"
|
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
|
||||||
ibcportkeeper "github.com/cosmos/ibc-go/v3/modules/core/05-port/keeper"
|
ibcportkeeper "github.com/cosmos/ibc-go/v4/modules/core/05-port/keeper"
|
||||||
ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported"
|
ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported"
|
||||||
)
|
)
|
||||||
|
|
||||||
// This defines which modules we actually want to expose cosmwasm contracts.
|
// This defines which modules we actually want to expose cosmwasm contracts.
|
||||||
|
|
|
@ -3,27 +3,26 @@ module github.com/wormhole-foundation/wormchain
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/CosmWasm/wasmd v0.28.0
|
github.com/CosmWasm/wasmd v0.30.0
|
||||||
github.com/CosmWasm/wasmvm v1.0.0
|
github.com/CosmWasm/wasmvm v1.1.1
|
||||||
github.com/cosmos/cosmos-sdk v0.45.9
|
github.com/cosmos/cosmos-sdk v0.45.11
|
||||||
github.com/cosmos/ibc-go/v3 v3.3.0
|
github.com/cosmos/ibc-go/v3 v3.3.0
|
||||||
github.com/dgraph-io/ristretto v0.1.0 // indirect
|
github.com/cosmos/ibc-go/v4 v4.2.0
|
||||||
github.com/ethereum/go-ethereum v1.10.21
|
github.com/ethereum/go-ethereum v1.10.21
|
||||||
github.com/gogo/protobuf v1.3.3
|
github.com/gogo/protobuf v1.3.3
|
||||||
github.com/golang/glog v1.0.0 // indirect
|
|
||||||
github.com/golang/protobuf v1.5.2
|
github.com/golang/protobuf v1.5.2
|
||||||
github.com/gorilla/mux v1.8.0
|
github.com/gorilla/mux v1.8.0
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
github.com/grpc-ecosystem/grpc-gateway v1.16.0
|
||||||
github.com/prometheus/client_golang v1.12.2
|
github.com/prometheus/client_golang v1.14.0
|
||||||
github.com/spf13/cast v1.5.0
|
github.com/spf13/cast v1.5.0
|
||||||
github.com/spf13/cobra v1.5.0
|
github.com/spf13/cobra v1.6.0
|
||||||
github.com/stretchr/testify v1.8.0
|
github.com/stretchr/testify v1.8.1
|
||||||
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
|
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
|
||||||
github.com/tendermint/spm v0.1.9
|
github.com/tendermint/spm v0.1.9
|
||||||
github.com/tendermint/tendermint v0.34.21
|
github.com/tendermint/tendermint v0.34.23
|
||||||
github.com/tendermint/tm-db v0.6.7
|
github.com/tendermint/tm-db v0.6.7
|
||||||
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220926172624-4b38dc650bb0
|
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20220926172624-4b38dc650bb0
|
||||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
|
golang.org/x/crypto v0.1.0
|
||||||
golang.org/x/net v0.2.0 // indirect
|
golang.org/x/net v0.2.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1
|
google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1
|
||||||
google.golang.org/grpc v1.50.1
|
google.golang.org/grpc v1.50.1
|
||||||
|
@ -32,7 +31,7 @@ require (
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
|
github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76
|
||||||
github.com/CosmWasm/wasmd v0.28.0 => github.com/wormhole-foundation/wasmd v0.28.0-wormhole-3
|
github.com/CosmWasm/wasmd v0.30.0 => github.com/wormhole-foundation/wasmd v0.30.0-wormchain-1
|
||||||
github.com/cosmos/cosmos-sdk => github.com/wormhole-foundation/cosmos-sdk v0.45.9-wormhole-2
|
github.com/cosmos/cosmos-sdk => github.com/wormhole-foundation/cosmos-sdk v0.45.9-wormhole-2
|
||||||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
|
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
|
||||||
github.com/wormhole-foundation/wormhole/sdk => ../sdk
|
github.com/wormhole-foundation/wormhole/sdk => ../sdk
|
||||||
|
|
345
wormchain/go.sum
345
wormchain/go.sum
File diff suppressed because it is too large
Load Diff
|
@ -19,6 +19,9 @@ service Msg {
|
||||||
// Instantiate creates a new smart contract instance for the given code id.
|
// Instantiate creates a new smart contract instance for the given code id.
|
||||||
rpc InstantiateContract(MsgInstantiateContract)
|
rpc InstantiateContract(MsgInstantiateContract)
|
||||||
returns (MsgInstantiateContractResponse);
|
returns (MsgInstantiateContractResponse);
|
||||||
|
|
||||||
|
rpc MigrateContract(MsgMigrateContract)
|
||||||
|
returns (MsgMigrateContractResponse);
|
||||||
// this line is used by starport scaffolding # proto/tx/rpc
|
// this line is used by starport scaffolding # proto/tx/rpc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,6 +73,8 @@ message MsgStoreCode {
|
||||||
message MsgStoreCodeResponse {
|
message MsgStoreCodeResponse {
|
||||||
// CodeID is the reference to the stored WASM code
|
// CodeID is the reference to the stored WASM code
|
||||||
uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ];
|
uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ];
|
||||||
|
// Checksum is the sha256 hash of the stored code
|
||||||
|
bytes checksum = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same as from x/wasmd but with vaa auth
|
// Same as from x/wasmd but with vaa auth
|
||||||
|
@ -82,7 +87,7 @@ message MsgInstantiateContract {
|
||||||
string label = 4;
|
string label = 4;
|
||||||
// Msg json encoded message to be passed to the contract on instantiation
|
// Msg json encoded message to be passed to the contract on instantiation
|
||||||
bytes msg = 5;
|
bytes msg = 5;
|
||||||
// vaa must be governance msg with payload containing sha3 256 hash of `bigEndian(code_id) || label || msg`
|
// vaa must be governance msg with payload containing keccak256 hash(hash(hash(BigEndian(CodeID)), Label), Msg)
|
||||||
bytes vaa = 6;
|
bytes vaa = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,4 +98,25 @@ message MsgInstantiateContractResponse {
|
||||||
bytes data = 2;
|
bytes data = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract
|
||||||
|
message MsgMigrateContract {
|
||||||
|
// Sender is the that actor that signed the messages
|
||||||
|
string signer = 1;
|
||||||
|
// Contract is the address of the smart contract
|
||||||
|
string contract = 2;
|
||||||
|
// CodeID references the new WASM code
|
||||||
|
uint64 code_id = 3 [ (gogoproto.customname) = "CodeID" ];
|
||||||
|
// Msg json encoded message to be passed to the contract on migration
|
||||||
|
bytes msg = 4;
|
||||||
|
|
||||||
|
// vaa must be governance msg with payload containing keccak256 hash(hash(hash(BigEndian(CodeID)), Contract), Msg)
|
||||||
|
bytes vaa = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MsgMigrateContractResponse returns contract migration result data.
|
||||||
|
message MsgMigrateContractResponse {
|
||||||
|
// Data contains same raw bytes returned as data from the wasm contract.
|
||||||
|
// (May be empty)
|
||||||
|
bytes data = 1;
|
||||||
|
}
|
||||||
// this line is used by starport scaffolding # proto/tx/message
|
// this line is used by starport scaffolding # proto/tx/message
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,6 +24,7 @@ func GetTxCmd() *cobra.Command {
|
||||||
cmd.AddCommand(CmdRegisterAccountAsGuardian())
|
cmd.AddCommand(CmdRegisterAccountAsGuardian())
|
||||||
cmd.AddCommand(CmdStoreCode())
|
cmd.AddCommand(CmdStoreCode())
|
||||||
cmd.AddCommand(CmdInstantiateContract())
|
cmd.AddCommand(CmdInstantiateContract())
|
||||||
|
cmd.AddCommand(CmdMigrateContract())
|
||||||
cmd.AddCommand(CmdCreateAllowedAddress())
|
cmd.AddCommand(CmdCreateAllowedAddress())
|
||||||
cmd.AddCommand(CmdDeleteAllowedAddress())
|
cmd.AddCommand(CmdDeleteAllowedAddress())
|
||||||
// this line is used by starport scaffolding # 1
|
// this line is used by starport scaffolding # 1
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"encoding/binary"
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
|
||||||
"github.com/CosmWasm/wasmd/x/wasm/ioutils"
|
"github.com/CosmWasm/wasmd/x/wasm/ioutils"
|
||||||
|
@ -16,6 +15,7 @@ import (
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/wormhole-foundation/wormchain/x/wormhole/types"
|
"github.com/wormhole-foundation/wormchain/x/wormhole/types"
|
||||||
|
"github.com/wormhole-foundation/wormhole/sdk/vaa"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -132,12 +132,62 @@ func CmdInstantiateContract() *cobra.Command {
|
||||||
}
|
}
|
||||||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
||||||
} else {
|
} else {
|
||||||
var hash [32]byte
|
hash := vaa.CreateInstatiateCosmwasmContractHash(msg.CodeID, msg.Label, msg.Msg)
|
||||||
keccak := sha3.NewLegacyKeccak256()
|
fmt.Println(hex.EncodeToString(hash[:]))
|
||||||
binary.Write(keccak, binary.BigEndian, msg.CodeID)
|
return nil
|
||||||
keccak.Write([]byte(msg.Label))
|
}
|
||||||
keccak.Write([]byte(msg.Msg))
|
},
|
||||||
keccak.Sum(hash[:0])
|
}
|
||||||
|
|
||||||
|
cmd.Flags().String("label", "", "A human-readable name for this contract in lists")
|
||||||
|
flags.AddTxFlagsToCmd(cmd)
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
func CmdMigrateContract() *cobra.Command {
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: "migrate [contract] [code_id_int64] [json_encoded_init_args] [vaa-hex]",
|
||||||
|
Short: "Migrate a wasmd contract, or just compute the hash for vaa if vaa is omitted",
|
||||||
|
Args: cobra.RangeArgs(3, 4),
|
||||||
|
RunE: func(cmd *cobra.Command, args []string) (err error) {
|
||||||
|
clientCtx, err := client.GetClientTxContext(cmd)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
hash_only := len(args) == 3
|
||||||
|
|
||||||
|
contract := args[0]
|
||||||
|
|
||||||
|
codeId, err := cast.ToUint64E(args[1])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
initMsg := args[2]
|
||||||
|
|
||||||
|
vaaBz := []byte{}
|
||||||
|
if !hash_only {
|
||||||
|
vaaBz, err = hex.DecodeString(args[3])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
msg := types.MsgMigrateContract{
|
||||||
|
Signer: clientCtx.GetFromAddress().String(),
|
||||||
|
CodeID: codeId,
|
||||||
|
Contract: contract,
|
||||||
|
Msg: []byte(initMsg),
|
||||||
|
Vaa: vaaBz,
|
||||||
|
}
|
||||||
|
if !hash_only {
|
||||||
|
if err := msg.ValidateBasic(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), &msg)
|
||||||
|
} else {
|
||||||
|
hash := vaa.CreateMigrateCosmwasmContractHash(msg.CodeID, msg.Contract, msg.Msg)
|
||||||
fmt.Println(hex.EncodeToString(hash[:]))
|
fmt.Println(hex.EncodeToString(hash[:]))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler {
|
||||||
case *types.MsgInstantiateContract:
|
case *types.MsgInstantiateContract:
|
||||||
res, err := msgServer.InstantiateContract(sdk.WrapSDKContext(ctx), msg)
|
res, err := msgServer.InstantiateContract(sdk.WrapSDKContext(ctx), msg)
|
||||||
return sdk.WrapServiceResult(ctx, res, err)
|
return sdk.WrapServiceResult(ctx, res, err)
|
||||||
|
case *types.MsgMigrateContract:
|
||||||
|
res, err := msgServer.MigrateContract(sdk.WrapSDKContext(ctx), msg)
|
||||||
|
return sdk.WrapServiceResult(ctx, res, err)
|
||||||
case *types.MsgCreateAllowlistEntryRequest:
|
case *types.MsgCreateAllowlistEntryRequest:
|
||||||
res, err := msgServer.CreateAllowlistEntry(sdk.WrapSDKContext(ctx), msg)
|
res, err := msgServer.CreateAllowlistEntry(sdk.WrapSDKContext(ctx), msg)
|
||||||
return sdk.WrapServiceResult(ctx, res, err)
|
return sdk.WrapServiceResult(ctx, res, err)
|
||||||
|
|
|
@ -12,6 +12,8 @@ import (
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var WASMD_CONTRACT_ADMIN = sdk.AccAddress("wormchain")
|
||||||
|
|
||||||
// Simple wrapper of x/wasmd StoreCode that requires a VAA
|
// Simple wrapper of x/wasmd StoreCode that requires a VAA
|
||||||
func (k msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*types.MsgStoreCodeResponse, error) {
|
func (k msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*types.MsgStoreCodeResponse, error) {
|
||||||
if !k.setWasmd {
|
if !k.setWasmd {
|
||||||
|
@ -52,12 +54,13 @@ func (k msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*t
|
||||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
||||||
sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer),
|
sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer),
|
||||||
))
|
))
|
||||||
codeID, err := k.wasmdKeeper.Create(ctx, senderAddr, msg.WASMByteCode, &wasmdtypes.DefaultUploadAccess)
|
codeID, chksum, err := k.wasmdKeeper.Create(ctx, senderAddr, msg.WASMByteCode, &wasmdtypes.DefaultUploadAccess)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &types.MsgStoreCodeResponse{
|
return &types.MsgStoreCodeResponse{
|
||||||
CodeID: codeID,
|
CodeID: codeID,
|
||||||
|
Checksum: chksum,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +87,8 @@ func (k msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst
|
||||||
return nil, types.ErrUnknownGovernanceAction
|
return nil, types.ErrUnknownGovernanceAction
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to verify the instatiation arguments
|
// Need to verify the instantiation arguments
|
||||||
// The vaa governance payload must contain the hash of the expected args.
|
// The vaa governance payload must contain the hash of the expected args.
|
||||||
|
|
||||||
expected_hash := vaa.CreateInstatiateCosmwasmContractHash(msg.CodeID, msg.Label, msg.Msg)
|
expected_hash := vaa.CreateInstatiateCosmwasmContractHash(msg.CodeID, msg.Label, msg.Msg)
|
||||||
if !bytes.Equal(payload, expected_hash[:]) {
|
if !bytes.Equal(payload, expected_hash[:]) {
|
||||||
return nil, types.ErrInvalidHash
|
return nil, types.ErrInvalidHash
|
||||||
|
@ -102,7 +104,7 @@ func (k msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst
|
||||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
||||||
sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer),
|
sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer),
|
||||||
))
|
))
|
||||||
contract_addr, data, err := k.wasmdKeeper.Instantiate(ctx, msg.CodeID, senderAddr, sdk.AccAddress{}, msg.Msg, msg.Label, sdk.Coins{})
|
contract_addr, data, err := k.wasmdKeeper.Instantiate(ctx, msg.CodeID, senderAddr, WASMD_CONTRACT_ADMIN, msg.Msg, msg.Label, sdk.Coins{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -111,3 +113,54 @@ func (k msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInst
|
||||||
Data: data,
|
Data: data,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (k msgServer) MigrateContract(goCtx context.Context, msg *types.MsgMigrateContract) (*types.MsgMigrateContractResponse, error) {
|
||||||
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
|
||||||
|
// Parse VAA
|
||||||
|
v, err := ParseVAA(msg.Vaa)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify VAA
|
||||||
|
action, payload, err := k.VerifyGovernanceVAA(ctx, v, vaa.WasmdModule)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if vaa.GovernanceAction(action) != vaa.ActionMigrateContract {
|
||||||
|
return nil, types.ErrUnknownGovernanceAction
|
||||||
|
}
|
||||||
|
|
||||||
|
// Need to verify the instantiation arguments
|
||||||
|
// The vaa governance payload must contain the hash of the expected args.
|
||||||
|
expected_hash := vaa.CreateMigrateCosmwasmContractHash(msg.CodeID, msg.Contract, msg.Msg)
|
||||||
|
if !bytes.Equal(payload, expected_hash[:]) {
|
||||||
|
return nil, types.ErrInvalidHash
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = sdk.AccAddressFromBech32(msg.Signer)
|
||||||
|
if err != nil {
|
||||||
|
return nil, sdkerrors.Wrap(err, "sender")
|
||||||
|
}
|
||||||
|
contractAddr, err := sdk.AccAddressFromBech32(msg.Contract)
|
||||||
|
if err != nil {
|
||||||
|
return nil, sdkerrors.Wrap(err, "contract")
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.EventManager().EmitEvent(sdk.NewEvent(
|
||||||
|
sdk.EventTypeMessage,
|
||||||
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
||||||
|
sdk.NewAttribute(sdk.AttributeKeySender, msg.Signer),
|
||||||
|
))
|
||||||
|
|
||||||
|
data, err := k.wasmdKeeper.Migrate(ctx, contractAddr, WASMD_CONTRACT_ADMIN, msg.CodeID, msg.Msg)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &types.MsgMigrateContractResponse{
|
||||||
|
Data: data,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
|
@ -42,6 +42,22 @@ func createWasmInstantiatePayload(code_id uint64, label string, json_msg string)
|
||||||
return payload.Bytes()
|
return payload.Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func createWasmMigratePayload(code_id uint64, contract string, json_msg string) []byte {
|
||||||
|
// governance message with sha3 of arguments to instantiate
|
||||||
|
// - code_id (big endian)
|
||||||
|
// - label
|
||||||
|
// - json_msg
|
||||||
|
expected_hash := vaa.CreateMigrateCosmwasmContractHash(code_id, contract, []byte(json_msg))
|
||||||
|
|
||||||
|
var payload bytes.Buffer
|
||||||
|
payload.Write(vaa.WasmdModule[:])
|
||||||
|
payload.Write([]byte{byte(vaa.ActionMigrateContract)})
|
||||||
|
binary.Write(&payload, binary.BigEndian, uint16(vaa.ChainIDWormchain))
|
||||||
|
// custom payload
|
||||||
|
payload.Write(expected_hash[:])
|
||||||
|
return payload.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
func TestWasmdStoreCode(t *testing.T) {
|
func TestWasmdStoreCode(t *testing.T) {
|
||||||
k, ctx := keepertest.WormholeKeeper(t)
|
k, ctx := keepertest.WormholeKeeper(t)
|
||||||
guardians, privateKeys := createNGuardianValidator(k, ctx, 10)
|
guardians, privateKeys := createNGuardianValidator(k, ctx, 10)
|
||||||
|
@ -207,7 +223,7 @@ func TestWasmdInstantiateContract(t *testing.T) {
|
||||||
// Bad msg
|
// Bad msg
|
||||||
assert.ErrorIs(t, err, types.ErrInvalidHash)
|
assert.ErrorIs(t, err, types.ErrInvalidHash)
|
||||||
|
|
||||||
// Sending to wrong module is error
|
// Sending to wrong module is error (basically test that governance verification is in place)
|
||||||
payload_wrong_module := createWasmInstantiatePayload(code_id, "btc", "{}")
|
payload_wrong_module := createWasmInstantiatePayload(code_id, "btc", "{}")
|
||||||
// tamper with the module id
|
// tamper with the module id
|
||||||
payload_wrong_module[16] = 0xff
|
payload_wrong_module[16] = 0xff
|
||||||
|
@ -221,4 +237,169 @@ func TestWasmdInstantiateContract(t *testing.T) {
|
||||||
Vaa: vBz,
|
Vaa: vBz,
|
||||||
})
|
})
|
||||||
assert.ErrorIs(t, err, types.ErrUnknownGovernanceModule)
|
assert.ErrorIs(t, err, types.ErrUnknownGovernanceModule)
|
||||||
|
|
||||||
|
// test action byte is checked by sending a valid migrate vaa
|
||||||
|
payload = createWasmMigratePayload(code_id, "btc", "{}")
|
||||||
|
v = generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, _ = v.Marshal()
|
||||||
|
_, err = msgServer.InstantiateContract(context, &types.MsgInstantiateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
CodeID: code_id,
|
||||||
|
Label: "btc",
|
||||||
|
Msg: []byte("{}"),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
assert.ErrorIs(t, err, types.ErrUnknownGovernanceAction)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestWasmdMigrateContract(t *testing.T) {
|
||||||
|
k, ctx := keepertest.WormholeKeeper(t)
|
||||||
|
guardians, privateKeys := createNGuardianValidator(k, ctx, 10)
|
||||||
|
_ = privateKeys
|
||||||
|
k.SetConfig(ctx, types.Config{
|
||||||
|
GovernanceEmitter: vaa.GovernanceEmitter[:],
|
||||||
|
GovernanceChain: uint32(vaa.GovernanceChain),
|
||||||
|
ChainId: uint32(vaa.ChainIDWormchain),
|
||||||
|
GuardianSetExpiration: 86400,
|
||||||
|
})
|
||||||
|
signer_bz := [20]byte{}
|
||||||
|
signer := sdk.AccAddress(signer_bz[:])
|
||||||
|
|
||||||
|
set := createNewGuardianSet(k, ctx, guardians)
|
||||||
|
|
||||||
|
context := sdk.WrapSDKContext(ctx)
|
||||||
|
msgServer := keeper.NewMsgServerImpl(*k)
|
||||||
|
|
||||||
|
// First we need to (1) upload some codes and (2) instantiate.
|
||||||
|
// (1) upload
|
||||||
|
payload := createWasmStoreCodePayload(keepertest.EXAMPLE_WASM_CONTRACT_GZIP)
|
||||||
|
code_ids := []uint64{}
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
v := generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, err := v.Marshal()
|
||||||
|
assert.NoError(t, err)
|
||||||
|
res, err := msgServer.StoreCode(context, &types.MsgStoreCode{
|
||||||
|
Signer: signer.String(),
|
||||||
|
WASMByteCode: keepertest.EXAMPLE_WASM_CONTRACT_GZIP,
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
code_ids = append(code_ids, res.CodeID)
|
||||||
|
}
|
||||||
|
|
||||||
|
// (2) instantiate
|
||||||
|
payload = createWasmInstantiatePayload(code_ids[0], "btc", "{}")
|
||||||
|
v := generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, _ := v.Marshal()
|
||||||
|
instantiate, err := msgServer.InstantiateContract(context, &types.MsgInstantiateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
CodeID: code_ids[0],
|
||||||
|
Label: "btc",
|
||||||
|
Msg: []byte("{}"),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
// Now we can test migrating
|
||||||
|
|
||||||
|
// Confirm migrate works
|
||||||
|
for _, code_id := range code_ids {
|
||||||
|
payload = createWasmMigratePayload(code_id, instantiate.Address, "{}")
|
||||||
|
v = generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, _ = v.Marshal()
|
||||||
|
_, err = msgServer.MigrateContract(context, &types.MsgMigrateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
CodeID: code_id,
|
||||||
|
Contract: instantiate.Address,
|
||||||
|
Msg: []byte("{}"),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test failure using the wrong codeid
|
||||||
|
payload = createWasmMigratePayload(code_ids[0], instantiate.Address, "{}")
|
||||||
|
v = generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, _ = v.Marshal()
|
||||||
|
_, err = msgServer.MigrateContract(context, &types.MsgMigrateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
// Switch codeid
|
||||||
|
CodeID: code_ids[1],
|
||||||
|
Contract: instantiate.Address,
|
||||||
|
Msg: []byte("{}"),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
assert.ErrorIs(t, err, types.ErrInvalidHash)
|
||||||
|
|
||||||
|
// Test failure using the wrong contract
|
||||||
|
payload = createWasmMigratePayload(code_ids[0], instantiate.Address, "{}")
|
||||||
|
v = generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, _ = v.Marshal()
|
||||||
|
_, err = msgServer.MigrateContract(context, &types.MsgMigrateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
CodeID: code_ids[0],
|
||||||
|
// modify address
|
||||||
|
Contract: instantiate.Address + "a",
|
||||||
|
Msg: []byte("{}"),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
assert.ErrorIs(t, err, types.ErrInvalidHash)
|
||||||
|
|
||||||
|
// Test failure using the wrong msg
|
||||||
|
payload = createWasmMigratePayload(code_ids[0], instantiate.Address, `{"hello": "world"}`)
|
||||||
|
v = generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, _ = v.Marshal()
|
||||||
|
_, err = msgServer.MigrateContract(context, &types.MsgMigrateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
CodeID: code_ids[0],
|
||||||
|
Contract: instantiate.Address,
|
||||||
|
// modify msg
|
||||||
|
Msg: []byte(`{"hallo": "world"}`),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
assert.ErrorIs(t, err, types.ErrInvalidHash)
|
||||||
|
|
||||||
|
// Test migrating with invalid json fails
|
||||||
|
payload = createWasmMigratePayload(code_ids[0], instantiate.Address, `{"hello": }`)
|
||||||
|
v = generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, _ = v.Marshal()
|
||||||
|
_, err = msgServer.MigrateContract(context, &types.MsgMigrateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
CodeID: code_ids[0],
|
||||||
|
Contract: instantiate.Address,
|
||||||
|
Msg: []byte(`{"hello": }`),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
assert.NotErrorIs(t, err, types.ErrInvalidHash)
|
||||||
|
require.Error(t, err)
|
||||||
|
|
||||||
|
// Sending to wrong module is error (basically test that governance verification is in place)
|
||||||
|
payload_wrong_module := createWasmMigratePayload(code_ids[0], instantiate.Address, `{}`)
|
||||||
|
// tamper with the module id
|
||||||
|
payload_wrong_module[16] = 0xff
|
||||||
|
v = generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload_wrong_module)
|
||||||
|
vBz, _ = v.Marshal()
|
||||||
|
_, err = msgServer.MigrateContract(context, &types.MsgMigrateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
CodeID: code_ids[0],
|
||||||
|
Contract: instantiate.Address,
|
||||||
|
Msg: []byte(`{}`),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
assert.ErrorIs(t, err, types.ErrUnknownGovernanceModule)
|
||||||
|
|
||||||
|
// test action byte is checked by sending a valid instantiate vaa
|
||||||
|
payload = createWasmInstantiatePayload(code_ids[0], "btc", "{}")
|
||||||
|
v = generateVaa(set.Index, privateKeys, vaa.ChainID(vaa.GovernanceChain), payload)
|
||||||
|
vBz, _ = v.Marshal()
|
||||||
|
_, err = msgServer.MigrateContract(context, &types.MsgMigrateContract{
|
||||||
|
Signer: signer.String(),
|
||||||
|
CodeID: code_ids[0],
|
||||||
|
Contract: "btc",
|
||||||
|
Msg: []byte("{}"),
|
||||||
|
Vaa: vBz,
|
||||||
|
})
|
||||||
|
assert.ErrorIs(t, err, types.ErrUnknownGovernanceAction)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) {
|
||||||
cdc.RegisterConcrete(&MsgRegisterAccountAsGuardian{}, "wormhole/RegisterAccountAsGuardian", nil)
|
cdc.RegisterConcrete(&MsgRegisterAccountAsGuardian{}, "wormhole/RegisterAccountAsGuardian", nil)
|
||||||
cdc.RegisterConcrete(&MsgStoreCode{}, "wormhole/StoreCode", nil)
|
cdc.RegisterConcrete(&MsgStoreCode{}, "wormhole/StoreCode", nil)
|
||||||
cdc.RegisterConcrete(&MsgInstantiateContract{}, "wormhole/InstantiateContract", nil)
|
cdc.RegisterConcrete(&MsgInstantiateContract{}, "wormhole/InstantiateContract", nil)
|
||||||
|
cdc.RegisterConcrete(&MsgMigrateContract{}, "wormhole/MigrateContract", nil)
|
||||||
cdc.RegisterConcrete(&MsgCreateAllowlistEntryRequest{}, "wormhole/CreateAllowlistEntryRequest", nil)
|
cdc.RegisterConcrete(&MsgCreateAllowlistEntryRequest{}, "wormhole/CreateAllowlistEntryRequest", nil)
|
||||||
cdc.RegisterConcrete(&MsgDeleteAllowlistEntryRequest{}, "wormhole/DeleteAllowlistEntryRequest", nil)
|
cdc.RegisterConcrete(&MsgDeleteAllowlistEntryRequest{}, "wormhole/DeleteAllowlistEntryRequest", nil)
|
||||||
// this line is used by starport scaffolding # 2
|
// this line is used by starport scaffolding # 2
|
||||||
|
@ -23,6 +24,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
|
||||||
&MsgExecuteGovernanceVAA{},
|
&MsgExecuteGovernanceVAA{},
|
||||||
&MsgStoreCode{},
|
&MsgStoreCode{},
|
||||||
&MsgInstantiateContract{},
|
&MsgInstantiateContract{},
|
||||||
|
&MsgMigrateContract{},
|
||||||
&MsgCreateAllowlistEntryRequest{},
|
&MsgCreateAllowlistEntryRequest{},
|
||||||
&MsgDeleteAllowlistEntryRequest{},
|
&MsgDeleteAllowlistEntryRequest{},
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,6 +15,7 @@ type BankKeeper interface {
|
||||||
|
|
||||||
type WasmdKeeper interface {
|
type WasmdKeeper interface {
|
||||||
// For StoreCode
|
// For StoreCode
|
||||||
Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (codeID uint64, err error)
|
Create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, instantiateAccess *wasmtypes.AccessConfig) (codeID uint64, checksum []byte, err error)
|
||||||
Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, []byte, error)
|
Instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins) (sdk.AccAddress, []byte, error)
|
||||||
|
Migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,3 +56,28 @@ func (msg *MsgStoreCode) GetSignBytes() []byte {
|
||||||
func (msg *MsgStoreCode) ValidateBasic() error {
|
func (msg *MsgStoreCode) ValidateBasic() error {
|
||||||
return msg.ToWasmd().ValidateBasic()
|
return msg.ToWasmd().ValidateBasic()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (msg *MsgMigrateContract) Route() string {
|
||||||
|
return RouterKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgMigrateContract) Type() string {
|
||||||
|
return "MigrateContract"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgMigrateContract) GetSigners() []sdk.AccAddress {
|
||||||
|
signer, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return []sdk.AccAddress{signer}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgMigrateContract) GetSignBytes() []byte {
|
||||||
|
bz := ModuleCdc.MustMarshalJSON(msg)
|
||||||
|
return sdk.MustSortJSON(bz)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (msg *MsgMigrateContract) ValidateBasic() error {
|
||||||
|
return msg.ToWasmd().ValidateBasic()
|
||||||
|
}
|
||||||
|
|
|
@ -424,6 +424,8 @@ func (m *MsgStoreCode) GetVaa() []byte {
|
||||||
type MsgStoreCodeResponse struct {
|
type MsgStoreCodeResponse struct {
|
||||||
// CodeID is the reference to the stored WASM code
|
// CodeID is the reference to the stored WASM code
|
||||||
CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||||
|
// Checksum is the sha256 hash of the stored code
|
||||||
|
Checksum []byte `protobuf:"bytes,2,opt,name=checksum,proto3" json:"checksum,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MsgStoreCodeResponse) Reset() { *m = MsgStoreCodeResponse{} }
|
func (m *MsgStoreCodeResponse) Reset() { *m = MsgStoreCodeResponse{} }
|
||||||
|
@ -466,6 +468,13 @@ func (m *MsgStoreCodeResponse) GetCodeID() uint64 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *MsgStoreCodeResponse) GetChecksum() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Checksum
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Same as from x/wasmd but with vaa auth
|
// Same as from x/wasmd but with vaa auth
|
||||||
type MsgInstantiateContract struct {
|
type MsgInstantiateContract struct {
|
||||||
// Signer is the that actor that signed the messages
|
// Signer is the that actor that signed the messages
|
||||||
|
@ -476,7 +485,7 @@ type MsgInstantiateContract struct {
|
||||||
Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"`
|
Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"`
|
||||||
// Msg json encoded message to be passed to the contract on instantiation
|
// Msg json encoded message to be passed to the contract on instantiation
|
||||||
Msg []byte `protobuf:"bytes,5,opt,name=msg,proto3" json:"msg,omitempty"`
|
Msg []byte `protobuf:"bytes,5,opt,name=msg,proto3" json:"msg,omitempty"`
|
||||||
// vaa must be governance msg with payload containing sha3 256 hash of `bigEndian(code_id) || label || msg`
|
// vaa must be governance msg with payload containing keccak256 hash(hash(hash(BigEndian(CodeID)), Label), Msg)
|
||||||
Vaa []byte `protobuf:"bytes,6,opt,name=vaa,proto3" json:"vaa,omitempty"`
|
Vaa []byte `protobuf:"bytes,6,opt,name=vaa,proto3" json:"vaa,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,6 +611,135 @@ func (m *MsgInstantiateContractResponse) GetData() []byte {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract
|
||||||
|
type MsgMigrateContract struct {
|
||||||
|
// Sender is the that actor that signed the messages
|
||||||
|
Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"`
|
||||||
|
// Contract is the address of the smart contract
|
||||||
|
Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"`
|
||||||
|
// CodeID references the new WASM code
|
||||||
|
CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"`
|
||||||
|
// Msg json encoded message to be passed to the contract on migration
|
||||||
|
Msg []byte `protobuf:"bytes,4,opt,name=msg,proto3" json:"msg,omitempty"`
|
||||||
|
// vaa must be governance msg with payload containing keccak256 hash(hash(hash(BigEndian(CodeID)), Contract), Msg)
|
||||||
|
Vaa []byte `protobuf:"bytes,6,opt,name=vaa,proto3" json:"vaa,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) Reset() { *m = MsgMigrateContract{} }
|
||||||
|
func (m *MsgMigrateContract) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*MsgMigrateContract) ProtoMessage() {}
|
||||||
|
func (*MsgMigrateContract) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_55f7aa067b0c517b, []int{11}
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContract) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_MsgMigrateContract.Marshal(b, m, deterministic)
|
||||||
|
} else {
|
||||||
|
b = b[:cap(b)]
|
||||||
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return b[:n], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContract) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_MsgMigrateContract.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContract) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContract) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_MsgMigrateContract.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_MsgMigrateContract proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) GetSigner() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Signer
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) GetContract() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Contract
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) GetCodeID() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.CodeID
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) GetMsg() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Msg
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) GetVaa() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Vaa
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MsgMigrateContractResponse returns contract migration result data.
|
||||||
|
type MsgMigrateContractResponse struct {
|
||||||
|
// Data contains same raw bytes returned as data from the wasm contract.
|
||||||
|
// (May be empty)
|
||||||
|
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContractResponse) Reset() { *m = MsgMigrateContractResponse{} }
|
||||||
|
func (m *MsgMigrateContractResponse) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*MsgMigrateContractResponse) ProtoMessage() {}
|
||||||
|
func (*MsgMigrateContractResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_55f7aa067b0c517b, []int{12}
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContractResponse) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_MsgMigrateContractResponse.Marshal(b, m, deterministic)
|
||||||
|
} else {
|
||||||
|
b = b[:cap(b)]
|
||||||
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return b[:n], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContractResponse) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_MsgMigrateContractResponse.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContractResponse) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContractResponse) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_MsgMigrateContractResponse.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_MsgMigrateContractResponse proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *MsgMigrateContractResponse) GetData() []byte {
|
||||||
|
if m != nil {
|
||||||
|
return m.Data
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*MsgCreateAllowlistEntryRequest)(nil), "wormhole_foundation.wormchain.wormhole.MsgCreateAllowlistEntryRequest")
|
proto.RegisterType((*MsgCreateAllowlistEntryRequest)(nil), "wormhole_foundation.wormchain.wormhole.MsgCreateAllowlistEntryRequest")
|
||||||
proto.RegisterType((*MsgDeleteAllowlistEntryRequest)(nil), "wormhole_foundation.wormchain.wormhole.MsgDeleteAllowlistEntryRequest")
|
proto.RegisterType((*MsgDeleteAllowlistEntryRequest)(nil), "wormhole_foundation.wormchain.wormhole.MsgDeleteAllowlistEntryRequest")
|
||||||
|
@ -614,53 +752,59 @@ func init() {
|
||||||
proto.RegisterType((*MsgStoreCodeResponse)(nil), "wormhole_foundation.wormchain.wormhole.MsgStoreCodeResponse")
|
proto.RegisterType((*MsgStoreCodeResponse)(nil), "wormhole_foundation.wormchain.wormhole.MsgStoreCodeResponse")
|
||||||
proto.RegisterType((*MsgInstantiateContract)(nil), "wormhole_foundation.wormchain.wormhole.MsgInstantiateContract")
|
proto.RegisterType((*MsgInstantiateContract)(nil), "wormhole_foundation.wormchain.wormhole.MsgInstantiateContract")
|
||||||
proto.RegisterType((*MsgInstantiateContractResponse)(nil), "wormhole_foundation.wormchain.wormhole.MsgInstantiateContractResponse")
|
proto.RegisterType((*MsgInstantiateContractResponse)(nil), "wormhole_foundation.wormchain.wormhole.MsgInstantiateContractResponse")
|
||||||
|
proto.RegisterType((*MsgMigrateContract)(nil), "wormhole_foundation.wormchain.wormhole.MsgMigrateContract")
|
||||||
|
proto.RegisterType((*MsgMigrateContractResponse)(nil), "wormhole_foundation.wormchain.wormhole.MsgMigrateContractResponse")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("wormhole/tx.proto", fileDescriptor_55f7aa067b0c517b) }
|
func init() { proto.RegisterFile("wormhole/tx.proto", fileDescriptor_55f7aa067b0c517b) }
|
||||||
|
|
||||||
var fileDescriptor_55f7aa067b0c517b = []byte{
|
var fileDescriptor_55f7aa067b0c517b = []byte{
|
||||||
// 642 bytes of a gzipped FileDescriptorProto
|
// 709 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x6e, 0xd3, 0x4e,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6a, 0x13, 0x41,
|
||||||
0x10, 0xae, 0x9b, 0x36, 0x55, 0x47, 0xd1, 0x4f, 0xfd, 0x99, 0xa8, 0x84, 0xa8, 0x72, 0xc1, 0xa0,
|
0x18, 0xef, 0x34, 0x69, 0xda, 0x7e, 0x04, 0xad, 0x6b, 0xa8, 0x71, 0x29, 0xa9, 0xae, 0x52, 0xbc,
|
||||||
0x8a, 0x0b, 0x89, 0x04, 0x08, 0x09, 0x81, 0x40, 0x49, 0xff, 0xa9, 0x12, 0xe6, 0xe0, 0x22, 0x90,
|
0x98, 0x88, 0x8a, 0xa0, 0x88, 0x92, 0xf4, 0x1f, 0x05, 0xd7, 0xc3, 0x56, 0x2c, 0x78, 0x09, 0x93,
|
||||||
0xb8, 0x44, 0x1b, 0x7b, 0xba, 0xb5, 0x64, 0xef, 0x86, 0xdd, 0x75, 0xdb, 0x9c, 0x78, 0x04, 0x78,
|
0xdd, 0xe9, 0x64, 0x71, 0x77, 0x27, 0xee, 0xcc, 0xb6, 0xcd, 0xc9, 0x47, 0xd0, 0xde, 0x15, 0x7c,
|
||||||
0x00, 0x90, 0x78, 0x03, 0xce, 0xbc, 0x01, 0xc7, 0x1e, 0x39, 0x55, 0x28, 0x7d, 0x11, 0xe4, 0x35,
|
0x03, 0x5f, 0xc3, 0x8b, 0xd0, 0xa3, 0xa7, 0x22, 0xe9, 0x8b, 0xc8, 0x4e, 0xb2, 0x93, 0xd0, 0x64,
|
||||||
0x76, 0x22, 0xd5, 0xae, 0xb0, 0xda, 0xdb, 0xcc, 0xac, 0xe7, 0xfb, 0xbe, 0x19, 0xcf, 0xce, 0xc2,
|
0x43, 0xd7, 0xf6, 0xf6, 0x7d, 0xb3, 0xf3, 0xfd, 0xfe, 0x0c, 0x33, 0x3f, 0x16, 0x6e, 0x1c, 0xb2,
|
||||||
0xff, 0xc7, 0x5c, 0x44, 0x87, 0x3c, 0xc4, 0xae, 0x3a, 0xe9, 0x8c, 0x04, 0x57, 0xdc, 0xdc, 0xc8,
|
0xd0, 0x6f, 0x33, 0x8f, 0xd4, 0xc4, 0x51, 0xb5, 0x13, 0x32, 0xc1, 0xb4, 0xb5, 0x64, 0xa9, 0xb9,
|
||||||
0x42, 0x83, 0x03, 0x1e, 0x33, 0x9f, 0xa8, 0x80, 0xb3, 0x4e, 0x12, 0xf3, 0x0e, 0x49, 0x90, 0x5a,
|
0xcf, 0xa2, 0xc0, 0xc1, 0xc2, 0x65, 0x41, 0x35, 0x5e, 0xb3, 0xdb, 0xd8, 0xed, 0x57, 0xf1, 0x57,
|
||||||
0xc9, 0x69, 0xbb, 0x49, 0x39, 0xe5, 0x3a, 0xa5, 0x9b, 0x58, 0x69, 0xb6, 0x7d, 0x00, 0x96, 0x23,
|
0xbd, 0x44, 0x19, 0x65, 0x72, 0xa4, 0x16, 0x57, 0xfd, 0x69, 0x63, 0x1f, 0x2a, 0x26, 0xa7, 0xeb,
|
||||||
0xe9, 0xa6, 0x40, 0xa2, 0xb0, 0x17, 0x86, 0xfc, 0x38, 0x0c, 0xa4, 0xda, 0x66, 0x4a, 0x8c, 0x5d,
|
0x21, 0xc1, 0x82, 0xd4, 0x3d, 0x8f, 0x1d, 0x7a, 0x2e, 0x17, 0x9b, 0x81, 0x08, 0xbb, 0x16, 0xf9,
|
||||||
0xfc, 0x10, 0xa3, 0x54, 0xe6, 0x2a, 0xd4, 0x65, 0x40, 0x19, 0x8a, 0x96, 0x71, 0xdb, 0xb8, 0xbf,
|
0x14, 0x11, 0x2e, 0xb4, 0x65, 0x28, 0x70, 0x97, 0x06, 0x24, 0x2c, 0xa3, 0x3b, 0xe8, 0xc1, 0xa2,
|
||||||
0xec, 0xfe, 0xf5, 0xcc, 0x16, 0x2c, 0x11, 0xdf, 0x17, 0x28, 0x65, 0x6b, 0x5e, 0x1f, 0x64, 0xae,
|
0x35, 0xe8, 0xb4, 0x32, 0xcc, 0x63, 0xc7, 0x09, 0x09, 0xe7, 0xe5, 0x59, 0xf9, 0x21, 0x69, 0x35,
|
||||||
0x69, 0xc2, 0x02, 0x23, 0x11, 0xb6, 0x6a, 0x3a, 0xac, 0x6d, 0xdb, 0xd5, 0x3c, 0x5b, 0x18, 0xe2,
|
0x0d, 0xf2, 0x01, 0xf6, 0x49, 0x39, 0x27, 0x97, 0x65, 0x6d, 0x58, 0x92, 0x67, 0x83, 0x78, 0xe4,
|
||||||
0xb5, 0xf1, 0xd8, 0xab, 0xd0, 0x74, 0x24, 0xcd, 0xd1, 0x5c, 0x94, 0x23, 0xce, 0x24, 0xda, 0x9b,
|
0xca, 0x78, 0x8c, 0x65, 0x28, 0x99, 0x9c, 0x2a, 0x34, 0x8b, 0xf0, 0x0e, 0x0b, 0x38, 0x31, 0xd6,
|
||||||
0x70, 0xd3, 0x91, 0x74, 0xfb, 0x04, 0xbd, 0x58, 0xe1, 0x2e, 0x3f, 0x42, 0xc1, 0x08, 0xf3, 0xf0,
|
0xe1, 0x96, 0xc9, 0xe9, 0xe6, 0x11, 0xb1, 0x23, 0x41, 0xb6, 0xd9, 0x01, 0x09, 0x03, 0x1c, 0xd8,
|
||||||
0x6d, 0xaf, 0x67, 0xae, 0x40, 0xed, 0x88, 0x10, 0xcd, 0xd0, 0x70, 0x13, 0x73, 0x86, 0x76, 0x7e,
|
0xe4, 0x7d, 0xbd, 0xae, 0x2d, 0x41, 0xee, 0x00, 0x63, 0xc9, 0x50, 0xb4, 0xe2, 0x72, 0x84, 0x76,
|
||||||
0x96, 0xd6, 0xbe, 0x03, 0xeb, 0x25, 0x20, 0x39, 0xcf, 0x1b, 0x58, 0x73, 0x24, 0x75, 0x91, 0x06,
|
0x76, 0x94, 0xd6, 0xb8, 0x0b, 0xab, 0x29, 0x20, 0x8a, 0xe7, 0x1d, 0xac, 0x98, 0x9c, 0x5a, 0x84,
|
||||||
0x52, 0xa1, 0xe8, 0x79, 0x1e, 0x8f, 0x99, 0xea, 0xc9, 0xdd, 0x98, 0x08, 0x3f, 0x20, 0xac, 0xb4,
|
0xba, 0x5c, 0x90, 0xb0, 0x6e, 0xdb, 0x2c, 0x0a, 0x44, 0x9d, 0x6f, 0x47, 0x38, 0x74, 0x5c, 0x1c,
|
||||||
0xa2, 0x35, 0x58, 0x4e, 0x2c, 0xa2, 0x62, 0x91, 0x36, 0xa9, 0xe1, 0x4e, 0x03, 0xf6, 0x06, 0xdc,
|
0xa4, 0x3a, 0x5a, 0x81, 0xc5, 0xb8, 0xc2, 0x22, 0x0a, 0xfb, 0x87, 0x54, 0xb4, 0x86, 0x0b, 0xc6,
|
||||||
0xbb, 0x0c, 0x35, 0x67, 0x1f, 0x41, 0xc3, 0x91, 0x74, 0x5f, 0x71, 0x81, 0x9b, 0xdc, 0xc7, 0x52,
|
0x1a, 0xdc, 0x9f, 0x86, 0xaa, 0xd8, 0x3b, 0x50, 0x34, 0x39, 0xdd, 0x15, 0x2c, 0x24, 0xeb, 0xcc,
|
||||||
0xb6, 0x27, 0xf0, 0xdf, 0x31, 0x91, 0xd1, 0x60, 0x38, 0x56, 0x38, 0xf0, 0xb8, 0x8f, 0xba, 0xd0,
|
0x21, 0xa9, 0x6c, 0xcf, 0xe0, 0xda, 0x21, 0xe6, 0x7e, 0xb3, 0xd5, 0x15, 0xa4, 0x69, 0x33, 0x87,
|
||||||
0x46, 0x7f, 0x65, 0x72, 0xb6, 0xde, 0x78, 0xd7, 0xdb, 0x77, 0xfa, 0x63, 0xa5, 0x11, 0xdc, 0x46,
|
0x48, 0xa3, 0xc5, 0xc6, 0x52, 0xef, 0x74, 0xb5, 0xb8, 0x57, 0xdf, 0x35, 0x1b, 0x5d, 0x21, 0x11,
|
||||||
0xf2, 0x5d, 0xe6, 0x65, 0xad, 0xaa, 0xe5, 0xad, 0xb2, 0x9f, 0xe9, 0x7e, 0xe7, 0x8c, 0x99, 0x12,
|
0xac, 0x62, 0xbc, 0x2f, 0xe9, 0x92, 0xa3, 0xca, 0xa9, 0xa3, 0x32, 0xf6, 0xe4, 0x79, 0x2b, 0xc6,
|
||||||
0xf3, 0x2e, 0x2c, 0x25, 0xb8, 0x83, 0xc0, 0xd7, 0xd4, 0x0b, 0x7d, 0x98, 0x9c, 0xad, 0xd7, 0x93,
|
0x44, 0x89, 0x76, 0x0f, 0xe6, 0x63, 0xdc, 0xa6, 0xeb, 0x48, 0xea, 0x7c, 0x03, 0x7a, 0xa7, 0xab,
|
||||||
0x4f, 0xf6, 0xb6, 0xdc, 0x7a, 0x72, 0xb4, 0xe7, 0xdb, 0x9f, 0x0c, 0x58, 0x75, 0x24, 0xdd, 0x63,
|
0x85, 0x78, 0xcb, 0xce, 0x86, 0x55, 0x88, 0x3f, 0xed, 0x38, 0x9a, 0x0e, 0x0b, 0x76, 0x9b, 0xd8,
|
||||||
0x52, 0x11, 0xa6, 0x02, 0x92, 0xb0, 0x30, 0x25, 0x88, 0x57, 0xfe, 0xe7, 0x67, 0x70, 0x6b, 0x65,
|
0x1f, 0x79, 0xe4, 0xf7, 0x05, 0x58, 0xaa, 0x37, 0xbe, 0x20, 0x58, 0x36, 0x39, 0xdd, 0x09, 0xb8,
|
||||||
0xb8, 0x66, 0x13, 0x16, 0x43, 0x32, 0xc4, 0xb0, 0xb5, 0xa0, 0x73, 0x53, 0x27, 0x11, 0x1f, 0x49,
|
0xc0, 0x81, 0x70, 0x71, 0xac, 0x20, 0x10, 0x21, 0xb6, 0xd3, 0x6f, 0xc5, 0x08, 0x67, 0x2e, 0x95,
|
||||||
0xda, 0x5a, 0x4c, 0xc5, 0x47, 0x92, 0x66, 0xe5, 0xd4, 0xa7, 0xe5, 0xbc, 0xd6, 0x23, 0x59, 0x20,
|
0xb3, 0x04, 0x73, 0x1e, 0x6e, 0x11, 0xaf, 0x9c, 0x97, 0xb3, 0xfd, 0x26, 0x36, 0xe6, 0x73, 0x5a,
|
||||||
0x28, 0x2f, 0x6c, 0x66, 0xf4, 0x8c, 0x0b, 0x23, 0xee, 0x13, 0x45, 0xd2, 0x56, 0xba, 0xda, 0x7e,
|
0x9e, 0xeb, 0x1b, 0xf3, 0x39, 0x4d, 0xac, 0x16, 0x86, 0x56, 0xdf, 0xca, 0xeb, 0x3a, 0x41, 0x90,
|
||||||
0xf8, 0x63, 0x09, 0x6a, 0x8e, 0xa4, 0xe6, 0x37, 0x03, 0x9a, 0x85, 0xc3, 0xf7, 0xb2, 0xf3, 0x6f,
|
0x32, 0x3d, 0x72, 0x2d, 0xd1, 0xd8, 0xf5, 0x77, 0xb0, 0xc0, 0x03, 0x97, 0xb2, 0x36, 0x8e, 0x11,
|
||||||
0x57, 0xb5, 0x53, 0x32, 0x78, 0xed, 0xdd, 0x2b, 0x02, 0xe4, 0x85, 0x7d, 0x37, 0xe0, 0x56, 0xf9,
|
0x68, 0x26, 0xa7, 0xa6, 0x4b, 0xc3, 0x8b, 0xb8, 0x8b, 0x0f, 0x6b, 0xb0, 0x67, 0x70, 0x2d, 0x55,
|
||||||
0xdc, 0x6e, 0x55, 0xa0, 0x29, 0x45, 0x69, 0xbf, 0xba, 0x0e, 0x94, 0x5c, 0xf1, 0x17, 0x03, 0x9a,
|
0x7f, 0x31, 0xe7, 0x03, 0x8f, 0xf9, 0x69, 0x1e, 0x1f, 0x81, 0x3e, 0x2e, 0x49, 0xf9, 0x4b, 0x5c,
|
||||||
0x45, 0x5b, 0xca, 0xdc, 0xa9, 0x40, 0x73, 0xc9, 0x9a, 0x6b, 0x3f, 0xaf, 0x80, 0x73, 0x61, 0xe5,
|
0xa0, 0xa1, 0x8b, 0xc7, 0xbf, 0x17, 0x20, 0x67, 0x72, 0xaa, 0xfd, 0x40, 0x50, 0x9a, 0xf8, 0xbc,
|
||||||
0x68, 0x79, 0x45, 0xcb, 0xad, 0x92, 0xbc, 0x4b, 0xb6, 0xe3, 0x15, 0xe5, 0x7d, 0x84, 0xe5, 0xe9,
|
0x5e, 0x57, 0x2f, 0x16, 0x46, 0xd5, 0x94, 0xa7, 0xa5, 0x6f, 0x5f, 0x12, 0x40, 0xc9, 0xff, 0x89,
|
||||||
0xa2, 0x78, 0x5c, 0x01, 0x2a, 0xcf, 0xaa, 0x24, 0xe0, 0xe2, 0x8a, 0xf8, 0x6a, 0xc0, 0x8d, 0xa2,
|
0xe0, 0x76, 0xfa, 0xcb, 0xdc, 0xc8, 0x40, 0x93, 0x8a, 0xa2, 0xbf, 0xb9, 0x0a, 0x14, 0xa5, 0xf8,
|
||||||
0xab, 0xff, 0xa2, 0x02, 0x6a, 0x41, 0x7e, 0x7b, 0xe7, 0x6a, 0xf9, 0x99, 0xbe, 0xfe, 0xfe, 0xcf,
|
0x1b, 0x82, 0xd2, 0xa4, 0x1c, 0xd6, 0xb6, 0x32, 0xd0, 0x4c, 0x09, 0x72, 0xfd, 0x65, 0x06, 0x9c,
|
||||||
0x89, 0x65, 0x9c, 0x4e, 0x2c, 0xe3, 0xf7, 0xc4, 0x32, 0x3e, 0x9f, 0x5b, 0x73, 0xa7, 0xe7, 0xd6,
|
0xb1, 0x50, 0x95, 0xf2, 0x26, 0xc5, 0x77, 0x26, 0x79, 0x53, 0xf2, 0xff, 0x92, 0xf2, 0x3e, 0xc3,
|
||||||
0xdc, 0xaf, 0x73, 0x6b, 0xee, 0xfd, 0x53, 0x1a, 0xa8, 0xc3, 0x78, 0xd8, 0xf1, 0x78, 0xd4, 0xcd,
|
0xe2, 0x30, 0x0a, 0x9f, 0x66, 0x80, 0x52, 0x53, 0x99, 0x04, 0x8c, 0x87, 0xe0, 0x77, 0x04, 0x37,
|
||||||
0xd0, 0x1e, 0x4c, 0xb9, 0xba, 0x39, 0x57, 0xf7, 0xa4, 0x3b, 0x7d, 0x9c, 0xc7, 0x23, 0x94, 0xc3,
|
0x27, 0x05, 0xd8, 0xab, 0x0c, 0xa8, 0x13, 0xe6, 0xf5, 0xad, 0xcb, 0xcd, 0x2b, 0x7d, 0xc7, 0x08,
|
||||||
0xba, 0x7e, 0x62, 0x1f, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0x86, 0x0b, 0xf1, 0x5c, 0xb5, 0x07,
|
0xae, 0x9f, 0x8f, 0x9f, 0x17, 0x19, 0xb0, 0xcf, 0xcd, 0xea, 0x8d, 0xff, 0x9f, 0x4d, 0x34, 0x35,
|
||||||
0x00, 0x00,
|
0x76, 0x7f, 0xf5, 0x2a, 0xe8, 0xa4, 0x57, 0x41, 0x7f, 0x7b, 0x15, 0xf4, 0xf5, 0xac, 0x32, 0x73,
|
||||||
|
0x72, 0x56, 0x99, 0xf9, 0x73, 0x56, 0x99, 0xf9, 0xf0, 0x9c, 0xba, 0xa2, 0x1d, 0xb5, 0xaa, 0x36,
|
||||||
|
0xf3, 0x6b, 0x09, 0xd2, 0xc3, 0x21, 0x4f, 0x4d, 0xf1, 0xd4, 0x8e, 0x6a, 0xc3, 0x5f, 0xa2, 0x6e,
|
||||||
|
0x87, 0xf0, 0x56, 0x41, 0xfe, 0xd8, 0x3c, 0xf9, 0x17, 0x00, 0x00, 0xff, 0xff, 0x39, 0xb3, 0x42,
|
||||||
|
0x88, 0x2b, 0x09, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference imports to suppress errors if they are not otherwise used.
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
@ -683,6 +827,7 @@ type MsgClient interface {
|
||||||
StoreCode(ctx context.Context, in *MsgStoreCode, opts ...grpc.CallOption) (*MsgStoreCodeResponse, error)
|
StoreCode(ctx context.Context, in *MsgStoreCode, opts ...grpc.CallOption) (*MsgStoreCodeResponse, error)
|
||||||
// Instantiate creates a new smart contract instance for the given code id.
|
// Instantiate creates a new smart contract instance for the given code id.
|
||||||
InstantiateContract(ctx context.Context, in *MsgInstantiateContract, opts ...grpc.CallOption) (*MsgInstantiateContractResponse, error)
|
InstantiateContract(ctx context.Context, in *MsgInstantiateContract, opts ...grpc.CallOption) (*MsgInstantiateContractResponse, error)
|
||||||
|
MigrateContract(ctx context.Context, in *MsgMigrateContract, opts ...grpc.CallOption) (*MsgMigrateContractResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type msgClient struct {
|
type msgClient struct {
|
||||||
|
@ -747,6 +892,15 @@ func (c *msgClient) InstantiateContract(ctx context.Context, in *MsgInstantiateC
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *msgClient) MigrateContract(ctx context.Context, in *MsgMigrateContract, opts ...grpc.CallOption) (*MsgMigrateContractResponse, error) {
|
||||||
|
out := new(MsgMigrateContractResponse)
|
||||||
|
err := c.cc.Invoke(ctx, "/wormhole_foundation.wormchain.wormhole.Msg/MigrateContract", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// MsgServer is the server API for Msg service.
|
// MsgServer is the server API for Msg service.
|
||||||
type MsgServer interface {
|
type MsgServer interface {
|
||||||
ExecuteGovernanceVAA(context.Context, *MsgExecuteGovernanceVAA) (*MsgExecuteGovernanceVAAResponse, error)
|
ExecuteGovernanceVAA(context.Context, *MsgExecuteGovernanceVAA) (*MsgExecuteGovernanceVAAResponse, error)
|
||||||
|
@ -757,6 +911,7 @@ type MsgServer interface {
|
||||||
StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error)
|
StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error)
|
||||||
// Instantiate creates a new smart contract instance for the given code id.
|
// Instantiate creates a new smart contract instance for the given code id.
|
||||||
InstantiateContract(context.Context, *MsgInstantiateContract) (*MsgInstantiateContractResponse, error)
|
InstantiateContract(context.Context, *MsgInstantiateContract) (*MsgInstantiateContractResponse, error)
|
||||||
|
MigrateContract(context.Context, *MsgMigrateContract) (*MsgMigrateContractResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||||
|
@ -781,6 +936,9 @@ func (*UnimplementedMsgServer) StoreCode(ctx context.Context, req *MsgStoreCode)
|
||||||
func (*UnimplementedMsgServer) InstantiateContract(ctx context.Context, req *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) {
|
func (*UnimplementedMsgServer) InstantiateContract(ctx context.Context, req *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method InstantiateContract not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method InstantiateContract not implemented")
|
||||||
}
|
}
|
||||||
|
func (*UnimplementedMsgServer) MigrateContract(ctx context.Context, req *MsgMigrateContract) (*MsgMigrateContractResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method MigrateContract not implemented")
|
||||||
|
}
|
||||||
|
|
||||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||||
|
@ -894,6 +1052,24 @@ func _Msg_InstantiateContract_Handler(srv interface{}, ctx context.Context, dec
|
||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Msg_MigrateContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(MsgMigrateContract)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(MsgServer).MigrateContract(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/wormhole_foundation.wormchain.wormhole.Msg/MigrateContract",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(MsgServer).MigrateContract(ctx, req.(*MsgMigrateContract))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||||
ServiceName: "wormhole_foundation.wormchain.wormhole.Msg",
|
ServiceName: "wormhole_foundation.wormchain.wormhole.Msg",
|
||||||
HandlerType: (*MsgServer)(nil),
|
HandlerType: (*MsgServer)(nil),
|
||||||
|
@ -922,6 +1098,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||||
MethodName: "InstantiateContract",
|
MethodName: "InstantiateContract",
|
||||||
Handler: _Msg_InstantiateContract_Handler,
|
Handler: _Msg_InstantiateContract_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "MigrateContract",
|
||||||
|
Handler: _Msg_MigrateContract_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "wormhole/tx.proto",
|
Metadata: "wormhole/tx.proto",
|
||||||
|
@ -1215,6 +1395,13 @@ func (m *MsgStoreCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
|
if len(m.Checksum) > 0 {
|
||||||
|
i -= len(m.Checksum)
|
||||||
|
copy(dAtA[i:], m.Checksum)
|
||||||
|
i = encodeVarintTx(dAtA, i, uint64(len(m.Checksum)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
if m.CodeID != 0 {
|
if m.CodeID != 0 {
|
||||||
i = encodeVarintTx(dAtA, i, uint64(m.CodeID))
|
i = encodeVarintTx(dAtA, i, uint64(m.CodeID))
|
||||||
i--
|
i--
|
||||||
|
@ -1316,6 +1503,92 @@ func (m *MsgInstantiateContractResponse) MarshalToSizedBuffer(dAtA []byte) (int,
|
||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Vaa) > 0 {
|
||||||
|
i -= len(m.Vaa)
|
||||||
|
copy(dAtA[i:], m.Vaa)
|
||||||
|
i = encodeVarintTx(dAtA, i, uint64(len(m.Vaa)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x32
|
||||||
|
}
|
||||||
|
if len(m.Msg) > 0 {
|
||||||
|
i -= len(m.Msg)
|
||||||
|
copy(dAtA[i:], m.Msg)
|
||||||
|
i = encodeVarintTx(dAtA, i, uint64(len(m.Msg)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x22
|
||||||
|
}
|
||||||
|
if m.CodeID != 0 {
|
||||||
|
i = encodeVarintTx(dAtA, i, uint64(m.CodeID))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x18
|
||||||
|
}
|
||||||
|
if len(m.Contract) > 0 {
|
||||||
|
i -= len(m.Contract)
|
||||||
|
copy(dAtA[i:], m.Contract)
|
||||||
|
i = encodeVarintTx(dAtA, i, uint64(len(m.Contract)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
if len(m.Signer) > 0 {
|
||||||
|
i -= len(m.Signer)
|
||||||
|
copy(dAtA[i:], m.Signer)
|
||||||
|
i = encodeVarintTx(dAtA, i, uint64(len(m.Signer)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContractResponse) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContractResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Data) > 0 {
|
||||||
|
i -= len(m.Data)
|
||||||
|
copy(dAtA[i:], m.Data)
|
||||||
|
i = encodeVarintTx(dAtA, i, uint64(len(m.Data)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0xa
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
|
func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
|
||||||
offset -= sovTx(v)
|
offset -= sovTx(v)
|
||||||
base := offset
|
base := offset
|
||||||
|
@ -1456,6 +1729,10 @@ func (m *MsgStoreCodeResponse) Size() (n int) {
|
||||||
if m.CodeID != 0 {
|
if m.CodeID != 0 {
|
||||||
n += 1 + sovTx(uint64(m.CodeID))
|
n += 1 + sovTx(uint64(m.CodeID))
|
||||||
}
|
}
|
||||||
|
l = len(m.Checksum)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTx(uint64(l))
|
||||||
|
}
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1504,6 +1781,47 @@ func (m *MsgInstantiateContractResponse) Size() (n int) {
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContract) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Signer)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTx(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Contract)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTx(uint64(l))
|
||||||
|
}
|
||||||
|
if m.CodeID != 0 {
|
||||||
|
n += 1 + sovTx(uint64(m.CodeID))
|
||||||
|
}
|
||||||
|
l = len(m.Msg)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTx(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Vaa)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTx(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MsgMigrateContractResponse) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
l = len(m.Data)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovTx(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
func sovTx(x uint64) (n int) {
|
func sovTx(x uint64) (n int) {
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
}
|
}
|
||||||
|
@ -2350,6 +2668,40 @@ func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Checksum", wireType)
|
||||||
|
}
|
||||||
|
var byteLen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
byteLen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if byteLen < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + byteLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Checksum = append(m.Checksum[:0], dAtA[iNdEx:postIndex]...)
|
||||||
|
if m.Checksum == nil {
|
||||||
|
m.Checksum = []byte{}
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
skippy, err := skipTx(dAtA[iNdEx:])
|
skippy, err := skipTx(dAtA[iNdEx:])
|
||||||
|
@ -2688,6 +3040,291 @@ func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: MsgMigrateContract: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: MsgMigrateContract: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
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 ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Signer = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
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 ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Contract = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 3:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType)
|
||||||
|
}
|
||||||
|
m.CodeID = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
m.CodeID |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType)
|
||||||
|
}
|
||||||
|
var byteLen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
byteLen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if byteLen < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + byteLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...)
|
||||||
|
if m.Msg == nil {
|
||||||
|
m.Msg = []byte{}
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 6:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Vaa", wireType)
|
||||||
|
}
|
||||||
|
var byteLen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
byteLen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if byteLen < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + byteLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Vaa = append(m.Vaa[:0], dAtA[iNdEx:postIndex]...)
|
||||||
|
if m.Vaa == nil {
|
||||||
|
m.Vaa = []byte{}
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipTx(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: MsgMigrateContractResponse: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: MsgMigrateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType)
|
||||||
|
}
|
||||||
|
var byteLen int
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowTx
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
byteLen |= int(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if byteLen < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + byteLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...)
|
||||||
|
if m.Data == nil {
|
||||||
|
m.Data = []byte{}
|
||||||
|
}
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipTx(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthTx
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func skipTx(dAtA []byte) (n int, err error) {
|
func skipTx(dAtA []byte) (n int, err error) {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
|
|
@ -19,3 +19,12 @@ func (msg MsgStoreCode) ToWasmd() wasmdtypes.MsgStoreCode {
|
||||||
WASMByteCode: msg.WASMByteCode,
|
WASMByteCode: msg.WASMByteCode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (msg MsgMigrateContract) ToWasmd() wasmdtypes.MsgMigrateContract {
|
||||||
|
return wasmdtypes.MsgMigrateContract{
|
||||||
|
Sender: msg.Signer,
|
||||||
|
Msg: msg.Msg,
|
||||||
|
Contract: msg.Contract,
|
||||||
|
CodeID: msg.CodeID,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue