Skip to content

Commit 7f56d6e

Browse files
GeorgeBakeAurelienFTxgreenxsegfault-magnet
committed
Support blobs in predicates (#2299)
## 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 <[email protected]> Co-authored-by: green <[email protected]> Co-authored-by: Ahmed Sagdati <[email protected]>
1 parent 368c149 commit 7f56d6e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+704
-178
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1616
- [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
1717
- [2265](https://github.com/FuelLabs/fuel-core/pull/2265): Integrate Block Committer API for DA Block Costs.
1818
- [2280](https://github.com/FuelLabs/fuel-core/pull/2280): Allow comma separated relayer addresses in cli
19+
- [2299](https://github.com/FuelLabs/fuel-core/pull/2299): Support blobs in the predicates.
20+
- [2300](https://github.com/FuelLabs/fuel-core/pull/2300): Added new function to `fuel-core-client` for checking whether a blob exists.
1921

2022
### Changed
2123

2224
#### Breaking
25+
- [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.
26+
- [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).
2327
- [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.
2428
- [2290](https://github.com/FuelLabs/fuel-core/pull/2290): Added a new GraphQL limit on number of `directives`. The default value is `10`.
2529
- [2206](https://github.com/FuelLabs/fuel-core/pull/2206): Use timestamp of last block when dry running transactions.

Cargo.lock

Lines changed: 38 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fuel-core-xtask = { version = "0.0.0", path = "./xtask" }
8989
fuel-gas-price-algorithm = { version = "0.36.0", path = "crates/fuel-gas-price-algorithm" }
9090

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

9494
# Common dependencies
9595
anyhow = "1.0"
@@ -116,7 +116,7 @@ postcard = "1.0"
116116
tracing-attributes = "0.1"
117117
tracing-subscriber = "0.3"
118118
serde = "1.0"
119-
serde_json = { version = "1.0", default-features = false }
119+
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
120120
serde_with = { version = "3.4", default-features = false }
121121
strum = { version = "0.25" }
122122
strum_macros = "0.25"

benches/benches/block_target_gas.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ use fuel_core_types::{
8383
checked_transaction::EstimatePredicates,
8484
consts::WORD_SIZE,
8585
interpreter::MemoryInstance,
86+
predicate::EmptyStorage,
8687
},
8788
services::executor::TransactionExecutionResult,
8889
};
@@ -418,6 +419,7 @@ fn run_with_service_with_extra_inputs(
418419
tx.estimate_predicates(
419420
&chain_config.consensus_parameters.clone().into(),
420421
MemoryInstance::new(),
422+
&EmptyStorage,
421423
)
422424
.unwrap();
423425
async move {

benches/benches/transaction_throughput.rs

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ use fuel_core_types::{
3939
EstimatePredicates,
4040
},
4141
interpreter::MemoryInstance,
42+
predicate::EmptyStorage,
4243
},
4344
};
4445
use rand::{
@@ -194,8 +195,12 @@ fn signed_transfers(c: &mut Criterion) {
194195
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
195196
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
196197
.finalize();
197-
tx.estimate_predicates(&checked_parameters(), MemoryInstance::new())
198-
.expect("Predicate check failed");
198+
tx.estimate_predicates(
199+
&checked_parameters(),
200+
MemoryInstance::new(),
201+
&EmptyStorage,
202+
)
203+
.expect("Predicate check failed");
199204
tx
200205
};
201206
bench_txs("signed transfers", c, generator);
@@ -220,8 +225,12 @@ fn predicate_transfers(c: &mut Criterion) {
220225
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
221226
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
222227
.finalize();
223-
tx.estimate_predicates(&checked_parameters(), MemoryInstance::new())
224-
.expect("Predicate check failed");
228+
tx.estimate_predicates(
229+
&checked_parameters(),
230+
MemoryInstance::new(),
231+
&EmptyStorage,
232+
)
233+
.expect("Predicate check failed");
225234
tx
226235
};
227236
bench_txs("predicate transfers", c, generator);
@@ -288,8 +297,12 @@ fn predicate_transfers_eck1(c: &mut Criterion) {
288297
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
289298
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
290299
.finalize();
291-
tx.estimate_predicates(&checked_parameters(), MemoryInstance::new())
292-
.expect("Predicate check failed");
300+
tx.estimate_predicates(
301+
&checked_parameters(),
302+
MemoryInstance::new(),
303+
&EmptyStorage,
304+
)
305+
.expect("Predicate check failed");
293306
tx
294307
};
295308
bench_txs("predicate transfers eck1", c, generator);
@@ -358,8 +371,12 @@ fn predicate_transfers_ed19(c: &mut Criterion) {
358371
.add_output(Output::coin(rng.gen(), 50, AssetId::default()))
359372
.add_output(Output::change(rng.gen(), 0, AssetId::default()))
360373
.finalize();
361-
tx.estimate_predicates(&checked_parameters(), MemoryInstance::new())
362-
.expect("Predicate check failed");
374+
tx.estimate_predicates(
375+
&checked_parameters(),
376+
MemoryInstance::new(),
377+
&EmptyStorage,
378+
)
379+
.expect("Predicate check failed");
363380
tx
364381
};
365382
bench_txs("predicate transfers ed19", c, generator);

benches/src/default_gas_costs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ pub fn default_gas_costs() -> GasCostsValues {
5757
ori: 2,
5858
poph: 2,
5959
popl: 2,
60-
pshh: 3073,
61-
pshl: 3016,
60+
pshh: 5,
61+
pshl: 5,
6262
move_op: 2,
6363
ret: 43,
6464
sb: 2,

benches/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ impl TryFrom<VmBench> for VmBenchPrepared {
494494
});
495495

496496
// add at least one coin input
497-
tx.add_random_fee_input();
497+
tx.add_fee_input();
498498

499499
let mut tx = tx
500500
.script_gas_limit(gas_limit)
@@ -504,6 +504,7 @@ impl TryFrom<VmBench> for VmBenchPrepared {
504504
tx.estimate_predicates(
505505
&CheckPredicateParams::from(&params),
506506
MemoryInstance::new(),
507+
db.database_mut(),
507508
)
508509
.unwrap();
509510
let tx = tx.into_checked(height, &params).unwrap();

bin/fuel-core/chainspec/local-testnet/chain_config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393
"ori": 2,
9494
"poph": 2,
9595
"popl": 2,
96-
"pshh": 3073,
97-
"pshl": 3016,
96+
"pshh": 5,
97+
"pshl": 5,
9898
"ret_contract": 43,
9999
"rvrt_contract": 39,
100100
"sb": 2,

crates/client/src/client.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,12 @@ impl FuelClient {
905905
Ok(blob)
906906
}
907907

908+
/// Check whether a blob with ID exists
909+
pub async fn blob_exists(&self, id: BlobId) -> io::Result<bool> {
910+
let query = schema::blob::BlobExistsQuery::build(BlobByIdArgs { id: id.into() });
911+
Ok(self.query(query).await?.blob.is_some())
912+
}
913+
908914
/// Retrieve multiple blocks
909915
pub async fn blocks(
910916
&self,

0 commit comments

Comments
 (0)