Skip to content

Conversation

cong-or
Copy link
Contributor

@cong-or cong-or commented May 7, 2025

issue 2393

Replace path parameter to a query parameter for stake address which allows optional stake addr lookup with rbac token, if present.

temporary version to avoid FE breaking changes.
/v2/cardano/assets/

@cong-or cong-or self-assigned this May 7, 2025
@cong-or cong-or added the F14-RC2 Release Candidate 2 for F14 Tech Readiness label May 7, 2025
@cong-or cong-or moved this from New to 🏗 In progress in Catalyst May 7, 2025
@cong-or cong-or added the do not review yet Do not review yet label May 7, 2025
Copy link
Contributor

github-actions bot commented May 7, 2025

Test Report | ${\color{lightgreen}Pass: 723/727}$ | ${\color{red}Fail: 0/727}$ |

@cong-or cong-or removed the do not review yet Do not review yet label May 7, 2025
@cong-or cong-or marked this pull request as ready for review May 7, 2025 19:42
let params = GetStakeAddressByCatIDParams::new(token.catalyst_id().clone().into());
let mut results = GetStakeAddressByCatIDQuery::execute(&session, params).await?;

results
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure whether this will give us a valid stake_address that we want 🤔. Might require to build the registration chain and get the latest stake address. What do you think? @stanislav-tkach

Copy link
Member

@stanislav-tkach stanislav-tkach May 8, 2025

Choose a reason for hiding this comment

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

I think that you are right. Anyway, this logic can be greatly simplified when we have the RBAC cache, but we probably cannot wait till that?..

Copy link
Contributor

Choose a reason for hiding this comment

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

It is label as RC2 so I think so, would be okay to perform a build_reg_chain for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so the (cat_id,stake_addr) in catalyst_id_for_stake_address table is not the latest?

Copy link
Member

@stanislav-tkach stanislav-tkach May 8, 2025

Choose a reason for hiding this comment

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

It is kind of the latest, but it can lie in several cases. For example:

  1. A root registration with A stake address and CID_1 Catalyst ID.
  2. A role 0 update that changes a stake address from A to B.

After processing these two registrations we would have two entries in the table: [(A, CID_1), (B, CID_1)]. A query with the A address returns CID_1, but that stake address is no longer used by this registration chain, so we should return "not found".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stanislav-tkach does this imply to the inverse also e.g here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is label as RC2 so I think so, would be okay to perform a build_reg_chain for now

@bkioshn do we have any examples of this?

Copy link
Member

@stanislav-tkach stanislav-tkach May 8, 2025

Choose a reason for hiding this comment

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

@stanislav-tkach does this imply to the inverse also e.g here

Sorry, I was confused. I described the situation with looking up a Catalyst ID by a stake address. Doing the reverse (to search a stake address with a Catalyst ID) would be simply inefficient using the catalyst_id_for_stake_address table. But there is an issue there too:

  1. A root registration with A stake address and CID_1 Catalyst ID.
  2. Another root registration with A stake address and CID_2 Catalyst ID.

It is allowed to "override" (or restart) a chain and in this case there once again would be multiple entries and it is impossible to tell which one is correct without building all of the chains. We cannot just use the latest one because it can be incorrect.

Sorry if all that is confusing (it is for me), but that is why we are trying to fix it with a different approach.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This will be resolved with the cache update to rbac registrations, if I am not mistaken.
It may be prudent to pause this and rebase it on that work, rather than try and fix those issues here.

Copy link
Contributor

@bkioshn bkioshn May 12, 2025

Choose a reason for hiding this comment

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

Sorry for late reply, @cong-or I have one that you can test
The scenario is

Registration 1: root registration
stake1 = stake_test1urmunkf4zd332vnucxmsqkddjhhr6a3ww7675phu7pvun0qvaqsqj
catid1 = preprod.cardano/HM_KavkvqjOjbX9ZeoEZd2mSgsjSJE9FKoVwwbdo04U

Registration 2: root registration
stake2 = stake_test1uzte0jry3w6rn3j63xhzcyn7fv5akggad66aaffyqsqkzxgm0mhky
catid1 = preprod.cardano/HM_KavkvqjOjbX9ZeoEZd2mSgsjSJE9FKoVwwbdo04U

Using catid1, you must get the stake address of registration 2

^ The above example will be invalid, I will generate a new one once the cache is ready

@stevenj stevenj marked this pull request as draft May 9, 2025 16:05
@stevenj
Copy link
Collaborator

stevenj commented May 9, 2025

I actually think this PR is mostly fine.
Except it will benefit immensely from the cache work on registrations that @stanislav-tkach is working on. Hence I have made this draft pending completion of that work, and then this can be rebased on that.

@github-actions github-actions bot deleted the lookup-stake-addr-w-rbac-token branch June 24, 2025 06:01
@minikin minikin added the no-track Used to skip tracking in Swarmia analytics, etc. label Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F14-RC2 Release Candidate 2 for F14 Tech Readiness no-track Used to skip tracking in Swarmia analytics, etc.
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

5 participants