diff --git a/crates/sui-types/src/object.rs b/crates/sui-types/src/object.rs index 9bc357eb9f1c1..db9971c1192bd 100644 --- a/crates/sui-types/src/object.rs +++ b/crates/sui-types/src/object.rs @@ -505,6 +505,10 @@ pub enum Authenticator { impl Authenticator { pub fn as_single_owner(&self) -> &SuiAddress { + // NOTE: Existing callers are written assuming that only singly-owned + // ConsensusV2 objects exist. If additional Authenticator variants are + // added, do not simply panic here. Instead, change the return type of + // this function and update callers accordingly. match self { Self::SingleOwner(address) => address, } diff --git a/sui-execution/latest/sui-adapter/src/temporary_store.rs b/sui-execution/latest/sui-adapter/src/temporary_store.rs index a12419225dff9..8e4223f2485ed 100644 --- a/sui-execution/latest/sui-adapter/src/temporary_store.rs +++ b/sui-execution/latest/sui-adapter/src/temporary_store.rs @@ -540,7 +540,7 @@ impl<'backing> TemporaryStore<'backing> { assert!(sender == a, "Input object must be owned by sender"); Some(id) } - Owner::Shared { .. } => Some(id), + Owner::Shared { .. } | Owner::ConsensusV2 { .. } => Some(id), Owner::Immutable => { // object is authenticated, but it cannot own other objects, // so we should not add it to `authenticated_objs` @@ -559,8 +559,6 @@ impl<'backing> TemporaryStore<'backing> { "Input objects must be address owned, shared, consensus, or immutable" ) } - // TODO: Implement support for ConsensusV2 objects. - Owner::ConsensusV2 { .. } => todo!(), } }) .filter(|id| { diff --git a/sui-execution/latest/sui-move-natives/src/test_scenario.rs b/sui-execution/latest/sui-move-natives/src/test_scenario.rs index c6115fec55716..1292666485571 100644 --- a/sui-execution/latest/sui-move-natives/src/test_scenario.rs +++ b/sui-execution/latest/sui-move-natives/src/test_scenario.rs @@ -229,8 +229,17 @@ pub fn end_transaction( .or_default() .insert(id); } - // TODO: Implement support for ConsensusV2 objects. - Owner::ConsensusV2 { .. } => todo!(), + Owner::ConsensusV2 { authenticator, .. } => { + // Treat ConsensusV2 objects the same as address-owned for now. This will have + // to be revisited when other Authenticators are added. + inventories + .address_inventories + .entry(*authenticator.as_single_owner()) + .or_default() + .entry(ty) + .or_default() + .insert(id); + } } } @@ -833,8 +842,12 @@ fn transaction_effects( Owner::ObjectOwner(o) => transferred_to_object.push((pack_id(id), pack_id(o))), Owner::Shared { .. } => shared.push(id), Owner::Immutable => frozen.push(id), - // TODO: Implement support for ConsensusV2 objects. - Owner::ConsensusV2 { .. } => todo!(), + // Treat ConsensusV2 objects the same as address-owned for now. This will have + // to be revisited when other Authenticators are added. + Owner::ConsensusV2 { authenticator, .. } => transferred_to_account.push(( + pack_id(id), + Value::address((*authenticator.as_single_owner()).into()), + )), } }