Skip to content

feat: add redelegation info#96

Merged
mateuszjasiuk merged 13 commits intomainfrom
feat/redelegations
Mar 21, 2025
Merged

feat: add redelegation info#96
mateuszjasiuk merged 13 commits intomainfrom
feat/redelegations

Conversation

@mateuszjasiuk
Copy link
Copy Markdown
Collaborator

@mateuszjasiuk mateuszjasiuk commented Aug 8, 2024

  • added redelegation info(null when no redelegation info found)
curl -X 'GET' \
  'http://localhost:5001/api/v1/pos/merged-bonds/tnam1qqshvryx9pngpk7mmzpzkjkm6klelgusuvmkc0uz' \
  -H 'accept: application/json'
{
  "results": [
   {
      "amount": "20.000000",
      "validator": {
        "address": "tnam1qyeajuacps8rcqd4fxq506am20sz22s7yypekcd5",
        "votingPower": "16155",
        "maxCommission": "0.02",
        "commission": "0.02",
        "state": "consensus",
        "name": null,
        "email": null,
        "website": null,
        "description": null,
        "discordHandle": null,
        "avatar": null,
        "validatorId": "188"
      },
      "redelegationInfo": {
        "earliestRedelegationEpoch": "450",
        "earliestRedelegationTime": "1742963267"
      }
    }
  ],
  "pagination": {
    "page": 1,
    "perPage": 30,
    "totalPages": 1,
    "totalItems": 2
  }
}
  • added slash_processing_epoch_offset
  • bond and unbond mods were moved to pos

@mateuszjasiuk mateuszjasiuk requested review from Fraccaman, grarco and sug0 and removed request for Fraccaman, grarco and sug0 March 10, 2025 11:58
@mateuszjasiuk mateuszjasiuk marked this pull request as draft March 10, 2025 12:12
@mateuszjasiuk mateuszjasiuk force-pushed the feat/redelegations branch 2 times, most recently from 113d703 to 4466920 Compare March 12, 2025 10:17
@mateuszjasiuk mateuszjasiuk marked this pull request as ready for review March 12, 2025 10:18
@mateuszjasiuk mateuszjasiuk requested review from Fraccaman, grarco and sug0 and removed request for sug0 March 12, 2025 10:26
@Fraccaman
Copy link
Copy Markdown
Collaborator

LGTM, the only thing I would change is to remove all the tracing::info!(..) and add another line in chain/src/main.rs:440

Comment thread chain/src/repository/pos.rs Outdated
validator.id,
)
})
.collect::<Vec<_>>(),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
.collect::<Vec<_>>(),
.collect::<anyhow::Result<Vec<_>>>()?,

you can collect a result to avoid the .expect()

addresses: &HashSet<BondAddresses>,
) -> anyhow::Result<Vec<Redelegation>> {
let redelegations = futures::stream::iter(addresses)
.filter_map(|BondAddresses { source, target }| async move {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we can propagate the errors. this will filter failing queries

})
.map(futures::future::ready)
.buffer_unordered(20)
.collect::<Vec<_>>()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

basically collect a result of a vec, again

validator_addresses: Vec<Id>,
) -> anyhow::Result<Vec<Redelegation>> {
let nested_delegations = futures::stream::iter(validator_addresses.clone())
.filter_map(|validator_address| async move {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

same

@mateuszjasiuk mateuszjasiuk requested a review from sug0 March 13, 2025 10:39
Comment thread webserver/src/response/pos.rs Outdated
@mateuszjasiuk mateuszjasiuk requested a review from grarco March 14, 2025 08:02
epoch_switch_blocks_delay INT NOT NULL,
checksums JSONB NOT NULL
checksums JSONB NOT NULL,
slash_processing_epoch_offset INT NOT NULL
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't this be in a separate migration ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah totally missed that

@mateuszjasiuk mateuszjasiuk requested a review from Fraccaman March 14, 2025 09:52
@mateuszjasiuk mateuszjasiuk added this pull request to the merge queue Mar 21, 2025
Merged via the queue into main with commit 2f5f8de Mar 21, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants