Skip to content

Commit

Permalink
Implement ConsensusV2 object handling in sui-execution
Browse files Browse the repository at this point in the history
  • Loading branch information
aschran committed Nov 27, 2024
1 parent 6255b64 commit c4e0fcd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
6 changes: 3 additions & 3 deletions sui-execution/latest/sui-adapter/src/temporary_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -559,13 +559,13 @@ 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| {
// remove any non-mutable inputs. This will remove deleted or readonly shared
// objects
// TODO: Do we want to treat ConsensusV2 objects taken immutably as authenticated?
// If so this will have to be changed.
mutable_inputs.contains(id)
})
.copied()
Expand Down
21 changes: 17 additions & 4 deletions sui-execution/latest/sui-move-natives/src/test_scenario.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down Expand Up @@ -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()),
)),
}
}

Expand Down

0 comments on commit c4e0fcd

Please sign in to comment.