Skip to content

Commit 4bb648d

Browse files
authored
Use Proto Types in storage instead of bytes (#3112)
## Linked Issues/PRs <!-- List of related issues/PRs --> followup to feedback from #3100 ## Description <!-- List of detailed changes --> ## 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? <!-- CURSOR_SUMMARY --> --- > [!NOTE] > <sup>[Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) is generating a summary for commit c0a6540. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent bd0f7c3 commit 4bb648d

File tree

35 files changed

+3239
-237
lines changed

35 files changed

+3239
-237
lines changed

.changes/added/3116.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Complete coverage of proto block types to cover all cases

.changes/fixed/3112.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use Protobuf types in serialization rather than opaque bytes

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ package-lock.json
1818
package.json
1919
bin/fuel-core/chainspec/local-testnet/state_transition_bytecode.wasm
2020
.DS_Store
21+
.fueldb/
2122

2223
local-testnet/

.typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ extend-ignore-identifiers-re = [
44
"tro",
55
"Tro",
66
"typ",
7+
"aloc",
8+
"ALOC",
79
]

Cargo.lock

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

crates/services/block_aggregator_api/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ repository = { workspace = true }
1010
rust-version = { workspace = true }
1111
build = "build.rs"
1212

13+
[features]
14+
fault-proving = ["fuel-core-types/fault-proving"]
15+
1316
[dependencies]
1417
anyhow = { workspace = true }
1518
async-trait = { workspace = true }
@@ -22,7 +25,7 @@ futures = { workspace = true }
2225
log = "0.4.27"
2326
num_enum = { workspace = true }
2427
postcard = { workspace = true }
25-
prost = { workspace = true }
28+
prost = { workspace = true, features = ["derive"] }
2629
rand = { workspace = true }
2730
serde = { workspace = true, features = ["derive"] }
2831
strum = { workspace = true }
@@ -41,5 +44,6 @@ tonic-prost-build = { workspace = true }
4144
fuel-core-services = { workspace = true, features = ["test-helpers"] }
4245
fuel-core-storage = { workspace = true, features = ["test-helpers"] }
4346
fuel-core-types = { workspace = true, features = ["std", "test-helpers"] }
47+
proptest = { workspace = true }
4448
tokio-stream = { workspace = true }
4549
tracing-subscriber = { workspace = true }
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
fn main() -> Result<(), Box<dyn std::error::Error>> {
2-
tonic_prost_build::compile_protos("proto/api.proto")?;
2+
tonic_prost_build::configure()
3+
.type_attribute(".", "#[derive(serde::Serialize,serde::Deserialize)]")
4+
.type_attribute(".", "#[allow(clippy::large_enum_variant)]")
5+
.compile_protos(&["proto/api.proto"], &["proto/"])?;
36
Ok(())
47
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Seeds for failure cases proptest has generated in the past. It is
2+
# automatically read and these particular cases re-run before any
3+
# novel cases are generated.
4+
#
5+
# It is recommended to check this file in to source control so that
6+
# everyone who runs the test benefits from these saved cases.
7+
cc 3d8a1dc0826956e2454ff1a3d6b8d75c5b5b0eebe2986c5668745ffb2bb9b0e4 # shrinks to block = V1(BlockV1 { header: V1(BlockHeaderV1 { application: ApplicationHeader { da_height: DaBlockHeight(0), consensus_parameters_version: 0, state_transition_bytecode_version: 31, generated: GeneratedApplicationFieldsV1 { transactions_count: 0, message_receipt_count: 0, transactions_root: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, message_outbox_root: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, event_inbox_root: 0000000000000000000000000000000000000000000000000000000000000000 } }, consensus: ConsensusHeader { prev_root: 0000000000000000000000000000000000000000000000000000000000000000, height: 00000000, time: Tai64(4611686018427387914), generated: GeneratedConsensusFields { application_hash: cda084575be17b88d98713807263d2f5b4ffbe79ba9a4fbf544bf6493a1d641a } }, metadata: Some(BlockHeaderMetadata { id: BlockId(c636fad695fad5e9211cd08b2cb66c024d7b972572cb1005c6ab56aeca4f34b4) }) }), transactions: [Script(ChargeableTransaction { body: ScriptBody { script_gas_limit: 0, receipts_root: 0000000000000000000000000000000000000000000000000000000000000000, script: ScriptCode { bytes: Bytes(24400000) }, script_data: Bytes() }, policies: Policies { bits: PoliciesBits(WitnessLimit | Maturity), values: [0, 10000, 0, 0, 0, 0] }, inputs: [], outputs: [], witnesses: [], metadata: None })] })

0 commit comments

Comments
 (0)