Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Prevent EM from calling SM after applyTransaction() #364

Merged
merged 3 commits into from
Apr 7, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { Abs_FraudContributor } from "./Abs_FraudContributor.sol";
* This contract controls the State Manager and Execution Manager, and uses them to calculate the
* post-state root by applying the transaction. The Fraud Verifier can then check for fraud by comparing
* the calculated post-state root with the proposed post-state root.
*
*
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of little white space fixes to ignore due to the addition of an .editorConfig.

* Compiler used: solc
* Runtime target: EVM
*/
Expand Down Expand Up @@ -170,7 +170,7 @@ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOV
{
return phase == TransitionPhase.COMPLETE;
}


/***********************************
* Public Functions: Pre-Execution *
Expand Down Expand Up @@ -335,7 +335,7 @@ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOV

// We require gas to complete the logic here in run() before/after execution,
// But must ensure the full _tx.gasLimit can be given to the ovmCALL (determinism)
// This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first
// This includes 1/64 of the gas getting lost because of EIP-150 (lost twice--first
// going into EM, then going into the code contract).
require(
gasleft() >= 100000 + _transaction.gasLimit * 1032 / 1000, // 1032/1000 = 1.032 = (64/63)^2 rounded up
Expand All @@ -354,6 +354,8 @@ contract OVM_StateTransitioner is Lib_AddressResolver, Abs_FraudContributor, iOV
// if that's the case.
ovmExecutionManager.run(_transaction, address(ovmStateManager));

// Prevent the Execution Manager from calling this SM again.
ovmStateManager.setExecutionManager(address(0))
phase = TransitionPhase.POST_EXECUTION;
}

Expand Down