In this track: Read logs and failures
advanced · 4 MIN READ

Why revert bytes can be spoofed

Recognizing an error format does not authenticate its author.

LET’S PICTURE IT

Anyone can print a form that resembles another organization’s form.

SEE IT FOR YOURSELF
Follow a revert and decode its error dataStep 1 / 4
Follow a revert and decode its error dataRequested actionTransfer 100 raw unitsExample inputsAvailable balance40 raw unitsCheck the ruleA deliberately failing local scenario, not a live transactionCondition fails100 > 40Request rejectedRollbackNo successful transferConsumed gas still mattersTop-level failure and a caught nested failure have different contextsError selector0x08c379a04 bytesMessage tailNot enough tokensDynamic string encodingCustom errors and Panic use different selectors and schemasDecoded messageNot enough tokensA diagnostic clueFurther evidenceCaller and code pathRelevant stateError bytes can be constructed by code; decoding is not authentication

This fictional call requests a transfer of one hundred raw units while the relevant balance is forty.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Understand what decoding proves

Successful decoding shows that bytes fit a supplied schema. It does not prove which source declaration, contract implementation or condition originally produced them.

A contract can construct matching bytes

Code can return a standard error selector and chosen arguments without executing the expected failing condition. A familiar custom error is also reproducible by another contract.

Handle selector ambiguity

Selectors use only four bytes. Distinct signatures can collide, so matching a selector does not uniquely establish a declaration over every possible interface.

Tie conclusions to a known frame

Use the called address, execution trace, verified code and appropriate ABI together. Keep diagnostic messages separate from authorization or balance evidence.

Inspect the example

0xcf47918100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000005

These bytes can be constructed by any program with this schema and values.

TURN UNDERSTANDING INTO PRACTICEOpen the Revert decoder →
QUICK CHECK · NO PRESSURE

What does a successful error decode establish?

Your progress stays in this browser.
Keep exploring the original referenceSolidity documentation ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.