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

[SOD] Reshare objects at same initial_shared_version #17834

Merged
merged 2 commits into from
May 20, 2024
Merged

Conversation

tzakian
Copy link
Contributor

@tzakian tzakian commented May 20, 2024

Description

Update the semantics of resharing so it preserves the initial shared version of the shared object.

Test plan

Updated display for tests, and made sure that the initial shared version is updated correctly under the new protocol version.

Bottom commit are the actual changes, and the updates to the meaningful tests. The top (fixup) commit are the changes to the rest of the tests to account for the update to the object owner display.


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:

@tzakian tzakian requested review from lxfind and tnowacki May 20, 2024 21:10
@tzakian tzakian requested a review from mystenmark as a code owner May 20, 2024 21:10
Copy link

vercel bot commented May 20, 2024

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

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 20, 2024 11:16pm
3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview May 20, 2024 11:16pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview May 20, 2024 11:16pm
sui-typescript-docs ⬜️ Ignored (Inspect) Visit Preview May 20, 2024 11:16pm

@tzakian tzakian changed the title Tzakian/sod fix iso [SOD] Reshare objects at same initial_shared_version May 20, 2024
} => {
write!(
f,
"Shared(initial_shared_version: {})",
Copy link
Contributor

Choose a reason for hiding this comment

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

this is used in sui-tool, where I think I'd prefer the more concise option of Shared(N), if its all the same to you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the same to me -- will update.

Copy link
Contributor

Choose a reason for hiding this comment

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

Are we okay with the non-hex value here? We definitely want it for tests, I'm just not sure why hex was used in the display normally

initial_shared_version: previous_initial_shared_version,
}) = input_objects.get(id).map(|obj| &obj.owner)
{
assert!(!self.created_object_ids.contains(id));
Copy link
Contributor

Choose a reason for hiding this comment

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

is it worth removing the assert and making this an if/else?

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 don't believe so? IMO this is just a sanity assert to make sure if we get into a situation where the object is showing as both created and an input object we should panic.

Copy link
Contributor

Choose a reason for hiding this comment

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

true, but if we think that's worth an assertion shouldn't it apply to all owner types? that said, i'm not very worried about this either way

sui-execution/v1/sui-adapter/src/temporary_store.rs Outdated Show resolved Hide resolved
debug_assert!(!self.deleted_object_ids.contains(id));
debug_assert!(
*initial_shared_version == SequenceNumber::new()
|| *initial_shared_version == *previous_initial_shared_version
Copy link
Contributor

Choose a reason for hiding this comment

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

why isn't it always == previous_initial_shared_version? i would think the only way it can be SequenceNumber::new() is if that is also what the previous version is?

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 the bug here, that sometimes it is SequenceNumber::new()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the issue today -- in the written_objects the initial_shared_version will be SequenceNumber::new() in this case, and if it's already equal to the initial_shared_version on input there's no issue.

Self::Shared {
initial_shared_version,
} => {
write!(f, "Shared({})", initial_shared_version.value())
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. I know the formatting above isn't super consistent (like that : sitting after Object ID), but it might be better to do

Suggested change
write!(f, "Shared({})", initial_shared_version.value())
write!(f, "Shared ( {} )", initial_shared_version.value())

Or maybe just change the other ones?

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'd be more in favor of just updating this one to have the space -- will do that now :)

Copy link
Contributor

@tnowacki tnowacki left a comment

Choose a reason for hiding this comment

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

Should we add a before/after test for the protocol config?

debug_assert!(!self.deleted_object_ids.contains(id));
debug_assert!(
*initial_shared_version == SequenceNumber::new()
|| *initial_shared_version == *previous_initial_shared_version
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 the bug here, that sometimes it is SequenceNumber::new()

@tzakian
Copy link
Contributor Author

tzakian commented May 20, 2024

Should we add a before/after test for the protocol config?

Added! See re_share.move and re_share_v45.move (which tests this before the protocol config).

@tzakian tzakian enabled auto-merge (squash) May 20, 2024 23:33
@tzakian tzakian merged commit 977e96e into main May 20, 2024
48 checks passed
@tzakian tzakian deleted the tzakian/sod-fix-iso branch May 20, 2024 23:40
tzakian added a commit that referenced this pull request May 20, 2024
## Description 

Update the semantics of resharing so it preserves the initial shared
version of the shared object.

## Test plan 

Updated display for tests, and made sure that the initial shared version
is updated correctly under the new protocol version.

Bottom commit are the actual changes, and the updates to the meaningful
tests. The top (fixup) commit are the changes to the rest of the tests
to account for the update to the object owner display.

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
tzakian added a commit that referenced this pull request May 21, 2024
…7834) (#17840)

## Description 

Update the semantics of resharing so it preserves the initial shared
version of the shared object.

## Test plan 

Updated display for tests, and made sure that the initial shared version
is updated correctly under the new protocol version.

Bottom commit are the actual changes, and the updates to the meaningful
tests. The top (fixup) commit are the changes to the rest of the tests
to account for the update to the object owner display.

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:

## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
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