Skip to content

Hide DAG implementation from protocol specification#28

Merged
pkel merged 12 commits into
masterfrom
hide-dag-from-protocols
Dec 3, 2022
Merged

Hide DAG implementation from protocol specification#28
pkel merged 12 commits into
masterfrom
hide-dag-from-protocols

Conversation

@pkel

@pkel pkel commented Dec 1, 2022

Copy link
Copy Markdown
Owner

Currently, details of the DAG implementation leak into the protocol specification.
Implies that protocol specs cannot be used with different DAG.
I want to play around with a persistent/immutable DAG implementation.
This can may enable forkable simulations in the future.

In this PR I do the first step in this direction. I hide the DAG implementation from the protocol specification API.

The better part of the work is done. But a few todos accumulated:

  • In blockDAG, type key is not needed. We can compare blocks directly imo.
  • In protocols, type state = block should be something like type state = Preferred block. This will improve error messages. Skipped, not necessary, increases diff, orthogonal.
  • There was no good reason to renamemax|min_pow to max|min_hash in the spec API. Undo!
  • tailstorm[ll] heuristic quorum uses hashtbl where it could use a Set.
  • Is Ssz_tools.State8 used anywhere? If not, drop!
  • I removed the distinction between localview and globalview. May be unwise. Revert? No. I like the new interface.
  • In simulator we use 'prot_data type variable. This can now be 'a.
  • Visually verify that tailstorm[ll] reward schemes are correct.
  • Consider using simpler DAG implementation in ethereum_test.ml. Have no simpler implementation. Thus ignore.
  • Align interface of old DAG implementation with new spec interface.
  • Remove redundancy in old dag.ml implementation and new dagtools.ml

pkel added 9 commits November 30, 2022 21:16
This allows to replace the DAG implementation with something else.
I do that because at some point I want to try a persistent
implementation that allows to fork simulations. Time-travelling might
also be useful at some point.

WIP. I have no time to fix all the protocols now.
Some protocols seem to work. I still have problems with the tailstorms.
It seems that some prior uses of interate_ancestors were relying on the
partial order. The new confirmed_votes function does not return
partially sorted stuff.

backlog:
- blockDAG type key is not needed. We can compare blocks directly imo
- tailstorm[ll] acc_votes should use set instead of list
- type state = block should be something like type state = Preferred block
- there was no good reason to rename max|min_pow to max|min_hash. Undo!
- Heuristic quorum uses hashtbl where is could use set
- confirming|ed_votes should assert that argument is block. Otherwise abuse
- Is Ssz_tools.State8 used anywhere?
- Use blockdag.neq where applicable. I replaced it with eq in some places
- I removed the distinction between localview and globalview. maybe unwise. revert?
Backlog:
- blockDAG type key is not needed. We can compare blocks directly imo
- type state = block should be something like type state = Preferred block
- there was no good reason to rename max|min_pow to max|min_hash. Undo!
- Heuristic quorum uses hashtbl where it could use set
- Is Ssz_tools.State8 used anywhere?
- I removed the distinction between localview and globalview. maybe unwise. revert?
- In simulator we use 'prot_data type variable. this can now be 'a
- Visually verify that tailstorm[ll] reward schemes are correct
Previously, we accumulated votes, then filtered them.
This fix avoids returning unconnected sets of votes if the agent decides
to ignore defender votes after having extended upon such a vote.

Still WIP, but protocol tests seem to work now.

Backlog:
- blockDAG type key is not needed. We can compare blocks directly imo
- type state = block should be something like type state = Preferred block
- there was no good reason to rename max|min_pow to max|min_hash. Undo!
- Heuristic quorum uses hashtbl where it could use set
- Is Ssz_tools.State8 used anywhere?
- I removed the distinction between localview and globalview. maybe unwise. revert?
- In simulator we use 'prot_data type variable. this can now be 'a
- Visually verify that tailstorm[ll] reward schemes are correct
Backlog:
- blockDAG type key is not needed. We can compare blocks directly imo
- type state = block should be something like type state = Preferred block
- there was no good reason to rename max|min_pow to max|min_hash. Undo!
- Heuristic quorum uses hashtbl where it could use set
- Is Ssz_tools.State8 used anywhere?
- I removed the distinction between localview and globalview. maybe unwise. revert?
- In simulator we use 'prot_data type variable. this can now be 'a
- Visually verify that tailstorm[ll] reward schemes are correct
Dag now has a Block sub-module which can be passed to Dagtools.Make and
Set.Make
Comment thread experiments/simulate/csv_runner.ml Outdated
Comment thread simulator/gym/engine.ml Outdated
Comment thread simulator/lib/intf.ml Outdated
Comment thread simulator/protocols/bk.ml
@pkel pkel force-pushed the hide-dag-from-protocols branch from a8c3a9b to fb5299c Compare December 3, 2022 09:16
@pkel pkel merged commit 9a08c2a into master Dec 3, 2022
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.

1 participant