Skip to content

Comments

WIP Evm docs updates#210

Open
evanorti wants to merge 34 commits intomainfrom
evm-docs-updates
Open

WIP Evm docs updates#210
evanorti wants to merge 34 commits intomainfrom
evm-docs-updates

Conversation

@evanorti
Copy link
Contributor

Update EVM docs files and streamline

Add a single comprehensive EVM compatibility guide (evm/next/documentation/evm-compatibility.mdx) that documents supported EIPs/ERCs/opcodes, tooling, precompiles, JSON‑RPC behavior, and Cosmos-specific capabilities (finality, fees, addresses, chain IDs, performance). Remove now-redundant subpages: eip-2935.mdx, eip-7702.mdx, eip-reference.mdx, and overview.mdx to centralize compatibility information and avoid duplication.
@evanorti evanorti marked this pull request as ready for review February 17, 2026 22:12

### Transaction Type Routing

**Ethereum transactions (`MsgEthereumTx`)**: Routed to the EVM TxPool, which handles nonce gaps, promotion, and eviction. Executable transactions are then broadcast via CometBFT P2P.
Copy link
Member

Choose a reason for hiding this comment

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

This will definitely change after Krakatoa

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was told that the mempool stays as-is, and krakatoa is an opt-in feature, so we'll put krakatoa docs in an "experimental features" section.

The mempool setup is split across two locations:

### Step 1: Add EVM Mempool to App Struct
- [`evmd/mempool.go`](https://github.com/cosmos/evm/blob/main/evmd/mempool.go) — `configureEVMMempool` and `createMempoolConfig`, called automatically from `NewExampleApp`
Copy link
Member

Choose a reason for hiding this comment

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

What does "automatically" mean?

Copy link
Member

Choose a reason for hiding this comment

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

This is something we need to include to app.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to:

- [`evmd/mempool.go`](https://github.com/cosmos/evm/blob/main/evmd/mempool.go) — `configureEVMMempool` and `createMempoolConfig`, which must be called from your `app.go` after `setAnteHandler`

wdyt?


## Enabling Precompiles

Precompiles are enabled via the `active_static_precompiles` parameter in the `vm` module. Only addresses listed here are callable at runtime. For the full list of built-in precompiles and their addresses, see the [precompiles overview](/evm/next/documentation/smart-contracts/precompiles/overview).
Copy link
Member

Choose a reason for hiding this comment

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

You also need to wire them in during the app.go wiring (either with DefaultPrecompiles) or with your own set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. please review the file changes

}
```

To enable only a specific subset, pass the addresses explicitly. Addresses must be in sorted order:
Copy link
Member

Choose a reason for hiding this comment

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

Addresses must be in sorted order:

I'm actually not sure this is true - what tells you this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Sorted order is required for determinism. This is enforced by ValidatePrecompiles in x/vm/types/params.go — validation fails with "precompiles need to be sorted" if slices.IsSorted(precompiles) returns false.
"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vladjdk I think it's enforced

---

## Available Precompiles
Precompiles are smart contract interfaces deployed at fixed addresses where the implementation runs as native Go code rather than EVM bytecode. In standard Ethereum, precompiles are stateless and handle things like signature verification and hashing. In Cosmos EVM, they can also be stateful — reading from and writing to Cosmos SDK module state outside the EVM.
Copy link
Member

Choose a reason for hiding this comment

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

I feel like we may have repeated this 3 times

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but in different places like the faq so I think it's ok.

This is what makes them powerful: a smart contract can call the staking precompile to delegate tokens, the governance precompile to submit a proposal, or the IBC precompile to send tokens cross-chain — all using a standard Solidity interface, all within a single transaction.

Precompiled contracts provide direct, gas-efficient access to native Cosmos SDK functionality from within the EVM. Build powerful hybrid applications that leverage the best of both worlds. This page provides an overview of the available precompiled contracts, each with detailed documentation on its usage, Solidity interface, and ABI.
Calls are bidirectional. EVM contracts can call precompiles, and precompiles can call back into EVM contracts. When a precompile is invoked, execution routes from the EVM through the corresponding Cosmos SDK module and returns the result to the EVM for continued execution. Gas is metered across both environments.
Copy link
Member

Choose a reason for hiding this comment

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

I don't want to specify that they can call back into the EVM. Let's just say that it's a window into the Cosmos SDK space

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"Precompiles act as a window into the Cosmos SDK: when a precompile is invoked, execution routes from the EVM through the corresponding Cosmos SDK module and returns the result to the EVM for continued execution. Gas is metered across both environments."

// WRONG: Assuming Ethereum's 18 decimals
uint256 amount = 1 ether; // 1000000000000000000
staking.delegate(validator, amount); // Delegates 1 trillion tokens!
Cosmos chains typically use 6 decimals. Passing a value like `1000000000000000000` (1 ETH in wei) to a precompile on a 6-decimal chain will be interpreted as 1 trillion tokens.
Copy link
Member

Choose a reason for hiding this comment

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

NO

Specify 18 decimals on Cosmos chains. There's no modern reason why you should use 6

Copy link
Contributor Author

@evanorti evanorti Feb 24, 2026

Choose a reason for hiding this comment

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

@vladjdk

is this good?

<Warning>
  All precompile contracts should use Ethereum's standard 18 decimals.

  Although typical Cosmos chains use 6 decimals, EVM chains should use 18 decimals.
  Always check your chain's decimal precision before interacting with a precompile.
</Warning>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants