-
Notifications
You must be signed in to change notification settings - Fork 302
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
Add support for equivalent values to ValueView
#3898
Conversation
Closes #3838 whenever we work out what the right design is |
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 think this makes sense. As we are scanning through blocks, we'll use the new prices: Vec<EstimatedPrice>
available in the transaction (the node provides this right?) and save these to our DB. Here's where we save the transaction. It shouldn't be hard to also have an additional write for prices in another table (or maybe do a special kind of index).
Then, upon request for balances, we'll fill out the ValueViews by querying the DB & applying some filtering (specific numeraire, recency/confidence, etc) and making the conversion like you did in the view_value
method.
Well, I'm not 100% sure if we want to do this, since it gets to the problem that asks for an I think this would need a bit more product thinking than we've done so far, it seems like a bit of a rabbithole, so we might be better off not doing anything for now and only focusing on the other parts of the RPC (like balances) which are inherently "current" data. But that's exactly the use case the current state of this PR doesn't address, since it only works on transactions.
Right, the issue I was pointing to is that (in the current state of this branch) this isn't possible, since the equivalent values can only be generated in the context of a |
I added the `EquivalentPrice` to the asset proto package rather than solely in the TxP, because I realized that the use cases we care about most immediately (having equivalent prices for balances) don't actually involve `TransactionView`s at all. While doing that I realized that in the context of viewing a _transaction_, it doesn't really make sense to just have an "equivalent value" on its own, so I added an `as_of_height` to allow indicating when the prices were relevant. We probably shouldn't try to expose this in the transaction view just yet, since it's a little unclear how we'd want to indicate historical prices.
48ba2c1
to
f5a42b5
Compare
I updated the PR to make it possible to use the estimated prices independently of the The breaking change notifications from the proto lint is a false positive, it's comparing to the previous run rather than comparing to the pre-PR state. |
ValueView
On the web side of things, it seems we'd just need to adjust the price sourcing (versus relying upon tx). For example, we'd have to do something like:
|
@grod220 I think penumbra-zone/web#556 is a more general design |
I'm not sure if the
EquivalentPrice
should also be defined in the asset proto package rather than alongside the TxP? I filled in an implementation that inserts equivalent values intoTransactionView
s but I realized that because it relies heavily on the TxP it may not be directly useful for the web extension use cases, which so far seem mostly about balances (?).However, while doing that I realized that in the context of viewing a transaction, it doesn't really make sense to just have an "equivalent value" on its own, so I added an
as_of_height
to allow indicating when the prices were relevant.