B.BlockAxis⌕ Search
Menu

EVM and smart contract composability

The Ethereum Virtual Machine executes instructions deterministically.

IntermediateContent revised · 13.09.20263 min reading · allow 5–10 more minutes for the workshopBlockAxis

Your learning plan

Trace execution and rollback

By the end, explain the diagram in your own words, solve the case and justify the correction.

Prerequisites : Ethereum accounts and transactions · Ethereum gas and EIP-1559

Level 2 · Intermediate →

Reading path · 10 / 35 · Intermediate

Key takeaway

The Ethereum Virtual Machine executes instructions deterministically.

The essentials

The Ethereum Virtual Machine executes instructions deterministically. Nodes starting from the same state and processing the same operations should reach the same result. A contract cannot freely fetch an arbitrary web price during execution; external information needs an explicit input mechanism such as an oracle.

How it works

Contracts can call other contracts, combining a swap, loan and repayment in one transaction. If a failure reverts the whole transaction, its state changes are rolled back while consumed computation still costs gas. Atomicity does not guarantee that the trade was economically sensible.

What to watch

Some deployed code is immutable; proxy systems can change the logic used at a stable address. Inspect upgrade authorities, delays and key controls. An audit of one implementation does not automatically cover a later upgrade. Composability also creates dependencies: another contract’s pause or failure can affect an otherwise correct application.

Understand the details

The EVM executes instructions deterministically against a given state. Contract storage persists between transactions; temporary execution memory does not. A call can invoke another contract, which may invoke more code. This composability is useful but expands the behavior that must be considered when reviewing a seemingly simple action.

Boundaries and common mistakes

A revert rolls back state changes within the reverted scope, while consumed gas still matters. A caller may deliberately handle a failed subcall, so not every internal failure means the entire transaction failed. Upgradeable proxies add another distinction: the address a user calls can delegate behavior to implementation code that may change under governance or administrator control.

The mechanism at a glance

  1. Initial state
  2. A calls B
  3. Success or handled failure
  4. Commit or revert scope
Trace execution and rollback. Conceptual map: read these four landmarks together with the explanation above.
Applied workshop · work at your own pace

Apply the lesson to a case

Contract A records an order, calls contract B, then requires a successful result. B fails and A reverts. Trace the order record, token movement and fee. Then consider how the result differs if A catches the failure and continues without moving tokens.

Why should an application inspect more than the top-level receipt?

Choose one answer.

Terms in this lesson
Oracle
A mechanism that supplies a contract with information originating outside its immediate execution context.
Gas
A measure of execution resources; gas units and the price per unit are separate quantities.
Prepare a correction note

Describe the passage and the proposed correction. This creates a local note for you to share; it sends nothing. Do not include personal or confidential information.