-
Notifications
You must be signed in to change notification settings - Fork 7
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
Improve vault client Stellar account fetching by using a locally-stored paging token #341
Comments
@ebma does this need to be completed before the Pendulum launch of Spacewalk? |
No, this is low priority and just a nice-to-have feature. It is not relevant for any milestone (and probably never will be) which is why I didn't add it to any. |
Hey team! Please add your planning poker estimate with Zenhub @b-yap @ebma @TorstenStueber |
@ebma just to understand what accounts a vault client needs to watch: I assume it is only the vault account and the accounts that intend to do an issue? If the latter: is there not a way to query all transactions that affect an account (the vault account) instead of only the accounts where a particular account is the source account? Either way: I think that the solution works nicely. However, when manually storing data on a hard drive instead of in a database, we need to be aware of all kind of race conditions: in your example it could happen that the client wants to store the files One could for example change your protocol so that the client only stores file |
The vault only needs to watch its own Stellar account. It needs to see all the payment operations directed at it and can do so by fetching its transactions. In theory, it would be enough to only query all transactions that have the public key of the vault's Stellar account as the destination but I'm not sure if we can do that.
Nice catch, we should probably change it as you proposed and make it more sequential. |
We need to check whether the "retrieve operations by account" or "retrieve transactions by account" endpoints retrieve only transactions/operations where the specified account is the source account or also the affected account. Unfortunately the Stellar docs don't specify this. The experiments I made indicate that this is the case. I asked on discord for clarification. |
Moving it to icebox |
Problem statement
A Stellar account could potentially have thousands of transactions and we don't want to start fetching from the first transaction every time the vault client (re-)starts. But:
We cannot just save the paging token of the last transaction we fetched. Because, if the vault client suddenly crashes after storing the paging token of the last transaction but the last transaction (and the preceding ones) was/were not yet handled, (ie. they were not yet used to fulfill issue requests) the next time the vault goes online it would ignore them because it only fetches from the cached paging token.
Possible Solution
We could implement the following logic for storing a safe paging token, with safe meaning that we can ignore all the transactions that happened before the safe paging token (excluding that transaction itself):
With this approach, we make sure that we don't miss the handling of any important transactions but reduce the load for the initial account fetch of our vault client.
Illustrating this with an example:
5
,21
and50
are important for issue/redeem requests.5
,21
and50
in the 'paging_token' directory with the file content being the xdr encoded data of each transaction.50
as the cursor.The text was updated successfully, but these errors were encountered: