* `ExchangeCapabilities`: Transform `O(n**2)` into `O(2n)` and fix logging.
* Find peers with subnets and logs: Refactor
* Validator custody: Do not wait being subscribed to advertise correct `cgc`. (temp hack)
* `DataColumnStorageSummary`: Implement `HasAtLeastOneIndex`.
* `DataColumnStorage.Get`: Exit early if the root is found but no corresponding columns.
* `custodyColumnsFromPeers`: Simplify.
* Remove duplicate `uint64MapToSortedSlice` function.
* `DataColumnStorageSummary`: Add `Stored`.
* Refactor reconstruction related code.
* `finalizedState` ==> `FinalizedState`.
We'll need it in an other package later.
* `setTargetValidatorsCustodyRequirement`: Use finalized state instead of head state.
* Fix James's comment.
* `reconstructAndBroadcastDataColumnSidecars`: Improve logging.
* `ReconstructDataColumnSidecars`: Add comments and return early if needed.
* `reconstructAndBroadcastDataColumnSidecars`: Return early if not blobs are retrieved from the EL.
* `filterPeerWhichCustodyAtLeastOneDataColumn`: Remove unneded log field.
* Fix Terence's comment.
* Seperate subscribe data columns from attestation and sync committee subnets
* Fix test
* Rename to subscribe-data-subnets
* Update to subscribe-all-data-subnets
* `--subscribe-all-data-subnets`: Add `.` at the end of help, since it seems to be the consensus.
* `ConfigureGlobalFlags`: Fix log.
---------
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* `data_column.go`: Factorize declarations (no functional changes).
* Verification for data columns: Do not recompute again if already done.
* `SaveDataColumns`: Delete because unused.
* `MissingDataColumns`: Use `DataColumnStorageSummarizer` instead of `DataColumnStorage`
* `TestFetchDataColumnsFromPeers`: Move trusted setup load out of the loop for optimization.
* `TestFetchDataColumnsFromPeers`: Use fulu block instead of deneb block.
* `fetchDataColumnsFromPeers`: Use functions already implemented in the `sync` package instead of duplicated them here.
* `fetchDataColumnsFromPeers` ==> `fetchMissingDataColumnsFromPeers`.
* Data columns initial sync: simplify
* Requests data columns by range: Move from initial sync to sync package.
Since it will eventually be used by the backfill package, and
the backfill packages does not depend on the initial sync package.
* Reconstruct data columns from gossip source: Call `setSeenDataColumnIndex`.
* `reconstructAndBroadcastDataColumnSidecars`: Minor optimisation.
Avoid to range over all columns.
* Reconstructed data columns sidecars from EL: Avoid broadcasting already received data columns.
* Extract the block fetcher's peer selection logic for data columns so it can be used in both by range and by root requests
* Refactor data column sidecar request to send requests to multiple peers instead of supernodes
* Remove comment
* Remove unused method
* Add tests for dmissiblePeersForDataColumns
* Extract data column fetching into standalone functions
* Remove AdmissibleCustodyGroupsPeers and replace the final call with requests to multiple peers
* Apply suggestions from code review
Co-authored-by: Manu NALEPA <nalepae@gmail.com>
* Wrap errors
* Use cached peedas.Info and properly convert custody groups to custody columns
* Rename filterPeersForRangeReq
* Preserve debugging descriptions when filtering out peers
* Remove unused functions.
* Initialize nested maps
* Fix comment
* First pass at retry logic for data column requests
* Select fresh peers for each retry
* Return an error if there are requested columns remaining
* Adjust errors
* Improve slightly the godoc.
* Improve wrapped error messages.
* `AdmissiblePeersForDataColumns`: Use value or `range`.
* Remove `convertCustodyGroupsToDataColumnsByPeer` since used only once.
* Minor fixes.
* Retry until we run out of peers
* Delete from the map of peers instead of filtering
* Remove unneeded break
* WIP: TestRequestDataColumnSidecars
* `RequestDataColumnSidecars`: Move the happy path in the for loop.
* Convert the peer ID to a node ID instead of using peer.EnodeID
* Extract AdmissiblePeersForDataColumns from a method into a function and use it (instead of a mock) in TestRequestDataColumnSidecars
* Track data column requests in tests to compare vs expectations
* Run gazelle
* Clean up test config changes so other tests don't break
* Clean up comments
* Minor changes.
* Add tests for peers that don't respond with all requested columns
* Respect MaxRequestDataColumnSidecars
---------
Co-authored-by: Manu NALEPA <nalepae@gmail.com>
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Implement data column support for different storage layouts
* Fix errors
* Fix linting
* `slotFromFile`: First try to decode as a data column.
---------
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Update ckzg version to include ComputeCells
* Minor fix
* Run `bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%prysm_deps -prune=true`
---------
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Add new message type to proto and generate .go files
* `proto/engine/v1`: Remove `execution_engine_eip7594.go` since this file does not exists.
Rerun ` hack/update-go-pbs.sh` and `hack/update-go-ssz.sh `.
---------
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* `TestBuildBwbSlices`: Add test case failing with the current implementation.
* Fix `buildBwbSlices` to comply with the new test case.
* `block_fetchers.go`: Improve logging and godoc.
* `DataColumnsRPCMinValidSlot`: Update to Fulu.
Previously, `buildBwbSlices` were built, and then only to big requests were batched in `buildDataColumnSidecarsByRangeRequests`.
In some edge cases, this lead to requesting data columns to peers for blocks with no blobs.
Splitting by batch directly in `buildBwbSlices` fixes the issue.
Rationale:
This log is the only one notifying the user a new fork happened.
A new fork is always a little bit stressful for a node operator.
Having at least one log indicating the client switched fork is something useful.
* `ColumnAlignsWithBlock`: Split lines.
* Data columns verifications: Batch
* Remove completely `DataColumnBatchVerifier`.
Only `DataColumnsVerifier` (with `s`) on columns remains.
It is the responsability of the function which receive the data column
(either by gossip, by range request or by root request) to verify the
data column wrt. corresponding checks.
* Fix Nishant's comment.
* `validateDataColumnsByRange`: `current` ==> `currentSlot`.
* `validateRequest`: Extract `remotePeer` variable.
* `dataColumnSidecarsByRangeRPCHandler`: Small non functional refactor.
* `streamDataColumnBatch`: Fix major bug.
Before this commit, the node was unable to respond with a data column index higher than the count of stored data columns.
For example, if there is 8 data columns stored for a given block, the node was
able to respond for data columns indices 1, 3, and 5, but not for 10, 16 or 127.
The issue was visible only for full nodes, since super nodes always store 128 data columns.
* Initial sync: Fetch data columns from all peers.
(Not only from supernodes.)
* Nishant's comment: Fix `lastSlot` and `endSlot` duplication.
* Address Nishant's comment.
* Fix Commitments Check
* `highestFinalizedEpoch`: Refactor (no functional change).
* `retrieveMissingDataColumnsFromPeers`: Fix logs.
* `VerifyDataColumnSidecarKZGProofs`: Optimise with capacity.
* Save data columns when initial syncing.
* `dataColumnSidecarsByRangeRPCHandler`: Add logs when a request enters.
* Improve logging.
* Improve logging.
* `peersWithDataColumns: Do not filter any more on peer head slot.
* Fix Nishant's comment.
---------
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Improve logging.
* `retrieveMissingDataColumnsFromPeers`: Limit to `512` items per request.
* `retrieveMissingDataColumnsFromPeers`: Allow `nil` peers.
Before this commit:
If, when this funcion is called, we are not yet connected to enough peers, then `peers` will be possibly not be satisfaying,
and, if new peers are connected, we will never see them.
After this commit:
If `peers` is `nil`, then we regularly check for all connected peers.
If `peers` is not `nil`, then we use them.
* `BestFinalized`: Refactor (no functional change).
* `BestNonFinalized`: Refactor (no functional change).
* `beaconBlocksByRangeRPCHandler`: Remove useless log.
The same is already printed at the start of the function.
* `calculateHeadAndTargetEpochs`: Avoid `else`.
* `ConvertPeerIDToNodeID`: Improve error.
* Stop printing noisy "peer should be banned" logs.
* Initial sync: Request data columns from peers which:
- custody a superset of columns we need, and
- have a head slot >= our target slot.
* `requestDataColumnsFromPeers`: Shuffle peers before requesting.
Before this commit, we always requests peers in the same order,
until one responds something.
Without shuffling, we always requests data columns from the same
peer.
* `requestDataColumnsFromPeers`: If error from a peer, just log the error and skip the peer.
* Improve logging.
* Fix tests.
* `retrieveMissingDataColumnsFromPeers`: Improve logging.
* `dataColumnSidecarByRootRPCHandler`: Stop decreasing peer's score if asking for a column we do not custody.
* `dataColumnSidecarByRootRPCHandler`: If a data column is unavailable, stop waiting for it.
This behaviour was useful for peer sampling.
Now, just return the data column if we store it.
If we don't, skip.
* Dirty code comment.
* `retrieveMissingDataColumnsFromPeers`: Improve logs.
* `SendDataColumnsByRangeRequest`: Improve logs.
* `dataColumnSidecarsByRangeRPCHandler`: Improve logs.
* `columnErrBuilder`: Uses `Wrap` instead of `Join`.
Reason: `Join` makes a carriage return. The log is quite unreadable.
* `validateDataColumn`: Improve log.
* `areDataColumnsAvailable`: Improve log.
* `SendDataColumnSidecarByRoot` ==> `SendDataColumnSidecarsByRootRequest`.
* `handleDA`: Refactor error message.
* `sendRecentBeaconBlocksRequest` ==> `sendBeaconBlocksRequest`.
Reason: There is no notion at all of "recent" in the function.
If the caller decides to call this function only with "recent" blocks, that's fine.
However, the function itself will know nothing about the "recentness" of these blocks.
* `sendBatchRootRequest`: Improve comments.
* `sendBeaconBlocksRequest`: Avoid `else` usage and use map of bool instead of `struct{}`.
* `wrapAndReportValidation`: Remove `agent` from log.
Reason: This prevent the log to hold on one line, and it is not really useful to debug.
* `validateAggregateAndProof`: Add comments.
* `GetValidCustodyPeers`: Fix typo.
* `GetValidCustodyPeers` ==> `DataColumnsAdmissibleCustodyPeers`.
* `CustodyHandler` ==> `DataColumnsHandler`.
* `CustodyCountFromRemotePeer` ==> `DataColumnsCustodyCountFromRemotePeer`.
* Implement `DataColumnsAdmissibleSubnetSamplingPeers`.
* Use `SubnetSamplingSize` instead of `CustodySubnetCount` where needed.
* Revert "`wrapAndReportValidation`: Remove `agent` from log."
This reverts commit 55db351102.
* `scheduleReconstructedDataColumnsBroadcast`: Really minor refactor.
* `receivedDataColumnsFromRootLock` -> `dataColumnsFromRootLock`
* `reconstructDataColumns`: Stop looking into the DB to know if we have some columns.
Before this commit:
Each time we receive a column, we look into the filesystem for all columns we store.
==> For 128 columns, it looks for 1 + 2 + 3 + ... + 128 = 128(128+1)/2 = 8256 files look.
Also, as soon as a column is saved into the file system, then if, right after, we
look at the filesystem again, we assume the column will be available (strict consistency).
It happens not to be always true.
==> Sometimes, we can reconstruct and reseed columns more than once, because of this lack of filesystem strict consistency.
After this commit:
We use a (strictly consistent) cache to determine if we received a column or not.
==> No more consistency issue, and less stress for the filesystem.
* `dataColumnSidecarByRootRPCHandler`: Improve logging.
Before this commit, logged values assumed that all requested columns correspond to
the same block root, which is not always the case.
After this commit, we know which columns are requested for which root.
* Add a log when broadcasting a data column.
This is useful to debug "lost data columns" in devnet.
* Address Nishant's comment
* `sendBatchRootRequest`: Refactor and add comments.
* `sendBatchRootRequest`: Do send requests to peers that custodies a superset of our columns.
Before this commit, we sent "data columns by root requests" for data columns peers do not custody.
* Data columns: Use subnet sampling only.
(Instead of peer sampling.)
aaa
* `areDataColumnsAvailable`: Improve logs.
* `GetBeaconBlock`: Improve logs.
Rationale: A `begin` log should always be followed by a `success` log or a `failure` log.
* `CustodyCountFromRemotePeer`: Set happy path in the outer scope.
* `FindPeersWithSubnet`: Improve logging.
* `listenForNewNodes`: Avoid infinite loop in a small subnet.
* Address Nishant's comment.
* FIx Nishant's comment.
* `pingPeers`: Add log with new ENR when modified.
* `p2p Start`: Use idiomatic go error syntax.
* P2P `start`: Fix error message.
* Use not bootnodes at all if the `--chain-config-file` flag is used and no `--bootstrap-node` flag is used.
Before this commit, if the `--chain-config-file` flag is used and no `--bootstrap-node` flag is used, then bootnodes are (incorrectly) defaulted on `mainnet` ones.
* `validPeersExist`: Centralize logs.
* `AddConnectionHandler`: Improve logging.
"Peer connected" does not really reflect the fact that a new peer is actually connected. --> "New peer connection" is more clear.
Also, instead of writing `0`, `1`or `2` for direction, now it's writted "Unknown", "Inbound", "Outbound".
* Logging: Add 2 decimals for timestamt in text and JSON logs.
* Improve "no valid peers" logging.
* Improve "Some columns have no peers responsible for custody" logging.
* `pubsubSubscriptionRequestLimit`: Increase to be consistent with data columns.
* `sendPingRequest`: Improve logging.
* `FindPeersWithSubnet`: Regularly recheck in our current set of peers if we have enough peers for this topic.
Before this commit, new peers HAD to be found, even if current peers are eventually acceptable.
For very small network, it used to lead to infinite search.
* `subscribeDynamicWithSyncSubnets`: Use exactly the same subscription function initially and every slot.
* Make deepsource happier.
* Nishant's commend: Change peer disconnected log.
* NIshant's comment: Change `Too many incoming subscription` log from error to debug.
* `FindPeersWithSubnet`: Address Nishant's comment.
* `batchSize`: Address Nishant's comment.
* `pingPeers` ==> `pingPeersAndLogEnr`.
* Update beacon-chain/sync/subscriber.go
Co-authored-by: Nishant Das <nishdas93@gmail.com>
---------
Co-authored-by: Nishant Das <nishdas93@gmail.com>
* `broadcastAndReceiveDataColumns`: Use real `sidecar.ColumnIndex` instead of position in the slice.
And improve logging as well.
* `isDataColumnsAvailable`: Improve logging.
* `validateDataColumn`: Print `Accepted data column sidecar gossip` really at the end.
* Subscriber: Improve logging.
* `sendAndSaveDataColumnSidecars`: Use common used function for logging.
* `dataColumnSidecarByRootRPCHandler`: Logging - Pring `all` instead of all the columns for a super node.
* Verification: Improve logging.
* `DataColumnsWithholdCount`: Set as `uint64` instead `int`.
* `DataColumnFields`: Improve logging.
* Logging: Remove now useless private `columnFields`function.
* Avoid useless goroutines blocking for reconstruction.
* Update beacon-chain/sync/subscriber.go
Co-authored-by: Nishant Das <nishdas93@gmail.com>
* Address Nishant's comment.
* Improve logging.
---------
Co-authored-by: Nishant Das <nishdas93@gmail.com>
* Persist All Changes
* Fix All Tests
* Fix Build
* Fix Build
* Fix Build
* Fix Test Again
* Add missing verification
* Add Test Cases for Data Column Validation
* Fix comments for methods
* Fix comments for methods
* Fix Test
* Manu's Review
* Fix the obvious...
* Data columns sampling: Modify logging.
* `waitForChainStart`: Set it threadsafe - Do only wait once.
* Sampling: Wait for chain start before running the sampling.
Reason: `newDataColumnSampler1D` needs `s.ctxMap`.
`s.ctxMap` is only set when chain is started.
Previously `waitForChainStart` was only called in `s.registerHandlers`, it self called in a go-routine.
==> We had a race condition here: Sometimes `newDataColumnSampler1D` were called once `s.ctxMap` were set, sometimes not.
* Adresse Nishant's comments.
* Sampling: Improve logging.
* `waitForChainStart`: Remove `chainIsStarted` check.
* `SendDataColumnsByRangeRequest`: Add some new fields in logs.
* `BlobStorageSummary`: Implement `HasDataColumnIndex` and `AllDataColumnsAvailable`.
* Implement `fetchDataColumnsFromPeers`.
* `fetchBlobsFromPeer`: Return only one error.
* DeepSource: Pass heavy objects by pointers.
* `removeBlockFromQueue`: Remove redundant error checking.
* `fetchBlobsFromPeer`: Use same variable for `append`.
* Remove unused arguments.
* Combine types.
* `Persist`: Add documentation.
* Remove unused receiver
* Remove duplicated import.
* Stop using both pointer and value receiver at the same time.
* `verifyAndPopulateColumns`: Remove unused parameter
* Stop using mpty slice literal used to declare a variable.
* PeerDAS: Run reconstruction in parallel.
* `isDataAvailableDataColumns` --> `isDataColumnsAvailable`
* `isDataColumnsAvailable`: Return `nil` as soon as half of the columns are received.
* Make deepsource happy.
* Update ckzg4844 to latest version
* Run go mod tidy
* Remove unnecessary tests & run goimports
* Remove fieldparams from blockchain/kzg
* Add back blank line
* Avoid large copies
* Run gazelle
* Use trusted setup from the specs & fix issue with struct
* Run goimports
* Fix mistake in makeCellsAndProofs
---------
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* use recoverCellsAndKZGProofs
* make recoverAllCells and CellsToBlob private
* chore: all methods now return CellsAndProof struct
* chore: update code
* chore: move all ckzg related functionality into kzg package
* refactor code to match
* run: bazel run //:gazelle -- fix
* chore: add some docs and stop copying large objects when converting between types
* fixes
* manually add kzg.go dep to Build.Hazel
* move kzg methods to kzg.go
* chore: add RecoverCellsAndProofs method
* bazel run //:gazelle -- fix
* make Cells be flattened sequence of bytes
* chore: add test for flattening roundtrip
* chore: remove code that was doing the flattening outside of the kzg package
* fix merge
* fix
* remove now un-needed conversion
* use pointers for Cell parameters
* linter
* rename cell conversion methods (this only applies to old version of c-kzg)
* change recoverBlobs to recoverCellsAndProofs
* modify code to take in the cells and proofs for a particular blob instead of the blob itself
* add CellsAndProofs structure
* modify recoverCellsAndProofs to return `cellsAndProofs` structure
* modify `DataColumnSidecarsForReconstruct` to accept the `cellsAndKZGProofs` structure
* bazel run //:gazelle -- fix
* use kzg abstraction for kzg method
* move CellsAndProofs to kzg.go
* chore: move all ckzg related functionality into kzg package
* refactor code to match
* run: bazel run //:gazelle -- fix
* chore: add some docs and stop copying large objects when converting between types
* fixes
* manually add kzg.go dep to Build.Hazel
* move kzg methods to kzg.go
* chore: add RecoverCellsAndProofs method
* bazel run //:gazelle -- fix
* use BytesPerBlob constant
* chore: fix some deepsource issues
* one declaration for commans and blobs
* Wrap errors, add logs.
* `missingColumnRequest`: Fix blobs <-> data columns mix.
* `ColumnIndices`: Return `map[uint64]bool` instead of `[fieldparams.NumberOfColumns]bool`.
* `DataColumnSidecars`: `interfaces.SignedBeaconBlock` ==> `interfaces.ReadOnlySignedBeaconBlock`.
We don't need any of the non read-only methods.
* Fix comments.
* `handleUnblidedBlock` ==> `handleUnblindedBlock`.
* `SaveDataColumn`: Move log from debug to trace.
If we attempt to save an already existing data column sidecar,
a debug log was printed.
This case could be quite common now with the data column reconstruction enabled.
* `sampling_data_columns.go` --> `data_columns_sampling.go`.
* Reconstruct data columns.
* Support Data Columns For By Root Requests
* Revert Config Changes
* Fix Panic
* Fix Process Block
* Fix Flags
* Lint
* Support Checkpoint Sync
* Manu's Review
* Add Support For Columns in Remaining Methods
* Unmarshal Uncorrectly
* Add Data Structure for New Request Type
* Add Data Column By Range Handler
* Add Data Column Request Methods
* Add new validation for columns by range requests
* Fix Build
* Allow Prysm Node To Fetch Data Columns
* Allow Prysm Node To Fetch Data Columns And Sync
* Bug Fixes For Interop
* GoFmt
* Use different var
* Manu's Review
* Enable E2E And Add Fixes
* Register Same Topic For Data Columns
* Initialize Capacity Of Slice
* Fix Initialization of Data Column Receiver
* Remove Mix In From Merkle Proof
* E2E: Subscribe to all subnets.
* Remove Index Check
* Remaining Bug Fixes to Get It Working
* Change Evaluator to Allow Test to Finish
* Fix Build
* Add Data Column Verification
* Fix LoopVar Bug
* Do Not Allocate Memory
* Update beacon-chain/blockchain/process_block.go
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Update beacon-chain/core/peerdas/helpers.go
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Update beacon-chain/core/peerdas/helpers.go
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Gofmt
* Fix It Again
* Fix Test Setup
* Fix Build
* Fix Trusted Setup panic
* Fix Trusted Setup panic
* Use New Test
---------
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Add new DA check
* Exit early in the event no commitments exist.
* Gazelle
* Fix Mock Broadcaster
* Fix Test Setup
* Update beacon-chain/blockchain/process_block.go
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Manu's Review
* Fix Build
---------
Co-authored-by: Manu NALEPA <enalepa@offchainlabs.com>
* Remove capital letter from error messages.
* `[4]byte` => `[fieldparams.VersionLength]byte`.
* Prometheus: Remove extra `committee`.
They are probably due to a bad copy/paste.
Note: The name of the probe itself is remaining,
to ensure backward compatibility.
* Implement Proposer RPC for data columns.
* Fix TestProposer_ProposeBlock_OK test.
* Remove default peerDAS activation.
* `validateDataColumn`: Workaround to return a `VerifiedRODataColumn`
* Bump `c-kzg-4844` lib to the `das` branch.
* Implement `MerkleProofKZGCommitments`.
* Implement `das-core.md`.
* Use `peerdas.CustodyColumnSubnets` and `peerdas.CustodyColumns`.
* `CustodyColumnSubnets`: Include `i` in the for loop.
* Remove `computeSubscribedColumnSubnet`.
* Remove `peerdas.CustodyColumns` out of the for loop.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.