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 more optional args to dev inspect on fullnode #15679

Merged
merged 4 commits into from
Jan 17, 2024
Merged

Conversation

emmazzz
Copy link
Contributor

@emmazzz emmazzz commented Jan 12, 2024

Description

For graphql we would like to combine dry run and dev inspect functionality, and any behavior difference between the two should be made toggleable via user provided options, which will look a lot like the newly added struct DevInspectArgs in this PR. This PR modifies the dev inspect code to make implementing new dev inspect easier. It also adds optional additional args to dev inspect APIs.

Test Plan

existing 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

Add optional additional parameters to dev_inspect_transaction_block including gas_budget, gas_objects, gas_sponsor and skip_checks.

Copy link

vercel bot commented Jan 12, 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 Jan 17, 2024 6:56am
sui-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 17, 2024 6:56am
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 17, 2024 6:56am
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Visit Preview Jan 17, 2024 6:56am
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jan 17, 2024 6:56am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jan 17, 2024 6:56am

Copy link
Member

@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.

Thanks @emmazzz, this looks great! Take a look at the comment about the check_transaction_for_signing test, I don't think that should be guarded, but otherwise good to go!

crates/sui-core/src/authority.rs Outdated Show resolved Hide resolved
crates/sui-core/src/authority.rs Outdated Show resolved Hide resolved
crates/sui-core/src/authority.rs Outdated Show resolved Hide resolved
Comment on lines 1706 to 1713
} else {
if transaction.gas().is_empty() {
Copy link
Member

Choose a reason for hiding this comment

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

nit: collapse the else and if here?

transaction.gas().to_vec()
};

let (gas_status, checked_input_objects) = if skip_checks {
Copy link
Member

Choose a reason for hiding this comment

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

There seems to be some interesting nuances between the interfaces for these various kinds of check (e.g. some of these APIs seem to expect the gas object in the inputs, some not, etc etc). It's probably something we can simplify (later), but for now, can you add some comments to this part to call out those differences?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, this is precisely why I did not collapse the else and if - not collapsing them would make the conditions more clear and code more readable imo. I'll add some comments explaining this.

Comment on lines +304 to +305
gas_price.map(|i| *i),
gas_budget.map(|i| *i),
Copy link
Member

Choose a reason for hiding this comment

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

Could this be done with .copied?

Suggested change
gas_price.map(|i| *i),
gas_budget.map(|i| *i),
gas_price.copied(),
gas_budget.copied(),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The map here is for converting an Option<BigInt<u64>> to an Option<u64>.

gas_budget.map(|i| *i),
gas_sponsor,
gas_objects,
epoch.map(|i| *i),
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

@emmazzz emmazzz enabled auto-merge (squash) January 17, 2024 07:09
@emmazzz emmazzz merged commit 20c77fb into main Jan 17, 2024
41 checks passed
@emmazzz emmazzz deleted the emma/refactor-dry-run branch January 17, 2024 07:15
emmazzz added a commit that referenced this pull request Jan 19, 2024
## Description 

This PR makes two changes:
- Added an option to dev inspect arguments to return the raw transaction
data. This is needed to implement dry run from graphql side.
- In a previous PR #15679 , I started using the unused `epoch` parameter
as transaction expiration epoch for dev inspect, which is apparently
wrong. This `epoch` was supposed to be for running a txn in a previous
epoch, which was never implemented. So this PR reverted that change and
kept ignoring `epoch`.

## Test Plan 

Existing 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
- [x] 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

Added an option to return raw transaction data for dev inspect.
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.

2 participants