Skip to content

spec(mempool/dog): Add spec of Flood gossip protocol - #4476

Merged
hvanz merged 50 commits into
mainfrom
hvanz/flood-spec-4318
Nov 15, 2024
Merged

hvanz merged 50 commits into
mainfrom
hvanz/flood-spec-4318

Conversation

@hvanz

@hvanz hvanz commented Nov 12, 2024 •

Copy link
Copy Markdown
Collaborator

Contributes to #4318

The DOG spec is based on Flood's spec (#4477)

README.md

@hvanz hvanz added mempool spec Specification-related labels Nov 12, 2024
@bugarela

Copy link
Copy Markdown

Regarding Quint <-> markdown, we have currently two options and I'm happy to work on improving them or setting up something new that would be useful for this kind of thing.

  1. Literate specifications, like a recent one here: https://github.com/left-curve/left-curve/blob/c440d02c2b7e15c92ca9c4fed9a589bf1f8dc3fc/grug/jellyfish-merkle/spec/invariants.md (check the raw file and the rendered one. A complete checkable Quint spec is produced out of this file, so it is a live document that we can check on the CI for example)
  • This looks great and enables all the freedom of markdown
  • It's a bit annoying to make changes to the Quint model with this. What I do is to change the acutal .qnt file and, once I'm done, reflect the changes on the markdown and make sure the tangled (generated from md) file is the same the .qnt one
  • It might be possible to write tooling that typechecks quint snippets inside markdown, and then we would be able to edit markdown directly. This is what noteeboks (likye jupyter notebook) do.
  1. Generating markdown out of Quint comments. This is currently possible with the quint docs cli command
  • The current format is tuned for generating builtin operator documentation, and it's probably not a good general format. Idk if we could come up with a general format that would be useful for multiple different projects, as each project might want to organize the markdown file in a specific way.
  • This requires that all content from markdown is embedded in Quint comments, which I think would either degrade the markdown quality or the quint file quality.
  • This doesn't have the problem of having to update something when you update the model, as the markdown file can be easily re-generated

@hvanz

hvanz commented Nov 13, 2024

Copy link
Copy Markdown
Collaborator Author

Thanks @bugarela! I like your literate spec example and I will give it a try. I couldn't find the qnt files it imports (hashes, tree, etc.). Where are those? And, do you keep the generated quint file somewhere in the repo?

I tried quint docs and it outputs only the declarations with signatures but it ignores all the comments. Does it expect a special format? I couldn't find documentation in the website.

@bugarela

Copy link
Copy Markdown

Thanks @bugarela! I like your literate spec example and I will give it a try. I couldn't find the qnt files it imports (hashes, tree, etc.). Where are those? And, do you keep the generated quint file somewhere in the repo?

This is all under a private repo for now, we only sent that md file to the public repository at this point.

I tried quint docs and it outputs only the declarations with signatures but it ignores all the comments. Does it expect a special format? I couldn't find documentation in the website.

Yes, it only considers docstrings, which in Quint are triple-slashed comments before top level definitions/modules (copied from rust)

/// foo is bla bla
val foo = 1

/// my def is cool
pure def f(x) = {
  // This comment cannot be triple slash as it does not come before a top-level definition
  x + 1
}

@hvanz

hvanz commented Nov 14, 2024 •

Copy link
Copy Markdown
Collaborator Author

I changed the Quint files for Markdown files with Quint code snippets. I think this format is much better.

@bugarela check out how I structured all the Quint code at the end of the md files using macros. In this way I don't have to insert line breaks in html comments and as a result the md file is much cleaner. Also, indentation is not lost on the generated Quint file.

@bugarela

Copy link
Copy Markdown

I considered using that! I like how it solves indentation, but I don't like not having a line between each definition. If I were to use this format, I'd still keep my line break comments 😅

@cason

cason commented Nov 14, 2024

Copy link
Copy Markdown

but I don't like not having a line between each definition.

This renders the code super hard to read indeed.

@hvanz

hvanz commented Nov 14, 2024

Copy link
Copy Markdown
Collaborator Author

Obviously line breaks between definitions is better, and even some comments would help when reading the code, but the quint code in this spec is not to read, now that we have the markdown files. I hope by the time we need to expand the specs with tests, models, etc. (not planned for the moment) there will be a quint fmt tool ready 😉 Otherwise we'll need to resort to put line breaks in comments.

@cason

cason commented Nov 15, 2024

Copy link
Copy Markdown

. I hope by the time we need to expand the specs with tests, models, etc. (not planned for the moment) there will be

Ok, I would say we merge this PR as it is, but can you add this follow-up work to the existing issue or a new one?

@hvanz
hvanz added this pull request to the merge queue Nov 15, 2024
Merged via the queue into main with commit 54cc079 Nov 15, 2024
@hvanz
hvanz deleted the hvanz/flood-spec-4318 branch November 15, 2024 15:53

@melekes melekes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

❤️

github-merge-queue Bot pushed a commit that referenced this pull request Nov 29, 2024
Solves #4318

Based on #4476 


[README.md](https://github.com/cometbft/cometbft/tree/hvanz/dog-spec-4318/spec/mempool/gossip)

---------

Co-authored-by: Andy Nogueira <[email protected]>
Co-authored-by: Daniel <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
hvanz added a commit to InjectiveLabs/cometbft-archived that referenced this pull request Mar 12, 2025
Contributes to cometbft#4318

The DOG spec is based on Flood's spec (cometbft#4477)


[README.md](https://github.com/cometbft/cometbft/tree/hvanz/flood-spec-4318/spec/mempool/gossip/)

---------

Co-authored-by: Andy Nogueira <[email protected]>
Co-authored-by: Daniel <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
hvanz added a commit to InjectiveLabs/cometbft-archived that referenced this pull request Mar 12, 2025
maxim-inj pushed a commit to InjectiveLabs/cometbft-archived that referenced this pull request Mar 15, 2025
Contributes to cometbft#4318

The DOG spec is based on Flood's spec (cometbft#4477)


[README.md](https://github.com/cometbft/cometbft/tree/hvanz/flood-spec-4318/spec/mempool/gossip/)

---------

Co-authored-by: Andy Nogueira <[email protected]>
Co-authored-by: Daniel <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
maxim-inj pushed a commit to InjectiveLabs/cometbft-archived that referenced this pull request Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mempool spec Specification-related

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

mempool/dog: Write spec

5 participants