-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdas.go
More file actions
42 lines (37 loc) · 1.48 KB
/
das.go
File metadata and controls
42 lines (37 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package dasmon
import (
"fmt"
"github.com/OffchainLabs/prysm/v7/beacon-chain/core/peerdas"
"github.com/OffchainLabs/prysm/v7/consensus-types/blocks"
eth "github.com/OffchainLabs/prysm/v7/proto/prysm/v1alpha1"
"github.com/ethereum/go-ethereum/p2p/enode"
)
// verifyDataColumn verifies the cryptographic proofs for a data column sidecar.
// This wraps Prysm's peerdas.VerifyDataColumnSidecar function.
func verifyDataColumn(column *eth.DataColumnSidecar) error {
col, err := blocks.NewRODataColumn(column)
if err != nil {
return fmt.Errorf("failed to create RO data column: %w", err)
}
return peerdas.VerifyDataColumnSidecar(col)
}
// verifyInclusionProof verifies the KZG inclusion proof for a data column sidecar.
// This wraps Prysm's peerdas.VerifyDataColumnSidecarInclusionProof function.
func verifyInclusionProof(column *eth.DataColumnSidecar) error {
col, err := blocks.NewRODataColumn(column)
if err != nil {
return fmt.Errorf("failed to create RO data column: %w", err)
}
return peerdas.VerifyDataColumnSidecarInclusionProof(col)
}
// computeCustodyGroups calculates the custody groups for a given node.
// This wraps Prysm's peerdas.CustodyGroups function.
//
// Parameters:
// - nodeID: The Ethereum node ID
// - totalGroups: Total number of custody groups (typically 128 for PeerDAS)
//
// Returns the list of custody group indices this node is responsible for.
func computeCustodyGroups(id enode.ID, cgc uint64) ([]uint64, error) {
return peerdas.CustodyGroups(id, cgc)
}