-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Better coins comparison in parallel-executor #2996
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
Comments
9 tasks
rymnc
added a commit
that referenced
this issue
May 9, 2025
## Linked Issues/PRs <!-- List of related issues/PRs --> closes #2996 ## Description <!-- List of detailed changes --> This pull request introduces a new `CoinInBatch` struct to encapsulate coin-related data and replaces the previous tuple-based representation of coins in the `parallel-executor` module. ### Introduction of `CoinInBatch` struct: * [`crates/services/parallel-executor/src/coin.rs`](diffhunk://#diff-d9a514e87bb0920ce48dc225aa9e274b40f77a516334df0edfbfcd4ce0b8c856R1-R138): Added the `CoinInBatch` struct, which encapsulates coin data such as `utxo_id`, `owner`, `amount`, `asset_id`, and its variant (`Signed` or `Predicate`). Implemented methods for constructing `CoinInBatch` from `CoinSigned` and `CoinPredicate`, as well as conversions to `CompressedCoin` and `Input`. ### Refactoring to use `CoinInBatch`: * [`crates/services/parallel-executor/src/scheduler.rs`](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L159-R163): Replaced all instances of `(UtxoId, usize)` with `CoinInBatch` in the `WorkSessionExecutionResult` and `WorkSessionSavedData` structs, as well as in the `CoinDependencyChainVerifier`. Updated methods like `register_coins_created` and `verify_coins_used` to work with the new struct. [[1]](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L159-R163) [[2]](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L178-R182) [[3]](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L569-R570) [[4]](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L582-R648) ### Updates to coin dependency verification: * [`crates/services/parallel-executor/src/scheduler.rs`](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L582-R648): Enhanced the `verify_coins_used` method to validate coins using the `CoinInBatch` struct. Added logic to compare `CoinInBatch` instances with database coins and verify their validity. ### Integration of `CoinInBatch` in batch processing: * [`crates/services/parallel-executor/src/scheduler.rs`](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L641-R660): Updated the `get_contracts_and_coins_used` function to construct `CoinInBatch` instances from `CoinSigned` and `CoinPredicate` inputs during batch processing. [[1]](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L641-R660) [[2]](diffhunk://#diff-bda48bcdc8ef69f69b955b2d196981ee95ef75d85c7d7438438d22ad4110ba42L653-R675) ### Module organization: * [`crates/services/parallel-executor/src/lib.rs`](diffhunk://#diff-ae71c4af5cfc6793160ece59523c9f21c5097593c6667898583b09b3443c8c80L1-R2): Added the new `coin` module to the project and made it accessible within the crate. ## Checklist - [ ] Breaking changes are clearly marked as such in the PR description and changelog - [ ] New behavior is reflected in tests - [ ] [The specification](https://github.com/FuelLabs/fuel-specs/) matches the implemented behavior (link update PR if changes are needed) ### Before requesting review - [ ] I have reviewed the code myself - [ ] I have created follow-up issues caused by this PR and linked them here ### After merging, notify other teams [Add or remove entries as needed] - [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/) - [ ] [Sway compiler](https://github.com/FuelLabs/sway/) - [ ] [Platform documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+) (for out-of-organization contributors, the person merging the PR will do this) - [ ] Someone else?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For now the coins are just match by their UTXO ID but we also need to verify that the content of the UTXO created as an output (with field resolved (no change/variable)) match the content of the used input
The text was updated successfully, but these errors were encountered: