Skip to content
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

feat(tendermint): validators RPC #2310

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from
Open

feat(tendermint): validators RPC #2310

wants to merge 16 commits into from

Conversation

onur-ozkan
Copy link
Member

@onur-ozkan onur-ozkan commented Jan 2, 2025

This is the initial implementation related to Tendermint staking feature on KDF. Remaining parts will be added gradually one by one similar to the validators RPC in this PR.

e.g., RPC payload structure:

let request = json!({
"userpass": mm.userpass,
"method": rpc_endpoint,
"mmrpc": "2.0",
"params": {
"ticker": coin,
"filter_by_status": filter_by_status,
"limit": limit,
"page_number": page_number
}
});

filter_by_status can be set to one of All, Bonded and Unbonded. Default is All.

Explanation of Bonded and Unbonded statuses:

/// Validator is in the active set and participates in consensus.
#[default]
Bonded,
/// Validator is not in the active set and does not participate in consensus.
/// Accordingly, they do not receive rewards and cannot be slashed.
/// It is possible to delegate tokens to a validator in this state.
Unbonded,

Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
@onur-ozkan onur-ozkan marked this pull request as ready for review January 6, 2025 06:09
Signed-off-by: onur-ozkan <[email protected]>
borngraced
borngraced previously approved these changes Jan 6, 2025
Copy link
Member

@borngraced borngraced left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work!

Copy link
Collaborator

@mariocynicys mariocynicys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank YOU :)

mm2src/mm2_test_helpers/src/for_tests.rs Outdated Show resolved Hide resolved
mm2src/coins/tendermint/tendermint_coin.rs Outdated Show resolved Hide resolved
mm2src/coins/rpc_command/tendermint/staking.rs Outdated Show resolved Hide resolved
Comment on lines +35 to +36
#[serde(flatten)]
paging: PagingOptions,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we have paging optional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already optional.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i meant having it optional as in the sense of accepting it being None, and not applying a default.
so the pagination in this request:

pagination: Some(PageRequest {
key: vec![],
offset: ((paging.page_number.get() - 1usize) * paging.limit) as u64,
limit: paging.limit as u64,
count_total: false,
reverse: false,
}),

could follow accordingly.

it's OK though if u did this intentionally because we want the default behavior to paginate like so.

Signed-off-by: onur-ozkan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants