From b3bd2e5cb20d57563f788505c28546c2c97cbf7c Mon Sep 17 00:00:00 2001 From: Ashok Menon Date: Wed, 30 Nov 2022 23:34:03 +0000 Subject: [PATCH] fixup: reset initial_shared_version in update_gateway_state --- crates/sui-core/src/authority/authority_store.rs | 9 +++++++++ crates/sui-types/src/messages.rs | 4 ++-- crates/sui-types/src/temporary_store.rs | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/sui-core/src/authority/authority_store.rs b/crates/sui-core/src/authority/authority_store.rs index de9f0cbc4fddc..262d645a9bbc7 100644 --- a/crates/sui-core/src/authority/authority_store.rs +++ b/crates/sui-core/src/authority/authority_store.rs @@ -754,6 +754,15 @@ impl Deserialize<'de>> SuiDataStore { WriteKind::Mutate | WriteKind::Unwrap => prev_versions[&object.id()], }; + if let Owner::Shared { + initial_shared_version, + } = &mut object.owner + { + if WriteKind::Create == kind { + *initial_shared_version = SequenceNumber::new(); + } + } + if let Some(object) = object.data.try_as_move_mut() { object.decrement_version_to(prev_version); } diff --git a/crates/sui-types/src/messages.rs b/crates/sui-types/src/messages.rs index 89382ad9f8866..c85420c46bf0e 100644 --- a/crates/sui-types/src/messages.rs +++ b/crates/sui-types/src/messages.rs @@ -14,7 +14,7 @@ use crate::message_envelope::{Envelope, Message, TrustedEnvelope, VerifiedEnvelo use crate::messages_checkpoint::{ AuthenticatedCheckpoint, CheckpointSequenceNumber, CheckpointSignatureMessage, }; -use crate::object::{MoveObject, Object, ObjectFormatOptions, Owner, OBJECT_START_VERSION}; +use crate::object::{MoveObject, Object, ObjectFormatOptions, Owner, PACKAGE_VERSION}; use crate::storage::{DeleteKind, WriteKind}; use crate::{SUI_SYSTEM_STATE_OBJECT_ID, SUI_SYSTEM_STATE_OBJECT_SHARED_VERSION}; use byteorder::{BigEndian, ReadBytesExt}; @@ -1931,7 +1931,7 @@ impl InputObjectKind { pub fn version(&self) -> Option { match self { - Self::MovePackage(..) => Some(OBJECT_START_VERSION), + Self::MovePackage(..) => Some(PACKAGE_VERSION), Self::ImmOrOwnedMoveObject((_, version, _)) => Some(*version), Self::SharedMoveObject { .. } => None, } diff --git a/crates/sui-types/src/temporary_store.rs b/crates/sui-types/src/temporary_store.rs index f268da9c14c8c..91a0bd8f213c1 100644 --- a/crates/sui-types/src/temporary_store.rs +++ b/crates/sui-types/src/temporary_store.rs @@ -176,7 +176,7 @@ impl TemporaryStore { assert_eq!( *initial_shared_version, SequenceNumber::new(), - "Initial version should be blank before this point", + "Initial version should be blank before this point for {id:?}", ); *initial_shared_version = self.lamport_timestamp; }