-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The great function cleanup/rework #380
Comments
IMO the
I’d support that we make it into several small PRs instead of a huge one. 😃
It won’t be 100% complete since the object |
Very in favor of this in general :) I'm a little torn on removing the explicit params from the I'd like to take a stab at [1] maybe right after we merge in #374 (reviewing now!) |
What's helpful in general is minimizing order-dependence of the various parts of the spec - a concrete example of this would be what #348 points out - there's a dependency there on As far as implementation goes, the direction we're heading in is to do as much validation work as possible up front ("validate that there are at most X attestations") before making any state changes - this to minimize the cost of discarding faulty blocks (including costly state rewinds) - that's made harder if validation depends on partial state updates, because we then have to rewrite the validation code with |
Generally looks good to me!
I think
I think there's a balance here. The absolute extreme is that the spec is literally just a highly commented python implementation. It's probably worth thinking on a case-by-case basis, and also where we remove English text outside the python, add it back inside the python via comments. Another thing is that whereas some functions as "utility" functions that are used throughout the spec, others are highly specialized to a specific task. Those functions should probably NOT go at the top of the spec; they should go inline in whatever the relevant section is. We shouldn't be requiring readers to constantly jump back and forth between different parts of the page as much as possible. |
Closing for now as the focus is on content (e.g. fixing bugs) rather than presentation. A presentational overhaul will come in the "Transparent Paper" after the spec is finalised. Anyone keen to do the cleanups feel free to reopen :) |
Global organisation
hash
,hash_tree_root
,repeat_hash
,integer_squareroot
,shuffle
,split
,merkle_root
,verify_merkle_branch
, etc.state
:get_active_validator_indices
,get_shuffling
,get_shard_committees_at_slot
,get_block_root
,get_beacon_proposer_index
,get_attestation_participants
,get_effective_balance
, etc.state
:process_deposit
,process_ejections
,process_penalties_and_exits
,activate_validator
,initiate_validator_exit
,exit_validator
, etc.state: BeaconState
as the first argument.state
where possible to minimise the number of inputs. For exampleget_active_validator_indices
is currently givenvalidators: [ValidatorRecord], slot: int
when it suffices to passstate: BeaconState
.verify_proposer_signature
,process_randao
, ...get_ancestor
,repeat_hash
).process_deposit
has 8 inputs (state
,pubkey
,amount
,proof_of_possession
,withdrawal_credentials
,randao_commitment
,poc_commitment
) where the last 7 inputs can be replaced with a singleDepositData
object.Naming
get_
prefix exclusively for functions that readstate
. (E.g. renameget_initial_beacon_state
,get_domain
,get_fork_version
to something else.)validate_proof_of_possession
,verify_slashable_vote_data
should both use "validate" or "verify").prepare_validator_for_withdrawal
toinitiate_validator_withdrawal
for consistency withinitiate_validator_exit
.Local cleanups
@djrtwo, @hwwhww, @vbuterin Open to add/remove cleanup items from the above. It may make sense for me and/or @djrtwo to do the work when there are no open PRs to avoid merge conflict hell.
The text was updated successfully, but these errors were encountered: