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

[GraphQL] fix issue with failed dry run and add more e2e test #16248

Merged
merged 3 commits into from
Feb 16, 2024

Conversation

emmazzz
Copy link
Contributor

@emmazzz emmazzz commented Feb 14, 2024

Description

Currently we assume that the dev inspect result coming from fullnode is always Some but it can actually be None if the transaction failed to execute. This PR fixes that and adds a few more e2e test cases for this scenario as well as a scenario where a TransactionKind is provided.

Test Plan

Added tests


If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section.

Type of Change (Check all that apply)

  • protocol change
  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

Copy link

vercel bot commented Feb 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mysten-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 16, 2024 7:09am
sui-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 16, 2024 7:09am
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 16, 2024 7:09am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Visit Preview Feb 16, 2024 7:09am
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Feb 16, 2024 7:09am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Feb 16, 2024 7:09am

results
.into_iter()
.map(DryRunEffect::try_from)
.collect::<Result<Vec<_>, Error>>()?,
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this return an error in case DryRun fails?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When a dry run fails, dev_inspect_results.results would be None and dev_inspect_results.error would be Some. If the dry run succeeds, then the reverse is true. Here we are in the branch where the dry run succeeds and results is Some. And to clarify, the Error in collect::<Result<Vec<_>, Error>>()? is potential internal errors from DryRunEffect::try_from.

Copy link
Contributor

@amnn amnn left a comment

Choose a reason for hiding this comment

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

Nice, thanks @emmazzz !

crates/sui-graphql-rpc/tests/e2e_tests.rs Show resolved Hide resolved
crates/sui-graphql-rpc/tests/e2e_tests.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@wlmyng wlmyng left a comment

Choose a reason for hiding this comment

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

Nice that we do get error results back from dev inspect/ dry run as well

@emmazzz emmazzz enabled auto-merge (squash) February 16, 2024 07:40
@emmazzz emmazzz merged commit a1e2f72 into main Feb 16, 2024
41 checks passed
@emmazzz emmazzz deleted the emma/fix-dry-run branch February 16, 2024 07:49
cgswords pushed a commit that referenced this pull request Feb 24, 2024
## Description 

Currently we assume that the dev inspect result coming from fullnode is
always `Some` but it can actually be `None` if the transaction failed to
execute. This PR fixes that and adds a few more e2e test cases for this
scenario as well as a scenario where a `TransactionKind` is provided.

## Test Plan 

Added tests

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
emmazzz added a commit that referenced this pull request Feb 28, 2024
## Description 

Currently we assume that the dev inspect result coming from fullnode is
always `Some` but it can actually be `None` if the transaction failed to
execute. This PR fixes that and adds a few more e2e test cases for this
scenario as well as a scenario where a `TransactionKind` is provided.

## Test Plan 

Added tests

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants