Skip to content

Commit

Permalink
Remove hardcoded stack size value (#44)
Browse files Browse the repository at this point in the history
* initial commit

* change default config port for debug settings
  • Loading branch information
tarassh authored Oct 17, 2024
1 parent 5d3e6e0 commit 247e628
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion internal/light-client/sampler/sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 247e628

Please sign in to comment.