-
Notifications
You must be signed in to change notification settings - Fork 43
refactor(e2e): unify submit helpers behind a typed SubmitError #2013
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
Open
wbaxterh
wants to merge
1
commit into
midnightntwrk:main
Choose a base branch
from
wbaxterh:wes-1840-typed-submit-error
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #tests | ||
|
|
||
| # Unify the e2e submit helpers behind a typed SubmitError | ||
|
|
||
| `tests/e2e/src/api/midnight.rs` had `submit_midnight_tx` (returned the raw progress handle) and | ||
| `submit_expecting_rejection` (drove it to a rejection and returned a stringly `Box<dyn Error>`). | ||
|
|
||
| Add a typed `SubmitError` (`Subxt` for submission-time failures, `NotFinalized` for a watched tx | ||
| that failed pre_dispatch/execution) and collapse the two into a single `submit_midnight_tx` that | ||
| submits, waits for finalized success, and returns the finalized `ExtrinsicEvents` or a typed | ||
| `SubmitError`. Callers expecting success use `?`/`expect`; callers expecting a rejection match on | ||
| the `Err`. | ||
|
|
||
| `submit_expecting_rejection` had no callers and is removed. `submit_expecting_success` keeps its | ||
| best-block-inclusion semantics via a shared `submit_and_watch` helper and now also returns | ||
| `SubmitError`. The one `c2m_bridge` caller uses the returned events directly. | ||
|
|
||
| PR: <link> | ||
| Issue: https://github.com/midnightntwrk/midnight-node/issues/1840 |
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
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
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
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.
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.
When the transaction subscription disconnects, event retrieval fails, or another subxt/RPC error occurs while
wait_for_finalized_success()is running, this mapping reportsSubmitError::NotFinalizedjust like a pre-dispatch or execution rejection. A rejection-focused e2e test matching that variant can therefore pass during an infrastructure failure instead of proving the node rejected the transaction; preserve subxt watcher errors separately and reserveNotFinalizedfor confirmed transaction failures.Useful? React with 👍 / 👎.