Skip to content

Commit

Permalink
Support blobs in predicates (#2299)
Browse files Browse the repository at this point in the history
## Linked Issues/PRs
FuelLabs/fuel-vm#848
FuelLabs/fuel-vm#849

## Description
<!-- List of detailed changes -->

## Checklist
- [x] Breaking changes are clearly marked as such in the PR description
and changelog
- [x] 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
- [x] I have reviewed the code myself

---------

Co-authored-by: AurelienFT <aurelien.foucault@epitech.eu>
Co-authored-by: green <xgreenx9999@gmail.com>
Co-authored-by: Ahmed Sagdati <37515857+segfault-magnet@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 5, 2024
1 parent f5adbcf commit 773226c
Show file tree
Hide file tree
Showing 52 changed files with 704 additions and 178 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [2162](https://github.com/FuelLabs/fuel-core/pull/2162): Pool structure with dependencies, etc.. for the next transaction pool module. Also adds insertion/verification process in PoolV2 and tests refactoring
- [2265](https://github.com/FuelLabs/fuel-core/pull/2265): Integrate Block Committer API for DA Block Costs.
- [2280](https://github.com/FuelLabs/fuel-core/pull/2280): Allow comma separated relayer addresses in cli
- [2299](https://github.com/FuelLabs/fuel-core/pull/2299): Support blobs in the predicates.
- [2300](https://github.com/FuelLabs/fuel-core/pull/2300): Added new function to `fuel-core-client` for checking whether a blob exists.

### Changed

#### Breaking
- [2299](https://github.com/FuelLabs/fuel-core/pull/2299): Anyone who wants to participate in the transaction broadcasting via p2p must upgrade to support new predicates on the TxPool level.
- [2299](https://github.com/FuelLabs/fuel-core/pull/2299): Upgraded `fuel-vm` to `0.58.0`. More information in the [release](https://github.com/FuelLabs/fuel-vm/releases/tag/v0.58.0).
- [2276](https://github.com/FuelLabs/fuel-core/pull/2276): Changed how complexity for blocks is calculated. The default complexity now is 80_000. All queries that somehow touch the block header now are more expensive.
- [2290](https://github.com/FuelLabs/fuel-core/pull/2290): Added a new GraphQL limit on number of `directives`. The default value is `10`.
- [2206](https://github.com/FuelLabs/fuel-core/pull/2206): Use timestamp of last block when dry running transactions.
Expand Down
86 changes: 38 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fuel-core-xtask = { version = "0.0.0", path = "./xtask" }
fuel-gas-price-algorithm = { version = "0.36.0", path = "crates/fuel-gas-price-algorithm" }

# Fuel dependencies
fuel-vm-private = { version = "0.57.0", package = "fuel-vm", default-features = false }
fuel-vm-private = { version = "0.58.0", package = "fuel-vm", default-features = false }

# Common dependencies
anyhow = "1.0"
Expand All @@ -116,7 +116,7 @@ postcard = "1.0"
tracing-attributes = "0.1"
tracing-subscriber = "0.3"
serde = "1.0"
serde_json = { version = "1.0", default-features = false }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
serde_with = { version = "3.4", default-features = false }
strum = { version = "0.25" }
strum_macros = "0.25"
Expand Down
2 changes: 2 additions & 0 deletions benches/benches/block_target_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ use fuel_core_types::{
checked_transaction::EstimatePredicates,
consts::WORD_SIZE,
interpreter::MemoryInstance,
predicate::EmptyStorage,
},
services::executor::TransactionExecutionResult,
};
Expand Down Expand Up @@ -418,6 +419,7 @@ fn run_with_service_with_extra_inputs(
tx.estimate_predicates(
&chain_config.consensus_parameters.clone().into(),
MemoryInstance::new(),
&EmptyStorage,
)
.unwrap();
async move {
Expand Down
33 changes: 25 additions & 8 deletions benches/benches/transaction_throughput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use fuel_core_types::{
EstimatePredicates,
},
interpreter::MemoryInstance,
predicate::EmptyStorage,
},
};
use rand::{
Expand Down Expand Up @@ -194,8 +195,12 @@ fn signed_transfers(c: &mut Criterion) {
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
.finalize();
tx.estimate_predicates(&checked_parameters(), MemoryInstance::new())
.expect("Predicate check failed");
tx.estimate_predicates(
&checked_parameters(),
MemoryInstance::new(),
&EmptyStorage,
)
.expect("Predicate check failed");
tx
};
bench_txs("signed transfers", c, generator);
Expand All @@ -220,8 +225,12 @@ fn predicate_transfers(c: &mut Criterion) {
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
.finalize();
tx.estimate_predicates(&checked_parameters(), MemoryInstance::new())
.expect("Predicate check failed");
tx.estimate_predicates(
&checked_parameters(),
MemoryInstance::new(),
&EmptyStorage,
)
.expect("Predicate check failed");
tx
};
bench_txs("predicate transfers", c, generator);
Expand Down Expand Up @@ -288,8 +297,12 @@ fn predicate_transfers_eck1(c: &mut Criterion) {
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
.finalize();
tx.estimate_predicates(&checked_parameters(), MemoryInstance::new())
.expect("Predicate check failed");
tx.estimate_predicates(
&checked_parameters(),
MemoryInstance::new(),
&EmptyStorage,
)
.expect("Predicate check failed");
tx
};
bench_txs("predicate transfers eck1", c, generator);
Expand Down Expand Up @@ -358,8 +371,12 @@ fn predicate_transfers_ed19(c: &mut Criterion) {
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
.finalize();
tx.estimate_predicates(&checked_parameters(), MemoryInstance::new())
.expect("Predicate check failed");
tx.estimate_predicates(
&checked_parameters(),
MemoryInstance::new(),
&EmptyStorage,
)
.expect("Predicate check failed");
tx
};
bench_txs("predicate transfers ed19", c, generator);
Expand Down
4 changes: 2 additions & 2 deletions benches/src/default_gas_costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ pub fn default_gas_costs() -> GasCostsValues {
ori: 2,
poph: 2,
popl: 2,
pshh: 3073,
pshl: 3016,
pshh: 5,
pshl: 5,
move_op: 2,
ret: 43,
sb: 2,
Expand Down
3 changes: 2 additions & 1 deletion benches/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ impl TryFrom<VmBench> for VmBenchPrepared {
});

// add at least one coin input
tx.add_random_fee_input();
tx.add_fee_input();

let mut tx = tx
.script_gas_limit(gas_limit)
Expand All @@ -504,6 +504,7 @@ impl TryFrom<VmBench> for VmBenchPrepared {
tx.estimate_predicates(
&CheckPredicateParams::from(&params),
MemoryInstance::new(),
db.database_mut(),
)
.unwrap();
let tx = tx.into_checked(height, &params).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions bin/fuel-core/chainspec/local-testnet/chain_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
"ori": 2,
"poph": 2,
"popl": 2,
"pshh": 3073,
"pshl": 3016,
"pshh": 5,
"pshl": 5,
"ret_contract": 43,
"rvrt_contract": 39,
"sb": 2,
Expand Down
6 changes: 6 additions & 0 deletions crates/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,12 @@ impl FuelClient {
Ok(blob)
}

/// Check whether a blob with ID exists
pub async fn blob_exists(&self, id: BlobId) -> io::Result<bool> {
let query = schema::blob::BlobExistsQuery::build(BlobByIdArgs { id: id.into() });
Ok(self.query(query).await?.blob.is_some())
}

/// Retrieve multiple blocks
pub async fn blocks(
&self,
Expand Down
Loading

0 comments on commit 773226c

Please sign in to comment.