Conversation
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
269feaf to
45f1a67
Compare
Signed-off-by: onur-ozkan <work@onurozkan.dev>
f729bc0 to
47e4489
Compare
Signed-off-by: onur-ozkan <work@onurozkan.dev>
47e4489 to
7bcf533
Compare
There was a problem hiding this comment.
I think it's better to follow common recommendations and implement the Display trait instead of a direct ToString implementation.
impl Display for ValidatorStatus {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let str = match self {
// An empty string doesn't filter any validators and we get an unfiltered result.
ValidatorStatus::All => String::default(),
ValidatorStatus::Bonded => "BOND_STATUS_BONDED".into(),
ValidatorStatus::Unbonded => "BOND_STATUS_UNBONDED".into(),
};
write!(f, "{}", str)
}
}|
Could you elaborate how it's being the common recommendation to prefer |
https://doc.rust-lang.org/std/fmt/trait.Display.html
As I understand implementing |
|
We don't need formatting on the type so it's unnecessary. We specifically and explicitly need |
| Cosmos(rpc_command::tendermint::staking::SimpleListQuery), | ||
| } | ||
|
|
||
| #[derive(Deserialize)] | ||
| pub struct UndelegationsInfo { | ||
| pub coin: String, | ||
| info_details: UndelegationsInfoDetails, | ||
| } | ||
|
|
||
| #[derive(Debug, Deserialize)] | ||
| #[serde(tag = "type")] | ||
| pub enum UndelegationsInfoDetails { | ||
| Cosmos(rpc_command::tendermint::staking::SimpleListQuery), |
There was a problem hiding this comment.
There is so much code in lp_coins.rs related to staking and delegation.
What about moving it to pub mod staking? The module can be inside the coins workspace.
There was a problem hiding this comment.
Yeah... I also hate that, but the thing is even with staking module in coins module it wouldn't be good enough, in fact, I think it will be even bad because it will look like we have duplicated staking modules (one from tendermint and one from coins) and it will look inconsistent with how we handle other RPCs (right now they all included in lp_coins).
I would prefer to re-write this module in general, rather than applying a workaround solution for specific logic.
There was a problem hiding this comment.
I think it will be even bad because it will look like we have duplicated staking modules
You can rename staking in tendermint or just add doc comment at the top of file
There was a problem hiding this comment.
If I do it in this PR, it will be very hard for others to review this PR (due to moving lots of things around). I will wait for others opinion on this.
There was a problem hiding this comment.
I think you can create an issue to move staking code from lp_coins to its own module before adding more staking implementations.
There was a problem hiding this comment.
If I do it in this PR, it will be very hard for others to review this PR (due to moving lots of things around). I will wait for others opinion on this.
Agreed, we should never do refactors that involves moving code around in the same PR as new functionalities.
borngraced
left a comment
There was a problem hiding this comment.
well done. I have two minor 2 notes
Signed-off-by: onur-ozkan <work@onurozkan.dev>
2a32128 to
d1115e8
Compare
|
Can you please finalize your reviews? @laruh @borngraced |
laruh
left a comment
There was a problem hiding this comment.
LGTM! please dont forget to create an issue #2377 (comment)
Signed-off-by: onur-ozkan <work@onurozkan.dev>
70b217f
… into staking-query-rpcs
* dev: feat(tendermint): staking queries (#2377)
* dev: fix(tx-history): fix unhandled IBC and HTLC events (#2385) improvement(dep-stack): replace deprecated `instant` dependency (#2391) feat(tendermint): staking queries (#2377) refactor(eth): use trait addr_to_string method instead of old function (#2348) fix(ci): use correct rustup component syntax in fmt-and-lint job (#2390) refactor(tx-query): use TxSearchRequest for tx queries (#2384) refactor(tpu-v2): allow to skip p2p message with taker payment spend preimage for eth (#2359) feat(rpc): add is_success field to legacy MySwapStatusResponse (#2371) fix(key-derivation): use stored Argon2 parameters instead of default values (#2360) fix(tests): stabilize `tendermint_coin::test_claim_staking_rewards` (#2373) improvement(RPCs): group staking rpcs under a namespace (#2372)
Implements
delegationsandongoing_undelegationssearching RPCs including rewards and undelegation completion period information for tendermint.