Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lean_spec/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions src/lean_spec/node/chain/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/lean_spec/node/chain/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/lean_spec/node/networking/gossipsub/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/lean_spec/node/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/lean_spec/spec/forks/lstar/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions src/lean_spec/spec/forks/lstar/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/consensus/lstar/fc/test_block_attestation_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions tests/consensus/lstar/fc/test_block_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion tests/consensus/lstar/fc/test_checkpoint_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/interop/helpers/node_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/lean_spec/cli/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/lean_spec/node/chain/test_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/lean_spec/node/chain/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tests/lean_spec/node/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@

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
from lean_spec.node.validator.registry import ValidatorEntry
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,
Expand Down
2 changes: 1 addition & 1 deletion tests/lean_spec/node/validator/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading