-
Notifications
You must be signed in to change notification settings - Fork 67
refactor: swap ID from u64 to SizedAsciiString<64>
#1217
Conversation
95a538b
to
8e907a4
Compare
300f3ff
to
2dc1d4d
Compare
83a25cd
to
9130eef
Compare
9130eef
to
8a239a0
Compare
e3658eb
to
45c4a79
Compare
SizedAsciiString<64>
* chore: upgrade to rust 1.71 * rebase origin/develop * Bump dependencies across workspace * Adjust fuel types in fuel-indexer-types * Remove temp workarounds in indexer macro * Bring in fuel-tx v0.35.3, thank you @xgreenx * Fix most of explorer; optimize data decoding in indexer macro * Clippy fixes * Fix indexing_postgres e2e tests * Manually convert contract IDs in indexer codegen * Fix final type errors * Upgrade fuel-indexer-tests * Add missing fields to client schema * Finish the upgrade...hopefully * Upgrade to fuels-rs v0.45 * ra0x3 feedback * Fix CI failures --------- Co-authored-by: Rashad Alston <rashad@Rashads-Air.lan>
* First pass; combine non-output receipt tests into one * Combine explorer-related tests * Combine tests that hit /ping * Combine receipt tests again * Finish optimization of e2e::indexing_postgres * Remove unused replace-indexer tests from indexing_postgres * Remove outdated, unused test from integration::service * Condense GraphQL API E2E tests * Use get_or_create() in test indexer * Remove IDs checks in E2E tests * Cleanup formatting and folder structure * Move http_client into WebTestComponents * Upgrade Sway version * cargo fmt * Adjust EXPECTED_CONTRACT_ID * Upgrade fuels-rs to v0.45.1
* chore: upgrade to rust 1.71 * rebase origin/develop * Bump dependencies across workspace * Adjust fuel types in fuel-indexer-types * Remove temp workarounds in indexer macro * Bring in fuel-tx v0.35.3, thank you @xgreenx * Fix most of explorer; optimize data decoding in indexer macro * Clippy fixes * Fix indexing_postgres e2e tests * Manually convert contract IDs in indexer codegen * Fix final type errors * Upgrade fuel-indexer-tests * Add missing fields to client schema * Finish the upgrade...hopefully * Upgrade to fuels-rs v0.45 * ra0x3 feedback * Fix CI failures --------- Co-authored-by: Rashad Alston <rashad@Rashads-Air.lan>
e8d5044
to
adaf55b
Compare
} | ||
|
||
#[cfg(test)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not even sure we ever used these conversions
74194ae
to
1b690d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running through your testing steps now; left a few questions/suggestions in the meantime.
unsafe { | ||
let buf = id.to_le_bytes(); | ||
let mut buflen = (buf.len() as u32).to_le_bytes(); | ||
let buff = bincode::serialize(&id.to_string()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this .to_string()
call here as SizedAsciiString
provides an impl
for Serialize
: https://github.com/FuelLabs/fuels-rs/blob/df21541b679bb90a1ee3e54f34a67b7037b40be7/packages/fuels-core/src/types/core/sized_ascii_string.rs#L162-L169.
Additionally, can we replace the .unwrap()
with an .expect()
?
{ | ||
error!("Failed to send ServiceRequest::Reload: {e:?}"); | ||
return Err(e.into()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether there is a better way of handling this pattern.
The error returned by ?
is generally logged somewhere up. We have a couple of error messages that repeat this way.
The advantage of the error!
macro is the source location attribution.
Perhaps there is some way to have both concise code and precise location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I agree it seems a bit...repetitive?
- I think the main reason I bubbled things up in this way (and in executor/service) was to be almost annoyingly explicit with the path of the error (where we can trace the error's path just via looking at the logs)
- I'm open to better ways to accomplish this
Thanks for opening a PR with the Fuel Indexer project, please review the Checklist below and ensure you've completed all of the necessary steps to make this PR review as painless as possible.
Checklist
Description
.clone()
Don't use too much.clone()
onID
types #1278SizedAsciiString<64>
IDs instead ofu64
IDsSizedAsciiString<64>
aliased asUID
IndexMetadataEntity
tofuel_indexer_types
fuel_indexer_lib
dependent onfuel_indexer_types
fuel_indexer_types
is now the base crate (previously wasfuel_indexer_lib
)Testing steps
cargo run --bin fuel-indexer -- run --run-migrations --fuel-node-host beta-4.fuel.network --fuel-node-port 80
forc index new indexer-test --namespace fuellabs && cd indexer-test && forc index deploy
Changelog
SizedAsciiString<64>