Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! [adapter][move] Rela…
Browse files Browse the repository at this point in the history
…x object/pure arg ordering. remove return values
  • Loading branch information
tnowacki committed Apr 21, 2022
1 parent 3840d03 commit b29f233
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
4 changes: 2 additions & 2 deletions sui_core/src/authority/temporary_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ impl<S> AuthorityTemporaryStore<S> {
})
.collect();
let objects = input_objects
.iter()
.map(|(_, object)| (object.id(), object.clone()))
.into_iter()
.map(|(_, object)| (object.id(), object))
.collect();
Self {
package_store,
Expand Down
37 changes: 14 additions & 23 deletions sui_core/src/execution_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,11 @@ fn execute_transaction<S: BackingPackageStore>(
.expect("We constructed the object map so it should always have the gas object id")
.clone();

// unwraps here are safe because we built `inputs`
let mut result = Ok(());
// TODO: Since we require all mutable objects to not show up more than
// once across single tx, we should be able to run them in parallel.
for single_tx in transaction.into_single_transactions() {
match single_tx {
result = match single_tx {
SingleTransactionKind::Transfer(Transfer {
recipient,
object_ref,
Expand All @@ -95,10 +94,7 @@ fn execute_transaction<S: BackingPackageStore>(
.get(&object_ref.0)
.unwrap()
.clone();
if let Err(err) = transfer(temporary_store, object, recipient) {
result = Err(err);
break;
}
transfer(temporary_store, object, recipient)
}
SingleTransactionKind::Call(MoveCall {
package,
Expand All @@ -108,7 +104,7 @@ fn execute_transaction<S: BackingPackageStore>(
arguments,
}) => {
let module_id = ModuleId::new(package.0.into(), module);
result = adapter::execute(
adapter::execute(
move_vm,
temporary_store,
module_id,
Expand All @@ -117,24 +113,19 @@ fn execute_transaction<S: BackingPackageStore>(
arguments,
&mut gas_status,
tx_ctx,
);
if result.is_err() {
break;
}
}
SingleTransactionKind::Publish(MoveModulePublish { modules }) => {
if let Err(err) = adapter::publish(
temporary_store,
native_functions.clone(),
modules,
tx_ctx,
&mut gas_status,
) {
result = Err(err);
break;
}
)
}
SingleTransactionKind::Publish(MoveModulePublish { modules }) => adapter::publish(
temporary_store,
native_functions.clone(),
modules,
tx_ctx,
&mut gas_status,
),
};
if result.is_err() {
break;
}
}
if result.is_err() {
// Roll back the temporary store if execution failed.
Expand Down
8 changes: 4 additions & 4 deletions sui_programmability/adapter/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ fn execute_internal<
gas_status: &mut SuiGasStatus, // gas status for the current call operation
ctx: &mut TxContext,
) -> SuiResult<()> {
// object_owner_map maps from object ID to its exclusive object owner.
// This map will be used for detecting circular ownership among
// objects, which can only happen to objects exclusively owned
// by objects.
let object_owner_map: BTreeMap<SuiAddress, SuiAddress> = object_data
.iter()
.filter_map(|(id, (owner, _))| match owner {
Expand Down Expand Up @@ -599,10 +603,6 @@ fn check_transferred_object_invariants(

pub struct TypeCheckSuccess {
pub module_id: ModuleId,
// object_owner_map maps from object ID to its exclusive object owner.
// This map will be used for detecting circular ownership among
// objects, which can only happen to objects exclusively owned
// by objects.
pub object_data: BTreeMap<ObjectID, (object::Owner, SequenceNumber)>,
pub by_value_objects: BTreeSet<ObjectID>,
pub mutable_ref_objects: BTreeMap<LocalIndex, ObjectID>,
Expand Down

0 comments on commit b29f233

Please sign in to comment.