Fix Tutorial 1's __check_auth example to match the current CustomAccountInterface trait - #2686
Open
leighmcculloch wants to merge 1 commit into
Open
Conversation
…untInterface trait ### What Correct the custom account example's `__check_auth` signature to use the right signature-payload type, and make its `Context` match exhaustive against the current enum. ### Why As written, this tutorial's account contract does not compile against the current SDK, so anyone copying it hits a wall immediately — and it was already inconsistent with Tutorial 2 in the same file, which had the correct type.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Tutorial 1 for the current CustomAccountInterface and exhaustive Context matching.
Changes:
- Changes signature payloads to
Hash<32>. - Handles constructor contexts.
- Blocking: both new
Hashimports use the nonexistent crate-root export.
Recommendation: NEEDS-CHANGES — import crypto::Hash in both snippets.
Comments suppressed due to low confidence (1)
docs/build/guides/auth/check-auth-tutorials.mdx:264
- The complete example repeats the invalid crate-root
Hashimport, so copying this advertised single-file version will not compile. ImportHashfromsoroban_sdk::crypto, as required by the current SDK.
BytesN, Env, Hash, Symbol, Vec,
| use soroban_sdk::{ | ||
| auth::{Context, CustomAccountInterface}, contract, contracterror, contractimpl, contracttype, symbol_short, Address, | ||
| BytesN, Env, Symbol, Vec, | ||
| BytesN, Env, Hash, Symbol, Vec, |
|
Preview is available here: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Correct the custom account example's
__check_authsignature to use the right signature-payload type, and make itsContextmatch exhaustive against the current enum.Why
As written, this tutorial's account contract does not compile against the current SDK, so anyone copying it hits a wall immediately — and it was already inconsistent with Tutorial 2 in the same file, which had the correct type.