Skip to content
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

PeerDAS: Batch columns verifications #14559

Merged
merged 4 commits into from
Oct 23, 2024
Merged

Conversation

nalepae
Copy link
Contributor

@nalepae nalepae commented Oct 21, 2024

This PR transforms NewColumnVerifier (1 column) into NewDataColumnsVerifier (multiple columns, Data has been added for consistency).

The purpose of this PR is to batch data columns verification, and especially VerifyDataColumnsSidecarKZGProofs, which is much more efficient when called by batch than when called columns by columns.

On my computer (ARM M-2), duration of KZG verification assuming a constant blob count per block, for 32 blocks:

  • column by column: ~12-13 s
  • batch (all columns in the batch of 32 blocks): ~700 ms

==> x18 (!) improvement.

  • Able to sync a super node from genesis on peerdas-devnet-3
  • Able to sync a full node from genesis on peerdas-devnet-3 (in progress)

@nalepae nalepae force-pushed the peerDAS-initial-sync-batch branch 2 times, most recently from c3eb8d1 to 1efb15c Compare October 21, 2024 18:23
@nalepae nalepae force-pushed the peerDAS-initial-sync-batch branch 2 times, most recently from f65e1a6 to aebc3a0 Compare October 21, 2024 18:50
@nalepae nalepae marked this pull request as ready for review October 21, 2024 18:53
@nalepae nalepae requested a review from a team as a code owner October 21, 2024 18:53
@nalepae nalepae requested review from potuz, terencechain and james-prysm and removed request for a team October 21, 2024 18:53
@@ -69,26 +68,32 @@ var (
ErrColumnIndexInvalid = errors.New("incorrect column sidecar index")
)

type RODataColumnVerifier struct {
type RODataColumnsVerifier struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this being changed ? We already have a batch verifier for the cases where we need to modify multiple columns at once

@@ -538,9 +538,11 @@ func verifyColumn(
return false
}

vf := columnVerifier(roDataColumn, verification.SamplingColumnSidecarRequirements)
// TODO: Once peer sampling is used, we should verify all sampled data columns in a single batch.
verifier := dataColumnsVerifier([]blocks.RODataColumn{roDataColumn}, verification.SamplingColumnSidecarRequirements)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nit, but in go its always more preferable for shorter variable names (vf vs verifier). This was done in a few places in this PR

@nalepae nalepae force-pushed the peerDAS-initial-sync-batch branch 2 times, most recently from 416bddb to e6038a3 Compare October 22, 2024 15:37
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.
@nalepae nalepae force-pushed the peerDAS-initial-sync-batch branch from e6038a3 to 9490e32 Compare October 22, 2024 16:00
if err != nil {
return pubsub.ValidationReject, err
}

msg.ValidatorData = verifiedRODataColumn
if len(verifiedRODataColumns) != 1 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an error logged since its an impossible condition

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 843b43d.

@nalepae nalepae merged commit e599896 into peerDAS Oct 23, 2024
15 of 16 checks passed
@nalepae nalepae deleted the peerDAS-initial-sync-batch branch October 23, 2024 10:56
nalepae added a commit that referenced this pull request Oct 23, 2024
* `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.
nalepae added a commit that referenced this pull request Oct 23, 2024
* `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.
nalepae added a commit that referenced this pull request Oct 23, 2024
* `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.
nalepae added a commit that referenced this pull request Oct 24, 2024
* `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.
nalepae added a commit that referenced this pull request Nov 20, 2024
* `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.
nalepae added a commit that referenced this pull request Nov 22, 2024
* `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.
nalepae added a commit that referenced this pull request Nov 22, 2024
* `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.
nalepae added a commit that referenced this pull request Nov 25, 2024
* `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.
nalepae added a commit that referenced this pull request Nov 25, 2024
* `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.
nalepae added a commit that referenced this pull request Nov 27, 2024
* `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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants