mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-12 14:36:56 +00:00
* begin 0.6.0: new get_domain/increase_balance/reduce_balance, BeaconState.validator_balances -> BeaconState.balances, some renamed constants, transaction processing changes, SlashableAttestation field name changes, 0.6.0 get_beacon_proposer_index always uses given state's slot, update tests subrepo * mark get_bitfield_bit/bls_verify_multiple/stat-list-lengths/is_active_validator/is_surround_vote/slot_to_epoch/int_to_bytes/etc as unchanged in 0.6.0; rm Eth1DataVote/maybe_reset_eth1_period and thus adjust expected tree hash test results * mark verify_bitfield/bls_verify/deposit-contract/VoluntaryExit/PendingAttestation/Historicalbatch/Fork as 0.6.0; update DOMAIN_BEACON_BLOCK to DOMAIN_BEACON_PROPOSER * update Crosslink to 0.6.0 (also requires tree hashing test result change, so isolate in individual commit) * mark verify_merkle_branch/get_delayed_activation_exit_epoch/ProposerSlashing/Attestation/AttestationDataAndCustodyBit/hash/integer_squareroot/get_epoch_start_slot/is_double_vote/get_randao_mix/generate_seed as 0.6.0; update reward and penalty quotients; SlashableAttestation -> IndexedAttestation; rm get_fork_version; ATTESTATION_INCLUSION_REWARD_QUOTIENT -> PROPOSER_REWARD_QUOTIENT
60 lines
1.7 KiB
Nim
60 lines
1.7 KiB
Nim
import
|
|
os, ospaths, strutils, strformat,
|
|
chronos, blscurve, nimcrypto, json_serialization, confutils,
|
|
spec/[datatypes, digest, crypto], conf, time, ssz,
|
|
../tests/testutil
|
|
|
|
proc writeTextFile(filename: string, contents: string) =
|
|
writeFile(filename, contents)
|
|
echo "Wrote ", filename
|
|
|
|
proc writeFile(filename: string, value: auto) =
|
|
Json.saveFile(filename, value, pretty = true)
|
|
echo "Wrote ", filename
|
|
|
|
cli do (totalValidators: int = 125000,
|
|
outputDir: string = "validators",
|
|
generateFakeKeys = false):
|
|
|
|
for i in 0 ..< totalValidators:
|
|
let
|
|
v = validatorFileBaseName(i)
|
|
depositFn = outputDir / v & ".deposit.json"
|
|
privKeyFn = outputDir / v & ".privkey"
|
|
|
|
if existsFile(depositFn) and existsFile(privKeyFn):
|
|
continue
|
|
|
|
let
|
|
privKey = if generateFakeKeys: makeFakeValidatorPrivKey(i)
|
|
else: ValidatorPrivKey.random
|
|
pubKey = privKey.pubKey()
|
|
|
|
let
|
|
withdrawalCredentials = makeFakeHash(i)
|
|
|
|
proofOfPossessionData = DepositInput(
|
|
pubkey: pubKey,
|
|
withdrawal_credentials: withdrawalCredentials)
|
|
|
|
proofOfPossession = bls_sign(
|
|
privkey, hash_tree_root(proofOfPossessionData).data,
|
|
0 # TODO - domain
|
|
)
|
|
|
|
let
|
|
deposit = Deposit(
|
|
deposit_data: DepositData(
|
|
amount: MAX_EFFECTIVE_BALANCE,
|
|
timestamp: 0, # TODO https://github.com/ethereum/eth2.0-specs/pull/834
|
|
deposit_input: DepositInput(
|
|
pubkey: pubKey,
|
|
proof_of_possession: proofOfPossession,
|
|
withdrawal_credentials: withdrawalCredentials)))
|
|
|
|
writeTextFile(privKeyFn, $privKey)
|
|
writeFile(depositFn, deposit)
|
|
|
|
if generateFakeKeys:
|
|
echo "Keys generated by this tool are only for testing!"
|