Skip to content

Commit

Permalink
chore: lint formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nugaon committed Sep 19, 2023
1 parent d8e86cc commit 0c976d4
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions pkg/storageincentives/proof.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/ethersphere/bee/pkg/swarm"
)

var errorMessage = errors.New("reserve commitment hasher: failure in proof creation")
var errMessage = errors.New("reserve commitment hasher: failure in proof creation")

// makeInclusionProofs creates transaction data for claim method.
// In the document this logic, result data, is also called Proof of entitlement (POE).
Expand Down Expand Up @@ -59,17 +59,17 @@ func makeInclusionProofs(
rccontent.SetHeaderInt64(swarm.HashSize * storer.SampleSize * 2)
rsc, err := sampleChunk(reserveSampleItems)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
rscData := rsc.Data()
_, err = rccontent.Write(rscData[swarm.SpanSize:])
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
pr := bmt.Prover{Hasher: rccontent}
_, err = pr.Hash(nil)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
proof1p1 := pr.Proof(int(require1) * 2)
proof2p1 := pr.Proof(int(require2) * 2)
Expand All @@ -84,24 +84,24 @@ func makeInclusionProofs(
chunk1ContentPayload := reserveSampleItems[require1].ChunkData[swarm.SpanSize:]
_, err = chunk1Content.Write(chunk1ContentPayload)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
pr = bmt.Prover{Hasher: chunk1Content}
_, err = pr.Hash(nil)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
proof1p2 := pr.Proof(segmentIndex)
// TR chunk proof
chunk1TrContent := prefixHasherPool.Get()
chunk1TrContent.SetHeader(reserveSampleItems[require1].ChunkData[:swarm.SpanSize])
_, err = chunk1TrContent.Write(chunk1ContentPayload)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
_, err = chunk1TrContent.Hash(nil)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
pr = bmt.Prover{Hasher: chunk1TrContent}
proof1p3 := pr.Proof(segmentIndex)
Expand All @@ -116,25 +116,25 @@ func makeInclusionProofs(
chunk2Content.SetHeader(reserveSampleItems[require2].ChunkData[:swarm.SpanSize])
_, err = chunk2Content.Write(chunk2ContentPayload)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
pr = bmt.Prover{Hasher: chunk2Content}
_, err = pr.Hash(nil)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
proof2p2 := pr.Proof(segmentIndex)
// TR Chunk proof
chunk2TrContent := prefixHasherPool.Get()
chunk2TrContent.SetHeader(reserveSampleItems[require2].ChunkData[:swarm.SpanSize])
_, err = chunk2TrContent.Write(chunk2ContentPayload)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
pr = bmt.Prover{Hasher: chunk2TrContent}
_, err = pr.Hash(nil)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
proof2p3 := pr.Proof(segmentIndex)
// cleanup
Expand All @@ -148,25 +148,25 @@ func makeInclusionProofs(
chunkLastContentPayload := reserveSampleItems[require3].ChunkData[swarm.SpanSize:]
_, err = chunkLastContent.Write(chunkLastContentPayload)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
pr = bmt.Prover{Hasher: chunkLastContent}
_, err = pr.Hash(nil)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
proofLastp2 := pr.Proof(segmentIndex)
// TR Chunk Proof
chunkLastTrContent := prefixHasherPool.Get()
chunkLastTrContent.SetHeader(reserveSampleItems[require3].ChunkData[:swarm.SpanSize])
_, err = chunkLastTrContent.Write(chunkLastContentPayload)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
pr = bmt.Prover{Hasher: chunkLastTrContent}
_, err = pr.Hash(nil)
if err != nil {
return redistribution.ChunkInclusionProofs{}, errorMessage
return redistribution.ChunkInclusionProofs{}, errMessage
}
proofLastp3 := pr.Proof(segmentIndex)
// cleanup
Expand Down

0 comments on commit 0c976d4

Please sign in to comment.