-
Notifications
You must be signed in to change notification settings - Fork 1
fix: address comments on naive_state_transition branch #49
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
fix: address comments on naive_state_transition branch #49
Conversation
a2216de
to
4acd42b
Compare
Performance Report✔️ no performance regression detected Full benchmark results
|
.build_options = .{ | ||
.preset = .{ | ||
.default = "mainnet", | ||
.type = "string", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's missing constants
module related change here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I forgot updating that, and CI only scanned through "zig build" command now
which command should I run on CIs @ensi321 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I forgot updating that, and CI only scanned through "zig build" command now which command should I run on CIs @ensi321 ?
I think it needs to run zbuild sync
and then check if build.zig has changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* feat: implement EpochContext * feat: implement reference couting strategy * feat: CachedBeaconStateAllForks * feat: electra and capella utils * feat: implement phase0 processPendingAttestations() * feat: epoch transition cache * feat: processJustificationAndFinalization * feat: processInactivityUpdates * feat: processRegistryUpdates * feat: processSlashings * feat: processRewardsAndPenalties * feat: processEth1DataReset * fix: blst compilation error * fix: update hashtree-z * fix: skip darwin-x64 target due to hashtree * feat: processPendingDeposits() * feat: processPendingConsolidations() * feat: processEffectiveBalanceUpdates() * feat: processEpoch() * feat: afterProcessEpoch() * feat: processSyncCommitteeUpdates() * fix: inline switch prongs for BeaconStateAllForks * feat: model BeaconBlock * feat: fork aware hashTreeRoot() * feat: processBlockHeader * feat: processWithdrawals() * feat: convert ExecutionPayload to ExecutionPayloadHeader * feat: processExecutionPayload() * feat: fastAggregateVerify() * feat: randao SignatureSet * refactor: move beacon_state and beacon_block and execution_payload to types folder * feat: model IndexedAttestation * feat: indexed_attestation signature set * feat: AttesterSlashings * fix: implement fork in fork.zig * feat: bls_to_execution_change signature set * feat: proposer signature set * refactor: move Fork definition to types folder * feat: proposer_slashings signature set * feat: voluntary_exits signature set * feat: process_randao * feat: process_eth1_data * feat: slash_validator * feat: process_proposer_slashing * feat: attestation utils * feat: is_valid_indexed_attestation * feat: process_attester_slashing * feat: getIndexedAttestation() and getAttestingIndices() in EpochCache * feat: process_attestation_phase0 * feat: process_attestation_altair * feat: process_attestations * fix: generic validateAttestation * chore: improve processs_attester_slashing * fix: remove fork on process_attestation flow * fix: remove fork in all state_transition functions * feat: process_deposit * feat: process_voluntary_exit * feat: process_bls_to_execution_change * feat: process_deposit_request * feat: process_withdrawal_request * feat: process_consolidation_request * feat: process_operations * feat: getAttestationsSignatureSets() * feat: process_sync_committee * feat: process_blob_kzg_commitments * feat: process_block * feat: process_slot * fix: change ChainConfig property inside BeaconConfig * fix: ForkSeq import path * feat: params and config modules * fix: add test folder * fix: state_transition module in its own folder * feat: add network chain configs * fix: model EpochCache as reference count in CachedBeaconstateAllForks * fix: create EpochCache from a beacon state * feat: separate unit tests and int tests * fix: SyncCommitteeCache * fix: int test createCachedBeaconState * fix: generalize committee_indices * fix: support u64 proposer index * refactor: ReferenceCount * fix: generalize innerShuffleList() * fix: processPendingDeposits * feat: implement TestCachedBeaconStateAllForks * fix: unit test beforeProcessEpoch (#27) * fix: stack allocation EpochTransitionCache * fix: pass by reference in process_epoch() functions * fix: rewards and penalties as output params * fix: unit test process_justification_and_finalization * fix: reuse reards and penalties from EpochTransisionCache * fix: process_epoch_fn compilation errors * fix: PubkeyIndexMap to support both u32 and u64 * fix: processPendingDeposits compilation errors * chore(types): dedup panic statements (#29) * fix: processPendingConsolidations compilation errors * fix: processEffectiveBalanceUpdates compilation errors * fix: processSlashingsReset compilation errors * fix: processHistoricalSummariesUpdate compilation errors * fix: processHistoricalRootsUpdate compilation errors * fix: processParticipationRecordUpdates compilation errors * fix: processParticipationFlagUpdates compiltation errors * fix: processSyncCommitteeUpdates compilation errors * feat: implement and consume getters in EpochCache * fix: wrong type for `ExecutionPayloadHeader` methods (#31) * fix: wrong type for `ExecutionPayloadHeader` methods * add usage to confirm * feat(types): add support for blinded block variants Adds support for `BlindedBeaconBlock` and `BlindedBeaconBlockBody` with a sanity test. * fix(types): correctly type methods in `ExecutionPayloadHeader` * fix(types): remove `isExecutionType` from `BlindedBeaconBlockBody` * feat: testProcessRewardsAndPenalties() * chore: test processInactivityUpdates() * chore: test processRegistryUpdates() * chore: test processSlashings() * fix: missing try in processEpoch() * fix: testProcessEpochFn to handle no-err functions * fix: unit test processPendingDeposits() * fix: unit test processPendingConsolidations() * chore: unit test processEffectiveBalanceUpdates() * chore: unit test processSlashingsReset() * chore: unit test processRandaoMixesReset() * chore: unit test processHistoricalSummariesUpdate() * fix: unit test processParticipationFlagUpdates() * chore: processSyncCommitteeUpdates unit tests * fix: append* instead of add* * fix: unit test the main processEpoch() function * fix: correct method name rotateEpochParticipations() * fix: processSyncCommitteeUpdates next_sync_committee_pubkeys_slices[i] * fix: wrong type for `ExecutionPayloadHeader` methods (#31) * fix: wrong type for `ExecutionPayloadHeader` methods * add usage to confirm * feat(types): add support for blinded block variants Adds support for `BlindedBeaconBlock` and `BlindedBeaconBlockBody` with a sanity test. * fix(types): correctly type methods in `ExecutionPayloadHeader` * fix(types): remove `isExecutionType` from `BlindedBeaconBlockBody` * main stf fix import undo panic dedup deletion * main stf skeleton * fix: inline else in beacon_state.zig * fix: use imported type in beacon_state.zig * chore: add comment for ReferenceCount.get() usage * chore: avoid optional where possible * chore: avoid double negative in process_rewards_and_penalties * chore: avoid optional in process_slashings * fix: expicit params for getTestProcessFn() * fix: avoid negative terms in getTestProcessFn() util * fix: TestRunner and TestOpt * main stf skeleton * more compilation fixes * process attestation fixes * processAttestation * processDeposit * more QoL tweaks * processBlsToExecutionChanges * fix: verifyMerkleBranch * processVoluntaryExits * processDepositRequest * processWithdrawalRequest * processConsolidationRequest * processSyncCommittee * processSyncCommittee pt 2 * processBlobKzgCommitments * unnecessary compileLog; test runs * rename unblinded -> regular for clearer names * more simplification with regular vs blinded * move SignedBlock out * test: processBlockHeader * test: processWithdrawals * test: processExecutionPayload * test:processRandao * test: processEth1Data * test: process operations * test: process sync committee and blob kzg * clean imports * remove print * ergonomic pending withdrawals * zbuild sync * fix utils * fix build * test: skip stf test for now * uncomment beforeProcessEpoch and processEpoch * slot, fork, latestBlockHeader api changes * feat(beacon_state): more un-OOPing of API * feat(beacon_state): more unOOP * feat(beacon_state): finish simplifying beacon_state * feat(beacon_block): unoops * feat(beacon_block): fin * feat(signed_block): clean up * feat(signed_block): move to types/ * fix imports * feat: revamp types this still feels a little wrong, there are only that many reusable types from `consensus_types` that I think the cleaner way might just be to use them directly instead of reimports. * remove ValidatorIndices * feat(process_block): ProcessBlockOpts * remove unnecessary TODO for blockToHeader * missed out removing appendPendingDeposit * chore: remove TODOs Some TODOs are either already completed, or have low-hanging fruit changes that are implemented in this commit. * fix(bls): blst test * fix: compilation issues * chore: nuke primitives.zig we should just directly import and use ssz types where possible instead of needlessly importing and reexporting them. This provides clarity of what the underlying type is, because we also have some types native only to state transition (such as the beacon blocks) * chore: remove script * feat(stf): implement isMergeTransitionComplete * use clone * comments * feat(process_epoch): use toBoolArray for justification bits * fix(epoch_transition_cache): use initCapacity * style changes * fix(validator): snake_case instead of camelCase * chore: style * slight stylistic change for readability * fix: typo: acrive -> active * fix(epoch_participation): prefer `clearRetainingCapacity` over `deinit` For 2 reasons: 1. we're about to reuse the same `ArrayList` again, so there's no reason to `deinit` 2. we can assume (at the very least) the capacity of the 2 arraylists are the same because `resize` was called in `beforeProcessEpoch`. * feat(processBlock): handle expected_withdrawals_result deinit * remove unused allocator params * fix(proposer_slashing): verify_signature as bool instead of ?bool * feat(slash_validator): use switch/case instead of if/else to set slashing penalty quotient * feat(slash_validator): switch/case for all fork dependent values * fix(processBlsToExecutionChange): verify_signature as bool instead of ?bool * style * fix(processSyncAggregate): verify_signature as bool instead of ?bool * update zbuild * build: update zbuild * fix: deinit expected withdrawal result * fix(beacon_state): properly implement rotateEpochParticipation * feat(beacon_state): fully impl clone * feat(stf): upgrade state * chore: move options into params * fix upgrade state * chore(test_utils): move test_utils into state_transition module `test_utils` rely on `state_transition`, so importing both of them in unit tests result in a circular dependency. It makes more sense to put `test_utils` in `state_transition` and reuse it that way. * test: test process attestations * chore: remove test/utils * update .gitignore * chore: clean up `BlockExternalData` * fix: missing ExecutinoPayloadStatus enum * chore: remove upgrade_state.zig * remove allocator from processWithdrawals * rework processWithdrawals a bit * fix: address comments on naive_state_transition branch (#49) * feat: merge main * fix: use @TagName() in ForkSeq * fix: remove ForkSeq.isXXX() * fix: handle integer underflow of epoch - 1 * fix: verify signature in isValidIndexedAttestation() * fix: handle addPubkey() where index=len * fix: use @TagName() in Preset * feat: make constants module * fix: move ForkSeq from params to config * fix: move preset from consensus_types to params * fix: params should not import consensus_types * fix: rename params to preset * fix: CI steps * fix: unify blst dependencies * feat: precompute all domains * fix: remove unnecessary CI trigger --------- Co-authored-by: Tuyen Nguyen <[email protected]> * fix: CI to run all tests specified in build.zig * fix: clean up TODOs * remove usage of ?bool in preference for plain bool * fix: simplify Preset method * fix: generate build.zig from zbuild * fix: zig 0.14.1 * fix: comment out zbuild sync job * fix: fix zig 0.14.1 after merge * fix: switch back to zig 0.14.0 --------- Co-authored-by: Tuyen Nguyen <[email protected]> Co-authored-by: bing <[email protected]>
Motivation
Description
main
to resolve conflict