Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

fork choice test format #12

@djrtwo

Description

@djrtwo

Issue

We need to come to consensus on a fork choice test case format relatively soon. I'd argue that this should come before the full-blown state tests because it can test a very isolated component of the spec before everything else is done.

As I began to sculpt the test case format, I realized there are two potential paths -- one that is very abstract wrt to the actual mechanics of the spec or one that is more concrete using validators/attestations in the test case.

I would like to air on the side of abstract for simplicity but am worried that if it is too abstract, it might actually make more work on client side to get tests running.

An abstract version of the fork choice test case would look something like the following, where blocks just defines abstractly defines a block tree, weights is the integer amount of total weight given to a block (akin to the latest attestations), and head is the result of running the fork choice on the block tree + weights.

blocks:
  - id: <block-id>
    parent: <block-id>
weights:
  # if no matching key for block-id, weight = 0
  - <block-id>: <int>
  - ...
head: <block-id>

The benefit is that it is very easy to reason about and can easily even test the fork choice against an implementation not deeply embedded in a 2.0 implementation. The downside is that a client must be able to take this structure and convert it into something usable (create real blocks, validators, and attestations of blocks) or they must be able to take the real spec objects and distill them into this more abstract form to run their fork choice.

A concrete version would have an actual list of validators, weights, slots for blocks, and latest attestations.

I lean in the direction of the abstract version but want to get more input before I work toward a polished proposal.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions