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

Extract object loading from transaction input checking #14579

Merged
merged 14 commits into from
Nov 8, 2023

Conversation

mystenmark
Copy link
Contributor

@mystenmark mystenmark commented Oct 31, 2023

This PR

  • Is primarily intended to support the creation of an in-memory object
    cache (coming soon).
  • Makes it easier to use multi-gets for transaction loads.
  • Simplifies handling of deleted shared objects and receivables.
  • Will prevent inadvertently loading the same object multiple times.
  • Will reduce the proliferation of special purpose traits (e.g.
    MarkerTableQuery which is removed in this PR).

Description

Describe the changes or additions included in this PR.

Test Plan

How did you test the new or updated feature?


If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

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

@vercel vercel bot temporarily deployed to Preview – mysten-ui October 31, 2023 22:41 Inactive
@mystenmark mystenmark marked this pull request as draft October 31, 2023 22:41
Copy link

vercel bot commented Oct 31, 2023

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 Nov 8, 2023 7:11pm
sui-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2023 7:11pm
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2023 7:11pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2023 7:11pm
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2023 7:11pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2023 7:11pm

@mystenmark mystenmark requested review from tzakian and lxfind October 31, 2023 22:42
@mystenmark mystenmark changed the title Extract object loading from transaction input checking. This: Extract object loading from transaction input checking Oct 31, 2023
@mystenmark mystenmark force-pushed the mlogan-transaction-input-loader branch from c62e697 to 0011735 Compare October 31, 2023 22:46
@vercel vercel bot temporarily deployed to Preview – mysten-ui October 31, 2023 22:46 Inactive
@mystenmark mystenmark mentioned this pull request Nov 1, 2023
7 tasks
@mystenmark mystenmark force-pushed the mlogan-transaction-input-loader branch from ebb8f9a to 72d8b61 Compare November 1, 2023 16:38
@vercel vercel bot temporarily deployed to Preview – mysten-ui November 1, 2023 16:39 Inactive
@mystenmark mystenmark force-pushed the mlogan-transaction-input-loader branch from 72d8b61 to 1be8251 Compare November 1, 2023 17:46
@vercel vercel bot temporarily deployed to Preview – mysten-ui November 1, 2023 17:46 Inactive
@mystenmark mystenmark force-pushed the mlogan-transaction-input-loader branch from 1be8251 to bbfbb82 Compare November 1, 2023 18:23
@mystenmark mystenmark marked this pull request as ready for review November 1, 2023 18:23
@vercel vercel bot temporarily deployed to Preview – mysten-ui November 1, 2023 18:23 Inactive
@mystenmark mystenmark force-pushed the mlogan-transaction-input-loader branch from bbfbb82 to ea87807 Compare November 1, 2023 20:28
@vercel vercel bot temporarily deployed to Preview – mysten-ui November 1, 2023 20:30 Inactive
Copy link
Contributor

@tzakian tzakian left a comment

Choose a reason for hiding this comment

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

Went through it again, this time a bit more deeply.

Overall everything looks pretty good to me, a couple smaller nits here and there that you should feel free to accept/ignore.

Only larger thing that I spotted was a change in gas_v2 where I believe an as_object could be None and we could call expect on it. Unless this is guarded by other checks further up in the transaction input checks possibly (but I couldn't find it).

crates/sui-core/src/transaction_input_loader.rs Outdated Show resolved Hide resolved
crates/sui-core/src/transaction_input_loader.rs Outdated Show resolved Hide resolved
crates/sui-core/src/transaction_input_loader.rs Outdated Show resolved Hide resolved
crates/sui-transaction-checks/src/lib.rs Outdated Show resolved Hide resolved
crates/sui-types/src/gas_model/gas_v2.rs Show resolved Hide resolved
Copy link
Contributor

@tzakian tzakian left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you for the changes!

Copy link
Contributor

@lxfind lxfind left a comment

Choose a reason for hiding this comment

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

Overall LGTM

input_object_kinds: &[InputObjectKind],
receiving_objects: &[ObjectRef],
protocol_config: &ProtocolConfig,
) -> SuiResult<(InputObjects, ReceivingObjects)> {
Copy link
Contributor

Choose a reason for hiding this comment

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

This function should not return ReceivingObjects today because it's effectively always empty, until we actually implement that part. We should make it so and add a TODO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started trying to remove this, and found that for dry-run, all the other machinery is already in place, so instead I changed this to read the receiving objects and return them.

&self,
_tx_digest: Option<&TransactionDigest>,
input_object_kinds: &[InputObjectKind],
receiving_objects: &[ObjectRef],
Copy link
Contributor

Choose a reason for hiding this comment

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

That's not a good argument to leave this not processed logically. We could move the fp_ensure check to the two callers for now until we decide to implement it

mystenmark and others added 14 commits November 8, 2023 09:34
- Is primarily intended to support the creation of an in-memory object
  cache (coming soon).
- Makes it easier to use multi-gets.
- Simplifies handling of deleted shared objects and receivables.
- Will prevent inadvertently loading the same object multiple times.
- Will reduce the proliferation of special purpose traits (e.g.
  MarkerTableQuery which is removed in this PR).
Co-authored-by: Xun Li <lxfind@gmail.com>
@mystenmark mystenmark force-pushed the mlogan-transaction-input-loader branch from d55d613 to 217e8cd Compare November 8, 2023 19:10
@vercel vercel bot temporarily deployed to Preview – mysten-ui November 8, 2023 19:11 Inactive
@mystenmark mystenmark merged commit 7201e68 into main Nov 8, 2023
34 checks passed
@mystenmark mystenmark deleted the mlogan-transaction-input-loader branch November 8, 2023 20:00
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.

3 participants