From b390fc3b2f93341ae5ab321b9a3bc48afcd1d58e Mon Sep 17 00:00:00 2001 From: gyuguen Date: Fri, 2 Dec 2022 10:06:36 +0900 Subject: [PATCH 01/21] feat: define skeleton proto files --- go.mod | 2 +- go.sum | 14 + proto/panacea/datadeal/v2/consent.proto | 16 + proto/panacea/datadeal/v2/deal.proto | 37 + proto/panacea/datadeal/v2/genesis.proto | 16 + proto/panacea/datadeal/v2/query.proto | 80 + proto/panacea/datadeal/v2/tx.proto | 55 + proto/panacea/oracle/v2/genesis.proto | 26 + proto/panacea/oracle/v2/oracle.proto | 48 + proto/panacea/oracle/v2/query.proto | 89 + proto/panacea/oracle/v2/tx.proto | 67 + scripts/protocgen.sh | 5 +- x/datadeal/types/consent.pb.go | 512 +++++ x/datadeal/types/deal.pb.go | 732 +++++++ x/datadeal/types/genesis.pb.go | 434 +++++ x/datadeal/types/query.pb.go | 1974 +++++++++++++++++++ x/datadeal/types/query.pb.gw.go | 500 +++++ x/datadeal/types/tx.pb.go | 1541 +++++++++++++++ x/oracle/types/genesis.pb.go | 681 +++++++ x/oracle/types/oracle.pb.go | 1131 +++++++++++ x/oracle/types/query.pb.go | 2317 +++++++++++++++++++++++ x/oracle/types/query.pb.gw.go | 526 +++++ x/oracle/types/tx.pb.go | 1998 +++++++++++++++++++ 23 files changed, 12798 insertions(+), 3 deletions(-) create mode 100644 proto/panacea/datadeal/v2/consent.proto create mode 100644 proto/panacea/datadeal/v2/deal.proto create mode 100644 proto/panacea/datadeal/v2/genesis.proto create mode 100644 proto/panacea/datadeal/v2/query.proto create mode 100644 proto/panacea/datadeal/v2/tx.proto create mode 100644 proto/panacea/oracle/v2/genesis.proto create mode 100644 proto/panacea/oracle/v2/oracle.proto create mode 100644 proto/panacea/oracle/v2/query.proto create mode 100644 proto/panacea/oracle/v2/tx.proto create mode 100644 x/datadeal/types/consent.pb.go create mode 100644 x/datadeal/types/deal.pb.go create mode 100644 x/datadeal/types/genesis.pb.go create mode 100644 x/datadeal/types/query.pb.go create mode 100644 x/datadeal/types/query.pb.gw.go create mode 100644 x/datadeal/types/tx.pb.go create mode 100644 x/oracle/types/genesis.pb.go create mode 100644 x/oracle/types/oracle.pb.go create mode 100644 x/oracle/types/query.pb.go create mode 100644 x/oracle/types/query.pb.gw.go create mode 100644 x/oracle/types/tx.pb.go diff --git a/go.mod b/go.mod index e81d59c4..6fafc553 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b google.golang.org/grpc v1.48.0 + google.golang.org/protobuf v1.28.0 ) require ( @@ -121,7 +122,6 @@ require ( golang.org/x/sys v0.0.0-20220727055044-e65921a090b8 // indirect golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect golang.org/x/text v0.3.7 // indirect - google.golang.org/protobuf v1.28.0 // indirect gopkg.in/ini.v1 v1.66.6 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index d705db37..3176b14d 100644 --- a/go.sum +++ b/go.sum @@ -146,6 +146,7 @@ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbt github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= @@ -231,6 +232,7 @@ github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSa github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.1.13/go.mod h1:L5Z7tw+7lRK1Fnpi/LT/ooCP1elkXn0krMWBQHUhEDE= +github.com/adlio/schema v1.2.3/go.mod h1:nD7ZWmMMbwU12Pqwg+qL0rTvHBrBXfNz+5UQxTfy38M= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= @@ -332,6 +334,7 @@ github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BR github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.21.0-beta/go.mod h1:ZSWyehm27aAuS9bvkATT+Xte3hjHZ+MRgMY/8NJ7K94= +github.com/btcsuite/btcd v0.22.0-beta/go.mod h1:9n5ntfhhHQBIhUvlhDvD3Qg6fRUj4jkN0VB8L8svzOA= github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= @@ -464,6 +467,7 @@ github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe/go.mod h1:cE github.com/containerd/continuity v0.0.0-20201208142359-180525291bb7/go.mod h1:kR3BEg7bDFaEddKm54WSmrol1fKWDU1nKYkgrcgZT7Y= github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e/go.mod h1:EXlVlkqNba9rJe3j7w3Xa924itAMLgZH4UD/Q4PExuQ= github.com/containerd/continuity v0.1.0/go.mod h1:ICJu0PwR54nI0yPEnJ6jcS+J7CZAUXrLh8lPo2knzsM= +github.com/containerd/continuity v0.2.1/go.mod h1:wCYX+dRqZdImhGucXOqTQn05AhX6EUDaGEMUzTFFpLg= github.com/containerd/continuity v0.2.2/go.mod h1:pWygW9u7LtS1o4N/Tn0FoCFDIXZ7rxcMX7HX1Dmibvk= github.com/containerd/continuity v0.2.3-0.20220330195504-d132b287edc8/go.mod h1:pWygW9u7LtS1o4N/Tn0FoCFDIXZ7rxcMX7HX1Dmibvk= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= @@ -559,6 +563,7 @@ github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= +github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= github.com/cosmos/iavl v0.19.3 h1:cESO0OwTTxQm5rmyESKW+zESheDUYI7CcZDWWDwnuxg= github.com/cosmos/iavl v0.19.3/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/ibc-go/v2 v2.0.3 h1:kZ6SAj7hyxoixsLEUBx431bVGiBW22PCHwkWHafWhXs= @@ -685,10 +690,12 @@ github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQL github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= +github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg= github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= +github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= @@ -1552,6 +1559,7 @@ github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rm github.com/opencontainers/runc v1.0.0-rc92/go.mod h1:X1zlU4p7wOlX4+WRCz+hvlRv8phdL7UqbYD+vQwNMmE= github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= +github.com/opencontainers/runc v1.0.3/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= github.com/opencontainers/runc v1.1.0/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runc v1.1.1/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= @@ -1748,6 +1756,7 @@ github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.26.0/go.mod h1:yBiM87lvSqX8h0Ww4sdzNSkVYZ8dL2xjZJG1lAuGZEo= github.com/rs/zerolog v1.27.0 h1:1T7qCieN22GVc8S4Q2yuexzBb1EqjbgjSH9RohbMjKs= github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= github.com/rubiojr/go-vhd v0.0.0-20160810183302-0bfd3b39853c/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto= @@ -1763,6 +1772,7 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/safchain/ethtool v0.0.0-20210803160452-9aa261dae9b1/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= +github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpOAnclKvg+mdA= github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= @@ -1865,6 +1875,7 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= +github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= @@ -1924,6 +1935,7 @@ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/tendermint v0.34.14/go.mod h1:FrwVm3TvsVicI9Z7FlucHV6Znfd5KBc/Lpp69cCwtk0= +github.com/tendermint/tendermint v0.34.16/go.mod h1:n0G22GynfeXTYbrn2IeLeB+oqsAe6R6jl4vZxZ1Y8F4= github.com/tendermint/tendermint v0.34.20/go.mod h1:KtOwCLYJcsS1ymtAfnjjAtXfXClbqcqjdqzFt2Em1Ac= github.com/tendermint/tendermint v0.34.21 h1:UiGGnBFHVrZhoQVQ7EfwSOLuCtarqCSsRf8VrklqB7s= github.com/tendermint/tendermint v0.34.21/go.mod h1:XDvfg6U7grcFTDx7VkzxnhazQ/bspGJAn4DZ6DcLLjQ= @@ -2332,6 +2344,7 @@ golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -2828,6 +2841,7 @@ google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201119123407-9b1e624d6bc4/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= diff --git a/proto/panacea/datadeal/v2/consent.proto b/proto/panacea/datadeal/v2/consent.proto new file mode 100644 index 00000000..d080edd4 --- /dev/null +++ b/proto/panacea/datadeal/v2/consent.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package panacea.datadeal.v2; + +option go_package = "github.com/medibloc/panacea-core/x/datadeal/types"; + +import "gogoproto/gogo.proto"; +import "panacea/datadeal/v2/deal.proto"; + +// Certificate defines a certificate +message Certificate { + string cid = 1; + string operator_address = 2; + int64 deal_id = 3; + string provider_address = 4; + string data_hash = 5; +} \ No newline at end of file diff --git a/proto/panacea/datadeal/v2/deal.proto b/proto/panacea/datadeal/v2/deal.proto new file mode 100644 index 00000000..53fba9c3 --- /dev/null +++ b/proto/panacea/datadeal/v2/deal.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package panacea.datadeal.v2; + +option go_package = "github.com/medibloc/panacea-core/x/datadeal/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +// Deal defines a deal. +message Deal { + uint64 id = 1; + string address = 2; + repeated string data_schema = 3; + cosmos.base.v1beta1.Coin budget = 4; + uint64 max_num_data = 5; + uint64 cur_num_data = 6; + string consumer_address = 7; + DealStatus status = 8; + bytes nonce = 9; +} + +// DealStatus enumerates the status of deal. +enum DealStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // DEAL_STATUS_UNSPECIFIED + DEAL_STATUS_UNSPECIFIED = 0; + + // DEAL_STATUS_ACTIVE defines the deal status that is active. + DEAL_STATUS_ACTIVE = 1; + + // DEAL_STATUS_INACTIVE defines the deal status that is inactive. + DEAL_STATUS_INACTIVE = 2; + + // DEAL_STATUS_COMPLETED defines the deal status that is completed. + DEAL_STATUS_COMPLETED = 3; +} \ No newline at end of file diff --git a/proto/panacea/datadeal/v2/genesis.proto b/proto/panacea/datadeal/v2/genesis.proto new file mode 100644 index 00000000..6e0d6e28 --- /dev/null +++ b/proto/panacea/datadeal/v2/genesis.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package panacea.datadeal.v2; + +option go_package = "github.com/medibloc/panacea-core/x/datadeal/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "panacea/datadeal/v2/deal.proto"; +import "panacea/datadeal/v2/consent.proto"; + +// GenesisState defines the datadeal module's genesis state. +message GenesisState { + uint64 next_deal_number = 1; + repeated Deal deals = 2 [(gogoproto.nullable) = false]; + repeated Certificate certificates = 3 [(gogoproto.nullable) = false]; +} \ No newline at end of file diff --git a/proto/panacea/datadeal/v2/query.proto b/proto/panacea/datadeal/v2/query.proto new file mode 100644 index 00000000..3b0d403b --- /dev/null +++ b/proto/panacea/datadeal/v2/query.proto @@ -0,0 +1,80 @@ +syntax = "proto3"; +package panacea.datadeal.v2; + +option go_package = "github.com/medibloc/panacea-core/x/datadeal/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "google/api/annotations.proto"; +import "panacea/datadeal/v2/deal.proto"; +import "panacea/datadeal/v2/consent.proto"; + +// Query defines the gRPC querier service. +service Query { + // Deals return a list of Deal. + rpc Deals(QueryDealsRequest) returns (QueryDealsResponse) { + option (google.api.http).get = "/panacea/datadeal/v2/deals"; + } + + // Deal returns a Deal. + rpc Deal(QueryDealRequest) returns (QueryDealResponse) { + option (google.api.http).get = "/panacea/datadeal/v2/deals/{deal_id}"; + } + + // Certificates returns a list of Certificate. + rpc Certificates(QueryCertificates) returns (QueryCertificatesResponse) { + option (google.api.http).get = "/panacea/datadeal/v2/deals/{deal_id}/certificates"; + } + + // Certificate returns a Certificate + rpc Certificate(QueryCertificate) returns (QueryCertificateResponse) { + option (google.api.http).get = "/panacea/datadeal/v2/deals/{deal_id}/certificates/{data_hash}"; + } + + +} + +// QueryDealsRequest defines the request type for the Query/Deals RPC method. +message QueryDealsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryDealsResponse defines the response type for the Query/Deals RPC method. +message QueryDealsResponse { + repeated Deal deal = 1; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryDealRequest defines the request type for the Query/Deal RPC method. +message QueryDealRequest { + uint64 deal_id = 1; +} + +// QueryDealResponse defines the response type for the Query/Deal RPC method. +message QueryDealResponse { + Deal deal = 1; +} + +// QueryDealsRequest defines the request type for the Query/Deals RPC method. +message QueryCertificates { + int64 deal_id = 1; + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryDealsResponse defines the response type for the Query/Deals RPC method. +message QueryCertificatesResponse { + repeated Certificate certificates = 1; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + + +message QueryCertificate { + uint64 deal_id = 1; + string data_hash = 2; +} + + +message QueryCertificateResponse { + Certificate certificate = 1; +} + diff --git a/proto/panacea/datadeal/v2/tx.proto b/proto/panacea/datadeal/v2/tx.proto new file mode 100644 index 00000000..09e6565c --- /dev/null +++ b/proto/panacea/datadeal/v2/tx.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; +package panacea.datadeal.v2; + +option go_package = "github.com/medibloc/panacea-core/x/datadeal/types"; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "panacea/datadeal/v2/deal.proto"; +import "panacea/datadeal/v2/consent.proto"; + +// Msg defines the Msg service. +service Msg { + // CreateDeal defines a method for creating a deal. + rpc CreateDeal(MsgCreateDeal) returns (MsgCreateDealResponse); + + // DeactivateDeal defines a method for deactivating the deal. + rpc DeactivateDeal(MsgDeactivateDeal) returns (MsgDeactivateDealResponse); + + // SubmitConsent + rpc SubmitConsent(MsgSubmitConsent) returns (MsgSubmitConsentResponse); +} + +// MsgCreateDeal defines the Msg/CreateDeal request type. +message MsgCreateDeal { + repeated string data_schema = 1; + cosmos.base.v1beta1.Coin budget = 2; + uint64 max_num_data = 3; + string buyer_address = 4; + bytes nonce =5; +} + +// MsgCreateDealResponse defines the Msg/CreateDeal response type. +message MsgCreateDealResponse { + uint64 deal_id = 1; +} + +// MsgDeactivateDeal defines the Msg/DeactivateDeal request type. +message MsgDeactivateDeal { + uint64 deal_id = 1; + string requester_address = 2; +} + +// MsgDeactivateDealResponse defines the Msg/DeactivateDeal response type. +message MsgDeactivateDealResponse { +} + +// MsgSubmitConsent defines the Msg/SubmitConsent request type. +message MsgSubmitConsent { + Certificate certificate = 1; + bytes signature = 2; +} + +// MsgSubmitConsentResponse defines the Msg/SubmitConsent response type. +message MsgSubmitConsentResponse { +} \ No newline at end of file diff --git a/proto/panacea/oracle/v2/genesis.proto b/proto/panacea/oracle/v2/genesis.proto new file mode 100644 index 00000000..efa066e8 --- /dev/null +++ b/proto/panacea/oracle/v2/genesis.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package panacea.oracle.v2; + +option go_package = "github.com/medibloc/panacea-core/x/oracle/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "panacea/oracle/v2/oracle.proto"; + +// GenesisState defines the oracle module's genesis state. +message GenesisState { + repeated Oracle oracles = 1 [(gogoproto.nullable) = false]; + repeated OracleRegistration oracleRegistrations = 2 [(gogoproto.nullable) = false]; +} + +// Params defines the oracle module's params. +message Params { + // A base64-encoded oracle public key which is paired with an oracle private key generated in SGX by the first oracle. + // This key is used to encrypt data, so that the data can be decrypted and verified securely only in SGX + string oracle_public_key = 1; + // A base64-encoded SGX remote report which contains an oracle public key. + // Using this report, anyone can validate that the oracle key pair was generated in SGX. + string oracle_pub_key_remote_report = 2; + // The unique ID of current version of oracle. + string unique_id = 3; +} \ No newline at end of file diff --git a/proto/panacea/oracle/v2/oracle.proto b/proto/panacea/oracle/v2/oracle.proto new file mode 100644 index 00000000..47453687 --- /dev/null +++ b/proto/panacea/oracle/v2/oracle.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package panacea.oracle.v2; + +option go_package = "github.com/medibloc/panacea-core/x/oracle/types"; + +import "gogoproto/gogo.proto"; + +// Oracle defines a detail of oracle. +message Oracle { + string operator_address = 1; + OracleStatus status = 2; + string unique_id = 3; + string endpoint = 4; + string oracle_commission_rate = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +// OracleStatus enumerates the status of oracle. +enum OracleStatus { + option (gogoproto.goproto_enum_prefix) = false; + + // ORACLE_STATUS_UNSPECIFIED + ORACLE_STATUS_UNSPECIFIED = 0; + + // ORACLE_STATUS_ACTIVE defines the oracle status that is active + ORACLE_STATUS_ACTIVE = 1; + + // ORACLE_STATUS_INACTIVE defines the oracle status that is inactive + ORACLE_STATUS_INACTIVE = 2; +} + +// OracleRegistration defines the detailed states of the registration of oracle. +message OracleRegistration { + string unique_id = 1; + string operator_address = 2; + // Node public key is a pair with a node private key which is generated in SGX by each oracle. + // This key is used to share the oracle private key from other oracles. + bytes node_pub_key = 3; + // Anyone can validate that the node key pair is generated in SGX using this node key remote report. + bytes node_pub_key_remote_report = 4; + // The trusted block info is required for light client. + // Other oracle can validate whether the oracle set correct trusted block info. + int64 trusted_block_height = 5; + bytes trusted_block_hash = 6; + string endpoint = 7; + string oracle_commission_rate = 8 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + // Nonce required for AES256-GCM encryption + bytes nonce = 9; +} \ No newline at end of file diff --git a/proto/panacea/oracle/v2/query.proto b/proto/panacea/oracle/v2/query.proto new file mode 100644 index 00000000..656330b5 --- /dev/null +++ b/proto/panacea/oracle/v2/query.proto @@ -0,0 +1,89 @@ +syntax = "proto3"; +package panacea.oracle.v2; + +option go_package = "github.com/medibloc/panacea-core/x/oracle/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "google/api/annotations.proto"; +import "panacea/oracle/v2/oracle.proto"; +import "panacea/oracle/v2/genesis.proto"; + +service Query { + // Oracles returns a list of oracles. + rpc Oracles(QueryOraclesRequest) returns (QueryOraclesResponse) { + option (google.api.http).get = "/panacea/oracle/v2/oracles"; + } + + // Oracle returns a oracle. + rpc Oracle(QueryOracleRequest) returns (QueryOracleResponse) { + option (google.api.http).get = "/panacea/oracle/v2/oracles/{operator_address}"; + } + + // OracleRegistrations returns a list of OracleRegistration. + rpc OracleRegistrations(QueryOracleRegistrationsRequest) returns (QueryOracleRegistrationsResponse) { + option (google.api.http).get = "/panacea/oracle/v2/oracle_registrations"; + } + + // OracleRegistration returns a OracleRegistration details. + rpc OracleRegistration(QueryOracleRegistrationRequest) returns (QueryOracleRegistrationResponse) { + option (google.api.http).get = "/panacea/oracle/v2/oracle_registrations/{unique_id}/{operator_address}"; + } + + // Params returns params of oracle module. + rpc Params(QueryOracleParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/panacea/oracle/v2/params"; + } +} + +// QueryOraclesRequest is the request type for the Query/Oracles RPC method. +message QueryOraclesRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryOracleResponse is the response type for the Query/Oracles RPC method. +message QueryOraclesResponse { + repeated Oracle oracles = 1; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryOracleRequest is the request type for the Query/Oracle RPC method. +message QueryOracleRequest { + string operator_address = 1; +} + +// QueryOracleResponse is the response type for the Query/Oracle RPC method. +message QueryOracleResponse { + Oracle oracle = 1; +} + +// QueryOracleRegistrationsRequest is the request type for the Query/OracleRegistrations RPC method. +message QueryOracleRegistrationsRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryOracleRegistrationsResponse is the response type for the Query/OracleRegistrations RPC method. +message QueryOracleRegistrationsResponse { + repeated OracleRegistration oracle_registrations = 1; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryOracleRegistrationRequest is the request type for the Query/OracleRegistration RPC method. +message QueryOracleRegistrationRequest { + string unique_id = 1; + string operator_address = 2; +} + +// QueryOracleRegistrationResponse is the response type for the Query/OracleRegistration RPC method. +message QueryOracleRegistrationResponse { + OracleRegistration oracle_registration = 1; +} + +// QueryOracleParamsRequest is the request type for the Query/OracleParams RPC method. +message QueryOracleParamsRequest {} + +// QueryParamsResponse is the response type for the Query/OracleParams RPC method. +message QueryParamsResponse { + Params params = 1; +} diff --git a/proto/panacea/oracle/v2/tx.proto b/proto/panacea/oracle/v2/tx.proto new file mode 100644 index 00000000..d35bebcc --- /dev/null +++ b/proto/panacea/oracle/v2/tx.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; +package panacea.oracle.v2; + +option go_package = "github.com/medibloc/panacea-core/x/oracle/types"; + +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "google/api/annotations.proto"; +import "panacea/oracle/v2/oracle.proto"; +import "panacea/oracle/v2/genesis.proto"; + +// Msg defines the Msg service. +service Msg { + // RegisterOracle defines a method for registration of oracle. + rpc RegisterOracle(MsgRegisterOracle) returns (MsgRegisterOracleResponse); + + // ApproveOracleRegistration defines a method to approve oracle registration + rpc ApproveOracleRegistration(MsgApproveOracleRegistration) returns (MsgApproveOracleRegistrationResponse); + + // UpgradeOracle defines a method for upgrade of oracle. + rpc UpdateOracleInfo(MsgUpdateOracleInfo) returns (MsgUpdateOracleInfoResponse); +} + +// MsgRegisterOracle defines the Msg/RegisterOracle request type. +message MsgRegisterOracle { + string unique_id = 1; + string operator_address = 2; // panacea1.. account address + bytes node_pub_key = 3; + bytes node_pub_key_remote_report = 4; + int64 trusted_block_height = 5; + bytes trusted_block_hash = 6; + string endpoint = 7; + string oracle_commission_rate = 8 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +// MsgRegisterOracleResponse defines the Msg/RegisterOracle response type. +message MsgRegisterOracleResponse { +} + +// MsgApproveOracleRegistration defines the Msg/ApproveOracleRegistration +message MsgApproveOracleRegistration { + ApproveOracleRegistration approveOracleRegistration = 1; + bytes signature = 2; +} + +// ApproveOracleRegistration defines for oracle registration approval +message ApproveOracleRegistration { + string unique_id = 1; + string target_operator_address = 2; + bytes encrypted_oracle_priv_key = 3; +} + +// MsgApproveOracleRegistrationResponse defines the Msg/ApproveOracleRegistration +message MsgApproveOracleRegistrationResponse { +} + +// MsgUpdateOracleInfo defines the Msg/UpdateOracleInfo +message MsgUpdateOracleInfo { + string operator_address = 1; // panacea1.. account address + string endpoint = 2; + string oracle_commission_rate = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; +} + +// MsgUpdateOracleInfoResponse defines the Msg/UpdateOracleInfo +message MsgUpdateOracleInfoResponse { +} diff --git a/scripts/protocgen.sh b/scripts/protocgen.sh index 0b19eb66..37bed170 100755 --- a/scripts/protocgen.sh +++ b/scripts/protocgen.sh @@ -30,5 +30,6 @@ Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \ done ## move proto files to the right places -cp -r github.com/medibloc/panacea-core/* ./ -rm -rf github.com +find ./x -type f -name "*.pb*.go" -exec rm {} \; +cp -rv github.com/medibloc/panacea-core/x/* ./x/ +rm -rfv github.com \ No newline at end of file diff --git a/x/datadeal/types/consent.pb.go b/x/datadeal/types/consent.pb.go new file mode 100644 index 00000000..76e57700 --- /dev/null +++ b/x/datadeal/types/consent.pb.go @@ -0,0 +1,512 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/datadeal/v2/consent.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Certificate defines a certificate +type Certificate struct { + Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` + OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + DealId int64 `protobuf:"varint,3,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` + ProviderAddress string `protobuf:"bytes,4,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty"` + DataHash string `protobuf:"bytes,5,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` +} + +func (m *Certificate) Reset() { *m = Certificate{} } +func (m *Certificate) String() string { return proto.CompactTextString(m) } +func (*Certificate) ProtoMessage() {} +func (*Certificate) Descriptor() ([]byte, []int) { + return fileDescriptor_b5d80581f65c4381, []int{0} +} +func (m *Certificate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Certificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Certificate.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 *Certificate) XXX_Merge(src proto.Message) { + xxx_messageInfo_Certificate.Merge(m, src) +} +func (m *Certificate) XXX_Size() int { + return m.Size() +} +func (m *Certificate) XXX_DiscardUnknown() { + xxx_messageInfo_Certificate.DiscardUnknown(m) +} + +var xxx_messageInfo_Certificate proto.InternalMessageInfo + +func (m *Certificate) GetCid() string { + if m != nil { + return m.Cid + } + return "" +} + +func (m *Certificate) GetOperatorAddress() string { + if m != nil { + return m.OperatorAddress + } + return "" +} + +func (m *Certificate) GetDealId() int64 { + if m != nil { + return m.DealId + } + return 0 +} + +func (m *Certificate) GetProviderAddress() string { + if m != nil { + return m.ProviderAddress + } + return "" +} + +func (m *Certificate) GetDataHash() string { + if m != nil { + return m.DataHash + } + return "" +} + +func init() { + proto.RegisterType((*Certificate)(nil), "panacea.datadeal.v2.Certificate") +} + +func init() { proto.RegisterFile("panacea/datadeal/v2/consent.proto", fileDescriptor_b5d80581f65c4381) } + +var fileDescriptor_b5d80581f65c4381 = []byte{ + // 279 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xb1, 0x4e, 0xeb, 0x30, + 0x14, 0x86, 0xeb, 0xdb, 0x4b, 0xa1, 0x66, 0xa0, 0x0a, 0x48, 0x44, 0x45, 0xb2, 0x0a, 0x53, 0x19, + 0x88, 0x45, 0x79, 0x02, 0x60, 0x01, 0xb1, 0x75, 0x64, 0x89, 0x1c, 0xfb, 0x90, 0x58, 0x6a, 0x73, + 0x22, 0xdb, 0x44, 0xf0, 0x16, 0xbc, 0x07, 0x2f, 0xc2, 0xd8, 0x91, 0x11, 0x25, 0x2f, 0x82, 0xec, + 0x34, 0xea, 0xc2, 0x76, 0xfc, 0xff, 0x9f, 0x3f, 0xd9, 0x87, 0x9e, 0x57, 0xa2, 0x14, 0x12, 0x04, + 0x57, 0xc2, 0x09, 0x05, 0x62, 0xc5, 0xeb, 0x05, 0x97, 0x58, 0x5a, 0x28, 0x5d, 0x52, 0x19, 0x74, + 0x18, 0x1d, 0x6f, 0x91, 0xa4, 0x47, 0x92, 0x7a, 0x31, 0x3d, 0xc9, 0x31, 0xc7, 0xd0, 0x73, 0x3f, + 0x75, 0xe8, 0x94, 0xfd, 0x65, 0x0b, 0x57, 0x42, 0x7f, 0xf1, 0x49, 0xe8, 0xe1, 0x3d, 0x18, 0xa7, + 0x5f, 0xb4, 0x14, 0x0e, 0xa2, 0x09, 0x1d, 0x4a, 0xad, 0x62, 0x32, 0x23, 0xf3, 0xf1, 0xd2, 0x8f, + 0xd1, 0x25, 0x9d, 0x60, 0x05, 0x46, 0x38, 0x34, 0xa9, 0x50, 0xca, 0x80, 0xb5, 0xf1, 0xbf, 0x50, + 0x1f, 0xf5, 0xf9, 0x6d, 0x17, 0x47, 0xa7, 0x74, 0xdf, 0xab, 0x53, 0xad, 0xe2, 0xe1, 0x8c, 0xcc, + 0x87, 0xcb, 0x91, 0x3f, 0x3e, 0x06, 0x47, 0x65, 0xb0, 0xd6, 0x0a, 0x76, 0x8e, 0xff, 0x9d, 0xa3, + 0xcf, 0x7b, 0xc7, 0x19, 0x1d, 0xfb, 0xa7, 0xa6, 0x85, 0xb0, 0x45, 0xbc, 0x17, 0x98, 0x03, 0x1f, + 0x3c, 0x08, 0x5b, 0xdc, 0x3d, 0x7d, 0x35, 0x8c, 0x6c, 0x1a, 0x46, 0x7e, 0x1a, 0x46, 0x3e, 0x5a, + 0x36, 0xd8, 0xb4, 0x6c, 0xf0, 0xdd, 0xb2, 0xc1, 0xf3, 0x75, 0xae, 0x5d, 0xf1, 0x9a, 0x25, 0x12, + 0xd7, 0x7c, 0x0d, 0x4a, 0x67, 0x2b, 0x94, 0x7c, 0xfb, 0xf7, 0x2b, 0x89, 0x06, 0xf8, 0xdb, 0x6e, + 0x05, 0xee, 0xbd, 0x02, 0x9b, 0x8d, 0xc2, 0x06, 0x6e, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2b, + 0xb1, 0x98, 0x17, 0x71, 0x01, 0x00, 0x00, +} + +func (m *Certificate) 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 *Certificate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Certificate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DataHash) > 0 { + i -= len(m.DataHash) + copy(dAtA[i:], m.DataHash) + i = encodeVarintConsent(dAtA, i, uint64(len(m.DataHash))) + i-- + dAtA[i] = 0x2a + } + if len(m.ProviderAddress) > 0 { + i -= len(m.ProviderAddress) + copy(dAtA[i:], m.ProviderAddress) + i = encodeVarintConsent(dAtA, i, uint64(len(m.ProviderAddress))) + i-- + dAtA[i] = 0x22 + } + if m.DealId != 0 { + i = encodeVarintConsent(dAtA, i, uint64(m.DealId)) + i-- + dAtA[i] = 0x18 + } + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintConsent(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Cid) > 0 { + i -= len(m.Cid) + copy(dAtA[i:], m.Cid) + i = encodeVarintConsent(dAtA, i, uint64(len(m.Cid))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintConsent(dAtA []byte, offset int, v uint64) int { + offset -= sovConsent(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Certificate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Cid) + if l > 0 { + n += 1 + l + sovConsent(uint64(l)) + } + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovConsent(uint64(l)) + } + if m.DealId != 0 { + n += 1 + sovConsent(uint64(m.DealId)) + } + l = len(m.ProviderAddress) + if l > 0 { + n += 1 + l + sovConsent(uint64(l)) + } + l = len(m.DataHash) + if l > 0 { + n += 1 + l + sovConsent(uint64(l)) + } + return n +} + +func sovConsent(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozConsent(x uint64) (n int) { + return sovConsent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Certificate) 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 ErrIntOverflowConsent + } + 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: Certificate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Certificate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsent + } + 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 ErrInvalidLengthConsent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConsent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cid = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsent + } + 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 ErrInvalidLengthConsent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConsent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DealId", wireType) + } + m.DealId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DealId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsent + } + 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 ErrInvalidLengthConsent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConsent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProviderAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsent + } + 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 ErrInvalidLengthConsent + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConsent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipConsent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthConsent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipConsent(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowConsent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowConsent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowConsent + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthConsent + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupConsent + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthConsent + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthConsent = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowConsent = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupConsent = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/datadeal/types/deal.pb.go b/x/datadeal/types/deal.pb.go new file mode 100644 index 00000000..63219026 --- /dev/null +++ b/x/datadeal/types/deal.pb.go @@ -0,0 +1,732 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/datadeal/v2/deal.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// DealStatus enumerates the status of deal. +type DealStatus int32 + +const ( + // DEAL_STATUS_UNSPECIFIED + DEAL_STATUS_UNSPECIFIED DealStatus = 0 + // DEAL_STATUS_ACTIVE defines the deal status that is active. + DEAL_STATUS_ACTIVE DealStatus = 1 + // DEAL_STATUS_INACTIVE defines the deal status that is inactive. + DEAL_STATUS_INACTIVE DealStatus = 2 + // DEAL_STATUS_COMPLETED defines the deal status that is completed. + DEAL_STATUS_COMPLETED DealStatus = 3 +) + +var DealStatus_name = map[int32]string{ + 0: "DEAL_STATUS_UNSPECIFIED", + 1: "DEAL_STATUS_ACTIVE", + 2: "DEAL_STATUS_INACTIVE", + 3: "DEAL_STATUS_COMPLETED", +} + +var DealStatus_value = map[string]int32{ + "DEAL_STATUS_UNSPECIFIED": 0, + "DEAL_STATUS_ACTIVE": 1, + "DEAL_STATUS_INACTIVE": 2, + "DEAL_STATUS_COMPLETED": 3, +} + +func (x DealStatus) String() string { + return proto.EnumName(DealStatus_name, int32(x)) +} + +func (DealStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_45d9ced3b49eab12, []int{0} +} + +// Deal defines a deal. +type Deal struct { + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + DataSchema []string `protobuf:"bytes,3,rep,name=data_schema,json=dataSchema,proto3" json:"data_schema,omitempty"` + Budget *types.Coin `protobuf:"bytes,4,opt,name=budget,proto3" json:"budget,omitempty"` + MaxNumData uint64 `protobuf:"varint,5,opt,name=max_num_data,json=maxNumData,proto3" json:"max_num_data,omitempty"` + CurNumData uint64 `protobuf:"varint,6,opt,name=cur_num_data,json=curNumData,proto3" json:"cur_num_data,omitempty"` + ConsumerAddress string `protobuf:"bytes,7,opt,name=consumer_address,json=consumerAddress,proto3" json:"consumer_address,omitempty"` + Status DealStatus `protobuf:"varint,8,opt,name=status,proto3,enum=panacea.datadeal.v2.DealStatus" json:"status,omitempty"` + Nonce []byte `protobuf:"bytes,9,opt,name=nonce,proto3" json:"nonce,omitempty"` +} + +func (m *Deal) Reset() { *m = Deal{} } +func (m *Deal) String() string { return proto.CompactTextString(m) } +func (*Deal) ProtoMessage() {} +func (*Deal) Descriptor() ([]byte, []int) { + return fileDescriptor_45d9ced3b49eab12, []int{0} +} +func (m *Deal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Deal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Deal.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 *Deal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Deal.Merge(m, src) +} +func (m *Deal) XXX_Size() int { + return m.Size() +} +func (m *Deal) XXX_DiscardUnknown() { + xxx_messageInfo_Deal.DiscardUnknown(m) +} + +var xxx_messageInfo_Deal proto.InternalMessageInfo + +func (m *Deal) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *Deal) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *Deal) GetDataSchema() []string { + if m != nil { + return m.DataSchema + } + return nil +} + +func (m *Deal) GetBudget() *types.Coin { + if m != nil { + return m.Budget + } + return nil +} + +func (m *Deal) GetMaxNumData() uint64 { + if m != nil { + return m.MaxNumData + } + return 0 +} + +func (m *Deal) GetCurNumData() uint64 { + if m != nil { + return m.CurNumData + } + return 0 +} + +func (m *Deal) GetConsumerAddress() string { + if m != nil { + return m.ConsumerAddress + } + return "" +} + +func (m *Deal) GetStatus() DealStatus { + if m != nil { + return m.Status + } + return DEAL_STATUS_UNSPECIFIED +} + +func (m *Deal) GetNonce() []byte { + if m != nil { + return m.Nonce + } + return nil +} + +func init() { + proto.RegisterEnum("panacea.datadeal.v2.DealStatus", DealStatus_name, DealStatus_value) + proto.RegisterType((*Deal)(nil), "panacea.datadeal.v2.Deal") +} + +func init() { proto.RegisterFile("panacea/datadeal/v2/deal.proto", fileDescriptor_45d9ced3b49eab12) } + +var fileDescriptor_45d9ced3b49eab12 = []byte{ + // 457 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xb3, 0x4e, 0x9a, 0x92, 0x69, 0x55, 0xa2, 0x25, 0x80, 0x1b, 0x24, 0xd7, 0xe2, 0x64, + 0x90, 0xd8, 0x55, 0xc2, 0x81, 0x73, 0x88, 0x8d, 0x14, 0x51, 0x42, 0x65, 0xa7, 0x1c, 0xb8, 0x58, + 0xeb, 0xf5, 0x2a, 0xb5, 0x14, 0x7b, 0x23, 0xaf, 0x1d, 0x05, 0x89, 0x07, 0xe0, 0xc8, 0x3b, 0xf0, + 0x26, 0x9c, 0x38, 0xf6, 0xc8, 0x11, 0x25, 0x2f, 0x82, 0xfc, 0x4f, 0xc9, 0xa1, 0xa7, 0xdd, 0xf9, + 0xbe, 0x9f, 0x76, 0xbf, 0x19, 0x0d, 0x18, 0x6b, 0x96, 0x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 0xdc, 0x83, 0x02, 0x00, 0x00, +} + +func (m *Deal) 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 *Deal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Deal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Nonce) > 0 { + i -= len(m.Nonce) + copy(dAtA[i:], m.Nonce) + i = encodeVarintDeal(dAtA, i, uint64(len(m.Nonce))) + i-- + dAtA[i] = 0x4a + } + if m.Status != 0 { + i = encodeVarintDeal(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x40 + } + if len(m.ConsumerAddress) > 0 { + i -= len(m.ConsumerAddress) + copy(dAtA[i:], m.ConsumerAddress) + i = encodeVarintDeal(dAtA, i, uint64(len(m.ConsumerAddress))) + i-- + dAtA[i] = 0x3a + } + if m.CurNumData != 0 { + i = encodeVarintDeal(dAtA, i, uint64(m.CurNumData)) + i-- + dAtA[i] = 0x30 + } + if m.MaxNumData != 0 { + i = encodeVarintDeal(dAtA, i, uint64(m.MaxNumData)) + i-- + dAtA[i] = 0x28 + } + if m.Budget != nil { + { + size, err := m.Budget.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintDeal(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if len(m.DataSchema) > 0 { + for iNdEx := len(m.DataSchema) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.DataSchema[iNdEx]) + copy(dAtA[i:], m.DataSchema[iNdEx]) + i = encodeVarintDeal(dAtA, i, uint64(len(m.DataSchema[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintDeal(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintDeal(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintDeal(dAtA []byte, offset int, v uint64) int { + offset -= sovDeal(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Deal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovDeal(uint64(m.Id)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovDeal(uint64(l)) + } + if len(m.DataSchema) > 0 { + for _, s := range m.DataSchema { + l = len(s) + n += 1 + l + sovDeal(uint64(l)) + } + } + if m.Budget != nil { + l = m.Budget.Size() + n += 1 + l + sovDeal(uint64(l)) + } + if m.MaxNumData != 0 { + n += 1 + sovDeal(uint64(m.MaxNumData)) + } + if m.CurNumData != 0 { + n += 1 + sovDeal(uint64(m.CurNumData)) + } + l = len(m.ConsumerAddress) + if l > 0 { + n += 1 + l + sovDeal(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovDeal(uint64(m.Status)) + } + l = len(m.Nonce) + if l > 0 { + n += 1 + l + sovDeal(uint64(l)) + } + return n +} + +func sovDeal(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozDeal(x uint64) (n int) { + return sovDeal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Deal) 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 ErrIntOverflowDeal + } + 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: Deal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Deal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + 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 ErrInvalidLengthDeal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDeal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataSchema", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + 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 ErrInvalidLengthDeal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDeal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataSchema = append(m.DataSchema, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Budget", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthDeal + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthDeal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Budget == nil { + m.Budget = &types.Coin{} + } + if err := m.Budget.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxNumData", wireType) + } + m.MaxNumData = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxNumData |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CurNumData", wireType) + } + m.CurNumData = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CurNumData |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsumerAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + 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 ErrInvalidLengthDeal + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthDeal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ConsumerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= DealStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowDeal + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthDeal + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthDeal + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Nonce = append(m.Nonce[:0], dAtA[iNdEx:postIndex]...) + if m.Nonce == nil { + m.Nonce = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipDeal(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthDeal + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipDeal(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDeal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDeal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowDeal + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthDeal + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupDeal + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthDeal + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthDeal = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowDeal = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupDeal = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/datadeal/types/genesis.pb.go b/x/datadeal/types/genesis.pb.go new file mode 100644 index 00000000..96eec98a --- /dev/null +++ b/x/datadeal/types/genesis.pb.go @@ -0,0 +1,434 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/datadeal/v2/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the datadeal module's genesis state. +type GenesisState struct { + NextDealNumber uint64 `protobuf:"varint,1,opt,name=next_deal_number,json=nextDealNumber,proto3" json:"next_deal_number,omitempty"` + Deals []Deal `protobuf:"bytes,2,rep,name=deals,proto3" json:"deals"` + Certificates []Certificate `protobuf:"bytes,3,rep,name=certificates,proto3" json:"certificates"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_4930434e4830666e, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetNextDealNumber() uint64 { + if m != nil { + return m.NextDealNumber + } + return 0 +} + +func (m *GenesisState) GetDeals() []Deal { + if m != nil { + return m.Deals + } + return nil +} + +func (m *GenesisState) GetCertificates() []Certificate { + if m != nil { + return m.Certificates + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "panacea.datadeal.v2.GenesisState") +} + +func init() { proto.RegisterFile("panacea/datadeal/v2/genesis.proto", fileDescriptor_4930434e4830666e) } + +var fileDescriptor_4930434e4830666e = []byte{ + // 302 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0xd0, 0xbf, 0x4e, 0xf3, 0x30, + 0x10, 0x00, 0xf0, 0xf8, 0x6b, 0x3f, 0x86, 0x50, 0x21, 0x14, 0x18, 0x4a, 0x07, 0xb7, 0x30, 0x75, + 0xc1, 0x16, 0x45, 0xbc, 0x40, 0x41, 0x42, 0x02, 0x89, 0xa1, 0x6c, 0x2c, 0x95, 0xe3, 0x5e, 0x8d, + 0xa5, 0xc4, 0x8e, 0xe2, 0x6b, 0x55, 0xde, 0x82, 0xf7, 0xe1, 0x05, 0x3a, 0x76, 0x64, 0x42, 0x28, + 0x79, 0x11, 0x14, 0x27, 0xa8, 0x42, 0xca, 0x96, 0xdc, 0xfd, 0xee, 0x8f, 0x2f, 0x3c, 0xcf, 0x84, + 0x11, 0x12, 0x04, 0x5f, 0x08, 0x14, 0x0b, 0x10, 0x09, 0x5f, 0x4f, 0xb8, 0x02, 0x03, 0x4e, 0x3b, + 0x96, 0xe5, 0x16, 0x6d, 0x74, 0xd2, 0x10, 0xf6, 0x4b, 0xd8, 0x7a, 0x32, 0x38, 0x55, 0x56, 0x59, + 0x9f, 0xe7, 0xd5, 0x57, 0x4d, 0x07, 0x43, 0x65, 0xad, 0x4a, 0x80, 0xfb, 0xbf, 0x78, 0xb5, 0xe4, + 0xa8, 0x53, 0x70, 0x28, 0xd2, 0xac, 0x01, 0xb4, 0x6d, 0x9c, 0xef, 0x59, 0xe7, 0x5b, 0xd7, 0x91, + 0xd6, 0x38, 0x30, 0x58, 0x93, 0x8b, 0x0f, 0x12, 0xf6, 0xee, 0xeb, 0x05, 0x9f, 0x51, 0x20, 0x44, + 0xe3, 0xf0, 0xd8, 0xc0, 0x06, 0xe7, 0x15, 0x9f, 0x9b, 0x55, 0x1a, 0x43, 0xde, 0x27, 0x23, 0x32, + 0xee, 0xce, 0x8e, 0xaa, 0xf8, 0x1d, 0x88, 0xe4, 0xc9, 0x47, 0xa3, 0x9b, 0xf0, 0x7f, 0x85, 0x5c, + 0xff, 0xdf, 0xa8, 0x33, 0x3e, 0x9c, 0x9c, 0xb1, 0x96, 0x97, 0xb1, 0xca, 0x4f, 0xbb, 0xdb, 0xaf, + 0x61, 0x30, 0xab, 0x75, 0xf4, 0x10, 0xf6, 0x24, 0xe4, 0xa8, 0x97, 0x5a, 0x0a, 0x04, 0xd7, 0xef, + 0xf8, 0xea, 0x51, 0x6b, 0xf5, 0xed, 0x1e, 0x36, 0x4d, 0xfe, 0xd4, 0x4e, 0x1f, 0xb7, 0x05, 0x25, + 0xbb, 0x82, 0x92, 0xef, 0x82, 0x92, 0xf7, 0x92, 0x06, 0xbb, 0x92, 0x06, 0x9f, 0x25, 0x0d, 0x5e, + 0xae, 0x94, 0xc6, 0xd7, 0x55, 0xcc, 0xa4, 0x4d, 0x79, 0x0a, 0x0b, 0x1d, 0x27, 0x56, 0xf2, 0x66, + 0xc4, 0xa5, 0xb4, 0x39, 0xf0, 0xcd, 0xfe, 0x2a, 0xf8, 0x96, 0x81, 0x8b, 0x0f, 0xfc, 0x45, 0xae, + 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x1c, 0x73, 0x6c, 0x01, 0xc5, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Certificates) > 0 { + for iNdEx := len(m.Certificates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Certificates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Deals) > 0 { + for iNdEx := len(m.Deals) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.NextDealNumber != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.NextDealNumber)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NextDealNumber != 0 { + n += 1 + sovGenesis(uint64(m.NextDealNumber)) + } + if len(m.Deals) > 0 { + for _, e := range m.Deals { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Certificates) > 0 { + for _, e := range m.Certificates { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NextDealNumber", wireType) + } + m.NextDealNumber = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.NextDealNumber |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deals = append(m.Deals, Deal{}) + if err := m.Deals[len(m.Deals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certificates = append(m.Certificates, Certificate{}) + if err := m.Certificates[len(m.Certificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/datadeal/types/query.pb.go b/x/datadeal/types/query.pb.go new file mode 100644 index 00000000..87e75455 --- /dev/null +++ b/x/datadeal/types/query.pb.go @@ -0,0 +1,1974 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/datadeal/v2/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryDealsRequest defines the request type for the Query/Deals RPC method. +type QueryDealsRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDealsRequest) Reset() { *m = QueryDealsRequest{} } +func (m *QueryDealsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDealsRequest) ProtoMessage() {} +func (*QueryDealsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4c7a445ecc4b9161, []int{0} +} +func (m *QueryDealsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDealsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDealsRequest.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 *QueryDealsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDealsRequest.Merge(m, src) +} +func (m *QueryDealsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDealsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDealsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDealsRequest proto.InternalMessageInfo + +func (m *QueryDealsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDealsResponse defines the response type for the Query/Deals RPC method. +type QueryDealsResponse struct { + Deal []*Deal `protobuf:"bytes,1,rep,name=deal,proto3" json:"deal,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryDealsResponse) Reset() { *m = QueryDealsResponse{} } +func (m *QueryDealsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDealsResponse) ProtoMessage() {} +func (*QueryDealsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4c7a445ecc4b9161, []int{1} +} +func (m *QueryDealsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDealsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDealsResponse.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 *QueryDealsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDealsResponse.Merge(m, src) +} +func (m *QueryDealsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDealsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDealsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDealsResponse proto.InternalMessageInfo + +func (m *QueryDealsResponse) GetDeal() []*Deal { + if m != nil { + return m.Deal + } + return nil +} + +func (m *QueryDealsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDealRequest defines the request type for the Query/Deal RPC method. +type QueryDealRequest struct { + DealId uint64 `protobuf:"varint,1,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` +} + +func (m *QueryDealRequest) Reset() { *m = QueryDealRequest{} } +func (m *QueryDealRequest) String() string { return proto.CompactTextString(m) } +func (*QueryDealRequest) ProtoMessage() {} +func (*QueryDealRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_4c7a445ecc4b9161, []int{2} +} +func (m *QueryDealRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDealRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDealRequest.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 *QueryDealRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDealRequest.Merge(m, src) +} +func (m *QueryDealRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryDealRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDealRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDealRequest proto.InternalMessageInfo + +func (m *QueryDealRequest) GetDealId() uint64 { + if m != nil { + return m.DealId + } + return 0 +} + +// QueryDealResponse defines the response type for the Query/Deal RPC method. +type QueryDealResponse struct { + Deal *Deal `protobuf:"bytes,1,opt,name=deal,proto3" json:"deal,omitempty"` +} + +func (m *QueryDealResponse) Reset() { *m = QueryDealResponse{} } +func (m *QueryDealResponse) String() string { return proto.CompactTextString(m) } +func (*QueryDealResponse) ProtoMessage() {} +func (*QueryDealResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4c7a445ecc4b9161, []int{3} +} +func (m *QueryDealResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryDealResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryDealResponse.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 *QueryDealResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryDealResponse.Merge(m, src) +} +func (m *QueryDealResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryDealResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryDealResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryDealResponse proto.InternalMessageInfo + +func (m *QueryDealResponse) GetDeal() *Deal { + if m != nil { + return m.Deal + } + return nil +} + +// QueryDealsRequest defines the request type for the Query/Deals RPC method. +type QueryCertificates struct { + DealId int64 `protobuf:"varint,1,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryCertificates) Reset() { *m = QueryCertificates{} } +func (m *QueryCertificates) String() string { return proto.CompactTextString(m) } +func (*QueryCertificates) ProtoMessage() {} +func (*QueryCertificates) Descriptor() ([]byte, []int) { + return fileDescriptor_4c7a445ecc4b9161, []int{4} +} +func (m *QueryCertificates) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCertificates) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCertificates.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 *QueryCertificates) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCertificates.Merge(m, src) +} +func (m *QueryCertificates) XXX_Size() int { + return m.Size() +} +func (m *QueryCertificates) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCertificates.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCertificates proto.InternalMessageInfo + +func (m *QueryCertificates) GetDealId() int64 { + if m != nil { + return m.DealId + } + return 0 +} + +func (m *QueryCertificates) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryDealsResponse defines the response type for the Query/Deals RPC method. +type QueryCertificatesResponse struct { + Certificates []*Certificate `protobuf:"bytes,1,rep,name=certificates,proto3" json:"certificates,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryCertificatesResponse) Reset() { *m = QueryCertificatesResponse{} } +func (m *QueryCertificatesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCertificatesResponse) ProtoMessage() {} +func (*QueryCertificatesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4c7a445ecc4b9161, []int{5} +} +func (m *QueryCertificatesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCertificatesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCertificatesResponse.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 *QueryCertificatesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCertificatesResponse.Merge(m, src) +} +func (m *QueryCertificatesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCertificatesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCertificatesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCertificatesResponse proto.InternalMessageInfo + +func (m *QueryCertificatesResponse) GetCertificates() []*Certificate { + if m != nil { + return m.Certificates + } + return nil +} + +func (m *QueryCertificatesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryCertificate struct { + DealId uint64 `protobuf:"varint,1,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` + DataHash string `protobuf:"bytes,2,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` +} + +func (m *QueryCertificate) Reset() { *m = QueryCertificate{} } +func (m *QueryCertificate) String() string { return proto.CompactTextString(m) } +func (*QueryCertificate) ProtoMessage() {} +func (*QueryCertificate) Descriptor() ([]byte, []int) { + return fileDescriptor_4c7a445ecc4b9161, []int{6} +} +func (m *QueryCertificate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCertificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCertificate.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 *QueryCertificate) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCertificate.Merge(m, src) +} +func (m *QueryCertificate) XXX_Size() int { + return m.Size() +} +func (m *QueryCertificate) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCertificate.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCertificate proto.InternalMessageInfo + +func (m *QueryCertificate) GetDealId() uint64 { + if m != nil { + return m.DealId + } + return 0 +} + +func (m *QueryCertificate) GetDataHash() string { + if m != nil { + return m.DataHash + } + return "" +} + +type QueryCertificateResponse struct { + Certificate *Certificate `protobuf:"bytes,1,opt,name=certificate,proto3" json:"certificate,omitempty"` +} + +func (m *QueryCertificateResponse) Reset() { *m = QueryCertificateResponse{} } +func (m *QueryCertificateResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCertificateResponse) ProtoMessage() {} +func (*QueryCertificateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4c7a445ecc4b9161, []int{7} +} +func (m *QueryCertificateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCertificateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCertificateResponse.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 *QueryCertificateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCertificateResponse.Merge(m, src) +} +func (m *QueryCertificateResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCertificateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCertificateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCertificateResponse proto.InternalMessageInfo + +func (m *QueryCertificateResponse) GetCertificate() *Certificate { + if m != nil { + return m.Certificate + } + return nil +} + +func init() { + proto.RegisterType((*QueryDealsRequest)(nil), "panacea.datadeal.v2.QueryDealsRequest") + proto.RegisterType((*QueryDealsResponse)(nil), "panacea.datadeal.v2.QueryDealsResponse") + proto.RegisterType((*QueryDealRequest)(nil), "panacea.datadeal.v2.QueryDealRequest") + proto.RegisterType((*QueryDealResponse)(nil), "panacea.datadeal.v2.QueryDealResponse") + proto.RegisterType((*QueryCertificates)(nil), "panacea.datadeal.v2.QueryCertificates") + proto.RegisterType((*QueryCertificatesResponse)(nil), "panacea.datadeal.v2.QueryCertificatesResponse") + proto.RegisterType((*QueryCertificate)(nil), "panacea.datadeal.v2.QueryCertificate") + proto.RegisterType((*QueryCertificateResponse)(nil), "panacea.datadeal.v2.QueryCertificateResponse") +} + +func init() { proto.RegisterFile("panacea/datadeal/v2/query.proto", fileDescriptor_4c7a445ecc4b9161) } + +var fileDescriptor_4c7a445ecc4b9161 = []byte{ + // 593 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x3f, 0x6f, 0xd3, 0x4e, + 0x18, 0xc7, 0x73, 0x69, 0xda, 0xdf, 0xaf, 0x97, 0x0e, 0x70, 0x20, 0x91, 0x9a, 0xca, 0x04, 0x8b, + 0xa6, 0x15, 0x90, 0x3b, 0x25, 0x9d, 0x18, 0x10, 0x52, 0x28, 0x50, 0xc4, 0x02, 0x1e, 0x41, 0xa2, + 0xba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0x83, 0x46, 0x95, + 0xcc, 0x0a, 0xe7, 0xde, 0x27, 0x6b, 0x6b, 0xae, 0x2e, 0xe6, 0x74, 0x9c, 0xf7, 0xdf, 0x7e, 0x7d, + 0xce, 0x6f, 0x20, 0x8b, 0xcc, 0x7a, 0xb3, 0x05, 0xfa, 0x00, 0x60, 0x41, 0x65, 0xa1, 0xcd, 0x8b, + 0xab, 0x8e, 0xcd, 0x2b, 0xf3, 0x64, 0xc6, 0xfb, 0xae, 0xf6, 0xae, 0xa0, 0x5b, 0xb3, 0xbd, 0xc9, + 0x91, 0xd9, 0xcb, 0x31, 0xfa, 0x02, 0xe0, 0xda, 0xc4, 0x59, 0x5f, 0x60, 0x93, 0xd6, 0x59, 0x78, + 0x31, 0x5d, 0x82, 0x75, 0x4f, 0x63, 0xed, 0xa0, 0xda, 0x22, 0x58, 0x64, 0xe2, 0x48, 0x4f, 0x00, + 0x2c, 0xa6, 0xef, 0x6a, 0x73, 0x21, 0x6b, 0xab, 0xba, 0x90, 0x2c, 0x01, 0x7c, 0xa4, 0x01, 0x1f, + 0xa0, 0xfb, 0x7f, 0x0c, 0x48, 0x8e, 0x92, 0x6b, 0x3e, 0x6e, 0x3c, 0xfb, 0x3a, 0xb4, 0xc1, 0xe9, + 0xd0, 0x06, 0x3f, 0x87, 0x36, 0xf8, 0x34, 0xb2, 0x73, 0xa7, 0x23, 0x3b, 0xf7, 0x7d, 0x64, 0xe7, + 0x5e, 0xd6, 0xfc, 0x40, 0xb6, 0xfb, 0x4d, 0xec, 0xf1, 0x2e, 0xe9, 0xb2, 0x56, 0xd0, 0xec, 0x70, + 0x6f, 0xec, 0x55, 0xf5, 0x78, 0x8f, 0x91, 0xb7, 0x67, 0x96, 0xf2, 0x30, 0x62, 0xa2, 0xb9, 0xa2, + 0x3f, 0xee, 0x3b, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x1c, 0x02, 0xed, 0xb7, 0x06, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Deals return a list of Deal. + Deals(ctx context.Context, in *QueryDealsRequest, opts ...grpc.CallOption) (*QueryDealsResponse, error) + // Deal returns a Deal. + Deal(ctx context.Context, in *QueryDealRequest, opts ...grpc.CallOption) (*QueryDealResponse, error) + // Certificates returns a list of Certificate. + Certificates(ctx context.Context, in *QueryCertificates, opts ...grpc.CallOption) (*QueryCertificatesResponse, error) + // Certificate returns a Certificate + Certificate(ctx context.Context, in *QueryCertificate, opts ...grpc.CallOption) (*QueryCertificateResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Deals(ctx context.Context, in *QueryDealsRequest, opts ...grpc.CallOption) (*QueryDealsResponse, error) { + out := new(QueryDealsResponse) + err := c.cc.Invoke(ctx, "/panacea.datadeal.v2.Query/Deals", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Deal(ctx context.Context, in *QueryDealRequest, opts ...grpc.CallOption) (*QueryDealResponse, error) { + out := new(QueryDealResponse) + err := c.cc.Invoke(ctx, "/panacea.datadeal.v2.Query/Deal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Certificates(ctx context.Context, in *QueryCertificates, opts ...grpc.CallOption) (*QueryCertificatesResponse, error) { + out := new(QueryCertificatesResponse) + err := c.cc.Invoke(ctx, "/panacea.datadeal.v2.Query/Certificates", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Certificate(ctx context.Context, in *QueryCertificate, opts ...grpc.CallOption) (*QueryCertificateResponse, error) { + out := new(QueryCertificateResponse) + err := c.cc.Invoke(ctx, "/panacea.datadeal.v2.Query/Certificate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Deals return a list of Deal. + Deals(context.Context, *QueryDealsRequest) (*QueryDealsResponse, error) + // Deal returns a Deal. + Deal(context.Context, *QueryDealRequest) (*QueryDealResponse, error) + // Certificates returns a list of Certificate. + Certificates(context.Context, *QueryCertificates) (*QueryCertificatesResponse, error) + // Certificate returns a Certificate + Certificate(context.Context, *QueryCertificate) (*QueryCertificateResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Deals(ctx context.Context, req *QueryDealsRequest) (*QueryDealsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deals not implemented") +} +func (*UnimplementedQueryServer) Deal(ctx context.Context, req *QueryDealRequest) (*QueryDealResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deal not implemented") +} +func (*UnimplementedQueryServer) Certificates(ctx context.Context, req *QueryCertificates) (*QueryCertificatesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Certificates not implemented") +} +func (*UnimplementedQueryServer) Certificate(ctx context.Context, req *QueryCertificate) (*QueryCertificateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Certificate not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Deals_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDealsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Deals(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.datadeal.v2.Query/Deals", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deals(ctx, req.(*QueryDealsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Deal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDealRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Deal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.datadeal.v2.Query/Deal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Deal(ctx, req.(*QueryDealRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Certificates_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCertificates) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Certificates(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.datadeal.v2.Query/Certificates", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Certificates(ctx, req.(*QueryCertificates)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Certificate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCertificate) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Certificate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.datadeal.v2.Query/Certificate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Certificate(ctx, req.(*QueryCertificate)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "panacea.datadeal.v2.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Deals", + Handler: _Query_Deals_Handler, + }, + { + MethodName: "Deal", + Handler: _Query_Deal_Handler, + }, + { + MethodName: "Certificates", + Handler: _Query_Certificates_Handler, + }, + { + MethodName: "Certificate", + Handler: _Query_Certificate_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "panacea/datadeal/v2/query.proto", +} + +func (m *QueryDealsRequest) 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 *QueryDealsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDealsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryDealsResponse) 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 *QueryDealsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDealsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Deal) > 0 { + for iNdEx := len(m.Deal) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deal[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryDealRequest) 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 *QueryDealRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDealRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DealId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.DealId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryDealResponse) 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 *QueryDealResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryDealResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Deal != nil { + { + size, err := m.Deal.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryCertificates) 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 *QueryCertificates) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCertificates) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.DealId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.DealId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryCertificatesResponse) 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 *QueryCertificatesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCertificatesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Certificates) > 0 { + for iNdEx := len(m.Certificates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Certificates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryCertificate) 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 *QueryCertificate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCertificate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.DataHash) > 0 { + i -= len(m.DataHash) + copy(dAtA[i:], m.DataHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DataHash))) + i-- + dAtA[i] = 0x12 + } + if m.DealId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.DealId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryCertificateResponse) 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 *QueryCertificateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCertificateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Certificate != nil { + { + size, err := m.Certificate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryDealsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDealsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Deal) > 0 { + for _, e := range m.Deal { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryDealRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DealId != 0 { + n += 1 + sovQuery(uint64(m.DealId)) + } + return n +} + +func (m *QueryDealResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Deal != nil { + l = m.Deal.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCertificates) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DealId != 0 { + n += 1 + sovQuery(uint64(m.DealId)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCertificatesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Certificates) > 0 { + for _, e := range m.Certificates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCertificate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DealId != 0 { + n += 1 + sovQuery(uint64(m.DealId)) + } + l = len(m.DataHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryCertificateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Certificate != nil { + l = m.Certificate.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryDealsRequest) 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 ErrIntOverflowQuery + } + 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: QueryDealsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDealsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDealsResponse) 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 ErrIntOverflowQuery + } + 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: QueryDealsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDealsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deal = append(m.Deal, &Deal{}) + if err := m.Deal[len(m.Deal)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDealRequest) 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 ErrIntOverflowQuery + } + 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: QueryDealRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDealRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DealId", wireType) + } + m.DealId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DealId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDealResponse) 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 ErrIntOverflowQuery + } + 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: QueryDealResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDealResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deal", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Deal == nil { + m.Deal = &Deal{} + } + if err := m.Deal.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCertificates) 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 ErrIntOverflowQuery + } + 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: QueryCertificates: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCertificates: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DealId", wireType) + } + m.DealId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DealId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCertificatesResponse) 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 ErrIntOverflowQuery + } + 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: QueryCertificatesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCertificatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certificates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Certificates = append(m.Certificates, &Certificate{}) + if err := m.Certificates[len(m.Certificates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCertificate) 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 ErrIntOverflowQuery + } + 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: QueryCertificate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCertificate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DealId", wireType) + } + m.DealId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DealId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DataHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCertificateResponse) 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 ErrIntOverflowQuery + } + 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: QueryCertificateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCertificateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certificate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Certificate == nil { + m.Certificate = &Certificate{} + } + if err := m.Certificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/datadeal/types/query.pb.gw.go b/x/datadeal/types/query.pb.gw.go new file mode 100644 index 00000000..601ea23f --- /dev/null +++ b/x/datadeal/types/query.pb.gw.go @@ -0,0 +1,500 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: panacea/datadeal/v2/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +var ( + filter_Query_Deals_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Deals_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDealsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Deals_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Deals(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Deals_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDealsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Deals_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Deals(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Deal_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDealRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["deal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "deal_id") + } + + protoReq.DealId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "deal_id", err) + } + + msg, err := client.Deal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Deal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDealRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["deal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "deal_id") + } + + protoReq.DealId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "deal_id", err) + } + + msg, err := server.Deal(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Certificates_0 = &utilities.DoubleArray{Encoding: map[string]int{"deal_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_Certificates_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCertificates + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["deal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "deal_id") + } + + protoReq.DealId, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "deal_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Certificates_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Certificates(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Certificates_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCertificates + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["deal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "deal_id") + } + + protoReq.DealId, err = runtime.Int64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "deal_id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Certificates_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Certificates(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Certificate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCertificate + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["deal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "deal_id") + } + + protoReq.DealId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "deal_id", err) + } + + val, ok = pathParams["data_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data_hash") + } + + protoReq.DataHash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data_hash", err) + } + + msg, err := client.Certificate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Certificate_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCertificate + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["deal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "deal_id") + } + + protoReq.DealId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "deal_id", err) + } + + val, ok = pathParams["data_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "data_hash") + } + + protoReq.DataHash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "data_hash", err) + } + + msg, err := server.Certificate(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Deals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Deals_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Deal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Deal_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Certificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Certificates_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Certificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Certificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Certificate_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Certificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Deals_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Deals_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deals_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Deal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Deal_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Deal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Certificates_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Certificates_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Certificates_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Certificate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Certificate_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Certificate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Deals_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"panacea", "datadeal", "v2", "deals"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Deal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"panacea", "datadeal", "v2", "deals", "deal_id"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Certificates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"panacea", "datadeal", "v2", "deals", "deal_id", "certificates"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Certificate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"panacea", "datadeal", "v2", "deals", "deal_id", "certificates", "data_hash"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Deals_0 = runtime.ForwardResponseMessage + + forward_Query_Deal_0 = runtime.ForwardResponseMessage + + forward_Query_Certificates_0 = runtime.ForwardResponseMessage + + forward_Query_Certificate_0 = runtime.ForwardResponseMessage +) diff --git a/x/datadeal/types/tx.pb.go b/x/datadeal/types/tx.pb.go new file mode 100644 index 00000000..33baf2ad --- /dev/null +++ b/x/datadeal/types/tx.pb.go @@ -0,0 +1,1541 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/datadeal/v2/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgCreateDeal defines the Msg/CreateDeal request type. +type MsgCreateDeal struct { + DataSchema []string `protobuf:"bytes,1,rep,name=data_schema,json=dataSchema,proto3" json:"data_schema,omitempty"` + Budget *types.Coin `protobuf:"bytes,2,opt,name=budget,proto3" json:"budget,omitempty"` + MaxNumData uint64 `protobuf:"varint,3,opt,name=max_num_data,json=maxNumData,proto3" json:"max_num_data,omitempty"` + BuyerAddress string `protobuf:"bytes,4,opt,name=buyer_address,json=buyerAddress,proto3" json:"buyer_address,omitempty"` + Nonce []byte `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` +} + +func (m *MsgCreateDeal) Reset() { *m = MsgCreateDeal{} } +func (m *MsgCreateDeal) String() string { return proto.CompactTextString(m) } +func (*MsgCreateDeal) ProtoMessage() {} +func (*MsgCreateDeal) Descriptor() ([]byte, []int) { + return fileDescriptor_9f03db1b9a7fe946, []int{0} +} +func (m *MsgCreateDeal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateDeal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateDeal.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 *MsgCreateDeal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateDeal.Merge(m, src) +} +func (m *MsgCreateDeal) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateDeal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateDeal.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateDeal proto.InternalMessageInfo + +func (m *MsgCreateDeal) GetDataSchema() []string { + if m != nil { + return m.DataSchema + } + return nil +} + +func (m *MsgCreateDeal) GetBudget() *types.Coin { + if m != nil { + return m.Budget + } + return nil +} + +func (m *MsgCreateDeal) GetMaxNumData() uint64 { + if m != nil { + return m.MaxNumData + } + return 0 +} + +func (m *MsgCreateDeal) GetBuyerAddress() string { + if m != nil { + return m.BuyerAddress + } + return "" +} + +func (m *MsgCreateDeal) GetNonce() []byte { + if m != nil { + return m.Nonce + } + return nil +} + +// MsgCreateDealResponse defines the Msg/CreateDeal response type. +type MsgCreateDealResponse struct { + DealId uint64 `protobuf:"varint,1,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` +} + +func (m *MsgCreateDealResponse) Reset() { *m = MsgCreateDealResponse{} } +func (m *MsgCreateDealResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateDealResponse) ProtoMessage() {} +func (*MsgCreateDealResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9f03db1b9a7fe946, []int{1} +} +func (m *MsgCreateDealResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateDealResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateDealResponse.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 *MsgCreateDealResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateDealResponse.Merge(m, src) +} +func (m *MsgCreateDealResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateDealResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateDealResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateDealResponse proto.InternalMessageInfo + +func (m *MsgCreateDealResponse) GetDealId() uint64 { + if m != nil { + return m.DealId + } + return 0 +} + +// MsgDeactivateDeal defines the Msg/DeactivateDeal request type. +type MsgDeactivateDeal struct { + DealId uint64 `protobuf:"varint,1,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` + RequesterAddress string `protobuf:"bytes,2,opt,name=requester_address,json=requesterAddress,proto3" json:"requester_address,omitempty"` +} + +func (m *MsgDeactivateDeal) Reset() { *m = MsgDeactivateDeal{} } +func (m *MsgDeactivateDeal) String() string { return proto.CompactTextString(m) } +func (*MsgDeactivateDeal) ProtoMessage() {} +func (*MsgDeactivateDeal) Descriptor() ([]byte, []int) { + return fileDescriptor_9f03db1b9a7fe946, []int{2} +} +func (m *MsgDeactivateDeal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeactivateDeal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeactivateDeal.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 *MsgDeactivateDeal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeactivateDeal.Merge(m, src) +} +func (m *MsgDeactivateDeal) XXX_Size() int { + return m.Size() +} +func (m *MsgDeactivateDeal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeactivateDeal.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeactivateDeal proto.InternalMessageInfo + +func (m *MsgDeactivateDeal) GetDealId() uint64 { + if m != nil { + return m.DealId + } + return 0 +} + +func (m *MsgDeactivateDeal) GetRequesterAddress() string { + if m != nil { + return m.RequesterAddress + } + return "" +} + +// MsgDeactivateDealResponse defines the Msg/DeactivateDeal response type. +type MsgDeactivateDealResponse struct { +} + +func (m *MsgDeactivateDealResponse) Reset() { *m = MsgDeactivateDealResponse{} } +func (m *MsgDeactivateDealResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDeactivateDealResponse) ProtoMessage() {} +func (*MsgDeactivateDealResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9f03db1b9a7fe946, []int{3} +} +func (m *MsgDeactivateDealResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeactivateDealResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeactivateDealResponse.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 *MsgDeactivateDealResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeactivateDealResponse.Merge(m, src) +} +func (m *MsgDeactivateDealResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDeactivateDealResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeactivateDealResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeactivateDealResponse proto.InternalMessageInfo + +// MsgSubmitConsent defines the Msg/SubmitConsent request type. +type MsgSubmitConsent struct { + Certificate *Certificate `protobuf:"bytes,1,opt,name=certificate,proto3" json:"certificate,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *MsgSubmitConsent) Reset() { *m = MsgSubmitConsent{} } +func (m *MsgSubmitConsent) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitConsent) ProtoMessage() {} +func (*MsgSubmitConsent) Descriptor() ([]byte, []int) { + return fileDescriptor_9f03db1b9a7fe946, []int{4} +} +func (m *MsgSubmitConsent) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitConsent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitConsent.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 *MsgSubmitConsent) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitConsent.Merge(m, src) +} +func (m *MsgSubmitConsent) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitConsent) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitConsent.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitConsent proto.InternalMessageInfo + +func (m *MsgSubmitConsent) GetCertificate() *Certificate { + if m != nil { + return m.Certificate + } + return nil +} + +func (m *MsgSubmitConsent) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +// MsgSubmitConsentResponse defines the Msg/SubmitConsent response type. +type MsgSubmitConsentResponse struct { +} + +func (m *MsgSubmitConsentResponse) Reset() { *m = MsgSubmitConsentResponse{} } +func (m *MsgSubmitConsentResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitConsentResponse) ProtoMessage() {} +func (*MsgSubmitConsentResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9f03db1b9a7fe946, []int{5} +} +func (m *MsgSubmitConsentResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitConsentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitConsentResponse.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 *MsgSubmitConsentResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitConsentResponse.Merge(m, src) +} +func (m *MsgSubmitConsentResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitConsentResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitConsentResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitConsentResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateDeal)(nil), "panacea.datadeal.v2.MsgCreateDeal") + proto.RegisterType((*MsgCreateDealResponse)(nil), "panacea.datadeal.v2.MsgCreateDealResponse") + proto.RegisterType((*MsgDeactivateDeal)(nil), "panacea.datadeal.v2.MsgDeactivateDeal") + proto.RegisterType((*MsgDeactivateDealResponse)(nil), "panacea.datadeal.v2.MsgDeactivateDealResponse") + proto.RegisterType((*MsgSubmitConsent)(nil), "panacea.datadeal.v2.MsgSubmitConsent") + proto.RegisterType((*MsgSubmitConsentResponse)(nil), "panacea.datadeal.v2.MsgSubmitConsentResponse") +} + +func init() { proto.RegisterFile("panacea/datadeal/v2/tx.proto", fileDescriptor_9f03db1b9a7fe946) } + +var fileDescriptor_9f03db1b9a7fe946 = []byte{ + // 531 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcd, 0x6e, 0xd3, 0x4e, + 0x14, 0xc5, 0xe3, 0xa4, 0xcd, 0x5f, 0xb9, 0x49, 0xfe, 0x6a, 0x87, 0x22, 0x5c, 0x53, 0x19, 0x63, + 0x04, 0x8a, 0x40, 0x1d, 0x93, 0xf0, 0x04, 0x34, 0xd9, 0x20, 0x14, 0x16, 0xee, 0x0a, 0x84, 0x14, + 0x8d, 0xc7, 0x17, 0xc7, 0x52, 0xec, 0x09, 0x9e, 0x71, 0x94, 0xbe, 0x05, 0x0f, 0xc3, 0x03, 0xb0, + 0x64, 0xd9, 0x25, 0x4b, 0x94, 0xbc, 0x08, 0xb2, 0x1d, 0xe7, 0xa3, 0x24, 0xa2, 0x3b, 0xfb, 0x9e, + 0xdf, 0xdc, 0x73, 0xee, 0x7c, 0xc0, 0xc5, 0x94, 0xc5, 0x8c, 0x23, 0x73, 0x7c, 0xa6, 0x98, 0x8f, + 0x6c, 0xe2, 0xcc, 0x7a, 0x8e, 0x9a, 0xd3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 0xdf, 0x0b, 0x53, 0xfb, 0xb6, 0x34, 0x2b, 0xb7, 0x4b, 0xb3, 0xf2, 0x6b, + 0x69, 0x56, 0x3e, 0x75, 0x83, 0x50, 0x8d, 0x53, 0x8f, 0x72, 0x11, 0x39, 0x11, 0xfa, 0xa1, 0x37, + 0x11, 0xdc, 0x59, 0xf5, 0xbe, 0xe4, 0x22, 0x41, 0x67, 0xbe, 0x79, 0x8d, 0xea, 0x66, 0x8a, 0xd2, + 0xab, 0xe7, 0x2f, 0xf1, 0xcd, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x3e, 0xe6, 0x7f, 0x37, + 0x04, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // CreateDeal defines a method for creating a deal. + CreateDeal(ctx context.Context, in *MsgCreateDeal, opts ...grpc.CallOption) (*MsgCreateDealResponse, error) + // DeactivateDeal defines a method for deactivating the deal. + DeactivateDeal(ctx context.Context, in *MsgDeactivateDeal, opts ...grpc.CallOption) (*MsgDeactivateDealResponse, error) + // SubmitConsent + SubmitConsent(ctx context.Context, in *MsgSubmitConsent, opts ...grpc.CallOption) (*MsgSubmitConsentResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateDeal(ctx context.Context, in *MsgCreateDeal, opts ...grpc.CallOption) (*MsgCreateDealResponse, error) { + out := new(MsgCreateDealResponse) + err := c.cc.Invoke(ctx, "/panacea.datadeal.v2.Msg/CreateDeal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DeactivateDeal(ctx context.Context, in *MsgDeactivateDeal, opts ...grpc.CallOption) (*MsgDeactivateDealResponse, error) { + out := new(MsgDeactivateDealResponse) + err := c.cc.Invoke(ctx, "/panacea.datadeal.v2.Msg/DeactivateDeal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) SubmitConsent(ctx context.Context, in *MsgSubmitConsent, opts ...grpc.CallOption) (*MsgSubmitConsentResponse, error) { + out := new(MsgSubmitConsentResponse) + err := c.cc.Invoke(ctx, "/panacea.datadeal.v2.Msg/SubmitConsent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateDeal defines a method for creating a deal. + CreateDeal(context.Context, *MsgCreateDeal) (*MsgCreateDealResponse, error) + // DeactivateDeal defines a method for deactivating the deal. + DeactivateDeal(context.Context, *MsgDeactivateDeal) (*MsgDeactivateDealResponse, error) + // SubmitConsent + SubmitConsent(context.Context, *MsgSubmitConsent) (*MsgSubmitConsentResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateDeal(ctx context.Context, req *MsgCreateDeal) (*MsgCreateDealResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateDeal not implemented") +} +func (*UnimplementedMsgServer) DeactivateDeal(ctx context.Context, req *MsgDeactivateDeal) (*MsgDeactivateDealResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeactivateDeal not implemented") +} +func (*UnimplementedMsgServer) SubmitConsent(ctx context.Context, req *MsgSubmitConsent) (*MsgSubmitConsentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitConsent not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateDeal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateDeal) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateDeal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.datadeal.v2.Msg/CreateDeal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateDeal(ctx, req.(*MsgCreateDeal)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DeactivateDeal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeactivateDeal) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeactivateDeal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.datadeal.v2.Msg/DeactivateDeal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeactivateDeal(ctx, req.(*MsgDeactivateDeal)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SubmitConsent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitConsent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitConsent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.datadeal.v2.Msg/SubmitConsent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitConsent(ctx, req.(*MsgSubmitConsent)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "panacea.datadeal.v2.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateDeal", + Handler: _Msg_CreateDeal_Handler, + }, + { + MethodName: "DeactivateDeal", + Handler: _Msg_DeactivateDeal_Handler, + }, + { + MethodName: "SubmitConsent", + Handler: _Msg_SubmitConsent_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "panacea/datadeal/v2/tx.proto", +} + +func (m *MsgCreateDeal) 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 *MsgCreateDeal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateDeal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Nonce) > 0 { + i -= len(m.Nonce) + copy(dAtA[i:], m.Nonce) + i = encodeVarintTx(dAtA, i, uint64(len(m.Nonce))) + i-- + dAtA[i] = 0x2a + } + if len(m.BuyerAddress) > 0 { + i -= len(m.BuyerAddress) + copy(dAtA[i:], m.BuyerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.BuyerAddress))) + i-- + dAtA[i] = 0x22 + } + if m.MaxNumData != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.MaxNumData)) + i-- + dAtA[i] = 0x18 + } + if m.Budget != nil { + { + size, err := m.Budget.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.DataSchema) > 0 { + for iNdEx := len(m.DataSchema) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.DataSchema[iNdEx]) + copy(dAtA[i:], m.DataSchema[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.DataSchema[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateDealResponse) 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 *MsgCreateDealResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateDealResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DealId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.DealId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgDeactivateDeal) 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 *MsgDeactivateDeal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeactivateDeal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RequesterAddress) > 0 { + i -= len(m.RequesterAddress) + copy(dAtA[i:], m.RequesterAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.RequesterAddress))) + i-- + dAtA[i] = 0x12 + } + if m.DealId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.DealId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgDeactivateDealResponse) 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 *MsgDeactivateDealResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeactivateDealResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgSubmitConsent) 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 *MsgSubmitConsent) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitConsent) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.Certificate != nil { + { + size, err := m.Certificate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitConsentResponse) 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 *MsgSubmitConsentResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitConsentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateDeal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.DataSchema) > 0 { + for _, s := range m.DataSchema { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + if m.Budget != nil { + l = m.Budget.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.MaxNumData != 0 { + n += 1 + sovTx(uint64(m.MaxNumData)) + } + l = len(m.BuyerAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Nonce) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateDealResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DealId != 0 { + n += 1 + sovTx(uint64(m.DealId)) + } + return n +} + +func (m *MsgDeactivateDeal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DealId != 0 { + n += 1 + sovTx(uint64(m.DealId)) + } + l = len(m.RequesterAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgDeactivateDealResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSubmitConsent) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Certificate != nil { + l = m.Certificate.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitConsentResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateDeal) 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: MsgCreateDeal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateDeal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DataSchema", 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.DataSchema = append(m.DataSchema, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Budget", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Budget == nil { + m.Budget = &types.Coin{} + } + if err := m.Budget.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxNumData", wireType) + } + m.MaxNumData = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxNumData |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BuyerAddress", 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.BuyerAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", 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.Nonce = append(m.Nonce[:0], dAtA[iNdEx:postIndex]...) + if m.Nonce == nil { + m.Nonce = []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 *MsgCreateDealResponse) 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: MsgCreateDealResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateDealResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DealId", wireType) + } + m.DealId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DealId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgDeactivateDeal) 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: MsgDeactivateDeal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeactivateDeal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DealId", wireType) + } + m.DealId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DealId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RequesterAddress", 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.RequesterAddress = string(dAtA[iNdEx:postIndex]) + 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 *MsgDeactivateDealResponse) 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: MsgDeactivateDealResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeactivateDealResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *MsgSubmitConsent) 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: MsgSubmitConsent: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitConsent: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Certificate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Certificate == nil { + m.Certificate = &Certificate{} + } + if err := m.Certificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", 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.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []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 *MsgSubmitConsentResponse) 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: MsgSubmitConsentResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitConsentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go new file mode 100644 index 00000000..4f0afa5d --- /dev/null +++ b/x/oracle/types/genesis.pb.go @@ -0,0 +1,681 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/oracle/v2/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the oracle module's genesis state. +type GenesisState struct { + Oracles []Oracle `protobuf:"bytes,1,rep,name=oracles,proto3" json:"oracles"` + OracleRegistrations []OracleRegistration `protobuf:"bytes,2,rep,name=oracleRegistrations,proto3" json:"oracleRegistrations"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_321e5b447e46614a, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetOracles() []Oracle { + if m != nil { + return m.Oracles + } + return nil +} + +func (m *GenesisState) GetOracleRegistrations() []OracleRegistration { + if m != nil { + return m.OracleRegistrations + } + return nil +} + +// Params defines the oracle module's params. +type Params struct { + // A base64-encoded oracle public key which is paired with an oracle private key generated in SGX by the first oracle. + // This key is used to encrypt data, so that the data can be decrypted and verified securely only in SGX + OraclePublicKey string `protobuf:"bytes,1,opt,name=oracle_public_key,json=oraclePublicKey,proto3" json:"oracle_public_key,omitempty"` + // A base64-encoded SGX remote report which contains an oracle public key. + // Using this report, anyone can validate that the oracle key pair was generated in SGX. + OraclePubKeyRemoteReport string `protobuf:"bytes,2,opt,name=oracle_pub_key_remote_report,json=oraclePubKeyRemoteReport,proto3" json:"oracle_pub_key_remote_report,omitempty"` + // The unique ID of current version of oracle. + UniqueId string `protobuf:"bytes,3,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_321e5b447e46614a, []int{1} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetOraclePublicKey() string { + if m != nil { + return m.OraclePublicKey + } + return "" +} + +func (m *Params) GetOraclePubKeyRemoteReport() string { + if m != nil { + return m.OraclePubKeyRemoteReport + } + return "" +} + +func (m *Params) GetUniqueId() string { + if m != nil { + return m.UniqueId + } + return "" +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "panacea.oracle.v2.GenesisState") + proto.RegisterType((*Params)(nil), "panacea.oracle.v2.Params") +} + +func init() { proto.RegisterFile("panacea/oracle/v2/genesis.proto", fileDescriptor_321e5b447e46614a) } + +var fileDescriptor_321e5b447e46614a = []byte{ + // 355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 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, 0xe3, 0x99, 0x74, 0x6a, 0x3a, 0xe6, 0xf0, 0xc7, 0x98, 0xaf, 0x74, 0x15, 0xf9, 0x5d, 0x4e, + 0xef, 0x09, 0xe1, 0xc6, 0x84, 0x0a, 0x9a, 0x4a, 0xfb, 0x08, 0xb7, 0x0c, 0x11, 0xe4, 0x45, 0x98, + 0xb0, 0x28, 0xb8, 0x83, 0xd2, 0x41, 0x5d, 0xd4, 0x6f, 0xfa, 0xff, 0x8d, 0x31, 0xd1, 0xf5, 0x31, + 0x94, 0xf6, 0x19, 0x3e, 0xf8, 0x64, 0xd7, 0x60, 0x20, 0x20, 0xe5, 0x0a, 0x02, 0x01, 0x39, 0x17, + 0xca, 0xa9, 0xe9, 0x36, 0xe7, 0xa3, 0x6d, 0x0c, 0xa5, 0xaf, 0x01, 0x5f, 0xfb, 0xf6, 0x3e, 0x6e, + 0x16, 0x19, 0xbb, 0x2f, 0x20, 0x60, 0x53, 0xa7, 0xae, 0xe1, 0x3f, 0xa6, 0x30, 0x9a, 0x0e, 0x47, + 0xf3, 0xa5, 0x8b, 0x16, 0x4b, 0x17, 0xbd, 0x2d, 0x5d, 0xf4, 0xb8, 0x72, 0xad, 0xc5, 0xca, 0xb5, + 0x5e, 0x56, 0xae, 0x75, 0x45, 0x62, 0xa6, 0x6e, 0x8b, 0xd0, 0x8b, 0x78, 0x4a, 0x52, 0x98, 0xb2, + 0x30, 0xe1, 0x11, 0xa9, 0x56, 0x70, 0x1c, 0x71, 0x01, 0xe4, 0x61, 0x73, 0x13, 0x55, 0xe6, 0x20, + 0xc3, 0x86, 0x3e, 0xc8, 0xc9, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x75, 0xdb, 0xd3, 0x1d, + 0x02, 0x00, 0x00, +} + +func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OracleRegistrations) > 0 { + for iNdEx := len(m.OracleRegistrations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OracleRegistrations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Oracles) > 0 { + for iNdEx := len(m.Oracles) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Oracles[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UniqueId) > 0 { + i -= len(m.UniqueId) + copy(dAtA[i:], m.UniqueId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.UniqueId))) + i-- + dAtA[i] = 0x1a + } + if len(m.OraclePubKeyRemoteReport) > 0 { + i -= len(m.OraclePubKeyRemoteReport) + copy(dAtA[i:], m.OraclePubKeyRemoteReport) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.OraclePubKeyRemoteReport))) + i-- + dAtA[i] = 0x12 + } + if len(m.OraclePublicKey) > 0 { + i -= len(m.OraclePublicKey) + copy(dAtA[i:], m.OraclePublicKey) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.OraclePublicKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Oracles) > 0 { + for _, e := range m.Oracles { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.OracleRegistrations) > 0 { + for _, e := range m.OracleRegistrations { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OraclePublicKey) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.OraclePubKeyRemoteReport) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.UniqueId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Oracles", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Oracles = append(m.Oracles, Oracle{}) + if err := m.Oracles[len(m.Oracles)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleRegistrations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OracleRegistrations = append(m.OracleRegistrations, OracleRegistration{}) + if err := m.OracleRegistrations[len(m.OracleRegistrations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) 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 ErrIntOverflowGenesis + } + 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OraclePublicKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OraclePublicKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OraclePubKeyRemoteReport", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OraclePubKeyRemoteReport = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniqueId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + 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 ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UniqueId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go new file mode 100644 index 00000000..02512d4f --- /dev/null +++ b/x/oracle/types/oracle.pb.go @@ -0,0 +1,1131 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/oracle/v2/oracle.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// OracleStatus enumerates the status of oracle. +type OracleStatus int32 + +const ( + // ORACLE_STATUS_UNSPECIFIED + ORACLE_STATUS_UNSPECIFIED OracleStatus = 0 + // ORACLE_STATUS_ACTIVE defines the oracle status that is active + ORACLE_STATUS_ACTIVE OracleStatus = 1 + // ORACLE_STATUS_INACTIVE defines the oracle status that is inactive + ORACLE_STATUS_INACTIVE OracleStatus = 2 +) + +var OracleStatus_name = map[int32]string{ + 0: "ORACLE_STATUS_UNSPECIFIED", + 1: "ORACLE_STATUS_ACTIVE", + 2: "ORACLE_STATUS_INACTIVE", +} + +var OracleStatus_value = map[string]int32{ + "ORACLE_STATUS_UNSPECIFIED": 0, + "ORACLE_STATUS_ACTIVE": 1, + "ORACLE_STATUS_INACTIVE": 2, +} + +func (x OracleStatus) String() string { + return proto.EnumName(OracleStatus_name, int32(x)) +} + +func (OracleStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_35c1a1e2fbbbc7ea, []int{0} +} + +// Oracle defines a detail of oracle. +type Oracle struct { + OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + Status OracleStatus `protobuf:"varint,2,opt,name=status,proto3,enum=panacea.oracle.v2.OracleStatus" json:"status,omitempty"` + UniqueId string `protobuf:"bytes,3,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` + Endpoint string `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + OracleCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=oracle_commission_rate,json=oracleCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_commission_rate"` +} + +func (m *Oracle) Reset() { *m = Oracle{} } +func (m *Oracle) String() string { return proto.CompactTextString(m) } +func (*Oracle) ProtoMessage() {} +func (*Oracle) Descriptor() ([]byte, []int) { + return fileDescriptor_35c1a1e2fbbbc7ea, []int{0} +} +func (m *Oracle) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Oracle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Oracle.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 *Oracle) XXX_Merge(src proto.Message) { + xxx_messageInfo_Oracle.Merge(m, src) +} +func (m *Oracle) XXX_Size() int { + return m.Size() +} +func (m *Oracle) XXX_DiscardUnknown() { + xxx_messageInfo_Oracle.DiscardUnknown(m) +} + +var xxx_messageInfo_Oracle proto.InternalMessageInfo + +func (m *Oracle) GetOperatorAddress() string { + if m != nil { + return m.OperatorAddress + } + return "" +} + +func (m *Oracle) GetStatus() OracleStatus { + if m != nil { + return m.Status + } + return ORACLE_STATUS_UNSPECIFIED +} + +func (m *Oracle) GetUniqueId() string { + if m != nil { + return m.UniqueId + } + return "" +} + +func (m *Oracle) GetEndpoint() string { + if m != nil { + return m.Endpoint + } + return "" +} + +// OracleRegistration defines the detailed states of the registration of oracle. +type OracleRegistration struct { + UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` + OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + // Node public key is a pair with a node private key which is generated in SGX by each oracle. + // This key is used to share the oracle private key from other oracles. + NodePubKey []byte `protobuf:"bytes,3,opt,name=node_pub_key,json=nodePubKey,proto3" json:"node_pub_key,omitempty"` + // Anyone can validate that the node key pair is generated in SGX using this node key remote report. + NodePubKeyRemoteReport []byte `protobuf:"bytes,4,opt,name=node_pub_key_remote_report,json=nodePubKeyRemoteReport,proto3" json:"node_pub_key_remote_report,omitempty"` + // The trusted block info is required for light client. + // Other oracle can validate whether the oracle set correct trusted block info. + TrustedBlockHeight int64 `protobuf:"varint,5,opt,name=trusted_block_height,json=trustedBlockHeight,proto3" json:"trusted_block_height,omitempty"` + TrustedBlockHash []byte `protobuf:"bytes,6,opt,name=trusted_block_hash,json=trustedBlockHash,proto3" json:"trusted_block_hash,omitempty"` + Endpoint string `protobuf:"bytes,7,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + OracleCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=oracle_commission_rate,json=oracleCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_commission_rate"` + // Nonce required for AES256-GCM encryption + Nonce []byte `protobuf:"bytes,9,opt,name=nonce,proto3" json:"nonce,omitempty"` +} + +func (m *OracleRegistration) Reset() { *m = OracleRegistration{} } +func (m *OracleRegistration) String() string { return proto.CompactTextString(m) } +func (*OracleRegistration) ProtoMessage() {} +func (*OracleRegistration) Descriptor() ([]byte, []int) { + return fileDescriptor_35c1a1e2fbbbc7ea, []int{1} +} +func (m *OracleRegistration) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OracleRegistration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OracleRegistration.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 *OracleRegistration) XXX_Merge(src proto.Message) { + xxx_messageInfo_OracleRegistration.Merge(m, src) +} +func (m *OracleRegistration) XXX_Size() int { + return m.Size() +} +func (m *OracleRegistration) XXX_DiscardUnknown() { + xxx_messageInfo_OracleRegistration.DiscardUnknown(m) +} + +var xxx_messageInfo_OracleRegistration proto.InternalMessageInfo + +func (m *OracleRegistration) GetUniqueId() string { + if m != nil { + return m.UniqueId + } + return "" +} + +func (m *OracleRegistration) GetOperatorAddress() string { + if m != nil { + return m.OperatorAddress + } + return "" +} + +func (m *OracleRegistration) GetNodePubKey() []byte { + if m != nil { + return m.NodePubKey + } + return nil +} + +func (m *OracleRegistration) GetNodePubKeyRemoteReport() []byte { + if m != nil { + return m.NodePubKeyRemoteReport + } + return nil +} + +func (m *OracleRegistration) GetTrustedBlockHeight() int64 { + if m != nil { + return m.TrustedBlockHeight + } + return 0 +} + +func (m *OracleRegistration) GetTrustedBlockHash() []byte { + if m != nil { + return m.TrustedBlockHash + } + return nil +} + +func (m *OracleRegistration) GetEndpoint() string { + if m != nil { + return m.Endpoint + } + return "" +} + +func (m *OracleRegistration) GetNonce() []byte { + if m != nil { + return m.Nonce + } + return nil +} + +func init() { + proto.RegisterEnum("panacea.oracle.v2.OracleStatus", OracleStatus_name, OracleStatus_value) + proto.RegisterType((*Oracle)(nil), "panacea.oracle.v2.Oracle") + proto.RegisterType((*OracleRegistration)(nil), "panacea.oracle.v2.OracleRegistration") +} + +func init() { proto.RegisterFile("panacea/oracle/v2/oracle.proto", fileDescriptor_35c1a1e2fbbbc7ea) } + +var fileDescriptor_35c1a1e2fbbbc7ea = []byte{ + // 535 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0x41, 0x6f, 0xd3, 0x30, + 0x14, 0xc7, 0x93, 0x76, 0x2b, 0xad, 0x55, 0x41, 0xb1, 0xaa, 0x2a, 0x14, 0x91, 0x56, 0x3b, 0xa0, + 0x81, 0x58, 0x82, 0xca, 0x01, 0x89, 0x5b, 0xdb, 0x15, 0x11, 0x81, 0xb6, 0x29, 0xed, 0x38, 0x70, + 0xb1, 0xdc, 0xe4, 0xa9, 0xb5, 0xba, 0xc4, 0xc1, 0x76, 0x26, 0xfa, 0x0d, 0x90, 0xb8, 0xf0, 0x1d, + 0xf8, 0x06, 0x7c, 0x8a, 0x1d, 0x77, 0x44, 0x1c, 0x26, 0xd4, 0x7e, 0x11, 0x54, 0x27, 0x85, 0x76, + 0xec, 0xc0, 0x61, 0xa7, 0xd8, 0xef, 0xf7, 0xcf, 0xf3, 0xf3, 0xff, 0xf9, 0x21, 0x3b, 0xa1, 0x31, + 0x0d, 0x80, 0xba, 0x5c, 0xd0, 0xe0, 0x0c, 0xdc, 0xf3, 0x4e, 0xbe, 0x72, 0x12, 0xc1, 0x15, 0xc7, + 0xf7, 0x73, 0xee, 0xe4, 0xd1, 0xf3, 0x4e, 0xb3, 0x3e, 0xe1, 0x13, 0xae, 0xa9, 0xbb, 0x5a, 0x65, + 0xc2, 0xbd, 0x2f, 0x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b6, 0xf1, 0xc1, + 0xdd, 0xb8, 0x58, 0x04, 0x21, 0x5b, 0xf9, 0xe9, 0xe6, 0x43, 0x71, 0x10, 0x70, 0x01, 0xee, 0xa7, + 0xf5, 0xac, 0xea, 0x5b, 0x8e, 0x4b, 0x7a, 0xfe, 0x5e, 0xfc, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf3, + 0x68, 0x89, 0x60, 0xca, 0x03, 0x00, 0x00, +} + +func (m *Oracle) 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 *Oracle) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Oracle) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.OracleCommissionRate.Size() + i -= size + if _, err := m.OracleCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + if len(m.Endpoint) > 0 { + i -= len(m.Endpoint) + copy(dAtA[i:], m.Endpoint) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Endpoint))) + i-- + dAtA[i] = 0x22 + } + if len(m.UniqueId) > 0 { + i -= len(m.UniqueId) + copy(dAtA[i:], m.UniqueId) + i = encodeVarintOracle(dAtA, i, uint64(len(m.UniqueId))) + i-- + dAtA[i] = 0x1a + } + if m.Status != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x10 + } + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintOracle(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *OracleRegistration) 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 *OracleRegistration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OracleRegistration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Nonce) > 0 { + i -= len(m.Nonce) + copy(dAtA[i:], m.Nonce) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Nonce))) + i-- + dAtA[i] = 0x4a + } + { + size := m.OracleCommissionRate.Size() + i -= size + if _, err := m.OracleCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + if len(m.Endpoint) > 0 { + i -= len(m.Endpoint) + copy(dAtA[i:], m.Endpoint) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Endpoint))) + i-- + dAtA[i] = 0x3a + } + if len(m.TrustedBlockHash) > 0 { + i -= len(m.TrustedBlockHash) + copy(dAtA[i:], m.TrustedBlockHash) + i = encodeVarintOracle(dAtA, i, uint64(len(m.TrustedBlockHash))) + i-- + dAtA[i] = 0x32 + } + if m.TrustedBlockHeight != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.TrustedBlockHeight)) + i-- + dAtA[i] = 0x28 + } + if len(m.NodePubKeyRemoteReport) > 0 { + i -= len(m.NodePubKeyRemoteReport) + copy(dAtA[i:], m.NodePubKeyRemoteReport) + i = encodeVarintOracle(dAtA, i, uint64(len(m.NodePubKeyRemoteReport))) + i-- + dAtA[i] = 0x22 + } + if len(m.NodePubKey) > 0 { + i -= len(m.NodePubKey) + copy(dAtA[i:], m.NodePubKey) + i = encodeVarintOracle(dAtA, i, uint64(len(m.NodePubKey))) + i-- + dAtA[i] = 0x1a + } + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintOracle(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.UniqueId) > 0 { + i -= len(m.UniqueId) + copy(dAtA[i:], m.UniqueId) + i = encodeVarintOracle(dAtA, i, uint64(len(m.UniqueId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintOracle(dAtA []byte, offset int, v uint64) int { + offset -= sovOracle(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Oracle) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.Status != 0 { + n += 1 + sovOracle(uint64(m.Status)) + } + l = len(m.UniqueId) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Endpoint) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = m.OracleCommissionRate.Size() + n += 1 + l + sovOracle(uint64(l)) + return n +} + +func (m *OracleRegistration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UniqueId) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.NodePubKey) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.NodePubKeyRemoteReport) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + if m.TrustedBlockHeight != 0 { + n += 1 + sovOracle(uint64(m.TrustedBlockHeight)) + } + l = len(m.TrustedBlockHash) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = len(m.Endpoint) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + l = m.OracleCommissionRate.Size() + n += 1 + l + sovOracle(uint64(l)) + l = len(m.Nonce) + if l > 0 { + n += 1 + l + sovOracle(uint64(l)) + } + return n +} + +func sovOracle(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozOracle(x uint64) (n int) { + return sovOracle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Oracle) 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 ErrIntOverflowOracle + } + 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: Oracle: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Oracle: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= OracleStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniqueId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UniqueId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleCommissionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OracleCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OracleRegistration) 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 ErrIntOverflowOracle + } + 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: OracleRegistration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OracleRegistration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniqueId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UniqueId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodePubKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodePubKey = append(m.NodePubKey[:0], dAtA[iNdEx:postIndex]...) + if m.NodePubKey == nil { + m.NodePubKey = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodePubKeyRemoteReport", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodePubKeyRemoteReport = append(m.NodePubKeyRemoteReport[:0], dAtA[iNdEx:postIndex]...) + if m.NodePubKeyRemoteReport == nil { + m.NodePubKeyRemoteReport = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustedBlockHeight", wireType) + } + m.TrustedBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TrustedBlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustedBlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TrustedBlockHash = append(m.TrustedBlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.TrustedBlockHash == nil { + m.TrustedBlockHash = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Endpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleCommissionRate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + 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 ErrInvalidLengthOracle + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OracleCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthOracle + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthOracle + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Nonce = append(m.Nonce[:0], dAtA[iNdEx:postIndex]...) + if m.Nonce == nil { + m.Nonce = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipOracle(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOracle + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthOracle + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOracle + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthOracle + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthOracle = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOracle = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOracle = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go new file mode 100644 index 00000000..93551d63 --- /dev/null +++ b/x/oracle/types/query.pb.go @@ -0,0 +1,2317 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/oracle/v2/query.proto + +package types + +import ( + context "context" + fmt "fmt" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryOraclesRequest is the request type for the Query/Oracles RPC method. +type QueryOraclesRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOraclesRequest) Reset() { *m = QueryOraclesRequest{} } +func (m *QueryOraclesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOraclesRequest) ProtoMessage() {} +func (*QueryOraclesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{0} +} +func (m *QueryOraclesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOraclesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOraclesRequest.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 *QueryOraclesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOraclesRequest.Merge(m, src) +} +func (m *QueryOraclesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOraclesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOraclesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOraclesRequest proto.InternalMessageInfo + +func (m *QueryOraclesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOracleResponse is the response type for the Query/Oracles RPC method. +type QueryOraclesResponse struct { + Oracles []*Oracle `protobuf:"bytes,1,rep,name=oracles,proto3" json:"oracles,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOraclesResponse) Reset() { *m = QueryOraclesResponse{} } +func (m *QueryOraclesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOraclesResponse) ProtoMessage() {} +func (*QueryOraclesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{1} +} +func (m *QueryOraclesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOraclesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOraclesResponse.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 *QueryOraclesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOraclesResponse.Merge(m, src) +} +func (m *QueryOraclesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOraclesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOraclesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOraclesResponse proto.InternalMessageInfo + +func (m *QueryOraclesResponse) GetOracles() []*Oracle { + if m != nil { + return m.Oracles + } + return nil +} + +func (m *QueryOraclesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOracleRequest is the request type for the Query/Oracle RPC method. +type QueryOracleRequest struct { + OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` +} + +func (m *QueryOracleRequest) Reset() { *m = QueryOracleRequest{} } +func (m *QueryOracleRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOracleRequest) ProtoMessage() {} +func (*QueryOracleRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{2} +} +func (m *QueryOracleRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOracleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOracleRequest.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 *QueryOracleRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOracleRequest.Merge(m, src) +} +func (m *QueryOracleRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOracleRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOracleRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOracleRequest proto.InternalMessageInfo + +func (m *QueryOracleRequest) GetOperatorAddress() string { + if m != nil { + return m.OperatorAddress + } + return "" +} + +// QueryOracleResponse is the response type for the Query/Oracle RPC method. +type QueryOracleResponse struct { + Oracle *Oracle `protobuf:"bytes,1,opt,name=oracle,proto3" json:"oracle,omitempty"` +} + +func (m *QueryOracleResponse) Reset() { *m = QueryOracleResponse{} } +func (m *QueryOracleResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOracleResponse) ProtoMessage() {} +func (*QueryOracleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{3} +} +func (m *QueryOracleResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOracleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOracleResponse.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 *QueryOracleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOracleResponse.Merge(m, src) +} +func (m *QueryOracleResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOracleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOracleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOracleResponse proto.InternalMessageInfo + +func (m *QueryOracleResponse) GetOracle() *Oracle { + if m != nil { + return m.Oracle + } + return nil +} + +// QueryOracleRegistrationsRequest is the request type for the Query/OracleRegistrations RPC method. +type QueryOracleRegistrationsRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOracleRegistrationsRequest) Reset() { *m = QueryOracleRegistrationsRequest{} } +func (m *QueryOracleRegistrationsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOracleRegistrationsRequest) ProtoMessage() {} +func (*QueryOracleRegistrationsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{4} +} +func (m *QueryOracleRegistrationsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOracleRegistrationsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOracleRegistrationsRequest.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 *QueryOracleRegistrationsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOracleRegistrationsRequest.Merge(m, src) +} +func (m *QueryOracleRegistrationsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOracleRegistrationsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOracleRegistrationsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOracleRegistrationsRequest proto.InternalMessageInfo + +func (m *QueryOracleRegistrationsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOracleRegistrationsResponse is the response type for the Query/OracleRegistrations RPC method. +type QueryOracleRegistrationsResponse struct { + OracleRegistrations []*OracleRegistration `protobuf:"bytes,1,rep,name=oracle_registrations,json=oracleRegistrations,proto3" json:"oracle_registrations,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOracleRegistrationsResponse) Reset() { *m = QueryOracleRegistrationsResponse{} } +func (m *QueryOracleRegistrationsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOracleRegistrationsResponse) ProtoMessage() {} +func (*QueryOracleRegistrationsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{5} +} +func (m *QueryOracleRegistrationsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOracleRegistrationsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOracleRegistrationsResponse.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 *QueryOracleRegistrationsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOracleRegistrationsResponse.Merge(m, src) +} +func (m *QueryOracleRegistrationsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOracleRegistrationsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOracleRegistrationsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOracleRegistrationsResponse proto.InternalMessageInfo + +func (m *QueryOracleRegistrationsResponse) GetOracleRegistrations() []*OracleRegistration { + if m != nil { + return m.OracleRegistrations + } + return nil +} + +func (m *QueryOracleRegistrationsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOracleRegistrationRequest is the request type for the Query/OracleRegistration RPC method. +type QueryOracleRegistrationRequest struct { + UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` + OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` +} + +func (m *QueryOracleRegistrationRequest) Reset() { *m = QueryOracleRegistrationRequest{} } +func (m *QueryOracleRegistrationRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOracleRegistrationRequest) ProtoMessage() {} +func (*QueryOracleRegistrationRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{6} +} +func (m *QueryOracleRegistrationRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOracleRegistrationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOracleRegistrationRequest.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 *QueryOracleRegistrationRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOracleRegistrationRequest.Merge(m, src) +} +func (m *QueryOracleRegistrationRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOracleRegistrationRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOracleRegistrationRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOracleRegistrationRequest proto.InternalMessageInfo + +func (m *QueryOracleRegistrationRequest) GetUniqueId() string { + if m != nil { + return m.UniqueId + } + return "" +} + +func (m *QueryOracleRegistrationRequest) GetOperatorAddress() string { + if m != nil { + return m.OperatorAddress + } + return "" +} + +// QueryOracleRegistrationResponse is the response type for the Query/OracleRegistration RPC method. +type QueryOracleRegistrationResponse struct { + OracleRegistration *OracleRegistration `protobuf:"bytes,1,opt,name=oracle_registration,json=oracleRegistration,proto3" json:"oracle_registration,omitempty"` +} + +func (m *QueryOracleRegistrationResponse) Reset() { *m = QueryOracleRegistrationResponse{} } +func (m *QueryOracleRegistrationResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOracleRegistrationResponse) ProtoMessage() {} +func (*QueryOracleRegistrationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{7} +} +func (m *QueryOracleRegistrationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOracleRegistrationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOracleRegistrationResponse.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 *QueryOracleRegistrationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOracleRegistrationResponse.Merge(m, src) +} +func (m *QueryOracleRegistrationResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOracleRegistrationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOracleRegistrationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOracleRegistrationResponse proto.InternalMessageInfo + +func (m *QueryOracleRegistrationResponse) GetOracleRegistration() *OracleRegistration { + if m != nil { + return m.OracleRegistration + } + return nil +} + +// QueryOracleParamsRequest is the request type for the Query/OracleParams RPC method. +type QueryOracleParamsRequest struct { +} + +func (m *QueryOracleParamsRequest) Reset() { *m = QueryOracleParamsRequest{} } +func (m *QueryOracleParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOracleParamsRequest) ProtoMessage() {} +func (*QueryOracleParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{8} +} +func (m *QueryOracleParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOracleParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOracleParamsRequest.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 *QueryOracleParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOracleParamsRequest.Merge(m, src) +} +func (m *QueryOracleParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOracleParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOracleParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOracleParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is the response type for the Query/OracleParams RPC method. +type QueryParamsResponse struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_79c168e4f9a93eac, []int{9} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + +func init() { + proto.RegisterType((*QueryOraclesRequest)(nil), "panacea.oracle.v2.QueryOraclesRequest") + proto.RegisterType((*QueryOraclesResponse)(nil), "panacea.oracle.v2.QueryOraclesResponse") + proto.RegisterType((*QueryOracleRequest)(nil), "panacea.oracle.v2.QueryOracleRequest") + proto.RegisterType((*QueryOracleResponse)(nil), "panacea.oracle.v2.QueryOracleResponse") + proto.RegisterType((*QueryOracleRegistrationsRequest)(nil), "panacea.oracle.v2.QueryOracleRegistrationsRequest") + proto.RegisterType((*QueryOracleRegistrationsResponse)(nil), "panacea.oracle.v2.QueryOracleRegistrationsResponse") + proto.RegisterType((*QueryOracleRegistrationRequest)(nil), "panacea.oracle.v2.QueryOracleRegistrationRequest") + proto.RegisterType((*QueryOracleRegistrationResponse)(nil), "panacea.oracle.v2.QueryOracleRegistrationResponse") + proto.RegisterType((*QueryOracleParamsRequest)(nil), "panacea.oracle.v2.QueryOracleParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "panacea.oracle.v2.QueryParamsResponse") +} + +func init() { proto.RegisterFile("panacea/oracle/v2/query.proto", fileDescriptor_79c168e4f9a93eac) } + +var fileDescriptor_79c168e4f9a93eac = []byte{ + // 677 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4d, 0x6b, 0xd4, 0x40, + 0x18, 0xc7, 0x3b, 0x15, 0xb7, 0x76, 0x7a, 0x50, 0x67, 0x7b, 0x68, 0xd3, 0x9a, 0xd6, 0x40, 0xdf, + 0x94, 0x66, 0xd8, 0x2c, 0x9e, 0x45, 0x0f, 0xb5, 0xbd, 0x68, 0xdd, 0x83, 0x88, 0x20, 0xcb, 0x24, + 0x3b, 0xa6, 0x81, 0x4d, 0x26, 0x9b, 0x49, 0x16, 0x97, 0x52, 0x11, 0x3f, 0x80, 0x08, 0x7a, 0xf3, + 0x43, 0xf8, 0x29, 0x04, 0xc1, 0x4b, 0xc1, 0x8b, 0x47, 0xd9, 0xf5, 0x83, 0xc8, 0xce, 0x4c, 0xb6, + 0x1b, 0x93, 0xec, 0x6e, 0xa1, 0xb7, 0x76, 0x9e, 0x97, 0xff, 0xef, 0x79, 0xcb, 0xc2, 0x3b, 0x21, + 0x09, 0x88, 0x43, 0x09, 0x66, 0x11, 0x71, 0xda, 0x14, 0x77, 0x2d, 0xdc, 0x49, 0x68, 0xd4, 0x33, + 0xc3, 0x88, 0xc5, 0x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0x6d, 0xfd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x50, 0xa4, 0x58, + 0xcb, 0x64, 0x08, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Oracles returns a list of oracles. + Oracles(ctx context.Context, in *QueryOraclesRequest, opts ...grpc.CallOption) (*QueryOraclesResponse, error) + // Oracle returns a oracle. + Oracle(ctx context.Context, in *QueryOracleRequest, opts ...grpc.CallOption) (*QueryOracleResponse, error) + // OracleRegistrations returns a list of OracleRegistration. + OracleRegistrations(ctx context.Context, in *QueryOracleRegistrationsRequest, opts ...grpc.CallOption) (*QueryOracleRegistrationsResponse, error) + // OracleRegistration returns a OracleRegistration details. + OracleRegistration(ctx context.Context, in *QueryOracleRegistrationRequest, opts ...grpc.CallOption) (*QueryOracleRegistrationResponse, error) + // Params returns params of oracle module. + Params(ctx context.Context, in *QueryOracleParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Oracles(ctx context.Context, in *QueryOraclesRequest, opts ...grpc.CallOption) (*QueryOraclesResponse, error) { + out := new(QueryOraclesResponse) + err := c.cc.Invoke(ctx, "/panacea.oracle.v2.Query/Oracles", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Oracle(ctx context.Context, in *QueryOracleRequest, opts ...grpc.CallOption) (*QueryOracleResponse, error) { + out := new(QueryOracleResponse) + err := c.cc.Invoke(ctx, "/panacea.oracle.v2.Query/Oracle", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) OracleRegistrations(ctx context.Context, in *QueryOracleRegistrationsRequest, opts ...grpc.CallOption) (*QueryOracleRegistrationsResponse, error) { + out := new(QueryOracleRegistrationsResponse) + err := c.cc.Invoke(ctx, "/panacea.oracle.v2.Query/OracleRegistrations", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) OracleRegistration(ctx context.Context, in *QueryOracleRegistrationRequest, opts ...grpc.CallOption) (*QueryOracleRegistrationResponse, error) { + out := new(QueryOracleRegistrationResponse) + err := c.cc.Invoke(ctx, "/panacea.oracle.v2.Query/OracleRegistration", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Params(ctx context.Context, in *QueryOracleParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/panacea.oracle.v2.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Oracles returns a list of oracles. + Oracles(context.Context, *QueryOraclesRequest) (*QueryOraclesResponse, error) + // Oracle returns a oracle. + Oracle(context.Context, *QueryOracleRequest) (*QueryOracleResponse, error) + // OracleRegistrations returns a list of OracleRegistration. + OracleRegistrations(context.Context, *QueryOracleRegistrationsRequest) (*QueryOracleRegistrationsResponse, error) + // OracleRegistration returns a OracleRegistration details. + OracleRegistration(context.Context, *QueryOracleRegistrationRequest) (*QueryOracleRegistrationResponse, error) + // Params returns params of oracle module. + Params(context.Context, *QueryOracleParamsRequest) (*QueryParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Oracles(ctx context.Context, req *QueryOraclesRequest) (*QueryOraclesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Oracles not implemented") +} +func (*UnimplementedQueryServer) Oracle(ctx context.Context, req *QueryOracleRequest) (*QueryOracleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Oracle not implemented") +} +func (*UnimplementedQueryServer) OracleRegistrations(ctx context.Context, req *QueryOracleRegistrationsRequest) (*QueryOracleRegistrationsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OracleRegistrations not implemented") +} +func (*UnimplementedQueryServer) OracleRegistration(ctx context.Context, req *QueryOracleRegistrationRequest) (*QueryOracleRegistrationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method OracleRegistration not implemented") +} +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryOracleParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Oracles_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOraclesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Oracles(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.oracle.v2.Query/Oracles", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Oracles(ctx, req.(*QueryOraclesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Oracle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOracleRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Oracle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.oracle.v2.Query/Oracle", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Oracle(ctx, req.(*QueryOracleRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_OracleRegistrations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOracleRegistrationsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).OracleRegistrations(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.oracle.v2.Query/OracleRegistrations", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OracleRegistrations(ctx, req.(*QueryOracleRegistrationsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_OracleRegistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOracleRegistrationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).OracleRegistration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.oracle.v2.Query/OracleRegistration", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).OracleRegistration(ctx, req.(*QueryOracleRegistrationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOracleParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.oracle.v2.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryOracleParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "panacea.oracle.v2.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Oracles", + Handler: _Query_Oracles_Handler, + }, + { + MethodName: "Oracle", + Handler: _Query_Oracle_Handler, + }, + { + MethodName: "OracleRegistrations", + Handler: _Query_OracleRegistrations_Handler, + }, + { + MethodName: "OracleRegistration", + Handler: _Query_OracleRegistration_Handler, + }, + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "panacea/oracle/v2/query.proto", +} + +func (m *QueryOraclesRequest) 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 *QueryOraclesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOraclesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOraclesResponse) 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 *QueryOraclesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOraclesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Oracles) > 0 { + for iNdEx := len(m.Oracles) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Oracles[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryOracleRequest) 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 *QueryOracleRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOracleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOracleResponse) 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 *QueryOracleResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOracleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Oracle != nil { + { + size, err := m.Oracle.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOracleRegistrationsRequest) 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 *QueryOracleRegistrationsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOracleRegistrationsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOracleRegistrationsResponse) 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 *QueryOracleRegistrationsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOracleRegistrationsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.OracleRegistrations) > 0 { + for iNdEx := len(m.OracleRegistrations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OracleRegistrations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryOracleRegistrationRequest) 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 *QueryOracleRegistrationRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOracleRegistrationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.UniqueId) > 0 { + i -= len(m.UniqueId) + copy(dAtA[i:], m.UniqueId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.UniqueId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOracleRegistrationResponse) 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 *QueryOracleRegistrationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOracleRegistrationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OracleRegistration != nil { + { + size, err := m.OracleRegistration.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryOracleParamsRequest) 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 *QueryOracleParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOracleParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryOraclesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOraclesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Oracles) > 0 { + for _, e := range m.Oracles { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOracleRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOracleResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Oracle != nil { + l = m.Oracle.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOracleRegistrationsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOracleRegistrationsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OracleRegistrations) > 0 { + for _, e := range m.OracleRegistrations { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOracleRegistrationRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UniqueId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOracleRegistrationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.OracleRegistration != nil { + l = m.OracleRegistration.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOracleParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryOraclesRequest) 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 ErrIntOverflowQuery + } + 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: QueryOraclesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOraclesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOraclesResponse) 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 ErrIntOverflowQuery + } + 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: QueryOraclesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOraclesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Oracles", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Oracles = append(m.Oracles, &Oracle{}) + if err := m.Oracles[len(m.Oracles)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOracleRequest) 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 ErrIntOverflowQuery + } + 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: QueryOracleRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOracleRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOracleResponse) 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 ErrIntOverflowQuery + } + 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: QueryOracleResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOracleResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Oracle", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Oracle == nil { + m.Oracle = &Oracle{} + } + if err := m.Oracle.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOracleRegistrationsRequest) 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 ErrIntOverflowQuery + } + 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: QueryOracleRegistrationsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOracleRegistrationsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOracleRegistrationsResponse) 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 ErrIntOverflowQuery + } + 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: QueryOracleRegistrationsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOracleRegistrationsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleRegistrations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OracleRegistrations = append(m.OracleRegistrations, &OracleRegistration{}) + if err := m.OracleRegistrations[len(m.OracleRegistrations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOracleRegistrationRequest) 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 ErrIntOverflowQuery + } + 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: QueryOracleRegistrationRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOracleRegistrationRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniqueId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UniqueId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOracleRegistrationResponse) 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 ErrIntOverflowQuery + } + 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: QueryOracleRegistrationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOracleRegistrationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleRegistration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OracleRegistration == nil { + m.OracleRegistration = &OracleRegistration{} + } + if err := m.OracleRegistration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOracleParamsRequest) 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 ErrIntOverflowQuery + } + 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: QueryOracleParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOracleParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) 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 ErrIntOverflowQuery + } + 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go new file mode 100644 index 00000000..64928aca --- /dev/null +++ b/x/oracle/types/query.pb.gw.go @@ -0,0 +1,526 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: panacea/oracle/v2/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage + +var ( + filter_Query_Oracles_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Oracles_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOraclesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Oracles_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Oracles(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Oracles_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOraclesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Oracles_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Oracles(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Oracle_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOracleRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_address") + } + + protoReq.OperatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_address", err) + } + + msg, err := client.Oracle(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Oracle_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOracleRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["operator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_address") + } + + protoReq.OperatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_address", err) + } + + msg, err := server.Oracle(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_OracleRegistrations_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_OracleRegistrations_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOracleRegistrationsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OracleRegistrations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.OracleRegistrations(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_OracleRegistrations_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOracleRegistrationsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_OracleRegistrations_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.OracleRegistrations(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_OracleRegistration_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOracleRegistrationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["unique_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "unique_id") + } + + protoReq.UniqueId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "unique_id", err) + } + + val, ok = pathParams["operator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_address") + } + + protoReq.OperatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_address", err) + } + + msg, err := client.OracleRegistration(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_OracleRegistration_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOracleRegistrationRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["unique_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "unique_id") + } + + protoReq.UniqueId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "unique_id", err) + } + + val, ok = pathParams["operator_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_address") + } + + protoReq.OperatorAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_address", err) + } + + msg, err := server.OracleRegistration(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOracleParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOracleParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Oracles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Oracles_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Oracles_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Oracle_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Oracle_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Oracle_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OracleRegistrations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_OracleRegistrations_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OracleRegistrations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OracleRegistration_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_OracleRegistration_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OracleRegistration_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Oracles_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Oracles_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Oracles_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Oracle_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Oracle_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Oracle_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OracleRegistrations_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_OracleRegistrations_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OracleRegistrations_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_OracleRegistration_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_OracleRegistration_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_OracleRegistration_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Oracles_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"panacea", "oracle", "v2", "oracles"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Oracle_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"panacea", "oracle", "v2", "oracles", "operator_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_OracleRegistrations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"panacea", "oracle", "v2", "oracle_registrations"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_OracleRegistration_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"panacea", "oracle", "v2", "oracle_registrations", "unique_id", "operator_address"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"panacea", "oracle", "v2", "params"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Oracles_0 = runtime.ForwardResponseMessage + + forward_Query_Oracle_0 = runtime.ForwardResponseMessage + + forward_Query_OracleRegistrations_0 = runtime.ForwardResponseMessage + + forward_Query_OracleRegistration_0 = runtime.ForwardResponseMessage + + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go new file mode 100644 index 00000000..12247c0b --- /dev/null +++ b/x/oracle/types/tx.pb.go @@ -0,0 +1,1998 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: panacea/oracle/v2/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + _ "google.golang.org/protobuf/types/known/timestamppb" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgRegisterOracle defines the Msg/RegisterOracle request type. +type MsgRegisterOracle struct { + UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` + OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + NodePubKey []byte `protobuf:"bytes,3,opt,name=node_pub_key,json=nodePubKey,proto3" json:"node_pub_key,omitempty"` + NodePubKeyRemoteReport []byte `protobuf:"bytes,4,opt,name=node_pub_key_remote_report,json=nodePubKeyRemoteReport,proto3" json:"node_pub_key_remote_report,omitempty"` + TrustedBlockHeight int64 `protobuf:"varint,5,opt,name=trusted_block_height,json=trustedBlockHeight,proto3" json:"trusted_block_height,omitempty"` + TrustedBlockHash []byte `protobuf:"bytes,6,opt,name=trusted_block_hash,json=trustedBlockHash,proto3" json:"trusted_block_hash,omitempty"` + Endpoint string `protobuf:"bytes,7,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + OracleCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=oracle_commission_rate,json=oracleCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_commission_rate"` +} + +func (m *MsgRegisterOracle) Reset() { *m = MsgRegisterOracle{} } +func (m *MsgRegisterOracle) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterOracle) ProtoMessage() {} +func (*MsgRegisterOracle) Descriptor() ([]byte, []int) { + return fileDescriptor_91b53ec53f5557f6, []int{0} +} +func (m *MsgRegisterOracle) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterOracle) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterOracle.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 *MsgRegisterOracle) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterOracle.Merge(m, src) +} +func (m *MsgRegisterOracle) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterOracle) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterOracle.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterOracle proto.InternalMessageInfo + +func (m *MsgRegisterOracle) GetUniqueId() string { + if m != nil { + return m.UniqueId + } + return "" +} + +func (m *MsgRegisterOracle) GetOperatorAddress() string { + if m != nil { + return m.OperatorAddress + } + return "" +} + +func (m *MsgRegisterOracle) GetNodePubKey() []byte { + if m != nil { + return m.NodePubKey + } + return nil +} + +func (m *MsgRegisterOracle) GetNodePubKeyRemoteReport() []byte { + if m != nil { + return m.NodePubKeyRemoteReport + } + return nil +} + +func (m *MsgRegisterOracle) GetTrustedBlockHeight() int64 { + if m != nil { + return m.TrustedBlockHeight + } + return 0 +} + +func (m *MsgRegisterOracle) GetTrustedBlockHash() []byte { + if m != nil { + return m.TrustedBlockHash + } + return nil +} + +func (m *MsgRegisterOracle) GetEndpoint() string { + if m != nil { + return m.Endpoint + } + return "" +} + +// MsgRegisterOracleResponse defines the Msg/RegisterOracle response type. +type MsgRegisterOracleResponse struct { +} + +func (m *MsgRegisterOracleResponse) Reset() { *m = MsgRegisterOracleResponse{} } +func (m *MsgRegisterOracleResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterOracleResponse) ProtoMessage() {} +func (*MsgRegisterOracleResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_91b53ec53f5557f6, []int{1} +} +func (m *MsgRegisterOracleResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterOracleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterOracleResponse.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 *MsgRegisterOracleResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterOracleResponse.Merge(m, src) +} +func (m *MsgRegisterOracleResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterOracleResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterOracleResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterOracleResponse proto.InternalMessageInfo + +// MsgApproveOracleRegistration defines the Msg/ApproveOracleRegistration +type MsgApproveOracleRegistration struct { + ApproveOracleRegistration *ApproveOracleRegistration `protobuf:"bytes,1,opt,name=approveOracleRegistration,proto3" json:"approveOracleRegistration,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` +} + +func (m *MsgApproveOracleRegistration) Reset() { *m = MsgApproveOracleRegistration{} } +func (m *MsgApproveOracleRegistration) String() string { return proto.CompactTextString(m) } +func (*MsgApproveOracleRegistration) ProtoMessage() {} +func (*MsgApproveOracleRegistration) Descriptor() ([]byte, []int) { + return fileDescriptor_91b53ec53f5557f6, []int{2} +} +func (m *MsgApproveOracleRegistration) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgApproveOracleRegistration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgApproveOracleRegistration.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 *MsgApproveOracleRegistration) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgApproveOracleRegistration.Merge(m, src) +} +func (m *MsgApproveOracleRegistration) XXX_Size() int { + return m.Size() +} +func (m *MsgApproveOracleRegistration) XXX_DiscardUnknown() { + xxx_messageInfo_MsgApproveOracleRegistration.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgApproveOracleRegistration proto.InternalMessageInfo + +func (m *MsgApproveOracleRegistration) GetApproveOracleRegistration() *ApproveOracleRegistration { + if m != nil { + return m.ApproveOracleRegistration + } + return nil +} + +func (m *MsgApproveOracleRegistration) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +// ApproveOracleRegistration defines for oracle registration approval +type ApproveOracleRegistration struct { + UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` + TargetOperatorAddress string `protobuf:"bytes,2,opt,name=target_operator_address,json=targetOperatorAddress,proto3" json:"target_operator_address,omitempty"` + EncryptedOraclePrivKey []byte `protobuf:"bytes,3,opt,name=encrypted_oracle_priv_key,json=encryptedOraclePrivKey,proto3" json:"encrypted_oracle_priv_key,omitempty"` +} + +func (m *ApproveOracleRegistration) Reset() { *m = ApproveOracleRegistration{} } +func (m *ApproveOracleRegistration) String() string { return proto.CompactTextString(m) } +func (*ApproveOracleRegistration) ProtoMessage() {} +func (*ApproveOracleRegistration) Descriptor() ([]byte, []int) { + return fileDescriptor_91b53ec53f5557f6, []int{3} +} +func (m *ApproveOracleRegistration) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ApproveOracleRegistration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ApproveOracleRegistration.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 *ApproveOracleRegistration) XXX_Merge(src proto.Message) { + xxx_messageInfo_ApproveOracleRegistration.Merge(m, src) +} +func (m *ApproveOracleRegistration) XXX_Size() int { + return m.Size() +} +func (m *ApproveOracleRegistration) XXX_DiscardUnknown() { + xxx_messageInfo_ApproveOracleRegistration.DiscardUnknown(m) +} + +var xxx_messageInfo_ApproveOracleRegistration proto.InternalMessageInfo + +func (m *ApproveOracleRegistration) GetUniqueId() string { + if m != nil { + return m.UniqueId + } + return "" +} + +func (m *ApproveOracleRegistration) GetTargetOperatorAddress() string { + if m != nil { + return m.TargetOperatorAddress + } + return "" +} + +func (m *ApproveOracleRegistration) GetEncryptedOraclePrivKey() []byte { + if m != nil { + return m.EncryptedOraclePrivKey + } + return nil +} + +// MsgApproveOracleRegistrationResponse defines the Msg/ApproveOracleRegistration +type MsgApproveOracleRegistrationResponse struct { +} + +func (m *MsgApproveOracleRegistrationResponse) Reset() { *m = MsgApproveOracleRegistrationResponse{} } +func (m *MsgApproveOracleRegistrationResponse) String() string { return proto.CompactTextString(m) } +func (*MsgApproveOracleRegistrationResponse) ProtoMessage() {} +func (*MsgApproveOracleRegistrationResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_91b53ec53f5557f6, []int{4} +} +func (m *MsgApproveOracleRegistrationResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgApproveOracleRegistrationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgApproveOracleRegistrationResponse.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 *MsgApproveOracleRegistrationResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgApproveOracleRegistrationResponse.Merge(m, src) +} +func (m *MsgApproveOracleRegistrationResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgApproveOracleRegistrationResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgApproveOracleRegistrationResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgApproveOracleRegistrationResponse proto.InternalMessageInfo + +// MsgUpdateOracleInfo defines the Msg/UpdateOracleInfo +type MsgUpdateOracleInfo struct { + OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + OracleCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=oracle_commission_rate,json=oracleCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_commission_rate"` +} + +func (m *MsgUpdateOracleInfo) Reset() { *m = MsgUpdateOracleInfo{} } +func (m *MsgUpdateOracleInfo) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateOracleInfo) ProtoMessage() {} +func (*MsgUpdateOracleInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_91b53ec53f5557f6, []int{5} +} +func (m *MsgUpdateOracleInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateOracleInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateOracleInfo.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 *MsgUpdateOracleInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateOracleInfo.Merge(m, src) +} +func (m *MsgUpdateOracleInfo) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateOracleInfo) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateOracleInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateOracleInfo proto.InternalMessageInfo + +func (m *MsgUpdateOracleInfo) GetOperatorAddress() string { + if m != nil { + return m.OperatorAddress + } + return "" +} + +func (m *MsgUpdateOracleInfo) GetEndpoint() string { + if m != nil { + return m.Endpoint + } + return "" +} + +// MsgUpdateOracleInfoResponse defines the Msg/UpdateOracleInfo +type MsgUpdateOracleInfoResponse struct { +} + +func (m *MsgUpdateOracleInfoResponse) Reset() { *m = MsgUpdateOracleInfoResponse{} } +func (m *MsgUpdateOracleInfoResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateOracleInfoResponse) ProtoMessage() {} +func (*MsgUpdateOracleInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_91b53ec53f5557f6, []int{6} +} +func (m *MsgUpdateOracleInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateOracleInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateOracleInfoResponse.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 *MsgUpdateOracleInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateOracleInfoResponse.Merge(m, src) +} +func (m *MsgUpdateOracleInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateOracleInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateOracleInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateOracleInfoResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgRegisterOracle)(nil), "panacea.oracle.v2.MsgRegisterOracle") + proto.RegisterType((*MsgRegisterOracleResponse)(nil), "panacea.oracle.v2.MsgRegisterOracleResponse") + proto.RegisterType((*MsgApproveOracleRegistration)(nil), "panacea.oracle.v2.MsgApproveOracleRegistration") + proto.RegisterType((*ApproveOracleRegistration)(nil), "panacea.oracle.v2.ApproveOracleRegistration") + proto.RegisterType((*MsgApproveOracleRegistrationResponse)(nil), "panacea.oracle.v2.MsgApproveOracleRegistrationResponse") + proto.RegisterType((*MsgUpdateOracleInfo)(nil), "panacea.oracle.v2.MsgUpdateOracleInfo") + proto.RegisterType((*MsgUpdateOracleInfoResponse)(nil), "panacea.oracle.v2.MsgUpdateOracleInfoResponse") +} + +func init() { proto.RegisterFile("panacea/oracle/v2/tx.proto", fileDescriptor_91b53ec53f5557f6) } + +var fileDescriptor_91b53ec53f5557f6 = []byte{ + // 716 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x4f, 0xdb, 0x48, + 0x1c, 0x8d, 0xc9, 0x2e, 0x0b, 0xb3, 0x68, 0x17, 0xbc, 0x2c, 0xeb, 0x18, 0x36, 0x44, 0x11, 0x42, + 0xb4, 0x02, 0x4f, 0x49, 0xa5, 0x56, 0xed, 0x0d, 0xda, 0x43, 0x11, 0x8a, 0x40, 0x96, 0x7a, 0xe9, + 0xc5, 0x1a, 0xdb, 0x3f, 0x9c, 0x01, 0x3c, 0x33, 0xcc, 0x8c, 0x23, 0xf2, 0x01, 0x7a, 0xef, 0xbd, + 0x5f, 0xa0, 0x52, 0xbf, 0x45, 0x4f, 0x1c, 0x39, 0x56, 0x3d, 0xd0, 0x0a, 0xbe, 0x48, 0x95, 0xb1, + 0x13, 0xd2, 0xfc, 0x41, 0x54, 0xea, 0x29, 0xf1, 0xef, 0xbd, 0x79, 0xf3, 0x9b, 0x79, 0x6f, 0x7e, + 0xc8, 0x15, 0x84, 0x91, 0x08, 0x08, 0xe6, 0x92, 0x44, 0xa7, 0x80, 0xdb, 0x0d, 0xac, 0xcf, 0x3d, + 0x21, 0xb9, 0xe6, 0xf6, 0x42, 0x81, 0x79, 0x39, 0xe6, 0xb5, 0x1b, 0xee, 0x62, 0xc2, 0x13, 0x6e, + 0x50, 0xdc, 0xfd, 0x97, 0x13, 0xdd, 0xd5, 0x84, 0xf3, 0xe4, 0x14, 0xb0, 0xf9, 0x0a, 0xb3, 0x23, + 0xac, 0x69, 0x0a, 0x4a, 0x93, 0x54, 0x14, 0x84, 0x87, 0x11, 0x57, 0x29, 0x57, 0x38, 0x24, 0x0a, + 0xf0, 0x59, 0x06, 0xb2, 0x83, 0xdb, 0xdb, 0x21, 0x68, 0xb2, 0x8d, 0x05, 0x49, 0x28, 0x23, 0x9a, + 0x72, 0x56, 0x70, 0x57, 0x0a, 0x31, 0x22, 0x28, 0x26, 0x8c, 0x71, 0x6d, 0x40, 0x55, 0xa0, 0xd5, + 0xd1, 0x7e, 0x8b, 0xee, 0x8a, 0x56, 0x46, 0xf1, 0x04, 0x18, 0x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ba, 0xe0, 0xed, 0xb1, 0x23, 0x3e, 0xf6, 0x81, 0x58, 0xe3, 0x1f, + 0xc8, 0x60, 0xc4, 0xa6, 0xee, 0x1d, 0xb1, 0xf2, 0x2f, 0x8c, 0xd8, 0xff, 0x68, 0x79, 0xcc, 0x19, + 0x7a, 0x67, 0x6c, 0x7c, 0x9d, 0x42, 0xe5, 0xa6, 0x4a, 0xec, 0x18, 0xfd, 0x35, 0x34, 0x23, 0xd6, + 0xc6, 0x44, 0x67, 0x24, 0xac, 0xee, 0xe6, 0x7d, 0x58, 0xbd, 0xdd, 0xec, 0xb7, 0x77, 0xe6, 0x04, + 0x8f, 0xd7, 0x9a, 0xb8, 0xc0, 0x7d, 0xfa, 0x93, 0x0b, 0xfa, 0x7d, 0x1c, 0xa3, 0xf9, 0x11, 0x57, + 0xd7, 0xc7, 0x8b, 0x0d, 0xf3, 0x5c, 0xef, 0x7e, 0xbc, 0xde, 0x5e, 0xbb, 0x7b, 0x17, 0xd7, 0x55, + 0xeb, 0xf2, 0xba, 0x6a, 0x7d, 0xbb, 0xae, 0x5a, 0xef, 0x6e, 0xaa, 0xa5, 0xcb, 0x9b, 0x6a, 0xe9, + 0xf3, 0x4d, 0xb5, 0xf4, 0x06, 0x0f, 0x18, 0x9b, 0x42, 0x4c, 0xbb, 0x23, 0x0b, 0x17, 0xe2, 0x5b, + 0x11, 0x97, 0x80, 0xcf, 0x7b, 0x73, 0xdd, 0xb8, 0x1c, 0x4e, 0x9b, 0x99, 0xfe, 0xf8, 0x7b, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x3f, 0x82, 0x9a, 0x69, 0xc6, 0x06, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // RegisterOracle defines a method for registration of oracle. + RegisterOracle(ctx context.Context, in *MsgRegisterOracle, opts ...grpc.CallOption) (*MsgRegisterOracleResponse, error) + // ApproveOracleRegistration defines a method to approve oracle registration + ApproveOracleRegistration(ctx context.Context, in *MsgApproveOracleRegistration, opts ...grpc.CallOption) (*MsgApproveOracleRegistrationResponse, error) + // UpgradeOracle defines a method for upgrade of oracle. + UpdateOracleInfo(ctx context.Context, in *MsgUpdateOracleInfo, opts ...grpc.CallOption) (*MsgUpdateOracleInfoResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) RegisterOracle(ctx context.Context, in *MsgRegisterOracle, opts ...grpc.CallOption) (*MsgRegisterOracleResponse, error) { + out := new(MsgRegisterOracleResponse) + err := c.cc.Invoke(ctx, "/panacea.oracle.v2.Msg/RegisterOracle", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ApproveOracleRegistration(ctx context.Context, in *MsgApproveOracleRegistration, opts ...grpc.CallOption) (*MsgApproveOracleRegistrationResponse, error) { + out := new(MsgApproveOracleRegistrationResponse) + err := c.cc.Invoke(ctx, "/panacea.oracle.v2.Msg/ApproveOracleRegistration", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateOracleInfo(ctx context.Context, in *MsgUpdateOracleInfo, opts ...grpc.CallOption) (*MsgUpdateOracleInfoResponse, error) { + out := new(MsgUpdateOracleInfoResponse) + err := c.cc.Invoke(ctx, "/panacea.oracle.v2.Msg/UpdateOracleInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // RegisterOracle defines a method for registration of oracle. + RegisterOracle(context.Context, *MsgRegisterOracle) (*MsgRegisterOracleResponse, error) + // ApproveOracleRegistration defines a method to approve oracle registration + ApproveOracleRegistration(context.Context, *MsgApproveOracleRegistration) (*MsgApproveOracleRegistrationResponse, error) + // UpgradeOracle defines a method for upgrade of oracle. + UpdateOracleInfo(context.Context, *MsgUpdateOracleInfo) (*MsgUpdateOracleInfoResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) RegisterOracle(ctx context.Context, req *MsgRegisterOracle) (*MsgRegisterOracleResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterOracle not implemented") +} +func (*UnimplementedMsgServer) ApproveOracleRegistration(ctx context.Context, req *MsgApproveOracleRegistration) (*MsgApproveOracleRegistrationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApproveOracleRegistration not implemented") +} +func (*UnimplementedMsgServer) UpdateOracleInfo(ctx context.Context, req *MsgUpdateOracleInfo) (*MsgUpdateOracleInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateOracleInfo not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_RegisterOracle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterOracle) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterOracle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.oracle.v2.Msg/RegisterOracle", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterOracle(ctx, req.(*MsgRegisterOracle)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ApproveOracleRegistration_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgApproveOracleRegistration) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ApproveOracleRegistration(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.oracle.v2.Msg/ApproveOracleRegistration", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ApproveOracleRegistration(ctx, req.(*MsgApproveOracleRegistration)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateOracleInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateOracleInfo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateOracleInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/panacea.oracle.v2.Msg/UpdateOracleInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateOracleInfo(ctx, req.(*MsgUpdateOracleInfo)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "panacea.oracle.v2.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterOracle", + Handler: _Msg_RegisterOracle_Handler, + }, + { + MethodName: "ApproveOracleRegistration", + Handler: _Msg_ApproveOracleRegistration_Handler, + }, + { + MethodName: "UpdateOracleInfo", + Handler: _Msg_UpdateOracleInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "panacea/oracle/v2/tx.proto", +} + +func (m *MsgRegisterOracle) 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 *MsgRegisterOracle) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterOracle) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.OracleCommissionRate.Size() + i -= size + if _, err := m.OracleCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + if len(m.Endpoint) > 0 { + i -= len(m.Endpoint) + copy(dAtA[i:], m.Endpoint) + i = encodeVarintTx(dAtA, i, uint64(len(m.Endpoint))) + i-- + dAtA[i] = 0x3a + } + if len(m.TrustedBlockHash) > 0 { + i -= len(m.TrustedBlockHash) + copy(dAtA[i:], m.TrustedBlockHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.TrustedBlockHash))) + i-- + dAtA[i] = 0x32 + } + if m.TrustedBlockHeight != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TrustedBlockHeight)) + i-- + dAtA[i] = 0x28 + } + if len(m.NodePubKeyRemoteReport) > 0 { + i -= len(m.NodePubKeyRemoteReport) + copy(dAtA[i:], m.NodePubKeyRemoteReport) + i = encodeVarintTx(dAtA, i, uint64(len(m.NodePubKeyRemoteReport))) + i-- + dAtA[i] = 0x22 + } + if len(m.NodePubKey) > 0 { + i -= len(m.NodePubKey) + copy(dAtA[i:], m.NodePubKey) + i = encodeVarintTx(dAtA, i, uint64(len(m.NodePubKey))) + i-- + dAtA[i] = 0x1a + } + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.UniqueId) > 0 { + i -= len(m.UniqueId) + copy(dAtA[i:], m.UniqueId) + i = encodeVarintTx(dAtA, i, uint64(len(m.UniqueId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterOracleResponse) 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 *MsgRegisterOracleResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterOracleResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgApproveOracleRegistration) 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 *MsgApproveOracleRegistration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgApproveOracleRegistration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.ApproveOracleRegistration != nil { + { + size, err := m.ApproveOracleRegistration.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ApproveOracleRegistration) 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 *ApproveOracleRegistration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ApproveOracleRegistration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.EncryptedOraclePrivKey) > 0 { + i -= len(m.EncryptedOraclePrivKey) + copy(dAtA[i:], m.EncryptedOraclePrivKey) + i = encodeVarintTx(dAtA, i, uint64(len(m.EncryptedOraclePrivKey))) + i-- + dAtA[i] = 0x1a + } + if len(m.TargetOperatorAddress) > 0 { + i -= len(m.TargetOperatorAddress) + copy(dAtA[i:], m.TargetOperatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.TargetOperatorAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.UniqueId) > 0 { + i -= len(m.UniqueId) + copy(dAtA[i:], m.UniqueId) + i = encodeVarintTx(dAtA, i, uint64(len(m.UniqueId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgApproveOracleRegistrationResponse) 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 *MsgApproveOracleRegistrationResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgApproveOracleRegistrationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateOracleInfo) 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 *MsgUpdateOracleInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateOracleInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.OracleCommissionRate.Size() + i -= size + if _, err := m.OracleCommissionRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Endpoint) > 0 { + i -= len(m.Endpoint) + copy(dAtA[i:], m.Endpoint) + i = encodeVarintTx(dAtA, i, uint64(len(m.Endpoint))) + i-- + dAtA[i] = 0x12 + } + if len(m.OperatorAddress) > 0 { + i -= len(m.OperatorAddress) + copy(dAtA[i:], m.OperatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateOracleInfoResponse) 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 *MsgUpdateOracleInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateOracleInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgRegisterOracle) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UniqueId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NodePubKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NodePubKeyRemoteReport) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TrustedBlockHeight != 0 { + n += 1 + sovTx(uint64(m.TrustedBlockHeight)) + } + l = len(m.TrustedBlockHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Endpoint) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.OracleCommissionRate.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgRegisterOracleResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgApproveOracleRegistration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ApproveOracleRegistration != nil { + l = m.ApproveOracleRegistration.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *ApproveOracleRegistration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UniqueId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TargetOperatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.EncryptedOraclePrivKey) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgApproveOracleRegistrationResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateOracleInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OperatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Endpoint) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.OracleCommissionRate.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateOracleInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgRegisterOracle) 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: MsgRegisterOracle: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterOracle: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniqueId", 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.UniqueId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", 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.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodePubKey", 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.NodePubKey = append(m.NodePubKey[:0], dAtA[iNdEx:postIndex]...) + if m.NodePubKey == nil { + m.NodePubKey = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodePubKeyRemoteReport", 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.NodePubKeyRemoteReport = append(m.NodePubKeyRemoteReport[:0], dAtA[iNdEx:postIndex]...) + if m.NodePubKeyRemoteReport == nil { + m.NodePubKeyRemoteReport = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustedBlockHeight", wireType) + } + m.TrustedBlockHeight = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TrustedBlockHeight |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TrustedBlockHash", 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.TrustedBlockHash = append(m.TrustedBlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.TrustedBlockHash == nil { + m.TrustedBlockHash = []byte{} + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", 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.Endpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleCommissionRate", 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 + } + if err := m.OracleCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *MsgRegisterOracleResponse) 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: MsgRegisterOracleResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterOracleResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *MsgApproveOracleRegistration) 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: MsgApproveOracleRegistration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgApproveOracleRegistration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApproveOracleRegistration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ApproveOracleRegistration == nil { + m.ApproveOracleRegistration = &ApproveOracleRegistration{} + } + if err := m.ApproveOracleRegistration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", 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.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []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 *ApproveOracleRegistration) 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: ApproveOracleRegistration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ApproveOracleRegistration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UniqueId", 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.UniqueId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TargetOperatorAddress", 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.TargetOperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EncryptedOraclePrivKey", 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.EncryptedOraclePrivKey = append(m.EncryptedOraclePrivKey[:0], dAtA[iNdEx:postIndex]...) + if m.EncryptedOraclePrivKey == nil { + m.EncryptedOraclePrivKey = []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 *MsgApproveOracleRegistrationResponse) 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: MsgApproveOracleRegistrationResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgApproveOracleRegistrationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *MsgUpdateOracleInfo) 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: MsgUpdateOracleInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateOracleInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", 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.OperatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", 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.Endpoint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OracleCommissionRate", 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 + } + if err := m.OracleCommissionRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *MsgUpdateOracleInfoResponse) 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: MsgUpdateOracleInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateOracleInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From 4a8176f4a607d43c29db33e0af29ca94e1f0f5c5 Mon Sep 17 00:00:00 2001 From: gyuguen Date: Fri, 2 Dec 2022 10:53:51 +0900 Subject: [PATCH 02/21] fix --- proto/panacea/datadeal/v2/tx.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/panacea/datadeal/v2/tx.proto b/proto/panacea/datadeal/v2/tx.proto index 09e6565c..86a56302 100644 --- a/proto/panacea/datadeal/v2/tx.proto +++ b/proto/panacea/datadeal/v2/tx.proto @@ -16,7 +16,7 @@ service Msg { // DeactivateDeal defines a method for deactivating the deal. rpc DeactivateDeal(MsgDeactivateDeal) returns (MsgDeactivateDealResponse); - // SubmitConsent + // SubmitConsent defines a method for provider's submit consent rpc SubmitConsent(MsgSubmitConsent) returns (MsgSubmitConsentResponse); } From af166433a07f22a9a2093bb0539db08096b276db Mon Sep 17 00:00:00 2001 From: gyuguen Date: Fri, 2 Dec 2022 11:03:04 +0900 Subject: [PATCH 03/21] fix --- proto/panacea/datadeal/v2/query.proto | 4 +- proto/panacea/oracle/v2/genesis.proto | 2 +- proto/panacea/oracle/v2/query.proto | 1 + proto/panacea/oracle/v2/tx.proto | 2 +- x/datadeal/types/query.pb.go | 2 + x/datadeal/types/tx.pb.go | 4 +- x/oracle/types/genesis.pb.go | 48 +++++++------- x/oracle/types/tx.pb.go | 94 +++++++++++++-------------- 8 files changed, 80 insertions(+), 77 deletions(-) diff --git a/proto/panacea/datadeal/v2/query.proto b/proto/panacea/datadeal/v2/query.proto index 3b0d403b..afe3b725 100644 --- a/proto/panacea/datadeal/v2/query.proto +++ b/proto/panacea/datadeal/v2/query.proto @@ -67,13 +67,13 @@ message QueryCertificatesResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } - +// QueryCertificate defines the request type for the Query/Certificate RPC method. message QueryCertificate { uint64 deal_id = 1; string data_hash = 2; } - +// QueryCertificateResponse defines the response type for the Query/Certificate RPC method. message QueryCertificateResponse { Certificate certificate = 1; } diff --git a/proto/panacea/oracle/v2/genesis.proto b/proto/panacea/oracle/v2/genesis.proto index efa066e8..25f5b2b3 100644 --- a/proto/panacea/oracle/v2/genesis.proto +++ b/proto/panacea/oracle/v2/genesis.proto @@ -10,7 +10,7 @@ import "panacea/oracle/v2/oracle.proto"; // GenesisState defines the oracle module's genesis state. message GenesisState { repeated Oracle oracles = 1 [(gogoproto.nullable) = false]; - repeated OracleRegistration oracleRegistrations = 2 [(gogoproto.nullable) = false]; + repeated OracleRegistration oracle_registrations = 2 [(gogoproto.nullable) = false]; } // Params defines the oracle module's params. diff --git a/proto/panacea/oracle/v2/query.proto b/proto/panacea/oracle/v2/query.proto index 656330b5..09932f5e 100644 --- a/proto/panacea/oracle/v2/query.proto +++ b/proto/panacea/oracle/v2/query.proto @@ -10,6 +10,7 @@ import "google/api/annotations.proto"; import "panacea/oracle/v2/oracle.proto"; import "panacea/oracle/v2/genesis.proto"; +// Query defines the gRPC querier service. service Query { // Oracles returns a list of oracles. rpc Oracles(QueryOraclesRequest) returns (QueryOraclesResponse) { diff --git a/proto/panacea/oracle/v2/tx.proto b/proto/panacea/oracle/v2/tx.proto index d35bebcc..fb972689 100644 --- a/proto/panacea/oracle/v2/tx.proto +++ b/proto/panacea/oracle/v2/tx.proto @@ -40,7 +40,7 @@ message MsgRegisterOracleResponse { // MsgApproveOracleRegistration defines the Msg/ApproveOracleRegistration message MsgApproveOracleRegistration { - ApproveOracleRegistration approveOracleRegistration = 1; + ApproveOracleRegistration approve_oracle_registration = 1; bytes signature = 2; } diff --git a/x/datadeal/types/query.pb.go b/x/datadeal/types/query.pb.go index 87e75455..81188fc4 100644 --- a/x/datadeal/types/query.pb.go +++ b/x/datadeal/types/query.pb.go @@ -324,6 +324,7 @@ func (m *QueryCertificatesResponse) GetPagination() *query.PageResponse { return nil } +// QueryCertificate defines the request type for the Query/Certificate RPC method. type QueryCertificate struct { DealId uint64 `protobuf:"varint,1,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` DataHash string `protobuf:"bytes,2,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` @@ -376,6 +377,7 @@ func (m *QueryCertificate) GetDataHash() string { return "" } +// QueryCertificateResponse defines the response type for the Query/Certificate RPC method. type QueryCertificateResponse struct { Certificate *Certificate `protobuf:"bytes,1,opt,name=certificate,proto3" json:"certificate,omitempty"` } diff --git a/x/datadeal/types/tx.pb.go b/x/datadeal/types/tx.pb.go index 33baf2ad..05fed3ab 100644 --- a/x/datadeal/types/tx.pb.go +++ b/x/datadeal/types/tx.pb.go @@ -396,7 +396,7 @@ type MsgClient interface { CreateDeal(ctx context.Context, in *MsgCreateDeal, opts ...grpc.CallOption) (*MsgCreateDealResponse, error) // DeactivateDeal defines a method for deactivating the deal. DeactivateDeal(ctx context.Context, in *MsgDeactivateDeal, opts ...grpc.CallOption) (*MsgDeactivateDealResponse, error) - // SubmitConsent + // SubmitConsent defines a method for provider's submit consent SubmitConsent(ctx context.Context, in *MsgSubmitConsent, opts ...grpc.CallOption) (*MsgSubmitConsentResponse, error) } @@ -441,7 +441,7 @@ type MsgServer interface { CreateDeal(context.Context, *MsgCreateDeal) (*MsgCreateDealResponse, error) // DeactivateDeal defines a method for deactivating the deal. DeactivateDeal(context.Context, *MsgDeactivateDeal) (*MsgDeactivateDealResponse, error) - // SubmitConsent + // SubmitConsent defines a method for provider's submit consent SubmitConsent(context.Context, *MsgSubmitConsent) (*MsgSubmitConsentResponse, error) } diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index 4f0afa5d..8956d4de 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -27,7 +27,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the oracle module's genesis state. type GenesisState struct { Oracles []Oracle `protobuf:"bytes,1,rep,name=oracles,proto3" json:"oracles"` - OracleRegistrations []OracleRegistration `protobuf:"bytes,2,rep,name=oracleRegistrations,proto3" json:"oracleRegistrations"` + OracleRegistrations []OracleRegistration `protobuf:"bytes,2,rep,name=oracle_registrations,json=oracleRegistrations,proto3" json:"oracle_registrations"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -151,30 +151,30 @@ func init() { func init() { proto.RegisterFile("panacea/oracle/v2/genesis.proto", fileDescriptor_321e5b447e46614a) } var fileDescriptor_321e5b447e46614a = []byte{ - // 355 bytes of a gzipped FileDescriptorProto + // 357 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x4a, 0xeb, 0x40, - 0x14, 0x86, 0x33, 0xed, 0xa5, 0xf7, 0x76, 0xee, 0x85, 0x4b, 0xa3, 0x8b, 0x58, 0x25, 0x2d, 0x05, - 0xa1, 0x08, 0x66, 0xa0, 0xae, 0xdc, 0xb8, 0xe8, 0x46, 0x4a, 0x17, 0x96, 0xb8, 0x13, 0x24, 0x4c, - 0xd2, 0x63, 0x1c, 0x4c, 0x32, 0x71, 0x66, 0x52, 0xcc, 0x5b, 0xe8, 0x5b, 0xf8, 0x28, 0x5d, 0x76, - 0xe9, 0x4a, 0xa4, 0x7d, 0x11, 0xe9, 0x4c, 0xaa, 0x42, 0x75, 0xf7, 0xcf, 0xf9, 0xbf, 0xf3, 0x9f, - 0xe1, 0x1c, 0xdc, 0xc9, 0x69, 0x46, 0x23, 0xa0, 0x84, 0x0b, 0x1a, 0x25, 0x40, 0x66, 0x03, 0x12, - 0x43, 0x06, 0x92, 0x49, 0x2f, 0x17, 0x5c, 0x71, 0xbb, 0x55, 0x01, 0x9e, 0x01, 0xbc, 0xd9, 0xa0, - 0xbd, 0x1b, 0xf3, 0x98, 0x6b, 0x97, 0xac, 0x95, 0x01, 0xdb, 0x9d, 0x98, 0xf3, 0x38, 0x01, 0xa2, - 0x5f, 0x61, 0x71, 0x43, 0x14, 0x4b, 0x41, 0x2a, 0x9a, 0xe6, 0x15, 0xe0, 0x6e, 0x8f, 0xaa, 0x32, - 0xb5, 0xdf, 0x7b, 0x46, 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, 0x61, 0x73, 0x13, 0x55, 0xe6, 0x20, - 0xc3, 0x86, 0x3e, 0xc8, 0xc9, 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x75, 0xdb, 0xd3, 0x1d, - 0x02, 0x00, 0x00, + 0x14, 0x86, 0x33, 0xed, 0xa5, 0xf7, 0x76, 0xee, 0x85, 0x4b, 0x63, 0x17, 0xb1, 0x4a, 0x5a, 0x0a, + 0x42, 0x11, 0xcc, 0x40, 0x5d, 0xb9, 0x71, 0xd1, 0x8d, 0x94, 0x2e, 0x2c, 0x71, 0xe7, 0xc2, 0x30, + 0x49, 0x8f, 0x71, 0x30, 0xc9, 0xc4, 0x99, 0x49, 0x31, 0x6f, 0xa1, 0x8f, 0xe1, 0x9b, 0x74, 0xd9, + 0xa5, 0x2b, 0x91, 0xf6, 0x45, 0xa4, 0x33, 0xa9, 0x0a, 0xc5, 0xdd, 0x99, 0xf3, 0x7f, 0xe7, 0xff, + 0x0f, 0x73, 0x70, 0x37, 0xa7, 0x19, 0x8d, 0x80, 0x12, 0x2e, 0x68, 0x94, 0x00, 0x99, 0x0f, 0x49, + 0x0c, 0x19, 0x48, 0x26, 0xbd, 0x5c, 0x70, 0xc5, 0xed, 0x56, 0x05, 0x78, 0x06, 0xf0, 0xe6, 0xc3, + 0x4e, 0x3b, 0xe6, 0x31, 0xd7, 0x2a, 0xd9, 0x54, 0x06, 0xec, 0x74, 0x63, 0xce, 0xe3, 0x04, 0x88, + 0x7e, 0x85, 0xc5, 0x2d, 0x51, 0x2c, 0x05, 0xa9, 0x68, 0x9a, 0x57, 0x80, 0xbb, 0x1b, 0x55, 0x79, + 0x6a, 0xbd, 0xff, 0x82, 0xf0, 0xbf, 0x0b, 0x93, 0x7d, 0xa5, 0xa8, 0x02, 0xfb, 0x0c, 0xff, 0x36, + 0x80, 0x74, 0x50, 0xaf, 0x3e, 0xf8, 0x3b, 0xdc, 0xf7, 0x76, 0x96, 0xf1, 0x2e, 0x75, 0x35,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*GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 12247c0b..2363c40e 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -165,7 +165,7 @@ var xxx_messageInfo_MsgRegisterOracleResponse proto.InternalMessageInfo // MsgApproveOracleRegistration defines the Msg/ApproveOracleRegistration type MsgApproveOracleRegistration struct { - ApproveOracleRegistration *ApproveOracleRegistration `protobuf:"bytes,1,opt,name=approveOracleRegistration,proto3" json:"approveOracleRegistration,omitempty"` + ApproveOracleRegistration *ApproveOracleRegistration `protobuf:"bytes,1,opt,name=approve_oracle_registration,json=approveOracleRegistration,proto3" json:"approve_oracle_registration,omitempty"` Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } @@ -418,52 +418,52 @@ func init() { func init() { proto.RegisterFile("panacea/oracle/v2/tx.proto", fileDescriptor_91b53ec53f5557f6) } var fileDescriptor_91b53ec53f5557f6 = []byte{ - // 716 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4f, 0x4f, 0xdb, 0x48, - 0x1c, 0x8d, 0xc9, 0x2e, 0x0b, 0xb3, 0x68, 0x17, 0xbc, 0x2c, 0xeb, 0x18, 0x36, 0x44, 0x11, 0x42, - 0xb4, 0x02, 0x4f, 0x49, 0xa5, 0x56, 0xed, 0x0d, 0xda, 0x43, 0x11, 0x8a, 0x40, 0x96, 0x7a, 0xe9, - 0xc5, 0x1a, 0xdb, 0x3f, 0x9c, 0x01, 0x3c, 0x33, 0xcc, 0x8c, 0x23, 0xf2, 0x01, 0x7a, 0xef, 0xbd, - 0x5f, 0xa0, 0x52, 0xbf, 0x45, 0x4f, 0x1c, 0x39, 0x56, 0x3d, 0xd0, 0x0a, 0xbe, 0x48, 0x95, 0xb1, - 0x13, 0xd2, 0xfc, 0x41, 0x54, 0xea, 0x29, 0xf1, 0xef, 0xbd, 0x79, 0xf3, 0x9b, 0x79, 0x6f, 0x7e, - 0xc8, 0x15, 0x84, 0x91, 0x08, 0x08, 0xe6, 0x92, 0x44, 0xa7, 0x80, 0xdb, 0x0d, 0xac, 0xcf, 0x3d, - 0x21, 0xb9, 0xe6, 0xf6, 0x42, 0x81, 0x79, 0x39, 0xe6, 0xb5, 0x1b, 0xee, 0x62, 0xc2, 0x13, 0x6e, - 0x50, 0xdc, 0xfd, 0x97, 0x13, 0xdd, 0xd5, 0x84, 0xf3, 0xe4, 0x14, 0xb0, 0xf9, 0x0a, 0xb3, 0x23, - 0xac, 0x69, 0x0a, 0x4a, 0x93, 0x54, 0x14, 0x84, 0x87, 0x11, 0x57, 0x29, 0x57, 0x38, 0x24, 0x0a, - 0xf0, 0x59, 0x06, 0xb2, 0x83, 0xdb, 0xdb, 0x21, 0x68, 0xb2, 0x8d, 0x05, 0x49, 0x28, 0x23, 0x9a, - 0x72, 0x56, 0x70, 0x57, 0x0a, 0x31, 0x22, 0x28, 0x26, 0x8c, 0x71, 0x6d, 0x40, 0x55, 0xa0, 0xd5, - 0xd1, 0x7e, 0x8b, 0xee, 0x8a, 0x56, 0x46, 0xf1, 0x04, 0x18, 0x28, 0x5a, 0x08, 0xd4, 0xdf, 0x97, - 0xd1, 0x42, 0x53, 0x25, 0x3e, 0x24, 0x54, 0x69, 0x90, 0x07, 0x86, 0x66, 0x2f, 0xa3, 0xd9, 0x8c, - 0xd1, 0xb3, 0x0c, 0x02, 0x1a, 0x3b, 0x56, 0xcd, 0xda, 0x98, 0xf5, 0x67, 0xf2, 0xc2, 0x5e, 0x6c, - 0x3f, 0x40, 0xf3, 0x5c, 0x80, 0x24, 0x9a, 0xcb, 0x80, 0xc4, 0xb1, 0x04, 0xa5, 0x9c, 0x29, 0xc3, - 0xf9, 0xbb, 0x57, 0xdf, 0xc9, 0xcb, 0x76, 0x0d, 0xcd, 0x31, 0x1e, 0x43, 0x20, 0xb2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b, 0xfa, 0x7d, 0x1c, 0xa3, 0xf9, 0x11, 0x57, - 0xd7, 0xc7, 0x8b, 0x0d, 0xf3, 0x5c, 0xef, 0x7e, 0xbc, 0xde, 0x5e, 0xbb, 0x7b, 0x17, 0xd7, 0x55, - 0xeb, 0xf2, 0xba, 0x6a, 0x7d, 0xbb, 0xae, 0x5a, 0xef, 0x6e, 0xaa, 0xa5, 0xcb, 0x9b, 0x6a, 0xe9, - 0xf3, 0x4d, 0xb5, 0xf4, 0x06, 0x0f, 0x18, 0x9b, 0x42, 0x4c, 0xbb, 0x23, 0x0b, 0x17, 0xe2, 0x5b, - 0x11, 0x97, 0x80, 0xcf, 0x7b, 0x73, 0xdd, 0xb8, 0x1c, 0x4e, 0x9b, 0x99, 0xfe, 0xf8, 0x7b, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x3f, 0x82, 0x9a, 0x69, 0xc6, 0x06, 0x00, 0x00, + // 718 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x4f, 0x13, 0x41, + 0x18, 0xc6, 0xbb, 0x54, 0x11, 0x46, 0xa2, 0xb0, 0x22, 0x6e, 0xb7, 0x58, 0x9a, 0x86, 0x10, 0x34, + 0xb0, 0x23, 0x35, 0xd1, 0xe8, 0x0d, 0xf4, 0x20, 0x21, 0x0d, 0x64, 0x13, 0x2f, 0x5e, 0x36, 0xb3, + 0xbb, 0x2f, 0xdb, 0x91, 0xee, 0xce, 0x30, 0x33, 0xdb, 0xd0, 0x0f, 0xe0, 0xdd, 0xbb, 0xdf, 0x40, + 0xbf, 0x85, 0x27, 0x8e, 0x1c, 0x8d, 0x07, 0x34, 0xf0, 0x45, 0x4c, 0x67, 0xb7, 0xa5, 0xf6, 0x0f, + 0xc1, 0xc4, 0x53, 0xbb, 0xef, 0xf3, 0x9b, 0x77, 0xde, 0x9d, 0xe7, 0xd9, 0x41, 0x36, 0x27, 0x09, + 0x09, 0x80, 0x60, 0x26, 0x48, 0xd0, 0x02, 0xdc, 0xae, 0x63, 0x75, 0xe2, 0x70, 0xc1, 0x14, 0x33, + 0x17, 0x72, 0xcd, 0xc9, 0x34, 0xa7, 0x5d, 0xb7, 0x17, 0x23, 0x16, 0x31, 0xad, 0xe2, 0xee, 0xbf, + 0x0c, 0xb4, 0x57, 0x22, 0xc6, 0xa2, 0x16, 0x60, 0xfd, 0xe4, 0xa7, 0x87, 0x58, 0xd1, 0x18, 0xa4, + 0x22, 0x31, 0xcf, 0x81, 0xa7, 0x01, 0x93, 0x31, 0x93, 0xd8, 0x27, 0x12, 0xf0, 0x71, 0x0a, 0xa2, + 0x83, 0xdb, 0x5b, 0x3e, 0x28, 0xb2, 0x85, 0x39, 0x89, 0x68, 0x42, 0x14, 0x65, 0x49, 0xce, 0x2e, + 0xe7, 0xcd, 0x08, 0xa7, 0x98, 0x24, 0x09, 0x53, 0x5a, 0x94, 0xb9, 0x5a, 0x19, 0x9d, 0x37, 0x9f, + 0x2e, 0x1f, 0x65, 0x54, 0x8f, 0x20, 0x01, 0x49, 0xf3, 0x06, 0xb5, 0x2f, 0x45, 0xb4, 0xd0, 0x90, + 0x91, 0x0b, 0x11, 0x95, 0x0a, 0xc4, 0xbe, 0xc6, 0xcc, 0x32, 0x9a, 0x4d, 0x13, 0x7a, 0x9c, 0x82, + 0x47, 0x43, 0xcb, 0xa8, 0x1a, 0xeb, 0xb3, 0xee, 0x4c, 0x56, 0xd8, 0x0d, 0xcd, 0x27, 0x68, 0x9e, + 0x71, 0x10, 0x44, 0x31, 0xe1, 0x91, 0x30, 0x14, 0x20, 0xa5, 0x35, 0xa5, 0x99, 0xfb, 0xbd, 0xfa, + 0x76, 0x56, 0x36, 0xab, 0x68, 0x2e, 0x61, 0x21, 0x78, 0x3c, 0xf5, 0xbd, 0x23, 0xe8, 0x58, 0xc5, + 0xaa, 0xb1, 0x3e, 0xe7, 0xa2, 0x6e, 0xed, 0x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b, 0x0d, 0x73, 0xb6, 0x73, 0x33, 0xae, 0xb7, 0xd7, 0xce, 0xee, 0xe9, + 0x45, 0xc5, 0x38, 0xbb, 0xa8, 0x18, 0xbf, 0x2f, 0x2a, 0xc6, 0xe7, 0xcb, 0x4a, 0xe1, 0xec, 0xb2, + 0x52, 0xf8, 0x71, 0x59, 0x29, 0x7c, 0xc0, 0x03, 0xc6, 0xc6, 0x10, 0xd2, 0xee, 0xa5, 0x85, 0xf3, + 0xe6, 0x9b, 0x01, 0x13, 0x80, 0x4f, 0x7a, 0x37, 0xbb, 0x76, 0xd9, 0x9f, 0xd6, 0xb7, 0xfa, 0xf3, + 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x85, 0xe1, 0x68, 0xc8, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. From 31f3b7d5be2bfe62a215c2af6820a70f77013141 Mon Sep 17 00:00:00 2001 From: gyuguen Date: Fri, 2 Dec 2022 11:18:55 +0900 Subject: [PATCH 04/21] fix --- proto/panacea/datadeal/v2/consent.proto | 15 ++++++++++----- proto/panacea/datadeal/v2/tx.proto | 1 - 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/proto/panacea/datadeal/v2/consent.proto b/proto/panacea/datadeal/v2/consent.proto index d080edd4..69360db2 100644 --- a/proto/panacea/datadeal/v2/consent.proto +++ b/proto/panacea/datadeal/v2/consent.proto @@ -8,9 +8,14 @@ import "panacea/datadeal/v2/deal.proto"; // Certificate defines a certificate message Certificate { - string cid = 1; - string operator_address = 2; - int64 deal_id = 3; - string provider_address = 4; - string data_hash = 5; + UnsignedCertificate unsigned_certificate = 1; + bytes signature = 2; +} + +message UnsignedCertificate { + string cid = 1; + string operator_address = 2; + int64 deal_id = 3; + string provider_address = 4; + string data_hash = 5; } \ No newline at end of file diff --git a/proto/panacea/datadeal/v2/tx.proto b/proto/panacea/datadeal/v2/tx.proto index 86a56302..6192f5eb 100644 --- a/proto/panacea/datadeal/v2/tx.proto +++ b/proto/panacea/datadeal/v2/tx.proto @@ -47,7 +47,6 @@ message MsgDeactivateDealResponse { // MsgSubmitConsent defines the Msg/SubmitConsent request type. message MsgSubmitConsent { Certificate certificate = 1; - bytes signature = 2; } // MsgSubmitConsentResponse defines the Msg/SubmitConsent response type. From d359d68d4437c34e6508d8830b8ee913486adfaa Mon Sep 17 00:00:00 2001 From: gyuguen Date: Fri, 2 Dec 2022 11:21:01 +0900 Subject: [PATCH 05/21] fix --- proto/panacea/datadeal/v2/consent.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proto/panacea/datadeal/v2/consent.proto b/proto/panacea/datadeal/v2/consent.proto index 69360db2..c9faf0f8 100644 --- a/proto/panacea/datadeal/v2/consent.proto +++ b/proto/panacea/datadeal/v2/consent.proto @@ -6,12 +6,13 @@ option go_package = "github.com/medibloc/panacea-core/x/datadeal/types"; import "gogoproto/gogo.proto"; import "panacea/datadeal/v2/deal.proto"; -// Certificate defines a certificate +// Certificate defines a certificate with signature message Certificate { UnsignedCertificate unsigned_certificate = 1; bytes signature = 2; } +// UnsignedCertificate defines a certificate information message UnsignedCertificate { string cid = 1; string operator_address = 2; From e189f52e36b2e5254694a919c0809650fa7b2829 Mon Sep 17 00:00:00 2001 From: gyuguen Date: Fri, 2 Dec 2022 11:23:36 +0900 Subject: [PATCH 06/21] fix --- .github/workflows/ci.yml | 56 +++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8eb92d4..a7cba12f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ name: ci on: push: branches: # only for pushes on master - - master + - master pull_request: # for all PRs regardless of its base branch jobs: @@ -12,29 +12,43 @@ jobs: name: Build and Test runs-on: ubuntu-latest steps: + - name: Set up Go 1.x + uses: actions/setup-go@v3 + with: + go-version: 1.19 + id: go - - name: Set up Go 1.x - uses: actions/setup-go@v3 - with: - go-version: 1.19 - id: go + - name: Check out code into the Go module directory + uses: actions/checkout@v3 - - name: Check out code into the Go module directory - uses: actions/checkout@v3 + - name: Build (+ generating proto and docs) + run: make build-all - - name: Build (+ generating proto and docs) - run: make build-all + - name: Test + run: make test - - name: Test - run: make test + - name: Publish coverage.html as an artifact + uses: actions/upload-artifact@master + with: + name: coverage + path: artifacts/coverage.html - - name: Lint - uses: golangci/golangci-lint-action@v3 - with: - version: latest + lint: + name: Lint + runs-on: ubuntu-latest - - name: Publish coverage.html as an artifact - uses: actions/upload-artifact@master - with: - name: coverage - path: artifacts/coverage.html + steps: + - name: Set up Go 1.x + uses: actions/setup-go@v3 + with: + go-version: 1.18 + id: go + + - name: Checkout code into the Go module directory + uses: actions/checkout@v3 + + - name: Lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: --timeout=5m From 8eccb41513d2d18b87ff343c73155def0844c388 Mon Sep 17 00:00:00 2001 From: gyuguen Date: Mon, 5 Dec 2022 10:44:41 +0900 Subject: [PATCH 07/21] fix --- proto/panacea/datadeal/v2/consent.proto | 2 +- proto/panacea/oracle/v2/oracle.proto | 25 +- proto/panacea/oracle/v2/query.proto | 8 +- proto/panacea/oracle/v2/tx.proto | 6 +- .../cosmos/staking/v1beta1/staking.proto | 4 +- x/datadeal/types/consent.pb.go | 313 +++++++++++++++--- x/datadeal/types/tx.pb.go | 122 ++----- x/oracle/types/oracle.pb.go | 190 ++++------- x/oracle/types/query.pb.go | 129 ++++---- x/oracle/types/query.pb.gw.go | 36 +- x/oracle/types/tx.pb.go | 152 ++++----- 11 files changed, 540 insertions(+), 447 deletions(-) diff --git a/proto/panacea/datadeal/v2/consent.proto b/proto/panacea/datadeal/v2/consent.proto index c9faf0f8..22650913 100644 --- a/proto/panacea/datadeal/v2/consent.proto +++ b/proto/panacea/datadeal/v2/consent.proto @@ -15,7 +15,7 @@ message Certificate { // UnsignedCertificate defines a certificate information message UnsignedCertificate { string cid = 1; - string operator_address = 2; + string oracle_address = 2; int64 deal_id = 3; string provider_address = 4; string data_hash = 5; diff --git a/proto/panacea/oracle/v2/oracle.proto b/proto/panacea/oracle/v2/oracle.proto index 47453687..8fa3cc98 100644 --- a/proto/panacea/oracle/v2/oracle.proto +++ b/proto/panacea/oracle/v2/oracle.proto @@ -7,31 +7,16 @@ import "gogoproto/gogo.proto"; // Oracle defines a detail of oracle. message Oracle { - string operator_address = 1; - OracleStatus status = 2; - string unique_id = 3; - string endpoint = 4; - string oracle_commission_rate = 5 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; -} - -// OracleStatus enumerates the status of oracle. -enum OracleStatus { - option (gogoproto.goproto_enum_prefix) = false; - - // ORACLE_STATUS_UNSPECIFIED - ORACLE_STATUS_UNSPECIFIED = 0; - - // ORACLE_STATUS_ACTIVE defines the oracle status that is active - ORACLE_STATUS_ACTIVE = 1; - - // ORACLE_STATUS_INACTIVE defines the oracle status that is inactive - ORACLE_STATUS_INACTIVE = 2; + string oracle_address = 1; + string unique_id = 2; + string endpoint = 3; + string oracle_commission_rate = 4 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } // OracleRegistration defines the detailed states of the registration of oracle. message OracleRegistration { string unique_id = 1; - string operator_address = 2; + string oracle_address = 2; // Node public key is a pair with a node private key which is generated in SGX by each oracle. // This key is used to share the oracle private key from other oracles. bytes node_pub_key = 3; diff --git a/proto/panacea/oracle/v2/query.proto b/proto/panacea/oracle/v2/query.proto index 09932f5e..278af92a 100644 --- a/proto/panacea/oracle/v2/query.proto +++ b/proto/panacea/oracle/v2/query.proto @@ -19,7 +19,7 @@ service Query { // Oracle returns a oracle. rpc Oracle(QueryOracleRequest) returns (QueryOracleResponse) { - option (google.api.http).get = "/panacea/oracle/v2/oracles/{operator_address}"; + option (google.api.http).get = "/panacea/oracle/v2/oracles/{oracle_address}"; } // OracleRegistrations returns a list of OracleRegistration. @@ -29,7 +29,7 @@ service Query { // OracleRegistration returns a OracleRegistration details. rpc OracleRegistration(QueryOracleRegistrationRequest) returns (QueryOracleRegistrationResponse) { - option (google.api.http).get = "/panacea/oracle/v2/oracle_registrations/{unique_id}/{operator_address}"; + option (google.api.http).get = "/panacea/oracle/v2/oracle_registrations/{unique_id}/{oracle_address}"; } // Params returns params of oracle module. @@ -51,7 +51,7 @@ message QueryOraclesResponse { // QueryOracleRequest is the request type for the Query/Oracle RPC method. message QueryOracleRequest { - string operator_address = 1; + string oracle_address = 1; } // QueryOracleResponse is the response type for the Query/Oracle RPC method. @@ -73,7 +73,7 @@ message QueryOracleRegistrationsResponse { // QueryOracleRegistrationRequest is the request type for the Query/OracleRegistration RPC method. message QueryOracleRegistrationRequest { string unique_id = 1; - string operator_address = 2; + string oracle_address = 2; } // QueryOracleRegistrationResponse is the response type for the Query/OracleRegistration RPC method. diff --git a/proto/panacea/oracle/v2/tx.proto b/proto/panacea/oracle/v2/tx.proto index fb972689..0250e87d 100644 --- a/proto/panacea/oracle/v2/tx.proto +++ b/proto/panacea/oracle/v2/tx.proto @@ -25,7 +25,7 @@ service Msg { // MsgRegisterOracle defines the Msg/RegisterOracle request type. message MsgRegisterOracle { string unique_id = 1; - string operator_address = 2; // panacea1.. account address + string oracle_address = 2; // panacea1.. account address bytes node_pub_key = 3; bytes node_pub_key_remote_report = 4; int64 trusted_block_height = 5; @@ -47,7 +47,7 @@ message MsgApproveOracleRegistration { // ApproveOracleRegistration defines for oracle registration approval message ApproveOracleRegistration { string unique_id = 1; - string target_operator_address = 2; + string target_oracle_address = 2; bytes encrypted_oracle_priv_key = 3; } @@ -57,7 +57,7 @@ message MsgApproveOracleRegistrationResponse { // MsgUpdateOracleInfo defines the Msg/UpdateOracleInfo message MsgUpdateOracleInfo { - string operator_address = 1; // panacea1.. account address + string oracle_address = 1; // panacea1.. account address string endpoint = 2; string oracle_commission_rate = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; } diff --git a/third_party/proto/cosmos/staking/v1beta1/staking.proto b/third_party/proto/cosmos/staking/v1beta1/staking.proto index cacdbf78..0eadc75b 100644 --- a/third_party/proto/cosmos/staking/v1beta1/staking.proto +++ b/third_party/proto/cosmos/staking/v1beta1/staking.proto @@ -85,8 +85,8 @@ message Validator { option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_getters) = false; - // operator_address defines the address of the validator's operator; bech encoded in JSON. - string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""]; + // oracle_address defines the address of the validator's operator; bech encoded in JSON. + string oracle_address = 1 [(gogoproto.moretags) = "yaml:\"oracle_address\""]; // consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. google.protobuf.Any consensus_pubkey = 2 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"consensus_pubkey\""]; diff --git a/x/datadeal/types/consent.pb.go b/x/datadeal/types/consent.pb.go index 76e57700..5ce05fe7 100644 --- a/x/datadeal/types/consent.pb.go +++ b/x/datadeal/types/consent.pb.go @@ -23,13 +23,10 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Certificate defines a certificate +// Certificate defines a certificate with signature type Certificate struct { - Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` - OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` - DealId int64 `protobuf:"varint,3,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` - ProviderAddress string `protobuf:"bytes,4,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty"` - DataHash string `protobuf:"bytes,5,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` + UnsignedCertificate *UnsignedCertificate `protobuf:"bytes,1,opt,name=unsigned_certificate,json=unsignedCertificate,proto3" json:"unsigned_certificate,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } func (m *Certificate) Reset() { *m = Certificate{} } @@ -65,35 +62,91 @@ func (m *Certificate) XXX_DiscardUnknown() { var xxx_messageInfo_Certificate proto.InternalMessageInfo -func (m *Certificate) GetCid() string { +func (m *Certificate) GetUnsignedCertificate() *UnsignedCertificate { + if m != nil { + return m.UnsignedCertificate + } + return nil +} + +func (m *Certificate) GetSignature() []byte { + if m != nil { + return m.Signature + } + return nil +} + +// UnsignedCertificate defines a certificate information +type UnsignedCertificate struct { + Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` + OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` + DealId int64 `protobuf:"varint,3,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` + ProviderAddress string `protobuf:"bytes,4,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty"` + DataHash string `protobuf:"bytes,5,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` +} + +func (m *UnsignedCertificate) Reset() { *m = UnsignedCertificate{} } +func (m *UnsignedCertificate) String() string { return proto.CompactTextString(m) } +func (*UnsignedCertificate) ProtoMessage() {} +func (*UnsignedCertificate) Descriptor() ([]byte, []int) { + return fileDescriptor_b5d80581f65c4381, []int{1} +} +func (m *UnsignedCertificate) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UnsignedCertificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UnsignedCertificate.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 *UnsignedCertificate) XXX_Merge(src proto.Message) { + xxx_messageInfo_UnsignedCertificate.Merge(m, src) +} +func (m *UnsignedCertificate) XXX_Size() int { + return m.Size() +} +func (m *UnsignedCertificate) XXX_DiscardUnknown() { + xxx_messageInfo_UnsignedCertificate.DiscardUnknown(m) +} + +var xxx_messageInfo_UnsignedCertificate proto.InternalMessageInfo + +func (m *UnsignedCertificate) GetCid() string { if m != nil { return m.Cid } return "" } -func (m *Certificate) GetOperatorAddress() string { +func (m *UnsignedCertificate) GetOracleAddress() string { if m != nil { - return m.OperatorAddress + return m.OracleAddress } return "" } -func (m *Certificate) GetDealId() int64 { +func (m *UnsignedCertificate) GetDealId() int64 { if m != nil { return m.DealId } return 0 } -func (m *Certificate) GetProviderAddress() string { +func (m *UnsignedCertificate) GetProviderAddress() string { if m != nil { return m.ProviderAddress } return "" } -func (m *Certificate) GetDataHash() string { +func (m *UnsignedCertificate) GetDataHash() string { if m != nil { return m.DataHash } @@ -102,30 +155,35 @@ func (m *Certificate) GetDataHash() string { func init() { proto.RegisterType((*Certificate)(nil), "panacea.datadeal.v2.Certificate") + proto.RegisterType((*UnsignedCertificate)(nil), "panacea.datadeal.v2.UnsignedCertificate") } func init() { proto.RegisterFile("panacea/datadeal/v2/consent.proto", fileDescriptor_b5d80581f65c4381) } var fileDescriptor_b5d80581f65c4381 = []byte{ - // 279 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0xb1, 0x4e, 0xeb, 0x30, - 0x14, 0x86, 0xeb, 0xdb, 0x4b, 0xa1, 0x66, 0xa0, 0x0a, 0x48, 0x44, 0x45, 0xb2, 0x0a, 0x53, 0x19, - 0x88, 0x45, 0x79, 0x02, 0x60, 0x01, 0xb1, 0x75, 0x64, 0x89, 0x1c, 0xfb, 0x90, 0x58, 0x6a, 0x73, - 0x22, 0xdb, 0x44, 0xf0, 0x16, 0xbc, 0x07, 0x2f, 0xc2, 0xd8, 0x91, 0x11, 0x25, 0x2f, 0x82, 0xec, - 0x34, 0xea, 0xc2, 0x76, 0xfc, 0xff, 0x9f, 0x3f, 0xd9, 0x87, 0x9e, 0x57, 0xa2, 0x14, 0x12, 0x04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0x8d, 0xc2, 0x06, 0x6e, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x2b, - 0xb1, 0x98, 0x17, 0x71, 0x01, 0x00, 0x00, + // 341 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbf, 0x4e, 0xeb, 0x30, + 0x14, 0x87, 0xeb, 0xdb, 0x7b, 0x7b, 0x89, 0xcb, 0x9f, 0xca, 0xad, 0x44, 0x54, 0x90, 0x55, 0x2a, + 0x21, 0x85, 0x81, 0x58, 0x94, 0x27, 0x00, 0x16, 0x10, 0x5b, 0x24, 0x16, 0x18, 0x22, 0xd7, 0x36, + 0x89, 0xa5, 0x36, 0x8e, 0x6c, 0xa7, 0x82, 0x37, 0x60, 0xe4, 0x4d, 0x78, 0x0d, 0xc6, 0x8e, 0x8c, + 0xa8, 0x7d, 0x11, 0x64, 0xb7, 0xa5, 0x48, 0x74, 0x3b, 0xf9, 0xce, 0xef, 0x7c, 0x39, 0xc9, 0x81, + 0x47, 0x25, 0x2d, 0x28, 0x13, 0x94, 0x70, 0x6a, 0x29, 0x17, 0x74, 0x44, 0x26, 0x03, 0xc2, 0x54, + 0x61, 0x44, 0x61, 0xe3, 0x52, 0x2b, 0xab, 0x50, 0x7b, 0x19, 0x89, 0x57, 0x91, 0x78, 0x32, 0xe8, + 0x76, 0x32, 0x95, 0x29, 0xdf, 0x27, 0xae, 0x5a, 0x44, 0xbb, 0x78, 0x93, 0xcd, 0x8f, 0xf8, 0x7e, + 0xff, 0x05, 0xc0, 0xe6, 0x95, 0xd0, 0x56, 0x3e, 0x4a, 0x46, 0xad, 0x40, 0x0f, 0xb0, 0x53, 0x15, + 0x46, 0x66, 0x85, 0xe0, 0x29, 0x5b, 0xf3, 0x10, 0xf4, 0x40, 0xd4, 0x1c, 0x44, 0xf1, 0x86, 0x37, + 0xc7, 0x77, 0xcb, 0x81, 0x1f, 0x9e, 0xa4, 0x5d, 0xfd, 0x86, 0xe8, 0x10, 0x06, 0x0e, 0x52, 0x5b, + 0x69, 0x11, 0xfe, 0xe9, 0x81, 0x68, 0x3b, 0x59, 0x83, 0xfe, 0x1b, 0x80, 0xed, 0x0d, 0x2a, 0xd4, + 0x82, 0x75, 0x26, 0xb9, 0xdf, 0x20, 0x48, 0x5c, 0x89, 0x8e, 0xe1, 0xae, 0xd2, 0x94, 0x8d, 0x44, + 0x4a, 0x39, 0xd7, 0xc2, 0x18, 0x2f, 0x0b, 0x92, 0x9d, 0x05, 0xbd, 0x58, 0x40, 0xb4, 0x0f, 0xff, + 0xbb, 0x15, 0x53, 0xc9, 0xc3, 0x7a, 0x0f, 0x44, 0xf5, 0xa4, 0xe1, 0x1e, 0x6f, 0x38, 0x3a, 0x81, + 0xad, 0x52, 0xab, 0x89, 0xe4, 0x42, 0x7f, 0x1b, 0xfe, 0x7a, 0xc3, 0xde, 0x8a, 0xaf, 0x1c, 0x07, + 0x30, 0x70, 0x9f, 0x9a, 0xe6, 0xd4, 0xe4, 0xe1, 0x3f, 0x9f, 0xd9, 0x72, 0xe0, 0x9a, 0x9a, 0xfc, + 0xf2, 0xf6, 0x7d, 0x86, 0xc1, 0x74, 0x86, 0xc1, 0xe7, 0x0c, 0x83, 0xd7, 0x39, 0xae, 0x4d, 0xe7, + 0xb8, 0xf6, 0x31, 0xc7, 0xb5, 0xfb, 0xb3, 0x4c, 0xda, 0xbc, 0x1a, 0xc6, 0x4c, 0x8d, 0xc9, 0x58, + 0x70, 0x39, 0x1c, 0x29, 0x46, 0x96, 0xff, 0xee, 0x94, 0x29, 0x2d, 0xc8, 0xd3, 0xfa, 0x22, 0xf6, + 0xb9, 0x14, 0x66, 0xd8, 0xf0, 0x07, 0x39, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xfa, 0xa1, + 0xb9, 0x00, 0x02, 0x00, 0x00, } func (m *Certificate) Marshal() (dAtA []byte, err error) { @@ -144,6 +202,48 @@ func (m *Certificate) MarshalTo(dAtA []byte) (int, error) { } func (m *Certificate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Signature) > 0 { + i -= len(m.Signature) + copy(dAtA[i:], m.Signature) + i = encodeVarintConsent(dAtA, i, uint64(len(m.Signature))) + i-- + dAtA[i] = 0x12 + } + if m.UnsignedCertificate != nil { + { + size, err := m.UnsignedCertificate.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintConsent(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *UnsignedCertificate) 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 *UnsignedCertificate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UnsignedCertificate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -167,10 +267,10 @@ func (m *Certificate) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintConsent(dAtA, i, uint64(len(m.OperatorAddress))) + if len(m.OracleAddress) > 0 { + i -= len(m.OracleAddress) + copy(dAtA[i:], m.OracleAddress) + i = encodeVarintConsent(dAtA, i, uint64(len(m.OracleAddress))) i-- dAtA[i] = 0x12 } @@ -196,6 +296,23 @@ func encodeVarintConsent(dAtA []byte, offset int, v uint64) int { return base } func (m *Certificate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.UnsignedCertificate != nil { + l = m.UnsignedCertificate.Size() + n += 1 + l + sovConsent(uint64(l)) + } + l = len(m.Signature) + if l > 0 { + n += 1 + l + sovConsent(uint64(l)) + } + return n +} + +func (m *UnsignedCertificate) Size() (n int) { if m == nil { return 0 } @@ -205,7 +322,7 @@ func (m *Certificate) Size() (n int) { if l > 0 { n += 1 + l + sovConsent(uint64(l)) } - l = len(m.OperatorAddress) + l = len(m.OracleAddress) if l > 0 { n += 1 + l + sovConsent(uint64(l)) } @@ -258,6 +375,126 @@ func (m *Certificate) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Certificate: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UnsignedCertificate", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthConsent + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthConsent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.UnsignedCertificate == nil { + m.UnsignedCertificate = &UnsignedCertificate{} + } + if err := m.UnsignedCertificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConsent + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthConsent + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthConsent + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) + if m.Signature == nil { + m.Signature = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipConsent(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthConsent + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *UnsignedCertificate) 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 ErrIntOverflowConsent + } + 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: UnsignedCertificate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UnsignedCertificate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType) @@ -292,7 +529,7 @@ func (m *Certificate) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OracleAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -320,7 +557,7 @@ func (m *Certificate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + m.OracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 0 { diff --git a/x/datadeal/types/tx.pb.go b/x/datadeal/types/tx.pb.go index 05fed3ab..aee1f904 100644 --- a/x/datadeal/types/tx.pb.go +++ b/x/datadeal/types/tx.pb.go @@ -244,7 +244,6 @@ var xxx_messageInfo_MsgDeactivateDealResponse proto.InternalMessageInfo // MsgSubmitConsent defines the Msg/SubmitConsent request type. type MsgSubmitConsent struct { Certificate *Certificate `protobuf:"bytes,1,opt,name=certificate,proto3" json:"certificate,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` } func (m *MsgSubmitConsent) Reset() { *m = MsgSubmitConsent{} } @@ -287,13 +286,6 @@ func (m *MsgSubmitConsent) GetCertificate() *Certificate { return nil } -func (m *MsgSubmitConsent) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - // MsgSubmitConsentResponse defines the Msg/SubmitConsent response type. type MsgSubmitConsentResponse struct { } @@ -343,41 +335,40 @@ func init() { func init() { proto.RegisterFile("panacea/datadeal/v2/tx.proto", fileDescriptor_9f03db1b9a7fe946) } var fileDescriptor_9f03db1b9a7fe946 = []byte{ - // 531 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcd, 0x6e, 0xd3, 0x4e, - 0x14, 0xc5, 0xe3, 0xa4, 0xcd, 0x5f, 0xb9, 0x49, 0xfe, 0x6a, 0x87, 0x22, 0x5c, 0x53, 0x19, 0x63, - 0x04, 0x8a, 0x40, 0x1d, 0x93, 0xf0, 0x04, 0x34, 0xd9, 0x20, 0x14, 0x16, 0xee, 0x0a, 0x84, 0x14, - 0x8d, 0xc7, 0x17, 0xc7, 0x52, 0xec, 0x09, 0x9e, 0x71, 0x94, 0xbe, 0x05, 0x0f, 0xc3, 0x03, 0xb0, - 0x64, 0xd9, 0x25, 0x4b, 0x94, 0xbc, 0x08, 0xb2, 0x1d, 0xe7, 0xa3, 0x24, 0xa2, 0x3b, 0xfb, 0x9e, - 0xdf, 0xdc, 0x73, 0xee, 0x7c, 0xc0, 0xc5, 0x94, 0xc5, 0x8c, 0x23, 0x73, 0x7c, 0xa6, 0x98, 0x8f, - 0x6c, 0xe2, 0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xa6, - 0x76, 0xbb, 0x30, 0xb5, 0xdf, 0x0b, 0x53, 0xfb, 0xb6, 0x34, 0x2b, 0xb7, 0x4b, 0xb3, 0xf2, 0x6b, - 0x69, 0x56, 0x3e, 0x75, 0x83, 0x50, 0x8d, 0x53, 0x8f, 0x72, 0x11, 0x39, 0x11, 0xfa, 0xa1, 0x37, - 0x11, 0xdc, 0x59, 0xf5, 0xbe, 0xe4, 0x22, 0x41, 0x67, 0xbe, 0x79, 0x8d, 0xea, 0x66, 0x8a, 0xd2, - 0xab, 0xe7, 0x2f, 0xf1, 0xcd, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x3e, 0xe6, 0x7f, 0x37, - 0x04, 0x00, 0x00, + // 517 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xc1, 0x6e, 0xd3, 0x4a, + 0x14, 0x8d, 0x93, 0x36, 0x4f, 0xbd, 0x49, 0x9e, 0x5a, 0x53, 0x84, 0x6b, 0x90, 0x31, 0x46, 0xa0, + 0x08, 0xd4, 0x19, 0x12, 0xbe, 0x80, 0x26, 0x1b, 0x84, 0xc2, 0xc2, 0x95, 0x90, 0x40, 0x48, 0xd1, + 0x78, 0x7c, 0x71, 0x2c, 0xc5, 0x9e, 0xe0, 0x19, 0x47, 0xe9, 0x5f, 0xf0, 0x31, 0x7c, 0x00, 0x4b, + 0x96, 0x5d, 0xb2, 0x44, 0xc9, 0x8f, 0x20, 0xdb, 0x71, 0x1a, 0x97, 0x44, 0x74, 0xe7, 0xb9, 0xe7, + 0xcc, 0x39, 0xe7, 0xde, 0xf1, 0x85, 0x47, 0x33, 0x16, 0x33, 0x8e, 0x8c, 0xfa, 0x4c, 0x31, 0x1f, + 0xd9, 0x94, 0xce, 0xfb, 0x54, 0x2d, 0xc8, 0x2c, 0x11, 0x4a, 0xe8, 0xf7, 0xd6, 0x28, 0x29, 0x51,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 0x8d, 0xd0, + 0x0f, 0xbd, 0xa9, 0xe0, 0x74, 0xad, 0x7d, 0xce, 0x45, 0x82, 0x74, 0x71, 0xb3, 0x6f, 0xea, 0x6a, + 0x86, 0xd2, 0x6b, 0xe6, 0xbb, 0xf6, 0xfa, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x09, 0x0e, 0x64, + 0x09, 0x19, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -707,13 +698,6 @@ func (m *MsgSubmitConsent) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } if m.Certificate != nil { { size, err := m.Certificate.MarshalToSizedBuffer(dAtA[:i]) @@ -840,10 +824,6 @@ func (m *MsgSubmitConsent) Size() (n int) { l = m.Certificate.Size() n += 1 + l + sovTx(uint64(l)) } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } return n } @@ -1350,40 +1330,6 @@ func (m *MsgSubmitConsent) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", 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.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index 02512d4f..5e0de69f 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -24,45 +24,12 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// OracleStatus enumerates the status of oracle. -type OracleStatus int32 - -const ( - // ORACLE_STATUS_UNSPECIFIED - ORACLE_STATUS_UNSPECIFIED OracleStatus = 0 - // ORACLE_STATUS_ACTIVE defines the oracle status that is active - ORACLE_STATUS_ACTIVE OracleStatus = 1 - // ORACLE_STATUS_INACTIVE defines the oracle status that is inactive - ORACLE_STATUS_INACTIVE OracleStatus = 2 -) - -var OracleStatus_name = map[int32]string{ - 0: "ORACLE_STATUS_UNSPECIFIED", - 1: "ORACLE_STATUS_ACTIVE", - 2: "ORACLE_STATUS_INACTIVE", -} - -var OracleStatus_value = map[string]int32{ - "ORACLE_STATUS_UNSPECIFIED": 0, - "ORACLE_STATUS_ACTIVE": 1, - "ORACLE_STATUS_INACTIVE": 2, -} - -func (x OracleStatus) String() string { - return proto.EnumName(OracleStatus_name, int32(x)) -} - -func (OracleStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_35c1a1e2fbbbc7ea, []int{0} -} - // Oracle defines a detail of oracle. type Oracle struct { - OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` - Status OracleStatus `protobuf:"varint,2,opt,name=status,proto3,enum=panacea.oracle.v2.OracleStatus" json:"status,omitempty"` - UniqueId string `protobuf:"bytes,3,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` - Endpoint string `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"` - OracleCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,5,opt,name=oracle_commission_rate,json=oracleCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_commission_rate"` + OracleAddress string `protobuf:"bytes,1,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` + UniqueId string `protobuf:"bytes,2,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` + Endpoint string `protobuf:"bytes,3,opt,name=endpoint,proto3" json:"endpoint,omitempty"` + OracleCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=oracle_commission_rate,json=oracleCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_commission_rate"` } func (m *Oracle) Reset() { *m = Oracle{} } @@ -98,20 +65,13 @@ func (m *Oracle) XXX_DiscardUnknown() { var xxx_messageInfo_Oracle proto.InternalMessageInfo -func (m *Oracle) GetOperatorAddress() string { +func (m *Oracle) GetOracleAddress() string { if m != nil { - return m.OperatorAddress + return m.OracleAddress } return "" } -func (m *Oracle) GetStatus() OracleStatus { - if m != nil { - return m.Status - } - return ORACLE_STATUS_UNSPECIFIED -} - func (m *Oracle) GetUniqueId() string { if m != nil { return m.UniqueId @@ -128,8 +88,8 @@ func (m *Oracle) GetEndpoint() string { // OracleRegistration defines the detailed states of the registration of oracle. type OracleRegistration struct { - UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` - OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` + OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` // Node public key is a pair with a node private key which is generated in SGX by each oracle. // This key is used to share the oracle private key from other oracles. NodePubKey []byte `protobuf:"bytes,3,opt,name=node_pub_key,json=nodePubKey,proto3" json:"node_pub_key,omitempty"` @@ -185,9 +145,9 @@ func (m *OracleRegistration) GetUniqueId() string { return "" } -func (m *OracleRegistration) GetOperatorAddress() string { +func (m *OracleRegistration) GetOracleAddress() string { if m != nil { - return m.OperatorAddress + return m.OracleAddress } return "" } @@ -235,7 +195,6 @@ func (m *OracleRegistration) GetNonce() []byte { } func init() { - proto.RegisterEnum("panacea.oracle.v2.OracleStatus", OracleStatus_name, OracleStatus_value) proto.RegisterType((*Oracle)(nil), "panacea.oracle.v2.Oracle") proto.RegisterType((*OracleRegistration)(nil), "panacea.oracle.v2.OracleRegistration") } @@ -243,41 +202,35 @@ func init() { func init() { proto.RegisterFile("panacea/oracle/v2/oracle.proto", fileDescriptor_35c1a1e2fbbbc7ea) } var fileDescriptor_35c1a1e2fbbbc7ea = []byte{ - // 535 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x93, 0x41, 0x6f, 0xd3, 0x30, - 0x14, 0xc7, 0x93, 0x76, 0x2b, 0xad, 0x55, 0x41, 0xb1, 0xaa, 0x2a, 0x14, 0x91, 0x56, 0x3b, 0xa0, - 0x81, 0x58, 0x82, 0xca, 0x01, 0x89, 0x5b, 0xdb, 0x15, 0x11, 0x81, 0xb6, 0x29, 0xed, 0x38, 0x70, - 0xb1, 0xdc, 0xe4, 0xa9, 0xb5, 0xba, 0xc4, 0xc1, 0x76, 0x26, 0xfa, 0x0d, 0x90, 0xb8, 0xf0, 0x1d, - 0xf8, 0x06, 0x7c, 0x8a, 0x1d, 0x77, 0x44, 0x1c, 0x26, 0xd4, 0x7e, 0x11, 0x54, 0x27, 0x85, 0x76, - 0xec, 0xc0, 0x61, 0xa7, 0xd8, 0xef, 0xf7, 0xcf, 0xf3, 0xf3, 0xff, 0xf9, 0x21, 0x3b, 0xa1, 0x31, - 0x0d, 0x80, 0xba, 0x5c, 0xd0, 0xe0, 0x0c, 0xdc, 0xf3, 0x4e, 0xbe, 0x72, 0x12, 0xc1, 0x15, 0xc7, - 0xf7, 0x73, 0xee, 0xe4, 0xd1, 0xf3,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, - 0xf3, 0xd7, 0xc2, 0x36, 0xbf, 0x2e, 0x6d, 0xe3, 0x72, 0x69, 0x1b, 0x3f, 0x96, 0xb6, 0xf1, 0xc1, - 0xdd, 0xb8, 0x58, 0x04, 0x21, 0x5b, 0xf9, 0xe9, 0xe6, 0x43, 0x71, 0x10, 0x70, 0x01, 0xee, 0xa7, - 0xf5, 0xac, 0xea, 0x5b, 0x8e, 0x4b, 0x7a, 0xfe, 0x5e, 0xfc, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xf3, - 0x68, 0x89, 0x60, 0xca, 0x03, 0x00, 0x00, + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x52, 0xc1, 0x6e, 0x13, 0x31, + 0x10, 0xcd, 0xb6, 0x34, 0x24, 0x56, 0x40, 0x60, 0x45, 0xd5, 0x2a, 0x48, 0xdb, 0xa8, 0x12, 0xa8, + 0x07, 0xba, 0x8b, 0xca, 0x8d, 0x1b, 0x81, 0x03, 0x15, 0x07, 0xd0, 0x1e, 0xb9, 0x58, 0x5e, 0x7b, + 0xb4, 0x6b, 0xa5, 0xeb, 0x59, 0x6c, 0x6f, 0x45, 0xfe, 0x82, 0x2f, 0xe1, 0x3b, 0x7a, 0x42, 0x3d, + 0x22, 0x0e, 0x15, 0x4a, 0x7e, 0x04, 0xad, 0xbd, 0x85, 0xa6, 0x70, 0xe0, 0xc0, 0xc9, 0x33, 0xef, + 0x3d, 0xcf, 0xcc, 0xd3, 0x0c, 0x49, 0x1a, 0xae, 0xb9, 0x00, 0x9e, 0xa1, 0xe1, 0xe2, 0x0c, 0xb2, + 0xf3, 0x93, 0x3e, 0x4a, 0x1b, 0x83, 0x0e, 0xe9, 0xc3, 0x9e, 0x4f, 0x7b, 0xf4, 0xfc, 0x64, 0x36, + 0x2d, 0xb1, 0x44, 0xcf, 0x66, 0x5d, 0x14, 0x84, 0x87, 0x5f, 0x23,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x7b, 0x96, 0x3e, 0x23, 0x53, 0x67, 0x5a, 0xeb, 0x40, 0xb2, 0xe2, 0x0c, 0xc5, 0x92, 0x55, + 0xa0, 0xca, 0xca, 0xc5, 0x7b, 0xf3, 0xe8, 0x68, 0x37, 0xa7, 0x3d, 0xb7, 0xe8, 0xa8, 0x37, 0x9e, + 0xa1, 0x4f, 0x09, 0xbd, 0xf5, 0x83, 0xdb, 0x2a, 0x1e, 0xfa, 0x2e, 0x0f, 0xb6, 0xf4, 0xdc, 0x56, + 0x5b, 0xab, 0xb9, 0xfb, 0xcf, 0xab, 0x19, 0xfd, 0xbf, 0xd5, 0xd0, 0x29, 0xd9, 0xd3, 0xa8, 0x05, + 0xc4, 0x63, 0x3f, 0x62, 0x48, 0x16, 0xa7, 0x17, 0xeb, 0x24, 0xba, 0x5c, 0x27, 0xd1, 0x8f, 0x75, + 0x12, 0x7d, 0xde, 0x24, 0x83, 0xcb, 0x4d, 0x32, 0xf8, 0xb6, 0x49, 0x06, 0x1f, 0xb2, 0x1b, 0xdd, + 0x6a, 0x90, 0xaa, 0x33, 0x99, 0xf5, 0x87, 0x7d, 0x2c, 0xd0, 0x40, 0xf6, 0xe9, 0xfa, 0xfe, 0x7d, + 0xeb, 0x62, 0xe8, 0x6f, 0xfa, 0xf9, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0xeb, 0x01, 0xe8, + 0x1e, 0x03, 0x00, 0x00, } func (m *Oracle) Marshal() (dAtA []byte, err error) { @@ -309,30 +262,25 @@ func (m *Oracle) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOracle(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 if len(m.Endpoint) > 0 { i -= len(m.Endpoint) copy(dAtA[i:], m.Endpoint) i = encodeVarintOracle(dAtA, i, uint64(len(m.Endpoint))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if len(m.UniqueId) > 0 { i -= len(m.UniqueId) copy(dAtA[i:], m.UniqueId) i = encodeVarintOracle(dAtA, i, uint64(len(m.UniqueId))) i-- - dAtA[i] = 0x1a - } - if m.Status != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintOracle(dAtA, i, uint64(len(m.OperatorAddress))) + if len(m.OracleAddress) > 0 { + i -= len(m.OracleAddress) + copy(dAtA[i:], m.OracleAddress) + i = encodeVarintOracle(dAtA, i, uint64(len(m.OracleAddress))) i-- dAtA[i] = 0xa } @@ -409,10 +357,10 @@ func (m *OracleRegistration) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintOracle(dAtA, i, uint64(len(m.OperatorAddress))) + if len(m.OracleAddress) > 0 { + i -= len(m.OracleAddress) + copy(dAtA[i:], m.OracleAddress) + i = encodeVarintOracle(dAtA, i, uint64(len(m.OracleAddress))) i-- dAtA[i] = 0x12 } @@ -443,13 +391,10 @@ func (m *Oracle) Size() (n int) { } var l int _ = l - l = len(m.OperatorAddress) + l = len(m.OracleAddress) if l > 0 { n += 1 + l + sovOracle(uint64(l)) } - if m.Status != 0 { - n += 1 + sovOracle(uint64(m.Status)) - } l = len(m.UniqueId) if l > 0 { n += 1 + l + sovOracle(uint64(l)) @@ -473,7 +418,7 @@ func (m *OracleRegistration) Size() (n int) { if l > 0 { n += 1 + l + sovOracle(uint64(l)) } - l = len(m.OperatorAddress) + l = len(m.OracleAddress) if l > 0 { n += 1 + l + sovOracle(uint64(l)) } @@ -542,7 +487,7 @@ func (m *Oracle) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OracleAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -570,28 +515,9 @@ func (m *Oracle) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + m.OracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= OracleStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UniqueId", wireType) } @@ -623,7 +549,7 @@ func (m *Oracle) Unmarshal(dAtA []byte) error { } m.UniqueId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Endpoint", wireType) } @@ -655,7 +581,7 @@ func (m *Oracle) Unmarshal(dAtA []byte) error { } m.Endpoint = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OracleCommissionRate", wireType) } @@ -773,7 +699,7 @@ func (m *OracleRegistration) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OracleAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -801,7 +727,7 @@ func (m *OracleRegistration) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + m.OracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index 93551d63..7b66881a 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -131,7 +131,7 @@ func (m *QueryOraclesResponse) GetPagination() *query.PageResponse { // QueryOracleRequest is the request type for the Query/Oracle RPC method. type QueryOracleRequest struct { - OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + OracleAddress string `protobuf:"bytes,1,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` } func (m *QueryOracleRequest) Reset() { *m = QueryOracleRequest{} } @@ -167,9 +167,9 @@ func (m *QueryOracleRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryOracleRequest proto.InternalMessageInfo -func (m *QueryOracleRequest) GetOperatorAddress() string { +func (m *QueryOracleRequest) GetOracleAddress() string { if m != nil { - return m.OperatorAddress + return m.OracleAddress } return "" } @@ -319,8 +319,8 @@ func (m *QueryOracleRegistrationsResponse) GetPagination() *query.PageResponse { // QueryOracleRegistrationRequest is the request type for the Query/OracleRegistration RPC method. type QueryOracleRegistrationRequest struct { - UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` - OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` + OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` } func (m *QueryOracleRegistrationRequest) Reset() { *m = QueryOracleRegistrationRequest{} } @@ -363,9 +363,9 @@ func (m *QueryOracleRegistrationRequest) GetUniqueId() string { return "" } -func (m *QueryOracleRegistrationRequest) GetOperatorAddress() string { +func (m *QueryOracleRegistrationRequest) GetOracleAddress() string { if m != nil { - return m.OperatorAddress + return m.OracleAddress } return "" } @@ -513,50 +513,49 @@ func init() { func init() { proto.RegisterFile("panacea/oracle/v2/query.proto", fileDescriptor_79c168e4f9a93eac) } var fileDescriptor_79c168e4f9a93eac = []byte{ - // 677 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4d, 0x6b, 0xd4, 0x40, - 0x18, 0xc7, 0x3b, 0x15, 0xb7, 0x76, 0x7a, 0x50, 0x67, 0x7b, 0x68, 0xd3, 0x9a, 0xd6, 0x40, 0xdf, - 0x94, 0x66, 0xd8, 0x2c, 0x9e, 0x45, 0x0f, 0xb5, 0xbd, 0x68, 0xdd, 0x83, 0x88, 0x20, 0xcb, 0x24, - 0x3b, 0xa6, 0x81, 0x4d, 0x26, 0x9b, 0x49, 0x16, 0x97, 0x52, 0x11, 0x3f, 0x80, 0x08, 0x7a, 0xf3, - 0x43, 0xf8, 0x29, 0x04, 0xc1, 0x4b, 0xc1, 0x8b, 0x47, 0xd9, 0xf5, 0x83, 0xc8, 0xce, 0x4c, 0xb6, - 0x1b, 0x93, 0xec, 0x6e, 0xa1, 0xb7, 0x76, 0x9e, 0x97, 0xff, 0xef, 0x79, 0xcb, 0xc2, 0x3b, 0x21, - 0x09, 0x88, 0x43, 0x09, 0x66, 0x11, 0x71, 0xda, 0x14, 0x77, 0x2d, 0xdc, 0x49, 0x68, 0xd4, 0x33, - 0xc3, 0x88, 0xc5, 0x0c, 0xdd, 0x56, 0x66, 0x53, 0x9a, 0xcd, 0xae, 0xa5, 0x2d, 0xbb, 0xcc, 0x65, - 0xc2, 0x8a, 0x87, 0x7f, 0x49, 0x47, 0x6d, 0xc3, 0x65, 0xcc, 0x6d, 0x53, 0x2c, 0xfe, 0xb3, 0x93, - 0x37, 0x38, 0xf6, 0x7c, 0xca, 0x63, 0xe2, 0x87, 0xca, 0xe1, 0x9e, 0xc3, 0xb8, 0xcf, 0x38, 0xb6, - 0x09, 0xa7, 0x52, 0x02, 0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a, 0x26, 0x9b, 0xbf, 0x60, 0xad, 0x7e, 0xa9, 0x18, 0xc5, 0x8d, 0x05, 0xf7, 0x1e, 0xda, 0x29, - 0xe5, 0xce, 0x9e, 0x28, 0xfa, 0x09, 0x20, 0xca, 0x27, 0x44, 0xb5, 0xd9, 0xc5, 0x53, 0x5e, 0xeb, - 0x32, 0x21, 0x0a, 0xf7, 0xa9, 0xc0, 0x3d, 0x44, 0x07, 0x33, 0xe2, 0xe2, 0xd3, 0xd1, 0x89, 0x9e, - 0x15, 0xf5, 0xff, 0x3d, 0x80, 0x15, 0xb9, 0xad, 0xe8, 0xfe, 0x64, 0x9c, 0xcc, 0x71, 0x94, 0xaf, - 0x45, 0xf6, 0x5a, 0x8c, 0xbb, 0x82, 0x77, 0x0d, 0xad, 0x16, 0xf0, 0xca, 0xeb, 0x78, 0x7c, 0xf4, - 0xa3, 0xaf, 0x83, 0xf3, 0xbe, 0x0e, 0xfe, 0xf4, 0x75, 0xf0, 0x69, 0xa0, 0xcf, 0x9d, 0x0f, 0xf4, - 0xb9, 0xdf, 0x03, 0x7d, 0xee, 0x15, 0x76, 0xbd, 0xf8, 0x24, 0xb1, 0x4d, 0x87, 0xf9, 0xd8, 0xa7, - 0x2d, 0xcf, 0x6e, 0x33, 0x27, 0xcd, 0xb3, 0xef, 0xb0, 0x88, 0xe2, 0xb7, 0x69, 0xba, 0xb8, 0x17, - 0x52, 0x6e, 0x57, 0xc4, 0xcf, 0x6d, 0xfd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x50, 0xa4, 0x58, - 0xcb, 0x64, 0x08, 0x00, 0x00, + // 672 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4d, 0x6b, 0xd4, 0x4e, + 0x1c, 0xc7, 0x3b, 0xfd, 0xf3, 0xdf, 0xda, 0x29, 0x0a, 0xce, 0xf6, 0xd0, 0xa6, 0x35, 0xad, 0x81, + 0x76, 0xab, 0xa5, 0x19, 0x36, 0x7b, 0xf4, 0xa4, 0x48, 0xb5, 0x20, 0x58, 0xf7, 0x20, 0x22, 0x48, + 0x99, 0x24, 0x63, 0x0c, 0x6c, 0x32, 0xd9, 0x4c, 0xb2, 0xb8, 0x94, 0x8a, 0x78, 0xf6, 0x20, 0x28, + 0xf8, 0x32, 0x7c, 0x15, 0x82, 0xde, 0x0a, 0x5e, 0x3c, 0xca, 0xae, 0x2f, 0x44, 0x76, 0x66, 0xb2, + 0xdd, 0x90, 0x64, 0x77, 0x0b, 0xbd, 0xb5, 0xf3, 0x7b, 0xf8, 0x7e, 0x7e, 0x4f, 0x59, 0x78, 0x2b, + 0x22, 0x21, 0x71, 0x28, 0xc1, 0x2c, 0x26, 0x4e, 0x87, 0xe2, 0x9e, 0x85, 0xbb, 0x29, 0x8d, 0xfb, + 0x66, 0x14, 0xb3, 0x84, 0xa1, 0x9b, 0xca, 0x6c, 0x4a, 0xb3, 0xd9, 0xb3, 0xb4, 0x55, 0x8f, 0x79, + 0x4c, 0x58, 0xf1, 0xe8, 0x2f, 0xe9, 0xa8, 0x6d, 0x79, 0x8c, 0x79, 0x1d, 0x8a, 0xc5, 0x7f, 0x76, + 0xfa, 0x1a, 0x27, 0x7e, 0x40, 0x79, 0x42, 0x82, 0x48, 0x39, 0xdc, 0x75, 0x18, 0x0f, 0x18, 0xc7, + 0x36, 0xe1, 0x54, 0x4a, 0xe0, 0x5e, 0xd3, 0xa6, 0x09, 0x69, 0xe2, 0x88, 0x78, 0x7e, 0x48, 0x12, + 0x9f, 0x85, 0xca, 0x77, 0x53, 0x25, 0x23, 0x91, 0x8f, 0x49, 0x18, 0xb2, 0x44, 0x18, 0xb9, 0xb2, + 0xea, 0x45, 0x64, 0x45, 0xa7, 0x50, 0x8a, 0x76, 0x8f, 0x86, 0x94, 0xfb, 0x2a, 0x81, 0xf1, 0x0a, + 0xd6, 0x9f, 0x8d, 0x00, 0x9e, 0x0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 0x93, 0x9b, 0x8a, 0xf6, 0xa7, 0xc3, 0xe4, 0x0e, 0xa3, 0x7a, 0x25, 0xf2, 0x97, 0x62, 0xdc, + 0x16, 0xb4, 0x1b, 0x68, 0xbd, 0x84, 0x56, 0x5e, 0xc6, 0x83, 0xa3, 0x1f, 0x03, 0x1d, 0x9c, 0x0f, + 0x74, 0xf0, 0x67, 0xa0, 0x83, 0x4f, 0x43, 0x7d, 0xe1, 0x7c, 0xa8, 0x2f, 0xfc, 0x1e, 0xea, 0x0b, + 0x2f, 0xb1, 0xe7, 0x27, 0x6f, 0x52, 0xdb, 0x74, 0x58, 0x80, 0x03, 0xea, 0xfa, 0x76, 0x87, 0x39, + 0x59, 0x9e, 0x03, 0x87, 0xc5, 0x14, 0xbf, 0xcd, 0xd2, 0x25, 0xfd, 0x88, 0x72, 0xbb, 0x26, 0x7e, + 0x62, 0x5b, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x85, 0xc2, 0xec, 0x28, 0x58, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -897,10 +896,10 @@ func (m *QueryOracleRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddress))) + if len(m.OracleAddress) > 0 { + i -= len(m.OracleAddress) + copy(dAtA[i:], m.OracleAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OracleAddress))) i-- dAtA[i] = 0xa } @@ -1046,10 +1045,10 @@ func (m *QueryOracleRegistrationRequest) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.OperatorAddress))) + if len(m.OracleAddress) > 0 { + i -= len(m.OracleAddress) + copy(dAtA[i:], m.OracleAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.OracleAddress))) i-- dAtA[i] = 0x12 } @@ -1205,7 +1204,7 @@ func (m *QueryOracleRequest) Size() (n int) { } var l int _ = l - l = len(m.OperatorAddress) + l = len(m.OracleAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1267,7 +1266,7 @@ func (m *QueryOracleRegistrationRequest) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.OperatorAddress) + l = len(m.OracleAddress) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1552,7 +1551,7 @@ func (m *QueryOracleRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OracleAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1580,7 +1579,7 @@ func (m *QueryOracleRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + m.OracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1958,7 +1957,7 @@ func (m *QueryOracleRegistrationRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OracleAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1986,7 +1985,7 @@ func (m *QueryOracleRegistrationRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + m.OracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go index 64928aca..4c4fdfe4 100644 --- a/x/oracle/types/query.pb.gw.go +++ b/x/oracle/types/query.pb.gw.go @@ -78,15 +78,15 @@ func request_Query_Oracle_0(ctx context.Context, marshaler runtime.Marshaler, cl _ = err ) - val, ok = pathParams["operator_address"] + val, ok = pathParams["oracle_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_address") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "oracle_address") } - protoReq.OperatorAddress, err = runtime.String(val) + protoReq.OracleAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_address", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "oracle_address", err) } msg, err := client.Oracle(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -105,15 +105,15 @@ func local_request_Query_Oracle_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["operator_address"] + val, ok = pathParams["oracle_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_address") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "oracle_address") } - protoReq.OperatorAddress, err = runtime.String(val) + protoReq.OracleAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_address", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "oracle_address", err) } msg, err := server.Oracle(ctx, &protoReq) @@ -179,15 +179,15 @@ func request_Query_OracleRegistration_0(ctx context.Context, marshaler runtime.M return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "unique_id", err) } - val, ok = pathParams["operator_address"] + val, ok = pathParams["oracle_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_address") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "oracle_address") } - protoReq.OperatorAddress, err = runtime.String(val) + protoReq.OracleAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_address", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "oracle_address", err) } msg, err := client.OracleRegistration(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -217,15 +217,15 @@ func local_request_Query_OracleRegistration_0(ctx context.Context, marshaler run return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "unique_id", err) } - val, ok = pathParams["operator_address"] + val, ok = pathParams["oracle_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "operator_address") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "oracle_address") } - protoReq.OperatorAddress, err = runtime.String(val) + protoReq.OracleAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "operator_address", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "oracle_address", err) } msg, err := server.OracleRegistration(ctx, &protoReq) @@ -504,11 +504,11 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Oracles_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"panacea", "oracle", "v2", "oracles"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_Oracle_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"panacea", "oracle", "v2", "oracles", "operator_address"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Oracle_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"panacea", "oracle", "v2", "oracles", "oracle_address"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_OracleRegistrations_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"panacea", "oracle", "v2", "oracle_registrations"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_OracleRegistration_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"panacea", "oracle", "v2", "oracle_registrations", "unique_id", "operator_address"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_OracleRegistration_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5}, []string{"panacea", "oracle", "v2", "oracle_registrations", "unique_id", "oracle_address"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"panacea", "oracle", "v2", "params"}, "", runtime.AssumeColonVerbOpt(true))) ) diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 2363c40e..6a8fb127 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -35,7 +35,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgRegisterOracle defines the Msg/RegisterOracle request type. type MsgRegisterOracle struct { UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` - OperatorAddress string `protobuf:"bytes,2,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` NodePubKey []byte `protobuf:"bytes,3,opt,name=node_pub_key,json=nodePubKey,proto3" json:"node_pub_key,omitempty"` NodePubKeyRemoteReport []byte `protobuf:"bytes,4,opt,name=node_pub_key_remote_report,json=nodePubKeyRemoteReport,proto3" json:"node_pub_key_remote_report,omitempty"` TrustedBlockHeight int64 `protobuf:"varint,5,opt,name=trusted_block_height,json=trustedBlockHeight,proto3" json:"trusted_block_height,omitempty"` @@ -84,9 +84,9 @@ func (m *MsgRegisterOracle) GetUniqueId() string { return "" } -func (m *MsgRegisterOracle) GetOperatorAddress() string { +func (m *MsgRegisterOracle) GetOracleAddress() string { if m != nil { - return m.OperatorAddress + return m.OracleAddress } return "" } @@ -219,7 +219,7 @@ func (m *MsgApproveOracleRegistration) GetSignature() []byte { // ApproveOracleRegistration defines for oracle registration approval type ApproveOracleRegistration struct { UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` - TargetOperatorAddress string `protobuf:"bytes,2,opt,name=target_operator_address,json=targetOperatorAddress,proto3" json:"target_operator_address,omitempty"` + TargetOracleAddress string `protobuf:"bytes,2,opt,name=target_oracle_address,json=targetOracleAddress,proto3" json:"target_oracle_address,omitempty"` EncryptedOraclePrivKey []byte `protobuf:"bytes,3,opt,name=encrypted_oracle_priv_key,json=encryptedOraclePrivKey,proto3" json:"encrypted_oracle_priv_key,omitempty"` } @@ -263,9 +263,9 @@ func (m *ApproveOracleRegistration) GetUniqueId() string { return "" } -func (m *ApproveOracleRegistration) GetTargetOperatorAddress() string { +func (m *ApproveOracleRegistration) GetTargetOracleAddress() string { if m != nil { - return m.TargetOperatorAddress + return m.TargetOracleAddress } return "" } @@ -316,7 +316,7 @@ var xxx_messageInfo_MsgApproveOracleRegistrationResponse proto.InternalMessageIn // MsgUpdateOracleInfo defines the Msg/UpdateOracleInfo type MsgUpdateOracleInfo struct { - OperatorAddress string `protobuf:"bytes,1,opt,name=operator_address,json=operatorAddress,proto3" json:"operator_address,omitempty"` + OracleAddress string `protobuf:"bytes,1,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` Endpoint string `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` OracleCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=oracle_commission_rate,json=oracleCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"oracle_commission_rate"` } @@ -354,9 +354,9 @@ func (m *MsgUpdateOracleInfo) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateOracleInfo proto.InternalMessageInfo -func (m *MsgUpdateOracleInfo) GetOperatorAddress() string { +func (m *MsgUpdateOracleInfo) GetOracleAddress() string { if m != nil { - return m.OperatorAddress + return m.OracleAddress } return "" } @@ -418,52 +418,52 @@ func init() { func init() { proto.RegisterFile("panacea/oracle/v2/tx.proto", fileDescriptor_91b53ec53f5557f6) } var fileDescriptor_91b53ec53f5557f6 = []byte{ - // 718 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x4f, 0x13, 0x41, - 0x18, 0xc6, 0xbb, 0x54, 0x11, 0x46, 0xa2, 0xb0, 0x22, 0x6e, 0xb7, 0x58, 0x9a, 0x86, 0x10, 0x34, - 0xb0, 0x23, 0x35, 0xd1, 0xe8, 0x0d, 0xf4, 0x20, 0x21, 0x0d, 0x64, 0x13, 0x2f, 0x5e, 0x36, 0xb3, - 0xbb, 0x2f, 0xdb, 0x91, 0xee, 0xce, 0x30, 0x33, 0xdb, 0xd0, 0x0f, 0xe0, 0xdd, 0xbb, 0xdf, 0x40, - 0xbf, 0x85, 0x27, 0x8e, 0x1c, 0x8d, 0x07, 0x34, 0xf0, 0x45, 0x4c, 0x67, 0xb7, 0xa5, 0xf6, 0x0f, - 0xc1, 0xc4, 0x53, 0xbb, 0xef, 0xf3, 0x9b, 0x77, 0xde, 0x9d, 0xe7, 0xd9, 0x41, 0x36, 0x27, 0x09, - 0x09, 0x80, 0x60, 0x26, 0x48, 0xd0, 0x02, 0xdc, 0xae, 0x63, 0x75, 0xe2, 0x70, 0xc1, 0x14, 0x33, - 0x17, 0x72, 0xcd, 0xc9, 0x34, 0xa7, 0x5d, 0xb7, 0x17, 0x23, 0x16, 0x31, 0xad, 0xe2, 0xee, 0xbf, - 0x0c, 0xb4, 0x57, 0x22, 0xc6, 0xa2, 0x16, 0x60, 0xfd, 0xe4, 0xa7, 0x87, 0x58, 0xd1, 0x18, 0xa4, - 0x22, 0x31, 0xcf, 0x81, 0xa7, 0x01, 0x93, 0x31, 0x93, 0xd8, 0x27, 0x12, 0xf0, 0x71, 0x0a, 0xa2, - 0x83, 0xdb, 0x5b, 0x3e, 0x28, 0xb2, 0x85, 0x39, 0x89, 0x68, 0x42, 0x14, 0x65, 0x49, 0xce, 0x2e, - 0xe7, 0xcd, 0x08, 0xa7, 0x98, 0x24, 0x09, 0x53, 0x5a, 0x94, 0xb9, 0x5a, 0x19, 0x9d, 0x37, 0x9f, - 0x2e, 0x1f, 0x65, 0x54, 0x8f, 0x20, 0x01, 0x49, 0xf3, 0x06, 0xb5, 0x2f, 0x45, 0xb4, 0xd0, 0x90, - 0x91, 0x0b, 0x11, 0x95, 0x0a, 0xc4, 0xbe, 0xc6, 0xcc, 0x32, 0x9a, 0x4d, 0x13, 0x7a, 0x9c, 0x82, - 0x47, 0x43, 0xcb, 0xa8, 0x1a, 0xeb, 0xb3, 0xee, 0x4c, 0x56, 0xd8, 0x0d, 0xcd, 0x27, 0x68, 0x9e, - 0x71, 0x10, 0x44, 0x31, 0xe1, 0x91, 0x30, 0x14, 0x20, 0xa5, 0x35, 0xa5, 0x99, 0xfb, 0xbd, 0xfa, - 0x76, 0x56, 0x36, 0xab, 0x68, 0x2e, 0x61, 0x21, 0x78, 0x3c, 0xf5, 0xbd, 0x23, 0xe8, 0x58, 0xc5, - 0xaa, 0xb1, 0x3e, 0xe7, 0xa2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0x6b, 0xe3, 0x9b, 0x0d, 0x73, 0xb6, 0x73, 0x33, 0xae, 0xb7, 0xd7, 0xce, 0xee, 0xe9, - 0x45, 0xc5, 0x38, 0xbb, 0xa8, 0x18, 0xbf, 0x2f, 0x2a, 0xc6, 0xe7, 0xcb, 0x4a, 0xe1, 0xec, 0xb2, - 0x52, 0xf8, 0x71, 0x59, 0x29, 0x7c, 0xc0, 0x03, 0xc6, 0xc6, 0x10, 0xd2, 0xee, 0xa5, 0x85, 0xf3, - 0xe6, 0x9b, 0x01, 0x13, 0x80, 0x4f, 0x7a, 0x37, 0xbb, 0x76, 0xd9, 0x9f, 0xd6, 0xb7, 0xfa, 0xf3, - 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x85, 0xe1, 0x68, 0xc8, 0x06, 0x00, 0x00, + // 716 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x4f, 0xdb, 0x48, + 0x14, 0x8e, 0xc9, 0x2e, 0x0b, 0xb3, 0x2c, 0x02, 0xc3, 0x22, 0xc7, 0x61, 0x43, 0x14, 0xb1, 0x08, + 0xad, 0xc0, 0xb3, 0x64, 0x0f, 0xab, 0xdd, 0x1b, 0xb4, 0x87, 0x22, 0x14, 0x81, 0x2c, 0xf5, 0xd2, + 0x8b, 0x35, 0xb6, 0x1f, 0xce, 0x94, 0xd8, 0x33, 0xcc, 0x8c, 0x23, 0xf2, 0x03, 0x7a, 0xef, 0xad, + 0x3f, 0xa1, 0x52, 0x7f, 0x44, 0xcf, 0x1c, 0x39, 0x56, 0x3d, 0xd0, 0x0a, 0xfe, 0x48, 0x95, 0xf1, + 0x24, 0x04, 0x92, 0x20, 0x2a, 0xf5, 0x94, 0xf8, 0x7d, 0xdf, 0xfb, 0xde, 0xf3, 0x7b, 0x9f, 0x1f, + 0x72, 0x39, 0xc9, 0x48, 0x04, 0x04, 0x33, 0x41, 0xa2, 0x0e, 0xe0, 0x6e, 0x13, 0xab, 0x0b, 0x8f, + 0x0b, 0xa6, 0x98, 0xbd, 0x6c, 0x30, 0xaf, 0xc0, 0xbc, 0x6e, 0xd3, 0x5d, 0x4d, 0x58, 0xc2, 0x34, + 0x8a, 0xfb, 0xff, 0x0a, 0xa2, 0xbb, 0x91, 0x30, 0x96, 0x74, 0x00, 0xeb, 0xa7, 0x30, 0x3f, 0xc5, + 0x8a, 0xa6, 0x20, 0x15, 0x49, 0xb9, 0x21, 0xfc, 0x15, 0x31, 0x99, 0x32, 0x89, 0x43, 0x22, 0x01, + 0x9f, 0xe7, 0x20, 0x7a, 0xb8, 0xbb, 0x17, 0x82, 0x22, 0x7b, 0x98, 0x93, 0x84, 0x66, 0x44, 0x51, + 0x96, 0x19, 0xee, 0xba, 0x11, 0x23, 0x9c, 0x62, 0x92, 0x65, 0x4c, 0x69, 0x50, 0x1a, 0xb4, 0x36, + 0xde, 0xaf, 0xe9, 0xce, 0xb4, 0x32, 0x8e, 0x27, 0x90, 0x81, 0xa4, 0x46, 0xa0, 0xf1, 0xae, 0x8c, + 0x96, 0x5b, 0x32, 0xf1, 0x21, 0xa1, 0x52, 0x81, 0x38, 0xd6, 0x34, 0xbb, 0x8a, 0xe6, 0xf3, 0x8c, + 0x9e, 0xe7, 0x10, 0xd0, 0xd8, 0xb1, 0xea, 0xd6, 0xf6, 0xbc, 0x3f, 0x57, 0x04, 0x0e, 0x63, 0xfb, + 0x4f, 0xb4, 0x58, 0xa8, 0x05, 0x24, 0x8e, 0x05, 0x48, 0xe9, 0xcc, 0x68, 0xc6, 0x6f, 0x45, 0x74, + 0xbf, 0x08, 0xda, 0x75, 0xb4, 0x90, 0xb1, 0x18, 0x02, 0x9e, 0x87, 0xc1, 0x19, 0xf4, 0x9c, 0x72, + 0xdd, 0xda, 0x5e, 0xf0, 0x51, 0x3f, 0x76, 0x92, 0x87, 0x47, 0xd0, 0xb3, 0xff, 0x47, 0xee, 0x28,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0x6a, 0x1d, 0x1c, 0x5e, 0xde, 0xd4, + 0xac, 0xab, 0x9b, 0x9a, 0xf5, 0xf5, 0xa6, 0x66, 0xbd, 0xbd, 0xad, 0x95, 0xae, 0x6e, 0x6b, 0xa5, + 0x4f, 0xb7, 0xb5, 0xd2, 0x2b, 0x3c, 0xb2, 0xd8, 0x14, 0x62, 0xda, 0x3f, 0x56, 0xd8, 0x88, 0xef, + 0x46, 0x4c, 0x00, 0xbe, 0x18, 0x5c, 0x73, 0xbd, 0xe5, 0x70, 0x56, 0x5f, 0xf2, 0x7f, 0xbe, 0x05, + 0x00, 0x00, 0xff, 0xff, 0xe1, 0x73, 0xae, 0x44, 0xbc, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -687,10 +687,10 @@ func (m *MsgRegisterOracle) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddress))) + if len(m.OracleAddress) > 0 { + i -= len(m.OracleAddress) + copy(dAtA[i:], m.OracleAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OracleAddress))) i-- dAtA[i] = 0x12 } @@ -796,10 +796,10 @@ func (m *ApproveOracleRegistration) MarshalToSizedBuffer(dAtA []byte) (int, erro i-- dAtA[i] = 0x1a } - if len(m.TargetOperatorAddress) > 0 { - i -= len(m.TargetOperatorAddress) - copy(dAtA[i:], m.TargetOperatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.TargetOperatorAddress))) + if len(m.TargetOracleAddress) > 0 { + i -= len(m.TargetOracleAddress) + copy(dAtA[i:], m.TargetOracleAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.TargetOracleAddress))) i-- dAtA[i] = 0x12 } @@ -873,10 +873,10 @@ func (m *MsgUpdateOracleInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.OperatorAddress) > 0 { - i -= len(m.OperatorAddress) - copy(dAtA[i:], m.OperatorAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.OperatorAddress))) + if len(m.OracleAddress) > 0 { + i -= len(m.OracleAddress) + copy(dAtA[i:], m.OracleAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.OracleAddress))) i-- dAtA[i] = 0xa } @@ -927,7 +927,7 @@ func (m *MsgRegisterOracle) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.OperatorAddress) + l = len(m.OracleAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -991,7 +991,7 @@ func (m *ApproveOracleRegistration) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.TargetOperatorAddress) + l = len(m.TargetOracleAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1017,7 +1017,7 @@ func (m *MsgUpdateOracleInfo) Size() (n int) { } var l int _ = l - l = len(m.OperatorAddress) + l = len(m.OracleAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1108,7 +1108,7 @@ func (m *MsgRegisterOracle) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OracleAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1136,7 +1136,7 @@ func (m *MsgRegisterOracle) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + m.OracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -1579,7 +1579,7 @@ func (m *ApproveOracleRegistration) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetOperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TargetOracleAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1607,7 +1607,7 @@ func (m *ApproveOracleRegistration) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.TargetOperatorAddress = string(dAtA[iNdEx:postIndex]) + m.TargetOracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -1745,7 +1745,7 @@ func (m *MsgUpdateOracleInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OperatorAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OracleAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1773,7 +1773,7 @@ func (m *MsgUpdateOracleInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.OperatorAddress = string(dAtA[iNdEx:postIndex]) + m.OracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { From eeee097307e031587771883767e6628358dff585 Mon Sep 17 00:00:00 2001 From: gyuguen Date: Mon, 5 Dec 2022 11:50:03 +0900 Subject: [PATCH 08/21] fix --- third_party/proto/cosmos/staking/v1beta1/staking.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/third_party/proto/cosmos/staking/v1beta1/staking.proto b/third_party/proto/cosmos/staking/v1beta1/staking.proto index 0eadc75b..cacdbf78 100644 --- a/third_party/proto/cosmos/staking/v1beta1/staking.proto +++ b/third_party/proto/cosmos/staking/v1beta1/staking.proto @@ -85,8 +85,8 @@ message Validator { option (gogoproto.goproto_stringer) = false; option (gogoproto.goproto_getters) = false; - // oracle_address defines the address of the validator's operator; bech encoded in JSON. - string oracle_address = 1 [(gogoproto.moretags) = "yaml:\"oracle_address\""]; + // operator_address defines the address of the validator's operator; bech encoded in JSON. + string operator_address = 1 [(gogoproto.moretags) = "yaml:\"operator_address\""]; // consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. google.protobuf.Any consensus_pubkey = 2 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.moretags) = "yaml:\"consensus_pubkey\""]; From 7c6b72e884a5fcd46b9347d66dc274bb20e4baa0 Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Mon, 5 Dec 2022 15:00:02 +0900 Subject: [PATCH 09/21] feat: add skeleton code for oracle module --- proto/panacea/oracle/v2/genesis.proto | 1 + x/oracle/client/cli/query.go | 22 ++++ x/oracle/client/cli/tx.go | 22 ++++ x/oracle/genesis.go | 20 ++++ x/oracle/handler.go | 25 ++++ x/oracle/keeper/grpc_query.go | 5 + x/oracle/keeper/grpc_query_oracle.go | 32 +++++ x/oracle/keeper/keeper.go | 37 ++++++ x/oracle/keeper/msg_server.go | 15 +++ x/oracle/keeper/msg_server_oracle.go | 22 ++++ x/oracle/keeper/params.go | 16 +++ x/oracle/module.go | 166 ++++++++++++++++++++++++++ x/oracle/types/codec.go | 28 +++++ x/oracle/types/genesis.go | 49 ++++++++ x/oracle/types/genesis.pb.go | 102 ++++++++++++---- x/oracle/types/keys.go | 18 +++ x/oracle/types/oracle.go | 11 ++ x/oracle/types/params.go | 95 +++++++++++++++ 18 files changed, 662 insertions(+), 24 deletions(-) create mode 100644 x/oracle/client/cli/query.go create mode 100644 x/oracle/client/cli/tx.go create mode 100644 x/oracle/genesis.go create mode 100644 x/oracle/handler.go create mode 100644 x/oracle/keeper/grpc_query.go create mode 100644 x/oracle/keeper/grpc_query_oracle.go create mode 100644 x/oracle/keeper/keeper.go create mode 100644 x/oracle/keeper/msg_server.go create mode 100644 x/oracle/keeper/msg_server_oracle.go create mode 100644 x/oracle/keeper/params.go create mode 100644 x/oracle/module.go create mode 100644 x/oracle/types/codec.go create mode 100644 x/oracle/types/genesis.go create mode 100644 x/oracle/types/keys.go create mode 100644 x/oracle/types/oracle.go create mode 100644 x/oracle/types/params.go diff --git a/proto/panacea/oracle/v2/genesis.proto b/proto/panacea/oracle/v2/genesis.proto index 25f5b2b3..7b8b0ebf 100644 --- a/proto/panacea/oracle/v2/genesis.proto +++ b/proto/panacea/oracle/v2/genesis.proto @@ -11,6 +11,7 @@ import "panacea/oracle/v2/oracle.proto"; message GenesisState { repeated Oracle oracles = 1 [(gogoproto.nullable) = false]; repeated OracleRegistration oracle_registrations = 2 [(gogoproto.nullable) = false]; + Params params = 3 [(gogoproto.nullable) = false]; } // Params defines the oracle module's params. diff --git a/x/oracle/client/cli/query.go b/x/oracle/client/cli/query.go new file mode 100644 index 00000000..043255c8 --- /dev/null +++ b/x/oracle/client/cli/query.go @@ -0,0 +1,22 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/medibloc/panacea-core/v2/x/oracle/types" + "github.com/spf13/cobra" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group oracle queries under a subcommand + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + return cmd +} diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go new file mode 100644 index 00000000..bbd4017e --- /dev/null +++ b/x/oracle/client/cli/tx.go @@ -0,0 +1,22 @@ +package cli + +import ( + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/medibloc/panacea-core/v2/x/oracle/types" + "github.com/spf13/cobra" +) + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + return cmd +} diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go new file mode 100644 index 00000000..ecf6eaf8 --- /dev/null +++ b/x/oracle/genesis.go @@ -0,0 +1,20 @@ +package oracle + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/medibloc/panacea-core/v2/x/oracle/keeper" + "github.com/medibloc/panacea-core/v2/x/oracle/types" +) + +// InitGenesis initializes the capability module's state from a provided genesis +// state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { + //TODO implement me + panic("implement me") +} + +// ExportGenesis returns the capability module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + //TODO implement me + panic("implement me") +} diff --git a/x/oracle/handler.go b/x/oracle/handler.go new file mode 100644 index 00000000..2e54bfed --- /dev/null +++ b/x/oracle/handler.go @@ -0,0 +1,25 @@ +package oracle + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/medibloc/panacea-core/v2/x/oracle/keeper" + "github.com/medibloc/panacea-core/v2/x/oracle/types" +) + +// NewHandler ... +func NewHandler(k keeper.Keeper) sdk.Handler { + //msgServer := keeper.NewMsgServerImpl(k) + + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + + switch msg := msg.(type) { + default: + errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) + return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + } + } +} diff --git a/x/oracle/keeper/grpc_query.go b/x/oracle/keeper/grpc_query.go new file mode 100644 index 00000000..9bf6c761 --- /dev/null +++ b/x/oracle/keeper/grpc_query.go @@ -0,0 +1,5 @@ +package keeper + +import "github.com/medibloc/panacea-core/v2/x/oracle/types" + +var _ types.QueryServer = Keeper{} diff --git a/x/oracle/keeper/grpc_query_oracle.go b/x/oracle/keeper/grpc_query_oracle.go new file mode 100644 index 00000000..34b75319 --- /dev/null +++ b/x/oracle/keeper/grpc_query_oracle.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "context" + + "github.com/medibloc/panacea-core/v2/x/oracle/types" +) + +func (k Keeper) Oracles(ctx context.Context, request *types.QueryOraclesRequest) (*types.QueryOraclesResponse, error) { + //TODO implement me + panic("implement me") +} + +func (k Keeper) Oracle(ctx context.Context, request *types.QueryOracleRequest) (*types.QueryOracleResponse, error) { + //TODO implement me + panic("implement me") +} + +func (k Keeper) OracleRegistrations(ctx context.Context, request *types.QueryOracleRegistrationsRequest) (*types.QueryOracleRegistrationsResponse, error) { + //TODO implement me + panic("implement me") +} + +func (k Keeper) OracleRegistration(ctx context.Context, request *types.QueryOracleRegistrationRequest) (*types.QueryOracleRegistrationResponse, error) { + //TODO implement me + panic("implement me") +} + +func (k Keeper) Params(ctx context.Context, request *types.QueryOracleParamsRequest) (*types.QueryParamsResponse, error) { + //TODO implement me + panic("implement me") +} diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go new file mode 100644 index 00000000..b651643f --- /dev/null +++ b/x/oracle/keeper/keeper.go @@ -0,0 +1,37 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/medibloc/panacea-core/v2/x/oracle/types" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type ( + Keeper struct { + cdc codec.Codec + storeKey sdk.StoreKey + memKey sdk.StoreKey + + paramSpace paramtypes.Subspace + } +) + +func NewKeeper( + cdc codec.Codec, + storeKey, + memKey sdk.StoreKey, + paramSpace paramtypes.Subspace, +) *Keeper { + if !paramSpace.HasKeyTable() { + paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) + } + + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + paramSpace: paramSpace, + } +} diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go new file mode 100644 index 00000000..343409cb --- /dev/null +++ b/x/oracle/keeper/msg_server.go @@ -0,0 +1,15 @@ +package keeper + +import "github.com/medibloc/panacea-core/v2/x/oracle/types" + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/x/oracle/keeper/msg_server_oracle.go b/x/oracle/keeper/msg_server_oracle.go new file mode 100644 index 00000000..db1e12eb --- /dev/null +++ b/x/oracle/keeper/msg_server_oracle.go @@ -0,0 +1,22 @@ +package keeper + +import ( + "context" + + "github.com/medibloc/panacea-core/v2/x/oracle/types" +) + +func (m msgServer) RegisterOracle(ctx context.Context, oracle *types.MsgRegisterOracle) (*types.MsgRegisterOracleResponse, error) { + //TODO implement me + panic("implement me") +} + +func (m msgServer) ApproveOracleRegistration(ctx context.Context, registration *types.MsgApproveOracleRegistration) (*types.MsgApproveOracleRegistrationResponse, error) { + //TODO implement me + panic("implement me") +} + +func (m msgServer) UpdateOracleInfo(ctx context.Context, info *types.MsgUpdateOracleInfo) (*types.MsgUpdateOracleInfoResponse, error) { + //TODO implement me + panic("implement me") +} diff --git a/x/oracle/keeper/params.go b/x/oracle/keeper/params.go new file mode 100644 index 00000000..7c152278 --- /dev/null +++ b/x/oracle/keeper/params.go @@ -0,0 +1,16 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/medibloc/panacea-core/v2/x/oracle/types" +) + +func (k Keeper) GetParams(ctx sdk.Context) types.Params { + var params types.Params + k.paramSpace.GetParamSet(ctx, ¶ms) + return params +} + +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSpace.SetParamSet(ctx, ¶ms) +} diff --git a/x/oracle/module.go b/x/oracle/module.go new file mode 100644 index 00000000..40bd42e7 --- /dev/null +++ b/x/oracle/module.go @@ -0,0 +1,166 @@ +package oracle + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/gorilla/mux" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/medibloc/panacea-core/v2/x/oracle/client/cli" + "github.com/medibloc/panacea-core/v2/x/oracle/keeper" + "github.com/medibloc/panacea-core/v2/x/oracle/types" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface for the capability module. +type AppModuleBasic struct { + cdc codec.Codec +} + +func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the capability module's name. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +func (AppModuleBasic) RegisterCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers the module's interface types +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns the capability module's default genesis state. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis performs genesis state validation for the capability module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterRESTRoutes registers the capability module's REST service handlers. +func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router) { +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err != nil { + panic("Error RegisterGRPCGatewayRoutes") + } +} + +// GetTxCmd returns the capability module's root tx command. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the capability module's root query command. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface for the capability module. +type AppModule struct { + AppModuleBasic + keeper keeper.Keeper +} + +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// Name returns the capability module's name. +func (am AppModule) Name() string { + return am.AppModuleBasic.Name() +} + +// Route returns the capability module's message routing key. +func (am AppModule) Route() sdk.Route { + return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) +} + +// QuerierRoute returns the capability module's query routing key. +func (AppModule) QuerierRoute() string { return types.QuerierRoute } + +// LegacyQuerierHandler returns the capability module's Querier. +func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { + return nil +} + +// RegisterServices registers a GRPC query service to respond to the +// module-specific GRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// RegisterInvariants registers the capability module's invariants. +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} + +// InitGenesis performs the capability module's genesis initialization It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate { + var genState types.GenesisState + // Initialize global index to index in genesis state + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) + + return []abci.ValidatorUpdate{} +} + +// ExportGenesis returns the capability module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} + +// EndBlock executes all ABCI EndBlock logic respective to the capability module. It +// returns no validator updates. +func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { + return []abci.ValidatorUpdate{} +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go new file mode 100644 index 00000000..efb17925 --- /dev/null +++ b/x/oracle/types/codec.go @@ -0,0 +1,28 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgRegisterOracle{}, "oracle/RegisterOracle", nil) + cdc.RegisterConcrete(&MsgApproveOracleRegistration{}, "oracle/ApproveOracleRegistration", nil) + cdc.RegisterConcrete(&MsgUpdateOracleInfo{}, "oracle/UpdateOracleInfo", nil) +} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgRegisterOracle{}, + &MsgApproveOracleRegistration{}, + &MsgUpdateOracleInfo{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) diff --git a/x/oracle/types/genesis.go b/x/oracle/types/genesis.go new file mode 100644 index 00000000..d5796be9 --- /dev/null +++ b/x/oracle/types/genesis.go @@ -0,0 +1,49 @@ +package types + +import ( + "encoding/json" + + "github.com/cosmos/cosmos-sdk/codec" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +// DefaultGenesis returns the default Capability genesis state +func DefaultGenesis() *GenesisState { + return &GenesisState{ + Oracles: []Oracle{}, + OracleRegistrations: []OracleRegistration{}, + Params: DefaultParams(), + } +} + +func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMessage) *GenesisState { + var genesisState GenesisState + + if appState[ModuleName] != nil { + cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + } + + return &genesisState +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (m GenesisState) Validate() error { + + for _, oracle := range m.Oracles { + if err := oracle.ValidateBasic(); err != nil { + return err + } + } + for _, oracleRegistration := range m.OracleRegistrations { + if err := oracleRegistration.ValidateBasic(); err != nil { + return err + } + } + + if err := m.Params.Validate(); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, err.Error()) + } + + return nil +} diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index 8956d4de..e36006ed 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -28,6 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { Oracles []Oracle `protobuf:"bytes,1,rep,name=oracles,proto3" json:"oracles"` OracleRegistrations []OracleRegistration `protobuf:"bytes,2,rep,name=oracle_registrations,json=oracleRegistrations,proto3" json:"oracle_registrations"` + Params Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -77,6 +78,13 @@ func (m *GenesisState) GetOracleRegistrations() []OracleRegistration { return nil } +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + // Params defines the oracle module's params. type Params struct { // A base64-encoded oracle public key which is paired with an oracle private key generated in SGX by the first oracle. @@ -151,30 +159,31 @@ func init() { func init() { proto.RegisterFile("panacea/oracle/v2/genesis.proto", fileDescriptor_321e5b447e46614a) } var fileDescriptor_321e5b447e46614a = []byte{ - // 357 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0xc1, 0x4a, 0xeb, 0x40, - 0x14, 0x86, 0x33, 0xed, 0xa5, 0xf7, 0x76, 0xee, 0x85, 0x4b, 0x63, 0x17, 0xb1, 0x4a, 0x5a, 0x0a, - 0x42, 0x11, 0xcc, 0x40, 0x5d, 0xb9, 0x71, 0xd1, 0x8d, 0x94, 0x2e, 0x2c, 0x71, 0xe7, 0xc2, 0x30, - 0x49, 0x8f, 0x71, 0x30, 0xc9, 0xc4, 0x99, 0x49, 0x31, 0x6f, 0xa1, 0x8f, 0xe1, 0x9b, 0x74, 0xd9, - 0xa5, 0x2b, 0x91, 0xf6, 0x45, 0xa4, 0x33, 0xa9, 0x0a, 0xc5, 0xdd, 0x99, 0xf3, 0x7f, 0xe7, 0xff, - 0x0f, 0x73, 0x70, 0x37, 0xa7, 0x19, 0x8d, 0x80, 0x12, 0x2e, 0x68, 0x94, 0x00, 0x99, 0x0f, 0x49, - 0x0c, 0x19, 0x48, 0x26, 0xbd, 0x5c, 0x70, 0xc5, 0xed, 0x56, 0x05, 0x78, 0x06, 0xf0, 0xe6, 0xc3, - 0x4e, 0x3b, 0xe6, 0x31, 0xd7, 0x2a, 0xd9, 0x54, 0x06, 0xec, 0x74, 0x63, 0xce, 0xe3, 0x04, 0x88, - 0x7e, 0x85, 0xc5, 0x2d, 0x51, 0x2c, 0x05, 0xa9, 0x68, 0x9a, 0x57, 0x80, 0xbb, 0x1b, 0x55, 0x79, - 0x6a, 0xbd, 0xff, 0x82, 0xf0, 0xbf, 0x0b, 0x93, 0x7d, 0xa5, 0xa8, 0x02, 0xfb, 0x0c, 0xff, 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 0x17, 0x39, 0xfd, 0x08, 0x00, 0x00, 0xff, 0xff, 0x90, 0xc1, 0x79, - 0x70, 0x1e, 0x02, 0x00, 0x00, + // 374 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x41, 0x6b, 0xdb, 0x30, + 0x14, 0xc7, 0xad, 0x64, 0x64, 0x8b, 0x36, 0x18, 0xf1, 0x72, 0xf0, 0xb2, 0xe1, 0x84, 0xc0, 0x20, + 0x0c, 0x66, 0x41, 0x76, 0x18, 0xbb, 0xec, 0x90, 0xcb, 0x08, 0x39, 0x2c, 0x78, 0xb7, 0x1e, 0x6a, + 0x64, 0xe7, 0xd5, 0x15, 0xb5, 0x2d, 0x57, 0x92, 0x43, 0xfd, 0x2d, 0xda, 0x6f, 0x95, 0x63, 0x8e, + 0x3d, 0x95, 0xe2, 0x7c, 0x91, 0x12, 0x49, 0x69, 0x0b, 0x21, 0xb7, 0x27, 0xfd, 0x7f, 0xef, 0xff, + 0xfe, 0x8f, 0x87, 0x87, 0x25, 0x2d, 0x68, 0x02, 0x94, 0x70, 0x41, 0x93, 0x0c, 0xc8, 0x7a, 0x4a, + 0x52, 0x28, 0x40, 0x32, 0x19, 0x94, 0x82, 0x2b, 0xee, 0xf6, 0x2c, 0x10, 0x18, 0x20, 0x58, 0x4f, + 0x07, 0xfd, 0x94, 0xa7, 0x5c, 0xab, 0x64, 0x5f, 0x19, 0x70, 0x30, 0x4c, 0x39, 0x4f, 0x33, 0x20, + 0xfa, 0x15, 0x57, 0x17, 0x44, 0xb1, 0x1c, 0xa4, 0xa2, 0x79, 0x69, 0x01, 0xff, 0x78, 0x94, 0xf5, + 0xd4, 0xfa, 0xb8, 0x41, 0xf8, 0xc3, 0x5f, 0x33, 0xfb, 0xbf, 0xa2, 0x0a, 0xdc, 0xdf, 0xf8, 0xad, + 0x01, 0xa4, 0x87, 0x46, 0xed, 0xc9, 0xfb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x72, 0x73, 0xb8, 0xa6, + 0xaa, 0x4b, 0x90, 0x71, 0x47, 0x9f, 0xf2, 0xe7, 0x53, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x82, + 0xde, 0xcf, 0x57, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -197,6 +206,16 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a if len(m.OracleRegistrations) > 0 { for iNdEx := len(m.OracleRegistrations) - 1; iNdEx >= 0; iNdEx-- { { @@ -301,6 +320,8 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -428,6 +449,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go new file mode 100644 index 00000000..28e943d6 --- /dev/null +++ b/x/oracle/types/keys.go @@ -0,0 +1,18 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "oracle" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey is the message route for slashing + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName + + // MemStoreKey defines the in-memory store key + MemStoreKey = "mem_oracle" +) diff --git a/x/oracle/types/oracle.go b/x/oracle/types/oracle.go new file mode 100644 index 00000000..db3432b5 --- /dev/null +++ b/x/oracle/types/oracle.go @@ -0,0 +1,11 @@ +package types + +func (m Oracle) ValidateBasic() error { + //TODO implement me + panic("implement me") +} + +func (m OracleRegistration) ValidateBasic() error { + //TODO implement me + panic("implement me") +} diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go new file mode 100644 index 00000000..e5fdb39b --- /dev/null +++ b/x/oracle/types/params.go @@ -0,0 +1,95 @@ +package types + +import ( + "encoding/base64" + "fmt" + + "github.com/btcsuite/btcd/btcec" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var ( + KeyOraclePublicKey = []byte("OraclePublicKey") + KeyOraclePubKeyRemoteReport = []byte("OraclePubKeyRemoteReport") + KeyUniqueID = []byte("UniqueID") +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +func DefaultParams() Params { + return Params{ + OraclePublicKey: "", + OraclePubKeyRemoteReport: "", + UniqueId: "", + } +} + +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyOraclePublicKey, &p.OraclePublicKey, validateOraclePublicKey), + paramtypes.NewParamSetPair(KeyOraclePubKeyRemoteReport, &p.OraclePubKeyRemoteReport, validateOraclePubKeyRemoteReport), + paramtypes.NewParamSetPair(KeyUniqueID, &p.UniqueId, validateUniqueID), + } +} + +func (p Params) Validate() error { + if err := validateOraclePublicKey(p.OraclePublicKey); err != nil { + return err + } + if err := validateOraclePubKeyRemoteReport(p.OraclePubKeyRemoteReport); err != nil { + return err + } + if err := validateUniqueID(p.UniqueId); err != nil { + return err + } + + return nil +} + +func validateOraclePublicKey(i interface{}) error { + pubKeyBase64, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if pubKeyBase64 != "" { + oraclePubKeyBz, err := base64.StdEncoding.DecodeString(pubKeyBase64) + if err != nil { + return err + } + + if _, err := btcec.ParsePubKey(oraclePubKeyBz, btcec.S256()); err != nil { + return err + } + } + + return nil +} + +func validateOraclePubKeyRemoteReport(i interface{}) error { + reportBase64, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if reportBase64 != "" { + if _, err := base64.StdEncoding.DecodeString(reportBase64); err != nil { + return err + } + } + + return nil +} + +func validateUniqueID(i interface{}) error { + _, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + return nil +} From 1c32ec0a7bab09b9a250e2e54d2727c35f40cf05 Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Mon, 5 Dec 2022 15:24:54 +0900 Subject: [PATCH 10/21] fix --- x/oracle/handler.go | 11 +++++++- x/oracle/types/message_oracle.go | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 x/oracle/types/message_oracle.go diff --git a/x/oracle/handler.go b/x/oracle/handler.go index 2e54bfed..5ac37fb8 100644 --- a/x/oracle/handler.go +++ b/x/oracle/handler.go @@ -11,12 +11,21 @@ import ( // NewHandler ... func NewHandler(k keeper.Keeper) sdk.Handler { - //msgServer := keeper.NewMsgServerImpl(k) + msgServer := keeper.NewMsgServerImpl(k) return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { ctx = ctx.WithEventManager(sdk.NewEventManager()) switch msg := msg.(type) { + case *types.MsgRegisterOracle: + res, err := msgServer.RegisterOracle(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) + //case *types.MsgApproveOracleRegistration: + // res, err := msgServer.ApproveOracleRegistration(sdk.WrapSDKContext(ctx), msg) + // return sdk.WrapServiceResult(ctx, res, err) + //case *types.MsgUpdateOracleInfo: + // res, err := msgServer.UpdateOracleInfo(sdk.WrapSDKContext(ctx), msg) + // return sdk.WrapServiceResult(ctx, res, err) default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) diff --git a/x/oracle/types/message_oracle.go b/x/oracle/types/message_oracle.go new file mode 100644 index 00000000..4a1c1a40 --- /dev/null +++ b/x/oracle/types/message_oracle.go @@ -0,0 +1,46 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgRegisterOracle{} + +func NewMsgRegisterOracle(uniqueID, oracleAddress, endpoint string, nodePubKey, nodePubKeyRemoteReport []byte, trustedBlockHeight int64, trustedBlockHash []byte, oracleCommissionRate sdk.Dec) *MsgRegisterOracle { + return &MsgRegisterOracle{ + UniqueId: uniqueID, + OracleAddress: oracleAddress, + NodePubKey: nodePubKey, + NodePubKeyRemoteReport: nodePubKeyRemoteReport, + TrustedBlockHeight: trustedBlockHeight, + TrustedBlockHash: trustedBlockHash, + Endpoint: endpoint, + OracleCommissionRate: oracleCommissionRate, + } +} + +func (m *MsgRegisterOracle) Route() string { + return RouterKey +} + +func (m *MsgRegisterOracle) Type() string { + return "RegisterOracle" +} + +func (m *MsgRegisterOracle) ValidateBasic() error { + + return nil +} + +func (m *MsgRegisterOracle) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(m) + return sdk.MustSortJSON(bz) +} + +func (m *MsgRegisterOracle) GetSigners() []sdk.AccAddress { + oracleAddress, err := sdk.AccAddressFromBech32(m.OracleAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{oracleAddress} +} From a28fd6d4a559726876b5f29f068e0e39b381fc27 Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Mon, 5 Dec 2022 18:04:32 +0900 Subject: [PATCH 11/21] feat: add ApproveOracleRegistration keeper function --- x/oracle/keeper/oracle.go | 120 ++++++++++++++++++++++++++++++++++++++ x/oracle/types/errors.go | 11 ++++ x/oracle/types/events.go | 8 +++ x/oracle/types/keys.go | 26 +++++++++ x/oracle/types/params.go | 14 +++++ 5 files changed, 179 insertions(+) create mode 100644 x/oracle/keeper/oracle.go create mode 100644 x/oracle/types/errors.go create mode 100644 x/oracle/types/events.go diff --git a/x/oracle/keeper/oracle.go b/x/oracle/keeper/oracle.go new file mode 100644 index 00000000..f7628315 --- /dev/null +++ b/x/oracle/keeper/oracle.go @@ -0,0 +1,120 @@ +package keeper + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/medibloc/panacea-core/v2/x/oracle/types" + "github.com/tendermint/tendermint/crypto/secp256k1" +) + +func (k Keeper) HasOracle(ctx sdk.Context, address string) (bool, error) { + store := ctx.KVStore(k.storeKey) + accAddr, err := sdk.AccAddressFromBech32(address) + if err != nil { + return false, err + } + + return store.Has(types.GetOracleKey(accAddr)), nil +} + +func (k Keeper) SetOracle(ctx sdk.Context, oracle *types.Oracle) error { + store := ctx.KVStore(k.storeKey) + accAddr, err := sdk.AccAddressFromBech32(oracle.OracleAddress) + if err != nil { + return err + } + key := types.GetOracleKey(accAddr) + bz, err := k.cdc.MarshalLengthPrefixed(oracle) + if err != nil { + return err + } + + store.Set(key, bz) + + return nil +} + +func (k Keeper) GetOracleRegistration(ctx sdk.Context, uniqueID, address string) (*types.OracleRegistration, error) { + store := ctx.KVStore(k.storeKey) + accAddr, err := sdk.AccAddressFromBech32(address) + if err != nil { + return nil, err + } + key := types.GetOracleRegistrationKey(uniqueID, accAddr) + bz := store.Get(key) + if bz == nil { + return nil, types.ErrOracleRegistrationNotFound + } + + oracleRegistration := &types.OracleRegistration{} + + err = k.cdc.UnmarshalLengthPrefixed(bz, oracleRegistration) + if err != nil { + return nil, err + } + + return oracleRegistration, nil +} + +func (k Keeper) ApproveOracleRegistration(ctx sdk.Context, msg *types.MsgApproveOracleRegistration) error { + + if err := k.validateApproveOracleRegistration(ctx, msg); err != nil { + return fmt.Errorf("invalid oracle private key signature") + } + + oracleRegistration, err := k.GetOracleRegistration(ctx, msg.ApproveOracleRegistration.UniqueId, msg.ApproveOracleRegistration.TargetOracleAddress) + if err != nil { + return err + } + + newOracle := &types.Oracle{ + OracleAddress: msg.ApproveOracleRegistration.TargetOracleAddress, + UniqueId: msg.ApproveOracleRegistration.UniqueId, + Endpoint: oracleRegistration.Endpoint, + OracleCommissionRate: oracleRegistration.OracleCommissionRate, + } + + if err := k.SetOracle(ctx, newOracle); err != nil { + return err + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeApproveOracleRegistration, + sdk.NewAttribute(types.AttributeKeyOracleAddress, msg.ApproveOracleRegistration.TargetOracleAddress), + sdk.NewAttribute(types.AttributeKeyEncryptedOraclePrivKey, string(msg.ApproveOracleRegistration.EncryptedOraclePrivKey)), + ), + ) + + return nil + +} + +// validateApproveOracleRegistration checks signature +func (k Keeper) validateApproveOracleRegistration(ctx sdk.Context, msg *types.MsgApproveOracleRegistration) interface{} { + + params := k.GetParams(ctx) + targetOracleAddress := msg.ApproveOracleRegistration.TargetOracleAddress + + if msg.ApproveOracleRegistration.UniqueId != params.UniqueId { + return types.ErrInvalidUniqueId + } + + ApproveOracleRegistrationBz := k.cdc.MustMarshal(msg.ApproveOracleRegistration) + + oraclePubKeyBz := k.GetParams(ctx).MustDecodeOraclePublicKey() + if !secp256k1.PubKey(oraclePubKeyBz).VerifySignature(ApproveOracleRegistrationBz, msg.Signature) { + return fmt.Errorf("failed to signature validation") + } + + hasOracle, err := k.HasOracle(ctx, targetOracleAddress) + if err != nil { + return err + } + if hasOracle { + return fmt.Errorf("oracle address(%v) is already registered", targetOracleAddress) + } + + return nil +} diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go new file mode 100644 index 00000000..32a8cff9 --- /dev/null +++ b/x/oracle/types/errors.go @@ -0,0 +1,11 @@ +package types + +import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + +var ( + ErrInvalidUniqueId = sdkerrors.Register(ModuleName, 1, "invalid unique id") + ErrGetOracle = sdkerrors.Register(ModuleName, 2, "error while get oracle") + ErrGetOracleRegistration = sdkerrors.Register(ModuleName, 3, "error while get oracleRegistration") + + ErrOracleRegistrationNotFound = sdkerrors.Register(ModuleName, 4, "oracle registration not found") +) diff --git a/x/oracle/types/events.go b/x/oracle/types/events.go new file mode 100644 index 00000000..860a0b14 --- /dev/null +++ b/x/oracle/types/events.go @@ -0,0 +1,8 @@ +package types + +const ( + EventTypeApproveOracleRegistration = "approve_oracle_registration" + + AttributeKeyOracleAddress = "oracle_address" + AttributeKeyEncryptedOraclePrivKey = "encrypted_oracle_priv_key" +) diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index 28e943d6..229e939c 100644 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -1,5 +1,11 @@ package types +import ( + "bytes" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + const ( // ModuleName defines the module name ModuleName = "oracle" @@ -16,3 +22,23 @@ const ( // MemStoreKey defines the in-memory store key MemStoreKey = "mem_oracle" ) + +var ( + // OraclesKey defines key to store oracle + OraclesKey = []byte{0x01} + OracleRegistrationKey = []byte{0x02} + + IndexSeparator = []byte{0xFF} +) + +func GetOracleKey(address sdk.AccAddress) []byte { + return append(OraclesKey, address...) +} + +func GetOracleRegistrationKey(uniqueID string, address sdk.AccAddress) []byte { + return append(OracleRegistrationKey, CombineKeys([]byte(uniqueID), address)...) +} + +func CombineKeys(keys ...[]byte) []byte { + return bytes.Join(keys, IndexSeparator) +} diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index e5fdb39b..5f894ee6 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -93,3 +93,17 @@ func validateUniqueID(i interface{}) error { return nil } + +// MustDecodeOraclePublicKey decodes a base64-encoded Params.OraclePublicKey. +// It panics if the decoding is failed, assuming that the Params was already validated by Params.Validate(). +func (p Params) MustDecodeOraclePublicKey() []byte { + return mustDecodeBase64Str(p.OraclePublicKey) +} + +func mustDecodeBase64Str(s string) []byte { + decoded, err := base64.StdEncoding.DecodeString(s) + if err != nil { + panic(err) + } + return decoded +} From 355133d34e66fe091490364c9e3034bb57a1539c Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Wed, 7 Dec 2022 11:10:37 +0900 Subject: [PATCH 12/21] feat: add test code --- proto/panacea/datadeal/v2/consent.proto | 22 - proto/panacea/oracle/v2/tx.proto | 5 +- types/testsuite/suite.go | 16 + x/datadeal/types/consent.pb.go | 749 ------------------------ x/oracle/keeper/oracle.go | 161 +++-- x/oracle/keeper/oracle_test.go | 136 +++++ x/oracle/types/codec.go | 2 + x/oracle/types/errors.go | 11 +- x/oracle/types/events.go | 2 + x/oracle/types/message_oracle.go | 102 ++++ x/oracle/types/oracle.go | 87 ++- x/oracle/types/params.go | 2 +- x/oracle/types/tx.pb.go | 152 +++-- 13 files changed, 571 insertions(+), 876 deletions(-) delete mode 100644 proto/panacea/datadeal/v2/consent.proto delete mode 100644 x/datadeal/types/consent.pb.go create mode 100644 x/oracle/keeper/oracle_test.go diff --git a/proto/panacea/datadeal/v2/consent.proto b/proto/panacea/datadeal/v2/consent.proto deleted file mode 100644 index 22650913..00000000 --- a/proto/panacea/datadeal/v2/consent.proto +++ /dev/null @@ -1,22 +0,0 @@ -syntax = "proto3"; -package panacea.datadeal.v2; - -option go_package = "github.com/medibloc/panacea-core/x/datadeal/types"; - -import "gogoproto/gogo.proto"; -import "panacea/datadeal/v2/deal.proto"; - -// Certificate defines a certificate with signature -message Certificate { - UnsignedCertificate unsigned_certificate = 1; - bytes signature = 2; -} - -// UnsignedCertificate defines a certificate information -message UnsignedCertificate { - string cid = 1; - string oracle_address = 2; - int64 deal_id = 3; - string provider_address = 4; - string data_hash = 5; -} \ No newline at end of file diff --git a/proto/panacea/oracle/v2/tx.proto b/proto/panacea/oracle/v2/tx.proto index 0250e87d..939058ae 100644 --- a/proto/panacea/oracle/v2/tx.proto +++ b/proto/panacea/oracle/v2/tx.proto @@ -47,8 +47,9 @@ message MsgApproveOracleRegistration { // ApproveOracleRegistration defines for oracle registration approval message ApproveOracleRegistration { string unique_id = 1; - string target_oracle_address = 2; - bytes encrypted_oracle_priv_key = 3; + string approver_oracle_address = 2; + string target_oracle_address = 3; + bytes encrypted_oracle_priv_key = 4; } // MsgApproveOracleRegistrationResponse defines the Msg/ApproveOracleRegistration diff --git a/types/testsuite/suite.go b/types/testsuite/suite.go index 5dff6c73..4b4f57aa 100644 --- a/types/testsuite/suite.go +++ b/types/testsuite/suite.go @@ -34,6 +34,8 @@ import ( aoltypes "github.com/medibloc/panacea-core/v2/x/aol/types" burnkeeper "github.com/medibloc/panacea-core/v2/x/burn/keeper" burntypes "github.com/medibloc/panacea-core/v2/x/burn/types" + oraclekeeper "github.com/medibloc/panacea-core/v2/x/oracle/keeper" + oracletypes "github.com/medibloc/panacea-core/v2/x/oracle/types" "github.com/stretchr/testify/suite" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/tendermint/tendermint/libs/log" @@ -52,6 +54,7 @@ type TestSuite struct { suite.Suite Ctx sdk.Context + Cdc params.EncodingConfig AccountKeeper authkeeper.AccountKeeper StakingKeeper stakingkeeper.Keeper @@ -65,6 +68,8 @@ type TestSuite struct { TransferKeeper ibctransferkeeper.Keeper DIDMsgServer didtypes.MsgServer DIDKeeper didkeeper.Keeper + OracleKeeper oraclekeeper.Keeper + OracleMsgServer oracletypes.MsgServer WasmKeeper wasm.Keeper UpgradeKeeper upgradekeeper.Keeper } @@ -76,6 +81,7 @@ func (suite *TestSuite) SetupTest() { banktypes.StoreKey, paramstypes.StoreKey, didtypes.StoreKey, + oracletypes.StoreKey, wasm.StoreKey, ibchost.StoreKey, capabilitytypes.StoreKey, @@ -202,6 +208,15 @@ func (suite *TestSuite) SetupTest() { memKeys[didtypes.MemStoreKey], ) suite.DIDMsgServer = didkeeper.NewMsgServerImpl(suite.DIDKeeper) + + suite.OracleKeeper = *oraclekeeper.NewKeeper( + cdc.Marshaler, + keyParams[oracletypes.StoreKey], + memKeys[oracletypes.MemStoreKey], + paramsKeeper.Subspace(oracletypes.ModuleName), + ) + + suite.OracleMsgServer = oraclekeeper.NewMsgServerImpl(suite.OracleKeeper) } func (suite *TestSuite) BeforeTest(suiteName, testName string) { @@ -218,6 +233,7 @@ func newTestCodec() params.EncodingConfig { authtypes.RegisterInterfaces(interfaceRegistry) banktypes.RegisterInterfaces(interfaceRegistry) didtypes.RegisterInterfaces(interfaceRegistry) + oracletypes.RegisterInterfaces(interfaceRegistry) marshaler := codec.NewProtoCodec(interfaceRegistry) return params.EncodingConfig{ diff --git a/x/datadeal/types/consent.pb.go b/x/datadeal/types/consent.pb.go deleted file mode 100644 index 5ce05fe7..00000000 --- a/x/datadeal/types/consent.pb.go +++ /dev/null @@ -1,749 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: panacea/datadeal/v2/consent.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Certificate defines a certificate with signature -type Certificate struct { - UnsignedCertificate *UnsignedCertificate `protobuf:"bytes,1,opt,name=unsigned_certificate,json=unsignedCertificate,proto3" json:"unsigned_certificate,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` -} - -func (m *Certificate) Reset() { *m = Certificate{} } -func (m *Certificate) String() string { return proto.CompactTextString(m) } -func (*Certificate) ProtoMessage() {} -func (*Certificate) Descriptor() ([]byte, []int) { - return fileDescriptor_b5d80581f65c4381, []int{0} -} -func (m *Certificate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Certificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Certificate.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 *Certificate) XXX_Merge(src proto.Message) { - xxx_messageInfo_Certificate.Merge(m, src) -} -func (m *Certificate) XXX_Size() int { - return m.Size() -} -func (m *Certificate) XXX_DiscardUnknown() { - xxx_messageInfo_Certificate.DiscardUnknown(m) -} - -var xxx_messageInfo_Certificate proto.InternalMessageInfo - -func (m *Certificate) GetUnsignedCertificate() *UnsignedCertificate { - if m != nil { - return m.UnsignedCertificate - } - return nil -} - -func (m *Certificate) GetSignature() []byte { - if m != nil { - return m.Signature - } - return nil -} - -// UnsignedCertificate defines a certificate information -type UnsignedCertificate struct { - Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` - OracleAddress string `protobuf:"bytes,2,opt,name=oracle_address,json=oracleAddress,proto3" json:"oracle_address,omitempty"` - DealId int64 `protobuf:"varint,3,opt,name=deal_id,json=dealId,proto3" json:"deal_id,omitempty"` - ProviderAddress string `protobuf:"bytes,4,opt,name=provider_address,json=providerAddress,proto3" json:"provider_address,omitempty"` - DataHash string `protobuf:"bytes,5,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` -} - -func (m *UnsignedCertificate) Reset() { *m = UnsignedCertificate{} } -func (m *UnsignedCertificate) String() string { return proto.CompactTextString(m) } -func (*UnsignedCertificate) ProtoMessage() {} -func (*UnsignedCertificate) Descriptor() ([]byte, []int) { - return fileDescriptor_b5d80581f65c4381, []int{1} -} -func (m *UnsignedCertificate) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UnsignedCertificate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnsignedCertificate.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 *UnsignedCertificate) XXX_Merge(src proto.Message) { - xxx_messageInfo_UnsignedCertificate.Merge(m, src) -} -func (m *UnsignedCertificate) XXX_Size() int { - return m.Size() -} -func (m *UnsignedCertificate) XXX_DiscardUnknown() { - xxx_messageInfo_UnsignedCertificate.DiscardUnknown(m) -} - -var xxx_messageInfo_UnsignedCertificate proto.InternalMessageInfo - -func (m *UnsignedCertificate) GetCid() string { - if m != nil { - return m.Cid - } - return "" -} - -func (m *UnsignedCertificate) GetOracleAddress() string { - if m != nil { - return m.OracleAddress - } - return "" -} - -func (m *UnsignedCertificate) GetDealId() int64 { - if m != nil { - return m.DealId - } - return 0 -} - -func (m *UnsignedCertificate) GetProviderAddress() string { - if m != nil { - return m.ProviderAddress - } - return "" -} - -func (m *UnsignedCertificate) GetDataHash() string { - if m != nil { - return m.DataHash - } - return "" -} - -func init() { - proto.RegisterType((*Certificate)(nil), "panacea.datadeal.v2.Certificate") - proto.RegisterType((*UnsignedCertificate)(nil), "panacea.datadeal.v2.UnsignedCertificate") -} - -func init() { proto.RegisterFile("panacea/datadeal/v2/consent.proto", fileDescriptor_b5d80581f65c4381) } - -var fileDescriptor_b5d80581f65c4381 = []byte{ - // 341 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0xbf, 0x4e, 0xeb, 0x30, - 0x14, 0x87, 0xeb, 0xdb, 0x7b, 0x7b, 0x89, 0xcb, 0x9f, 0xca, 0xad, 0x44, 0x54, 0x90, 0x55, 0x2a, - 0x21, 0x85, 0x81, 0x58, 0x94, 0x27, 0x00, 0x16, 0x10, 0x5b, 0x24, 0x16, 0x18, 0x22, 0xd7, 0x36, - 0x89, 0xa5, 0x36, 0x8e, 0x6c, 0xa7, 0x82, 0x37, 0x60, 0xe4, 0x4d, 0x78, 0x0d, 0xc6, 0x8e, 0x8c, - 0xa8, 0x7d, 0x11, 0x64, 0xb7, 0xa5, 0x48, 0x74, 0x3b, 0xf9, 0xce, 0xef, 0x7c, 0x39, 0xc9, 0x81, - 0x47, 0x25, 0x2d, 0x28, 0x13, 0x94, 0x70, 0x6a, 0x29, 0x17, 0x74, 0x44, 0x26, 0x03, 0xc2, 0x54, - 0x61, 0x44, 0x61, 0xe3, 0x52, 0x2b, 0xab, 0x50, 0x7b, 0x19, 0x89, 0x57, 0x91, 0x78, 0x32, 0xe8, - 0x76, 0x32, 0x95, 0x29, 0xdf, 0x27, 0xae, 0x5a, 0x44, 0xbb, 0x78, 0x93, 0xcd, 0x8f, 0xf8, 0x7e, - 0xff, 0x05, 0xc0, 0xe6, 0x95, 0xd0, 0x56, 0x3e, 0x4a, 0x46, 0xad, 0x40, 0x0f, 0xb0, 0x53, 0x15, - 0x46, 0x66, 0x85, 0xe0, 0x29, 0x5b, 0xf3, 0x10, 0xf4, 0x40, 0xd4, 0x1c, 0x44, 0xf1, 0x86, 0x37, - 0xc7, 0x77, 0xcb, 0x81, 0x1f, 0x9e, 0xa4, 0x5d, 0xfd, 0x86, 0xe8, 0x10, 0x06, 0x0e, 0x52, 0x5b, - 0x69, 0x11, 0xfe, 0xe9, 0x81, 0x68, 0x3b, 0x59, 0x83, 0xfe, 0x1b, 0x80, 0xed, 0x0d, 0x2a, 0xd4, - 0x82, 0x75, 0x26, 0xb9, 0xdf, 0x20, 0x48, 0x5c, 0x89, 0x8e, 0xe1, 0xae, 0xd2, 0x94, 0x8d, 0x44, - 0x4a, 0x39, 0xd7, 0xc2, 0x18, 0x2f, 0x0b, 0x92, 0x9d, 0x05, 0xbd, 0x58, 0x40, 0xb4, 0x0f, 0xff, - 0xbb, 0x15, 0x53, 0xc9, 0xc3, 0x7a, 0x0f, 0x44, 0xf5, 0xa4, 0xe1, 0x1e, 0x6f, 0x38, 0x3a, 0x81, - 0xad, 0x52, 0xab, 0x89, 0xe4, 0x42, 0x7f, 0x1b, 0xfe, 0x7a, 0xc3, 0xde, 0x8a, 0xaf, 0x1c, 0x07, - 0x30, 0x70, 0x9f, 0x9a, 0xe6, 0xd4, 0xe4, 0xe1, 0x3f, 0x9f, 0xd9, 0x72, 0xe0, 0x9a, 0x9a, 0xfc, - 0xf2, 0xf6, 0x7d, 0x86, 0xc1, 0x74, 0x86, 0xc1, 0xe7, 0x0c, 0x83, 0xd7, 0x39, 0xae, 0x4d, 0xe7, - 0xb8, 0xf6, 0x31, 0xc7, 0xb5, 0xfb, 0xb3, 0x4c, 0xda, 0xbc, 0x1a, 0xc6, 0x4c, 0x8d, 0xc9, 0x58, - 0x70, 0x39, 0x1c, 0x29, 0x46, 0x96, 0xff, 0xee, 0x94, 0x29, 0x2d, 0xc8, 0xd3, 0xfa, 0x22, 0xf6, - 0xb9, 0x14, 0x66, 0xd8, 0xf0, 0x07, 0x39, 0xff, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xaf, 0xfa, 0xa1, - 0xb9, 0x00, 0x02, 0x00, 0x00, -} - -func (m *Certificate) 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 *Certificate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Certificate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Signature) > 0 { - i -= len(m.Signature) - copy(dAtA[i:], m.Signature) - i = encodeVarintConsent(dAtA, i, uint64(len(m.Signature))) - i-- - dAtA[i] = 0x12 - } - if m.UnsignedCertificate != nil { - { - size, err := m.UnsignedCertificate.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintConsent(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UnsignedCertificate) 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 *UnsignedCertificate) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UnsignedCertificate) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.DataHash) > 0 { - i -= len(m.DataHash) - copy(dAtA[i:], m.DataHash) - i = encodeVarintConsent(dAtA, i, uint64(len(m.DataHash))) - i-- - dAtA[i] = 0x2a - } - if len(m.ProviderAddress) > 0 { - i -= len(m.ProviderAddress) - copy(dAtA[i:], m.ProviderAddress) - i = encodeVarintConsent(dAtA, i, uint64(len(m.ProviderAddress))) - i-- - dAtA[i] = 0x22 - } - if m.DealId != 0 { - i = encodeVarintConsent(dAtA, i, uint64(m.DealId)) - i-- - dAtA[i] = 0x18 - } - if len(m.OracleAddress) > 0 { - i -= len(m.OracleAddress) - copy(dAtA[i:], m.OracleAddress) - i = encodeVarintConsent(dAtA, i, uint64(len(m.OracleAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.Cid) > 0 { - i -= len(m.Cid) - copy(dAtA[i:], m.Cid) - i = encodeVarintConsent(dAtA, i, uint64(len(m.Cid))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintConsent(dAtA []byte, offset int, v uint64) int { - offset -= sovConsent(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Certificate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UnsignedCertificate != nil { - l = m.UnsignedCertificate.Size() - n += 1 + l + sovConsent(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovConsent(uint64(l)) - } - return n -} - -func (m *UnsignedCertificate) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Cid) - if l > 0 { - n += 1 + l + sovConsent(uint64(l)) - } - l = len(m.OracleAddress) - if l > 0 { - n += 1 + l + sovConsent(uint64(l)) - } - if m.DealId != 0 { - n += 1 + sovConsent(uint64(m.DealId)) - } - l = len(m.ProviderAddress) - if l > 0 { - n += 1 + l + sovConsent(uint64(l)) - } - l = len(m.DataHash) - if l > 0 { - n += 1 + l + sovConsent(uint64(l)) - } - return n -} - -func sovConsent(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozConsent(x uint64) (n int) { - return sovConsent(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Certificate) 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 ErrIntOverflowConsent - } - 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: Certificate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Certificate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnsignedCertificate", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowConsent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthConsent - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthConsent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.UnsignedCertificate == nil { - m.UnsignedCertificate = &UnsignedCertificate{} - } - if err := m.UnsignedCertificate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowConsent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthConsent - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthConsent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipConsent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthConsent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UnsignedCertificate) 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 ErrIntOverflowConsent - } - 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: UnsignedCertificate: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnsignedCertificate: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowConsent - } - 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 ErrInvalidLengthConsent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthConsent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Cid = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OracleAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowConsent - } - 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 ErrInvalidLengthConsent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthConsent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OracleAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DealId", wireType) - } - m.DealId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowConsent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DealId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderAddress", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowConsent - } - 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 ErrInvalidLengthConsent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthConsent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProviderAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DataHash", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowConsent - } - 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 ErrInvalidLengthConsent - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthConsent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DataHash = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipConsent(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthConsent - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipConsent(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowConsent - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowConsent - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowConsent - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthConsent - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupConsent - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthConsent - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthConsent = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowConsent = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupConsent = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/oracle/keeper/oracle.go b/x/oracle/keeper/oracle.go index f7628315..a848ec1d 100644 --- a/x/oracle/keeper/oracle.go +++ b/x/oracle/keeper/oracle.go @@ -1,66 +1,53 @@ package keeper import ( + "errors" "fmt" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/medibloc/panacea-core/v2/x/oracle/types" "github.com/tendermint/tendermint/crypto/secp256k1" ) -func (k Keeper) HasOracle(ctx sdk.Context, address string) (bool, error) { - store := ctx.KVStore(k.storeKey) - accAddr, err := sdk.AccAddressFromBech32(address) - if err != nil { - return false, err - } - - return store.Has(types.GetOracleKey(accAddr)), nil -} +func (k Keeper) RegisterOracle(ctx sdk.Context, msg *types.MsgRegisterOracle) error { + oracleRegistration := types.NewOracleRegistration(msg) -func (k Keeper) SetOracle(ctx sdk.Context, oracle *types.Oracle) error { - store := ctx.KVStore(k.storeKey) - accAddr, err := sdk.AccAddressFromBech32(oracle.OracleAddress) - if err != nil { + if err := oracleRegistration.ValidateBasic(); err != nil { return err } - key := types.GetOracleKey(accAddr) - bz, err := k.cdc.MarshalLengthPrefixed(oracle) - if err != nil { - return err - } - - store.Set(key, bz) - return nil -} - -func (k Keeper) GetOracleRegistration(ctx sdk.Context, uniqueID, address string) (*types.OracleRegistration, error) { - store := ctx.KVStore(k.storeKey) - accAddr, err := sdk.AccAddressFromBech32(address) - if err != nil { - return nil, err - } - key := types.GetOracleRegistrationKey(uniqueID, accAddr) - bz := store.Get(key) - if bz == nil { - return nil, types.ErrOracleRegistrationNotFound + params := k.GetParams(ctx) + if params.UniqueId != oracleRegistration.UniqueId { + return sdkerrors.Wrapf(types.ErrOracleRegistration, "is not match the currently active uniqueID") } - oracleRegistration := &types.OracleRegistration{} + if oracle, err := k.GetOracle(ctx, oracleRegistration.OracleAddress); !errors.Is(types.ErrOracleNotFound, err) { + if oracle != nil { + return sdkerrors.Wrapf(types.ErrOracleRegistration, "already registered oracle. address(%s)", oracleRegistration.OracleAddress) + } else { + return sdkerrors.Wrapf(types.ErrOracleRegistration, err.Error()) + } + } - err = k.cdc.UnmarshalLengthPrefixed(bz, oracleRegistration) - if err != nil { - return nil, err + if err := k.SetOracleRegistration(ctx, oracleRegistration); err != nil { + return err } - return oracleRegistration, nil + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeRegistration, + sdk.NewAttribute(types.AttributeKeyUniqueID, oracleRegistration.UniqueId), + sdk.NewAttribute(types.AttributeKeyOracleAddress, oracleRegistration.OracleAddress), + ), + ) + return nil } func (k Keeper) ApproveOracleRegistration(ctx sdk.Context, msg *types.MsgApproveOracleRegistration) error { if err := k.validateApproveOracleRegistration(ctx, msg); err != nil { - return fmt.Errorf("invalid oracle private key signature") + return err } oracleRegistration, err := k.GetOracleRegistration(ctx, msg.ApproveOracleRegistration.UniqueId, msg.ApproveOracleRegistration.TargetOracleAddress) @@ -75,6 +62,7 @@ func (k Keeper) ApproveOracleRegistration(ctx sdk.Context, msg *types.MsgApprove OracleCommissionRate: oracleRegistration.OracleCommissionRate, } + // append new oracle info if err := k.SetOracle(ctx, newOracle); err != nil { return err } @@ -92,22 +80,25 @@ func (k Keeper) ApproveOracleRegistration(ctx sdk.Context, msg *types.MsgApprove } // validateApproveOracleRegistration checks signature -func (k Keeper) validateApproveOracleRegistration(ctx sdk.Context, msg *types.MsgApproveOracleRegistration) interface{} { +func (k Keeper) validateApproveOracleRegistration(ctx sdk.Context, msg *types.MsgApproveOracleRegistration) error { params := k.GetParams(ctx) targetOracleAddress := msg.ApproveOracleRegistration.TargetOracleAddress + // check unique id if msg.ApproveOracleRegistration.UniqueId != params.UniqueId { return types.ErrInvalidUniqueId } + // verify signature ApproveOracleRegistrationBz := k.cdc.MustMarshal(msg.ApproveOracleRegistration) - oraclePubKeyBz := k.GetParams(ctx).MustDecodeOraclePublicKey() + if !secp256k1.PubKey(oraclePubKeyBz).VerifySignature(ApproveOracleRegistrationBz, msg.Signature) { return fmt.Errorf("failed to signature validation") } + // check if the oracle has been already registered hasOracle, err := k.HasOracle(ctx, targetOracleAddress) if err != nil { return err @@ -118,3 +109,91 @@ func (k Keeper) validateApproveOracleRegistration(ctx sdk.Context, msg *types.Ms return nil } + +func (k Keeper) SetOracleRegistration(ctx sdk.Context, regOracle *types.OracleRegistration) error { + store := ctx.KVStore(k.storeKey) + + accAddr, err := sdk.AccAddressFromBech32(regOracle.OracleAddress) + if err != nil { + return err + } + key := types.GetOracleRegistrationKey(regOracle.UniqueId, accAddr) + bz, err := k.cdc.MarshalLengthPrefixed(regOracle) + if err != nil { + return err + } + + store.Set(key, bz) + + return nil +} + +func (k Keeper) GetOracleRegistration(ctx sdk.Context, uniqueID, address string) (*types.OracleRegistration, error) { + store := ctx.KVStore(k.storeKey) + accAddr, err := sdk.AccAddressFromBech32(address) + if err != nil { + return nil, err + } + key := types.GetOracleRegistrationKey(uniqueID, accAddr) + bz := store.Get(key) + if bz == nil { + return nil, sdkerrors.Wrapf(types.ErrGetOracleRegistration, "oracle registration not found") + } + + oracleRegistration := &types.OracleRegistration{} + + if err := k.cdc.UnmarshalLengthPrefixed(bz, oracleRegistration); err != nil { + return nil, err + } + + return oracleRegistration, nil +} + +func (k Keeper) SetOracle(ctx sdk.Context, oracle *types.Oracle) error { + store := ctx.KVStore(k.storeKey) + accAddr, err := sdk.AccAddressFromBech32(oracle.OracleAddress) + if err != nil { + return err + } + key := types.GetOracleKey(accAddr) + bz, err := k.cdc.MarshalLengthPrefixed(oracle) + if err != nil { + return err + } + + store.Set(key, bz) + + return nil +} + +func (k Keeper) GetOracle(ctx sdk.Context, address string) (*types.Oracle, error) { + store := ctx.KVStore(k.storeKey) + accAddr, err := sdk.AccAddressFromBech32(address) + if err != nil { + return nil, err + } + key := types.GetOracleKey(accAddr) + bz := store.Get(key) + if bz == nil { + return nil, sdkerrors.Wrapf(types.ErrOracleNotFound, "oracle '%s' does not exist", address) + } + + oracle := &types.Oracle{} + + err = k.cdc.UnmarshalLengthPrefixed(bz, oracle) + if err != nil { + return nil, sdkerrors.Wrapf(types.ErrGetOracle, err.Error()) + } + + return oracle, nil +} + +func (k Keeper) HasOracle(ctx sdk.Context, address string) (bool, error) { + store := ctx.KVStore(k.storeKey) + accAddr, err := sdk.AccAddressFromBech32(address) + if err != nil { + return false, err + } + + return store.Has(types.GetOracleKey(accAddr)), nil +} diff --git a/x/oracle/keeper/oracle_test.go b/x/oracle/keeper/oracle_test.go new file mode 100644 index 00000000..1d9b800b --- /dev/null +++ b/x/oracle/keeper/oracle_test.go @@ -0,0 +1,136 @@ +package keeper_test + +import ( + "encoding/base64" + "testing" + + "github.com/btcsuite/btcd/btcec" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/medibloc/panacea-core/v2/types/testsuite" + "github.com/medibloc/panacea-core/v2/x/oracle/types" + "github.com/stretchr/testify/suite" +) + +type oracleTestSuite struct { + testsuite.TestSuite + + uniqueID string + + oracleAccPrivKey cryptotypes.PrivKey + oracleAccPubKey cryptotypes.PubKey + oracleAccAddr sdk.AccAddress + + newOracleAccPrivKey cryptotypes.PrivKey + newOracleAccPubKey cryptotypes.PubKey + newOracleAccAddr sdk.AccAddress + + oraclePrivKey *btcec.PrivateKey + oraclePubKey *btcec.PublicKey + + nodePrivKey *btcec.PrivateKey + nodePubKey *btcec.PublicKey + + nodePubKeyRemoteReport []byte + + trustedBlockHeight int64 + trustedBlockHash []byte + + endpoint string + oracleCommissionRate sdk.Dec +} + +func TestOracleTestSuite(t *testing.T) { + suite.Run(t, new(oracleTestSuite)) +} + +func (suite *oracleTestSuite) BeforeTest(_, _ string) { + suite.uniqueID = "uniqueID" + suite.oracleAccPrivKey = secp256k1.GenPrivKey() + suite.oracleAccPubKey = suite.oracleAccPrivKey.PubKey() + suite.oracleAccAddr = sdk.AccAddress(suite.oracleAccPubKey.Address()) + + suite.newOracleAccPrivKey = secp256k1.GenPrivKey() + suite.newOracleAccPubKey = suite.newOracleAccPrivKey.PubKey() + suite.newOracleAccAddr = sdk.AccAddress(suite.newOracleAccPubKey.Address()) + + suite.oraclePrivKey, _ = btcec.NewPrivateKey(btcec.S256()) + suite.oraclePubKey = suite.oraclePrivKey.PubKey() + + suite.nodePrivKey, _ = btcec.NewPrivateKey(btcec.S256()) + suite.nodePubKey = suite.nodePrivKey.PubKey() + + suite.nodePubKeyRemoteReport = []byte("nodePubKeyRemoteReport") + + suite.trustedBlockHeight = int64(1) + suite.trustedBlockHash = []byte("trustedBlockHash") + + suite.endpoint = "https://my-validator.org" + suite.oracleCommissionRate = sdk.NewDecWithPrec(1, 1) + + suite.OracleKeeper.SetParams(suite.Ctx, types.Params{ + OraclePublicKey: base64.StdEncoding.EncodeToString(suite.oraclePubKey.SerializeCompressed()), + OraclePubKeyRemoteReport: "", + UniqueId: suite.uniqueID, + }) +} + +func (suite *oracleTestSuite) TestApproveOracleRegistrationSuccess() { + ctx := suite.Ctx + + msgRegisterOracle := &types.MsgRegisterOracle{ + UniqueId: suite.uniqueID, + OracleAddress: suite.oracleAccAddr.String(), + NodePubKey: suite.nodePubKey.SerializeCompressed(), + NodePubKeyRemoteReport: suite.nodePubKeyRemoteReport, + TrustedBlockHeight: suite.trustedBlockHeight, + TrustedBlockHash: suite.trustedBlockHash, + Endpoint: suite.endpoint, + OracleCommissionRate: suite.oracleCommissionRate, + } + + err := suite.OracleKeeper.RegisterOracle(ctx, msgRegisterOracle) + suite.Require().NoError(err) + + encryptedOraclePrivKey, err := btcec.Encrypt(suite.nodePubKey, suite.oraclePrivKey.Serialize()) + suite.Require().NoError(err) + + approveOracleRegistration := &types.ApproveOracleRegistration{ + UniqueId: suite.uniqueID, + ApproverOracleAddress: suite.oracleAccAddr.String(), + TargetOracleAddress: suite.oracleAccAddr.String(), + EncryptedOraclePrivKey: encryptedOraclePrivKey, + } + + approveOracleRegistrationBz, err := suite.Cdc.Marshaler.Marshal(approveOracleRegistration) + suite.Require().NoError(err) + oraclePrivKeySecp256k1 := secp256k1.PrivKey{ + Key: suite.oraclePrivKey.Serialize(), + } + signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) + suite.Require().NoError(err) + + msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) + + err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) + suite.Require().NoError(err) + + events := suite.Ctx.EventManager().Events() + suite.Require().Equal(2, len(events)) + suite.Require().Equal(types.EventTypeApproveOracleRegistration, events[1].Type) + + eventVoteAttributes := events[1].Attributes + suite.Require().Equal(2, len(eventVoteAttributes)) + suite.Require().Equal(types.AttributeKeyOracleAddress, string(eventVoteAttributes[0].Key)) + suite.Require().Equal(suite.oracleAccAddr.String(), string(eventVoteAttributes[0].Value)) + suite.Require().Equal(types.AttributeKeyEncryptedOraclePrivKey, string(eventVoteAttributes[1].Key)) + suite.Require().Equal(string(encryptedOraclePrivKey), string(eventVoteAttributes[1].Value)) + + getOracle, err := suite.OracleKeeper.GetOracle(ctx, suite.oracleAccAddr.String()) + suite.Require().NoError(err) + suite.Require().Equal(suite.uniqueID, getOracle.UniqueId) + suite.Require().Equal(suite.oracleAccAddr.String(), getOracle.OracleAddress) + suite.Require().Equal(suite.endpoint, getOracle.Endpoint) + suite.Require().Equal(suite.oracleCommissionRate, getOracle.OracleCommissionRate) +} diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go index efb17925..87f9afa8 100644 --- a/x/oracle/types/codec.go +++ b/x/oracle/types/codec.go @@ -18,7 +18,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgRegisterOracle{}, &MsgApproveOracleRegistration{}, &MsgUpdateOracleInfo{}, + &ApproveOracleRegistration{}, ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index 32a8cff9..5319996b 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -3,9 +3,10 @@ package types import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" var ( - ErrInvalidUniqueId = sdkerrors.Register(ModuleName, 1, "invalid unique id") - ErrGetOracle = sdkerrors.Register(ModuleName, 2, "error while get oracle") - ErrGetOracleRegistration = sdkerrors.Register(ModuleName, 3, "error while get oracleRegistration") - - ErrOracleRegistrationNotFound = sdkerrors.Register(ModuleName, 4, "oracle registration not found") + ErrOracleRegistration = sdkerrors.Register(ModuleName, 1, "error while registering a oracle") + ErrGetOracleRegistration = sdkerrors.Register(ModuleName, 2, "error while getting a oracle registration") + ErrGetOracle = sdkerrors.Register(ModuleName, 3, "error while getting a oracle") + ErrOracleNotFound = sdkerrors.Register(ModuleName, 4, "oracle not found") + ErrInvalidUniqueId = sdkerrors.Register(ModuleName, 5, "invalid unique id") + ErrOracleRegistrationNotFound = sdkerrors.Register(ModuleName, 6, "oracle registration not found") ) diff --git a/x/oracle/types/events.go b/x/oracle/types/events.go index 860a0b14..4c986680 100644 --- a/x/oracle/types/events.go +++ b/x/oracle/types/events.go @@ -1,8 +1,10 @@ package types const ( + EventTypeRegistration = "oracle_registration" EventTypeApproveOracleRegistration = "approve_oracle_registration" + AttributeKeyUniqueID = "unique_id" AttributeKeyOracleAddress = "oracle_address" AttributeKeyEncryptedOraclePrivKey = "encrypted_oracle_priv_key" ) diff --git a/x/oracle/types/message_oracle.go b/x/oracle/types/message_oracle.go index 4a1c1a40..86dd62e9 100644 --- a/x/oracle/types/message_oracle.go +++ b/x/oracle/types/message_oracle.go @@ -2,6 +2,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var _ sdk.Msg = &MsgRegisterOracle{} @@ -44,3 +45,104 @@ func (m *MsgRegisterOracle) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{oracleAddress} } + +var _ sdk.Msg = &MsgApproveOracleRegistration{} + +func NewMsgApproveOracleRegistration(approve *ApproveOracleRegistration, signature []byte) *MsgApproveOracleRegistration { + return &MsgApproveOracleRegistration{ + ApproveOracleRegistration: approve, + Signature: signature, + } +} + +func (m *MsgApproveOracleRegistration) Route() string { + return RouterKey +} + +func (m *MsgApproveOracleRegistration) Type() string { + return "ApproveOracleRegistration" +} + +func (m *MsgApproveOracleRegistration) ValidateBasic() error { + if err := m.ApproveOracleRegistration.ValidateBasic(); err != nil { + return err + } + + if m.Signature == nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "signature is empty") + } + + return nil +} + +func (m *MsgApproveOracleRegistration) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(m) + return sdk.MustSortJSON(bz) +} + +func (m *MsgApproveOracleRegistration) GetSigners() []sdk.AccAddress { + oracleAddress, err := sdk.AccAddressFromBech32(m.ApproveOracleRegistration.ApproverOracleAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{oracleAddress} +} + +func (m *ApproveOracleRegistration) ValidateBasic() error { + if len(m.UniqueId) == 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "uniqueId is empty") + } + + if len(m.ApproverOracleAddress) == 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "approverOracleAddress is empty") + } + + if len(m.TargetOracleAddress) == 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "targetOracleAddress is empty") + } + + if m.EncryptedOraclePrivKey == nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "encryptedOraclePrivKey is empty") + } + + return nil +} + +var _ sdk.Msg = &MsgUpdateOracleInfo{} + +func NewMsgUpdateOracleInfo(address, endpoint string, commissionRate sdk.Dec) *MsgUpdateOracleInfo { + return &MsgUpdateOracleInfo{ + OracleAddress: address, + Endpoint: endpoint, + OracleCommissionRate: commissionRate, + } +} + +func (m *MsgUpdateOracleInfo) Route() string { + return RouterKey +} + +func (m *MsgUpdateOracleInfo) Type() string { + return "UpdateOracleInfo" +} + +func (m *MsgUpdateOracleInfo) ValidateBasic() error { + if len(m.OracleAddress) == 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "oracleAddress is empty") + } + + return nil +} + +func (m *MsgUpdateOracleInfo) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(m) + return sdk.MustSortJSON(bz) +} + +func (m *MsgUpdateOracleInfo) GetSigners() []sdk.AccAddress { + oracleAddress, err := sdk.AccAddressFromBech32(m.OracleAddress) + if err != nil { + panic(err) + } + return []sdk.AccAddress{oracleAddress} +} diff --git a/x/oracle/types/oracle.go b/x/oracle/types/oracle.go index db3432b5..99ef64de 100644 --- a/x/oracle/types/oracle.go +++ b/x/oracle/types/oracle.go @@ -1,11 +1,86 @@ package types -func (m Oracle) ValidateBasic() error { - //TODO implement me - panic("implement me") +import ( + "fmt" + + "github.com/btcsuite/btcd/btcec" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +func NewOracle(oracleAddress, uniqueID, endpoint string, oracleCommissionRate sdk.Dec) *Oracle { + return &Oracle{ + OracleAddress: oracleAddress, + UniqueId: uniqueID, + Endpoint: endpoint, + OracleCommissionRate: oracleCommissionRate, + } +} + +func (m *Oracle) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.OracleAddress); err != nil { + return sdkerrors.Wrapf(err, "oracle address is invalid. address: %s", m.OracleAddress) + } + if len(m.UniqueId) == 0 { + return fmt.Errorf("uniqueID is empty") + } + if len(m.Endpoint) == 0 { + return fmt.Errorf("endpoint is empty") + } + if m.OracleCommissionRate.IsNegative() { + return fmt.Errorf("oracle commission rate cannot be negative") + } + if m.OracleCommissionRate.GT(sdk.OneDec()) { + return fmt.Errorf("oracle commission rate cannot be greater than 1") + } + return nil +} + +func NewOracleRegistration(msg *MsgRegisterOracle) *OracleRegistration { + return &OracleRegistration{ + UniqueId: msg.UniqueId, + OracleAddress: msg.OracleAddress, + NodePubKey: msg.NodePubKey, + NodePubKeyRemoteReport: msg.NodePubKeyRemoteReport, + TrustedBlockHeight: msg.TrustedBlockHeight, + TrustedBlockHash: msg.TrustedBlockHash, + Endpoint: msg.Endpoint, + OracleCommissionRate: msg.OracleCommissionRate, + } } -func (m OracleRegistration) ValidateBasic() error { - //TODO implement me - panic("implement me") +func (m *OracleRegistration) ValidateBasic() error { + if len(m.UniqueId) == 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "uniqueID is empty") + } + if _, err := sdk.AccAddressFromBech32(m.OracleAddress); err != nil { + return sdkerrors.Wrapf(err, "oracle address is invalid. address: %s", m.OracleAddress) + } + + if m.NodePubKey == nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "node public key is empty") + } else if _, err := btcec.ParsePubKey(m.NodePubKey, btcec.S256()); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid node public key") + } + + if m.NodePubKeyRemoteReport == nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "remote report of node public key is empty") + } + + if m.TrustedBlockHeight <= 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "trusted block height must be greater than zero") + } + + if m.TrustedBlockHash == nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "trusted block hash should not be nil") + } + + if len(m.Endpoint) == 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "endpoint is empty") + } + + if m.OracleCommissionRate.IsNegative() { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "oracle commission rate cannot be negative") + } + return nil } diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index 5f894ee6..b391fb8d 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -36,7 +36,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { } } -func (p Params) Validate() error { +func (p *Params) Validate() error { if err := validateOraclePublicKey(p.OraclePublicKey); err != nil { return err } diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 6a8fb127..dc19f436 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -219,8 +219,9 @@ func (m *MsgApproveOracleRegistration) GetSignature() []byte { // ApproveOracleRegistration defines for oracle registration approval type ApproveOracleRegistration struct { UniqueId string `protobuf:"bytes,1,opt,name=unique_id,json=uniqueId,proto3" json:"unique_id,omitempty"` - TargetOracleAddress string `protobuf:"bytes,2,opt,name=target_oracle_address,json=targetOracleAddress,proto3" json:"target_oracle_address,omitempty"` - EncryptedOraclePrivKey []byte `protobuf:"bytes,3,opt,name=encrypted_oracle_priv_key,json=encryptedOraclePrivKey,proto3" json:"encrypted_oracle_priv_key,omitempty"` + ApproverOracleAddress string `protobuf:"bytes,2,opt,name=approver_oracle_address,json=approverOracleAddress,proto3" json:"approver_oracle_address,omitempty"` + TargetOracleAddress string `protobuf:"bytes,3,opt,name=target_oracle_address,json=targetOracleAddress,proto3" json:"target_oracle_address,omitempty"` + EncryptedOraclePrivKey []byte `protobuf:"bytes,4,opt,name=encrypted_oracle_priv_key,json=encryptedOraclePrivKey,proto3" json:"encrypted_oracle_priv_key,omitempty"` } func (m *ApproveOracleRegistration) Reset() { *m = ApproveOracleRegistration{} } @@ -263,6 +264,13 @@ func (m *ApproveOracleRegistration) GetUniqueId() string { return "" } +func (m *ApproveOracleRegistration) GetApproverOracleAddress() string { + if m != nil { + return m.ApproverOracleAddress + } + return "" +} + func (m *ApproveOracleRegistration) GetTargetOracleAddress() string { if m != nil { return m.TargetOracleAddress @@ -418,52 +426,53 @@ func init() { func init() { proto.RegisterFile("panacea/oracle/v2/tx.proto", fileDescriptor_91b53ec53f5557f6) } var fileDescriptor_91b53ec53f5557f6 = []byte{ - // 716 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x4f, 0xdb, 0x48, - 0x14, 0x8e, 0xc9, 0x2e, 0x0b, 0xb3, 0x2c, 0x02, 0xc3, 0x22, 0xc7, 0x61, 0x43, 0x14, 0xb1, 0x08, - 0xad, 0xc0, 0xb3, 0x64, 0x0f, 0xab, 0xdd, 0x1b, 0xb4, 0x87, 0x22, 0x14, 0x81, 0x2c, 0xf5, 0xd2, - 0x8b, 0x35, 0xb6, 0x1f, 0xce, 0x94, 0xd8, 0x33, 0xcc, 0x8c, 0x23, 0xf2, 0x03, 0x7a, 0xef, 0xad, - 0x3f, 0xa1, 0x52, 0x7f, 0x44, 0xcf, 0x1c, 0x39, 0x56, 0x3d, 0xd0, 0x0a, 0xfe, 0x48, 0x95, 0xf1, - 0x24, 0x04, 0x92, 0x20, 0x2a, 0xf5, 0x94, 0xf8, 0x7d, 0xdf, 0xfb, 0xde, 0xf3, 0x7b, 0x9f, 0x1f, - 0x72, 0x39, 0xc9, 0x48, 0x04, 0x04, 0x33, 0x41, 0xa2, 0x0e, 0xe0, 0x6e, 0x13, 0xab, 0x0b, 0x8f, - 0x0b, 0xa6, 0x98, 0xbd, 0x6c, 0x30, 0xaf, 0xc0, 0xbc, 0x6e, 0xd3, 0x5d, 0x4d, 0x58, 0xc2, 0x34, - 0x8a, 0xfb, 0xff, 0x0a, 0xa2, 0xbb, 0x91, 0x30, 0x96, 0x74, 0x00, 0xeb, 0xa7, 0x30, 0x3f, 0xc5, - 0x8a, 0xa6, 0x20, 0x15, 0x49, 0xb9, 0x21, 0xfc, 0x15, 0x31, 0x99, 0x32, 0x89, 0x43, 0x22, 0x01, - 0x9f, 0xe7, 0x20, 0x7a, 0xb8, 0xbb, 0x17, 0x82, 0x22, 0x7b, 0x98, 0x93, 0x84, 0x66, 0x44, 0x51, - 0x96, 0x19, 0xee, 0xba, 0x11, 0x23, 0x9c, 0x62, 0x92, 0x65, 0x4c, 0x69, 0x50, 0x1a, 0xb4, 0x36, - 0xde, 0xaf, 0xe9, 0xce, 0xb4, 0x32, 0x8e, 0x27, 0x90, 0x81, 0xa4, 0x46, 0xa0, 0xf1, 0xae, 0x8c, - 0x96, 0x5b, 0x32, 0xf1, 0x21, 0xa1, 0x52, 0x81, 0x38, 0xd6, 0x34, 0xbb, 0x8a, 0xe6, 0xf3, 0x8c, - 0x9e, 0xe7, 0x10, 0xd0, 0xd8, 0xb1, 0xea, 0xd6, 0xf6, 0xbc, 0x3f, 0x57, 0x04, 0x0e, 0x63, 0xfb, - 0x4f, 0xb4, 0x58, 0xa8, 0x05, 0x24, 0x8e, 0x05, 0x48, 0xe9, 0xcc, 0x68, 0xc6, 0x6f, 0x45, 0x74, - 0xbf, 0x08, 0xda, 0x75, 0xb4, 0x90, 0xb1, 0x18, 0x02, 0x9e, 0x87, 0xc1, 0x19, 0xf4, 0x9c, 0x72, - 0xdd, 0xda, 0x5e, 0xf0, 0x51, 0x3f, 0x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, 0x2c, 0xf6, 0x90, 0xe7, 0x7a, 0x4f, 0xe3, 0x0d, 0x6a, 0x1d, 0x1c, 0x5e, 0xde, 0xd4, - 0xac, 0xab, 0x9b, 0x9a, 0xf5, 0xf5, 0xa6, 0x66, 0xbd, 0xbd, 0xad, 0x95, 0xae, 0x6e, 0x6b, 0xa5, - 0x4f, 0xb7, 0xb5, 0xd2, 0x2b, 0x3c, 0xb2, 0xd8, 0x14, 0x62, 0xda, 0x3f, 0x56, 0xd8, 0x88, 0xef, - 0x46, 0x4c, 0x00, 0xbe, 0x18, 0x5c, 0x73, 0xbd, 0xe5, 0x70, 0x56, 0x5f, 0xf2, 0x7f, 0xbe, 0x05, - 0x00, 0x00, 0xff, 0xff, 0xe1, 0x73, 0xae, 0x44, 0xbc, 0x06, 0x00, 0x00, + // 731 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x4f, 0xdb, 0x4a, + 0x14, 0x8d, 0xc9, 0x7b, 0x3c, 0x98, 0xc7, 0x43, 0x60, 0x3e, 0x9e, 0xe3, 0xf0, 0x42, 0x14, 0xf1, + 0x10, 0xaa, 0xc0, 0x53, 0x52, 0xa9, 0x55, 0xbb, 0x83, 0x76, 0x51, 0x84, 0x22, 0x90, 0xa5, 0x6e, + 0xba, 0xb1, 0xc6, 0xf6, 0xc5, 0x99, 0x12, 0x7b, 0xcc, 0xcc, 0x38, 0x22, 0x3f, 0xa0, 0xfb, 0xee, + 0xfa, 0x1f, 0xfa, 0x23, 0xba, 0x66, 0xc9, 0xb2, 0xea, 0x02, 0x2a, 0xf8, 0x23, 0x55, 0xc6, 0x93, + 0x10, 0xf2, 0x81, 0xa8, 0xd4, 0x55, 0xe2, 0x7b, 0xce, 0x3d, 0xf7, 0xda, 0xe7, 0xd8, 0x83, 0xec, + 0x94, 0x24, 0x24, 0x00, 0x82, 0x19, 0x27, 0x41, 0x0b, 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d1, 0xcd, + 0xf1, 0x62, 0xc3, 0x3c, 0xdb, 0x79, 0x1c, 0xaf, 0x37, 0x6b, 0xff, 0xe0, 0xe2, 0xa6, 0x62, 0x5c, + 0xde, 0x54, 0x8c, 0x1f, 0x37, 0x15, 0xe3, 0xd3, 0x6d, 0xa5, 0x70, 0x79, 0x5b, 0x29, 0x7c, 0xbb, + 0xad, 0x14, 0xde, 0xe3, 0x01, 0x63, 0x63, 0x08, 0x69, 0xf7, 0x23, 0x87, 0xb5, 0xf8, 0x4e, 0xc0, + 0x38, 0xe0, 0xf3, 0xde, 0x29, 0xa0, 0x5c, 0xf6, 0xa7, 0xd5, 0x09, 0xf0, 0xec, 0x67, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x2d, 0x36, 0x58, 0x7f, 0xf4, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -794,13 +803,20 @@ func (m *ApproveOracleRegistration) MarshalToSizedBuffer(dAtA []byte) (int, erro copy(dAtA[i:], m.EncryptedOraclePrivKey) i = encodeVarintTx(dAtA, i, uint64(len(m.EncryptedOraclePrivKey))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } if len(m.TargetOracleAddress) > 0 { i -= len(m.TargetOracleAddress) copy(dAtA[i:], m.TargetOracleAddress) i = encodeVarintTx(dAtA, i, uint64(len(m.TargetOracleAddress))) i-- + dAtA[i] = 0x1a + } + if len(m.ApproverOracleAddress) > 0 { + i -= len(m.ApproverOracleAddress) + copy(dAtA[i:], m.ApproverOracleAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ApproverOracleAddress))) + i-- dAtA[i] = 0x12 } if len(m.UniqueId) > 0 { @@ -991,6 +1007,10 @@ func (m *ApproveOracleRegistration) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.ApproverOracleAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } l = len(m.TargetOracleAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) @@ -1578,6 +1598,38 @@ func (m *ApproveOracleRegistration) Unmarshal(dAtA []byte) error { m.UniqueId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApproverOracleAddress", 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.ApproverOracleAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field TargetOracleAddress", wireType) } @@ -1609,7 +1661,7 @@ func (m *ApproveOracleRegistration) Unmarshal(dAtA []byte) error { } m.TargetOracleAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EncryptedOraclePrivKey", wireType) } From 29ee7eeed8753c5374e738b63217e2b20b41fa1a Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Wed, 7 Dec 2022 14:18:23 +0900 Subject: [PATCH 13/21] feat: add tx cli & failed test code --- types/testsuite/suite.go | 1 + x/oracle/client/cli/tx.go | 2 + .../client/cli/txApproveOracleRegistration.go | 43 ++++++ x/oracle/keeper/msg_server_oracle.go | 20 ++- x/oracle/keeper/oracle.go | 2 +- x/oracle/keeper/oracle_test.go | 126 +++++++++++++++++- x/oracle/types/codec.go | 1 - x/oracle/types/message_oracle.go | 8 ++ 8 files changed, 197 insertions(+), 6 deletions(-) create mode 100644 x/oracle/client/cli/txApproveOracleRegistration.go diff --git a/types/testsuite/suite.go b/types/testsuite/suite.go index 4b4f57aa..973c2735 100644 --- a/types/testsuite/suite.go +++ b/types/testsuite/suite.go @@ -133,6 +133,7 @@ func (suite *TestSuite) SetupTest() { scopedIBCKeeper := suite.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) suite.Ctx = ctx + suite.Cdc = cdc suite.AccountKeeper = authkeeper.NewAccountKeeper( cdc.Marshaler, keyParams[authtypes.StoreKey], diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go index bbd4017e..c1f38795 100644 --- a/x/oracle/client/cli/tx.go +++ b/x/oracle/client/cli/tx.go @@ -18,5 +18,7 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } + cmd.AddCommand(CmdApproveOracleRegistration()) + return cmd } diff --git a/x/oracle/client/cli/txApproveOracleRegistration.go b/x/oracle/client/cli/txApproveOracleRegistration.go new file mode 100644 index 00000000..b4928a54 --- /dev/null +++ b/x/oracle/client/cli/txApproveOracleRegistration.go @@ -0,0 +1,43 @@ +package cli + +import ( + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/medibloc/panacea-core/v2/x/oracle/types" + "github.com/spf13/cobra" +) + +func CmdApproveOracleRegistration() *cobra.Command { + cmd := &cobra.Command{ + Use: "approve-oracle-registration [unique ID] [target oracle address] [encrypted oracle private key] [signature]", + Short: "approve a new oracle registration", + Args: cobra.ExactArgs(4), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + oracleAddress := clientCtx.GetFromAddress().String() + + approveOracleRegistration := &types.ApproveOracleRegistration{ + UniqueId: args[0], + ApproverOracleAddress: oracleAddress, + TargetOracleAddress: args[1], + EncryptedOraclePrivKey: []byte(args[2]), + } + + msg := types.NewMsgApproveOracleRegistration(approveOracleRegistration, []byte(args[3])) + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/oracle/keeper/msg_server_oracle.go b/x/oracle/keeper/msg_server_oracle.go index db1e12eb..c9526510 100644 --- a/x/oracle/keeper/msg_server_oracle.go +++ b/x/oracle/keeper/msg_server_oracle.go @@ -3,6 +3,7 @@ package keeper import ( "context" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/medibloc/panacea-core/v2/x/oracle/types" ) @@ -11,9 +12,22 @@ func (m msgServer) RegisterOracle(ctx context.Context, oracle *types.MsgRegister panic("implement me") } -func (m msgServer) ApproveOracleRegistration(ctx context.Context, registration *types.MsgApproveOracleRegistration) (*types.MsgApproveOracleRegistrationResponse, error) { - //TODO implement me - panic("implement me") +func (m msgServer) ApproveOracleRegistration(goCtx context.Context, msg *types.MsgApproveOracleRegistration) (*types.MsgApproveOracleRegistrationResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if err := m.Keeper.ApproveOracleRegistration(ctx, msg); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + ), + ) + + return &types.MsgApproveOracleRegistrationResponse{}, nil } func (m msgServer) UpdateOracleInfo(ctx context.Context, info *types.MsgUpdateOracleInfo) (*types.MsgUpdateOracleInfoResponse, error) { diff --git a/x/oracle/keeper/oracle.go b/x/oracle/keeper/oracle.go index a848ec1d..c1405491 100644 --- a/x/oracle/keeper/oracle.go +++ b/x/oracle/keeper/oracle.go @@ -104,7 +104,7 @@ func (k Keeper) validateApproveOracleRegistration(ctx sdk.Context, msg *types.Ms return err } if hasOracle { - return fmt.Errorf("oracle address(%v) is already registered", targetOracleAddress) + return fmt.Errorf("already registered oracle. address(%s)", targetOracleAddress) } return nil diff --git a/x/oracle/keeper/oracle_test.go b/x/oracle/keeper/oracle_test.go index 1d9b800b..7d78b6a9 100644 --- a/x/oracle/keeper/oracle_test.go +++ b/x/oracle/keeper/oracle_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "encoding/base64" + "fmt" "testing" "github.com/btcsuite/btcd/btcec" @@ -109,7 +110,6 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationSuccess() { Key: suite.oraclePrivKey.Serialize(), } signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) - suite.Require().NoError(err) msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) @@ -134,3 +134,127 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationSuccess() { suite.Require().Equal(suite.endpoint, getOracle.Endpoint) suite.Require().Equal(suite.oracleCommissionRate, getOracle.OracleCommissionRate) } + +func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedInvalidUniqueID() { + ctx := suite.Ctx + + msgRegisterOracle := &types.MsgRegisterOracle{ + UniqueId: suite.uniqueID, + OracleAddress: suite.oracleAccAddr.String(), + NodePubKey: suite.nodePubKey.SerializeCompressed(), + NodePubKeyRemoteReport: suite.nodePubKeyRemoteReport, + TrustedBlockHeight: suite.trustedBlockHeight, + TrustedBlockHash: suite.trustedBlockHash, + Endpoint: suite.endpoint, + OracleCommissionRate: suite.oracleCommissionRate, + } + + err := suite.OracleKeeper.RegisterOracle(ctx, msgRegisterOracle) + suite.Require().NoError(err) + + encryptedOraclePrivKey, err := btcec.Encrypt(suite.nodePubKey, suite.oraclePrivKey.Serialize()) + suite.Require().NoError(err) + + approveOracleRegistration := &types.ApproveOracleRegistration{ + UniqueId: "uniqueID2", + ApproverOracleAddress: suite.oracleAccAddr.String(), + TargetOracleAddress: suite.oracleAccAddr.String(), + EncryptedOraclePrivKey: encryptedOraclePrivKey, + } + approveOracleRegistrationBz, err := suite.Cdc.Marshaler.Marshal(approveOracleRegistration) + suite.Require().NoError(err) + oraclePrivKeySecp256k1 := secp256k1.PrivKey{ + Key: suite.oraclePrivKey.Serialize(), + } + signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) + suite.Require().NoError(err) + + msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) + + err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) + suite.Require().Error(err, types.ErrInvalidUniqueId) +} + +func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedInvalidSignature() { + ctx := suite.Ctx + + msgRegisterOracle := &types.MsgRegisterOracle{ + UniqueId: suite.uniqueID, + OracleAddress: suite.oracleAccAddr.String(), + NodePubKey: suite.nodePubKey.SerializeCompressed(), + NodePubKeyRemoteReport: suite.nodePubKeyRemoteReport, + TrustedBlockHeight: suite.trustedBlockHeight, + TrustedBlockHash: suite.trustedBlockHash, + Endpoint: suite.endpoint, + OracleCommissionRate: suite.oracleCommissionRate, + } + + err := suite.OracleKeeper.RegisterOracle(ctx, msgRegisterOracle) + suite.Require().NoError(err) + + encryptedOraclePrivKey, err := btcec.Encrypt(suite.nodePubKey, suite.oraclePrivKey.Serialize()) + suite.Require().NoError(err) + + approveOracleRegistration := &types.ApproveOracleRegistration{ + UniqueId: "uniqueID", + ApproverOracleAddress: suite.oracleAccAddr.String(), + TargetOracleAddress: suite.oracleAccAddr.String(), + EncryptedOraclePrivKey: encryptedOraclePrivKey, + } + approveOracleRegistrationBz, err := suite.Cdc.Marshaler.Marshal(approveOracleRegistration) + suite.Require().NoError(err) + newPrivateKey := secp256k1.GenPrivKey() + signature, err := newPrivateKey.Sign(approveOracleRegistrationBz) + suite.Require().NoError(err) + + msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) + + err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) + suite.Require().Error(err, "failed to signature validation") +} + +func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedAlreadyExistOracle() { + ctx := suite.Ctx + + oracle := types.NewOracle(suite.oracleAccAddr.String(), suite.uniqueID, suite.endpoint, suite.oracleCommissionRate) + err := suite.OracleKeeper.SetOracle(ctx, oracle) + suite.Require().NoError(err) + + msgRegisterOracle := &types.MsgRegisterOracle{ + UniqueId: suite.uniqueID, + OracleAddress: suite.oracleAccAddr.String(), + NodePubKey: suite.nodePubKey.SerializeCompressed(), + NodePubKeyRemoteReport: suite.nodePubKeyRemoteReport, + TrustedBlockHeight: suite.trustedBlockHeight, + TrustedBlockHash: suite.trustedBlockHash, + Endpoint: suite.endpoint, + OracleCommissionRate: suite.oracleCommissionRate, + } + + oracleRegistration := types.NewOracleRegistration(msgRegisterOracle) + + err = suite.OracleKeeper.SetOracleRegistration(ctx, oracleRegistration) + + encryptedOraclePrivKey, err := btcec.Encrypt(suite.nodePubKey, suite.oraclePrivKey.Serialize()) + suite.Require().NoError(err) + + approveOracleRegistration := &types.ApproveOracleRegistration{ + UniqueId: "uniqueID", + ApproverOracleAddress: suite.oracleAccAddr.String(), + TargetOracleAddress: suite.oracleAccAddr.String(), + EncryptedOraclePrivKey: encryptedOraclePrivKey, + } + approveOracleRegistrationBz, err := suite.Cdc.Marshaler.Marshal(approveOracleRegistration) + suite.Require().NoError(err) + oraclePrivKeySecp256k1 := secp256k1.PrivKey{ + Key: suite.oraclePrivKey.Serialize(), + } + signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) + suite.Require().NoError(err) + + msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) + + err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) + suite.Require().Error(err, types.ErrOracleRegistration) + suite.Require().ErrorContains(err, fmt.Sprintf("already registered oracle. address(%s)", msgRegisterOracle.OracleAddress)) +} diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go index 87f9afa8..f14699a4 100644 --- a/x/oracle/types/codec.go +++ b/x/oracle/types/codec.go @@ -18,7 +18,6 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgRegisterOracle{}, &MsgApproveOracleRegistration{}, &MsgUpdateOracleInfo{}, - &ApproveOracleRegistration{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/oracle/types/message_oracle.go b/x/oracle/types/message_oracle.go index 86dd62e9..ab03bd8d 100644 --- a/x/oracle/types/message_oracle.go +++ b/x/oracle/types/message_oracle.go @@ -97,10 +97,18 @@ func (m *ApproveOracleRegistration) ValidateBasic() error { return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "approverOracleAddress is empty") } + if _, err := sdk.AccAddressFromBech32(m.ApproverOracleAddress); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "approverOracleAddress is invalid. address: %s, error: %s", m.ApproverOracleAddress, err.Error()) + } + if len(m.TargetOracleAddress) == 0 { return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "targetOracleAddress is empty") } + if _, err := sdk.AccAddressFromBech32(m.TargetOracleAddress); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "targetOracleAddress is invalid. address: %s, error: %s", m.TargetOracleAddress, err.Error()) + } + if m.EncryptedOraclePrivKey == nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "encryptedOraclePrivKey is empty") } From 9e20c35e1e03c06670f40170c205cc3aa1995b53 Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Wed, 7 Dec 2022 14:52:30 +0900 Subject: [PATCH 14/21] fix --- x/oracle/keeper/oracle_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x/oracle/keeper/oracle_test.go b/x/oracle/keeper/oracle_test.go index 7d78b6a9..a4553b9a 100644 --- a/x/oracle/keeper/oracle_test.go +++ b/x/oracle/keeper/oracle_test.go @@ -110,6 +110,7 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationSuccess() { Key: suite.oraclePrivKey.Serialize(), } signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) + suite.Require().NoError(err) msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) @@ -166,6 +167,7 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedInvalidUniqueID oraclePrivKeySecp256k1 := secp256k1.PrivKey{ Key: suite.oraclePrivKey.Serialize(), } + signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) suite.Require().NoError(err) @@ -234,6 +236,7 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedAlreadyExistOra oracleRegistration := types.NewOracleRegistration(msgRegisterOracle) err = suite.OracleKeeper.SetOracleRegistration(ctx, oracleRegistration) + suite.Require().NoError(err) encryptedOraclePrivKey, err := btcec.Encrypt(suite.nodePubKey, suite.oraclePrivKey.Serialize()) suite.Require().NoError(err) From 9f7563b6b1b1766cec2dc5dddf6ab5bd56dab375 Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Wed, 7 Dec 2022 15:33:17 +0900 Subject: [PATCH 15/21] feat: change secp256k1 based signature verification to btcec based --- x/oracle/keeper/keeper.go | 27 +++++++++++++++++++++++++++ x/oracle/keeper/oracle.go | 8 ++------ x/oracle/keeper/oracle_test.go | 27 +++++++++------------------ 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index b651643f..5565defc 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -1,6 +1,9 @@ package keeper import ( + "fmt" + + "github.com/btcsuite/btcd/btcec" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/medibloc/panacea-core/v2/x/oracle/types" @@ -35,3 +38,27 @@ func NewKeeper( paramSpace: paramSpace, } } + +func (k Keeper) VerifySignature(ctx sdk.Context, msg codec.ProtoMarshaler, sigBz []byte) error { + bz, err := k.cdc.Marshal(msg) + if err != nil { + return err + } + + oraclePubKeyBz := k.GetParams(ctx).MustDecodeOraclePublicKey() + oraclePubKey, err := btcec.ParsePubKey(oraclePubKeyBz, btcec.S256()) + if err != nil { + return err + } + + signature, err := btcec.ParseSignature(sigBz, btcec.S256()) + if err != nil { + return err + } + + if !signature.Verify(bz, oraclePubKey) { + return fmt.Errorf("failed to signature validation") + } + + return nil +} diff --git a/x/oracle/keeper/oracle.go b/x/oracle/keeper/oracle.go index c1405491..27e01df8 100644 --- a/x/oracle/keeper/oracle.go +++ b/x/oracle/keeper/oracle.go @@ -7,7 +7,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/medibloc/panacea-core/v2/x/oracle/types" - "github.com/tendermint/tendermint/crypto/secp256k1" ) func (k Keeper) RegisterOracle(ctx sdk.Context, msg *types.MsgRegisterOracle) error { @@ -91,11 +90,8 @@ func (k Keeper) validateApproveOracleRegistration(ctx sdk.Context, msg *types.Ms } // verify signature - ApproveOracleRegistrationBz := k.cdc.MustMarshal(msg.ApproveOracleRegistration) - oraclePubKeyBz := k.GetParams(ctx).MustDecodeOraclePublicKey() - - if !secp256k1.PubKey(oraclePubKeyBz).VerifySignature(ApproveOracleRegistrationBz, msg.Signature) { - return fmt.Errorf("failed to signature validation") + if err := k.VerifySignature(ctx, msg.ApproveOracleRegistration, msg.Signature); err != nil { + return err } // check if the oracle has been already registered diff --git a/x/oracle/keeper/oracle_test.go b/x/oracle/keeper/oracle_test.go index a4553b9a..746dcc3e 100644 --- a/x/oracle/keeper/oracle_test.go +++ b/x/oracle/keeper/oracle_test.go @@ -106,13 +106,10 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationSuccess() { approveOracleRegistrationBz, err := suite.Cdc.Marshaler.Marshal(approveOracleRegistration) suite.Require().NoError(err) - oraclePrivKeySecp256k1 := secp256k1.PrivKey{ - Key: suite.oraclePrivKey.Serialize(), - } - signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) + signature, err := suite.oraclePrivKey.Sign(approveOracleRegistrationBz) suite.Require().NoError(err) - msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) + msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature.Serialize()) err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) suite.Require().NoError(err) @@ -164,14 +161,10 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedInvalidUniqueID } approveOracleRegistrationBz, err := suite.Cdc.Marshaler.Marshal(approveOracleRegistration) suite.Require().NoError(err) - oraclePrivKeySecp256k1 := secp256k1.PrivKey{ - Key: suite.oraclePrivKey.Serialize(), - } - - signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) + signature, err := suite.oraclePrivKey.Sign(approveOracleRegistrationBz) suite.Require().NoError(err) - msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) + msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature.Serialize()) err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) suite.Require().Error(err, types.ErrInvalidUniqueId) @@ -205,11 +198,12 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedInvalidSignatur } approveOracleRegistrationBz, err := suite.Cdc.Marshaler.Marshal(approveOracleRegistration) suite.Require().NoError(err) - newPrivateKey := secp256k1.GenPrivKey() + newPrivateKey, err := btcec.NewPrivateKey(btcec.S256()) + suite.Require().NoError(err) signature, err := newPrivateKey.Sign(approveOracleRegistrationBz) suite.Require().NoError(err) - msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) + msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature.Serialize()) err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) suite.Require().Error(err, "failed to signature validation") @@ -249,13 +243,10 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedAlreadyExistOra } approveOracleRegistrationBz, err := suite.Cdc.Marshaler.Marshal(approveOracleRegistration) suite.Require().NoError(err) - oraclePrivKeySecp256k1 := secp256k1.PrivKey{ - Key: suite.oraclePrivKey.Serialize(), - } - signature, err := oraclePrivKeySecp256k1.Sign(approveOracleRegistrationBz) + signature, err := suite.oraclePrivKey.Sign(approveOracleRegistrationBz) suite.Require().NoError(err) - msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature) + msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature.Serialize()) err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) suite.Require().Error(err, types.ErrOracleRegistration) From 14ef82b21af9f41bffa38a4db436c3a5aa5a59bc Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Wed, 7 Dec 2022 15:40:42 +0900 Subject: [PATCH 16/21] fix --- x/oracle/handler.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/oracle/handler.go b/x/oracle/handler.go index 5ac37fb8..466436dc 100644 --- a/x/oracle/handler.go +++ b/x/oracle/handler.go @@ -20,9 +20,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgRegisterOracle: res, err := msgServer.RegisterOracle(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - //case *types.MsgApproveOracleRegistration: - // res, err := msgServer.ApproveOracleRegistration(sdk.WrapSDKContext(ctx), msg) - // return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgApproveOracleRegistration: + res, err := msgServer.ApproveOracleRegistration(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) //case *types.MsgUpdateOracleInfo: // res, err := msgServer.UpdateOracleInfo(sdk.WrapSDKContext(ctx), msg) // return sdk.WrapServiceResult(ctx, res, err) From 160a4d95bdf19fe466e7b09c441636e4c35804d6 Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Wed, 7 Dec 2022 17:48:19 +0900 Subject: [PATCH 17/21] Update x/oracle/keeper/msg_server_oracle.go Co-authored-by: Youngjoon Lee --- x/oracle/keeper/msg_server_oracle.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/oracle/keeper/msg_server_oracle.go b/x/oracle/keeper/msg_server_oracle.go index c9526510..cc7d5e4c 100644 --- a/x/oracle/keeper/msg_server_oracle.go +++ b/x/oracle/keeper/msg_server_oracle.go @@ -21,7 +21,6 @@ func (m msgServer) ApproveOracleRegistration(goCtx context.Context, msg *types.M ctx.EventManager().EmitEvent( sdk.NewEvent( - sdk.EventTypeMessage, sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), ), From 51da4c2e160f81fdd6642595e8587091d64f8eca Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Wed, 7 Dec 2022 18:02:29 +0900 Subject: [PATCH 18/21] feat: remove ApproveOracleRegistration CLI --- x/oracle/client/cli/tx.go | 2 - .../client/cli/txApproveOracleRegistration.go | 43 ------------------- 2 files changed, 45 deletions(-) delete mode 100644 x/oracle/client/cli/txApproveOracleRegistration.go diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go index c1f38795..bbd4017e 100644 --- a/x/oracle/client/cli/tx.go +++ b/x/oracle/client/cli/tx.go @@ -18,7 +18,5 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdApproveOracleRegistration()) - return cmd } diff --git a/x/oracle/client/cli/txApproveOracleRegistration.go b/x/oracle/client/cli/txApproveOracleRegistration.go deleted file mode 100644 index b4928a54..00000000 --- a/x/oracle/client/cli/txApproveOracleRegistration.go +++ /dev/null @@ -1,43 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/medibloc/panacea-core/v2/x/oracle/types" - "github.com/spf13/cobra" -) - -func CmdApproveOracleRegistration() *cobra.Command { - cmd := &cobra.Command{ - Use: "approve-oracle-registration [unique ID] [target oracle address] [encrypted oracle private key] [signature]", - Short: "approve a new oracle registration", - Args: cobra.ExactArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - oracleAddress := clientCtx.GetFromAddress().String() - - approveOracleRegistration := &types.ApproveOracleRegistration{ - UniqueId: args[0], - ApproverOracleAddress: oracleAddress, - TargetOracleAddress: args[1], - EncryptedOraclePrivKey: []byte(args[2]), - } - - msg := types.NewMsgApproveOracleRegistration(approveOracleRegistration, []byte(args[3])) - if err := msg.ValidateBasic(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} From 4c5d4ea908450a660e81e9a4a222ce0bba11131f Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Thu, 8 Dec 2022 16:44:54 +0900 Subject: [PATCH 19/21] fix --- x/oracle/keeper/oracle.go | 19 +++++++++---------- x/oracle/keeper/oracle_test.go | 6 ++---- x/oracle/types/errors.go | 12 ++++++------ x/oracle/types/events.go | 7 +++---- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/x/oracle/keeper/oracle.go b/x/oracle/keeper/oracle.go index 26204731..383716b5 100644 --- a/x/oracle/keeper/oracle.go +++ b/x/oracle/keeper/oracle.go @@ -46,31 +46,30 @@ func (k Keeper) RegisterOracle(ctx sdk.Context, msg *types.MsgRegisterOracle) er func (k Keeper) ApproveOracleRegistration(ctx sdk.Context, msg *types.MsgApproveOracleRegistration) error { if err := k.validateApproveOracleRegistration(ctx, msg); err != nil { - return err + return sdkerrors.Wrapf(types.ErrApproveOracleRegistration, err.Error()) } oracleRegistration, err := k.GetOracleRegistration(ctx, msg.ApproveOracleRegistration.UniqueId, msg.ApproveOracleRegistration.TargetOracleAddress) if err != nil { - return err + return sdkerrors.Wrapf(types.ErrApproveOracleRegistration, err.Error()) } - newOracle := &types.Oracle{ - OracleAddress: msg.ApproveOracleRegistration.TargetOracleAddress, - UniqueId: msg.ApproveOracleRegistration.UniqueId, - Endpoint: oracleRegistration.Endpoint, - OracleCommissionRate: oracleRegistration.OracleCommissionRate, - } + newOracle := types.NewOracle( + msg.ApproveOracleRegistration.TargetOracleAddress, + msg.ApproveOracleRegistration.UniqueId, + oracleRegistration.Endpoint, + oracleRegistration.OracleCommissionRate, + ) // append new oracle info if err := k.SetOracle(ctx, newOracle); err != nil { - return err + return sdkerrors.Wrapf(types.ErrApproveOracleRegistration, err.Error()) } ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeApproveOracleRegistration, sdk.NewAttribute(types.AttributeKeyOracleAddress, msg.ApproveOracleRegistration.TargetOracleAddress), - sdk.NewAttribute(types.AttributeKeyEncryptedOraclePrivKey, string(msg.ApproveOracleRegistration.EncryptedOraclePrivKey)), ), ) diff --git a/x/oracle/keeper/oracle_test.go b/x/oracle/keeper/oracle_test.go index 2d3cd21f..4b20b876 100644 --- a/x/oracle/keeper/oracle_test.go +++ b/x/oracle/keeper/oracle_test.go @@ -263,11 +263,9 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationSuccess() { suite.Require().Equal(types.EventTypeApproveOracleRegistration, events[1].Type) eventVoteAttributes := events[1].Attributes - suite.Require().Equal(2, len(eventVoteAttributes)) + suite.Require().Equal(1, len(eventVoteAttributes)) suite.Require().Equal(types.AttributeKeyOracleAddress, string(eventVoteAttributes[0].Key)) suite.Require().Equal(suite.oracleAccAddr.String(), string(eventVoteAttributes[0].Value)) - suite.Require().Equal(types.AttributeKeyEncryptedOraclePrivKey, string(eventVoteAttributes[1].Key)) - suite.Require().Equal(string(encryptedOraclePrivKey), string(eventVoteAttributes[1].Value)) getOracle, err := suite.OracleKeeper.GetOracle(ctx, suite.oracleAccAddr.String()) suite.Require().NoError(err) @@ -395,4 +393,4 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedAlreadyExistOra err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) suite.Require().Error(err, types.ErrOracleRegistration) suite.Require().ErrorContains(err, fmt.Sprintf("already registered oracle. address(%s)", msgRegisterOracle.OracleAddress)) -} \ No newline at end of file +} diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index 2138ad0b..f58538aa 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -3,10 +3,10 @@ package types import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" var ( - ErrOracleRegistration = sdkerrors.Register(ModuleName, 1, "error while registering a oracle") - ErrGetOracleRegistration = sdkerrors.Register(ModuleName, 2, "error while getting a oracle registration") - ErrGetOracle = sdkerrors.Register(ModuleName, 3, "error while getting a oracle") - ErrOracleNotFound = sdkerrors.Register(ModuleName, 4, "oracle not found") - ErrInvalidUniqueId = sdkerrors.Register(ModuleName, 5, "invalid unique id") - ErrOracleRegistrationNotFound = sdkerrors.Register(ModuleName, 6, "oracle registration not found") + ErrOracleRegistration = sdkerrors.Register(ModuleName, 1, "error while registering a oracle") + ErrGetOracleRegistration = sdkerrors.Register(ModuleName, 2, "error while getting a oracle registration") + ErrGetOracle = sdkerrors.Register(ModuleName, 3, "error while getting a oracle") + ErrOracleNotFound = sdkerrors.Register(ModuleName, 4, "oracle not found") + ErrInvalidUniqueID = sdkerrors.Register(ModuleName, 5, "invalid unique id") + ErrApproveOracleRegistration = sdkerrors.Register(ModuleName, 6, "error while approving an oracle registration") ) diff --git a/x/oracle/types/events.go b/x/oracle/types/events.go index 9399f576..a2a8dbf9 100644 --- a/x/oracle/types/events.go +++ b/x/oracle/types/events.go @@ -1,10 +1,9 @@ package types const ( - EventTypeRegistration = "oracle_registration" + EventTypeRegistration = "oracle_registration" EventTypeApproveOracleRegistration = "approve_oracle_registration" - AttributeKeyUniqueID = "unique_id" - AttributeKeyOracleAddress = "oracle_address" - AttributeKeyEncryptedOraclePrivKey = "encrypted_oracle_priv_key" + AttributeKeyUniqueID = "unique_id" + AttributeKeyOracleAddress = "oracle_address" ) From 8e5313ba6abe2ac78971ed027f4b36da38d829da Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Thu, 8 Dec 2022 17:47:28 +0900 Subject: [PATCH 20/21] fix --- x/oracle/keeper/oracle.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/oracle/keeper/oracle.go b/x/oracle/keeper/oracle.go index 383716b5..9cb3ae0d 100644 --- a/x/oracle/keeper/oracle.go +++ b/x/oracle/keeper/oracle.go @@ -85,7 +85,7 @@ func (k Keeper) validateApproveOracleRegistration(ctx sdk.Context, msg *types.Ms // check unique id if msg.ApproveOracleRegistration.UniqueId != params.UniqueId { - return types.ErrInvalidUniqueId + return types.ErrInvalidUniqueID } // verify signature From c96befacdf02651ee92f48c47d365fbe9448476a Mon Sep 17 00:00:00 2001 From: audtlr24 Date: Thu, 8 Dec 2022 18:05:31 +0900 Subject: [PATCH 21/21] fix --- x/oracle/keeper/oracle_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/oracle/keeper/oracle_test.go b/x/oracle/keeper/oracle_test.go index 4b20b876..9af88711 100644 --- a/x/oracle/keeper/oracle_test.go +++ b/x/oracle/keeper/oracle_test.go @@ -309,7 +309,7 @@ func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedInvalidUniqueID msgApproveOracleRegistration := types.NewMsgApproveOracleRegistration(approveOracleRegistration, signature.Serialize()) err = suite.OracleKeeper.ApproveOracleRegistration(ctx, msgApproveOracleRegistration) - suite.Require().Error(err, types.ErrInvalidUniqueId) + suite.Require().Error(err, types.ErrInvalidUniqueID) } func (suite *oracleTestSuite) TestApproveOracleRegistrationFailedInvalidSignature() {