question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Spike: Investigate how to handle versioned datastructures [3D]

See original GitHub issue

Description

As part of #3356, we’ll need to figure out how to handle data structures (like BeaconState) that change format across forks.

See the eth2 spec repo for details on the proposed changes to BeaconState. Basically, 2 fields on BeaconState (previous_epoch_attestations and current_epoch_attestations) will be replaced with 2 new fields: previous_epoch_participation and current_epoch_participation. Additional data structure changes are involved in implementing light-client support as well.

Issues we want to consider:

  • How are versioned data structure classes organized?
    • Do we have completely distinct versions: BeaconStateV1, BeaconStateV2?
    • Do we try to somehow generify the optional fields: BeaconState<TVersionedFields>?
    • Do we have an overarching BeaconState interface with more specific implementations: BeaconStateV1 implements BeaconState?
  • How does versioned core logic that operates on a BeaconState work?
  • How is (de)serialization handled by the Database
    • Likely we will need to delegate to a deserializer that we pull from the SpecProvider. This deserializer could take the serialized Bytes, extract the state’s slot or fork info, use that to find the right deserializer instance, and then deserialize the state to the right type.

Outcomes:

  • Propose a general plan for how to address the outlined issues, get feedback from the team
  • If appropriate, think about tickets / subtasks we might want to add

Time box: 3 days.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mbaxtercommented, Feb 4, 2021

Another option could be something like:

public interface BeaconState {
  // Common fields
  UInt64 slot();
  ListViewRead<Validator> validators();
  ListViewRead<UInt64View> getBalances();
  // etc

  // Variable fields
  Optional<SSZList<PendingAttestation>> maybeGetPrevious_epoch_attestations();
  Optional<SSZList<PendingAttestation>> maybeGetCurrent_epoch_attestations();

  Optional<SSZList<SSZVector<BitView>>> maybeGetPrevious_epoch_participation();
  Optional<SSZList<SSZVector<BitView>>> maybeGetCurrent_epoch_participation();
}

public interface BeaconStateGenesis extends BeaconState {
  SSZList<PendingAttestation> getPrevious_epoch_attestations();
  SSZList<PendingAttestation> getCurrent_epoch_attestations();
}

public interface BeaconStateHF1 extends BeaconState {
  SSZList<SSZVector<BitView>> getPrevious_epoch_participation();
  SSZList<SSZVector<BitView>> getCurrent_epoch_participation();
}
1reaction
Nashatyrevcommented, Feb 4, 2021

Likely we will need to delegate to a deserializer that we pull from the SpecProvider. This deserializer could take the serialized Bytes, extract the state’s slot or fork info, use that to find the right deserializer instance, and then deserialize the state to the right type.

We may potentially have structures modified in the future which doesn’t contain slot info. So probably makes sense to come up with some generic solution? E.g. prepend db record with a single version byte

Read more comments on GitHub >

github_iconTop Results From Across the Web

SpikeInterface, a unified framework for spike sorting - eLife
With a few lines of code, researchers can reproducibly run, compare, and benchmark most modern spike sorting algorithms; pre-process, post- ...
Read more >
Spike sorting: new trends and challenges of the era of high ...
There is yet no consensus on how to deal with drifts in extracellular recordings. However, before reviewing the different methods used by modern...
Read more >
Comparing Open-Source Toolboxes for Processing and ...
Analysis of spike and local field potential (LFP) data is an essential ... control systems, which prevents tracking version differences and ...
Read more >
SpikeInterface, a unified framework for spike sorting - PMC
All analyses are done with spikeinterface version 0.10.0 which is available ... All extracted data is converted into either native Python data structures...
Read more >
Cluster tendency assessment in neuronal spike data - PLOS
In this paper, we investigate the first approach and evaluate the utility ... inaccuracy of the assumed data structure that is inferred by ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found