-
Notifications
You must be signed in to change notification settings - Fork 1k
The MASP conversions query now requires a MASP epoch to be specified. #4776
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
Conversation
add089e
to
e377e7f
Compare
@murisi - it was mentioned to me from @Fraccaman that we desire this work. Is this mergeable (I see the label that might suggest otherwise). Does it need review? |
@brentstone It's been a while since I've looked at this. I believe this PR did help when the mainnet clone's epochs got very high. I probably put the |
@batconjurer would you mind peeking at this? |
e377e7f
to
b46504b
Compare
This looks good to me. In the future, it would also be possible to speed up the server side processing by keying the conversions by epoch since right now the server still needs to do a linear scan over the whole conversion state. That is a much more invasive change though. |
🧪 CI InsightsHere's what we observed from your CI run for 882fbbd. 🟢 All jobs passed!But CI Insights is watching 👀 |
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.
we can optimize conversion queries. right now, we need to wait for the full round-trip time of the conversions at a specific masp epoch. say we had 100 masp epochs to go through, and the RTT was 100 ms. we would need to wait 10 seconds for each query to be resolved. with 100 concurrent requests, ideally we would complete all queries in 100 ms. of course in practice they'll be slower, but there should be a major speed-up from launching these queries concurrently.
crates/apps_lib/src/client/rpc.rs
Outdated
for epoch in MaspEpoch::iter_bounds_inclusive(from, to) { | ||
conversions.append( | ||
&mut rpc::query_conversions(context.client(), &epoch) | ||
.await | ||
.expect("Conversions should be defined"), | ||
); | ||
} |
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.
there's no reason why we cannot run these queries concurrently (e.g. with this). the Stream
can be collected into a BTreeMap
(see StreamExt::collect
)
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.
I've attempted this in 0d1074c even though I had to fold
the maps instead of collect
because of the limitations of the Extend
trait on maps. Should we also add an extra argument to the query command to allow the user to specify the from
epoch to avoid querying from 0 all the times?
46ea724
to
0d1074c
Compare
Force-pushed to rebase on main |
0d1074c
to
70bc3df
Compare
lgtm, just a small question |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The MASP conversions query now requires a MASP epoch to be specified. (backport #4776)
…pr-4776 The MASP conversions query now requires a MASP epoch to be specified. (backport #4776)
Describe your changes
Querying the conversion state becomes more difficult as nodes progress to higher and higher epochs. For instance, on a mainnet clone running on accelerated epochs, client queries for conversions always timeout (even after modifying
timeout_broadcast_tx_commit
) when the node goes beyond a certain MASP epoch. This happens because the conversion state grows linearly with the MASP epoch counter. This PR attempts to address this problem by making the conversions RPC endpoint require that clients specify the MASP epoch they want conversions from. This implies two things: first the size of the response from the conversions RPC endpoint should now be constant (equal to the number of tokens in the shielded rewards program), and second a client requiring all conversions now has to do a separate query for each MASP epoch.Checklist before merging
breaking::
labelsnamada-docs
reponamada-indexer
ornamada-masp-indexer
, a corresponding PR is opened in that repo