Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(torii): add transaction hash to erc_transfers table #2520
feat(torii): add transaction hash to erc_transfers table #2520
Changes from all commits
1ee2bb6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 687 in crates/torii/core/src/engine.rs
Codecov / codecov/patch
crates/torii/core/src/engine.rs#L686-L687
Check warning on line 910 in crates/torii/core/src/engine.rs
Codecov / codecov/patch
crates/torii/core/src/engine.rs#L908-L910
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.
🛠️ Refactor suggestion
Ohayo, sensei! Consider adding error handling to
get_transaction_hash_from_event_id
.The function assumes the event_id format is always correct. To improve robustness, consider:
Here's a potential implementation:
This change would make the function more resilient to incorrect inputs.
Check warning on line 50 in crates/torii/core/src/processors/erc20_legacy_transfer.rs
Codecov / codecov/patch
crates/torii/core/src/processors/erc20_legacy_transfer.rs#L50
Check warning on line 64 in crates/torii/core/src/processors/erc20_legacy_transfer.rs
Codecov / codecov/patch
crates/torii/core/src/processors/erc20_legacy_transfer.rs#L55-L64
Check warning on line 53 in crates/torii/core/src/processors/erc20_transfer.rs
Codecov / codecov/patch
crates/torii/core/src/processors/erc20_transfer.rs#L53
Check warning on line 64 in crates/torii/core/src/processors/erc20_transfer.rs
Codecov / codecov/patch
crates/torii/core/src/processors/erc20_transfer.rs#L55-L64
Check warning on line 53 in crates/torii/core/src/processors/erc721_legacy_transfer.rs
Codecov / codecov/patch
crates/torii/core/src/processors/erc721_legacy_transfer.rs#L53
Check warning on line 62 in crates/torii/core/src/processors/erc721_legacy_transfer.rs
Codecov / codecov/patch
crates/torii/core/src/processors/erc721_legacy_transfer.rs#L62
Check warning on line 53 in crates/torii/core/src/processors/erc721_transfer.rs
Codecov / codecov/patch
crates/torii/core/src/processors/erc721_transfer.rs#L53
Check warning on line 62 in crates/torii/core/src/processors/erc721_transfer.rs
Codecov / codecov/patch
crates/torii/core/src/processors/erc721_transfer.rs#L62
Check warning on line 28 in crates/torii/core/src/sql/erc.rs
Codecov / codecov/patch
crates/torii/core/src/sql/erc.rs#L28
Check warning on line 47 in crates/torii/core/src/sql/erc.rs
Codecov / codecov/patch
crates/torii/core/src/sql/erc.rs#L47
Check warning on line 84 in crates/torii/core/src/sql/erc.rs
Codecov / codecov/patch
crates/torii/core/src/sql/erc.rs#L84
Check warning on line 102 in crates/torii/core/src/sql/erc.rs
Codecov / codecov/patch
crates/torii/core/src/sql/erc.rs#L102
Check warning on line 323 in crates/torii/core/src/sql/erc.rs
Codecov / codecov/patch
crates/torii/core/src/sql/erc.rs#L323
Check warning on line 327 in crates/torii/core/src/sql/erc.rs
Codecov / codecov/patch
crates/torii/core/src/sql/erc.rs#L326-L327
Check warning on line 338 in crates/torii/core/src/sql/erc.rs
Codecov / codecov/patch
crates/torii/core/src/sql/erc.rs#L338
Check warning on line 83 in crates/torii/graphql/src/object/erc/erc_transfer.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/erc_transfer.rs#L82-L83
Check warning on line 125 in crates/torii/graphql/src/object/erc/erc_transfer.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/erc_transfer.rs#L125
Check warning on line 148 in crates/torii/graphql/src/object/erc/erc_transfer.rs
Codecov / codecov/patch
crates/torii/graphql/src/object/erc/erc_transfer.rs#L148
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.
Ohayo, sensei! Consider handling existing data when adding the new NOT NULL column.
The addition of the
transaction_hash
column aligns well with the PR objectives. However, adding aNOT NULL
column to an existing table without aDEFAULT
value might cause issues if there are existing rows in theerc_transfers
table.To address this, consider the following options:
If the table is empty or you're certain all existing data can be safely discarded:
If existing data needs to be preserved, use a two-step migration:
If a default value is appropriate:
Choose the option that best fits your data requirements and existing table state, sensei.
Would you like assistance in implementing one of these solutions or in creating a data migration script?