Skip to content

Commit

Permalink
Constants update (v0.7.1) (#725)
Browse files Browse the repository at this point in the history
* Change mainnet constants

* Change minimal constants in config.toml
  • Loading branch information
cemozerr authored Jun 17, 2019
1 parent 99430af commit 94ecad3
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 42 deletions.
122 changes: 103 additions & 19 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,45 +40,129 @@ DepositSimulation = ["secp", "bls", "deposit_data", "events"]

# Modify constants in Constants.java
[constants]
# Minimal preset


# Misc
# ---------------------------------------------------------------

# [customized] Just 8 shards for testing purposes
SHARD_COUNT = 8
# [customized] unsecure, but fast
TARGET_COMMITTEE_SIZE = 4
MAX_BALANCE_CHURN_QUOTIENT = 32
MAX_INDICES_PER_SLASHABLE_VOTE = 4096
MAX_EXIT_DEQUEUES_PER_EPOCH = 4
SHUFFLE_ROUND_COUNT = 90
# 2**12 (= 4,096)
MAX_INDICES_PER_ATTESTATION = 4096
# 2**2 (= 4)
MIN_PER_EPOCH_CHURN_LIMIT = 4
# 2**16 (= 65,536)
CHURN_LIMIT_QUOTIENT = 65536
# Normalizes base rewards
BASE_REWARDS_PER_EPOCH = 5
# [customized] Faster, but unsecure.
SHUFFLE_ROUND_COUNT = 10


# Deposit contract
# ---------------------------------------------------------------
# **TBD**
DEPOSIT_CONTRACT_ADDRESS = '0x1234567890123456789012345678901234567890'
# 2**5 (= 32)
DEPOSIT_CONTRACT_TREE_DEPTH = 32


# Gwei values
# ---------------------------------------------------------------
# 2**0 * 10**9 (= 1,000,000,000) Gwei
MIN_DEPOSIT_AMOUNT = 1000000000
MAX_DEPOSIT_AMOUNT = 32000000000
FORK_CHOICE_BALANCE_INCREMENT = 1000000000
# 2**5 * 10**9 (= 32,000,000,000) Gwei
MAX_EFFECTIVE_BALANCE = 32000000000
# 2**4 * 10**9 (= 16,000,000,000) Gwei
EJECTION_BALANCE = 16000000000
GENESIS_FORK_VERSION = 0
GENESIS_SLOT = 4294967296
GENESIS_EPOCH = 536870912
GENESIS_START_SHARD = 0
# 2**0 * 10**9 (= 1,000,000,000) Gwei
EFFECTIVE_BALANCE_INCREMENT = 1000000000


# Initial values
# ---------------------------------------------------------------
GENESIS_FORK_VERSION = '0x00000000'
# 0, GENESIS_EPOCH is derived from this constant
GENESIS_SLOT = 0
# 2**64 - 1
FAR_FUTURE_EPOCH = 18446744073709551615
BLS_WITHDRAWAL_PREFIX = 0


# Time parameters
# ---------------------------------------------------------------
# 6 seconds 6 seconds
SECONDS_PER_SLOT = 6
MIN_ATTESTATION_INCLUSION_DELAY = 1
# [customized] 2 slots
MIN_ATTESTATION_INCLUSION_DELAY = 2
# [customized] fast epochs
SLOTS_PER_EPOCH = 8
# 2**0 (= 1) epochs
MIN_SEED_LOOKAHEAD = 1
# 2**2 (= 4) epochs
ACTIVATION_EXIT_DELAY = 4
EPOCHS_PER_ETH1_VOTING_PERIOD = 16
# [customized] higher frequency new deposits from eth1 for testing
SLOTS_PER_ETH1_VOTING_PERIOD = 16
# [customized] smaller state
SLOTS_PER_HISTORICAL_ROOT = 64
# 2**8 (= 256) epochs
MIN_VALIDATOR_WITHDRAWABILITY_DELAY = 256
# 2**11 (= 2,048) epochs
PERSISTENT_COMMITTEE_PERIOD = 2048
# 2**6 (= 64) epochs
MAX_EPOCHS_PER_CROSSLINK = 64
# 2**2 (= 4) epochs
MIN_EPOCHS_TO_INACTIVITY_PENALTY = 4
# [customized] 2**12 (= 4,096) epochs
EARLY_DERIVED_SECRET_PENALTY_MAX_FUTURE_EPOCHS = 4096


# State list lengths
# ---------------------------------------------------------------
# [customized] smaller state
LATEST_RANDAO_MIXES_LENGTH = 64
# [customized] smaller state
LATEST_ACTIVE_INDEX_ROOTS_LENGTH = 64
# [customized] smaller state
LATEST_SLASHED_EXIT_LENGTH = 64
BASE_REWARD_QUOTIENT = 32
WHISTLEBLOWER_REWARD_QUOTIENT = 512
ATTESTATION_INCLUSION_REWARD_QUOTIENT = 8
INACTIVITY_PENALTY_QUOTIENT = 16777216
MIN_PENALTY_QUOTIENT = 32


# Reward and penalty quotients
# ---------------------------------------------------------------
# 2**5 (= 32)
BASE_REWARD_FACTOR = 32
# 2**9 (= 512)
WHISTLEBLOWING_REWARD_QUOTIENT = 512
# 2**3 (= 8)
PROPOSER_REWARD_QUOTIENT = 8
# 2**25 (= 33,554,432)
INACTIVITY_PENALTY_QUOTIENT = 33554432
# 2**5 (= 32)
MIN_SLASHING_PENALTY_QUOTIENT = 32


# Max operations per block
# ---------------------------------------------------------------
# 2**4 (= 16)
MAX_PROPOSER_SLASHINGS = 16
# 2**0 (= 1)
MAX_ATTESTER_SLASHINGS = 1
# 2**7 (= 128)
MAX_ATTESTATIONS = 128
# 2**4 (= 16)
MAX_DEPOSITS = 16
# 2**4 (= 16)
MAX_VOLUNTARY_EXITS = 16
MAX_TRANSFERS = 16
DOMAIN_BEACON_BLOCK = 0
# Originally 2**4 (= 16), disabled for now.
MAX_TRANSFERS = 0


# Signature domains
# ---------------------------------------------------------------
DOMAIN_BEACON_PROPOSER = 0
DOMAIN_RANDAO = 1
DOMAIN_ATTESTATION = 2
DOMAIN_DEPOSIT = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,53 +27,53 @@ public class Constants {
// Misc
public static int SHARD_COUNT = 1024; // 2^10 shards
public static int TARGET_COMMITTEE_SIZE = 128; // 2^7 validators
public static int MAX_BALANCE_CHURN_QUOTIENT = 32; // 2^5
public static int MAX_INDICES_PER_SLASHABLE_VOTE = 4096; // 2^12 votes
public static int MAX_EXIT_DEQUEUES_PER_EPOCH = 4; // 2^2 withdrawals
public static int MAX_INDICES_PER_ATTESTATION = 4096; // 2^5
public static int MIN_PER_EPOCH_CHURN_LIMIT = 4; // 2^2 withdrawals
public static int CHURN_LIMIT_QUOTIENT = 65536; // 2^2 withdrawals
public static int BASE_REWARD_PER_EPOCH = 5; // 2^2 withdrawals
public static int SHUFFLE_ROUND_COUNT = 90;

// Deposit contract
public static String DEPOSIT_CONTRACT_ADDRESS = "0x0"; // This is TBD in the spec.
public static int DEPOSIT_CONTRACT_TREE_DEPTH = 32; // 2^5

// Gwei values
public static long MIN_DEPOSIT_AMOUNT = 1000000000L; // 2^0 * 1E9 Gwei
public static long MAX_DEPOSIT_AMOUNT = 32000000000L; // 2^5 * 1E9 Gwei
public static long FORK_CHOICE_BALANCE_INCREMENT = 1000000000L; // 2^0 * 1E9 Gwei
public static long MAX_EFFECTIVE_BALANCE = 32000000000L; // 2^5 * 1E9 Gwei
public static long EJECTION_BALANCE = 16000000000L; // 2^4 * 1E9 Gwei
public static long EFFECTIVE_BALANCE_INCREMENT = 1000000000L; // 2^0 * 1E9 Gwei

// Initial values
public static long GENESIS_SLOT = 0; // 2^32
public static long GENESIS_EPOCH = 0;
public static UnsignedLong FAR_FUTURE_EPOCH = UnsignedLong.MAX_VALUE;
public static Bytes32 ZERO_HASH = Bytes32.ZERO; // TODO confirm if equals to b'\x00' * 32
public static int BLS_WITHDRAWAL_PREFIX_BYTE = 0;

// Time parameters
public static int SECONDS_PER_SLOT = 6; // 6 seconds
public static int MIN_ATTESTATION_INCLUSION_DELAY = 4; // 2^2 slots
public static int SLOTS_PER_EPOCH = 64; // 2^6 slots
public static int MIN_SEED_LOOKAHEAD = 1; // 2^0 epochs (6.4 minutes)
public static int ACTIVATION_EXIT_DELAY = 4; // 2^2 epochs (25.6 minutes)
public static int EPOCHS_PER_ETH1_VOTING_PERIOD = 16; // 2^4 epochs (~1.7 hours)
public static int SLOTS_PER_ETH1_VOTING_PERIOD = 1024; // 2^4 epochs (~1.7 hours)
public static int SLOTS_PER_HISTORICAL_ROOT = 8192; // 2^13 slots (~13 hours)
public static int MIN_VALIDATOR_WITHDRAWABILITY_DELAY = 256; // 2^8 epochs (~27 hours)
public static int PERSISTENT_COMMITTEE_PERIOD = 2048; // 2^11 epochs (~9 days)
public static int MAX_EPOCHS_PER_CROSSLINK = 64; // 2^11 epochs (~9 days)
public static int MIN_EPOCHS_TO_INACTIVITY_PENALTY = 4; // 2^11 epochs (~9 days)

// Initial values
public static int GENESIS_FORK_VERSION = 0;
public static long GENESIS_SLOT = 4294967296L; // 2^32
public static long GENESIS_EPOCH = slot_to_epoch(GENESIS_SLOT);
public static long GENESIS_START_SHARD = 0;
public static UnsignedLong FAR_FUTURE_EPOCH = UnsignedLong.MAX_VALUE;
public static Bytes32 ZERO_HASH = Bytes32.ZERO;
public static BLSSignature EMPTY_SIGNATURE = BLSSignature.empty();
public static Bytes BLS_WITHDRAWAL_PREFIX_BYTE = Bytes.EMPTY;
public static int SECONDS_PER_SLOT = 6; // removed in 7.1 main spec for some reason but keep for now

// State list lengths
public static int LATEST_RANDAO_MIXES_LENGTH = 8192; // 2^13 epochs (~36 days)
public static int LATEST_ACTIVE_INDEX_ROOTS_LENGTH = 8192; // 2^13 epochs (~36 days)
public static int LATEST_SLASHED_EXIT_LENGTH = 8192; // 2^13 epochs (~36 days)

// Reward and penalty quotients
public static int BASE_REWARD_QUOTIENT = 32; // 2^5
public static int WHISTLEBLOWER_REWARD_QUOTIENT = 512; // 2^9
public static int ATTESTATION_INCLUSION_REWARD_QUOTIENT = 8; // 2^3
public static int INACTIVITY_PENALTY_QUOTIENT = 16777216; // 2^24
public static int MIN_PENALTY_QUOTIENT = 32; // 2^5
public static int BASE_REWARD_FACTOR = 32; // 2^5
public static int WHISTLEBLOWING_REWARD_QUOTIENT = 512; // 2^9
public static int PROPOSER_REWARD_QUOTIENT = 8; // 2^3
public static int INACTIVITY_PENALTY_QUOTIENT = 33554432; // 2^25
public static int MIN_SLASHING_PENALTY_QUOTIENT = 32; // 2^5

// Max transactions per block
public static int MAX_PROPOSER_SLASHINGS = 16; // 2^4
Expand All @@ -84,7 +84,7 @@ public class Constants {
public static int MAX_TRANSFERS = 16; // 2^4

// Signature domains
public static int DOMAIN_BEACON_BLOCK = 0;
public static int DOMAIN_BEACON_PROPOSER = 0;
public static int DOMAIN_RANDAO = 1;
public static int DOMAIN_ATTESTATION = 2;
public static int DOMAIN_DEPOSIT = 3;
Expand Down

0 comments on commit 94ecad3

Please sign in to comment.