eth2fastspec
Eth2fastspec is an extension to eth2spec, utilizing the same types, configuration and dependencies, but optimized for transition speed.
Usage
A few new objects are introduced for precomputed data, speeding up the transition:
ShufflingEpoch: Committee shuffling information for a single epochEpochsContext: A collection of contextual information to re-use during an epoch, and rotating precomputed data of the next epoch into the current epoch. This includes shuffling, but also proposer information is available.epochs_ctx.load_state(state)precomputes the data for the given state.sync_pubkeys()checks the precomputed data against a state, and then adds missing pubkeys (strictly append-only however, not meant to fork this information)copy()if a fork occurs, the context will have to be copied. To avoid copying the immutable parts, thecopy()implements a specialized copy routine.rotate_epochs()to re-use information, such as the shuffling of the next epoch, after transitioning into a new epoch, therotate_epochs()is called. The transition function takes care of epoch-context data rotation.
FlatValidator: A copy of the regularValidator, but in a simple object instead of a tree-representation. For intermediate computation the remerkleable representation slows things down, so a regular object is used instead.AttesterStatus: During the epoch transition, additional data is precomputed to avoid traversing any state a second time. Attestations are a big part of this, and each validator has an "status" to represent its precomputed participation.EpochProcess: TheAttesterStatus(andFlatValidatorunderstatus.validator) objects andEpochStakeSummaryare tracked in theEpochProcessand made available as additional context in the epoch transition.prepare_epoch_process_state(epochs_ctx, state)computes this data.
Method signatures in the spec changed to utilize precomputed data:
state_transition,process_slots,process_slot,process_epoch, every epoch sub-process,process_block, every block sub-process, andverify_block_signatureall have an additionalepochs_ctx(EpochsContext) argument.- every epoch sub-process has an additional
process(EpochProcess) argument.
The argument order is generally: epochs_ctx, proces, state, remaining args.
from eth2spec.config.config_util import prepare_config
# Example: load a config, loading it in `eth2spec` as well as `eth2fastspec`, before loading the spec modules.
prepare_config("./lighthouse", "config")
import eth2fastspec as spec
state: spec.BeaconState = ... # BeaconState.deserialize(stream, size), or some other source.
block: spec.SignedBeaconBlock = ...
epochs_ctx = spec.EpochsContext()
epochs_ctx.load_state(state)
spec.state_transition(epochs_ctx, state, block)
print(state.hash_tree_root().hex())
License
MIT, see LICENSE file.
Metadata
Release files for eth2fastspec 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eth2fastspec-0.0.5.tar.gz | 16.9 kB | Without provenance | Details for eth2fastspec-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eth2fastspec-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for eth2fastspec-0.0.5-py3-none-any.whl |
Total release size: 34.4 kB
Release files / eth2fastspec-0.0.5.tar.gz
| Download URL | eth2fastspec-0.0.5.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1aceebe77a7cdc114981f508885d0891a8c2a32631b70b52cc406d865d182895
|
|
BLAKE2b-256 checksum How to use checksums |
d97bca8d304807bb19667b88759a467f22bd9381a22acd01f0d2bea640e45eb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.3
|
Release files / eth2fastspec-0.0.5-py3-none-any.whl
| Download URL | eth2fastspec-0.0.5-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8d87b651ec96dc740fa2f188592b2d91d80c846377275213629485e353d5ed79
|
|
BLAKE2b-256 checksum How to use checksums |
64943dd0b05fb1340eea961567226654eb20f8d7cac20cd00de2f26640f19e49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.3
|
Security for eth2fastspec 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.