-
Notifications
You must be signed in to change notification settings - Fork 93
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
Return TxId
when error in checking of transactions
#897
base: master
Are you sure you want to change the base?
Conversation
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.
Copilot reviewed 5 out of 11 changed files in this pull request and generated no comments.
Files not reviewed (6)
- fuel-tx/src/transaction/types/blob.rs: Evaluated as low risk
- fuel-tx/src/transaction/types/create.rs: Evaluated as low risk
- fuel-tx/src/transaction/types/mint.rs: Evaluated as low risk
- fuel-tx/src/transaction/types/script.rs: Evaluated as low risk
- fuel-tx/src/transaction/types/upload.rs: Evaluated as low risk
- fuel-vm/src/checked_transaction.rs: Evaluated as low risk
Comments suppressed due to low confidence (3)
fuel-tx/src/transaction/types/upgrade.rs:16
- The error should return
(TxId, ValidityError)
instead of justValidityError
to match the new error handling pattern.
Err(ValidityError::TransactionUpgradeConsensusParametersChecksumMismatch)?;
fuel-vm/src/tests/upload.rs:280
- The error message should be updated to reflect the new return type, ensuring clarity and consistency.
.expect_err("Should fail to generate checked tx")
fuel-vm/src/tests/upload.rs:307
- The error message should be updated to reflect the new return type, ensuring clarity and consistency.
.expect_err("Should fail to generate checked tx")
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.
It would be nice to make this change non breaking. I tried to play with generics, but it still produces breaking code in some cases: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5f70213c55d0cf6e17abf2cd3e5f17fe
Alternative solution will be to add one more function like into_checked_basic_with_metadata
and this one will return metadata in the case of error.
I improved your playground code to be more close to reality and I have something that is breaking only because you need to specify the error type. I don't know if we can still consider this breaking I think so but I would like to have your thoughts. Link : https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d256580f356615cd7ff3979bcd2e3706 |
Yeah, it is why I'm saying it is not good solution because it is still breaking=D So because of that I'm more in favor of the |
Okey will do that but it will be |
When we try to turn a
Tx
in aChecked<Tx>
, errors can happens, but we always start by computing theTxId
and this can never fails. If something else, fails afterwards it's super useful to have theTxId
to link the error with the transaction associated.Currently, in the existing code calling
into_checked()
, if we have an error we are computing theTxId
ourself again to link it to theCheckError
which creates a double computation.Breaking change
The
TxId
is now returned with the error.Before :
Now :
Breaking change notes
I didn't placed this behind a feature flag because I think it's always valuable, however if we want to avoid breaking for now and have this information under a special feature I'm ok with this. Inputs from reviewers would be super valuable on that.
Checklist
Before requesting review
After merging, notify other teams