The whole transaction boundary, in one place.
signature -> nonce -> funds -> price and scope -> invariants -> charge
policy is node configuration. envelope is whatever arrived on the wire.
They are separate parameters because merging them was a vulnerability: an
earlier version destructured :system-writers and :schedule from the same
map that carried the signature, and the signature covers only
{:chain :sender :nonce :tx-data}. A sender could therefore declare
themselves a system writer, and supply a fee schedule that priced their own
transaction at zero. Both were demonstrated.
:chain is signed AND compared against the node's own configured chain
here. Signing it is not enough on its own -- if the verifier takes the chain
from the same envelope, an attacker simply signs for whatever chain they
declare, and the domain separation urd.consensus.auth exists to provide
evaporates.
Each step is cheaper than the one after it, and each can refuse alone. A
signature check is one Ed25519 operation against a key we hold; a nonce and
a balance are lookups; d/with walks the database and allocates; invariants
run Datalog someone else wrote. Doing the expensive half first is how a node
is made to work hard for a message anyone can send.
Settlement prices and authorizes the stamped user operations. For an accepted candidate, the boundary prepares a report over the complete settlement, including the fee and nonce. Guard dispatch and evaluation share that report. Storage accounting and commit happen in block/apply-block.
It applies the fee and the nonce bump without the sender's effects. A refusal that wrote nothing would leave the nonce unspent, and a transaction that can be retried for free after being refused is a free retry loop.
The whole transaction boundary, in one place.
signature -> nonce -> funds -> price and scope -> invariants -> charge
## Policy and envelope are separate arguments, deliberately
`policy` is node configuration. `envelope` is whatever arrived on the wire.
They are separate parameters because merging them was a vulnerability: an
earlier version destructured `:system-writers` and `:schedule` from the same
map that carried the signature, and the signature covers only
`{:chain :sender :nonce :tx-data}`. A sender could therefore declare
themselves a system writer, and supply a fee schedule that priced their own
transaction at zero. Both were demonstrated.
`:chain` is signed AND compared against the node's own configured chain
here. Signing it is not enough on its own -- if the verifier takes the chain
from the same envelope, an attacker simply signs for whatever chain they
declare, and the domain separation `urd.consensus.auth` exists to provide
evaporates.
## Why the order is what it is
Each step is cheaper than the one after it, and each can refuse alone. A
signature check is one Ed25519 operation against a key we hold; a nonce and
a balance are lookups; `d/with` walks the database and allocates; invariants
run Datalog someone else wrote. Doing the expensive half first is how a node
is made to work hard for a message anyone can send.
## Transaction reports
Settlement prices and authorizes the stamped user operations. For an
accepted candidate, the boundary prepares a report over the complete
settlement, including the fee and nonce. Guard dispatch and evaluation
share that report. Storage accounting and commit happen in block/apply-block.
## A refused transaction still transacts
It applies the fee and the nonce bump without the sender's effects. A
refusal that wrote nothing would leave the nonce unspent, and a transaction
that can be retried for free after being refused is a free retry loop.(admit conn policy envelope)Decide, price, and produce the transaction to apply.
policy is node configuration: {:chain c :schedule s}.
envelope is wire data: {:sender hex :public-key bytes :signature s :nonce n :tx-data [...]}.
Returns {:ok? bool :reason kw :fee n :apply [...] :violations [...]}.
Decide, price, and produce the transaction to apply.
`policy` is node configuration: `{:chain c :schedule s}`.
`envelope` is wire data: `{:sender hex :public-key bytes :signature s
:nonce n :tx-data [...]}`.
Returns `{:ok? bool :reason kw :fee n :apply [...] :violations [...]}`.(admit-prepared
conn
{:keys [chain schedule] :or {schedule cost/default-schedule} :as policy}
{:keys [sender public-key] :as envelope}
remaining)Admit an ordinary envelope against the current connection. On success, ::report is the speculative settlement shared with block storage checks. The block owns the optional single-threaded remaining-unit counter.
Admit an ordinary envelope against the current connection. On success, ::report is the speculative settlement shared with block storage checks. The block owns the optional single-threaded remaining-unit counter.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |