feat(examples): add attestation timeout, zero-amount validation, and …#17
Open
mrnetwork0001 wants to merge 1 commit into
Open
feat(examples): add attestation timeout, zero-amount validation, and …#17mrnetwork0001 wants to merge 1 commit into
mrnetwork0001 wants to merge 1 commit into
Conversation
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.
Description
This PR improves the example bridge scripts with better error handling and developer experience.
Changes
Attestation timeout (
--timeout): ThefetchAttestation()loop now has a configurable timeout (default: 600s / 10 minutes) instead of polling indefinitely. When the timeout is reached, a clear error message is shown suggesting the user retry with a longer timeout.Progress reporting: Attestation polling now shows attempt count and remaining time, making it much clearer what's happening during the wait.
Zero-amount validation: Added client-side validation for
--amount 0with a clear error message, instead of letting the user hit a confusingAmountMustBeNonzerocontract error on-chain.Dry-run flag (
--dryRun): When set totrue, the burn transaction is submitted but attestation polling and the receive/mint step are skipped. Useful for testing burn configuration without waiting for cross-chain completion.Updated examples README: Documented the new
--timeoutand--dryRunflags in the usage section.Motivation
The existing infinite polling loop in
fetchAttestation()could hang the process forever if an attestation never arrives (e.g., due to a misconfigured domain, insufficient fee, or attestation service issues). New developers trying the bridge tool for the first time may not realize the process is stuck versus still working.Testing
--timeoutvalidation with non-numeric and negative values--amount 0shows proper error message