Skip to content

Commit

Permalink
[aptos-vm] Fix a typo in environment (#15921)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemitenkov authored Feb 10, 2025
1 parent 9fee3cd commit 4fe7f5c
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion aptos-move/aptos-vm-environment/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl AptosEnvironment {
/// block executor where this optimization is needed. Note: whether the optimization will be
/// enabled or not depends on the feature flag.
pub fn new_with_delayed_field_optimization_enabled(state_view: &impl StateView) -> Self {
let env = Environment::new(state_view, true, None).try_enable_delayed_field_optimization();
let env = Environment::new(state_view, false, None).try_enable_delayed_field_optimization();
Self(Arc::new(env))
}

Expand Down Expand Up @@ -371,4 +371,26 @@ pub mod tests {
}
}
}

#[test]
fn test_environment_with_injected_create_signer_for_gov_sim() {
let state_view = MockStateView::empty();

let not_injected_envs = [
AptosEnvironment::new(&state_view),
AptosEnvironment::new_with_gas_hook(&state_view, Arc::new(|_| {})),
AptosEnvironment::new_with_delayed_field_optimization_enabled(&state_view),
];
for env in not_injected_envs {
#[allow(deprecated)]
let not_enabled = !env.inject_create_signer_for_gov_sim();
assert!(not_enabled);
}

// Injected.
let env = AptosEnvironment::new_with_injected_create_signer_for_gov_sim(&state_view);
#[allow(deprecated)]
let enabled = env.inject_create_signer_for_gov_sim();
assert!(enabled);
}
}

0 comments on commit 4fe7f5c

Please sign in to comment.