Skip to content
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

Add a separate error for nonexistent contract input #868

Merged
merged 5 commits into from
Dec 2, 2024

Conversation

Dentosal
Copy link
Member

@Dentosal Dentosal commented Nov 8, 2024

When debugging a contract error with @matt-user, we noticed that trying to transfer to zero address produced a weird error message. Instead of saying "contract was in inputs, but doesn't exist", the message was just "contract not in inputs". This PR creates a separate error for that. It's technically a breaking change, since we change error to be another error.

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog

Before requesting review

  • I have reviewed the code myself

@Dentosal Dentosal added the breaking A breaking api change label Nov 8, 2024
@Dentosal Dentosal self-assigned this Nov 8, 2024
@Dentosal Dentosal changed the title Add separate error for nonexistent contract Add separate error for nonexistent contract input Nov 8, 2024
@Dentosal Dentosal changed the title Add separate error for nonexistent contract input Add a separate error for nonexistent contract input Nov 8, 2024
@Dentosal Dentosal marked this pull request as ready for review November 8, 2024 05:33
@Dentosal Dentosal requested a review from a team November 8, 2024 05:34
Copy link
Member

@MitchTurner MitchTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to approve. We've lifted the code freeze I believe but want to check first.

AurelienFT
AurelienFT previously approved these changes Nov 9, 2024
rafal-ch
rafal-ch previously approved these changes Nov 14, 2024
Copy link
Contributor

@rafal-ch rafal-ch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@@ -905,7 +905,7 @@ where
false
}
}) {
return Err(InterpreterError::Panic(PanicReason::ContractNotInInputs));
return Err(InterpreterError::Panic(PanicReason::InputContractDoesNotExist));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that is it not possible to call contract from non Script transaction, but it looks like we need to move this check to the begin of the run function and return an error if contract doesn't exist regardless of the transaction type.

…ut-contract

# Conflicts:
#	CHANGELOG.md
#	fuel-asm/src/panic_reason.rs
Added an explicit `match` statement to not forget in the future to add handling of a new variants of the transactions.
@xgreenx xgreenx dismissed stale reviews from rafal-ch and AurelienFT via 4386bdd December 2, 2024 20:49
@AurelienFT AurelienFT enabled auto-merge December 2, 2024 23:12
@AurelienFT AurelienFT added this pull request to the merge queue Dec 2, 2024
Merged via the queue into master with commit ce051d4 Dec 2, 2024
40 checks passed
@AurelienFT AurelienFT deleted the dento/error-for-nonexistent-input-contract branch December 2, 2024 23:24
@xgreenx xgreenx mentioned this pull request Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking A breaking api change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants