-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #707 from oasisprotocol/ptrus/fix/validator-media
Validator media
- Loading branch information
Showing
16 changed files
with
556 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Validator media updates | ||
|
||
Adds `LogoUrl` field to the `ValidatorMedia` type. | ||
Also updates `ValidatorMedia` fields to match `RegistryMetadata`: | ||
|
||
- `website_link` -> `url` | ||
- `email_address` -> `email` | ||
- `twitter_acc` -> `twitter` | ||
- `tg_chat` removed | ||
- `keybase` added |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package metadata_registry | ||
|
||
import ( | ||
"context" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParseKeybaseResponse(t *testing.T) { | ||
tc := []struct { | ||
json string | ||
shouldErr bool | ||
resp string | ||
}{ | ||
// https://keybase.io/_/api/1.0/user/lookup.json?fields=pictures&usernames=ptrs | ||
{ | ||
json: `{"status":{"code":0,"name":"OK"},"them":[{"id":"149815106745ab70d3e9cdc00fc96419","pictures":{"primary":{"url":"https://s3.amazonaws.com/keybase_processed_uploads/ef2c20c2c1e1a6584d91c49303fd8e05_360_360.jpg","source":null}}},{"id":"a19ba1453ec120ed157c6e85b245c119"}]}`, | ||
shouldErr: false, | ||
resp: "https://s3.amazonaws.com/keybase_processed_uploads/ef2c20c2c1e1a6584d91c49303fd8e05_360_360.jpg", | ||
}, | ||
// https://keybase.io/_/api/1.0/user/lookup.json?fields=pictures&usernames=test | ||
{ | ||
json: `{"status":{"code":0,"name":"OK"},"them":[{"id":"a19ba1453ec120ed157c6e85b245c119"}]}`, | ||
shouldErr: false, | ||
resp: "", | ||
}, | ||
// Invalid JSON. | ||
{ | ||
json: `{"status":123, "code}`, | ||
shouldErr: true, | ||
resp: "", | ||
}, | ||
// Empty response. | ||
{ | ||
json: "", | ||
shouldErr: true, | ||
resp: "", | ||
}, | ||
} | ||
|
||
for _, tt := range tc { | ||
url, err := parseKeybaseLogoUrl(strings.NewReader(tt.json)) | ||
if tt.shouldErr { | ||
require.Error(t, err) | ||
} else { | ||
require.NoError(t, err) | ||
require.Equal(t, tt.resp, url) | ||
} | ||
} | ||
} | ||
|
||
func TestFetchKeybase(t *testing.T) { | ||
logo, err := fetchKeybaseLogoUrl(context.Background(), "ptrs") | ||
require.NoError(t, err) | ||
require.NotEmpty(t, logo) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1128,7 +1128,7 @@ paths: | |
- in: path | ||
name: address | ||
required: true | ||
schema: | ||
schema: | ||
allOf: [$ref: '#/components/schemas/EthOrOasisAddress'] | ||
description: The staking address of the account to return. | ||
responses: | ||
|
@@ -1530,8 +1530,8 @@ components: | |
type: object | ||
description: The method call body. This spec does not encode the many possible types; | ||
instead, see [the Go API](https://pkg.go.dev/github.com/oasisprotocol/oasis-core/go) of oasis-core. | ||
This object will conform to one of the types passed to variable instantiations using `NewMethodName` | ||
two levels down the hierarchy, e.g. `MethodTransfer` from `oasis-core/go/staking/api` seen | ||
This object will conform to one of the types passed to variable instantiations using `NewMethodName` | ||
two levels down the hierarchy, e.g. `MethodTransfer` from `oasis-core/go/staking/api` seen | ||
[here](https://pkg.go.dev/github.com/oasisprotocol/oasis-core/[email protected]/staking/api#pkg-variables). | ||
example: *tx_body_1 | ||
success: | ||
|
@@ -1561,9 +1561,9 @@ components: | |
This field, like `code` and `module`, can represent an error that originated | ||
anywhere in the paratime, i.e. either inside or outside a smart contract. | ||
A common special case worth calling out: When the paratime is | ||
EVM-compatible (e.g. Emerald or Sapphire) and the error originates | ||
inside a smart contract (using `revert` in solidity), the following | ||
A common special case worth calling out: When the paratime is | ||
EVM-compatible (e.g. Emerald or Sapphire) and the error originates | ||
inside a smart contract (using `revert` in solidity), the following | ||
will be true: | ||
- `module` will be "evm" and `code` will be 8; see [here](https://github.com/oasisprotocol/oasis-sdk/blob/runtime-sdk/v0.8.3/runtime-sdk/modules/evm/src/lib.rs#L128) for other possible errors in the `evm` module. | ||
- `message` will contain the best-effort human-readable revert reason. | ||
|
@@ -1573,12 +1573,12 @@ components: | |
allOf: [$ref: '#/components/schemas/EvmAbiParam'] | ||
description: | | ||
The error parameters, as decoded using the contract abi. Present only when | ||
- the error originated from within a smart contract (e.g. via `revert` in Solidity), and | ||
- the error originated from within a smart contract (e.g. via `revert` in Solidity), and | ||
- the contract is verified or the revert reason is a plain String. | ||
If this field is present, `message` will include the name of the error, e.g. 'InsufficentBalance'. | ||
Note that users should be cautious when evaluating error data since the | ||
data origin is not tracked and error information can be faked. | ||
ConsensusEventType: | ||
type: string | ||
enum: | ||
|
@@ -1835,25 +1835,25 @@ components: | |
type: object | ||
# All of the fields are optional. | ||
properties: | ||
website_link: | ||
url: | ||
type: string | ||
description: An URL associated with the entity. | ||
email_address: | ||
email: | ||
type: string | ||
description: An email address for the validator. | ||
twitter_acc: | ||
description: An email address associated with the entity. | ||
twitter: | ||
type: string | ||
description: A Twitter handle. | ||
tg_chat: | ||
description: Twitter handle. | ||
keybase: | ||
type: string | ||
description: An Telegram handle. | ||
logotype: | ||
type: string | ||
description: A logo type. | ||
description: Keybase handle. | ||
name: | ||
type: string | ||
description: The human-readable name of this validator. | ||
description: The human-readable name of this entity. | ||
example: WhaleStake | ||
logoUrl: | ||
type: string | ||
description: URL to a logo image for the entity. | ||
|
||
Validator: | ||
type: object | ||
|
@@ -2424,13 +2424,13 @@ components: | |
This object will conform to one of the `*Event` types two levels down | ||
the hierarchy (e.g. `MintEvent` from `accounts > Event > MintEvent`), | ||
OR `evm > Event`. For object fields that specify an oasis-style address, Nexus | ||
will add a field specifying the corresponding Ethereum address, if known. Currently, | ||
will add a field specifying the corresponding Ethereum address, if known. Currently, | ||
the only such possible fields are `from_eth`, `to_eth`, and `owner_eth`. | ||
evm_log_name: | ||
type: string | ||
description: | | ||
If the event type is `evm.log`, this field describes the human-readable type of | ||
evm event, e.g. `Transfer`. | ||
If the event type is `evm.log`, this field describes the human-readable type of | ||
evm event, e.g. `Transfer`. | ||
Absent if the event type is not `evm.log`. | ||
example: 'Transfer' | ||
evm_log_params: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE chain.entities | ||
ADD COLUMN logo_url TEXT; | ||
|
||
COMMIT; |
Oops, something went wrong.