Skip to content
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

Open
wants to merge 250 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
250 commits
Select commit Hold shift + click to select a range
4a70f52
Add basic balances functionality
rafal-ch Oct 14, 2024
7d472fb
Add support for querying all balances for user
rafal-ch Oct 14, 2024
4296fd4
Adding `balances_indexation_progress` to DB metadata
rafal-ch Oct 14, 2024
77d0f16
Attempt at migrating the metadata to store the indexation progress
rafal-ch Oct 15, 2024
525e6f9
Merge remote-tracking branch 'upstream/master' into 1965_balances
rafal-ch Oct 16, 2024
8eba5d7
Hack the `replace_forced()` and `commit_changes_forced` in
rafal-ch Oct 16, 2024
c083f45
Introduce `ForcedCommitDatabase`
rafal-ch Oct 16, 2024
6b76c37
Update dependencies
rafal-ch Oct 16, 2024
f246cd0
DB metadata can track multiple indexation progresses
rafal-ch Oct 17, 2024
7472db7
into_genesis() attemt
rafal-ch Oct 17, 2024
b4d2e0f
Add some TODOs with ideas for the future
rafal-ch Oct 17, 2024
d38fdb3
Use `double_key!` macro to define the balances key
rafal-ch Oct 17, 2024
292acab
Add `basic_storage_tests!` for Balances
rafal-ch Oct 17, 2024
651bcc8
Merge remote-tracking branch 'upstream/master' into 1965_balances
rafal-ch Oct 17, 2024
8342c8f
Balances DB stores separate information for coins and messages
rafal-ch Oct 17, 2024
9a9f120
Fix the recursive call
rafal-ch Oct 18, 2024
6aa9325
Init indexation progresses with 0 upon metadata migration
rafal-ch Oct 18, 2024
b153db4
Remove debug prints
rafal-ch Oct 18, 2024
512a8a3
Store incoming balance in the new Balances DB
rafal-ch Oct 18, 2024
adf9e2a
Read balance from the new Balances database
rafal-ch Oct 18, 2024
344ca90
Update coin balance, don't overwrite
rafal-ch Oct 18, 2024
f73dbed
Use more detailed `IndexationStatus`, not just block height
rafal-ch Oct 21, 2024
80da09b
Add processing of `MessageImported`
rafal-ch Oct 21, 2024
ad5216d
Simplify processing of coins and message amounts
rafal-ch Oct 21, 2024
c784e44
Extract `increase_balance()`
rafal-ch Oct 21, 2024
5762665
Store coin and message balances separately
rafal-ch Oct 21, 2024
5595985
Clean up column naming
rafal-ch Oct 21, 2024
38dd8d6
Add test for coin balances
rafal-ch Oct 21, 2024
530bcaf
Support both coins and messages in the new balance system
rafal-ch Oct 21, 2024
5604f30
Merge remote-tracking branch 'upstream/master' into 1965_balances
rafal-ch Oct 22, 2024
562c087
update comment
rafal-ch Oct 22, 2024
82f7a16
Remove the database migration hack
rafal-ch Oct 22, 2024
7d0b014
Remove code related to handling base asset id
rafal-ch Oct 22, 2024
1fe3bba
Clean-up of the balance update code
rafal-ch Oct 22, 2024
fe60c98
Remove unused tests
rafal-ch Oct 22, 2024
adef78e
Handle overflow in `balance` query
rafal-ch Oct 22, 2024
9409d52
Clippy and formatting
rafal-ch Oct 22, 2024
13b6db9
Update db tests after reverting changes to metadata
rafal-ch Oct 22, 2024
55f9025
Add comment
rafal-ch Oct 22, 2024
d215844
Add support for `balances()` (plural) query
rafal-ch Oct 22, 2024
53131a3
Handle error properly instead of using `expect()`
rafal-ch Oct 22, 2024
1e24aaa
Add support for `direction` in balances query
rafal-ch Oct 22, 2024
eeea199
Remove safety check from the `balance` query
rafal-ch Oct 22, 2024
e77f33b
Fix balance logging
rafal-ch Oct 22, 2024
c9b7e29
Include message balance in `balances()` query
rafal-ch Oct 22, 2024
076cb42
Revert "Fix balance logging"
rafal-ch Oct 22, 2024
f5e2a6d
Revert a couple of unintentional changes
rafal-ch Oct 22, 2024
d1c6fcc
Rename database `Balances` to `CoinBalances`
rafal-ch Oct 22, 2024
8cc0280
Update comments
rafal-ch Oct 22, 2024
ca32195
Merge remote-tracking branch 'upstream/master' into 1965_balances_cache
rafal-ch Oct 22, 2024
f082291
Fix formatting
rafal-ch Oct 23, 2024
f598395
Merge remote-tracking branch 'upstream/master' into 1965_balances_cache
rafal-ch Oct 24, 2024
8ce4550
Add comment about potential discount on the balances query cost
rafal-ch Oct 24, 2024
8262c0c
Fix comment
rafal-ch Oct 24, 2024
4e84ac3
Update DB metadata with balances info
rafal-ch Oct 28, 2024
9577f30
Support both 'new' and 'old' way of querying balances
rafal-ch Oct 28, 2024
a16ef36
Support both 'new' and 'old' way of querying balance
rafal-ch Oct 28, 2024
80fb852
Do not touch the onchain DB metadata
rafal-ch Oct 28, 2024
c94a484
Write balances cache information do off-chain db on genesis
rafal-ch Oct 28, 2024
ddf0571
Use balances cache in GraphQL api
rafal-ch Oct 28, 2024
9078b05
Clean-up error handling
rafal-ch Oct 28, 2024
3b6b8c6
Satisfy clippy and fmt
rafal-ch Oct 28, 2024
5162936
generic update function
rafal-ch Oct 28, 2024
f736ecb
Extract processing of balance updates
rafal-ch Oct 28, 2024
d880e0a
Merge remote-tracking branch 'upstream/master' into 1965_balances_cache
rafal-ch Oct 28, 2024
6927f03
Use instead of for balances key
rafal-ch Oct 29, 2024
66e26d9
Revert the supporsed-to-be temporary change that disabled warnings
rafal-ch Oct 29, 2024
a87698a
Remove unused lifetime from `HasIndexation` trait
rafal-ch Oct 29, 2024
ddadd80
Simplify trait bounds for `HasIndexation` trait
rafal-ch Oct 29, 2024
ccadf41
Further simplify trait bounds for `HasIndexation` trait
rafal-ch Oct 29, 2024
91e8abc
Split and rename the `HasIndexation` trait
rafal-ch Oct 30, 2024
ab7808f
WIP - bail when unable to update balance due to overflow
rafal-ch Oct 31, 2024
90fa259
Prefer `core::fmt::Display` over `std::fmt::Display`
rafal-ch Oct 31, 2024
0b39319
Use named const instead of plain `true` in genesis importer for clarity
rafal-ch Oct 31, 2024
4d6e17a
Remove reduntant write to `DatabaseMetadata::V2`
rafal-ch Oct 31, 2024
8f3e817
Ensure all indexations are enabled at genesis
rafal-ch Oct 31, 2024
895d9da
Fix `produce_block__raises_gas_price` after balance overflow check wa…
rafal-ch Oct 31, 2024
de11071
Fix more integration tests to work with the balance overflow checks
rafal-ch Nov 1, 2024
71226d4
Fix typo
rafal-ch Nov 1, 2024
474e207
Fix BLOB integration tests to work with the balance overflow checks
rafal-ch Nov 1, 2024
ca6057d
Revert "Fix BLOB integration tests to work with the balance overflow …
rafal-ch Nov 2, 2024
4d43038
Revert "Fix more integration tests to work with the balance overflow …
rafal-ch Nov 2, 2024
e3d898d
Revert "Fix `produce_block__raises_gas_price` after balance overflow …
rafal-ch Nov 2, 2024
9848f64
Do not bail when balances cannot be updated, log the error instead
rafal-ch Nov 2, 2024
dae0af5
Total balance of assets is now represented as `u128`
rafal-ch Nov 6, 2024
facbd2e
Infer types in `process_balances_update()`
rafal-ch Nov 6, 2024
9b8e491
Simplify trait bounds in `update_balances()`
rafal-ch Nov 6, 2024
9ea9c02
Merge remote-tracking branch 'upstream/master' into 1965_balances_cache
rafal-ch Nov 6, 2024
54087fc
Fix formatting
rafal-ch Nov 6, 2024
20081fa
Satisfy Clippy
rafal-ch Nov 6, 2024
8b9f4e8
Update tests
rafal-ch Nov 6, 2024
e819e23
Asset balance queries now return U128 instead of U64.
rafal-ch Nov 7, 2024
de16099
Log errors when balance cannot be calculated in the legacy calculatio…
rafal-ch Nov 8, 2024
4f307e3
Mention an balance overflow follow-up issue in the comments
rafal-ch Nov 11, 2024
66d5948
Remove the `TODO` comment
rafal-ch Nov 11, 2024
7023227
Merge remote-tracking branch 'upstream/master' into 1965_balances_cache
rafal-ch Nov 15, 2024
9a07cd2
Prevent the metadata from being overwritten with incorrect version
rafal-ch Nov 15, 2024
bcf543a
Extend `IndexationKind` enum with `CoinsToSpend`
rafal-ch Nov 15, 2024
d887e67
Introduce `coins_to_spend_indexation_enabled` and clean-up naming
rafal-ch Nov 15, 2024
75815f5
Wire coins to spend indexation into the offchain worker
rafal-ch Nov 15, 2024
01dd049
Upon creation, register coins in the index
rafal-ch Nov 15, 2024
b500f35
Access coins to spend index when querying GraphQL
rafal-ch Nov 18, 2024
41e87e1
Retrieve coins based on the 'coins to spend' index
rafal-ch Nov 18, 2024
2949172
Support many assets in a single request
rafal-ch Nov 18, 2024
af4a726
Merge remote-tracking branch 'upstream/master' into 1965_balances_cache
rafal-ch Nov 19, 2024
35663ae
Move metadata tests to a dedicated module
rafal-ch Nov 19, 2024
179cf69
Keep the previous indexation availability when updating metadata
rafal-ch Nov 19, 2024
1d40056
Add tests for balance with (non)retryable messages
rafal-ch Nov 19, 2024
bf83346
Refactor the `balances()` off_chain function
rafal-ch Nov 19, 2024
4805aa2
Make balance updates less generic but more readable
rafal-ch Nov 19, 2024
be9fdda
Introduce `IndexationError`
rafal-ch Nov 19, 2024
623bb9f
Extract indexation to a separate module
rafal-ch Nov 19, 2024
18f37cc
Fix issue in `decrease_message_balance()`
rafal-ch Nov 19, 2024
b2fc999
Add UTs for the indexation module
rafal-ch Nov 20, 2024
b721103
Simplify implementation of balances indexation
rafal-ch Nov 20, 2024
bd16f6c
Satisfy Clippy
rafal-ch Nov 20, 2024
53631e7
Extract and reuse `BALANCES_INDEXATION_ENABLED` flag
rafal-ch Nov 21, 2024
a8b950b
Use saturating_add when calculatin balances (hard to overflow u128 wi…
rafal-ch Nov 21, 2024
2e6ade7
Use saturating_add when calculating balances (hard to overflow u128 w…
rafal-ch Nov 21, 2024
7a95506
Do not import `tracing` and remove some log messages
rafal-ch Nov 21, 2024
33f75af
Move the indexation initialization to combined databases
rafal-ch Nov 21, 2024
fc6c1fc
Merge remote-tracking branch 'upstream/1965_balances_cache' into rafa…
rafal-ch Nov 21, 2024
6b8f18e
Return balances via iterator, not collection
rafal-ch Nov 22, 2024
2408e56
Remove dbg print
rafal-ch Nov 22, 2024
67d17d5
Make the `balances()` implementation more readable
rafal-ch Nov 22, 2024
48a363c
Merge remote-tracking branch 'upstream/1965_balances_cache' into rafa…
rafal-ch Nov 22, 2024
d2c3abe
Turn indexation into a proper module
rafal-ch Nov 22, 2024
f73140f
Introduce `coins_to_spend` indexation module
rafal-ch Nov 22, 2024
bb2537e
Update comment to mention follow-up issue
rafal-ch Nov 22, 2024
02dcc73
Merge remote-tracking branch 'upstream/1965_balances_cache' into rafa…
rafal-ch Nov 22, 2024
53bbc7b
Revert the stray change in `balance.rs`
rafal-ch Nov 22, 2024
342b2ff
Merge remote-tracking branch 'upstream/1965_balances_cache' into rafa…
rafal-ch Nov 22, 2024
cca1891
Add basic storage tests for `CoinBalances` and `MessageBalances`
rafal-ch Nov 22, 2024
f1fc124
Merge remote-tracking branch 'upstream/1965_balances_cache' into rafa…
rafal-ch Nov 22, 2024
f189494
Update index upon the `CoinCreated` event
rafal-ch Nov 22, 2024
0006312
Add test for coins to spend index key
rafal-ch Nov 22, 2024
18822c3
Register spent coins in the index
rafal-ch Nov 24, 2024
3c4192a
Coins to spend index key now supports both coins and messages
rafal-ch Nov 24, 2024
dae66a8
Add/remove messages from coins to spend index
rafal-ch Nov 24, 2024
d543f3e
Move indexation error to dedicated file
rafal-ch Nov 24, 2024
9d4fb43
Store indexed coin type in the index
rafal-ch Nov 24, 2024
2c1c0ea
Add support for (non)retryable flag in coins to spend indexation key
rafal-ch Nov 25, 2024
07caa6d
Add `owner()` and `asset_id()` getters to the `CoinsToSpendIndexKey`
rafal-ch Nov 25, 2024
07d5ce1
Messages are indexed with the correct base asset id
rafal-ch Nov 25, 2024
8eb3f27
Assert on asset id in the coins to spend index key
rafal-ch Nov 25, 2024
dd698d8
Update tests to use base asset id
rafal-ch Nov 25, 2024
c5b6288
Add tests for every part of the `CoinsToSpendIndexKey`
rafal-ch Nov 25, 2024
7f92aeb
Remove unused function
rafal-ch Nov 25, 2024
33a53da
Add initial unit tests for coins to spend indexation
rafal-ch Nov 26, 2024
a38ab07
Add more explanatory comment
rafal-ch Nov 26, 2024
9db30db
Add more UTs for coins to spend index
rafal-ch Nov 26, 2024
255338e
Add UTs for failed cases in coins to spend indexation
rafal-ch Nov 26, 2024
4be30fa
Satisfy Clippy
rafal-ch Nov 26, 2024
b411ecd
Add info about missing clone()
rafal-ch Nov 26, 2024
8720576
Fix flaky `coins_with_retryable_and_non_retryable_messages_are_not_mi…
rafal-ch Nov 26, 2024
c95ea5b
Add `can_differentiate_between_coin_with_base_asset_id_and_message()`…
rafal-ch Nov 26, 2024
fc86a2b
Revert "Add `can_differentiate_between_coin_with_base_asset_id_and_me…
rafal-ch Nov 26, 2024
c0cb68d
Merge remote-tracking branch 'upstream/master' into 1965_balances_cache
rafal-ch Nov 26, 2024
c1f88ce
Merge remote-tracking branch 'upstream/1965_balances_cache' into rafa…
rafal-ch Nov 26, 2024
370a196
Merge remote-tracking branch 'upstream/master' into 1965_balances_cache
rafal-ch Nov 28, 2024
d65fd6e
Merge remote-tracking branch 'upstream/1965_balances_cache' into rafa…
rafal-ch Nov 28, 2024
61b22ba
Wire up the coins to spend query
rafal-ch Nov 28, 2024
96d0987
Satisfy coins to spend request from the index
rafal-ch Nov 28, 2024
f179188
Use correct prefix to query for coin
rafal-ch Nov 28, 2024
0d545d9
Return the actual coins from on chain DB to the user
rafal-ch Nov 28, 2024
5d32aa0
Support for excluded ids in big coins
rafal-ch Nov 28, 2024
682ac92
Support for excluded ids in dust coins
rafal-ch Nov 28, 2024
ece6e7e
Introduce the concept of named foreign key to more efficiently compar…
rafal-ch Nov 28, 2024
05e5a76
Use variable key size for coins and messages to save some space in DB
rafal-ch Nov 29, 2024
cfcc13b
Simplify creation of `CoinsToSpendIndexKey`
rafal-ch Nov 29, 2024
7ba4cb5
Update integration tests for coins to spend
rafal-ch Nov 29, 2024
add20df
Satisfy Clippy
rafal-ch Nov 29, 2024
577b71f
Satisfy Clippy
rafal-ch Nov 29, 2024
be9b742
Small suggestions and simplification to the balances indexation PR (#…
xgreenx Nov 29, 2024
8af7dea
Merge remote-tracking branch 'upstream/1965_balances_cache' into rafa…
rafal-ch Nov 29, 2024
7614bf7
Fixes after the merge
rafal-ch Nov 29, 2024
ace08de
Merge remote-tracking branch 'upstream/rafal_2391_coins_to_spend_cach…
rafal-ch Nov 29, 2024
56b5f29
Merge remote-tracking branch 'upstream/master' into rafal_2391_coins_…
rafal-ch Dec 2, 2024
69010c4
Merge remote-tracking branch 'upstream/2391_optimize_coins_to_spend' …
rafal-ch Dec 2, 2024
2b76a88
Remove the `InsufficientCoins` error variant and update tests
rafal-ch Dec 2, 2024
ebe0294
coins_to_spend() directly returns `CoinId`
rafal-ch Dec 2, 2024
bb4985e
Remove `unwrap()`
rafal-ch Dec 2, 2024
4b1f788
Remove unwraps
rafal-ch Dec 2, 2024
b2e5bf7
Remove more temporary unwraps in implementation
rafal-ch Dec 2, 2024
274441a
Code cleanup
rafal-ch Dec 2, 2024
f490088
Updates to selection algo
rafal-ch Dec 2, 2024
4a8a11d
Bail on first error in coins to spend selection algorithm
rafal-ch Dec 2, 2024
1e4311b
Unify `big_coins` and `dust_coins`
rafal-ch Dec 2, 2024
0eef0b5
Merge branch 'master' into rafal_2391_coins_to_spend_cache
xgreenx Dec 3, 2024
5a34b33
Merge remote-tracking branch 'upstream/rafal_2391_coins_to_spend_cach…
rafal-ch Dec 3, 2024
6cbcc29
More unit tests for the coins to spend selection algorithm
rafal-ch Dec 3, 2024
ac6dd40
Cleanup
rafal-ch Dec 3, 2024
da344b4
Update comment for default query costs
rafal-ch Dec 3, 2024
08dcc65
Add an update that got lost when moving the files around
rafal-ch Dec 3, 2024
a915976
Get base asset from already available `chain_config`
rafal-ch Dec 3, 2024
d720d1d
Use better way of type sizing
rafal-ch Dec 3, 2024
4c55857
Simplify `IndexationError` comparison
rafal-ch Dec 3, 2024
dd03f92
Reduce number of parameters of `worker_service::new_service()`
rafal-ch Dec 3, 2024
7ad10f7
Update changelog
rafal-ch Dec 3, 2024
8df7d6b
'retryable flag' part is moved to the beginning of the key
rafal-ch Dec 3, 2024
5e6e6d3
Use `IndexedCoinType` enum directly in the database
rafal-ch Dec 4, 2024
202dcdf
Use consts in `CoinsToSpendIndexKey` implementation
rafal-ch Dec 4, 2024
3ee2a1a
More clean implementation of `CoinOrMessageIdBytes::from_nonce()`
rafal-ch Dec 4, 2024
8319abd
Split coins to spend function into indexed and non-indexed one
rafal-ch Dec 4, 2024
77f8caf
Move the coins to spend logic out of off-chain DB adapter
rafal-ch Dec 4, 2024
a5c80e1
Limit the number of allowed `excludedIds` in the `coinsToSpend` Graph…
rafal-ch Dec 4, 2024
c1fe4fd
Change the ordering of fields
rafal-ch Dec 4, 2024
6c37209
Add 'G/W/T' to new tests
rafal-ch Dec 4, 2024
9786f3e
Update changelog
rafal-ch Dec 4, 2024
2cfafc2
Update changelog (mention Balances cache)
rafal-ch Dec 4, 2024
604675c
Do not box all iterators
rafal-ch Dec 4, 2024
fd95f9f
`coins_to_spend_with_cache()` is now and uses `yield_each()`
rafal-ch Dec 4, 2024
4ca5e45
`into_coin_id()` is now `async`
rafal-ch Dec 4, 2024
b159e1c
Merge remote-tracking branch 'upstream/master' into rafal_2391_coins_…
rafal-ch Dec 6, 2024
88471ea
Coins to spend selects twice as much value of coins to reduce chances…
rafal-ch Dec 6, 2024
713d4a2
Clean up UTs for coins to spend
rafal-ch Dec 6, 2024
e40a974
Coins to spend algorithm returns `CoinsQueryError`, not `StorageError`
rafal-ch Dec 6, 2024
7459c3c
Move code pieces to correct places
rafal-ch Dec 6, 2024
3cf743a
Use `ExcludedKeysAsBytes` instead of `Vec` in `ExcludedKeysAsBytes`
rafal-ch Dec 9, 2024
2e0b7fd
Remove `CoinOrMessageIdBytes` type and avoid some allocations
rafal-ch Dec 9, 2024
ce637a8
Simplify asserts in some coin tests
rafal-ch Dec 9, 2024
7b54abc
Remove superfluous space
rafal-ch Dec 9, 2024
ad83e78
Make implementation of `select_coins_until_respects_excluded_ids()` m…
rafal-ch Dec 10, 2024
4c6cf85
Merge branch 'master' into rafal_2391_coins_to_spend_cache_part_2
xgreenx Dec 12, 2024
c001fd3
Make the `skip_big_coins_up_to_amount()` implementation more explicit…
rafal-ch Dec 12, 2024
a30c1da
Use more clear names in `skip_big_coins_up_to_amount()`
rafal-ch Dec 12, 2024
0175e41
Prefer `unwrap_or(false)` instead of `.unwrap_or_default()` for `bool…
rafal-ch Dec 12, 2024
87245d4
Add `CoinsQueryError::[FUnexpectedInternalState` error
rafal-ch Dec 12, 2024
2c40069
Clean up error handling in coins to spend
rafal-ch Dec 12, 2024
bef1548
Improve error handling in coins to spend query
rafal-ch Dec 12, 2024
ba883d2
Add test cases for errors in `indexed_coins_to_spend`
rafal-ch Dec 12, 2024
0602da1
Remove unnecessary variable
rafal-ch Dec 12, 2024
9d52683
Swap functions to reduce diff size
rafal-ch Dec 13, 2024
385aea7
`into_coin_id()` does not have to be async
rafal-ch Dec 13, 2024
1645c14
`setup()` function in tests now accepts consensus parameters
rafal-ch Dec 13, 2024
f1420e3
Simplify vec initialization in `into_coin_id()`
rafal-ch Dec 13, 2024
db1e97f
Update comment
rafal-ch Dec 13, 2024
bdc8ce2
Move the byte conversion from `into_coin_id()` to the key itself
rafal-ch Dec 13, 2024
8e42b87
Move the byte conversion from `is_excluded()` to the key itself
rafal-ch Dec 13, 2024
e841d66
Merge remote-tracking branch 'upstream/master' into rafal_2391_coins_…
rafal-ch Dec 13, 2024
2533060
Make fields of `CoinsToSpendIndexIter` pub
rafal-ch Dec 13, 2024
6740e7d
Return proper error from `select_coins_to_spend()`
rafal-ch Dec 13, 2024
03a0662
Mention follow-up issue
rafal-ch Dec 13, 2024
1049fea
Mention follow-up issue
rafal-ch Dec 13, 2024
9c87c8d
Merge remote-tracking branch 'upstream/master' into rafal_2391_coins_…
rafal-ch Dec 16, 2024
65f701d
Mention follow-up issue in the comment
rafal-ch Dec 17, 2024
5eb9bb0
Replace `as u128` with `u128::from()` where applicable
rafal-ch Dec 17, 2024
792dc33
Getters on `CoinsToSpendIndexKey` will no longer panic
rafal-ch Dec 18, 2024
4cc75bf
Remove comment which is no longer relevant
rafal-ch Dec 18, 2024
f776cb4
Merge remote-tracking branch 'upstream/master' into rafal_2391_coins_…
rafal-ch Dec 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [2429](https://github.com/FuelLabs/fuel-core/pull/2429): Introduce custom enum for representing result of running service tasks
- [2377](https://github.com/FuelLabs/fuel-core/pull/2377): Add more errors that can be returned as responses when using protocol `/fuel/req_res/0.0.2`. The errors supported are `ProtocolV1EmptyResponse` (status code `0`) for converting empty responses sent via protocol `/fuel/req_res/0.0.1`, `RequestedRangeTooLarge`(status code `1`) if the client requests a range of objects such as sealed block headers or transactions too large, `Timeout` (status code `2`) if the remote peer takes too long to fulfill a request, or `SyncProcessorOutOfCapacity` if the remote peer is fulfilling too many requests concurrently.
- [2233](https://github.com/FuelLabs/fuel-core/pull/2233): Introduce a new column `modification_history_v2` for storing the modification history in the historical rocksDB. Keys in this column are stored in big endian order. Changed the behaviour of the historical rocksDB to write changes for new block heights to the new column, and to perform lookup of values from the `modification_history_v2` table first, and then from the `modification_history` table, performing a migration upon access if necessary.
- [2383](https://github.com/FuelLabs/fuel-core/pull/2383): The `balance` and `balances` GraphQL query handlers now use index to provide the response in a more performant way. As the index is not created retroactively, the client must be initialized with an empty database and synced from the genesis block to utilize it. Otherwise, the legacy way of retrieving data will be used.
- [2463](https://github.com/FuelLabs/fuel-core/pull/2463): The `coinsToSpend` GraphQL query handler now uses index to provide the response in a more performant way. As the index is not created retroactively, the client must be initialized with an empty database and synced from the genesis block to utilize it. Otherwise, the legacy way of retrieving data will be used.

#### Breaking
- [2438](https://github.com/FuelLabs/fuel-core/pull/2438): The `fuel-core-client` can only work with new version of the `fuel-core`. The `0.40` and all older versions are not supported.
Expand All @@ -57,6 +59,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [2154](https://github.com/FuelLabs/fuel-core/pull/2154): Transaction graphql endpoints use `TransactionType` instead of `fuel_tx::Transaction`.
- [2446](https://github.com/FuelLabs/fuel-core/pull/2446): Use graphiql instead of graphql-playground due to known vulnerability and stale development.
- [2379](https://github.com/FuelLabs/fuel-core/issues/2379): Change `kv_store::Value` to be `Arc<[u8]>` instead of `Arc<Vec<u8>>`.
- [2463](https://github.com/FuelLabs/fuel-core/pull/2463): 'CoinsQueryError::MaxCoinsReached` variant has been removed. The `InsufficientCoins` variant has been renamed to `InsufficientCoinsForTheMax` and it now contains the additional `max` field
rafal-ch marked this conversation as resolved.
Show resolved Hide resolved
- [2463](https://github.com/FuelLabs/fuel-core/pull/2463): The number of excluded ids in the `coinsToSpend` GraphQL query is now limited to the maximum number of inputs allowed in transaction.
- [2463](https://github.com/FuelLabs/fuel-core/pull/2463): The `coinsToSpend` GraphQL query may now return different coins, depending whether the indexation is enabled or not. However, regardless of the differences, the returned coins will accurately reflect the current state of the database within the context of the query.

## [Version 0.40.0]

Expand Down
9 changes: 9 additions & 0 deletions crates/chain-config/src/config/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ impl ChainConfig {
..Default::default()
}
}

#[cfg(feature = "test-helpers")]
pub fn local_testnet_with_consensus_parameters(cp: &ConsensusParameters) -> Self {
Self {
chain_name: LOCAL_TESTNET.to_string(),
consensus_parameters: cp.clone(),
..Default::default()
}
}
}

impl GenesisCommitment for ChainConfig {
Expand Down
2 changes: 1 addition & 1 deletion crates/client/src/client/schema/coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl From<(Vec<UtxoId>, Vec<Nonce>)> for ExcludeInput {
pub struct SpendQueryElementInput {
/// asset ID of the coins
pub asset_id: AssetId,
/// address of the owner
/// the amount to cover with this asset
pub amount: U64,
/// the maximum number of coins per asset from the owner to return.
pub max: Option<U32>,
Expand Down
2 changes: 1 addition & 1 deletion crates/client/src/client/types/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl From<schema::balance::Balance> for Balance {
owner: value.owner.into(),
amount: {
let amount: u64 = value.amount.into();
amount as u128
u128::from(amount)
},
asset_id: value.asset_id.into(),
}
Expand Down
Loading
Loading