Commit Graph

133 Commits

Author SHA1 Message Date
Danny Ryan c7166a37af
change eth1data block_hash type to Hash32 in phase 0 2021-04-15 06:47:11 -05:00
protolambda 07b7774241
misc. phase1 modules refactor updates 2021-03-30 01:46:02 +02:00
Alex Vlasov 020895e35d
Typing problems fixes (#2271)
* Typing problem fixed: `process_block_header` passes `Bytes32()` to `state_root` of `BeaconBlockHeader`, which type is `Root`

* Typing problem fixed in `initialize_beacon_state_from_eth1`: `len` returns an `int` value, while `deposit_count=uint64` of `Eth1Data` has type `uint64`

* Typing problem fixed in `process_rewards_and_penalties`: `numerator` of type `int` passed to `weight` parameter of `get_flag_index_deltas`, which has type `uint64`

* Typing problem fixed in `process_attestation`; `False` passes as `crosslink_success` parameter of `PendingAttestation`, which has type `boolean`. `False` is an instance of `(python.)bool` and is not an instance of `(ssz.)boolean`

* Typing problem fixed: `shard_data_roots` of `ShardTransition` has type `List[Bytes32]`, but its elements are used as if they were `Root` values, e.g. in `process_chunk_challenge` method: passed to `data_root` of `CustodyChunkChallengeRecord` which has type `Root`

* Typing problem fixed in `process_custody_final_updates`: `index` has type `int`, while `validator_indices_in_records` has type `Set[ValidatorIndex]`, so tesing whether `index in validator_indices_in_records` can be risky, depending on implementation details. `ValidatorIndex(index) in validator_indices_in_records` is a safer variant.

* Typing problem fixed: `slashed` parameter of `pack_compact_validator` has type `(python.)bool`, however in `committee_to_compact_committee` a value of `(ssz.)boolean` is passed as a value of the parameter

* Typing problem fixed: `inactivity_scores` is a `List[uint64,...]`, while it is intialized/appended with values of `(python.)int` type

* fixed according to @protolambda suggestions

* changed types of _WEIGHT constants and appropriate variables/parameters, according to @protolambda suggestions

* revert code formatting back

* Introduced ZERO_ROOT according to @protolambda 's suggestion

* Reverted back to , according to @protolambda comments
2021-03-25 22:03:21 +01:00
Danny Ryan bb85ef5a57
pr cleanup 2021-03-22 10:53:26 -06:00
protolambda 493dd17cc4
reduce justification and finalization Altair diff 2021-03-21 04:22:45 +01:00
Justin Drake e7ebd08d69 Altair cosmetic cleanups plus a couple substantive changes 2021-03-15 11:08:41 +00:00
Danny Ryan 8ec082fcf9
Merge pull request #2149 from ethereum/0x01-creds
Eth1 withdrawal credentials (0x01)
2021-02-16 13:06:34 -06:00
Hsiao-Wei Wang 1b00c10ed3
Apply @michaelsproul's feedback 2021-01-27 14:47:52 +08:00
Hsiao-Wei Wang e53213a585
Minor refactor 2021-01-20 13:06:24 +08:00
Hsiao-Wei Wang daa4798704
Break down process_final_updates 2021-01-19 21:41:55 +08:00
Ben Edgington 452e3301be Fix typo 2020-12-21 10:22:04 +00:00
Justin ef3802b8e7
Cleaner section title
"Withdrawal prefixes" matches `[BLS]/[ETH1_ADDRESS]_WITHDRAWAL_PREFIX`
2020-12-12 20:40:59 +00:00
Justin 784e567d4b
Fix table for withdrawal credentials prefixes
Minor cosmetic fixes (misformated table, section title).
2020-12-12 20:38:40 +00:00
Danny Ryan 6b728c1880
add eth1 withdrawal credentials to spec 2020-12-11 15:03:58 -07:00
Justin f2fe390638
secret_key => privkey 2020-12-08 09:20:50 +00:00
Justin 0b9e80d1eb
grammar 2020-12-07 23:15:34 +08:00
Justin 56048cbf56
Cosmetic cleanups to BLS signatures section
Miscellaneous cosmetic cleanups to the " BLS signatures" section:

1) fix section capitalisation for spec consistency
2) avoid uncapitalised "eth2" for spec consistency
3) avoid contractions (such as `PK` for `pubkey`) for spec consistency
4) various copyedits
2020-12-07 07:28:01 -07:00
Hsiao-Wei Wang 64412be0d7
Minor update ToC 2020-12-07 11:10:19 +08:00
Danny Ryan 7589af8e8d
remove wip notice on phase 0 specs 2020-11-04 09:30:29 -06:00
Danny Ryan cd7b1056b4
add mainnet deposit contract address and min genesis time 2020-11-04 09:11:52 -06:00
Hsiao-Wei Wang 7fb9226ec6
Make `state_transition` not return post state; the given pre state should have been mutated to post state. 2020-10-15 15:58:26 +08:00
Danny Ryan 91deacbf9c
double eth1data params 2020-10-07 18:52:47 -06:00
Hsiao-Wei Wang d264ad8af7
Merge pull request #2080 from ethereum/bls_v4
Bump IETF BLS spec version draft 03 -> draft 04
2020-10-05 22:12:52 +08:00
Danny Ryan 157f7e8ef4
upgrade config to mainnet values 2020-09-28 12:56:08 -06:00
Hsiao-Wei Wang ad4ad2d8b4
Bump IETF BLS spec version draft 03 -> draft 04 2020-09-25 15:01:41 +08:00
Hsiao-Wei Wang 899927af30
Remove note 2020-09-15 23:43:07 +08:00
Hsiao-Wei Wang cfc69e47e6
Bump IETF BLS standard version to -03 2020-09-11 17:17:51 +08:00
Danny Ryan 54f1abc943
Merge pull request #2036 from ethereum/typing_clean
Non-substantive typing clean-up
2020-09-10 14:07:32 -06:00
Hsiao-Wei Wang 6e900f4fcc
Add more typings, no substantive change 2020-09-03 19:27:16 +08:00
Hsiao-Wei Wang eed2df37f4
Make linter happy 2020-09-03 17:27:20 +08:00
vbuterin b35f8fff74
Add a constant for slash penalty multiplier
Make the multipler on slashed penalties (if portion `p` of validators are slashed each one loses `k*p` an explicit constant).
2020-09-02 12:26:27 +08:00
Danny Ryan b529d47a3b
pr feedback 2020-07-28 11:48:45 -04:00
Danny Ryan 235fb7e2a5
add clarifying comment for genesis skip conditions 2020-07-28 06:48:16 -04:00
Jacek Sieka 6f7652d330
process_attestation: Validate epoch before using it
`data.target.epoch` is used to count the active validator set.

Because `get_committee_count_per_slot` is extremely inefficient the way
the spec is written, clients cache it, or the underlying active
validator set.

Performing the checks in the given order leads to a (very unlikely)
security issue where the a cold and above all, distant value may get
used which may be costly - reordering the checks brings the value into a
more reasonable range before using it.
2020-07-24 07:26:37 +02:00
Hsiao-Wei Wang 8e82ca5d1a
Merge branch 'dev' into hwwhww/new_int_to_bytes_dev 2020-07-16 01:36:19 +08:00
Hsiao-Wei Wang 4b239e94b7
Mix PR feedback from Danny and Proto 2020-06-29 12:50:01 +08:00
Hsiao-Wei Wang 1d954ee9bd
PR feedback from @ericsson49
Co-authored-by: Alex Vlasov <avv49@mail.ru>
2020-06-29 12:33:52 +08:00
protolambda 3b7617f51a
make extracted byte uint8 for bitshift, do not use negative slice indexing, avoid negative comparison in test 2020-06-26 16:14:27 +02:00
protolambda 531184f42b
Infer types where possible, e.g. uint64+uint64=uint64 2020-06-26 15:41:47 +02:00
Hsiao-Wei Wang a061758a66
Use `encode_bytes` to implement `int_to_bytes`
Rename `bytes_to_int` to `bytes_to_uint64`

Use `encode_bytes` to implement `int_to_bytes`

Rename `int_to_bytes` to `uint_to_bytes` and move it to `ssz_impl.py`
2020-06-25 20:20:39 +08:00
Hsiao-Wei Wang 76840c9178
Merge branch 'dev' into hwwhww/strict-uint64 2020-06-19 17:01:04 +08:00
Hsiao-Wei Wang 4428a6aedf
Fix table 2020-06-18 13:50:10 +08:00
protolambda 41ebd51aff
Merge branch 'dev' into hwwhww/strict-uint64 2020-06-18 02:49:09 +02:00
protolambda ce0371a66b
fix comment: committees per slot for given *epoch* 2020-06-17 20:23:26 +02:00
protolambda 9b60a9b799
Avoid state usage in p2p validation, compute committee count per slot for epoch as a whole 2020-06-17 20:19:32 +02:00
Hsiao-Wei Wang 41cfa7fdf6
Merge branch 'dev' into dankrad-custody-256bit 2020-06-09 01:39:51 +08:00
Raw Pong Ghmoa 34412130c5
phase0: enable a tunable genesis time 2020-06-02 10:55:13 -06:00
Danny Ryan 3a4db69a20
Merge branch 'dev' into dankrad-custody-256bit 2020-06-01 18:45:22 -06:00
Danny Ryan a6d4566f51
Merge pull request #1834 from ethereum/clarify-genesis-safety
clarify that eth1 block follow distance for genesis
2020-05-20 12:44:29 -06:00
Danny Ryan 4ac2fc7eff
add missing column description fo SECONDS_PER_ETH1_BLOCK
Co-authored-by: Diederik Loerakker <proto@protolambda.com>
2020-05-20 12:28:08 -06:00