Skip to content

Commit

Permalink
fixup: reset initial_shared_version in update_gateway_state
Browse files Browse the repository at this point in the history
  • Loading branch information
amnn committed Nov 30, 2022
1 parent 283ab92 commit b3bd2e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions crates/sui-core/src/authority/authority_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,15 @@ impl<S: Eq + Debug + Serialize + for<'de> Deserialize<'de>> SuiDataStore<S> {
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);
}
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-types/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -1931,7 +1931,7 @@ impl InputObjectKind {

pub fn version(&self) -> Option<SequenceNumber> {
match self {
Self::MovePackage(..) => Some(OBJECT_START_VERSION),
Self::MovePackage(..) => Some(PACKAGE_VERSION),
Self::ImmOrOwnedMoveObject((_, version, _)) => Some(*version),
Self::SharedMoveObject { .. } => None,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-types/src/temporary_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl<S> TemporaryStore<S> {
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;
}
Expand Down

0 comments on commit b3bd2e5

Please sign in to comment.