-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Use indexation cache to satisfy "coins to spend" queries #2463
base: master
Are you sure you want to change the base?
Conversation
… wrt to mutation
…to_spend_cache_part_2
…to_spend_cache_part_2
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.
Nice stuff so far. I have only done a relatively shallow sweep and will get back again during the week for a deeper look. I have a few nits and suggestions so far, but nothing major.
I'm not a fan of the lack of explicit error handling in crates/fuel-core/src/graphql_api/storage/coins.rs
but other than that I think the code looks generally really well-written.
Closes #2391
This PR includes all changes from the Part 1 PR, making it deprecated.
Description
Changes in this PR:
The new
CoinsToSpend
indexMessages
orCoins
on-chain databasesNonce
UtxoId
IndexedCoinType
enum, so we know which on-chain database to query when returning the actual coinsmax
andexcluded
params)max
) we fill the remaining slots with a random number of "dust" coinsChanges to
CoinsQueryError
typeMaxCoinsReached
variant has been removed because in the new algorithm we never query for more coins than the specifiedmax
, hence, without additional effort, we are not able to tell whether the query could be satisfied if user provided biggermax
InsufficientCoins
has been renamed toInsufficientCoinsForTheMax
and it now contains the additionalmax
fieldOff-chain database metadata
IndexationKind
-CoinsToSpend
Refactoring
indexation.rs
module was split into separate files, each per indexation type + errors + some utils.Other
coinsToSpend
GraphQL query is now limited to the maximum number of inputs allowed in transaction.Before requesting review
Follow-up issues
CoinsToSpendIndexKey
fromVec<u8>
to typed struct, similarly toOwnedTransactionIndexKey
#2498OffChainDatabase::coins_to_spend_index()
function should return error if indexation is not available #2499