For the complete documentation index, see llms.txt. This page is also available as Markdown.

4. How Rome runs your code

How a Rome transaction becomes Solana transactions, why most calls run atomically, and what changes when a call is too big.

Your Solidity runs unchanged. What changes is where it runs: inside a Solana program, under Solana's limits. This lesson gives you the picture you need to predict what a call will cost and when it will fail.

What you'll learn

  • The path a transaction takes from your wallet to a Solana validator and back to an EVM receipt.

  • The difference between atomic and iterative execution, and why you want atomic.

  • Which Solana limits reach your Solidity: compute, size, account count, locks.

  • How to measure what a call really costs.

Before you start

  • Finish 3. Your first contract on Hadrian. You need a deployed contract and one transaction you sent to it.

  • Keep that transaction hash at hand. You will open it on the explorer at the end of this lesson.

The path of one transaction

You sign an ordinary EVM transaction and send it to the Rome proxy with eth_sendRawTransaction. The proxy does not forward it yet. It first runs the call off-chain in an emulator that executes the same EVM logic as the on-chain program. The emulation tells it three things: how much gas the call needs, which Solana accounts the call touches, and whether the call fits in one Solana transaction.

The proxy then wraps your call as Solana instructions and sends them. The Rome EVM program, which is a normal Solana program, interprets your bytecode. State changes land in Solana accounts. An indexer reads the result and produces the EVM block and receipt your tools expect.

Every EVM address maps to a Solana account owned by the Rome program. Your contract's balance, nonce, code and storage are all Solana accounts. That is why the proxy must know the account list before it sends: Solana requires every account to be named up front.

Read the full lifecycle in Execution model.

Atomic first

Most calls run in one Solana transaction. Rome calls this atomic execution (VmAt). It is all-or-nothing: if any step fails, the whole call reverts. A transfer, a swap and most DeFi calls fit. Some do not: an Aave borrow on Hadrian needed more than one Solana transaction.

One atomic call has a budget of about 1.4M compute units. These limits shape every call:

Limit
What it means for you

Compute

About 1.4M CU shared by the EVM work and every program you call

Accounts

64 addresses, counting Rome's own accounts and everything your CPIs touch

Size

4 KB per Solana transaction; larger EVM payloads, such as big deployments, are staged through a holder account and the SDK handles this for you

Contract size

24 KB, as on Ethereum

The full list, with the values, is in Constraints.

Iterative when a call is too big

If the emulator finds that a call does not fit, Rome runs it iteratively (VmIt). The call is cut into legs. Each leg is its own Solana transaction and runs as many opcodes as its compute budget allows. Between legs the VM state is saved in a holder account and the next leg picks it up.

Iterative execution works, but it has a cost:

  • A session ends after 160 legs. Past that, it releases its locks and commits nothing.

  • The session locks its balance and storage accounts for a few seconds, renewed each leg. An atomic write to a locked account is refused with AccountLocked, and the client resends.

  • Calls that make Solana CPIs on the legacy track (the CpiProgram and HelperProgram calls of lesson 5) cannot run iteratively at all. They have to fit atomic.

  • On the Solana lane, a wallet that signs its own legs prompts the user once per leg.

The design rule follows: shape each user action to fit one atomic transaction. If a flow is bigger, split it into two user actions rather than lean on iterative mode. Lesson 5 returns to this when you call Solana programs.

What you pay

Rome counts the cost of a call in Solana lamports: signature fees, a fixed toll, rent for any account the call creates. One gas unit stands for one lamport of cost. The gas price converts that to the chain's gas token, which is USDC on Hadrian and Rubicon.

Rent is the part that surprises people. The first transfer to an address that has never been used creates accounts, so it costs far more than a repeat transfer. Expect high gas on a first touch and ordinary gas afterwards. The worked numbers are in How Solana and the EVM meet on Rome.

Measure, don't guess

EVM gasUsed is not a faithful stand-in for Solana compute. On Rome one gas unit is one lamport of cost, so eth_estimateGas sizes your gas limit but tells you nothing about compute units. Read compute from the Solana side. Via links the Solana transaction from its "Settled in" row, and the Solana explorer shows its compute units. In code, get the Solana signatures behind an EVM hash with rome_solanaTxForEvmTx, fetch each with Solana's getTransaction and maxSupportedTransactionVersion: 1, and read computeUnitsConsumed. An iterative call has one transaction per leg. Compute budget has typical costs per operation and the cheap habits that cut them: constants for program IDs, cached PDA derivations, fewer accounts.

Two behaviors differ from Ethereum and are worth knowing now:

  • Rome has no per-opcode gas meter. The gas you pass to a CALL is not enforced and there is no 2300-gas stipend. Guard against reentrancy explicitly.

  • block.number is the Solana slot and block.timestamp is the Solana clock.

Check yourself

Open your transaction from lesson 3 on the Hadrian explorer. Find the network link in Hadrian and the explorer notes in Via explorer.

Observe two things:

  1. The Solana transaction that settled your call, from the "Settled in" row.

  2. The compute units it consumed, on the Solana explorer.

Compare that number with the 1.4M budget. A simple call uses a small share of it.

Then answer:

1. Why does the proxy emulate a call before it sends it?

Solana needs every account named up front, and the proxy has to know whether the call fits one transaction. Emulation finds the touched accounts, estimates gas and decides atomic or iterative.

2. A call makes a legacy-track CPI (the `CpiProgram` and `HelperProgram` calls of lesson 5) and needs more than 1.4M CU. What happens?

It cannot run. Legacy-track CPIs are refused inside an iterative transaction, so the call must fit one atomic transaction. Split the work into smaller user actions.

3. Why is the first transfer to a new address expensive?

Rome creates Solana accounts for it, and the rent for those accounts is billed to the sender as gas.

Next

5. Call Solana from Solidity

Last updated

Was this helpful?