diff --git a/.vscode/launch.json b/.vscode/launch.json index 3439e8b..2a8d5f3 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -67,7 +67,7 @@ "--loglevel", "debug", "--rpc-url", - "ws://localhost:8080/v1/rpc", + "ws://localhost:8088/v1/rpc", "--private-key", "5fb8646c69fe23b6a8c9060a117a4218867acb2b2019df36f2627620fa8d5077", // sample key - change to your key "--collect-url", diff --git a/internal/light-client/sampler/sampler.go b/internal/light-client/sampler/sampler.go index adecb63..5ae5923 100644 --- a/internal/light-client/sampler/sampler.go +++ b/internal/light-client/sampler/sampler.go @@ -12,6 +12,7 @@ import ( "github.com/covalenthq/das-ipfs-pinner/internal/gateway" verifier "github.com/covalenthq/das-ipfs-pinner/internal/light-client/c-kzg-verifier" publisher "github.com/covalenthq/das-ipfs-pinner/internal/light-client/publisher" + ckzg4844 "github.com/ethereum/c-kzg-4844/v2/bindings/go" "github.com/ipfs/go-cid" ipfs "github.com/ipfs/go-ipfs-api" logging "github.com/ipfs/go-log/v2" @@ -72,6 +73,9 @@ func (s *Sampler) ProcessEvent(request internal.SamplingRequest, signature []byt } sampleIterations := s.samplingFn(rootNode.Length, rootNode.Length/2, 0.95) + stackSize := ckzg4844.CellsPerExtBlob / rootNode.Length + + log.Debugf("Sampling %d cells from %d blobs with stack size %d", sampleIterations, rootNode.Length, stackSize) for blobIndex, blobLink := range rootNode.Links { var links []internal.Link @@ -103,7 +107,7 @@ func (s *Sampler) ProcessEvent(request internal.SamplingRequest, signature []byt commitment := rootNode.Commitments[blobIndex].Nested.Bytes proof := data.Proof.Nested.Bytes cell := data.Cell.Nested.Bytes - res, err := verifier.NewKZGVerifier(commitment, proof, cell, uint64(colIndex), internal.StackSize).VerifyBatch() + res, err := verifier.NewKZGVerifier(commitment, proof, cell, uint64(colIndex), uint64(stackSize)).VerifyBatch() if err != nil { log.Errorf("Failed to verify proof and cell: %v", err) return