-
Notifications
You must be signed in to change notification settings - Fork 28
docs: add spec deviations page #499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MegaRedHand
wants to merge
6
commits into
main
Choose a base branch
from
docs/spec-deviations-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
319ff0a
docs: add spec deviations page to the book
MegaRedHand c7c4371
docs: address review feedback on spec deviations
MegaRedHand 977bcc3
Merge branch 'main' into docs/spec-deviations-page
MegaRedHand af6e5df
docs: drop stale leanSpec file paths; fix spec pointer
MegaRedHand 3909909
Merge branch 'main' into docs/spec-deviations-page
MegaRedHand 27a98a9
Merge remote-tracking branch 'origin/main' into docs/spec-deviations-…
MegaRedHand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Spec Deviations | ||
|
|
||
| ethlambda diverges from the [leanSpec](https://github.com/leanEthereum/leanSpec) | ||
| reference in a few places, mainly for performance reasons. This page lists those | ||
| deviations; each will be fleshed out with rationale, implementation notes, and | ||
| trade-offs over time. | ||
|
|
||
| ## Asynchronous signature aggregation with early stop | ||
|
|
||
| Aggregation runs off the main BlockChainServer actor loop and stops early once it ran out of time. | ||
|
|
||
| - **ethlambda:** at interval 2 the actor snapshots its state and spawns a `tokio::task::spawn_blocking` worker (`run_aggregation_worker`, `crates/blockchain/src/aggregation.rs:504`). The worker streams each finished group back as an `AggregateProduced` message; the actor loop is never blocked on XMSS work. | ||
| - **Early stop:** a `send_after(AGGREGATION_DEADLINE, ...)` timer cancels the session after 750ms (`AGGREGATION_DEADLINE`, `aggregation.rs:33`); the interval is 800ms (`MILLISECONDS_PER_INTERVAL`, `lib.rs:47`), leaving ~50ms for publish/propagation. The worker checks `cancel.is_cancelled()` before each job (`aggregation.rs:519`); in-flight jobs finish, remaining jobs are dropped. | ||
| - **leanSpec:** `aggregate()` is called inline and synchronously from `tick_interval` at interval 2 (`forks/lstar/spec.py`). It processes every group with no time budget, no worker, no cancellation. | ||
| - **Equivalence:** same XMSS proofs are produced; deviation is scheduling + a partial-result bound, not signature logic. | ||
|
|
||
| ## Attestation scoring on block building | ||
|
|
||
| Attestations are scored and selected when packing a block, rather than greedily included as they arrive. | ||
|
|
||
| - **ethlambda:** `select_attestations` (`crates/blockchain/src/block_builder.rs:170`) ranks candidate `AttestationData` entries by tier `Finalize > Justify > Build` (`enum Tier`, `block_builder.rs:473`). The within-tier order is tier-dependent (`EntryScore::ordering_key`, `block_builder.rs:517`): `Finalize`/`Justify` entries already cross 2/3, so newer chain progress leads (target slot, attestation slot, then new-voter count); `Build` entries only add marginal voters, so coverage leads (new-voter count, target slot, then attestation slot). `data_root` is the final deterministic tiebreak in both tiers. Each round picks the best candidate against a projected post-state, up to `MAX_ATTESTATIONS_DATA = 8` entries (`crates/common/types/src/block.rs:109`). | ||
| - **leanSpec:** `build_block` iterates entries sorted by `target.slot` (oldest first) and includes the first ones that pass filters (greedy, no scoring), re-running the loop as a fixed point when justification/finalization advances. Same cap: `MAX_ATTESTATIONS_DATA = 8` (`subspecs/chain/config.py`). | ||
| - **Equivalence:** both produce a valid block; ethlambda prioritizes attestations that advance finality/justification rather than processing in slot order. | ||
|
|
||
|
MegaRedHand marked this conversation as resolved.
Outdated
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.