In this track: Advanced security reasoning
advanced · 4 MIN READ

Callback trust boundaries

A callback is an entry point that needs its own authentication.

LET’S PICTURE IT

A return phone call is not trustworthy merely because it uses a familiar greeting.

SEE IT FOR YOURSELF
A valid counter call, step by stepStep 1 / 4
A valid counter call, step by stepFunction requestincrement()No argumentsBefore executionstored count0A local teaching example with a defined starting stateIncoming callCheck function dispatchCheck coded conditionsRules passConditions passContinue executionA failed check can revert insteadCalculation0 + 1Result: 1Storage writecount = 1Persists if call succeedsCalculating a local value and storing it are separate stepsPersistent statecount1Later readGetter reports 1No new incrementState, logs and browser display have different roles

This example begins with count zero and a request to call increment(). No real contract is deployed.

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

Identify the expected caller

A pool, router or provider may call a designated callback during a workflow. The receiver must establish that the caller is the intended source.

Bind the active operation

Check the callback belongs to the current action and expected assets or amounts. A valid provider address alone may not bind every supplied parameter.

Protect repeated entry

Callbacks can reenter other functions or occur more than once under some designs. Keep operation state and accounting coherent across those paths.

Test unsolicited calls

Call the callback directly from an unrelated local account and with mismatched operation data. Such calls should not release assets or alter protected accounting.

Work through the boundary

external operation begins
expected provider callback arrives
validate provider + operation context
apply bounded accounting effects

A simplified local review scenario. The example establishes a question to test, not a guarantee of production safety.

QUICK CHECK · NO PRESSURE

Should a public callback accept any caller merely because its arguments decode?

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.