Commit f77c0bec authored by Maurelian's avatar Maurelian Committed by GitHub

Treat SM address as context (#366)

parent 12485546
...@@ -206,9 +206,6 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -206,9 +206,6 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
// Wipe the execution context. // Wipe the execution context.
_resetContext(); _resetContext();
// Reset the ovmStateManager.
ovmStateManager = iOVM_StateManager(address(0));
} }
...@@ -640,7 +637,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -640,7 +637,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
{ {
// DELEGATECALL does not change anything about the message context. // DELEGATECALL does not change anything about the message context.
MessageContext memory nextMessageContext = messageContext; MessageContext memory nextMessageContext = messageContext;
return _callContract( return _callContract(
nextMessageContext, nextMessageContext,
_gasLimit, _gasLimit,
...@@ -915,7 +912,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -915,7 +912,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
/** /**
* Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates). * Handles all interactions which involve the execution manager calling out to untrusted code (both calls and creates).
* Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions. * Ensures that OVM-related measures are enforced, including L2 gas refunds, nuisance gas, and flagged reversions.
* *
* @param _nextMessageContext Message context to be used for the external message. * @param _nextMessageContext Message context to be used for the external message.
* @param _gasLimit Amount of gas to be passed into this message. * @param _gasLimit Amount of gas to be passed into this message.
* @param _contract OVM address being called or deployed to * @param _contract OVM address being called or deployed to
...@@ -1028,7 +1025,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -1028,7 +1025,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
* Handles the creation-specific safety measures required for OVM contract deployment. * Handles the creation-specific safety measures required for OVM contract deployment.
* This function sanitizes the return types for creation messages to match calls (bool, bytes). * This function sanitizes the return types for creation messages to match calls (bool, bytes).
* This allows for consistent handling of both types of messages in _handleExternalMessage(). * This allows for consistent handling of both types of messages in _handleExternalMessage().
* *
* @param _gasLimit Amount of gas to be passed into this creation. * @param _gasLimit Amount of gas to be passed into this creation.
* @param _creationCode Code to pass into CREATE for deployment. * @param _creationCode Code to pass into CREATE for deployment.
* @param _address OVM address being deployed to. * @param _address OVM address being deployed to.
...@@ -1075,7 +1072,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -1075,7 +1072,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
// Actually execute the EVM create message, // Actually execute the EVM create message,
address ethAddress = Lib_EthUtils.createContract(_creationCode); address ethAddress = Lib_EthUtils.createContract(_creationCode);
if (ethAddress == address(0)) { if (ethAddress == address(0)) {
// If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag // If the creation fails, the EVM lets us grab its revert data. This may contain a revert flag
// to be used above in _handleExternalMessage. // to be used above in _handleExternalMessage.
...@@ -1813,6 +1810,9 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -1813,6 +1810,9 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
messageContext.isStatic = false; messageContext.isStatic = false;
messageRecord.nuisanceGasLeft = 0; messageRecord.nuisanceGasLeft = 0;
// Reset the ovmStateManager.
ovmStateManager = iOVM_StateManager(address(0));
} }
/***************************** /*****************************
...@@ -1851,7 +1851,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver { ...@@ -1851,7 +1851,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
if (created == address(0)) { if (created == address(0)) {
return (false, revertData); return (false, revertData);
} else { } else {
// The eth_call RPC endpoint for to = undefined will return the deployed bytecode // The eth_call RPC endpoint for to = undefined will return the deployed bytecode
// in the success case, differing from standard create messages. // in the success case, differing from standard create messages.
return (true, Lib_EthUtils.getCode(created)); return (true, Lib_EthUtils.getCode(created));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment