Skip to content

Commit

Permalink
Merge pull request #2905 from 0chain/Issue#2824_CleaningGeolocation
Browse files Browse the repository at this point in the history
Issue#2824 cleaning geolocation
  • Loading branch information
dabasov committed Oct 28, 2023
2 parents 4842fd7 + 0636a89 commit fd1ddfd
Show file tree
Hide file tree
Showing 33 changed files with 125 additions and 1,403 deletions.
4 changes: 0 additions & 4 deletions code/go/0chain.net/chaincore/chain/protocol_view_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@ func (c *Chain) RegisterNode() (*httpclientutil.Transaction, error) {
mn.Settings.ServiceChargeRatio = viper.GetFloat64("service_charge")
mn.Settings.MaxNumDelegates = viper.GetInt("number_of_delegates")

mn.Geolocation = minersc.SimpleNodeGeolocation{
Latitude: viper.GetFloat64("latitude"),
Longitude: viper.GetFloat64("longitude"),
}
scData := &httpclientutil.SmartContractTxnData{}
if selfNode.Type == node.NodeTypeMiner {
mn.ProviderType = spenum.Miner
Expand Down
6 changes: 3 additions & 3 deletions code/go/0chain.net/chaincore/smartcontract/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestGetSmartContract(t *testing.T) {
{
name: "storage",
address: storagesc.ADDRESS,
restpoints: 56,
restpoints: 55,
},
{
name: "multisig",
Expand All @@ -145,7 +145,7 @@ func TestGetSmartContract(t *testing.T) {
{
name: "miner",
address: minersc.ADDRESS,
restpoints: 23,
restpoints: 21,
},
{
name: "vesting",
Expand Down Expand Up @@ -441,7 +441,7 @@ func TestExecuteSmartContract(t *testing.T) {
},
},
},
want: "{\"simple_miner\":{\"id\":\"\",\"is_shut_down\":false,\"is_killed\":false,\"provider_type\":1,\"n2n_host\":\"\",\"host\":\"\",\"port\":0,\"geolocation\":{\"latitude\":0,\"longitude\":0},\"path\":\"\",\"public_key\":\"\",\"short_name\":\"\",\"build_tag\":\"\",\"total_stake\":0,\"delete\":false,\"last_health_check\":0,\"last_setting_update_round\":0},\"stake_pool\":{\"pools\":{},\"rewards\":0,\"settings\":{\"delegate_wallet\":\"\",\"num_delegates\":0,\"min_stake\":0,\"service_charge\":0},\"minter\":0,\"is_dead\":false}}",
want: "{\"simple_miner\":{\"id\":\"\",\"is_shut_down\":false,\"is_killed\":false,\"provider_type\":1,\"n2n_host\":\"\",\"host\":\"\",\"port\":0,\"path\":\"\",\"public_key\":\"\",\"short_name\":\"\",\"build_tag\":\"\",\"total_stake\":0,\"delete\":false,\"last_health_check\":0,\"last_setting_update_round\":0},\"stake_pool\":{\"pools\":{},\"rewards\":0,\"settings\":{\"delegate_wallet\":\"\",\"num_delegates\":0,\"min_stake\":0,\"service_charge\":0},\"minter\":0,\"is_dead\":false}}",
wantErr: false,
},
}
Expand Down
198 changes: 0 additions & 198 deletions code/go/0chain.net/sharder/sharder/swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7/average-write-price | [average write price](#average-write-price) | Get Average Write Price |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7/blobber-challenges | [blobber challenges](#blobber-challenges) | Get Blobber Challenges by Challenge ID |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7/blobber_ids | [blobber ids](#blobber-ids) | Get Blobber URL as ID |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7/blobbers-by-geolocation | [blobbers by geolocation](#blobbers-by-geolocation) | Returns a list of all blobbers within a rectangle defined by maximum and minimum latitude and longitude values. |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7/blobbers-by-rank | [blobbers by rank](#blobbers-by-rank) | Get List of Blobbers by Rank |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7/free_alloc_blobbers | [free alloc blobbers](#free-alloc-blobbers) | Returns list of all blobbers alive that match the free allocation request. |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7/getBlobber | [get blobber](#get-blobber) | Get Blobber Info |
Expand Down Expand Up @@ -100,7 +99,6 @@
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/getDkgList | [get dkg list](#get-dkg-list) | Get list of DKG Miners |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/getMinerList | [get miner list](#get-miner-list) | Get Miner List |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/getMpksList | [get mpks list](#get-mpks-list) | Get DKG Miners |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/get_miner_geolocations | [get miner geolocations](#get-miner-geolocations) | Get Miner Geolocation |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/get_miners_stake | [get miners stake](#get-miners-stake) | Get Miners Stake |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/get_miners_stats | [get miners stats](#get-miners-stats) | Get Miners Stats |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/get_sharders_stats | [get sharders stats](#get-sharders-stats) | Get Active and Inactive Miners Count |
Expand Down Expand Up @@ -157,7 +155,6 @@
|---------|---------|--------|---------|
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/getSharderKeepList | [get sharder keep list](#get-sharder-keep-list) | Get Sharder Stake |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/getSharderList | [get sharder list](#get-sharder-list) | Get Sharders List |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/get_sharder_geolocations | [get sharder geolocations](#get-sharder-geolocations) | Get Sharder Geolocation |
| GET | /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/get_sharders_stake | [get sharders stake](#get-sharders-stake) | Get Total Sharder Stake |
| GET | /v1/sharder/get/stats | [sharderstats](#sharderstats) | Get Sharder Stats |

Expand Down Expand Up @@ -672,56 +669,6 @@ Status: Bad Request

###### <span id="blobber-ids-400-schema"></span> Schema

### <span id="blobbers-by-geolocation"></span> Returns a list of all blobbers within a rectangle defined by maximum and minimum latitude and longitude values. (*blobbers-by-geolocation*)

```
GET /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7/blobbers-by-geolocation
```

+ name: max_latitude
description: maximum latitude value, defaults to 90
in: query
type: string
+ name: min_latitude
description: minimum latitude value, defaults to -90
in: query
type: string
+ name: max_longitude
description: maximum max_longitude value, defaults to 180
in: query
type: string
+ name: min_longitude
description: minimum max_longitude value, defaults to -180
in: query
type: string
+ name: offset
description: offset
in: query
type: string
+ name: limit
description: limit
in: query
type: string
+ name: sort
description: desc or asc
in: query
type: string

#### All responses
| Code | Status | Description | Has headers | Schema |
|------|--------|-------------|:-----------:|--------|
| [200](#blobbers-by-geolocation-200) | OK | stringArray | | [schema](#blobbers-by-geolocation-200-schema) |
| [500](#blobbers-by-geolocation-500) | Internal Server Error | | | [schema](#blobbers-by-geolocation-500-schema) |

#### Responses


##### <span id="blobbers-by-geolocation-200"></span> 200 - stringArray
Status: OK

###### <span id="blobbers-by-geolocation-200-schema"></span> Schema




[StringArray](#string-array)
Expand Down Expand Up @@ -2136,51 +2083,6 @@ Status: Internal Server Error

###### <span id="get-blocks-500-schema"></span> Schema

### <span id="get-miner-geolocations"></span> Get Miner Geolocation (*get_miner_geolocations*)

```
GET /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/get_miner_geolocations
```

list minersc config settings

#### Parameters

| Name | Source | Type | Go type | Separator | Required | Default | Description |
|------|--------|------|---------|-----------| :------: |---------|-------------|
| active | `query` | string | `string` | || | active |
| limit | `query` | string | `string` | || | limit |
| offset | `query` | string | `string` | || | offset |
| sort | `query` | string | `string` | | | | desc or asc |

#### All responses
| Code | Status | Description | Has headers | Schema |
|------|--------|-------------|:-----------:|--------|
| [200](#get-miner-geolocations-200) | OK | MinerGeolocation | | [schema](#get-miner-geolocations-200-schema) |
| [400](#get-miner-geolocations-400) | Bad Request | | | [schema](#get-miner-geolocations-400-schema) |
| [484](#get-miner-geolocations-484) | Status 484 | | | [schema](#get-miner-geolocations-484-schema) |

#### Responses


##### <span id="get-miner-geolocations-200"></span> 200 - MinerGeolocation
Status: OK

###### <span id="get-miner-geolocations-200-schema"></span> Schema



[MinerGeolocation](#miner-geolocation)

##### <span id="get-miner-geolocations-400"></span> 400
Status: Bad Request

###### <span id="get-miner-geolocations-400-schema"></span> Schema

##### <span id="get-miner-geolocations-484"></span> 484
Status: Status 484

###### <span id="get-miner-geolocations-484-schema"></span> Schema

### <span id="get-miners-stake"></span> Get Miners Stake (*get_miners_stake*)

Expand Down Expand Up @@ -2244,51 +2146,6 @@ Status: Not Found

###### <span id="get-miners-stats-404-schema"></span> Schema

### <span id="get-sharder-geolocations"></span> Get Sharder Geolocation (*get_sharder_geolocations*)

```
GET /v1/screst/6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9/get_sharder_geolocations
```

list minersc config settings

#### Parameters

| Name | Source | Type | Go type | Separator | Required | Default | Description |
|------|--------|------|---------|-----------| :------: |---------|-------------|
| active | `query` | string | `string` | || | active |
| limit | `query` | string | `string` | || | limit |
| offset | `query` | string | `string` | || | offset |
| sort | `query` | string | `string` | | | | desc or asc |

#### All responses
| Code | Status | Description | Has headers | Schema |
|------|--------|-------------|:-----------:|--------|
| [200](#get-sharder-geolocations-200) | OK | SharderGeolocation | | [schema](#get-sharder-geolocations-200-schema) |
| [400](#get-sharder-geolocations-400) | Bad Request | | | [schema](#get-sharder-geolocations-400-schema) |
| [484](#get-sharder-geolocations-484) | Status 484 | | | [schema](#get-sharder-geolocations-484-schema) |

#### Responses


##### <span id="get-sharder-geolocations-200"></span> 200 - SharderGeolocation
Status: OK

###### <span id="get-sharder-geolocations-200-schema"></span> Schema



[SharderGeolocation](#sharder-geolocation)

##### <span id="get-sharder-geolocations-400"></span> 400
Status: Bad Request

###### <span id="get-sharder-geolocations-400-schema"></span> Schema

##### <span id="get-sharder-geolocations-484"></span> 484
Status: Status 484

###### <span id="get-sharder-geolocations-484-schema"></span> Schema

### <span id="get-sharders-stake"></span> Get Total Sharder Stake (*get_sharders_stake*)

Expand Down Expand Up @@ -3876,22 +3733,6 @@ IDField - Useful to embed this into all the entities and get consistent behavior



### <span id="miner-geolocation"></span> MinerGeolocation






**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| Latitude | double (formatted number)| `float64` | | | | |
| Longitude | double (formatted number)| `float64` | | | | |
| MinerID | string| `string` | | | | |



### <span id="miner-node"></span> MinerNode

Expand All @@ -3915,7 +3756,6 @@ IDField - Useful to embed this into all the entities and get consistent behavior
| Port | int64 (formatted integer)| `int64` | | | | |
| PublicKey | string| `string` | | | | |
| ShortName | string| `string` | | | | |
| geolocation | [SimpleNodeGeolocation](#simple-node-geolocation)| `SimpleNodeGeolocation` | | | | |
| last_health_check | [Timestamp](#timestamp)| `Timestamp` | | | | |
| minter | [ApprovedMinter](#approved-minter)| `ApprovedMinter` | | | | |
| node_type | [NodeType](#node-type)| `NodeType` | | | | |
Expand Down Expand Up @@ -4270,21 +4110,6 @@ it can be used as a scan destination, similar to NullString.



### <span id="sharder-geolocation"></span> SharderGeolocation






**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| Latitude | double (formatted number)| `float64` | | | | |
| Longitude | double (formatted number)| `float64` | | | | |
| SharderID | string| `string` | | | | |



### <span id="share-or-signs"></span> ShareOrSigns
Expand Down Expand Up @@ -4324,7 +4149,6 @@ it can be used as a scan destination, similar to NullString.
| Port | int64 (formatted integer)| `int64` | | | | |
| PublicKey | string| `string` | | | | |
| ShortName | string| `string` | | | | |
| geolocation | [SimpleNodeGeolocation](#simple-node-geolocation)| `SimpleNodeGeolocation` | | | | |
| last_health_check | [Timestamp](#timestamp)| `Timestamp` | | | | |
| node_type | [NodeType](#node-type)| `NodeType` | | | | |
| total_stake | [Coin](#coin)| `Coin` | | | | |
Expand Down Expand Up @@ -4536,7 +4360,6 @@ which the allocation has created. | |
| ID | string| `string` | | | | |
| LastRewardDataReadRound | int64 (formatted integer)| `int64` | | | | |
| SavedData | int64 (formatted integer)| `int64` | | | | |
| geolocation | [StorageNodeGeolocation](#storage-node-geolocation)| `StorageNodeGeolocation` | | | | |
| last_health_check | [Timestamp](#timestamp)| `Timestamp` | | | | |
| provider_type | [Provider](#provider)| `Provider` | | | | |
| reward_partition | [RewardPartitionLocation](#reward-partition-location)| `RewardPartitionLocation` | | | | |
Expand All @@ -4545,23 +4368,6 @@ which the allocation has created. | |



### <span id="storage-node-geolocation"></span> StorageNodeGeolocation


> Move to the core, in case of multi-entity use of geo data





**Properties**

| Name | Type | Go type | Required | Default | Description | Example |
|------|------|---------|:--------:| ------- |-------------|---------|
| Latitude | double (formatted number)| `float64` | | | | |
| Longitude | double (formatted number)| `float64` | | | | |



### <span id="string-map"></span> StringMap
Expand Down Expand Up @@ -4825,8 +4631,6 @@ Timestamp - just a wrapper to control the json encoding */ | |
| AuthorizerID | string| `string` | | | | |
| DelegateWallet | string| `string` | | | stake_pool_settings | |
| LastHealthCheck | int64 (formatted integer)| `int64` | | | Stats | |
| Latitude | double (formatted number)| `float64` | | | Geolocation | |
| Longitude | double (formatted number)| `float64` | | | | |
| NumDelegates | int64 (formatted integer)| `int64` | | | | |
| ServiceCharge | double (formatted number)| `float64` | | | | |
| URL | string| `string` | | | | |
Expand Down Expand Up @@ -4987,7 +4791,6 @@ Timestamp - just a wrapper to control the json encoding */ | |
| Round | int64 (formatted integer)| `int64` | | | | |
| ShortName | string| `string` | | | | |
| TotalReward | int64 (formatted integer)| `int64` | | | | |
| geolocation | [SimpleNodeGeolocation](#simple-node-geolocation)| `SimpleNodeGeolocation` | | | | |
| last_health_check | [Timestamp](#timestamp)| `Timestamp` | | | | |
| minter | [ApprovedMinter](#approved-minter)| `ApprovedMinter` | | | | |
| node_type | [NodeType](#node-type)| `NodeType` | | | | |
Expand Down Expand Up @@ -5070,7 +4873,6 @@ and the other for the allocations that the client (client_id) doesn't own
| ReadData | int64 (formatted integer)| `int64` | | | | |
| SavedData | int64 (formatted integer)| `int64` | | | | |
| UsedAllocation | int64 (formatted integer)| `int64` | | | | |
| geolocation | [StorageNodeGeolocation](#storage-node-geolocation)| `StorageNodeGeolocation` | | | | |
| last_health_check | [Timestamp](#timestamp)| `Timestamp` | | | | |
| provider_type | [Provider](#provider)| `Provider` | | | | |
| reward_partition | [RewardPartitionLocation](#reward-partition-location)| `RewardPartitionLocation` | | | | |
Expand Down

0 comments on commit fd1ddfd

Please sign in to comment.