Skip to content

docs(evm): explain how the contracts process a transaction - #2181

Open
atharrva01 wants to merge 5 commits into
LFDT-Panurus:feature/evm-network-driverfrom
atharrva01:evm-contract-flow-docs
Open

docs(evm): explain how the contracts process a transaction#2181
atharrva01 wants to merge 5 commits into
LFDT-Panurus:feature/evm-network-driverfrom
atharrva01:evm-contract-flow-docs

Conversation

@atharrva01

@atharrva01 atharrva01 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

The implementation guide described the contracts as they were sketched rather than as they were built. It named an entry point that does not exist (applyStateUpdate), emitted an event that does not exist (StateUpdateEvent), and drew one contract doing work that is actually split across two.

This replaces that with a walkthrough aimed at somebody meeting the contracts for the first time:

  • it opens with what usually confuses people, that the chain validates nothing and verifies no proofs, since everything else follows from that
  • a field by field tour of the StateDelta, which the guide never showed even though every diagram referred to it
  • the six sources in contracts/src, and which of them actually reach an address
  • deployment and transaction processing as separate phases, since a different set of contracts takes part in each
  • the sequence of one transaction, with a note on why the contract recomputes the digest itself instead of being handed one
  • the checks in the order they run

Failures are a table instead of a diagram: thirteen errors, what each means and what usually causes it. Somebody holding a reverted receipt wants to look up a name, not trace a flowchart.

The phase split came out of Angelo's question on which contracts are involved in processing versus deployment, and whether Clones is only there for the tests. It is not: TokenStateFactory.create calls it for every clone.

Writing that up caught two things the first draft had wrong. The clone is an EIP-1167 proxy, so it delegatecalls the implementation on every call and three addresses take part in processing rather than two. And StateCommitted is emitted at the clone's address, which is the address the finality layer filters eth_getLogs on.

Design section 3 gets a pointer to it, per rule R5.

The diffs show mermaid as source, so the diagrams are easier to judge rendered:

https://github.com/atharrva01/panurus/blob/evm-contract-flow-docs/docs/services/network-ethereum.md#how-the-contracts-interact

@adecaro
adecaro force-pushed the feature/evm-network-driver branch from 90020d1 to a68d31d Compare August 12, 2026 13:15
The implementation guide described the contracts as they were sketched, not as
they were built. It named an entry point that does not exist, emitted an event
that does not exist, and showed one contract doing work that is split across
two.

Replaces that with a walkthrough written for somebody meeting the contracts for
the first time. It opens with the thing that confuses newcomers most, that the
chain validates nothing and verifies no proofs, then covers the StateDelta field
by field, the three contracts and why they are separate, the sequence of one
transaction, and the checks in the order they run.

Failures are a table rather than a diagram. Thirteen errors, what each means and
what usually causes it, because somebody holding a reverted receipt wants to
look up a name, not trace a flowchart.

Design section 3 gains a pointer to it, per rule R5.

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
Says which of the six sources actually reach an address, then walks the
deployment phase and the processing phase separately. Clones is production
code used by the factory, not test scaffolding, so say that too.

Also corrects the processing picture: the clone delegatecalls the
implementation, so three addresses take part rather than two, and
StateCommitted is emitted at the clone's address, which is what the
finality layer filters eth_getLogs on.

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
@atharrva01
atharrva01 force-pushed the evm-contract-flow-docs branch from 3214768 to 1e0337c Compare August 12, 2026 13:47
The initiator no longer builds a StateDelta (LFDT-Panurus#2229): only the endorser's
DeltaFactory does, and that is where the aligned metadata lists actually
come from. "The driver" was accurate before that change and misleading
after it.

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
@atharrva01

Copy link
Copy Markdown
Contributor Author

One line here (the MetadataLengthMismatch row) attributed aligned metadata to "the driver", which was accurate at the time. #2229 moves StateDelta construction so only the endorser's translator does it, so I've updated the wording to match. No other content in this PR was affected; the rest already described the endorser-returns-the-delta shape correctly.

The v0.17.0 upgrade updated the tracked modules and missed this one, so
nothing under x/token/services/network/evm builds until go.mod is tidy.

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
LFDT-Panurus#2180 enabled containedctx and fixed the ttx occurrence. The evm module is a
separate Go module and was not linted in that pass, so make lint has been
failing on it since.

Neither field can be dropped. Ledger.ctx exists because driver.GetStateFnc
passes no context to GetState, and fakeContext.ctx exists because it
implements view.Context, whose Context() method has to return one.

Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
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