-
Notifications
You must be signed in to change notification settings - Fork 32
Add Support for Cosmos SDK 0.50.1 #383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Quilamir
wants to merge
10
commits into
SimplyStaking:master
Choose a base branch
from
NodeMonsterProjects:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9b89a90
added v0.50.1 Cosmos SDK endpoints
VogonAnthology 427304b
fixed cosmos REST test / removed substrate-api (ONLY) container / .en…
VogonAnthology 763e108
fixed tendermint RPC json parsing error
VogonAnthology 904aa3e
Fixed Cosmos REST error + added tests for v0.50.1
VogonAnthology 41985ec
fixed prometheus endpoints
VogonAnthology 54423f8
persistent db volumes
VogonAnthology 122162d
updated containers node's versions, mongodb & mongoose to latest, REA…
VogonAnthology 235007e
updated containers node versions, mongodb & mongoose to latest, REACT…
VogonAnthology 4da8daf
Merge pull request #1 from VogonAnthology/master
Quilamir 77647ba
Update cosmos.py
Quilamir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -30,11 +30,12 @@ def __init__(self, logger: logging.Logger, verify: bool = False, | |
| def get_syncing(self, cosmos_rest_url: str) -> Dict: | ||
| """ | ||
| This function retrieves data from the cosmos_rest_url/syncing endpoint, | ||
| and is compatible with both v0.39.2 and v0.42.6 of the Cosmos SDK | ||
| and is *NOT* compatible with both v0.39.2 and v0.42.6, | ||
| but *ONLY* compatible with v0.50.1 of the Cosmos SDK | ||
| :param cosmos_rest_url: The Cosmos REST url of the data source | ||
| :return: Retrieves data from the cosmos_rest_url/syncing endpoint | ||
| """ | ||
| endpoint = cosmos_rest_url + '/syncing' | ||
| endpoint = cosmos_rest_url + '/cosmos/base/tendermint/v1beta1/syncing' | ||
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| verify=self.verify, timeout=self.timeout) | ||
|
Comment on lines
30
to
40
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We always tried to keep PANIC backwards compatible. I suggest that we follow a similar implementation to |
||
|
|
||
|
|
@@ -87,6 +88,34 @@ def get_staking_validators_v0_42_6( | |
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| params=params, verify=self.verify, | ||
| timeout=self.timeout) | ||
|
|
||
| def get_staking_validators_v0_50_1( | ||
| self, cosmos_rest_url: str, validator_address: str = None, | ||
| params: Dict = None) -> Dict: | ||
| """ | ||
| This function retrieves data from the | ||
| cosmos_rest_url/cosmos/staking/v1beta1/validators and | ||
| cosmos_rest_url/cosmos/staking/v1beta1/validators/{validatorAddr} | ||
| endpoints, depending on the inputted function parameters. Note that this | ||
| function is only compatible with v0.50.1 of the Cosmos SDK, for other | ||
| versions unexpected behaviour might occur. | ||
| :param cosmos_rest_url: The Cosmos REST url of the data source | ||
| :param params: Parameters that need to be added to the endpoint | ||
| :param validator_address: The address of the validator you want to query | ||
| :return: Retrieves data from the | ||
| : cosmos_rest_url/cosmos/staking/v1beta1/validators or | ||
| : cosmos_rest_url/cosmos/staking/v1beta1/validators/{ | ||
| : validatorAddr} endpoints | ||
| """ | ||
| cosmos_fn = ( | ||
| '/cosmos/staking/v1beta1/validators' if validator_address is None | ||
| else '/cosmos/staking/v1beta1/validators/{}'.format( | ||
| validator_address) | ||
| ) | ||
| endpoint = cosmos_rest_url + cosmos_fn | ||
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| params=params, verify=self.verify, | ||
| timeout=self.timeout) | ||
|
|
||
| def get_proposals_v0_39_2( | ||
| self, cosmos_rest_url: str, proposal_id: int = None, | ||
|
|
@@ -137,6 +166,34 @@ def get_proposals_v0_42_6( | |
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| params=params, verify=self.verify, | ||
| timeout=self.timeout) | ||
|
|
||
| def get_proposals_v0_50_1( | ||
| self, cosmos_rest_url: str, proposal_id: int = None, | ||
| params: Dict = None) -> Dict: | ||
| """ | ||
| This function retrieves data from the | ||
| cosmos_rest_url/cosmos/gov/v1beta1/proposals and | ||
| cosmos_rest_url/cosmos/gov/v1beta1/proposals/{proposalId} | ||
| endpoints, depending on the inputted function parameters. Note that this | ||
| function is only compatible with v0.50.1 of the Cosmos SDK, for other | ||
| versions unexpected behaviour might occur. | ||
| :param cosmos_rest_url: The Cosmos REST url of the data source | ||
| :param params: Parameters that need to be added to the endpoint | ||
| :param proposal_id: The ID of the proposal you want to query | ||
| :return: Retrieves data from the | ||
| : cosmos_rest_url/cosmos/gov/v1beta1/proposals or | ||
| : cosmos_rest_url/cosmos/gov/v1beta1/proposals/{ | ||
| : proposalId} endpoints | ||
| """ | ||
| cosmos_fn = ( | ||
| '/cosmos/gov/v1/proposals' if proposal_id is None | ||
| else '/cosmos/gov/v1/proposals/{}'.format( | ||
| proposal_id) | ||
| ) | ||
| endpoint = cosmos_rest_url + cosmos_fn | ||
| return get_cosmos_json(endpoint=endpoint, logger=self.logger, | ||
| params=params, verify=self.verify, | ||
| timeout=self.timeout) | ||
|
|
||
| def execute_with_checks(self, function, args: List[Any], | ||
| node_name: str, sdk_version: str) -> Any: | ||
|
|
||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update inline documentation due to the fact that we are now supporting v50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly between lines 14 and 24