Execution Context

When the EVM executes a smart contract, a contextarrow-up-right is created for it. The context consists of the following.

  • The Code

    • The contract bytecode which is immutable, it is stored on-chain and referenced using a contract address.

  • The Stack

    • The call stack, an empty stack is initialised for each EVM contract execution.

  • The Memory

    • The contract memory, a clean memory is initialised for each EVM contract execution.

  • The Storage

    • The contract storage which is persisted across executions, it is stored on-chain and is referenced via a contract address and its storage slot.

  • The Call Data

    • The input data for a transaction.

  • The Return Data

    • The data returned from a contract function call.

CALL vs. DELEGATECALL

CALL executes a function in the context of the contract it was defined, while DELEGATECALL inherits the execution context, meaning that the function will behave as it was defined in the contract that’s using DELEGATECALL

For DELEGATECALL we have the following input variables;

CALL has exactly the same input variables with one additional value.

References:

https://www.evm.codes/aboutarrow-up-right

Last updated