diff --git a/packages/testing/src/consensus_testing/test_fixtures/slot_clock.py b/packages/testing/src/consensus_testing/test_fixtures/slot_clock.py index 6bf5273d3..69688c4d7 100644 --- a/packages/testing/src/consensus_testing/test_fixtures/slot_clock.py +++ b/packages/testing/src/consensus_testing/test_fixtures/slot_clock.py @@ -8,12 +8,12 @@ from typing import Any, ClassVar from lean_spec.node.chain.clock import Interval, SlotClock -from lean_spec.node.chain.config import ( +from lean_spec.spec.forks import Slot +from lean_spec.spec.forks.lstar.config import ( INTERVALS_PER_SLOT, MILLISECONDS_PER_INTERVAL, SECONDS_PER_SLOT, ) -from lean_spec.spec.forks import Slot from lean_spec.spec.ssz import Uint64 from .base import BaseConsensusFixture diff --git a/src/lean_spec/cli/run.py b/src/lean_spec/cli/run.py index 01b260c04..2b8fccd40 100644 --- a/src/lean_spec/cli/run.py +++ b/src/lean_spec/cli/run.py @@ -17,13 +17,13 @@ import logging -from lean_spec.node.chain.config import ATTESTATION_COMMITTEE_COUNT from lean_spec.node.metrics import PrometheusObserver, registry as metrics from lean_spec.node.networking.client import LiveNetworkEventSource from lean_spec.node.networking.gossipsub import GossipTopic from lean_spec.node.node import Node, NodeConfig from lean_spec.node.observability import set_observer from lean_spec.spec.forks import SubnetId +from lean_spec.spec.forks.lstar.config import ATTESTATION_COMMITTEE_COUNT from .bootstrap import NodeBootstrap diff --git a/src/lean_spec/node/chain/clock.py b/src/lean_spec/node/chain/clock.py index 934e76c04..90369e630 100644 --- a/src/lean_spec/node/chain/clock.py +++ b/src/lean_spec/node/chain/clock.py @@ -15,14 +15,13 @@ from dataclasses import dataclass from time import time as wall_time -from lean_spec.spec.ssz import Uint64 - -from .config import ( +from lean_spec.spec.forks.lstar.config import ( INTERVALS_PER_SLOT, MILLISECONDS_PER_INTERVAL, MILLISECONDS_PER_SLOT, SECONDS_PER_SLOT, ) +from lean_spec.spec.ssz import Uint64 class Interval(Uint64): diff --git a/src/lean_spec/node/chain/service.py b/src/lean_spec/node/chain/service.py index f53e9f0d4..b3e3ebc5c 100644 --- a/src/lean_spec/node/chain/service.py +++ b/src/lean_spec/node/chain/service.py @@ -26,9 +26,9 @@ import logging from dataclasses import dataclass, field -from lean_spec.node.chain.config import INTERVALS_PER_SLOT from lean_spec.node.sync import SyncService from lean_spec.spec.forks import LstarSpec, SignedAggregatedAttestation +from lean_spec.spec.forks.lstar.config import INTERVALS_PER_SLOT from .clock import Interval, SlotClock diff --git a/src/lean_spec/node/networking/gossipsub/parameters.py b/src/lean_spec/node/networking/gossipsub/parameters.py index 5feb9ea76..e4619820d 100644 --- a/src/lean_spec/node/networking/gossipsub/parameters.py +++ b/src/lean_spec/node/networking/gossipsub/parameters.py @@ -60,9 +60,9 @@ from __future__ import annotations from lean_spec.base import StrictBaseModel -from lean_spec.node.chain.config import JUSTIFICATION_LOOKBACK_SLOTS, SECONDS_PER_SLOT from lean_spec.node.networking.config import GOSSIPSUB_DEFAULT_PROTOCOL_ID from lean_spec.node.networking.types import ProtocolId +from lean_spec.spec.forks.lstar.config import JUSTIFICATION_LOOKBACK_SLOTS, SECONDS_PER_SLOT class GossipsubParameters(StrictBaseModel): diff --git a/src/lean_spec/node/node.py b/src/lean_spec/node/node.py index d940af661..9a32b2945 100644 --- a/src/lean_spec/node/node.py +++ b/src/lean_spec/node/node.py @@ -22,7 +22,6 @@ from lean_spec.node.api import AggregatorController, ApiServer, ApiServerConfig from lean_spec.node.chain import SlotClock from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import ATTESTATION_COMMITTEE_COUNT from lean_spec.node.chain.service import ChainService from lean_spec.node.metrics import registry as metrics from lean_spec.node.networking import NetworkService @@ -44,6 +43,7 @@ ValidatorIndex, Validators, ) +from lean_spec.spec.forks.lstar.config import ATTESTATION_COMMITTEE_COUNT from lean_spec.spec.ssz import Bytes32, Uint64 logger = logging.getLogger(__name__) diff --git a/src/lean_spec/node/chain/config.py b/src/lean_spec/spec/forks/lstar/config.py similarity index 95% rename from src/lean_spec/node/chain/config.py rename to src/lean_spec/spec/forks/lstar/config.py index a7b7e7b1c..ca4e56aa1 100644 --- a/src/lean_spec/node/chain/config.py +++ b/src/lean_spec/spec/forks/lstar/config.py @@ -45,8 +45,7 @@ """ The maximum number of historical block roots to store in the state. -With a 4-second slot, this corresponds to a history -of approximately 12.1 days. +With a 4-second slot, this corresponds to a history of approximately 12.1 days. """ ATTESTATION_COMMITTEE_COUNT: Final = Uint64(1) diff --git a/src/lean_spec/spec/forks/lstar/containers.py b/src/lean_spec/spec/forks/lstar/containers.py index cc6b02251..65f9b6373 100644 --- a/src/lean_spec/spec/forks/lstar/containers.py +++ b/src/lean_spec/spec/forks/lstar/containers.py @@ -15,8 +15,8 @@ from lean_spec.base import StrictBaseModel from lean_spec.config import LEAN_ENV from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import HISTORICAL_ROOTS_LIMIT from lean_spec.spec.crypto.xmss.containers import PublicKey, Signature +from lean_spec.spec.forks.lstar.config import HISTORICAL_ROOTS_LIMIT from lean_spec.spec.ssz import Boolean, ByteList512KiB, Bytes32, Bytes52, Container, SSZList, Uint64 from lean_spec.spec.ssz.bitfields import BaseBitlist diff --git a/src/lean_spec/spec/forks/lstar/spec.py b/src/lean_spec/spec/forks/lstar/spec.py index b36371fb8..5c4c973dd 100644 --- a/src/lean_spec/spec/forks/lstar/spec.py +++ b/src/lean_spec/spec/forks/lstar/spec.py @@ -7,12 +7,6 @@ from typing import Any, ClassVar from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import ( - GOSSIP_DISPARITY_INTERVALS, - INTERVALS_PER_SLOT, - JUSTIFICATION_LOOKBACK_SLOTS, - MAX_ATTESTATIONS_DATA, -) from lean_spec.node.observability import ( observe_on_attestation, observe_on_block, @@ -22,6 +16,12 @@ from lean_spec.spec.crypto.xmss.containers import PublicKey from lean_spec.spec.crypto.xmss.interface import TARGET_SIGNATURE_SCHEME from lean_spec.spec.forks.lstar.aggregation_select import select_greedily +from lean_spec.spec.forks.lstar.config import ( + GOSSIP_DISPARITY_INTERVALS, + INTERVALS_PER_SLOT, + JUSTIFICATION_LOOKBACK_SLOTS, + MAX_ATTESTATIONS_DATA, +) from lean_spec.spec.forks.lstar.containers import ( AggregatedAttestation, AggregatedAttestations, diff --git a/tests/consensus/lstar/fc/test_attestation_target_selection.py b/tests/consensus/lstar/fc/test_attestation_target_selection.py index 2f33baf8e..4a52c32ab 100644 --- a/tests/consensus/lstar/fc/test_attestation_target_selection.py +++ b/tests/consensus/lstar/fc/test_attestation_target_selection.py @@ -9,8 +9,8 @@ StoreChecks, ) -from lean_spec.node.chain.config import JUSTIFICATION_LOOKBACK_SLOTS from lean_spec.spec.forks import Slot, ValidatorIndex +from lean_spec.spec.forks.lstar.config import JUSTIFICATION_LOOKBACK_SLOTS pytestmark = pytest.mark.valid_until("Lstar") diff --git a/tests/consensus/lstar/fc/test_block_attestation_limits.py b/tests/consensus/lstar/fc/test_block_attestation_limits.py index 8b6d27dec..ac8aa3fc5 100644 --- a/tests/consensus/lstar/fc/test_block_attestation_limits.py +++ b/tests/consensus/lstar/fc/test_block_attestation_limits.py @@ -12,8 +12,8 @@ ) from consensus_testing.keys import XmssKeyManager -from lean_spec.node.chain.config import MAX_ATTESTATIONS_DATA from lean_spec.spec.forks import Slot, ValidatorIndex +from lean_spec.spec.forks.lstar.config import MAX_ATTESTATIONS_DATA pytestmark = pytest.mark.valid_until("Lstar") diff --git a/tests/consensus/lstar/fc/test_block_production.py b/tests/consensus/lstar/fc/test_block_production.py index 85e303276..f0e0e7b92 100644 --- a/tests/consensus/lstar/fc/test_block_production.py +++ b/tests/consensus/lstar/fc/test_block_production.py @@ -16,13 +16,13 @@ TickStep, ) -from lean_spec.node.chain.config import ( +from lean_spec.spec.forks import Slot, ValidatorIndex +from lean_spec.spec.forks.lstar.config import ( INTERVALS_PER_SLOT, MAX_ATTESTATIONS_DATA, MILLISECONDS_PER_INTERVAL, SECONDS_PER_SLOT, ) -from lean_spec.spec.forks import Slot, ValidatorIndex pytestmark = pytest.mark.valid_until("Lstar") diff --git a/tests/consensus/lstar/fc/test_checkpoint_sync.py b/tests/consensus/lstar/fc/test_checkpoint_sync.py index dea034a0a..3e373f8e9 100644 --- a/tests/consensus/lstar/fc/test_checkpoint_sync.py +++ b/tests/consensus/lstar/fc/test_checkpoint_sync.py @@ -12,9 +12,9 @@ ) from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import INTERVALS_PER_SLOT, SECONDS_PER_SLOT from lean_spec.spec.crypto.merkleization import hash_tree_root from lean_spec.spec.forks import Slot, ValidatorIndex +from lean_spec.spec.forks.lstar.config import INTERVALS_PER_SLOT, SECONDS_PER_SLOT from lean_spec.spec.ssz import Bytes32 pytestmark = pytest.mark.valid_until("Lstar") diff --git a/tests/consensus/lstar/fc/test_gossip_aggregated_attestation_validation.py b/tests/consensus/lstar/fc/test_gossip_aggregated_attestation_validation.py index 7b3ed18c0..4aac6dfc7 100644 --- a/tests/consensus/lstar/fc/test_gossip_aggregated_attestation_validation.py +++ b/tests/consensus/lstar/fc/test_gossip_aggregated_attestation_validation.py @@ -12,8 +12,8 @@ ) from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import GOSSIP_DISPARITY_INTERVALS from lean_spec.spec.forks import Slot, ValidatorIndex +from lean_spec.spec.forks.lstar.config import GOSSIP_DISPARITY_INTERVALS from lean_spec.spec.ssz import Bytes32 pytestmark = pytest.mark.valid_until("Lstar") diff --git a/tests/consensus/lstar/fc/test_gossip_attestation_validation.py b/tests/consensus/lstar/fc/test_gossip_attestation_validation.py index 0fd2c6032..9c45f36ff 100644 --- a/tests/consensus/lstar/fc/test_gossip_attestation_validation.py +++ b/tests/consensus/lstar/fc/test_gossip_attestation_validation.py @@ -12,8 +12,8 @@ ) from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import GOSSIP_DISPARITY_INTERVALS from lean_spec.spec.forks import Slot, ValidatorIndex +from lean_spec.spec.forks.lstar.config import GOSSIP_DISPARITY_INTERVALS from lean_spec.spec.ssz import Bytes32 pytestmark = pytest.mark.valid_until("Lstar") diff --git a/tests/interop/helpers/node_runner.py b/tests/interop/helpers/node_runner.py index 41f68afdd..c1da8fba3 100644 --- a/tests/interop/helpers/node_runner.py +++ b/tests/interop/helpers/node_runner.py @@ -12,7 +12,6 @@ from dataclasses import dataclass, field from typing import cast -from lean_spec.node.chain.config import ATTESTATION_COMMITTEE_COUNT from lean_spec.node.networking import PeerId from lean_spec.node.networking.client import LiveNetworkEventSource from lean_spec.node.networking.gossipsub.types import TopicId @@ -25,6 +24,7 @@ from lean_spec.spec.crypto.xmss import TARGET_SIGNATURE_SCHEME, SecretKey from lean_spec.spec.forks import Checkpoint, Slot, ValidatorIndex from lean_spec.spec.forks.lstar import Store +from lean_spec.spec.forks.lstar.config import ATTESTATION_COMMITTEE_COUNT from lean_spec.spec.forks.lstar.containers import Validator, Validators from lean_spec.spec.forks.lstar.spec import LstarSpec from lean_spec.spec.ssz import Bytes52, Uint64 diff --git a/tests/lean_spec/cli/test_run.py b/tests/lean_spec/cli/test_run.py index a6b78b106..79218df2f 100644 --- a/tests/lean_spec/cli/test_run.py +++ b/tests/lean_spec/cli/test_run.py @@ -11,12 +11,12 @@ from lean_spec.cli import NodeBootstrap from lean_spec.cli.run import _build_event_source -from lean_spec.node.chain.config import ATTESTATION_COMMITTEE_COUNT from lean_spec.node.genesis import GenesisConfig from lean_spec.node.networking.gossipsub import GossipTopic from lean_spec.node.validator import ValidatorRegistry from lean_spec.node.validator.registry import ValidatorEntry from lean_spec.spec.forks import DEFAULT_REGISTRY, Slot, ValidatorIndex +from lean_spec.spec.forks.lstar.config import ATTESTATION_COMMITTEE_COUNT class _RecordingEventSource: diff --git a/tests/lean_spec/node/chain/test_clock.py b/tests/lean_spec/node/chain/test_clock.py index 1dec5fb40..856d30e0b 100644 --- a/tests/lean_spec/node/chain/test_clock.py +++ b/tests/lean_spec/node/chain/test_clock.py @@ -5,13 +5,13 @@ import pytest from lean_spec.node.chain import Interval, SlotClock -from lean_spec.node.chain.config import ( +from lean_spec.spec.forks import Slot +from lean_spec.spec.forks.lstar.config import ( INTERVALS_PER_SLOT, MILLISECONDS_PER_INTERVAL, MILLISECONDS_PER_SLOT, SECONDS_PER_SLOT, ) -from lean_spec.spec.forks import Slot from lean_spec.spec.ssz import Uint64 GENESIS_TIME = Uint64(1_700_000_000) diff --git a/tests/lean_spec/node/chain/test_service.py b/tests/lean_spec/node/chain/test_service.py index 5655b1e89..6397afaba 100644 --- a/tests/lean_spec/node/chain/test_service.py +++ b/tests/lean_spec/node/chain/test_service.py @@ -7,9 +7,9 @@ from lean_spec.node.chain import SlotClock from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import MILLISECONDS_PER_INTERVAL from lean_spec.node.chain.service import ChainService from lean_spec.spec.forks import Slot +from lean_spec.spec.forks.lstar.config import MILLISECONDS_PER_INTERVAL from lean_spec.spec.forks.lstar.containers import SignedAggregatedAttestation from lean_spec.spec.ssz import ZERO_HASH, Bytes32, Uint64 from tests.lean_spec.helpers.mocks import StoreInterceptingSpec diff --git a/tests/lean_spec/node/test_node.py b/tests/lean_spec/node/test_node.py index f3714693f..c0aff0b66 100644 --- a/tests/lean_spec/node/test_node.py +++ b/tests/lean_spec/node/test_node.py @@ -12,12 +12,6 @@ from lean_spec.node.api import ApiServerConfig from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import ( - ATTESTATION_COMMITTEE_COUNT, - HISTORICAL_ROOTS_LIMIT, - INTERVALS_PER_SLOT, - SECONDS_PER_SLOT, -) from lean_spec.node.node import Node, NodeConfig from lean_spec.node.storage.sqlite import SQLiteDatabase from lean_spec.node.validator import ValidatorRegistry @@ -25,6 +19,12 @@ from lean_spec.spec.crypto.merkleization import hash_tree_root from lean_spec.spec.forks import Checkpoint, Slot, ValidatorIndex from lean_spec.spec.forks.lstar import State +from lean_spec.spec.forks.lstar.config import ( + ATTESTATION_COMMITTEE_COUNT, + HISTORICAL_ROOTS_LIMIT, + INTERVALS_PER_SLOT, + SECONDS_PER_SLOT, +) from lean_spec.spec.forks.lstar.containers import ( AggregatedAttestations, Block, diff --git a/tests/lean_spec/node/validator/test_service.py b/tests/lean_spec/node/validator/test_service.py index 083ef7ff8..47b769851 100644 --- a/tests/lean_spec/node/validator/test_service.py +++ b/tests/lean_spec/node/validator/test_service.py @@ -8,7 +8,6 @@ from consensus_testing.keys import XmssKeyManager from lean_spec.node.chain.clock import SlotClock -from lean_spec.node.chain.config import MILLISECONDS_PER_INTERVAL from lean_spec.node.sync.block_cache import BlockCache from lean_spec.node.sync.peer_manager import PeerManager from lean_spec.node.sync.service import SyncService @@ -19,6 +18,7 @@ from lean_spec.spec.crypto.xmss import TARGET_SIGNATURE_SCHEME from lean_spec.spec.forks import Slot, ValidatorIndex from lean_spec.spec.forks.lstar import Store +from lean_spec.spec.forks.lstar.config import MILLISECONDS_PER_INTERVAL from lean_spec.spec.forks.lstar.containers import ( AttestationData, Block, diff --git a/tests/lean_spec/spec/forks/lstar/forkchoice/test_attestation_target.py b/tests/lean_spec/spec/forks/lstar/forkchoice/test_attestation_target.py index ef3dac020..a13ebcbb7 100644 --- a/tests/lean_spec/spec/forks/lstar/forkchoice/test_attestation_target.py +++ b/tests/lean_spec/spec/forks/lstar/forkchoice/test_attestation_target.py @@ -6,10 +6,10 @@ from consensus_testing.keys import XmssKeyManager from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import JUSTIFICATION_LOOKBACK_SLOTS from lean_spec.spec.crypto.merkleization import hash_tree_root from lean_spec.spec.forks import Checkpoint, Slot, ValidatorIndex from lean_spec.spec.forks.lstar import Store +from lean_spec.spec.forks.lstar.config import JUSTIFICATION_LOOKBACK_SLOTS from lean_spec.spec.forks.lstar.containers import ( Attestation, AttestationData, diff --git a/tests/lean_spec/spec/forks/lstar/forkchoice/test_store_attestations.py b/tests/lean_spec/spec/forks/lstar/forkchoice/test_store_attestations.py index aa4212c00..5f8021979 100644 --- a/tests/lean_spec/spec/forks/lstar/forkchoice/test_store_attestations.py +++ b/tests/lean_spec/spec/forks/lstar/forkchoice/test_store_attestations.py @@ -6,10 +6,10 @@ from consensus_testing.keys import XmssKeyManager from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import INTERVALS_PER_SLOT from lean_spec.spec.crypto.merkleization import hash_tree_root from lean_spec.spec.forks import Checkpoint, Slot, ValidatorIndex from lean_spec.spec.forks.lstar import AttestationSignatureEntry +from lean_spec.spec.forks.lstar.config import INTERVALS_PER_SLOT from lean_spec.spec.forks.lstar.containers import ( AttestationData, SignedAggregatedAttestation, diff --git a/tests/lean_spec/spec/forks/lstar/forkchoice/test_time_management.py b/tests/lean_spec/spec/forks/lstar/forkchoice/test_time_management.py index 52b461ed7..fb02fc235 100644 --- a/tests/lean_spec/spec/forks/lstar/forkchoice/test_time_management.py +++ b/tests/lean_spec/spec/forks/lstar/forkchoice/test_time_management.py @@ -3,15 +3,15 @@ from hypothesis import given, settings, strategies as st from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import ( +from lean_spec.spec.crypto.merkleization import hash_tree_root +from lean_spec.spec.forks import Slot, ValidatorIndex +from lean_spec.spec.forks.lstar import Store +from lean_spec.spec.forks.lstar.config import ( INTERVALS_PER_SLOT, MILLISECONDS_PER_INTERVAL, MILLISECONDS_PER_SLOT, SECONDS_PER_SLOT, ) -from lean_spec.spec.crypto.merkleization import hash_tree_root -from lean_spec.spec.forks import Slot, ValidatorIndex -from lean_spec.spec.forks.lstar import Store from lean_spec.spec.forks.lstar.containers import Block, Validators from lean_spec.spec.forks.lstar.spec import LstarSpec from lean_spec.spec.ssz import Bytes32, Uint64 diff --git a/tests/lean_spec/spec/forks/lstar/forkchoice/test_validate_attestation.py b/tests/lean_spec/spec/forks/lstar/forkchoice/test_validate_attestation.py index 62431a8a4..c80b9c230 100644 --- a/tests/lean_spec/spec/forks/lstar/forkchoice/test_validate_attestation.py +++ b/tests/lean_spec/spec/forks/lstar/forkchoice/test_validate_attestation.py @@ -5,10 +5,10 @@ import pytest from lean_spec.node.chain.clock import Interval -from lean_spec.node.chain.config import GOSSIP_DISPARITY_INTERVALS, INTERVALS_PER_SLOT from lean_spec.spec.crypto.merkleization import hash_tree_root from lean_spec.spec.forks import Checkpoint, Slot, ValidatorIndex from lean_spec.spec.forks.lstar import Store +from lean_spec.spec.forks.lstar.config import GOSSIP_DISPARITY_INTERVALS, INTERVALS_PER_SLOT from lean_spec.spec.forks.lstar.containers import ( Attestation, AttestationData,