Merge pull request #33 from deep-stack/ng-client-set-record

Fixes to nameservice message types and GQL queries
This commit is contained in:
Ashwin Phatak 2022-04-21 10:08:41 +05:30 committed by GitHub
commit de7c0558c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 2429 additions and 774 deletions

View File

@ -1,11 +1,11 @@
# Vulcanize dxns gql # Vulcanize chiba-clonk gql
> Browser : http://localhost:9473 for gql > Browser : http://localhost:9473 for gql
## Start server ## Start server
```shell ```shell
./build/chibaclonkd start --gql-playground --gql-server ./build/chibaclonkd start --gql-playground --gql-server
``` ```
Basic node status: Basic node status:
@ -100,7 +100,7 @@ Query records.
```graphql ```graphql
{ {
queryRecords(attributes: [{ key: "type", value: { string: "wrn:bot" } }]) { queryRecords(attributes: [{ key: "type", value: { string: "crn:bot" } }]) {
id id
names names
bondId bondId
@ -316,7 +316,7 @@ LookUp Names
```graphql ```graphql
{ {
lookupNames(names: ["wrn://hello/test"]){ lookupNames(names: ["crn://hello/test"]){
latest{ latest{
id id
height height

View File

@ -165,7 +165,7 @@ var (
// Ethermint modules // Ethermint modules
evm.AppModuleBasic{}, evm.AppModuleBasic{},
feemarket.AppModuleBasic{}, feemarket.AppModuleBasic{},
// Vulcanize DXNS modules // Vulcanize chiba-clonk modules
auction.AppModuleBasic{}, auction.AppModuleBasic{},
bond.AppModuleBasic{}, bond.AppModuleBasic{},
nameservice.AppModuleBasic{}, nameservice.AppModuleBasic{},
@ -244,7 +244,7 @@ type EthermintApp struct {
EvmKeeper *evmkeeper.Keeper EvmKeeper *evmkeeper.Keeper
FeeMarketKeeper feemarketkeeper.Keeper FeeMarketKeeper feemarketkeeper.Keeper
// DXNS keepers // chiba-clonk keepers
AuctionKeeper auctionkeeper.Keeper AuctionKeeper auctionkeeper.Keeper
BondKeeper bondkeeper.Keeper BondKeeper bondkeeper.Keeper
NameServiceKeeper nameservicekeeper.Keeper NameServiceKeeper nameservicekeeper.Keeper
@ -300,7 +300,7 @@ func NewEthermintApp(
ibchost.StoreKey, ibctransfertypes.StoreKey, ibchost.StoreKey, ibctransfertypes.StoreKey,
// ethermint keys // ethermint keys
evmtypes.StoreKey, feemarkettypes.StoreKey, evmtypes.StoreKey, feemarkettypes.StoreKey,
// dxns keys // chiba-clonk keys
auctiontypes.StoreKey, auctiontypes.StoreKey,
bondtypes.StoreKey, bondtypes.StoreKey,
nameservicetypes.StoreKey, nameservicetypes.StoreKey,
@ -378,7 +378,7 @@ func NewEthermintApp(
appCodec, keys[feemarkettypes.StoreKey], app.GetSubspace(feemarkettypes.ModuleName), appCodec, keys[feemarkettypes.StoreKey], app.GetSubspace(feemarkettypes.ModuleName),
) )
// Create Vulcanize dxns keepers // Create Vulcanize chiba-clonk keepers
app.AuctionKeeper = auctionkeeper.NewKeeper( app.AuctionKeeper = auctionkeeper.NewKeeper(
app.AccountKeeper, app.BankKeeper, keys[auctiontypes.StoreKey], app.AccountKeeper, app.BankKeeper, keys[auctiontypes.StoreKey],
appCodec, app.GetSubspace(auctiontypes.ModuleName), appCodec, app.GetSubspace(auctiontypes.ModuleName),
@ -486,7 +486,7 @@ func NewEthermintApp(
// Ethermint app modules // Ethermint app modules
evm.NewAppModule(app.EvmKeeper, app.AccountKeeper), evm.NewAppModule(app.EvmKeeper, app.AccountKeeper),
feemarket.NewAppModule(app.FeeMarketKeeper), feemarket.NewAppModule(app.FeeMarketKeeper),
// DXNs modules // chiba-clonk modules
auction.NewAppModule(appCodec, app.AuctionKeeper), auction.NewAppModule(appCodec, app.AuctionKeeper),
bond.NewAppModule(appCodec, app.BondKeeper), bond.NewAppModule(appCodec, app.BondKeeper),
nameservice.NewAppModule(app.NameServiceKeeper), nameservice.NewAppModule(app.NameServiceKeeper),
@ -520,7 +520,7 @@ func NewEthermintApp(
feegrant.ModuleName, feegrant.ModuleName,
paramstypes.ModuleName, paramstypes.ModuleName,
vestingtypes.ModuleName, vestingtypes.ModuleName,
// DXNS modules // chiba-clonk modules
auctiontypes.ModuleName, auctiontypes.ModuleName,
bondtypes.ModuleName, bondtypes.ModuleName,
nameservicetypes.ModuleName, nameservicetypes.ModuleName,
@ -549,7 +549,7 @@ func NewEthermintApp(
paramstypes.ModuleName, paramstypes.ModuleName,
upgradetypes.ModuleName, upgradetypes.ModuleName,
vestingtypes.ModuleName, vestingtypes.ModuleName,
// DXNS modules // chiba-clonk modules
auctiontypes.ModuleName, auctiontypes.ModuleName,
bondtypes.ModuleName, bondtypes.ModuleName,
nameservicetypes.ModuleName, nameservicetypes.ModuleName,
@ -582,7 +582,7 @@ func NewEthermintApp(
// Ethermint modules // Ethermint modules
evmtypes.ModuleName, evmtypes.ModuleName,
feemarkettypes.ModuleName, feemarkettypes.ModuleName,
// DXNS modules // chiba-clonk modules
auctiontypes.ModuleName, auctiontypes.ModuleName,
bondtypes.ModuleName, bondtypes.ModuleName,
nameservicetypes.ModuleName, nameservicetypes.ModuleName,
@ -843,7 +843,7 @@ func initParamsKeeper(
// ethermint subspaces // ethermint subspaces
paramsKeeper.Subspace(evmtypes.ModuleName) paramsKeeper.Subspace(evmtypes.ModuleName)
paramsKeeper.Subspace(feemarkettypes.ModuleName) paramsKeeper.Subspace(feemarkettypes.ModuleName)
// dxns subspaces // chiba-clonk subspaces
paramsKeeper.Subspace(auctiontypes.ModuleName) paramsKeeper.Subspace(auctiontypes.ModuleName)
paramsKeeper.Subspace(bondtypes.ModuleName) paramsKeeper.Subspace(bondtypes.ModuleName)
paramsKeeper.Subspace(nameservicetypes.ModuleName) paramsKeeper.Subspace(nameservicetypes.ModuleName)

View File

@ -179,17 +179,20 @@
- [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest) - [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest)
- [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse) - [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse)
- [QueryListRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest) - [QueryListRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest)
- [QueryListRecordsRequest.KeyValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.KeyValueInput)
- [QueryListRecordsRequest.ReferenceInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ReferenceInput)
- [QueryListRecordsRequest.ValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput)
- [QueryListRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListRecordsResponse) - [QueryListRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListRecordsResponse)
- [QueryLookupWrn](#vulcanize.nameservice.v1beta1.QueryLookupWrn) - [QueryLookupCrn](#vulcanize.nameservice.v1beta1.QueryLookupCrn)
- [QueryLookupWrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupWrnResponse) - [QueryLookupCrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupCrnResponse)
- [QueryParamsRequest](#vulcanize.nameservice.v1beta1.QueryParamsRequest) - [QueryParamsRequest](#vulcanize.nameservice.v1beta1.QueryParamsRequest)
- [QueryParamsResponse](#vulcanize.nameservice.v1beta1.QueryParamsResponse) - [QueryParamsResponse](#vulcanize.nameservice.v1beta1.QueryParamsResponse)
- [QueryRecordByBondIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest) - [QueryRecordByBondIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdRequest)
- [QueryRecordByBondIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse) - [QueryRecordByBondIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByBondIdResponse)
- [QueryRecordByIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIdRequest) - [QueryRecordByIdRequest](#vulcanize.nameservice.v1beta1.QueryRecordByIdRequest)
- [QueryRecordByIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIdResponse) - [QueryRecordByIdResponse](#vulcanize.nameservice.v1beta1.QueryRecordByIdResponse)
- [QueryResolveWrn](#vulcanize.nameservice.v1beta1.QueryResolveWrn) - [QueryResolveCrn](#vulcanize.nameservice.v1beta1.QueryResolveCrn)
- [QueryResolveWrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveWrnResponse) - [QueryResolveCrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveCrnResponse)
- [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) - [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest)
- [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) - [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse)
@ -2362,11 +2365,12 @@ Params defines the nameservice module records
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `id` | [string](#string) | | | | `id` | [string](#string) | | |
| `bond_id` | [string](#string) | | | | `bond_id` | [string](#string) | | |
| `create_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | | `create_time` | [string](#string) | | |
| `expiry_time` | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | | | `expiry_time` | [string](#string) | | |
| `deleted` | [bool](#bool) | | | | `deleted` | [bool](#bool) | | |
| `owners` | [string](#string) | repeated | | | `owners` | [string](#string) | repeated | |
| `attributes` | [bytes](#bytes) | | | | `attributes` | [string](#string) | | |
| `names` | [string](#string) | repeated | |
@ -2597,6 +2601,8 @@ QueryListRecordsRequest is request type for nameservice records list
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `attributes` | [QueryListRecordsRequest.KeyValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.KeyValueInput) | repeated | |
| `all` | [bool](#bool) | | |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. | | `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |
@ -2604,6 +2610,58 @@ QueryListRecordsRequest is request type for nameservice records list
<a name="vulcanize.nameservice.v1beta1.QueryListRecordsRequest.KeyValueInput"></a>
### QueryListRecordsRequest.KeyValueInput
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `key` | [string](#string) | | |
| `value` | [QueryListRecordsRequest.ValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput) | | |
<a name="vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ReferenceInput"></a>
### QueryListRecordsRequest.ReferenceInput
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `id` | [string](#string) | | |
<a name="vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput"></a>
### QueryListRecordsRequest.ValueInput
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `type` | [string](#string) | | |
| `string` | [string](#string) | | |
| `int` | [int64](#int64) | | |
| `float` | [double](#double) | | |
| `boolean` | [bool](#bool) | | |
| `reference` | [QueryListRecordsRequest.ReferenceInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ReferenceInput) | | |
| `values` | [QueryListRecordsRequest.ValueInput](#vulcanize.nameservice.v1beta1.QueryListRecordsRequest.ValueInput) | repeated | |
<a name="vulcanize.nameservice.v1beta1.QueryListRecordsResponse"></a> <a name="vulcanize.nameservice.v1beta1.QueryListRecordsResponse"></a>
### QueryListRecordsResponse ### QueryListRecordsResponse
@ -2620,25 +2678,25 @@ QueryListRecordsResponse is response type for nameservice records list
<a name="vulcanize.nameservice.v1beta1.QueryLookupWrn"></a> <a name="vulcanize.nameservice.v1beta1.QueryLookupCrn"></a>
### QueryLookupWrn ### QueryLookupCrn
QueryLookupWrn is request type for LookupWrn QueryLookupCrn is request type for LookupCrn
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `wrn` | [string](#string) | | | | `crn` | [string](#string) | | |
<a name="vulcanize.nameservice.v1beta1.QueryLookupWrnResponse"></a> <a name="vulcanize.nameservice.v1beta1.QueryLookupCrnResponse"></a>
### QueryLookupWrnResponse ### QueryLookupCrnResponse
QueryLookupWrnResponse is response type for QueryLookupWrn QueryLookupCrnResponse is response type for QueryLookupCrn
| Field | Type | Label | Description | | Field | Type | Label | Description |
@ -2737,25 +2795,25 @@ QueryRecordByIdResponse is response type for nameservice records by id
<a name="vulcanize.nameservice.v1beta1.QueryResolveWrn"></a> <a name="vulcanize.nameservice.v1beta1.QueryResolveCrn"></a>
### QueryResolveWrn ### QueryResolveCrn
QueryResolveWrn is request type for ResolveWrn QueryResolveCrn is request type for ResolveCrn
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `wrn` | [string](#string) | | | | `crn` | [string](#string) | | |
<a name="vulcanize.nameservice.v1beta1.QueryResolveWrnResponse"></a> <a name="vulcanize.nameservice.v1beta1.QueryResolveCrnResponse"></a>
### QueryResolveWrnResponse ### QueryResolveCrnResponse
QueryResolveWrnResponse is response type for QueryResolveWrn QueryResolveCrnResponse is response type for QueryResolveCrn
| Field | Type | Label | Description | | Field | Type | Label | Description |
@ -2817,8 +2875,8 @@ Query defines the gRPC querier service for nameservice module
| `GetNameServiceModuleBalance` | [GetNameServiceModuleBalanceRequest](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest) | [GetNameServiceModuleBalanceResponse](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse) | Get nameservice module balance | GET|/vulcanize/nameservice/v1beta1/balance| | `GetNameServiceModuleBalance` | [GetNameServiceModuleBalanceRequest](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceRequest) | [GetNameServiceModuleBalanceResponse](#vulcanize.nameservice.v1beta1.GetNameServiceModuleBalanceResponse) | Get nameservice module balance | GET|/vulcanize/nameservice/v1beta1/balance|
| `ListNameRecords` | [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest) | [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse) | List name records | GET|/vulcanize/nameservice/v1beta1/names| | `ListNameRecords` | [QueryListNameRecordsRequest](#vulcanize.nameservice.v1beta1.QueryListNameRecordsRequest) | [QueryListNameRecordsResponse](#vulcanize.nameservice.v1beta1.QueryListNameRecordsResponse) | List name records | GET|/vulcanize/nameservice/v1beta1/names|
| `Whois` | [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) | [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) | Whois method retrieve the name authority info | GET|/vulcanize/nameservice/v1beta1/whois/{name}| | `Whois` | [QueryWhoisRequest](#vulcanize.nameservice.v1beta1.QueryWhoisRequest) | [QueryWhoisResponse](#vulcanize.nameservice.v1beta1.QueryWhoisResponse) | Whois method retrieve the name authority info | GET|/vulcanize/nameservice/v1beta1/whois/{name}|
| `LookupWrn` | [QueryLookupWrn](#vulcanize.nameservice.v1beta1.QueryLookupWrn) | [QueryLookupWrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupWrnResponse) | LookupWrn | GET|/vulcanize/nameservice/v1beta1/lookup| | `LookupCrn` | [QueryLookupCrn](#vulcanize.nameservice.v1beta1.QueryLookupCrn) | [QueryLookupCrnResponse](#vulcanize.nameservice.v1beta1.QueryLookupCrnResponse) | LookupCrn | GET|/vulcanize/nameservice/v1beta1/lookup|
| `ResolveWrn` | [QueryResolveWrn](#vulcanize.nameservice.v1beta1.QueryResolveWrn) | [QueryResolveWrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveWrnResponse) | ResolveWrn | GET|/vulcanize/nameservice/v1beta1/resolve| | `ResolveCrn` | [QueryResolveCrn](#vulcanize.nameservice.v1beta1.QueryResolveCrn) | [QueryResolveCrnResponse](#vulcanize.nameservice.v1beta1.QueryResolveCrnResponse) | ResolveCrn | GET|/vulcanize/nameservice/v1beta1/resolve|
| `GetRecordExpiryQueue` | [QueryGetRecordExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueue) | [QueryGetRecordExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueueResponse) | GetRecordExpiryQueue | GET|/vulcanize/nameservice/v1beta1/record-expiry| | `GetRecordExpiryQueue` | [QueryGetRecordExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueue) | [QueryGetRecordExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetRecordExpiryQueueResponse) | GetRecordExpiryQueue | GET|/vulcanize/nameservice/v1beta1/record-expiry|
| `GetAuthorityExpiryQueue` | [QueryGetAuthorityExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueue) | [QueryGetAuthorityExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueueResponse) | GetAuthorityExpiryQueue | GET|/vulcanize/nameservice/v1beta1/authority-expiry| | `GetAuthorityExpiryQueue` | [QueryGetAuthorityExpiryQueue](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueue) | [QueryGetAuthorityExpiryQueueResponse](#vulcanize.nameservice.v1beta1.QueryGetAuthorityExpiryQueueResponse) | GetAuthorityExpiryQueue | GET|/vulcanize/nameservice/v1beta1/authority-expiry|
@ -2868,7 +2926,7 @@ MsgDeleteNameAuthority is SDK message for DeleteNameAuthority
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `wrn` | [string](#string) | | | | `crn` | [string](#string) | | |
| `signer` | [string](#string) | | | | `signer` | [string](#string) | | |
@ -3053,7 +3111,7 @@ MsgSetName
| Field | Type | Label | Description | | Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- | | ----- | ---- | ----- | ----------- |
| `wrn` | [string](#string) | | | | `crn` | [string](#string) | | |
| `cid` | [string](#string) | | | | `cid` | [string](#string) | | |
| `signer` | [string](#string) | | | | `signer` | [string](#string) | | |
@ -3095,6 +3153,11 @@ MsgSetRecord
MsgSetRecordResponse MsgSetRecordResponse
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `id` | [string](#string) | | |
@ -3134,7 +3197,7 @@ Msg
| `DissociateBond` | [MsgDissociateBond](#vulcanize.nameservice.v1beta1.MsgDissociateBond) | [MsgDissociateBondResponse](#vulcanize.nameservice.v1beta1.MsgDissociateBondResponse) | DissociateBond | | | `DissociateBond` | [MsgDissociateBond](#vulcanize.nameservice.v1beta1.MsgDissociateBond) | [MsgDissociateBondResponse](#vulcanize.nameservice.v1beta1.MsgDissociateBondResponse) | DissociateBond | |
| `DissociateRecords` | [MsgDissociateRecords](#vulcanize.nameservice.v1beta1.MsgDissociateRecords) | [MsgDissociateRecordsResponse](#vulcanize.nameservice.v1beta1.MsgDissociateRecordsResponse) | DissociateRecords | | | `DissociateRecords` | [MsgDissociateRecords](#vulcanize.nameservice.v1beta1.MsgDissociateRecords) | [MsgDissociateRecordsResponse](#vulcanize.nameservice.v1beta1.MsgDissociateRecordsResponse) | DissociateRecords | |
| `ReAssociateRecords` | [MsgReAssociateRecords](#vulcanize.nameservice.v1beta1.MsgReAssociateRecords) | [MsgReAssociateRecordsResponse](#vulcanize.nameservice.v1beta1.MsgReAssociateRecordsResponse) | ReAssociateRecords | | | `ReAssociateRecords` | [MsgReAssociateRecords](#vulcanize.nameservice.v1beta1.MsgReAssociateRecords) | [MsgReAssociateRecordsResponse](#vulcanize.nameservice.v1beta1.MsgReAssociateRecordsResponse) | ReAssociateRecords | |
| `SetName` | [MsgSetName](#vulcanize.nameservice.v1beta1.MsgSetName) | [MsgSetNameResponse](#vulcanize.nameservice.v1beta1.MsgSetNameResponse) | SetName will store the name with given wrn and name | | | `SetName` | [MsgSetName](#vulcanize.nameservice.v1beta1.MsgSetName) | [MsgSetNameResponse](#vulcanize.nameservice.v1beta1.MsgSetNameResponse) | SetName will store the name with given crn and name | |
| `ReserveName` | [MsgReserveAuthority](#vulcanize.nameservice.v1beta1.MsgReserveAuthority) | [MsgReserveAuthorityResponse](#vulcanize.nameservice.v1beta1.MsgReserveAuthorityResponse) | Reserve name | | | `ReserveName` | [MsgReserveAuthority](#vulcanize.nameservice.v1beta1.MsgReserveAuthority) | [MsgReserveAuthorityResponse](#vulcanize.nameservice.v1beta1.MsgReserveAuthorityResponse) | Reserve name | |
| `DeleteName` | [MsgDeleteNameAuthority](#vulcanize.nameservice.v1beta1.MsgDeleteNameAuthority) | [MsgDeleteNameAuthorityResponse](#vulcanize.nameservice.v1beta1.MsgDeleteNameAuthorityResponse) | Delete Name method will remove authority name | | | `DeleteName` | [MsgDeleteNameAuthority](#vulcanize.nameservice.v1beta1.MsgDeleteNameAuthority) | [MsgDeleteNameAuthorityResponse](#vulcanize.nameservice.v1beta1.MsgDeleteNameAuthorityResponse) | Delete Name method will remove authority name | |
| `SetAuthorityBond` | [MsgSetAuthorityBond](#vulcanize.nameservice.v1beta1.MsgSetAuthorityBond) | [MsgSetAuthorityBondResponse](#vulcanize.nameservice.v1beta1.MsgSetAuthorityBondResponse) | SetAuthorityBond | | | `SetAuthorityBond` | [MsgSetAuthorityBond](#vulcanize.nameservice.v1beta1.MsgSetAuthorityBond) | [MsgSetAuthorityBondResponse](#vulcanize.nameservice.v1beta1.MsgSetAuthorityBondResponse) | SetAuthorityBond | |

4
go.mod
View File

@ -3,6 +3,7 @@ module github.com/tharsis/ethermint
go 1.17 go 1.17
require ( require (
github.com/99designs/gqlgen v0.17.2
github.com/btcsuite/btcd v0.22.0-beta github.com/btcsuite/btcd v0.22.0-beta
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/cosmos/cosmos-sdk v0.45.1 github.com/cosmos/cosmos-sdk v0.45.1
@ -35,6 +36,7 @@ require (
github.com/tendermint/tendermint v0.34.14 github.com/tendermint/tendermint v0.34.14
github.com/tendermint/tm-db v0.6.7 github.com/tendermint/tm-db v0.6.7
github.com/tyler-smith/go-bip39 v1.1.0 github.com/tyler-smith/go-bip39 v1.1.0
github.com/vektah/gqlparser/v2 v2.4.1
google.golang.org/genproto v0.0.0-20220401170504-314d38edb7de google.golang.org/genproto v0.0.0-20220401170504-314d38edb7de
google.golang.org/grpc v1.45.0 google.golang.org/grpc v1.45.0
google.golang.org/protobuf v1.28.0 google.golang.org/protobuf v1.28.0
@ -44,7 +46,6 @@ require (
require ( require (
filippo.io/edwards25519 v1.0.0-beta.2 // indirect filippo.io/edwards25519 v1.0.0-beta.2 // indirect
github.com/99designs/gqlgen v0.17.2 // indirect
github.com/99designs/keyring v1.1.6 // indirect github.com/99designs/keyring v1.1.6 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/DataDog/zstd v1.4.5 // indirect github.com/DataDog/zstd v1.4.5 // indirect
@ -152,7 +153,6 @@ require (
github.com/tendermint/go-amino v0.16.0 // indirect github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect github.com/tklauser/numcpus v0.2.2 // indirect
github.com/vektah/gqlparser/v2 v2.4.1 // indirect
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 // indirect github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 // indirect
github.com/zondax/hid v0.9.0 // indirect github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect go.etcd.io/bbolt v1.3.6 // indirect

7
go.sum
View File

@ -115,11 +115,13 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc= github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKSc=
github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
@ -282,6 +284,7 @@ github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUn
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y=
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
@ -993,6 +996,7 @@ github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KR
github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU= github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
@ -1112,7 +1116,6 @@ github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/X
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/vektah/gqlparser/v2 v2.4.0 h1:EmA4dw9mqHm0j6Xzb9T21hOrp3oXmxnS40vwki70DZU=
github.com/vektah/gqlparser/v2 v2.4.0/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= github.com/vektah/gqlparser/v2 v2.4.0/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0=
github.com/vektah/gqlparser/v2 v2.4.1 h1:QOyEn8DAPMUMARGMeshKDkDgNmVoEaEGiDB0uWxcSlQ= github.com/vektah/gqlparser/v2 v2.4.1 h1:QOyEn8DAPMUMARGMeshKDkDgNmVoEaEGiDB0uWxcSlQ=
github.com/vektah/gqlparser/v2 v2.4.1/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0= github.com/vektah/gqlparser/v2 v2.4.1/go.mod h1:flJWIR04IMQPGz+BXLrORkrARBxv/rtyIAFvd/MceW0=
@ -1524,8 +1527,8 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.9 h1:j9KsMiaP1c3B0OTQGth0/k+miLGTgLsAFUCrF2vLcF8=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -1,11 +1,11 @@
# Vulcanize dxns gql # Vulcanize chiba-clonk gql
> Browser : http://localhost:9473 for gql > Browser : http://localhost:9473 for gql
## Start server ## Start server
```shell ```shell
./build/chibaclonkd start --gql-playground --gql-server ./build/chibaclonkd start --gql-playground --gql-server
``` ```
Basic node status: Basic node status:
@ -100,7 +100,7 @@ Query records.
```graphql ```graphql
{ {
queryRecords(attributes: [{ key: "type", value: { string: "wrn:bot" } }]) { queryRecords(attributes: [{ key: "type", value: { string: "crn:bot" } }]) {
id id
names names
bondId bondId
@ -316,7 +316,7 @@ LookUp Names
```graphql ```graphql
{ {
lookupNames(names: ["wrn://hello/test"]){ lookupNames(names: ["crn://hello/test"]){
latest{ latest{
id id
height height

View File

@ -988,7 +988,7 @@ func (ec *executionContext) introspectType(name string) (*introspection.Type, er
} }
var sources = []*ast.Source{ var sources = []*ast.Source{
{Name: "vulcanize/dxns/schema.graphql", Input: `# Reference to another record. {Name: "vulcanize/chiba-clonk/schema.graphql", Input: `# Reference to another record.
type Reference { type Reference {
id: String! # ID of linked record. id: String! # ID of linked record.
} }
@ -1096,7 +1096,7 @@ type PeerInfo {
remote_ip: String! remote_ip: String!
} }
# Vulcanize DXNS status. # Vulcanize chiba-clonk status.
type Status { type Status {
version: String! version: String!
node: NodeInfo! node: NodeInfo!

View File

@ -4,7 +4,7 @@
# for detailed .gqlgen.yml documentation. # for detailed .gqlgen.yml documentation.
schema: schema:
- vulcanize/dxns/*.graphql - vulcanize/chiba-clonk/*.graphql
exec: exec:
filename: generated.go filename: generated.go
model: model:

View File

@ -3,13 +3,14 @@ package gql
import ( import (
"context" "context"
"encoding/base64" "encoding/base64"
"strconv"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
auctiontypes "github.com/tharsis/ethermint/x/auction/types" auctiontypes "github.com/tharsis/ethermint/x/auction/types"
bondtypes "github.com/tharsis/ethermint/x/bond/types" bondtypes "github.com/tharsis/ethermint/x/bond/types"
nstypes "github.com/tharsis/ethermint/x/nameservice/types" nstypes "github.com/tharsis/ethermint/x/nameservice/types"
"strconv"
) )
// DefaultLogNumLines is the number of log lines to tail by default. // DefaultLogNumLines is the number of log lines to tail by default.
@ -75,17 +76,18 @@ func (q queryResolver) ResolveNames(ctx context.Context, names []string) ([]*Rec
nsQueryClient := nstypes.NewQueryClient(q.ctx) nsQueryClient := nstypes.NewQueryClient(q.ctx)
var gqlResponse []*Record var gqlResponse []*Record
for _, name := range names { for _, name := range names {
res, err := nsQueryClient.ResolveWrn(context.Background(), &nstypes.QueryResolveWrn{Wrn: name}) res, err := nsQueryClient.ResolveCrn(context.Background(), &nstypes.QueryResolveCrn{Crn: name})
if err != nil { if err != nil {
return nil, err // Return nil for record not found.
} gqlResponse = append(gqlResponse, nil)
} else {
gqlRecord, err := getGQLRecord(context.Background(), q, *res.GetRecord())
if err != nil {
return nil, err
}
gqlRecord, err := getGQLRecord(context.Background(), q, *res.GetRecord()) gqlResponse = append(gqlResponse, gqlRecord)
if err != nil {
return nil, err
} }
gqlResponse = append(gqlResponse, gqlRecord)
} }
return gqlResponse, nil return gqlResponse, nil
@ -96,17 +98,18 @@ func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*Name
var gqlResponse []*NameRecord var gqlResponse []*NameRecord
for _, name := range names { for _, name := range names {
res, err := nsQueryClient.LookupWrn(context.Background(), &nstypes.QueryLookupWrn{Wrn: name}) res, err := nsQueryClient.LookupCrn(context.Background(), &nstypes.QueryLookupCrn{Crn: name})
if err != nil { if err != nil {
return nil, err // Return nil for name not found.
} gqlResponse = append(gqlResponse, nil)
} else {
gqlRecord, err := getGQLNameRecord(res.GetName())
if err != nil {
return nil, err
}
gqlRecord, err := getGQLNameRecord(res.GetName()) gqlResponse = append(gqlResponse, gqlRecord)
if err != nil {
return nil, err
} }
gqlResponse = append(gqlResponse, gqlRecord)
} }
return gqlResponse, nil return gqlResponse, nil
@ -114,7 +117,15 @@ func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*Name
func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error) { func (q queryResolver) QueryRecords(ctx context.Context, attributes []*KeyValueInput, all *bool) ([]*Record, error) {
nsQueryClient := nstypes.NewQueryClient(q.ctx) nsQueryClient := nstypes.NewQueryClient(q.ctx)
res, err := nsQueryClient.ListRecords(context.Background(), &nstypes.QueryListRecordsRequest{})
res, err := nsQueryClient.ListRecords(
context.Background(),
&nstypes.QueryListRecordsRequest{
Attributes: parseRequestAttributes(attributes),
All: (all != nil && *all),
},
)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -141,13 +152,15 @@ func (q queryResolver) GetRecordsByIds(ctx context.Context, ids []string) ([]*Re
for i, id := range ids { for i, id := range ids {
res, err := nsQueryClient.GetRecord(context.Background(), &nstypes.QueryRecordByIdRequest{Id: id}) res, err := nsQueryClient.GetRecord(context.Background(), &nstypes.QueryRecordByIdRequest{Id: id})
if err != nil { if err != nil {
return nil, err // Return nil for record not found.
gqlResponse[i] = nil
} else {
record, err := getGQLRecord(context.Background(), q, res.GetRecord())
if err != nil {
return nil, err
}
gqlResponse[i] = record
} }
record, err := getGQLRecord(context.Background(), q, res.GetRecord())
if err != nil {
return nil, err
}
gqlResponse[i] = record
} }
return gqlResponse, nil return gqlResponse, nil

View File

@ -3,12 +3,13 @@ package gql
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"reflect"
"strconv"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
auctiontypes "github.com/tharsis/ethermint/x/auction/types" auctiontypes "github.com/tharsis/ethermint/x/auction/types"
bondtypes "github.com/tharsis/ethermint/x/bond/types" bondtypes "github.com/tharsis/ethermint/x/bond/types"
nstypes "github.com/tharsis/ethermint/x/nameservice/types" nstypes "github.com/tharsis/ethermint/x/nameservice/types"
"reflect"
"strconv"
) )
// OwnerAttributeName denotes the owner attribute name for a bond. // OwnerAttributeName denotes the owner attribute name for a bond.
@ -72,9 +73,10 @@ func getGQLRecord(ctx context.Context, resolver QueryResolver, record nstypes.Re
return &Record{ return &Record{
ID: record.Id, ID: record.Id,
BondID: record.GetBondId(), BondID: record.GetBondId(),
CreateTime: record.GetCreateTime().String(), CreateTime: record.GetCreateTime(),
ExpiryTime: record.GetExpiryTime().String(), ExpiryTime: record.GetExpiryTime(),
Owners: record.GetOwners(), Owners: record.GetOwners(),
Names: record.GetNames(),
Attributes: attributes, Attributes: attributes,
References: references, References: references,
}, nil }, nil
@ -265,3 +267,49 @@ func mapToKeyValuePairs(attrs map[string]interface{}) ([]*KeyValue, error) {
return kvPairs, nil return kvPairs, nil
} }
func parseRequestAttributes(attrs []*KeyValueInput) []*nstypes.QueryListRecordsRequest_KeyValueInput {
kvPairs := []*nstypes.QueryListRecordsRequest_KeyValueInput{}
for _, value := range attrs {
kvPair := &nstypes.QueryListRecordsRequest_KeyValueInput{
Key: value.Key,
Value: &nstypes.QueryListRecordsRequest_ValueInput{},
}
if value.Value.String != nil {
kvPair.Value.String_ = *value.Value.String
kvPair.Value.Type = "string"
}
if value.Value.Int != nil {
kvPair.Value.Int = int64(*value.Value.Int)
kvPair.Value.Type = "int"
}
if value.Value.Float != nil {
kvPair.Value.Float = *value.Value.Float
kvPair.Value.Type = "float"
}
if value.Value.Boolean != nil {
kvPair.Value.Boolean = *value.Value.Boolean
kvPair.Value.Type = "boolean"
}
if value.Value.Reference != nil {
reference := &nstypes.QueryListRecordsRequest_ReferenceInput{
Id: value.Value.Reference.ID,
}
kvPair.Value.Reference = reference
kvPair.Value.Type = "reference"
}
// TODO: Handle arrays.
kvPairs = append(kvPairs, kvPair)
}
return kvPairs
}

View File

@ -106,7 +106,7 @@ type PeerInfo {
remote_ip: String! remote_ip: String!
} }
# Vulcanize DXNS status. # Vulcanize chiba-clonk status.
type Status { type Status {
version: String! version: String!
node: NodeInfo! node: NodeInfo!

24
init.sh
View File

@ -32,6 +32,30 @@ cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["staking"]["params"]
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
# Custom modules
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["record_rent"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_rent"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_commit_fee"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_reveal_fee"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_minimum_bid"]["denom"]="aphoton"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
if [[ "$TEST_NAMESERVICE_EXPIRY" == "true" ]]; then
echo "Setting timers for expiry tests."
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["record_rent_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_grace_period"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_rent_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
fi
if [[ "$TEST_AUCTION_ENABLED" == "true" ]]; then
echo "Enabling auction and setting timers."
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_enabled"]=true' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_rent_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_grace_period"]="300s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_commits_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
cat $HOME/.chibaclonkd/config/genesis.json | jq '.app_state["nameservice"]["params"]["authority_auction_reveals_duration"]="60s"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json
fi
# increase block time (?) # increase block time (?)
cat $HOME/.chibaclonkd/config/genesis.json | jq '.consensus_params["block"]["time_iota_ms"]="1000"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json cat $HOME/.chibaclonkd/config/genesis.json | jq '.consensus_params["block"]["time_iota_ms"]="1000"' > $HOME/.chibaclonkd/config/tmp_genesis.json && mv $HOME/.chibaclonkd/config/tmp_genesis.json $HOME/.chibaclonkd/config/genesis.json

View File

@ -68,23 +68,22 @@ message Record {
string bond_id = 2 [ string bond_id = 2 [
(gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\"" (gogoproto.moretags) = "json:\"bondId\" yaml:\"bondId\""
]; ];
google.protobuf.Timestamp create_time = 3 [ string create_time = 3 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\"" (gogoproto.moretags) = "json:\"createTime\" yaml:\"createTime\""
]; ];
google.protobuf.Timestamp expiry_time = 4 [ string expiry_time = 4 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\"" (gogoproto.moretags) = "json:\"expiryTime\" yaml:\"expiryTime\""
]; ];
bool deleted = 5; bool deleted = 5;
repeated string owners = 6 [ repeated string owners = 6 [
(gogoproto.moretags) = "json:\"owners\" yaml:\"owners\"" (gogoproto.moretags) = "json:\"owners\" yaml:\"owners\""
]; ];
bytes attributes = 7 [ string attributes = 7 [
(gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\"" (gogoproto.moretags) = "json:\"attributes\" yaml:\"attributes\""
]; ];
repeated string names = 8 [
(gogoproto.moretags) = "json:\"names\" yaml:\"names\""
];
} }
// AuthorityEntry defines the nameservice module AuthorityEntries // AuthorityEntry defines the nameservice module AuthorityEntries

View File

@ -39,12 +39,12 @@ service Query {
rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse){ rpc Whois(QueryWhoisRequest) returns (QueryWhoisResponse){
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/whois/{name}"; option (google.api.http).get = "/vulcanize/nameservice/v1beta1/whois/{name}";
} }
// LookupWrn // LookupCrn
rpc LookupWrn(QueryLookupWrn) returns (QueryLookupWrnResponse){ rpc LookupCrn(QueryLookupCrn) returns (QueryLookupCrnResponse){
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/lookup"; option (google.api.http).get = "/vulcanize/nameservice/v1beta1/lookup";
} }
// ResolveWrn // ResolveCrn
rpc ResolveWrn(QueryResolveWrn) returns (QueryResolveWrnResponse){ rpc ResolveCrn(QueryResolveCrn) returns (QueryResolveCrnResponse){
option (google.api.http).get = "/vulcanize/nameservice/v1beta1/resolve"; option (google.api.http).get = "/vulcanize/nameservice/v1beta1/resolve";
} }
// GetRecordExpiryQueue // GetRecordExpiryQueue
@ -68,8 +68,28 @@ message QueryParamsResponse{
// QueryListRecordsRequest is request type for nameservice records list // QueryListRecordsRequest is request type for nameservice records list
message QueryListRecordsRequest{ message QueryListRecordsRequest{
message ReferenceInput {
string id = 1;
}
message ValueInput {
string type = 1;
string string = 2;
int64 int = 3;
double float = 4;
bool boolean = 5;
ReferenceInput reference = 6;
repeated ValueInput values = 7;
}
message KeyValueInput {
string key = 1;
ValueInput value = 2;
}
repeated KeyValueInput attributes = 1;
bool all = 2;
// pagination defines an optional pagination for the request. // pagination defines an optional pagination for the request.
cosmos.base.query.v1beta1.PageRequest pagination = 1; cosmos.base.query.v1beta1.PageRequest pagination = 3;
} }
// QueryListRecordsResponse is response type for nameservice records list // QueryListRecordsResponse is response type for nameservice records list
@ -158,23 +178,23 @@ message QueryWhoisResponse{
]; ];
} }
// QueryLookupWrn is request type for LookupWrn // QueryLookupCrn is request type for LookupCrn
message QueryLookupWrn{ message QueryLookupCrn{
string wrn = 1; string crn = 1;
} }
// QueryLookupWrnResponse is response type for QueryLookupWrn // QueryLookupCrnResponse is response type for QueryLookupCrn
message QueryLookupWrnResponse{ message QueryLookupCrnResponse{
NameRecord name = 1; NameRecord name = 1;
} }
// QueryResolveWrn is request type for ResolveWrn // QueryResolveCrn is request type for ResolveCrn
message QueryResolveWrn{ message QueryResolveCrn{
string wrn = 1; string crn = 1;
} }
// QueryResolveWrnResponse is response type for QueryResolveWrn // QueryResolveCrnResponse is response type for QueryResolveCrn
message QueryResolveWrnResponse{ message QueryResolveCrnResponse{
Record record = 1; Record record = 1;
} }

View File

@ -20,7 +20,7 @@ service Msg {
rpc DissociateRecords(MsgDissociateRecords) returns (MsgDissociateRecordsResponse){} rpc DissociateRecords(MsgDissociateRecords) returns (MsgDissociateRecordsResponse){}
// ReAssociateRecords // ReAssociateRecords
rpc ReAssociateRecords(MsgReAssociateRecords) returns (MsgReAssociateRecordsResponse){} rpc ReAssociateRecords(MsgReAssociateRecords) returns (MsgReAssociateRecordsResponse){}
// SetName will store the name with given wrn and name // SetName will store the name with given crn and name
rpc SetName(MsgSetName) returns (MsgSetNameResponse){} rpc SetName(MsgSetName) returns (MsgSetNameResponse){}
// Reserve name // Reserve name
rpc ReserveName(MsgReserveAuthority) returns (MsgReserveAuthorityResponse){} rpc ReserveName(MsgReserveAuthority) returns (MsgReserveAuthorityResponse){}
@ -43,6 +43,7 @@ message MsgSetRecord{
// MsgSetRecordResponse // MsgSetRecordResponse
message MsgSetRecordResponse{ message MsgSetRecordResponse{
string id = 1;
} }
// Payload // Payload
@ -56,7 +57,7 @@ message Payload {
// MsgSetName // MsgSetName
message MsgSetName{ message MsgSetName{
string wrn = 1; string crn = 1;
string cid = 2; string cid = 2;
string signer = 3; string signer = 3;
} }
@ -92,7 +93,7 @@ message MsgSetAuthorityBondResponse{
// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority // MsgDeleteNameAuthority is SDK message for DeleteNameAuthority
message MsgDeleteNameAuthority{ message MsgDeleteNameAuthority{
string wrn = 1; string crn = 1;
string signer = 2; string signer = 2;
} }

View File

@ -1,17 +1,17 @@
# Build chain # Build chain
```bash ```bash
# it will create binary in build folder with `ethermintd` # it will create binary in build folder with `ethermintd`
$ make build $ make build
``` ```
# Setup Chain # Setup Chain
```bash ```bash
./build/chibaclonkd keys add root ./build/chibaclonkd keys add root
./build/chibaclonkd init test-moniker --chain-id ethermint_9000-1 ./build/chibaclonkd init test-moniker --chain-id ethermint_9000-1
./build/chibaclonkd add-genesis-account $(./build/chibaclonkd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake ./build/chibaclonkd add-genesis-account $(./build/chibaclonkd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake
./build/chibaclonkd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 ./build/chibaclonkd gentx root 1000000000000000000stake --chain-id ethermint_9000-1
./build/chibaclonkd collect-gentxs ./build/chibaclonkd collect-gentxs
./build/chibaclonkd start ./build/chibaclonkd start
``` ```
@ -78,7 +78,7 @@ $ ./build/chibaclonkd tx nameservice set ~/Desktop/examples/records/example1.yml
## Get records list ## Get records list
```bash ```bash
$ ./build/chibaclonkd q nameservice list -o json | jq $ ./build/chibaclonkd q nameservice list -o json | jq
[ [
{ {
"id": "bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae", "id": "bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae",
@ -181,8 +181,8 @@ $ ./build/chibaclonkd q nameservice balance -o json | jq .
## add bond to the authority ## add bond to the authority
```bash ```bash
$ ./build/chibaclonkd tx nameservice authority-bond [Authority Name] [Bond ID ] --from root --chain-id ethermint_9000-1 -y -o json | jq . $ ./build/chibaclonkd tx nameservice authority-bond [Authority Name] [Bond ID ] --from root --chain-id ethermint_9000-1 -y -o json | jq .
$ ./build/chibaclonkd tx nameservice authority-bond hello 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 -y -o json | jq . $ ./build/chibaclonkd tx nameservice authority-bond hello 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 -y -o json | jq .
``` ```
## Query the records by associate bond id ## Query the records by associate bond id
@ -247,12 +247,12 @@ txhash: 7AFEF524CB0D92D6576FC08601A787786E802449888FD8DDAA7635698CC85060
"timestamp": "" "timestamp": ""
} }
``` ```
## dissociate-records => remove all record from bond ## dissociate-records => remove all record from bond
```bash ```bash
$./build/chibaclonkd tx nameservice dissociate-records c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id ethermint_9000-1 -y -o json | jq . $./build/chibaclonkd tx nameservice dissociate-records c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id ethermint_9000-1 -y -o json | jq .
{ {
"height": "0", "height": "0",
"txhash": "0316F503E5DEA47CB108AE6C7C7FFAF3F71CC56BC22F63CB97322E1BE48B33B9", "txhash": "0316F503E5DEA47CB108AE6C7C7FFAF3F71CC56BC22F63CB97322E1BE48B33B9",
@ -274,14 +274,14 @@ $./build/chibaclonkd tx nameservice dissociate-records c3f7a78c5042d2003880962ba
> When a record is expires , needs to renew record > When a record is expires , needs to renew record
```bash ```bash
$ ./build/chibaclonkd tx nameservice renew-record bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id ethermint_9000-1 $ ./build/chibaclonkd tx nameservice renew-record bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id ethermint_9000-1
``` ```
## Set the authority name ## Set the authority name
```bash ```bash
$ ./build/chibaclonkd tx nameservice set-name wrn://hello/test test_hello_cid --from root --chain-id ethermint_9000-1 -y -o json | jq . $ ./build/chibaclonkd tx nameservice set-name crn://hello/test test_hello_cid --from root --chain-id ethermint_9000-1 -y -o json | jq .
{ {
"height": "0", "height": "0",
"txhash": "66A63C73B076EEE9A2F7605354448EDEB161F0115D4D03AF68C01BA28DB97486", "txhash": "66A63C73B076EEE9A2F7605354448EDEB161F0115D4D03AF68C01BA28DB97486",
@ -301,7 +301,7 @@ $ ./build/chibaclonkd tx nameservice set-name wrn://hello/test test_hello_cid -
## Delete the name ## Delete the name
```bash ```bash
$./build/chibaclonkd tx nameservice delete-name wrn://hello/test --from root --chain-id ethermint_9000-1 -y $./build/chibaclonkd tx nameservice delete-name crn://hello/test --from root --chain-id ethermint_9000-1 -y
code: 0 code: 0
codespace: "" codespace: ""
data: "" data: ""
@ -320,7 +320,7 @@ txhash: A3FF4C46BAC7BD6E54BBB743A49830AE8C6F6FE59282384789CBA323C1FE540C
## List of Authorities Expire Queue ## List of Authorities Expire Queue
```bash ```bash
$ ./build/chibaclonkd q nameservice authority-expiry -o json | jq . $ ./build/chibaclonkd q nameservice authority-expiry -o json | jq .
{ {
"authorities": [], "authorities": [],
"pagination": null "pagination": null
@ -331,7 +331,7 @@ $ ./build/chibaclonkd q nameservice authority-expiry -o json | jq .
## List of Records Expire Queue ## List of Records Expire Queue
```bash ```bash
$ ./build/chibaclonkd q nameservice record-expiry -o json | jq . $ ./build/chibaclonkd q nameservice record-expiry -o json | jq .
{ {
"records": [], "records": [],
"pagination": null "pagination": null

View File

@ -13,5 +13,8 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) {
// EndBlocker Called every block, update validator set // EndBlocker Called every block, update validator set
func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate { func EndBlocker(ctx sdk.Context, k keeper.Keeper) []abci.ValidatorUpdate {
k.ProcessRecordExpiryQueue(ctx)
k.ProcessAuthorityExpiryQueue(ctx)
return []abci.ValidatorUpdate{} return []abci.ValidatorUpdate{}
} }

View File

@ -3,12 +3,13 @@ package cli
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"strings"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/version"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/tharsis/ethermint/x/nameservice/types" "github.com/tharsis/ethermint/x/nameservice/types"
"strings"
) )
// GetQueryCmd returns the cli query commands for this module // GetQueryCmd returns the cli query commands for this module
@ -23,7 +24,7 @@ func GetQueryCmd() *cobra.Command {
bondQueryCmd.AddCommand( bondQueryCmd.AddCommand(
GetCmdWhoIs(), GetCmdWhoIs(),
GetCmdResolve(), GetCmdResolve(),
GetCmdLookupWRN(), GetCmdLookupCRN(),
GetRecordExpiryQueue(), GetRecordExpiryQueue(),
GetAuthorityExpiryQueue(), GetAuthorityExpiryQueue(),
GetQueryParamsCmd(), GetQueryParamsCmd(),
@ -68,15 +69,15 @@ $ %s query %s whois [name]
return cmd return cmd
} }
// GetCmdLookupWRN queries naming info for a WRN. // GetCmdLookupCRN queries naming info for a CRN.
func GetCmdLookupWRN() *cobra.Command { func GetCmdLookupCRN() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "lookup [wrn]", Use: "lookup [crn]",
Short: "Get naming info for WRN.", Short: "Get naming info for CRN.",
Long: strings.TrimSpace( Long: strings.TrimSpace(
fmt.Sprintf(`Get naming info for WRN. fmt.Sprintf(`Get naming info for CRN.
Example: Example:
$ %s query %s lookup [wrn] $ %s query %s lookup [crn]
`, `,
version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),
@ -88,7 +89,7 @@ $ %s query %s lookup [wrn]
return err return err
} }
queryClient := types.NewQueryClient(clientCtx) queryClient := types.NewQueryClient(clientCtx)
res, err := queryClient.LookupWrn(cmd.Context(), &types.QueryLookupWrn{Wrn: args[0]}) res, err := queryClient.LookupCrn(cmd.Context(), &types.QueryLookupCrn{Crn: args[0]})
if err != nil { if err != nil {
return err return err
} }
@ -141,7 +142,7 @@ func GetCmdList() *cobra.Command {
Long: strings.TrimSpace( Long: strings.TrimSpace(
fmt.Sprintf(`Get the records. fmt.Sprintf(`Get the records.
Example: Example:
$ %s query %s list $ %s query %s list
`, `,
version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),
@ -184,7 +185,7 @@ func GetCmdGetResource() *cobra.Command {
Long: strings.TrimSpace( Long: strings.TrimSpace(
fmt.Sprintf(`Get the record by id. fmt.Sprintf(`Get the record by id.
Example: Example:
$ %s query %s get [ID] $ %s query %s get [ID]
`, `,
version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),
@ -207,15 +208,15 @@ $ %s query %s get [ID]
return cmd return cmd
} }
// GetCmdResolve resolves a WRN to a record. // GetCmdResolve resolves a CRN to a record.
func GetCmdResolve() *cobra.Command { func GetCmdResolve() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "resolve [wrn]", Use: "resolve [crn]",
Short: "Resolve WRN to record.", Short: "Resolve CRN to record.",
Long: strings.TrimSpace( Long: strings.TrimSpace(
fmt.Sprintf(`Resolve WRN to record. fmt.Sprintf(`Resolve CRN to record.
Example: Example:
$ %s query %s resolve [wrn] $ %s query %s resolve [crn]
`, `,
version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),
@ -227,7 +228,7 @@ $ %s query %s resolve [wrn]
return err return err
} }
queryClient := types.NewQueryClient(clientCtx) queryClient := types.NewQueryClient(clientCtx)
record, err := queryClient.ResolveWrn(cmd.Context(), &types.QueryResolveWrn{Wrn: args[0]}) record, err := queryClient.ResolveCrn(cmd.Context(), &types.QueryResolveCrn{Crn: args[0]})
if err != nil { if err != nil {
return err return err
} }
@ -246,7 +247,7 @@ func GetCmdQueryByBond() *cobra.Command {
Long: strings.TrimSpace( Long: strings.TrimSpace(
fmt.Sprintf(`Get the record by bond id. fmt.Sprintf(`Get the record by bond id.
Example: Example:
$ %s query %s query-by-bond [bond id] $ %s query %s query-by-bond [bond id]
`, `,
version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),

View File

@ -2,6 +2,9 @@ package cli
import ( import (
"fmt" "fmt"
"io/ioutil"
"strings"
"github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/client/tx"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
@ -10,8 +13,6 @@ import (
"github.com/tharsis/ethermint/server/flags" "github.com/tharsis/ethermint/server/flags"
"github.com/tharsis/ethermint/x/nameservice/types" "github.com/tharsis/ethermint/x/nameservice/types"
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
"io/ioutil"
"strings"
) )
// NewTxCmd returns a root CLI command handler for all x/bond transaction commands. // NewTxCmd returns a root CLI command handler for all x/bond transaction commands.
@ -241,12 +242,12 @@ $ %s tx %s reassociate-records [old-bond-id] [new-bond-id]
// GetCmdSetName is the CLI command for mapping a name to a CID. // GetCmdSetName is the CLI command for mapping a name to a CID.
func GetCmdSetName() *cobra.Command { func GetCmdSetName() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "set-name [wrn] [cid]", Use: "set-name [crn] [cid]",
Short: "Set WRN to CID mapping.", Short: "Set CRN to CID mapping.",
Long: strings.TrimSpace( Long: strings.TrimSpace(
fmt.Sprintf(`Set name with wrn and cid. fmt.Sprintf(`Set name with crn and cid.
Example: Example:
$ %s tx %s set-name [wrn] [cid] $ %s tx %s set-name [crn] [cid]
`, `,
version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),
@ -345,12 +346,12 @@ $ %s tx %s authority-bond [name] [bond-id]
func GetCmdDeleteName() *cobra.Command { func GetCmdDeleteName() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete-name [wrn]", Use: "delete-name [crn]",
Short: "Delete WRN.", Short: "Delete CRN.",
Long: strings.TrimSpace( Long: strings.TrimSpace(
fmt.Sprintf(`Delete WRN. fmt.Sprintf(`Delete CRN.
Example: Example:
$ %s tx %s delete-name [wrn] $ %s tx %s delete-name [crn]
`, `,
version.AppName, types.ModuleName, version.AppName, types.ModuleName,
), ),

View File

@ -3,6 +3,9 @@ package testutil
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"os"
"time"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
@ -10,8 +13,6 @@ import (
tmcli "github.com/tendermint/tendermint/libs/cli" tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tharsis/ethermint/x/nameservice/client/cli" "github.com/tharsis/ethermint/x/nameservice/client/cli"
nstypes "github.com/tharsis/ethermint/x/nameservice/types" nstypes "github.com/tharsis/ethermint/x/nameservice/types"
"os"
"time"
) )
func (s *IntegrationTestSuite) TestGRPCQueryParams() { func (s *IntegrationTestSuite) TestGRPCQueryParams() {
@ -51,8 +52,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryParams() {
sr.NoError(err) sr.NoError(err)
params := nstypes.DefaultParams() params := nstypes.DefaultParams()
params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent) params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent)
params.RecordRentDuration = 5 * time.Second params.RecordRentDuration = 10 * time.Second
params.AuthorityGracePeriod = 5 * time.Second params.AuthorityGracePeriod = 10 * time.Second
sr.Equal(response.GetParams().String(), params.String()) sr.Equal(response.GetParams().String(), params.String())
} }
}) })
@ -130,7 +131,7 @@ func (s *IntegrationTestSuite) TestGRPCQueryWhoIs() {
func (s *IntegrationTestSuite) TestGRPCQueryLookup() { func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?wrn=%s" reqUrl := val.APIAddress + "/vulcanize/nameservice/v1beta1/lookup?crn=%s"
var authorityName = "QueryLookUp" var authorityName = "QueryLookUp"
testCases := []struct { testCases := []struct {
@ -165,13 +166,13 @@ func (s *IntegrationTestSuite) TestGRPCQueryLookup() {
s.Run(tc.name, func() { s.Run(tc.name, func() {
if !tc.expectErr { if !tc.expectErr {
tc.preRun(authorityName) tc.preRun(authorityName)
tc.url = fmt.Sprintf(reqUrl, fmt.Sprintf("wrn://%s/", authorityName)) tc.url = fmt.Sprintf(reqUrl, fmt.Sprintf("crn://%s/", authorityName))
} }
resp, _ := rest.GetRequest(tc.url) resp, _ := rest.GetRequest(tc.url)
if tc.expectErr { if tc.expectErr {
sr.Contains(string(resp), tc.errorMsg) sr.Contains(string(resp), tc.errorMsg)
} else { } else {
var response nstypes.QueryLookupWrnResponse var response nstypes.QueryLookupCrnResponse
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
sr.NoError(err) sr.NoError(err)
sr.NotZero(len(response.Name.Latest.Id)) sr.NotZero(len(response.Name.Latest.Id))
@ -236,8 +237,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryRecordExpiryQueue() {
if !tc.expectErr { if !tc.expectErr {
tc.preRun(s.bondId) tc.preRun(s.bondId)
} }
// wait 7 seconds for records expires // wait 12 seconds for records expires
time.Sleep(time.Second * 7) time.Sleep(time.Second * 12)
resp, _ := rest.GetRequest(tc.url) resp, _ := rest.GetRequest(tc.url)
require := s.Require() require := s.Require()
if tc.expectErr { if tc.expectErr {
@ -306,8 +307,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
if !tc.expectErr { if !tc.expectErr {
tc.preRun("QueryAuthorityExpiryQueue") tc.preRun("QueryAuthorityExpiryQueue")
} }
// wait 7 seconds to name authorites expires // wait 12 seconds to name authorites expires
time.Sleep(time.Second * 7) time.Sleep(time.Second * 12)
resp, _ := rest.GetRequest(tc.url) resp, _ := rest.GetRequest(tc.url)
require := s.Require() require := s.Require()
@ -317,7 +318,8 @@ func (s *IntegrationTestSuite) TestGRPCQueryAuthorityExpiryQueue() {
var response nstypes.QueryGetAuthorityExpiryQueueResponse var response nstypes.QueryGetAuthorityExpiryQueueResponse
err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response) err := val.ClientCtx.Codec.UnmarshalJSON(resp, &response)
sr.NoError(err) sr.NoError(err)
sr.NotZero(len(response.GetAuthorities())) // removed from expiry queue as no bond set
sr.Zero(len(response.GetAuthorities()))
} }
}) })
} }

View File

@ -3,14 +3,15 @@ package testutil
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"os"
"time"
"github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/flags"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
tmcli "github.com/tendermint/tendermint/libs/cli" tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tharsis/ethermint/x/nameservice/client/cli" "github.com/tharsis/ethermint/x/nameservice/client/cli"
"github.com/tharsis/ethermint/x/nameservice/types" "github.com/tharsis/ethermint/x/nameservice/types"
"os"
"time"
) )
func (s *IntegrationTestSuite) TestGetCmdQueryParams() { func (s *IntegrationTestSuite) TestGetCmdQueryParams() {
@ -39,8 +40,8 @@ func (s *IntegrationTestSuite) TestGetCmdQueryParams() {
sr.NoError(err) sr.NoError(err)
params := types.DefaultParams() params := types.DefaultParams()
params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, types.DefaultRecordRent) params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, types.DefaultRecordRent)
params.RecordRentDuration = 5 * time.Second params.RecordRentDuration = 10 * time.Second
params.AuthorityGracePeriod = 5 * time.Second params.AuthorityGracePeriod = 10 * time.Second
sr.Equal(param.GetParams().String(), params.String()) sr.Equal(param.GetParams().String(), params.String())
}) })
} }
@ -302,7 +303,7 @@ func (s *IntegrationTestSuite) TestGetCmdWhoIs() {
} }
} }
func (s *IntegrationTestSuite) TestGetCmdLookupWRN() { func (s *IntegrationTestSuite) TestGetCmdLookupCRN() {
val := s.network.Validators[0] val := s.network.Validators[0]
sr := s.Require() sr := s.Require()
var authorityName = "test1" var authorityName = "test1"
@ -314,7 +315,7 @@ func (s *IntegrationTestSuite) TestGetCmdLookupWRN() {
preRun func(authorityName string) preRun func(authorityName string)
}{ }{
{ {
"invalid request without wrn", "invalid request without crn",
[]string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
true, true,
0, 0,
@ -324,7 +325,7 @@ func (s *IntegrationTestSuite) TestGetCmdLookupWRN() {
}, },
{ {
"success query with name", "success query with name",
[]string{fmt.Sprintf("wrn://%s/", authorityName), fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, []string{fmt.Sprintf("crn://%s/", authorityName), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
false, false,
1, 1,
func(authorityName string) { func(authorityName string) {
@ -337,10 +338,10 @@ func (s *IntegrationTestSuite) TestGetCmdLookupWRN() {
for _, tc := range testCases { for _, tc := range testCases {
s.Run(tc.name, func() { s.Run(tc.name, func() {
if !tc.expErr { if !tc.expErr {
// set-name with wrn and bond-id // set-name with crn and bond-id
tc.preRun(authorityName) tc.preRun(authorityName)
} }
cmd := cli.GetCmdLookupWRN() cmd := cli.GetCmdLookupCRN()
clientCtx := val.ClientCtx clientCtx := val.ClientCtx
out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args) out, err := clitestutil.ExecTestCLICmd(clientCtx, cmd, tc.args)
@ -348,7 +349,7 @@ func (s *IntegrationTestSuite) TestGetCmdLookupWRN() {
sr.Error(err) sr.Error(err)
} else { } else {
sr.NoError(err) sr.NoError(err)
var response types.QueryLookupWrnResponse var response types.QueryLookupCrnResponse
err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response) err = clientCtx.Codec.UnmarshalJSON(out.Bytes(), &response)
sr.NoError(err) sr.NoError(err)
nameRecord := response.GetName() nameRecord := response.GetName()
@ -364,7 +365,7 @@ func (s *IntegrationTestSuite) TestGetCmdLookupWRN() {
noOfRecords int noOfRecords int
}{ }{
{ {
"invalid request without wrn", "invalid request without crn",
[]string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, []string{"invalid", fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
true, true,
0, 0,
@ -432,7 +433,7 @@ func (s *IntegrationTestSuite) GetRecordExpiryQueue() {
s.Run(tc.name, func() { s.Run(tc.name, func() {
if !tc.expErr { if !tc.expErr {
tc.preRun(authorityName, s) tc.preRun(authorityName, s)
time.Sleep(time.Second * 7) time.Sleep(time.Second * 12)
} }
cmd := cli.GetRecordExpiryQueue() cmd := cli.GetRecordExpiryQueue()
clientCtx := val.ClientCtx clientCtx := val.ClientCtx
@ -565,7 +566,7 @@ func createNameRecord(authorityName string, s *IntegrationTestSuite) {
sr.Zero(d.Code) sr.Zero(d.Code)
args = []string{ args = []string{
fmt.Sprintf("wrn://%s/", authorityName), fmt.Sprintf("crn://%s/", authorityName),
"test_hello_cid", "test_hello_cid",
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),

View File

@ -47,8 +47,8 @@ func (s *IntegrationTestSuite) SetupSuite() {
s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData)) s.Require().NoError(s.cfg.Codec.UnmarshalJSON(genesisState[nstypes.ModuleName], &nsData))
nsData.Params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent) nsData.Params.RecordRent = sdk.NewCoin(s.cfg.BondDenom, nstypes.DefaultRecordRent)
nsData.Params.RecordRentDuration = 5 * time.Second nsData.Params.RecordRentDuration = 10 * time.Second
nsData.Params.AuthorityGracePeriod = 5 * time.Second nsData.Params.AuthorityGracePeriod = 10 * time.Second
nsDataBz, err := s.cfg.Codec.MarshalJSON(&nsData) nsDataBz, err := s.cfg.Codec.MarshalJSON(&nsData)
s.Require().NoError(err) s.Require().NoError(err)
genesisState[nstypes.ModuleName] = nsDataBz genesisState[nstypes.ModuleName] = nsDataBz
@ -313,7 +313,7 @@ func (s *IntegrationTestSuite) TestGetCmdSetName() {
{ {
"success", "success",
[]string{ []string{
fmt.Sprintf("wrn://%s/", authorityName), fmt.Sprintf("crn://%s/", authorityName),
"test_hello_cid", "test_hello_cid",
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
@ -488,7 +488,7 @@ func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
preRun func(authorityName string, s *IntegrationTestSuite) preRun func(authorityName string, s *IntegrationTestSuite)
}{ }{
{ {
"invalid request without wrn", "invalid request without crn",
[]string{ []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
@ -521,7 +521,7 @@ func (s *IntegrationTestSuite) TestGetCmdDeleteName() {
s.Run(fmt.Sprintf("Case %s", tc.name), func() { s.Run(fmt.Sprintf("Case %s", tc.name), func() {
if !tc.err { if !tc.err {
tc.preRun(authorityName, s) tc.preRun(authorityName, s)
tc.args = append([]string{fmt.Sprintf("wrn://%s/", authorityName)}, tc.args...) tc.args = append([]string{fmt.Sprintf("crn://%s/", authorityName)}, tc.args...)
} }
clientCtx := val.ClientCtx clientCtx := val.ClientCtx
cmd := cli.GetCmdDeleteName() cmd := cli.GetCmdDeleteName()
@ -551,7 +551,7 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() {
postRun func(recordId string, s *IntegrationTestSuite) postRun func(recordId string, s *IntegrationTestSuite)
}{ }{
{ {
"invalid request without wrn", "invalid request without crn",
[]string{ []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
@ -670,7 +670,7 @@ func (s *IntegrationTestSuite) TestGetCmdDissociateBond() {
// postRun func(recordId string, s *IntegrationTestSuite) // postRun func(recordId string, s *IntegrationTestSuite)
// }{ // }{
// { // {
// "invalid request without wrn", // "invalid request without crn",
// []string{ // []string{
// fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), // fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), // fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
@ -794,7 +794,7 @@ func (s *IntegrationTestSuite) TestGetCmdAssociateBond() {
postRun func(recordId, bondId string, s *IntegrationTestSuite) postRun func(recordId, bondId string, s *IntegrationTestSuite)
}{ }{
{ {
"invalid request without wrn", "invalid request without crn",
[]string{ []string{
fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName), fmt.Sprintf("--%s=%s", flags.FlagFrom, accountName),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),

View File

@ -1,6 +1,8 @@
package nameservice package nameservice
import ( import (
"time"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
"github.com/tharsis/ethermint/x/nameservice/keeper" "github.com/tharsis/ethermint/x/nameservice/keeper"
@ -14,7 +16,13 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data types.GenesisState)
keeper.PutRecord(ctx, record) keeper.PutRecord(ctx, record)
// Add to record expiry queue if expiry time is in the future. // Add to record expiry queue if expiry time is in the future.
if record.ExpiryTime.After(ctx.BlockTime()) { expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil {
panic(err)
}
if expiryTime.After(ctx.BlockTime()) {
keeper.InsertRecordExpiryQueue(ctx, record) keeper.InsertRecordExpiryQueue(ctx, record)
} }

View File

@ -2,11 +2,18 @@ package keeper
import ( import (
"context" "context"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/tharsis/ethermint/x/nameservice/types" "github.com/tharsis/ethermint/x/nameservice/types"
) )
// BondIDAttributeName denotes the record bond ID.
const BondIDAttributeName = "bondId"
// ExpiryTimeAttributeName denotes the record expiry time.
const ExpiryTimeAttributeName = "expiryTime"
type Querier struct { type Querier struct {
Keeper Keeper
} }
@ -19,9 +26,20 @@ func (q Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.
return &types.QueryParamsResponse{Params: &params}, nil return &types.QueryParamsResponse{Params: &params}, nil
} }
func (q Querier) ListRecords(c context.Context, _ *types.QueryListRecordsRequest) (*types.QueryListRecordsResponse, error) { func (q Querier) ListRecords(c context.Context, req *types.QueryListRecordsRequest) (*types.QueryListRecordsResponse, error) {
ctx := sdk.UnwrapSDKContext(c) ctx := sdk.UnwrapSDKContext(c)
records := q.Keeper.ListRecords(ctx) attributes := req.GetAttributes()
all := req.GetAll()
records := []types.Record{}
if len(attributes) > 0 {
records = q.Keeper.MatchRecords(ctx, func(record *types.RecordType) bool {
return MatchOnAttributes(record, attributes, all)
})
} else {
records = q.Keeper.ListRecords(ctx)
}
return &types.QueryListRecordsResponse{Records: records}, nil return &types.QueryListRecordsResponse{Records: records}, nil
} }
@ -61,27 +79,27 @@ func (q Querier) Whois(c context.Context, request *types.QueryWhoisRequest) (*ty
return &types.QueryWhoisResponse{NameAuthority: nameAuthority}, nil return &types.QueryWhoisResponse{NameAuthority: nameAuthority}, nil
} }
func (q Querier) LookupWrn(c context.Context, req *types.QueryLookupWrn) (*types.QueryLookupWrnResponse, error) { func (q Querier) LookupCrn(c context.Context, req *types.QueryLookupCrn) (*types.QueryLookupCrnResponse, error) {
ctx := sdk.UnwrapSDKContext(c) ctx := sdk.UnwrapSDKContext(c)
wrn := req.GetWrn() crn := req.GetCrn()
if !q.Keeper.HasNameRecord(ctx, wrn) { if !q.Keeper.HasNameRecord(ctx, crn) {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "WRN not found.") return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "CRN not found.")
} }
nameRecord := q.Keeper.GetNameRecord(ctx, wrn) nameRecord := q.Keeper.GetNameRecord(ctx, crn)
if nameRecord == nil { if nameRecord == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "name record not found.") return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "name record not found.")
} }
return &types.QueryLookupWrnResponse{Name: nameRecord}, nil return &types.QueryLookupCrnResponse{Name: nameRecord}, nil
} }
func (q Querier) ResolveWrn(c context.Context, req *types.QueryResolveWrn) (*types.QueryResolveWrnResponse, error) { func (q Querier) ResolveCrn(c context.Context, req *types.QueryResolveCrn) (*types.QueryResolveCrnResponse, error) {
ctx := sdk.UnwrapSDKContext(c) ctx := sdk.UnwrapSDKContext(c)
wrn := req.GetWrn() crn := req.GetCrn()
record := q.Keeper.ResolveWRN(ctx, wrn) record := q.Keeper.ResolveCRN(ctx, crn)
if record == nil { if record == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "record not found.") return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "record not found.")
} }
return &types.QueryResolveWrnResponse{Record: record}, nil return &types.QueryResolveCrnResponse{Record: record}, nil
} }
func (q Querier) GetRecordExpiryQueue(c context.Context, _ *types.QueryGetRecordExpiryQueue) (*types.QueryGetRecordExpiryQueueResponse, error) { func (q Querier) GetRecordExpiryQueue(c context.Context, _ *types.QueryGetRecordExpiryQueue) (*types.QueryGetRecordExpiryQueueResponse, error) {
@ -95,3 +113,115 @@ func (q Querier) GetAuthorityExpiryQueue(c context.Context, _ *types.QueryGetAut
authorities := q.Keeper.GetAuthorityExpiryQueue(ctx) authorities := q.Keeper.GetAuthorityExpiryQueue(ctx)
return &types.QueryGetAuthorityExpiryQueueResponse{Authorities: authorities}, nil return &types.QueryGetAuthorityExpiryQueueResponse{Authorities: authorities}, nil
} }
func matchOnRecordField(record *types.RecordType, attr *types.QueryListRecordsRequest_KeyValueInput) (fieldFound bool, matched bool) {
fieldFound = false
matched = true
switch attr.Key {
case BondIDAttributeName:
{
fieldFound = true
if record.BondId != attr.Value.GetString_() {
matched = false
return
}
}
case ExpiryTimeAttributeName:
{
fieldFound = true
if record.ExpiryTime != attr.Value.GetString_() {
matched = false
return
}
}
}
return
}
func MatchOnAttributes(record *types.RecordType, attributes []*types.QueryListRecordsRequest_KeyValueInput, all bool) bool {
// Filter deleted records.
if record.Deleted {
return false
}
// If ONLY named records are requested, check for that condition first.
if !all && len(record.Names) == 0 {
return false
}
recAttrs := record.Attributes
for _, attr := range attributes {
// First try matching on record struct fields.
fieldFound, matched := matchOnRecordField(record, attr)
if fieldFound {
if !matched {
return false
}
continue
}
recAttrVal, recAttrFound := recAttrs[attr.Key]
if !recAttrFound {
return false
}
if attr.Value.Type == "int" {
recAttrValInt, ok := recAttrVal.(int)
if !ok || int(attr.Value.GetInt()) != recAttrValInt {
return false
}
}
if attr.Value.Type == "float" {
recAttrValFloat, ok := recAttrVal.(float64)
if !ok || attr.Value.GetFloat() != recAttrValFloat {
return false
}
}
if attr.Value.Type == "string" {
recAttrValString, ok := recAttrVal.(string)
if !ok {
return false
}
if attr.Value.GetString_() != recAttrValString {
return false
}
}
if attr.Value.Type == "boolean" {
recAttrValBool, ok := recAttrVal.(bool)
if !ok || attr.Value.GetBoolean() != recAttrValBool {
return false
}
}
if attr.Value.Type == "reference" {
obj, ok := recAttrVal.(map[string]interface{})
if !ok {
// Attr value is not an object.
return false
}
if _, ok := obj["/"].(string); !ok {
// Attr value is not a reference.
return false
}
recAttrValRefID := obj["/"].(string)
if recAttrValRefID != attr.Value.GetReference().GetId() {
return false
}
}
// TODO: Handle arrays.
}
return true
}

View File

@ -3,9 +3,10 @@ package keeper_test
import ( import (
"context" "context"
"fmt" "fmt"
"os"
"github.com/tharsis/ethermint/x/nameservice/client/cli" "github.com/tharsis/ethermint/x/nameservice/client/cli"
nameservicetypes "github.com/tharsis/ethermint/x/nameservice/types" nameservicetypes "github.com/tharsis/ethermint/x/nameservice/types"
"os"
) )
func (suite *KeeperTestSuite) TestGrpcQueryParams() { func (suite *KeeperTestSuite) TestGrpcQueryParams() {
@ -62,12 +63,13 @@ func (suite *KeeperTestSuite) TestGrpcGetRecordLists() {
sr.NoError(err) sr.NoError(err)
payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml") payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml")
sr.NoError(err) sr.NoError(err)
err = suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ record, err := suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{
BondId: suite.bond.GetId(), BondId: suite.bond.GetId(),
Signer: suite.accounts[0].String(), Signer: suite.accounts[0].String(),
Payload: payload.ToPayload(), Payload: payload.ToPayload(),
}) })
sr.NoError(err) sr.NoError(err)
sr.NotNil(record.Id)
} }
resp, err := grpcClient.ListRecords(context.Background(), test.req) resp, err := grpcClient.ListRecords(context.Background(), test.req)
if test.expErr { if test.expErr {
@ -192,12 +194,13 @@ func (suite *KeeperTestSuite) TestGrpcQueryNameserviceModuleBalance() {
sr.NoError(err) sr.NoError(err)
payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml") payload, err := cli.GetPayloadFromFile(dir + "/../helpers/examples/example1.yml")
sr.NoError(err) sr.NoError(err)
err = suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{ record, err := suite.app.NameServiceKeeper.ProcessSetRecord(ctx, nameservicetypes.MsgSetRecord{
BondId: suite.bond.GetId(), BondId: suite.bond.GetId(),
Signer: suite.accounts[0].String(), Signer: suite.accounts[0].String(),
Payload: payload.ToPayload(), Payload: payload.ToPayload(),
}) })
sr.NoError(err) sr.NoError(err)
sr.NotNil(record.Id)
} }
resp, err := grpcClient.GetNameServiceModuleBalance(context.Background(), test.req) resp, err := grpcClient.GetNameServiceModuleBalance(context.Background(), test.req)
if test.expErr { if test.expErr {

View File

@ -1,7 +1,11 @@
package keeper package keeper
import ( import (
"bytes"
"fmt" "fmt"
"sort"
"time"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy" "github.com/cosmos/cosmos-sdk/codec/legacy"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
@ -13,8 +17,6 @@ import (
bondkeeper "github.com/tharsis/ethermint/x/bond/keeper" bondkeeper "github.com/tharsis/ethermint/x/bond/keeper"
"github.com/tharsis/ethermint/x/nameservice/helpers" "github.com/tharsis/ethermint/x/nameservice/helpers"
"github.com/tharsis/ethermint/x/nameservice/types" "github.com/tharsis/ethermint/x/nameservice/types"
"sort"
"time"
) )
var ( var (
@ -27,8 +29,8 @@ var (
// PrefixNameAuthorityRecordIndex is the prefix for the name -> NameAuthority index. // PrefixNameAuthorityRecordIndex is the prefix for the name -> NameAuthority index.
PrefixNameAuthorityRecordIndex = []byte{0x01} PrefixNameAuthorityRecordIndex = []byte{0x01}
// PrefixWRNToNameRecordIndex is the prefix for the WRN -> NamingRecord index. // PrefixCRNToNameRecordIndex is the prefix for the CRN -> NamingRecord index.
PrefixWRNToNameRecordIndex = []byte{0x02} PrefixCRNToNameRecordIndex = []byte{0x02}
// PrefixBondIDToRecordsIndex is the prefix for the Bond ID -> [Record] index. // PrefixBondIDToRecordsIndex is the prefix for the Bond ID -> [Record] index.
PrefixBondIDToRecordsIndex = []byte{0x03} PrefixBondIDToRecordsIndex = []byte{0x03}
@ -118,8 +120,30 @@ func (k Keeper) ListRecords(ctx sdk.Context) []types.Record {
if bz != nil { if bz != nil {
var obj types.Record var obj types.Record
k.cdc.MustUnmarshal(bz, &obj) k.cdc.MustUnmarshal(bz, &obj)
//records = append(records, recordObjToRecord(store, k.cdc, obj)) records = append(records, recordObjToRecord(store, k.cdc, obj))
records = append(records, obj) }
}
return records
}
// MatchRecords - get all matching records.
func (k Keeper) MatchRecords(ctx sdk.Context, matchFn func(*types.RecordType) bool) []types.Record {
var records []types.Record
store := ctx.KVStore(k.storeKey)
itr := sdk.KVStorePrefixIterator(store, PrefixCIDToRecordIndex)
defer itr.Close()
for ; itr.Valid(); itr.Next() {
bz := store.Get(itr.Key())
if bz != nil {
var obj types.Record
k.cdc.MustUnmarshal(bz, &obj)
obj = recordObjToRecord(store, k.cdc, obj)
record := obj.ToRecordType()
if matchFn(&record) {
records = append(records, obj)
}
} }
} }
@ -147,7 +171,7 @@ func (k Keeper) GetRecordExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRecord
} }
// ProcessSetRecord creates a record. // ProcessSetRecord creates a record.
func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) error { func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) (*types.RecordType, error) {
payload := msg.Payload.ToReadablePayload() payload := msg.Payload.ToReadablePayload()
record := types.RecordType{Attributes: payload.Record, BondId: msg.BondId} record := types.RecordType{Attributes: payload.Record, BondId: msg.BondId}
@ -155,13 +179,14 @@ func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) error
resourceSignBytes, _ := record.GetSignBytes() resourceSignBytes, _ := record.GetSignBytes()
cid, err := record.GetCID() cid, err := record.GetCID()
if err != nil { if err != nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid record JSON") return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid record JSON")
} }
record.Id = cid record.Id = cid
if exists := k.HasRecord(ctx, record.Id); exists { if exists := k.HasRecord(ctx, record.Id); exists {
return nil // Immutable record already exists. No-op.
return &record, nil
} }
record.Owners = []string{} record.Owners = []string{}
@ -169,13 +194,13 @@ func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) error
pubKey, err := legacy.PubKeyFromBytes(helpers.BytesFromBase64(sig.PubKey)) pubKey, err := legacy.PubKeyFromBytes(helpers.BytesFromBase64(sig.PubKey))
if err != nil { if err != nil {
fmt.Println("Error decoding pubKey from bytes: ", err) fmt.Println("Error decoding pubKey from bytes: ", err)
return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid public key.") return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid public key.")
} }
sigOK := pubKey.VerifySignature(resourceSignBytes, helpers.BytesFromBase64(sig.Sig)) sigOK := pubKey.VerifySignature(resourceSignBytes, helpers.BytesFromBase64(sig.Sig))
if !sigOK { if !sigOK {
fmt.Println("Signature mismatch: ", sig.PubKey) fmt.Println("Signature mismatch: ", sig.PubKey)
return sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid signature.") return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Invalid signature.")
} }
record.Owners = append(record.Owners, pubKey.Address().String()) record.Owners = append(record.Owners, pubKey.Address().String())
} }
@ -184,9 +209,9 @@ func (k Keeper) ProcessSetRecord(ctx sdk.Context, msg types.MsgSetRecord) error
sort.Strings(record.Owners) sort.Strings(record.Owners)
sdkErr := k.processRecord(ctx, &record, false) sdkErr := k.processRecord(ctx, &record, false)
if sdkErr != nil { if sdkErr != nil {
return sdkErr return nil, sdkErr
} }
return nil return &record, nil
} }
func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenewal bool) error { func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenewal bool) error {
@ -198,8 +223,8 @@ func (k Keeper) processRecord(ctx sdk.Context, record *types.RecordType, isRenew
return err return err
} }
record.CreateTime = ctx.BlockHeader().Time record.CreateTime = ctx.BlockHeader().Time.Format(time.RFC3339)
record.ExpiryTime = ctx.BlockHeader().Time.Add(params.RecordRentDuration) record.ExpiryTime = ctx.BlockHeader().Time.Add(params.RecordRentDuration).Format(time.RFC3339)
record.Deleted = false record.Deleted = false
k.PutRecord(ctx, record.ToRecordObj()) k.PutRecord(ctx, record.ToRecordObj())
@ -268,9 +293,111 @@ func (k Keeper) GetRecordExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Ti
// InsertRecordExpiryQueue inserts a record CID to the appropriate timeslice in the record expiry queue. // InsertRecordExpiryQueue inserts a record CID to the appropriate timeslice in the record expiry queue.
func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) { func (k Keeper) InsertRecordExpiryQueue(ctx sdk.Context, val types.Record) {
timeSlice := k.GetRecordExpiryQueueTimeSlice(ctx, val.ExpiryTime) expiryTime, err := time.Parse(time.RFC3339, val.ExpiryTime)
if err != nil {
panic(err)
}
timeSlice := k.GetRecordExpiryQueueTimeSlice(ctx, expiryTime)
timeSlice = append(timeSlice, val.Id) timeSlice = append(timeSlice, val.Id)
k.SetRecordExpiryQueueTimeSlice(ctx, val.ExpiryTime, timeSlice) k.SetRecordExpiryQueueTimeSlice(ctx, expiryTime, timeSlice)
}
// DeleteRecordExpiryQueue deletes a record CID from the record expiry queue.
func (k Keeper) DeleteRecordExpiryQueue(ctx sdk.Context, record types.Record) {
expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil {
panic(err)
}
timeSlice := k.GetRecordExpiryQueueTimeSlice(ctx, expiryTime)
var newTimeSlice []string
for _, cid := range timeSlice {
if !bytes.Equal([]byte(cid), []byte(record.Id)) {
newTimeSlice = append(newTimeSlice, cid)
}
}
if len(newTimeSlice) == 0 {
k.DeleteRecordExpiryQueueTimeSlice(ctx, expiryTime)
} else {
k.SetRecordExpiryQueueTimeSlice(ctx, expiryTime, newTimeSlice)
}
}
// RecordExpiryQueueIterator returns all the record expiry queue timeslices from time 0 until endTime.
func (k Keeper) RecordExpiryQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator {
store := ctx.KVStore(k.storeKey)
rangeEndBytes := sdk.InclusiveEndBytes(getRecordExpiryQueueTimeKey(endTime))
return store.Iterator(PrefixExpiryTimeToRecordsIndex, rangeEndBytes)
}
// GetAllExpiredRecords returns a concatenated list of all the timeslices before currTime.
func (k Keeper) GetAllExpiredRecords(ctx sdk.Context, currTime time.Time) (expiredRecordCIDs []string) {
// Gets an iterator for all timeslices from time 0 until the current block header time.
itr := k.RecordExpiryQueueIterator(ctx, ctx.BlockHeader().Time)
defer itr.Close()
for ; itr.Valid(); itr.Next() {
timeslice, err := helpers.BytesArrToStringArr(itr.Value())
if err != nil {
panic(err)
}
expiredRecordCIDs = append(expiredRecordCIDs, timeslice...)
}
return expiredRecordCIDs
}
// ProcessRecordExpiryQueue tries to renew expiring records (by collecting rent) else marks them as deleted.
func (k Keeper) ProcessRecordExpiryQueue(ctx sdk.Context) {
cids := k.GetAllExpiredRecords(ctx, ctx.BlockHeader().Time)
for _, cid := range cids {
record := k.GetRecord(ctx, cid)
// If record doesn't have an associated bond or if bond no longer exists, mark it deleted.
if record.BondId == "" || !k.bondKeeper.HasBond(ctx, record.BondId) {
record.Deleted = true
k.PutRecord(ctx, record)
k.DeleteRecordExpiryQueue(ctx, record)
return
}
// Try to renew the record by taking rent.
k.TryTakeRecordRent(ctx, record)
}
}
// TryTakeRecordRent tries to take rent from the record bond.
func (k Keeper) TryTakeRecordRent(ctx sdk.Context, record types.Record) {
params := k.GetParams(ctx)
rent := params.RecordRent
sdkErr := k.bondKeeper.TransferCoinsToModuleAccount(ctx, record.BondId, types.RecordRentModuleAccountName, sdk.NewCoins(rent))
if sdkErr != nil {
// Insufficient funds, mark record as deleted.
record.Deleted = true
k.PutRecord(ctx, record)
k.DeleteRecordExpiryQueue(ctx, record)
return
}
// Delete old expiry queue entry, create new one.
k.DeleteRecordExpiryQueue(ctx, record)
record.ExpiryTime = ctx.BlockHeader().Time.Add(params.RecordRentDuration).Format(time.RFC3339)
k.InsertRecordExpiryQueue(ctx, record)
// Save record.
record.Deleted = false
k.PutRecord(ctx, record)
k.AddBondToRecordIndexEntry(ctx, record.BondId, record.Id)
} }
// GetModuleBalances gets the nameservice module account(s) balances. // GetModuleBalances gets the nameservice module account(s) balances.
@ -292,3 +419,19 @@ func (k Keeper) GetModuleBalances(ctx sdk.Context) []*types.AccountBalance {
return balances return balances
} }
func recordObjToRecord(store sdk.KVStore, codec codec.BinaryCodec, record types.Record) types.Record {
reverseNameIndexKey := GetCIDToNamesIndexKey(record.Id)
if store.Has(reverseNameIndexKey) {
names, err := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey))
if err != nil {
panic(err)
}
record.Names = names
}
return record
}

View File

@ -2,6 +2,7 @@ package keeper
import ( import (
"context" "context"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/nameservice/types" "github.com/tharsis/ethermint/x/nameservice/types"
) )
@ -24,7 +25,7 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types
return nil, err return nil, err
} }
err = m.Keeper.ProcessSetRecord(ctx, types.MsgSetRecord{ record, err := m.Keeper.ProcessSetRecord(ctx, types.MsgSetRecord{
BondId: msg.GetBondId(), BondId: msg.GetBondId(),
Signer: msg.GetSigner(), Signer: msg.GetSigner(),
Payload: msg.GetPayload(), Payload: msg.GetPayload(),
@ -47,7 +48,7 @@ func (m msgServer) SetRecord(c context.Context, msg *types.MsgSetRecord) (*types
), ),
}) })
return &types.MsgSetRecordResponse{}, nil return &types.MsgSetRecordResponse{Id: record.Id}, nil
} }
func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) { func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.MsgSetNameResponse, error) {
@ -64,7 +65,7 @@ func (m msgServer) SetName(c context.Context, msg *types.MsgSetName) (*types.Msg
sdk.NewEvent( sdk.NewEvent(
types.EventTypeSetRecord, types.EventTypeSetRecord,
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
sdk.NewAttribute(types.AttributeKeyWRN, msg.Wrn), sdk.NewAttribute(types.AttributeKeyCRN, msg.Crn),
sdk.NewAttribute(types.AttributeKeyCID, msg.Cid), sdk.NewAttribute(types.AttributeKeyCID, msg.Cid),
), ),
sdk.NewEvent( sdk.NewEvent(
@ -146,7 +147,7 @@ func (m msgServer) DeleteName(c context.Context, msg *types.MsgDeleteNameAuthori
sdk.NewEvent( sdk.NewEvent(
types.EventTypeDeleteName, types.EventTypeDeleteName,
sdk.NewAttribute(types.AttributeKeySigner, msg.Signer), sdk.NewAttribute(types.AttributeKeySigner, msg.Signer),
sdk.NewAttribute(types.AttributeKeyWRN, msg.Wrn), sdk.NewAttribute(types.AttributeKeyCRN, msg.Crn),
), ),
sdk.NewEvent( sdk.NewEvent(
sdk.EventTypeMessage, sdk.EventTypeMessage,

View File

@ -1,7 +1,12 @@
package keeper package keeper
import ( import (
"bytes"
"fmt" "fmt"
"net/url"
"strings"
"time"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
@ -9,9 +14,6 @@ import (
auctiontypes "github.com/tharsis/ethermint/x/auction/types" auctiontypes "github.com/tharsis/ethermint/x/auction/types"
"github.com/tharsis/ethermint/x/nameservice/helpers" "github.com/tharsis/ethermint/x/nameservice/helpers"
"github.com/tharsis/ethermint/x/nameservice/types" "github.com/tharsis/ethermint/x/nameservice/types"
"net/url"
"strings"
"time"
) )
func getAuthorityPubKey(pubKey cryptotypes.PubKey) string { func getAuthorityPubKey(pubKey cryptotypes.PubKey) string {
@ -26,9 +28,9 @@ func GetNameAuthorityIndexKey(name string) []byte {
return append(PrefixNameAuthorityRecordIndex, []byte(name)...) return append(PrefixNameAuthorityRecordIndex, []byte(name)...)
} }
// GetNameRecordIndexKey Generates WRN -> NameRecord index key. // GetNameRecordIndexKey Generates CRN -> NameRecord index key.
func GetNameRecordIndexKey(wrn string) []byte { func GetNameRecordIndexKey(crn string) []byte {
return append(PrefixWRNToNameRecordIndex, []byte(wrn)...) return append(PrefixCRNToNameRecordIndex, []byte(crn)...)
} }
func GetCIDToNamesIndexKey(id string) []byte { func GetCIDToNamesIndexKey(id string) []byte {
@ -101,35 +103,35 @@ func RemoveBondToAuthorityIndexEntry(store sdk.KVStore, bondID string, name stri
store.Delete(getBondIDToAuthoritiesIndexKey(bondID, name)) store.Delete(getBondIDToAuthoritiesIndexKey(bondID, name))
} }
func (k Keeper) updateBlockChangeSetForName(ctx sdk.Context, wrn string) { func (k Keeper) updateBlockChangeSetForName(ctx sdk.Context, crn string) {
changeSet := k.getOrCreateBlockChangeSet(ctx, ctx.BlockHeight()) changeSet := k.getOrCreateBlockChangeSet(ctx, ctx.BlockHeight())
changeSet.Names = append(changeSet.Names, wrn) changeSet.Names = append(changeSet.Names, crn)
k.saveBlockChangeSet(ctx, changeSet) k.saveBlockChangeSet(ctx, changeSet)
} }
func (k Keeper) getAuthority(ctx sdk.Context, wrn string) (string, *url.URL, *types.NameAuthority, error) { func (k Keeper) getAuthority(ctx sdk.Context, crn string) (string, *url.URL, *types.NameAuthority, error) {
parsedWRN, err := url.Parse(wrn) parsedCRN, err := url.Parse(crn)
if err != nil { if err != nil {
return "", nil, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid WRN.") return "", nil, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid CRN.")
} }
name := parsedWRN.Host name := parsedCRN.Host
if !k.HasNameAuthority(ctx, name) { if !k.HasNameAuthority(ctx, name) {
return name, nil, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name authority not found.") return name, nil, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name authority not found.")
} }
authority := k.GetNameAuthority(ctx, name) authority := k.GetNameAuthority(ctx, name)
return name, parsedWRN, &authority, nil return name, parsedCRN, &authority, nil
} }
func (k Keeper) checkWRNAccess(ctx sdk.Context, signer sdk.AccAddress, wrn string) error { func (k Keeper) checkCRNAccess(ctx sdk.Context, signer sdk.AccAddress, crn string) error {
name, parsedWRN, authority, err := k.getAuthority(ctx, wrn) name, parsedCRN, authority, err := k.getAuthority(ctx, crn)
if err != nil { if err != nil {
return err return err
} }
formattedWRN := fmt.Sprintf("wrn://%s%s", name, parsedWRN.RequestURI()) formattedCRN := fmt.Sprintf("crn://%s%s", name, parsedCRN.RequestURI())
if formattedWRN != wrn { if formattedCRN != crn {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid WRN.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid CRN.")
} }
if authority.OwnerAddress != signer.String() { if authority.OwnerAddress != signer.String() {
@ -159,14 +161,14 @@ func (k Keeper) checkWRNAccess(ctx sdk.Context, signer sdk.AccAddress, wrn strin
} }
// HasNameRecord - checks if a name record exists. // HasNameRecord - checks if a name record exists.
func (k Keeper) HasNameRecord(ctx sdk.Context, wrn string) bool { func (k Keeper) HasNameRecord(ctx sdk.Context, crn string) bool {
store := ctx.KVStore(k.storeKey) store := ctx.KVStore(k.storeKey)
return store.Has(GetNameRecordIndexKey(wrn)) return store.Has(GetNameRecordIndexKey(crn))
} }
// GetNameRecord - gets a name record from the store. // GetNameRecord - gets a name record from the store.
func GetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, wrn string) *types.NameRecord { func GetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, crn string) *types.NameRecord {
nameRecordKey := GetNameRecordIndexKey(wrn) nameRecordKey := GetNameRecordIndexKey(crn)
if !store.Has(nameRecordKey) { if !store.Has(nameRecordKey) {
return nil return nil
} }
@ -179,14 +181,14 @@ func GetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, wrn string) *type
} }
// GetNameRecord - gets a name record from the store. // GetNameRecord - gets a name record from the store.
func (k Keeper) GetNameRecord(ctx sdk.Context, wrn string) *types.NameRecord { func (k Keeper) GetNameRecord(ctx sdk.Context, crn string) *types.NameRecord {
_, _, authority, err := k.getAuthority(ctx, wrn) _, _, authority, err := k.getAuthority(ctx, crn)
if err != nil || authority.Status != types.AuthorityActive { if err != nil || authority.Status != types.AuthorityActive {
// If authority is not active (or any other error), lookup fails. // If authority is not active (or any other error), lookup fails.
return nil return nil
} }
nameRecord := GetNameRecord(ctx.KVStore(k.storeKey), k.cdc, wrn) nameRecord := GetNameRecord(ctx.KVStore(k.storeKey), k.cdc, crn)
// Name record may not exist. // Name record may not exist.
if nameRecord == nil { if nameRecord == nil {
@ -203,12 +205,12 @@ func (k Keeper) GetNameRecord(ctx sdk.Context, wrn string) *types.NameRecord {
} }
// RemoveRecordToNameMapping removes a name from the record ID -> []names index. // RemoveRecordToNameMapping removes a name from the record ID -> []names index.
func RemoveRecordToNameMapping(store sdk.KVStore, id string, wrn string) { func RemoveRecordToNameMapping(store sdk.KVStore, id string, crn string) {
reverseNameIndexKey := GetCIDToNamesIndexKey(id) reverseNameIndexKey := GetCIDToNamesIndexKey(id)
names, _ := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey)) names, _ := helpers.BytesArrToStringArr(store.Get(reverseNameIndexKey))
nameSet := helpers.SliceToSet(names) nameSet := helpers.SliceToSet(names)
nameSet.Remove(wrn) nameSet.Remove(crn)
if nameSet.Cardinality() == 0 { if nameSet.Cardinality() == 0 {
// Delete as storing empty slice throws error from baseapp. // Delete as storing empty slice throws error from baseapp.
@ -220,7 +222,7 @@ func RemoveRecordToNameMapping(store sdk.KVStore, id string, wrn string) {
} }
// AddRecordToNameMapping adds a name to the record ID -> []names index. // AddRecordToNameMapping adds a name to the record ID -> []names index.
func AddRecordToNameMapping(store sdk.KVStore, id string, wrn string) { func AddRecordToNameMapping(store sdk.KVStore, id string, crn string) {
reverseNameIndexKey := GetCIDToNamesIndexKey(id) reverseNameIndexKey := GetCIDToNamesIndexKey(id)
var names []string var names []string
@ -229,14 +231,14 @@ func AddRecordToNameMapping(store sdk.KVStore, id string, wrn string) {
} }
nameSet := helpers.SliceToSet(names) nameSet := helpers.SliceToSet(names)
nameSet.Add(wrn) nameSet.Add(crn)
bz, _ := helpers.StrArrToBytesArr(helpers.SetToSlice(nameSet)) bz, _ := helpers.StrArrToBytesArr(helpers.SetToSlice(nameSet))
store.Set(reverseNameIndexKey, bz) store.Set(reverseNameIndexKey, bz)
} }
// SetNameRecord - sets a name record. // SetNameRecord - sets a name record.
func SetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, wrn string, id string, height int64) { func SetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, crn string, id string, height int64) {
nameRecordIndexKey := GetNameRecordIndexKey(wrn) nameRecordIndexKey := GetNameRecordIndexKey(crn)
var nameRecord types.NameRecord var nameRecord types.NameRecord
if store.Has(nameRecordIndexKey) { if store.Has(nameRecordIndexKey) {
@ -246,7 +248,7 @@ func SetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, wrn string, id st
// Update old CID -> []Name index. // Update old CID -> []Name index.
if nameRecord.Latest.Id != "" || len(nameRecord.Latest.Id) != 0 { if nameRecord.Latest.Id != "" || len(nameRecord.Latest.Id) != 0 {
RemoveRecordToNameMapping(store, nameRecord.Latest.Id, wrn) RemoveRecordToNameMapping(store, nameRecord.Latest.Id, crn)
} }
} }
@ -259,35 +261,35 @@ func SetNameRecord(store sdk.KVStore, codec codec.BinaryCodec, wrn string, id st
// Update new CID -> []Name index. // Update new CID -> []Name index.
if id != "" { if id != "" {
AddRecordToNameMapping(store, id, wrn) AddRecordToNameMapping(store, id, crn)
} }
} }
// SetNameRecord - sets a name record. // SetNameRecord - sets a name record.
func (k Keeper) SetNameRecord(ctx sdk.Context, wrn string, id string) { func (k Keeper) SetNameRecord(ctx sdk.Context, crn string, id string) {
SetNameRecord(ctx.KVStore(k.storeKey), k.cdc, wrn, id, ctx.BlockHeight()) SetNameRecord(ctx.KVStore(k.storeKey), k.cdc, crn, id, ctx.BlockHeight())
// Update changeSet for name. // Update changeSet for name.
k.updateBlockChangeSetForName(ctx, wrn) k.updateBlockChangeSetForName(ctx, crn)
} }
// ProcessSetName creates a WRN -> Record ID mapping. // ProcessSetName creates a CRN -> Record ID mapping.
func (k Keeper) ProcessSetName(ctx sdk.Context, msg types.MsgSetName) error { func (k Keeper) ProcessSetName(ctx sdk.Context, msg types.MsgSetName) error {
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil { if err != nil {
return err return err
} }
err = k.checkWRNAccess(ctx, signerAddress, msg.Wrn) err = k.checkCRNAccess(ctx, signerAddress, msg.Crn)
if err != nil { if err != nil {
return err return err
} }
nameRecord := k.GetNameRecord(ctx, msg.Wrn) nameRecord := k.GetNameRecord(ctx, msg.Crn)
if nameRecord != nil && nameRecord.Latest.Id == msg.Cid { if nameRecord != nil && nameRecord.Latest.Id == msg.Cid {
return nil return nil
} }
k.SetNameRecord(ctx, msg.Wrn, msg.Cid) k.SetNameRecord(ctx, msg.Crn, msg.Cid)
return nil return nil
} }
@ -296,7 +298,7 @@ func (k Keeper) ProcessSetName(ctx sdk.Context, msg types.MsgSetName) error {
func (k Keeper) ListNameRecords(ctx sdk.Context) []types.NameEntry { func (k Keeper) ListNameRecords(ctx sdk.Context) []types.NameEntry {
var nameEntries []types.NameEntry var nameEntries []types.NameEntry
store := ctx.KVStore(k.storeKey) store := ctx.KVStore(k.storeKey)
itr := sdk.KVStorePrefixIterator(store, PrefixWRNToNameRecordIndex) itr := sdk.KVStorePrefixIterator(store, PrefixCRNToNameRecordIndex)
defer itr.Close() defer itr.Close()
for ; itr.Valid(); itr.Next() { for ; itr.Valid(); itr.Next() {
bz := store.Get(itr.Key()) bz := store.Get(itr.Key())
@ -304,7 +306,7 @@ func (k Keeper) ListNameRecords(ctx sdk.Context) []types.NameEntry {
var record types.NameRecord var record types.NameRecord
k.cdc.MustUnmarshal(bz, &record) k.cdc.MustUnmarshal(bz, &record)
nameEntries = append(nameEntries, types.NameEntry{ nameEntries = append(nameEntries, types.NameEntry{
Name: string(itr.Key()[len(PrefixWRNToNameRecordIndex):]), Name: string(itr.Key()[len(PrefixCRNToNameRecordIndex):]),
Entry: &record, Entry: &record,
}) })
} }
@ -425,13 +427,13 @@ func (k Keeper) createAuthority(ctx sdk.Context, name string, owner string, isRo
// ProcessReserveAuthority reserves a name authority. // ProcessReserveAuthority reserves a name authority.
func (k Keeper) ProcessReserveAuthority(ctx sdk.Context, msg types.MsgReserveAuthority) error { func (k Keeper) ProcessReserveAuthority(ctx sdk.Context, msg types.MsgReserveAuthority) error {
wrn := fmt.Sprintf("wrn://%s", msg.GetName()) crn := fmt.Sprintf("crn://%s", msg.GetName())
parsedWrn, err := url.Parse(wrn) parsedCrn, err := url.Parse(crn)
if err != nil { if err != nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid name") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid name")
} }
name := parsedWrn.Host name := parsedCrn.Host
if fmt.Sprintf("wrn://%s", name) != wrn { if fmt.Sprintf("crn://%s", name) != crn {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid name") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Invalid name")
} }
if strings.Contains(name, ".") { if strings.Contains(name, ".") {
@ -482,23 +484,23 @@ func (k Keeper) ProcessSetAuthorityBond(ctx sdk.Context, msg types.MsgSetAuthori
return nil return nil
} }
// ProcessDeleteName removes a WRN -> Record ID mapping. // ProcessDeleteName removes a CRN -> Record ID mapping.
func (k Keeper) ProcessDeleteName(ctx sdk.Context, msg types.MsgDeleteNameAuthority) error { func (k Keeper) ProcessDeleteName(ctx sdk.Context, msg types.MsgDeleteNameAuthority) error {
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer) signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
if err != nil { if err != nil {
return err return err
} }
err = k.checkWRNAccess(ctx, signerAddress, msg.Wrn) err = k.checkCRNAccess(ctx, signerAddress, msg.Crn)
if err != nil { if err != nil {
return err return err
} }
if !k.HasNameRecord(ctx, msg.Wrn) { if !k.HasNameRecord(ctx, msg.Crn) {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name not found.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Name not found.")
} }
// Set CID to empty string. // Set CID to empty string.
k.SetNameRecord(ctx, msg.Wrn, "") k.SetNameRecord(ctx, msg.Crn, "")
return nil return nil
} }
@ -524,9 +526,9 @@ func (k Keeper) GetAuthorityExpiryQueue(ctx sdk.Context) []*types.ExpiryQueueRec
return authorities return authorities
} }
// ResolveWRN resolves a WRN to a record. // ResolveCRN resolves a CRN to a record.
func (k Keeper) ResolveWRN(ctx sdk.Context, wrn string) *types.Record { func (k Keeper) ResolveCRN(ctx sdk.Context, crn string) *types.Record {
_, _, authority, err := k.getAuthority(ctx, wrn) _, _, authority, err := k.getAuthority(ctx, crn)
if err != nil || authority.Status != types.AuthorityActive { if err != nil || authority.Status != types.AuthorityActive {
// If authority is not active (or any other error), resolution fails. // If authority is not active (or any other error), resolution fails.
return nil return nil
@ -534,7 +536,7 @@ func (k Keeper) ResolveWRN(ctx sdk.Context, wrn string) *types.Record {
// Name should not resolve if it's stale. // Name should not resolve if it's stale.
// i.e. authority was registered later than the name. // i.e. authority was registered later than the name.
record, nameRecord := ResolveWRN(ctx.KVStore(k.storeKey), wrn, k, ctx) record, nameRecord := ResolveCRN(ctx.KVStore(k.storeKey), crn, k, ctx)
if authority.Height > nameRecord.Latest.Height { if authority.Height > nameRecord.Latest.Height {
return nil return nil
} }
@ -542,9 +544,9 @@ func (k Keeper) ResolveWRN(ctx sdk.Context, wrn string) *types.Record {
return record return record
} }
// ResolveWRN resolves a WRN to a record. // ResolveCRN resolves a CRN to a record.
func ResolveWRN(store sdk.KVStore, wrn string, k Keeper, c sdk.Context) (*types.Record, *types.NameRecord) { func ResolveCRN(store sdk.KVStore, crn string, k Keeper, c sdk.Context) (*types.Record, *types.NameRecord) {
nameKey := GetNameRecordIndexKey(wrn) nameKey := GetNameRecordIndexKey(crn)
if store.Has(nameKey) { if store.Has(nameKey) {
bz := store.Get(nameKey) bz := store.Get(nameKey)
@ -596,6 +598,111 @@ func (k Keeper) SetAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time
store.Set(getAuthorityExpiryQueueTimeKey(timestamp), bz) store.Set(getAuthorityExpiryQueueTimeKey(timestamp), bz)
} }
// ProcessAuthorityExpiryQueue tries to renew expiring authorities (by collecting rent) else marks them as expired.
func (k Keeper) ProcessAuthorityExpiryQueue(ctx sdk.Context) {
names := k.GetAllExpiredAuthorities(ctx, ctx.BlockHeader().Time)
for _, name := range names {
authority := k.GetNameAuthority(ctx, name)
// If authority doesn't have an associated bond or if bond no longer exists, mark it expired.
if authority.BondId == "" || !k.bondKeeper.HasBond(ctx, authority.BondId) {
authority.Status = types.AuthorityExpired
k.SetNameAuthority(ctx, name, &authority)
k.DeleteAuthorityExpiryQueue(ctx, name, authority)
ctx.Logger().Info(fmt.Sprintf("Marking authority expired as no bond present: %s", name))
return
}
// Try to renew the authority by taking rent.
k.TryTakeAuthorityRent(ctx, name, authority)
}
}
// DeleteAuthorityExpiryQueueTimeSlice deletes a specific authority expiry queue timeslice.
func (k Keeper) DeleteAuthorityExpiryQueueTimeSlice(ctx sdk.Context, timestamp time.Time) {
store := ctx.KVStore(k.storeKey)
store.Delete(getAuthorityExpiryQueueTimeKey(timestamp))
}
// DeleteAuthorityExpiryQueue deletes an authority name from the authority expiry queue.
func (k Keeper) DeleteAuthorityExpiryQueue(ctx sdk.Context, name string, authority types.NameAuthority) {
timeSlice := k.GetAuthorityExpiryQueueTimeSlice(ctx, authority.ExpiryTime)
newTimeSlice := []string{}
for _, existingName := range timeSlice {
if !bytes.Equal([]byte(existingName), []byte(name)) {
newTimeSlice = append(newTimeSlice, existingName)
}
}
if len(newTimeSlice) == 0 {
k.DeleteAuthorityExpiryQueueTimeSlice(ctx, authority.ExpiryTime)
} else {
k.SetAuthorityExpiryQueueTimeSlice(ctx, authority.ExpiryTime, newTimeSlice)
}
}
// GetAllExpiredAuthorities returns a concatenated list of all the timeslices before currTime.
func (k Keeper) GetAllExpiredAuthorities(ctx sdk.Context, currTime time.Time) (expiredAuthorityNames []string) {
// Gets an iterator for all timeslices from time 0 until the current block header time.
itr := k.AuthorityExpiryQueueIterator(ctx, ctx.BlockHeader().Time)
defer itr.Close()
for ; itr.Valid(); itr.Next() {
timeslice := []string{}
timeslice, err := helpers.BytesArrToStringArr(itr.Value())
if err != nil {
panic(err)
}
expiredAuthorityNames = append(expiredAuthorityNames, timeslice...)
}
return expiredAuthorityNames
}
// AuthorityExpiryQueueIterator returns all the authority expiry queue timeslices from time 0 until endTime.
func (k Keeper) AuthorityExpiryQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator {
store := ctx.KVStore(k.storeKey)
rangeEndBytes := sdk.InclusiveEndBytes(getAuthorityExpiryQueueTimeKey(endTime))
return store.Iterator(PrefixExpiryTimeToAuthoritiesIndex, rangeEndBytes)
}
// TryTakeAuthorityRent tries to take rent from the authority bond.
func (k Keeper) TryTakeAuthorityRent(ctx sdk.Context, name string, authority types.NameAuthority) {
ctx.Logger().Info(fmt.Sprintf("Trying to take rent for authority: %s", name))
params := k.GetParams(ctx)
rent := params.AuthorityRent
sdkErr := k.bondKeeper.TransferCoinsToModuleAccount(ctx, authority.BondId, types.AuthorityRentModuleAccountName, sdk.NewCoins(rent))
if sdkErr != nil {
// Insufficient funds, mark authority as expired.
authority.Status = types.AuthorityExpired
k.SetNameAuthority(ctx, name, &authority)
k.DeleteAuthorityExpiryQueue(ctx, name, authority)
ctx.Logger().Info(fmt.Sprintf("Insufficient funds in owner account to pay authority rent, marking as expired: %s", name))
return
}
// Delete old expiry queue entry, create new one.
k.DeleteAuthorityExpiryQueue(ctx, name, authority)
authority.ExpiryTime = ctx.BlockTime().Add(params.AuthorityRentDuration)
k.InsertAuthorityExpiryQueue(ctx, name, authority.ExpiryTime)
// Save authority.
authority.Status = types.AuthorityActive
k.SetNameAuthority(ctx, name, &authority)
k.AddBondToAuthorityIndexEntry(ctx, authority.BondId, name)
ctx.Logger().Info(fmt.Sprintf("Authority rent paid successfully: %s", name))
}
// ListNameAuthorityRecords - get all name authority records. // ListNameAuthorityRecords - get all name authority records.
func (k Keeper) ListNameAuthorityRecords(ctx sdk.Context) map[string]types.NameAuthority { func (k Keeper) ListNameAuthorityRecords(ctx sdk.Context) map[string]types.NameAuthority {
nameAuthorityRecords := make(map[string]types.NameAuthority) nameAuthorityRecords := make(map[string]types.NameAuthority)

View File

@ -2,6 +2,8 @@ package keeper
import ( import (
"fmt" "fmt"
"time"
"github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@ -143,8 +145,7 @@ func (k RecordKeeper) QueryRecordsByBond(ctx sdk.Context, bondID string) []types
if bz != nil { if bz != nil {
var obj types.Record var obj types.Record
k.cdc.MustUnmarshal(bz, &obj) k.cdc.MustUnmarshal(bz, &obj)
//records = append(records, recordObjToRecord(store, k.cdc, obj)) records = append(records, recordObjToRecord(store, k.cdc, obj))
records = append(records, obj)
} }
} }
@ -159,12 +160,18 @@ func (k Keeper) ProcessRenewRecord(ctx sdk.Context, msg types.MsgRenewRecord) er
// Check if renewal is required (i.e. expired record marked as deleted). // Check if renewal is required (i.e. expired record marked as deleted).
record := k.GetRecord(ctx, msg.RecordId) record := k.GetRecord(ctx, msg.RecordId)
if !record.Deleted || record.ExpiryTime.After(ctx.BlockTime()) { expiryTime, err := time.Parse(time.RFC3339, record.ExpiryTime)
if err != nil {
panic(err)
}
if !record.Deleted || expiryTime.After(ctx.BlockTime()) {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Renewal not required.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "Renewal not required.")
} }
recordType := record.ToRecordType() recordType := record.ToRecordType()
err := k.processRecord(ctx, &recordType, true) err = k.processRecord(ctx, &recordType, true)
if err != nil { if err != nil {
return err return err
} }

View File

@ -19,7 +19,7 @@ const (
AttributeKeyNewBondId = "new-bond-id" AttributeKeyNewBondId = "new-bond-id"
AttributeKeyCID = "cid" AttributeKeyCID = "cid"
AttributeKeyName = "name" AttributeKeyName = "name"
AttributeKeyWRN = "wrn" AttributeKeyCRN = "crn"
AttributeKeyRecordId = "record-id" AttributeKeyRecordId = "record-id"
AttributeValueCategory = ModuleName AttributeValueCategory = ModuleName
) )

View File

@ -1,9 +1,10 @@
package types package types
import ( import (
"net/url"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"net/url"
) )
var ( var (
@ -14,9 +15,9 @@ var (
) )
// NewMsgSetName is the constructor function for MsgSetName. // NewMsgSetName is the constructor function for MsgSetName.
func NewMsgSetName(wrn string, cid string, signer sdk.AccAddress) MsgSetName { func NewMsgSetName(crn string, cid string, signer sdk.AccAddress) MsgSetName {
return MsgSetName{ return MsgSetName{
Wrn: wrn, Crn: crn,
Cid: cid, Cid: cid,
Signer: signer.String(), Signer: signer.String(),
} }
@ -31,8 +32,8 @@ func (msg MsgSetName) Type() string { return "set-name" }
// ValidateBasic Implements Msg. // ValidateBasic Implements Msg.
func (msg MsgSetName) ValidateBasic() error { func (msg MsgSetName) ValidateBasic() error {
if msg.Wrn == "" { if msg.Crn == "" {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "WRN is required.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "CRN is required.")
} }
if msg.Cid == "" { if msg.Cid == "" {
@ -144,9 +145,9 @@ func (msg MsgSetAuthorityBond) GetSigners() []sdk.AccAddress {
} }
// NewMsgDeleteNameAuthority is the constructor function for MsgDeleteNameAuthority. // NewMsgDeleteNameAuthority is the constructor function for MsgDeleteNameAuthority.
func NewMsgDeleteNameAuthority(wrn string, signer sdk.AccAddress) MsgDeleteNameAuthority { func NewMsgDeleteNameAuthority(crn string, signer sdk.AccAddress) MsgDeleteNameAuthority {
return MsgDeleteNameAuthority{ return MsgDeleteNameAuthority{
Wrn: wrn, Crn: crn,
Signer: signer.String(), Signer: signer.String(),
} }
} }
@ -159,17 +160,17 @@ func (msg MsgDeleteNameAuthority) Type() string { return "delete-name" }
// ValidateBasic Implements Msg. // ValidateBasic Implements Msg.
func (msg MsgDeleteNameAuthority) ValidateBasic() error { func (msg MsgDeleteNameAuthority) ValidateBasic() error {
if len(msg.Wrn) == 0 { if len(msg.Crn) == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "wrn is required.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "crn is required.")
} }
if len(msg.Signer) == 0 { if len(msg.Signer) == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.") return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "invalid signer.")
} }
_, err := url.Parse(msg.Wrn) _, err := url.Parse(msg.Crn)
if err != nil { if err != nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid wrn.") return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "invalid crn.")
} }
return nil return nil

View File

@ -156,13 +156,14 @@ func (m *Params) GetAuthorityAuctionMinimumBid() types.Coin {
// Params defines the nameservice module records // Params defines the nameservice module records
type Record struct { type Record struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" json:"id" yaml:"id"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" json:"id" yaml:"id"`
BondId string `protobuf:"bytes,2,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"` BondId string `protobuf:"bytes,2,opt,name=bond_id,json=bondId,proto3" json:"bond_id,omitempty" json:"bondId" yaml:"bondId"`
CreateTime time.Time `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3,stdtime" json:"create_time" json:"createTime" yaml:"createTime"` CreateTime string `protobuf:"bytes,3,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty" json:"createTime" yaml:"createTime"`
ExpiryTime time.Time `protobuf:"bytes,4,opt,name=expiry_time,json=expiryTime,proto3,stdtime" json:"expiry_time" json:"expiryTime" yaml:"expiryTime"` ExpiryTime string `protobuf:"bytes,4,opt,name=expiry_time,json=expiryTime,proto3" json:"expiry_time,omitempty" json:"expiryTime" yaml:"expiryTime"`
Deleted bool `protobuf:"varint,5,opt,name=deleted,proto3" json:"deleted,omitempty"` Deleted bool `protobuf:"varint,5,opt,name=deleted,proto3" json:"deleted,omitempty"`
Owners []string `protobuf:"bytes,6,rep,name=owners,proto3" json:"owners,omitempty" json:"owners" yaml:"owners"` Owners []string `protobuf:"bytes,6,rep,name=owners,proto3" json:"owners,omitempty" json:"owners" yaml:"owners"`
Attributes []byte `protobuf:"bytes,7,opt,name=attributes,proto3" json:"attributes,omitempty" json:"attributes" yaml:"attributes"` Attributes string `protobuf:"bytes,7,opt,name=attributes,proto3" json:"attributes,omitempty" json:"attributes" yaml:"attributes"`
Names []string `protobuf:"bytes,8,rep,name=names,proto3" json:"names,omitempty" json:"names" yaml:"names"`
} }
func (m *Record) Reset() { *m = Record{} } func (m *Record) Reset() { *m = Record{} }
@ -212,18 +213,18 @@ func (m *Record) GetBondId() string {
return "" return ""
} }
func (m *Record) GetCreateTime() time.Time { func (m *Record) GetCreateTime() string {
if m != nil { if m != nil {
return m.CreateTime return m.CreateTime
} }
return time.Time{} return ""
} }
func (m *Record) GetExpiryTime() time.Time { func (m *Record) GetExpiryTime() string {
if m != nil { if m != nil {
return m.ExpiryTime return m.ExpiryTime
} }
return time.Time{} return ""
} }
func (m *Record) GetDeleted() bool { func (m *Record) GetDeleted() bool {
@ -240,10 +241,17 @@ func (m *Record) GetOwners() []string {
return nil return nil
} }
func (m *Record) GetAttributes() []byte { func (m *Record) GetAttributes() string {
if m != nil { if m != nil {
return m.Attributes return m.Attributes
} }
return ""
}
func (m *Record) GetNames() []string {
if m != nil {
return m.Names
}
return nil return nil
} }
@ -764,88 +772,90 @@ func init() {
} }
var fileDescriptor_c2009c2df775dbad = []byte{ var fileDescriptor_c2009c2df775dbad = []byte{
// 1295 bytes of a gzipped FileDescriptorProto // 1325 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xdd, 0x6e, 0x1b, 0xc5,
0x14, 0xcf, 0xc6, 0x89, 0x1d, 0x8f, 0x1b, 0x83, 0x86, 0xb4, 0x75, 0x02, 0xf5, 0x06, 0xa3, 0xaa, 0x17, 0xcf, 0xc6, 0x89, 0x13, 0x4f, 0x1a, 0xff, 0xff, 0x1a, 0xd2, 0x76, 0x13, 0xa8, 0x37, 0x18,
0xad, 0x42, 0xbc, 0x94, 0x1e, 0xca, 0x1f, 0x21, 0x94, 0x4d, 0xd2, 0x10, 0x10, 0x10, 0x26, 0xbd, 0x55, 0x6d, 0x55, 0xea, 0xa5, 0xf4, 0xa2, 0x7c, 0x08, 0xa1, 0x6c, 0xd2, 0xa6, 0x01, 0x01, 0x61,
0xc0, 0xc5, 0xcc, 0xee, 0x4e, 0xec, 0xa1, 0xde, 0x5d, 0x6b, 0x67, 0x36, 0xd4, 0x70, 0xe2, 0x1b, 0xda, 0x1b, 0xb8, 0x31, 0xb3, 0xbb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 0x47,
0x02, 0x97, 0x7a, 0xdc, 0x78, 0x98, 0xfb, 0xf3, 0xe6, 0xc3, 0x01, 0x61, 0x56, 0x59, 0xec, 0x84, 0xcf, 0x5b, 0x4b, 0x4f, 0x9f, 0xb7, 0x96, 0xfe, 0x7c, 0xde, 0x5a, 0xfa, 0xfa, 0x9d, 0x1e, 0xe5,
0x3b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x2a, 0x84, 0x83, 0x21, 0x9f, 0x0f, 0x00, 0x00, 0xfd, 0xc4, 0xed, 0x78, 0x51, 0x60, 0xf3, 0x3e, 0x8e, 0x19, 0x65, 0x36, 0xe1, 0x7d, 0x12, 0x07,
0x34, 0xe4, 0xf6, 0xc3, 0xd2, 0x6f, 0x36, 0x1f, 0x0d, 0x09, 0x73, 0xeb, 0x62, 0x26, 0xdc, 0xf8,
0x2f, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x95, 0x34, 0xdd, 0x8c, 0x0f, 0x00, 0x00,
} }
func (m *Params) Marshal() (dAtA []byte, err error) { func (m *Params) Marshal() (dAtA []byte, err error) {
@ -991,6 +1001,15 @@ func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Names) > 0 {
for iNdEx := len(m.Names) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Names[iNdEx])
copy(dAtA[i:], m.Names[iNdEx])
i = encodeVarintNameservice(dAtA, i, uint64(len(m.Names[iNdEx])))
i--
dAtA[i] = 0x42
}
}
if len(m.Attributes) > 0 { if len(m.Attributes) > 0 {
i -= len(m.Attributes) i -= len(m.Attributes)
copy(dAtA[i:], m.Attributes) copy(dAtA[i:], m.Attributes)
@ -1017,22 +1036,20 @@ func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i-- i--
dAtA[i] = 0x28 dAtA[i] = 0x28
} }
n11, err11 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpiryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiryTime):]) if len(m.ExpiryTime) > 0 {
if err11 != nil { i -= len(m.ExpiryTime)
return 0, err11 copy(dAtA[i:], m.ExpiryTime)
i = encodeVarintNameservice(dAtA, i, uint64(len(m.ExpiryTime)))
i--
dAtA[i] = 0x22
} }
i -= n11 if len(m.CreateTime) > 0 {
i = encodeVarintNameservice(dAtA, i, uint64(n11)) i -= len(m.CreateTime)
i-- copy(dAtA[i:], m.CreateTime)
dAtA[i] = 0x22 i = encodeVarintNameservice(dAtA, i, uint64(len(m.CreateTime)))
n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreateTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreateTime):]) i--
if err12 != nil { dAtA[i] = 0x1a
return 0, err12
} }
i -= n12
i = encodeVarintNameservice(dAtA, i, uint64(n12))
i--
dAtA[i] = 0x1a
if len(m.BondId) > 0 { if len(m.BondId) > 0 {
i -= len(m.BondId) i -= len(m.BondId)
copy(dAtA[i:], m.BondId) copy(dAtA[i:], m.BondId)
@ -1112,12 +1129,12 @@ func (m *NameAuthority) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
n14, err14 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpiryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiryTime):]) n12, err12 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.ExpiryTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiryTime):])
if err14 != nil { if err12 != nil {
return 0, err14 return 0, err12
} }
i -= n14 i -= n12
i = encodeVarintNameservice(dAtA, i, uint64(n14)) i = encodeVarintNameservice(dAtA, i, uint64(n12))
i-- i--
dAtA[i] = 0x3a dAtA[i] = 0x3a
if len(m.BondId) > 0 { if len(m.BondId) > 0 {
@ -1498,10 +1515,14 @@ func (m *Record) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovNameservice(uint64(l)) n += 1 + l + sovNameservice(uint64(l))
} }
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreateTime) l = len(m.CreateTime)
n += 1 + l + sovNameservice(uint64(l)) if l > 0 {
l = github_com_gogo_protobuf_types.SizeOfStdTime(m.ExpiryTime) n += 1 + l + sovNameservice(uint64(l))
n += 1 + l + sovNameservice(uint64(l)) }
l = len(m.ExpiryTime)
if l > 0 {
n += 1 + l + sovNameservice(uint64(l))
}
if m.Deleted { if m.Deleted {
n += 2 n += 2
} }
@ -1515,6 +1536,12 @@ func (m *Record) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovNameservice(uint64(l)) n += 1 + l + sovNameservice(uint64(l))
} }
if len(m.Names) > 0 {
for _, s := range m.Names {
l = len(s)
n += 1 + l + sovNameservice(uint64(l))
}
}
return n return n
} }
@ -2200,7 +2227,7 @@ func (m *Record) Unmarshal(dAtA []byte) error {
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field CreateTime", wireType) return fmt.Errorf("proto: wrong wireType = %d for field CreateTime", wireType)
} }
var msglen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowNameservice return ErrIntOverflowNameservice
@ -2210,30 +2237,29 @@ func (m *Record) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
msglen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNameservice return ErrInvalidLengthNameservice
} }
postIndex := iNdEx + msglen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthNameservice return ErrInvalidLengthNameservice
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreateTime, dAtA[iNdEx:postIndex]); err != nil { m.CreateTime = string(dAtA[iNdEx:postIndex])
return err
}
iNdEx = postIndex iNdEx = postIndex
case 4: case 4:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ExpiryTime", wireType)
} }
var msglen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowNameservice return ErrIntOverflowNameservice
@ -2243,24 +2269,23 @@ func (m *Record) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
msglen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if msglen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNameservice return ErrInvalidLengthNameservice
} }
postIndex := iNdEx + msglen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthNameservice return ErrInvalidLengthNameservice
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.ExpiryTime, dAtA[iNdEx:postIndex]); err != nil { m.ExpiryTime = string(dAtA[iNdEx:postIndex])
return err
}
iNdEx = postIndex iNdEx = postIndex
case 5: case 5:
if wireType != 0 { if wireType != 0 {
@ -2318,7 +2343,7 @@ func (m *Record) Unmarshal(dAtA []byte) error {
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType)
} }
var byteLen int var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowNameservice return ErrIntOverflowNameservice
@ -2328,25 +2353,55 @@ func (m *Record) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
byteLen |= int(b&0x7F) << shift stringLen |= uint64(b&0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
if byteLen < 0 { intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNameservice return ErrInvalidLengthNameservice
} }
postIndex := iNdEx + byteLen postIndex := iNdEx + intStringLen
if postIndex < 0 { if postIndex < 0 {
return ErrInvalidLengthNameservice return ErrInvalidLengthNameservice
} }
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Attributes = append(m.Attributes[:0], dAtA[iNdEx:postIndex]...) m.Attributes = string(dAtA[iNdEx:postIndex])
if m.Attributes == nil { iNdEx = postIndex
m.Attributes = []byte{} case 8:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Names", wireType)
} }
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNameservice
}
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 ErrInvalidLengthNameservice
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthNameservice
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Names = append(m.Names, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex

File diff suppressed because it is too large Load Diff

View File

@ -320,73 +320,73 @@ func local_request_Query_Whois_0(ctx context.Context, marshaler runtime.Marshale
} }
var ( var (
filter_Query_LookupWrn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} filter_Query_LookupCrn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
) )
func request_Query_LookupWrn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Query_LookupCrn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryLookupWrn var protoReq QueryLookupCrn
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LookupWrn_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LookupCrn_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.LookupWrn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.LookupCrn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_Query_LookupWrn_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_Query_LookupCrn_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryLookupWrn var protoReq QueryLookupCrn
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LookupWrn_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_LookupCrn_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.LookupWrn(ctx, &protoReq) msg, err := server.LookupCrn(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
var ( var (
filter_Query_ResolveWrn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} filter_Query_ResolveCrn_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
) )
func request_Query_ResolveWrn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Query_ResolveCrn_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryResolveWrn var protoReq QueryResolveCrn
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ResolveWrn_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ResolveCrn_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := client.ResolveWrn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.ResolveCrn(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err
} }
func local_request_Query_ResolveWrn_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func local_request_Query_ResolveCrn_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq QueryResolveWrn var protoReq QueryResolveCrn
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil { if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ResolveWrn_0); err != nil { if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ResolveCrn_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
} }
msg, err := server.ResolveWrn(ctx, &protoReq) msg, err := server.ResolveCrn(ctx, &protoReq)
return msg, metadata, err return msg, metadata, err
} }
@ -609,7 +609,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
}) })
mux.Handle("GET", pattern_Query_LookupWrn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Query_LookupCrn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@ -618,18 +618,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := local_request_Query_LookupWrn_0(rctx, inboundMarshaler, server, req, pathParams) resp, md, err := local_request_Query_LookupCrn_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Query_LookupWrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Query_LookupCrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
mux.Handle("GET", pattern_Query_ResolveWrn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Query_ResolveCrn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@ -638,14 +638,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := local_request_Query_ResolveWrn_0(rctx, inboundMarshaler, server, req, pathParams) resp, md, err := local_request_Query_ResolveCrn_0(rctx, inboundMarshaler, server, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Query_ResolveWrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Query_ResolveCrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -870,7 +870,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}) })
mux.Handle("GET", pattern_Query_LookupWrn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Query_LookupCrn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@ -879,18 +879,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := request_Query_LookupWrn_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Query_LookupCrn_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Query_LookupWrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Query_LookupCrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
mux.Handle("GET", pattern_Query_ResolveWrn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { mux.Handle("GET", pattern_Query_ResolveCrn_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context()) ctx, cancel := context.WithCancel(req.Context())
defer cancel() defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
@ -899,14 +899,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
resp, md, err := request_Query_ResolveWrn_0(rctx, inboundMarshaler, client, req, pathParams) resp, md, err := request_Query_ResolveCrn_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md) ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil { if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return return
} }
forward_Query_ResolveWrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) forward_Query_ResolveCrn_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
}) })
@ -968,9 +968,9 @@ var (
pattern_Query_Whois_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "whois", "name"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_Whois_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"vulcanize", "nameservice", "v1beta1", "whois", "name"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_LookupWrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "lookup"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_LookupCrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "lookup"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_ResolveWrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "resolve"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_ResolveCrn_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "resolve"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_Query_GetRecordExpiryQueue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "record-expiry"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_GetRecordExpiryQueue_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"vulcanize", "nameservice", "v1beta1", "record-expiry"}, "", runtime.AssumeColonVerbOpt(true)))
@ -992,9 +992,9 @@ var (
forward_Query_Whois_0 = runtime.ForwardResponseMessage forward_Query_Whois_0 = runtime.ForwardResponseMessage
forward_Query_LookupWrn_0 = runtime.ForwardResponseMessage forward_Query_LookupCrn_0 = runtime.ForwardResponseMessage
forward_Query_ResolveWrn_0 = runtime.ForwardResponseMessage forward_Query_ResolveCrn_0 = runtime.ForwardResponseMessage
forward_Query_GetRecordExpiryQueue_0 = runtime.ForwardResponseMessage forward_Query_GetRecordExpiryQueue_0 = runtime.ForwardResponseMessage

View File

@ -23,6 +23,12 @@ func NewMsgSetRecord(payload Payload, bondID string, signer sdk.AccAddress) MsgS
} }
} }
// Route Implements Msg.
func (msg MsgSetRecord) Route() string { return RouterKey }
// Type Implements Msg.
func (msg MsgSetRecord) Type() string { return "set-record" }
func (msg MsgSetRecord) ValidateBasic() error { func (msg MsgSetRecord) ValidateBasic() error {
if len(msg.Signer) == 0 { if len(msg.Signer) == 0 {
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer) return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, msg.Signer)

View File

@ -91,6 +91,7 @@ func (m *MsgSetRecord) GetPayload() Payload {
// MsgSetRecordResponse // MsgSetRecordResponse
type MsgSetRecordResponse struct { type MsgSetRecordResponse struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
} }
func (m *MsgSetRecordResponse) Reset() { *m = MsgSetRecordResponse{} } func (m *MsgSetRecordResponse) Reset() { *m = MsgSetRecordResponse{} }
@ -126,6 +127,13 @@ func (m *MsgSetRecordResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgSetRecordResponse proto.InternalMessageInfo var xxx_messageInfo_MsgSetRecordResponse proto.InternalMessageInfo
func (m *MsgSetRecordResponse) GetId() string {
if m != nil {
return m.Id
}
return ""
}
// Payload // Payload
type Payload struct { type Payload struct {
Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` Record *Record `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
@ -181,7 +189,7 @@ func (m *Payload) GetSignatures() []Signature {
// MsgSetName // MsgSetName
type MsgSetName struct { type MsgSetName struct {
Wrn string `protobuf:"bytes,1,opt,name=wrn,proto3" json:"wrn,omitempty"` Crn string `protobuf:"bytes,1,opt,name=crn,proto3" json:"crn,omitempty"`
Cid string `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"` Cid string `protobuf:"bytes,2,opt,name=cid,proto3" json:"cid,omitempty"`
Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"` Signer string `protobuf:"bytes,3,opt,name=signer,proto3" json:"signer,omitempty"`
} }
@ -219,9 +227,9 @@ func (m *MsgSetName) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgSetName proto.InternalMessageInfo var xxx_messageInfo_MsgSetName proto.InternalMessageInfo
func (m *MsgSetName) GetWrn() string { func (m *MsgSetName) GetCrn() string {
if m != nil { if m != nil {
return m.Wrn return m.Crn
} }
return "" return ""
} }
@ -476,7 +484,7 @@ var xxx_messageInfo_MsgSetAuthorityBondResponse proto.InternalMessageInfo
// MsgDeleteNameAuthority is SDK message for DeleteNameAuthority // MsgDeleteNameAuthority is SDK message for DeleteNameAuthority
type MsgDeleteNameAuthority struct { type MsgDeleteNameAuthority struct {
Wrn string `protobuf:"bytes,1,opt,name=wrn,proto3" json:"wrn,omitempty"` Crn string `protobuf:"bytes,1,opt,name=crn,proto3" json:"crn,omitempty"`
Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"`
} }
@ -513,9 +521,9 @@ func (m *MsgDeleteNameAuthority) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgDeleteNameAuthority proto.InternalMessageInfo var xxx_messageInfo_MsgDeleteNameAuthority proto.InternalMessageInfo
func (m *MsgDeleteNameAuthority) GetWrn() string { func (m *MsgDeleteNameAuthority) GetCrn() string {
if m != nil { if m != nil {
return m.Wrn return m.Crn
} }
return "" return ""
} }
@ -1059,62 +1067,62 @@ func init() {
} }
var fileDescriptor_b66a805dda801ce9 = []byte{ var fileDescriptor_b66a805dda801ce9 = []byte{
// 866 bytes of a gzipped FileDescriptorProto // 878 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0xd3, 0x4c, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x6b, 0xe3, 0x46,
0x14, 0x8d, 0x9b, 0x7e, 0xc9, 0x97, 0x1b, 0xa8, 0x5a, 0x13, 0xaa, 0xe0, 0x52, 0x3b, 0xb8, 0x6a, 0x18, 0xb6, 0xec, 0xd4, 0xae, 0x5f, 0xb7, 0x21, 0x51, 0xdd, 0xe0, 0x2a, 0x8d, 0xe4, 0x2a, 0x24,
0x15, 0x54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, 0x00, 0x87,
0x00, 0x00, 0xef, 0x03, 0x00, 0x00, 0xff, 0xff, 0x08, 0x20, 0xb1, 0x62, 0x91, 0x0c, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -1141,7 +1149,7 @@ type MsgClient interface {
DissociateRecords(ctx context.Context, in *MsgDissociateRecords, opts ...grpc.CallOption) (*MsgDissociateRecordsResponse, error) DissociateRecords(ctx context.Context, in *MsgDissociateRecords, opts ...grpc.CallOption) (*MsgDissociateRecordsResponse, error)
// ReAssociateRecords // ReAssociateRecords
ReAssociateRecords(ctx context.Context, in *MsgReAssociateRecords, opts ...grpc.CallOption) (*MsgReAssociateRecordsResponse, error) ReAssociateRecords(ctx context.Context, in *MsgReAssociateRecords, opts ...grpc.CallOption) (*MsgReAssociateRecordsResponse, error)
// SetName will store the name with given wrn and name // SetName will store the name with given crn and name
SetName(ctx context.Context, in *MsgSetName, opts ...grpc.CallOption) (*MsgSetNameResponse, error) SetName(ctx context.Context, in *MsgSetName, opts ...grpc.CallOption) (*MsgSetNameResponse, error)
// Reserve name // Reserve name
ReserveName(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error) ReserveName(ctx context.Context, in *MsgReserveAuthority, opts ...grpc.CallOption) (*MsgReserveAuthorityResponse, error)
@ -1263,7 +1271,7 @@ type MsgServer interface {
DissociateRecords(context.Context, *MsgDissociateRecords) (*MsgDissociateRecordsResponse, error) DissociateRecords(context.Context, *MsgDissociateRecords) (*MsgDissociateRecordsResponse, error)
// ReAssociateRecords // ReAssociateRecords
ReAssociateRecords(context.Context, *MsgReAssociateRecords) (*MsgReAssociateRecordsResponse, error) ReAssociateRecords(context.Context, *MsgReAssociateRecords) (*MsgReAssociateRecordsResponse, error)
// SetName will store the name with given wrn and name // SetName will store the name with given crn and name
SetName(context.Context, *MsgSetName) (*MsgSetNameResponse, error) SetName(context.Context, *MsgSetName) (*MsgSetNameResponse, error)
// Reserve name // Reserve name
ReserveName(context.Context, *MsgReserveAuthority) (*MsgReserveAuthorityResponse, error) ReserveName(context.Context, *MsgReserveAuthority) (*MsgReserveAuthorityResponse, error)
@ -1608,6 +1616,13 @@ func (m *MsgSetRecordResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Id) > 0 {
i -= len(m.Id)
copy(dAtA[i:], m.Id)
i = encodeVarintTx(dAtA, i, uint64(len(m.Id)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
@ -1694,10 +1709,10 @@ func (m *MsgSetName) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i-- i--
dAtA[i] = 0x12 dAtA[i] = 0x12
} }
if len(m.Wrn) > 0 { if len(m.Crn) > 0 {
i -= len(m.Wrn) i -= len(m.Crn)
copy(dAtA[i:], m.Wrn) copy(dAtA[i:], m.Crn)
i = encodeVarintTx(dAtA, i, uint64(len(m.Wrn))) i = encodeVarintTx(dAtA, i, uint64(len(m.Crn)))
i-- i--
dAtA[i] = 0xa dAtA[i] = 0xa
} }
@ -1888,10 +1903,10 @@ func (m *MsgDeleteNameAuthority) MarshalToSizedBuffer(dAtA []byte) (int, error)
i-- i--
dAtA[i] = 0x12 dAtA[i] = 0x12
} }
if len(m.Wrn) > 0 { if len(m.Crn) > 0 {
i -= len(m.Wrn) i -= len(m.Crn)
copy(dAtA[i:], m.Wrn) copy(dAtA[i:], m.Crn)
i = encodeVarintTx(dAtA, i, uint64(len(m.Wrn))) i = encodeVarintTx(dAtA, i, uint64(len(m.Crn)))
i-- i--
dAtA[i] = 0xa dAtA[i] = 0xa
} }
@ -2271,6 +2286,10 @@ func (m *MsgSetRecordResponse) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = len(m.Id)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
return n return n
} }
@ -2299,7 +2318,7 @@ func (m *MsgSetName) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = len(m.Wrn) l = len(m.Crn)
if l > 0 { if l > 0 {
n += 1 + l + sovTx(uint64(l)) n += 1 + l + sovTx(uint64(l))
} }
@ -2389,7 +2408,7 @@ func (m *MsgDeleteNameAuthority) Size() (n int) {
} }
var l int var l int
_ = l _ = l
l = len(m.Wrn) l = len(m.Crn)
if l > 0 { if l > 0 {
n += 1 + l + sovTx(uint64(l)) n += 1 + l + sovTx(uint64(l))
} }
@ -2729,6 +2748,38 @@ func (m *MsgSetRecordResponse) Unmarshal(dAtA []byte) error {
return fmt.Errorf("proto: MsgSetRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire) return fmt.Errorf("proto: MsgSetRecordResponse: illegal tag %d (wire type %d)", fieldNum, wire)
} }
switch fieldNum { switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Id", 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.Id = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipTx(dAtA[iNdEx:]) skippy, err := skipTx(dAtA[iNdEx:])
@ -2901,7 +2952,7 @@ func (m *MsgSetName) Unmarshal(dAtA []byte) error {
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Wrn", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Crn", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -2929,7 +2980,7 @@ func (m *MsgSetName) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Wrn = string(dAtA[iNdEx:postIndex]) m.Crn = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {
@ -3489,7 +3540,7 @@ func (m *MsgDeleteNameAuthority) Unmarshal(dAtA []byte) error {
switch fieldNum { switch fieldNum {
case 1: case 1:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Wrn", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Crn", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -3517,7 +3568,7 @@ func (m *MsgDeleteNameAuthority) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Wrn = string(dAtA[iNdEx:postIndex]) m.Crn = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 2 { if wireType != 2 {

View File

@ -2,9 +2,9 @@ package types
import ( import (
"crypto/sha256" "crypto/sha256"
canonicalJson "github.com/gibson042/canonicaljson-go" canonicalJson "github.com/gibson042/canonicaljson-go"
"github.com/tharsis/ethermint/x/nameservice/helpers" "github.com/tharsis/ethermint/x/nameservice/helpers"
"time"
) )
const ( const (
@ -24,11 +24,9 @@ type PayloadType struct {
func (payloadObj *PayloadType) ToPayload() Payload { func (payloadObj *PayloadType) ToPayload() Payload {
var payload = Payload{ var payload = Payload{
Record: &Record{ Record: &Record{
CreateTime: time.Time{},
ExpiryTime: time.Time{},
Deleted: false, Deleted: false,
Owners: nil, Owners: nil,
Attributes: helpers.MarshalMapToJSONBytes(payloadObj.Record), Attributes: helpers.BytesToBase64(helpers.MarshalMapToJSONBytes(payloadObj.Record)),
}, },
Signatures: payloadObj.Signatures, Signatures: payloadObj.Signatures,
} }
@ -40,7 +38,7 @@ func (payloadObj *PayloadType) ToPayload() Payload {
func (payload Payload) ToReadablePayload() PayloadType { func (payload Payload) ToReadablePayload() PayloadType {
var payloadType PayloadType var payloadType PayloadType
payloadType.Record = helpers.UnMarshalMapFromJSONBytes(payload.Record.Attributes) payloadType.Record = helpers.UnMarshalMapFromJSONBytes(helpers.BytesFromBase64(payload.Record.Attributes))
payloadType.Signatures = payload.Signatures payloadType.Signatures = payload.Signatures
@ -58,7 +56,8 @@ func (r *Record) ToRecordType() RecordType {
resourceObj.ExpiryTime = r.ExpiryTime resourceObj.ExpiryTime = r.ExpiryTime
resourceObj.Deleted = r.Deleted resourceObj.Deleted = r.Deleted
resourceObj.Owners = r.Owners resourceObj.Owners = r.Owners
resourceObj.Attributes = helpers.UnMarshalMapFromJSONBytes(r.Attributes) resourceObj.Names = r.Names
resourceObj.Attributes = helpers.UnMarshalMapFromJSONBytes(helpers.BytesFromBase64(r.Attributes))
return resourceObj return resourceObj
} }
@ -68,8 +67,8 @@ type RecordType struct {
Id string `json:"id,omitempty"` Id string `json:"id,omitempty"`
Names []string `json:"names,omitempty"` Names []string `json:"names,omitempty"`
BondId string `json:"bondId,omitempty"` BondId string `json:"bondId,omitempty"`
CreateTime time.Time `json:"createTime,omitempty"` CreateTime string `json:"createTime,omitempty"`
ExpiryTime time.Time `json:"expiryTime,omitempty"` ExpiryTime string `json:"expiryTime,omitempty"`
Deleted bool `json:"deleted,omitempty"` Deleted bool `json:"deleted,omitempty"`
Owners []string `json:"owners,omitempty"` Owners []string `json:"owners,omitempty"`
Attributes map[string]interface{} `json:"attributes,omitempty"` Attributes map[string]interface{} `json:"attributes,omitempty"`
@ -86,7 +85,7 @@ func (r *RecordType) ToRecordObj() Record {
resourceObj.ExpiryTime = r.ExpiryTime resourceObj.ExpiryTime = r.ExpiryTime
resourceObj.Deleted = r.Deleted resourceObj.Deleted = r.Deleted
resourceObj.Owners = r.Owners resourceObj.Owners = r.Owners
resourceObj.Attributes = helpers.MarshalMapToJSONBytes(r.Attributes) resourceObj.Attributes = helpers.BytesToBase64(helpers.MarshalMapToJSONBytes(r.Attributes))
return resourceObj return resourceObj
} }