Skip to content

Add leios-late-ib-inclusion to the Haskell simulator #413

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

Merged
merged 2 commits into from
Jun 25, 2025

Conversation

nfrisby
Copy link
Collaborator

@nfrisby nfrisby commented Jun 17, 2025

Closes #410.

, leiosLateIbInclusion :: Bool
-- ^ Whether an EB also includes IBs from the two previous iterations.
--
-- TODO Merely one previous iteration if 'pipeline' is 'SingleVote'?
Copy link
Collaborator Author

@nfrisby nfrisby Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Haskell simulator is configurable to use a single stage for voting (Vote) instead of two stages (VoteSend and VoteRecv).

The Short-to-Full spec only considers the two stage variant, when it specifies to include 3 iterations' IBs in each EB.

Would the Short-to-Full spec only include 2 iterations' IBs if Vote were a single stage? Should the Haskell simulator do that? @pagio @SupernaviX

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nfrisby I don't think we care about supporting the behavior when leios-vote-send-recv-stages is false, we've been assuming the uniform leios variant for a long time.

@bwbush bwbush self-requested a review June 17, 2025 17:13
@nfrisby nfrisby force-pushed the nfrisby/issue-410-LateIbs branch 3 times, most recently from e964fed to a1c11f2 Compare June 17, 2025 17:43
@nfrisby
Copy link
Collaborator Author

nfrisby commented Jun 17, 2025

FYI, I did some force pushes that.

  • fixed a bug
  • added tests (very similar to implementation, but that's largely because this first implementation is unoptimized)
  • ran fourmolu locally

@nfrisby nfrisby force-pushed the nfrisby/issue-410-LateIbs branch from a1c11f2 to 18f5c46 Compare June 17, 2025 17:47
@nfrisby nfrisby force-pushed the nfrisby/issue-410-LateIbs branch 2 times, most recently from 305acdb to 1d826bf Compare June 17, 2025 18:52
@nfrisby
Copy link
Collaborator Author

nfrisby commented Jun 17, 2025

I'm now expecting CI to build green.

ch1bo
ch1bo previously approved these changes Jun 18, 2025
Copy link
Member

@ch1bo ch1bo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and I love that you added a test for it!

@nfrisby nfrisby marked this pull request as draft June 18, 2025 17:54
@nfrisby
Copy link
Collaborator Author

nfrisby commented Jun 18, 2025

I converted this to a Draft PR because my study of the whole simulator has turned up at least three reasons this current diff is insufficient (see #413 (comment)).

Copy link
Collaborator

@bwbush bwbush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a global enough understanding of the implementation's inclusion logic to fully assess this, but changes seem to have the basics correct.

I'd very much like it if we could cite the specs as comments in the Haskell and Rust code. That direct link would make reviews much easier. Our use of google docs is not aligned very well with this style of commenting/citation.

@nfrisby nfrisby force-pushed the nfrisby/issue-410-LateIbs branch from 1d826bf to 9aca6be Compare June 23, 2025 18:55
@nfrisby nfrisby dismissed ch1bo’s stale review June 23, 2025 18:56

This diff is now much bigger than it was when Sebastian approved it.

@nfrisby nfrisby force-pushed the nfrisby/issue-410-LateIbs branch from 9aca6be to 801b110 Compare June 23, 2025 19:04
@nfrisby
Copy link
Collaborator Author

nfrisby commented Jun 23, 2025

Here's a partial record of my manual validation of this feature.

Record which commit I'm using.

$ git rev-parse HEAD
801b110e806e4ca16b29e138f5b2e15df128f819

Generate the config-on.log and config-off.log files.

$ cabal run ols -- sim short-leios --topology-file simulation/docs/topology-\[5-cores\].yaml --leios-config-file my-config.yaml --output-file catch-on --output-seconds 300
$ vi my-config.yaml   # disable leios-late-ib-inclusion
$ cabal run ols -- sim short-leios --topology-file simulation/docs/topology-\[5-cores\].yaml --leios-config-file my-config.yaml --output-file catch-off --output-seconds 300

(my-config.yaml generates many fewer IBs per stage and has a reduced stage length compared to the default file. Nothing crucial---just to make my runs faster and easier to parse.)

Demonstrate the EBs' byte sizes are roughly three times bigger.

$ cat catch-off.log | grep -e '"tag":"generated"' | grep -e '"kind":"EB"' | cut -f 2 -d']' | tr ',:' ' ' | awk '{print $1, $2}' | head
"size_bytes" 496
"size_bytes" 496
"size_bytes" 496
"size_bytes" 752
"size_bytes" 752
"size_bytes" 752
"size_bytes" 464
"size_bytes" 464
"size_bytes" 464
"size_bytes" 464
$ for i in off on; do echo $i; cat catch-$i.log | grep -e '"tag":"generated"' | grep -e '"kind":"EB"' | cut -f 2 -d']' | tr ',:' ' ' | awk '{x = x + $2} END {print x}'; done
off
26000
on
56240

Demonstrate the number of IBs per EB is roughly three times bigger.

$ cat catch-off.log | grep -e '"tag":"generated"' | grep -e '"kind":"EB"' | cut -f 1 -d']' | cut -c 50- | head -n5 
":"EB","id":"7-2","slot":50,"input_blocks":["16-0","49-0","58-1","58-2","63-1","67-0","68-1","77-0"
":"EB","id":"50-2","slot":50,"input_blocks":["16-0","49-0","58-1","58-2","63-1","67-0","68-1","77-0"
":"EB","id":"81-3","slot":50,"input_blocks":["16-0","49-0","58-1","58-2","63-1","67-0","68-1","77-0"
":"EB","id":"5-3","slot":60,"input_blocks":["11-0","13-0","17-0","26-0","27-0","29-1","41-0","49-1","51-0","54-0","66-0","68-2","68-3","88-0","90-0","93-0"
":"EB","id":"30-3","slot":60,"input_blocks":["11-0","13-0","17-0","26-0","27-0","29-1","41-0","49-1","51-0","54-0","66-0","68-2","68-3","88-0","90-0","93-0"
$ for i in off on; do echo $i; cat catch-$i.log | grep -e '"tag":"generated"' | grep -e '"kind":"EB"' | cut -f 2 -d'[' | cut -f 1 -d']' | tr -d '0123456789",' | head; done
off
--------
--------
--------
----------------
----------------
----------------
-------
-------
-------
-------
on
-----------------------------
-----------------------------
-----------------------------
-----------------------------------
-----------------------------------
-----------------------------------
-------------------------------
-------------------------------
-------------------------------
------------------------------

I also manually checked the slots of the IBs of an arbitrary EB with the feature on and they spanned more than one stage length.

@nfrisby
Copy link
Collaborator Author

nfrisby commented Jun 23, 2025

@bwbush suggested to double-check it works with Short-to-Full, since the default config file just uses short.

Both validations look right:

$ # used 'z' delimiter since initial EBs drop the endorser_blocks field since it's empty
$ for j in short full; do for i in off on; do echo $i-$j; cat catch-$i-$j.log | grep -e '"tag":"generated"' | grep -e '"kind":"EB"' | cut -f 2 -dz | tr ',:' ' ' | awk '{x = x + $2} END {print x}'; done; done
off-short
26000
on-short
56240
off-full
33872
on-full
63536
for i in off on; do echo $i; cat catch-$i-full.log | grep -e '"tag":"generated"' | grep -e '"kind":"EB"' | cut -f 2 -d'[' | cut -f 1 -d']' | tr -d '0123456789",' | head; done
off
--------
--------
--------
----------------
----------------
----------------
-------
-------
-------
-------
on
-----------------------------
-----------------------------
-----------------------------
-----------------------------------
-----------------------------------
-----------------------------------
-------------------------------
-------------------------------
-------------------------------
------------------------------

@nfrisby
Copy link
Collaborator Author

nfrisby commented Jun 24, 2025

We discussed the PR process in our working call today.

  • I realized I haven't worked on a non-deployed codebase for a while :D
  • So PRs in this repo don't need as much direct/immediate scrutiny as my instincts were telling me.
  • Basic idea: do what I've already done here. Some tests. Some manual validation. Ask Brian/Yves/Simon for high-level input and give them a heads up. Then merge.
  • Problems will (hopefully) become apparent as me/Brian/Yves do future work that directly or indirectly scrutinizes the merged PR.

My situation (urgent technical backfill on a prototype/research/brainstorming project) demanded some intensive onboarding. This created an opportunity for me to write down "stuff that wasn't immediately obvious".

I think such a document is valuable in its own right, but it also could become the basis of an architectural decision record (ADR). So in addition to the above list, Non-trivial PRs should also amend that ADR.


I already had drafted a summary of my onboarding, so I'll add that doc in a separate PR and then rebase this one on that doc, add an amendment, and then merge it.

@nfrisby nfrisby force-pushed the nfrisby/issue-410-LateIbs branch from 801b110 to 3dea699 Compare June 25, 2025 14:42
@nfrisby
Copy link
Collaborator Author

nfrisby commented Jun 25, 2025

I rebased so that the SimulatorModel.md is in-place and also amended it according to the changes in this PR.

I'm Merging now. Beyond the code review and my ad-hoc manual tests, the idea is that the Agda trace-verifier and/or confusing disagreements with the Rust simulator will eventually any catch bugs in this PR.

@nfrisby nfrisby marked this pull request as ready for review June 25, 2025 14:48
@nfrisby nfrisby merged commit b5993e0 into main Jun 25, 2025
11 of 13 checks passed
@nfrisby nfrisby deleted the nfrisby/issue-410-LateIbs branch June 25, 2025 14:55
@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in Consensus Team Backlog Jun 25, 2025
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.

Add LateIbInclusion to Haskell simulator
4 participants