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

[rpc] Parallelise estimate_predicates endpoint #1293

Merged
merged 3 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Description of the upcoming release here.

### Changed

- Something changed here 1
- Something changed here 2
- [#1293](https://github.com/FuelLabs/fuel-core/issues/1293): Parallelized the `estimate_predicates` endpoint to utilize all available threads.

#### Breaking
- [#1262](https://github.com/FuelLabs/fuel-core/pull/1262): The `ConsensusParameters` aggregates all configuration data related to the consensus. It contains many fields that are segregated by the usage. The API of some functions was affected to use lesser types instead the whole `ConsensusParameters`. It is a huge breaking change requiring repetitively monotonically updating all places that use the `ConsensusParameters`. But during updating, consider that maybe you can use lesser types. Usage of them may simplify signatures of methods and make them more user-friendly and transparent.
Expand Down
11 changes: 8 additions & 3 deletions crates/fuel-core/src/schema/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ use fuel_core_storage::{
Error as StorageError,
Result as StorageResult,
};
use fuel_core_txpool::service::TxStatusMessage;
use fuel_core_txpool::{
service::TxStatusMessage,
txpool::TokioWithRayon,
};
use fuel_core_types::{
fuel_tx::{
Cacheable,
Expand Down Expand Up @@ -205,11 +208,13 @@ impl TxQuery {
tx: HexString,
) -> async_graphql::Result<Transaction> {
let mut tx = FuelTx::from_bytes(&tx.0)?;

let config = ctx.data_unchecked::<Config>();

tx.estimate_predicates(&CheckPredicateParams::from(
tx.estimate_predicates_async::<TokioWithRayon>(&CheckPredicateParams::from(
&config.consensus_parameters,
))?;
))
.await?;

Ok(Transaction::from_tx(
tx.id(&config.consensus_parameters.chain_id),
Expand Down
Loading