Beispiel #1
0
def _decoder(
        # NOTE: mypy incorrectly thinks `Field` is a generic type
        data: Dict[str, EncodedConfigTypes],
        fields: Collection[Field],  # type: ignore
) -> Iterable[Tuple[str, ConfigTypes]]:
    # NOTE: this code is unwieldly but it satisfies `mypy`
    for field in fields:
        if field.type is Gwei:
            yield field.name, Gwei(cast(int, data[field.name]))
        elif field.type is Slot:
            yield field.name, Slot(cast(int, data[field.name]))
        elif field.type is Epoch:
            yield field.name, Epoch(cast(int, data[field.name]))
        elif field.type is Second:
            yield field.name, Second(cast(int, data[field.name]))
        elif field.type is bytes:
            yield field.name, decode_hex(cast(str, data[field.name]))
        elif field.type is Version:
            yield field.name, Version(decode_hex(cast(str, data[field.name])))
        else:
            yield field.name, int(data[field.name])
Beispiel #2
0
def sample_fork_params():
    return {
        'previous_version': Version((0).to_bytes(4, 'little')),
        'current_version': Version((0).to_bytes(4, 'little')),
        'epoch': 2**32,
    }
Beispiel #3
0
 CHURN_LIMIT_QUOTIENT=2**16,
 SHUFFLE_ROUND_COUNT=90,
 HYSTERESIS_QUOTIENT=4,
 HYSTERESIS_DOWNWARD_MULTIPLIER=1,
 HYSTERESIS_UPWARD_MULTIPLIER=5,
 # Genesis
 MIN_GENESIS_ACTIVE_VALIDATOR_COUNT=2**14,
 MIN_GENESIS_TIME=1578009600,  # (= Jan 3, 2020)
 # Gwei values
 MIN_DEPOSIT_AMOUNT=Gwei(2**0 * GWEI_PER_ETH),  # (= 1,000,000,000) Gwei
 MAX_EFFECTIVE_BALANCE=Gwei(2**5 * GWEI_PER_ETH),  # (= 32,000,000,00) Gwei
 EJECTION_BALANCE=Gwei(2**4 * GWEI_PER_ETH),  # (= 16,000,000,000) Gwei
 EFFECTIVE_BALANCE_INCREMENT=Gwei(2**0 *
                                  GWEI_PER_ETH),  # (= 1,000,000,000) Gwei
 # Initial values
 GENESIS_FORK_VERSION=Version(b"\x00" * 4),
 BLS_WITHDRAWAL_PREFIX=b"\x00",
 # Time parameters
 GENESIS_DELAY=Second(172800),
 SECONDS_PER_SLOT=Second(12),  # seconds
 MIN_ATTESTATION_INCLUSION_DELAY=2**0,  # (= 1) slots
 SLOTS_PER_EPOCH=2**5,  # (= 32) slots
 MIN_SEED_LOOKAHEAD=2**0,  # (= 1) epochs
 MAX_SEED_LOOKAHEAD=2**2,  # (= 4) epochs
 SLOTS_PER_HISTORICAL_ROOT=2**13,  # (= 8,192) slots
 MIN_VALIDATOR_WITHDRAWABILITY_DELAY=2**8,  # (= 256) epochs
 SHARD_COMMITTEE_PERIOD=2**8,  # (= 256) epochs
 MIN_EPOCHS_TO_INACTIVITY_PENALTY=2**2,
 # State list lengths
 EPOCHS_PER_ETH1_VOTING_PERIOD=32,
 EPOCHS_PER_HISTORICAL_VECTOR=2**16,
Beispiel #4
0
def sample_fork_params():
    return {
        "previous_version": Version((0).to_bytes(4, "little")),
        "current_version": Version((0).to_bytes(4, "little")),
        "epoch": 2 ** 32,
    }
Beispiel #5
0
 CHURN_LIMIT_QUOTIENT=2**16,
 SHUFFLE_ROUND_COUNT=90,
 HYSTERESIS_QUOTIENT=4,
 HYSTERESIS_DOWNWARD_MULTIPLIER=1,
 HYSTERESIS_UPWARD_MULTIPLIER=5,
 # Genesis
 MIN_GENESIS_ACTIVE_VALIDATOR_COUNT=16384,
 MIN_GENESIS_TIME=1596546000,
 # Gwei values
 MIN_DEPOSIT_AMOUNT=Gwei(2**0 * GWEI_PER_ETH),  # (= 1,000,000,000) Gwei
 MAX_EFFECTIVE_BALANCE=Gwei(2**5 * GWEI_PER_ETH),  # (= 32,000,000,00) Gwei
 EJECTION_BALANCE=Gwei(2**4 * GWEI_PER_ETH),  # (= 16,000,000,000) Gwei
 EFFECTIVE_BALANCE_INCREMENT=Gwei(2**0 *
                                  GWEI_PER_ETH),  # (= 1,000,000,000) Gwei
 # Initial values
 GENESIS_FORK_VERSION=Version(b"\x00\x00\x00\x01"),
 BLS_WITHDRAWAL_PREFIX=b"\x00",
 # Time parameters
 GENESIS_DELAY=Second(172800),
 SECONDS_PER_SLOT=Second(12),  # seconds
 MIN_ATTESTATION_INCLUSION_DELAY=2**0,  # (= 1) slots
 SLOTS_PER_EPOCH=2**5,  # (= 32) slots
 MIN_SEED_LOOKAHEAD=2**0,  # (= 1) epochs
 MAX_SEED_LOOKAHEAD=2**2,  # (= 4) epochs
 SLOTS_PER_HISTORICAL_ROOT=2**13,  # (= 8,192) slots
 MIN_VALIDATOR_WITHDRAWABILITY_DELAY=2**8,  # (= 256) epochs
 SHARD_COMMITTEE_PERIOD=2**8,  # (= 256) epochs
 MIN_EPOCHS_TO_INACTIVITY_PENALTY=2**2,
 # State list lengths
 EPOCHS_PER_ETH1_VOTING_PERIOD=32,
 EPOCHS_PER_HISTORICAL_VECTOR=2**16,
Beispiel #6
0
 MIN_PER_EPOCH_CHURN_LIMIT=2 ** 2,
 CHURN_LIMIT_QUOTIENT=2 ** 16,
 SHUFFLE_ROUND_COUNT=90,
 HYSTERESIS_QUOTIENT=4,
 HYSTERESIS_DOWNWARD_MULTIPLIER=1,
 HYSTERESIS_UPWARD_MULTIPLIER=5,
 # Genesis
 MIN_GENESIS_ACTIVE_VALIDATOR_COUNT=640,
 MIN_GENESIS_TIME=1593433800,
 # Gwei values
 MIN_DEPOSIT_AMOUNT=Gwei(2 ** 0 * GWEI_PER_ETH),  # (= 1,000,000,000) Gwei
 MAX_EFFECTIVE_BALANCE=Gwei(2 ** 5 * GWEI_PER_ETH),  # (= 32,000,000,00) Gwei
 EJECTION_BALANCE=Gwei(2 ** 4 * GWEI_PER_ETH),  # (= 16,000,000,000) Gwei
 EFFECTIVE_BALANCE_INCREMENT=Gwei(2 ** 0 * GWEI_PER_ETH),  # (= 1,000,000,000) Gwei
 # Initial values
 GENESIS_FORK_VERSION=Version(b"\x00000121"),
 BLS_WITHDRAWAL_PREFIX=b"\x00",
 # Time parameters
 GENESIS_DELAY=Second(172800),
 SECONDS_PER_SLOT=Second(12),  # seconds
 MIN_ATTESTATION_INCLUSION_DELAY=2 ** 0,  # (= 1) slots
 SLOTS_PER_EPOCH=2 ** 5,  # (= 32) slots
 MIN_SEED_LOOKAHEAD=2 ** 0,  # (= 1) epochs
 MAX_SEED_LOOKAHEAD=2 ** 2,  # (= 4) epochs
 SLOTS_PER_HISTORICAL_ROOT=2 ** 13,  # (= 8,192) slots
 MIN_VALIDATOR_WITHDRAWABILITY_DELAY=2 ** 8,  # (= 256) epochs
 SHARD_COMMITTEE_PERIOD=2 ** 8,  # (= 256) epochs
 MIN_EPOCHS_TO_INACTIVITY_PENALTY=2 ** 2,
 # State list lengths
 EPOCHS_PER_ETH1_VOTING_PERIOD=32,
 EPOCHS_PER_HISTORICAL_VECTOR=2 ** 16,