From 3c0cada025be6d6630d2bb39efb3b32dadd81073 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Thu, 5 Sep 2024 01:45:29 -0400 Subject: [PATCH] fix: Commitment decoding bug && svr handler tests - rm false positives --- store/memory.go | 4 ++-- verify/cert.go | 2 +- verify/certificate.go | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/store/memory.go b/store/memory.go index a368ec74..19d63c67 100644 --- a/store/memory.go +++ b/store/memory.go @@ -150,7 +150,7 @@ func (e *MemStore) Put(_ context.Context, value []byte) ([]byte, error) { mockBatchRoot := crypto.Keccak256Hash(entropy) blockNum, _ := rand.Int(rand.Reader, big.NewInt(1000)) - num := uint32(blockNum.Uint64()) + num := uint32(blockNum.Uint64()) // #nosec G115 cert := &verify.Certificate{ BlobHeader: &disperser.BlobHeader{ @@ -158,7 +158,7 @@ func (e *MemStore) Put(_ context.Context, value []byte) ([]byte, error) { X: commitment.X.Marshal(), Y: commitment.Y.Marshal(), }, - DataLength: uint32(len(encodedVal)), + DataLength: uint32(len(encodedVal)), // #nosec G115 BlobQuorumParams: []*disperser.BlobQuorumParam{ { QuorumNumber: 1, diff --git a/verify/cert.go b/verify/cert.go index 33867471..94a2e88c 100644 --- a/verify/cert.go +++ b/verify/cert.go @@ -115,7 +115,7 @@ func (cv *CertVerifier) getContextBlock() (*big.Int, error) { } blockNumber = new(big.Int) - blockNumber.Sub(blockHeader.Number(), big.NewInt(int64(cv.ethConfirmationDepth-1))) + blockNumber.Sub(blockHeader.Number(), big.NewInt(int64(cv.ethConfirmationDepth-1))) // #nosec G115 return blockNumber, nil } diff --git a/verify/certificate.go b/verify/certificate.go index ef2f09c7..9defd894 100644 --- a/verify/certificate.go +++ b/verify/certificate.go @@ -43,9 +43,9 @@ func (c *Certificate) ReadBlobHeader() BlobHeader { qps := make([]QuorumBlobParam, len(c.BlobHeader.BlobQuorumParams)) for i, qp := range c.BlobHeader.BlobQuorumParams { qps[i] = QuorumBlobParam{ - QuorumNumber: uint8(qp.QuorumNumber), - AdversaryThresholdPercentage: uint8(qp.AdversaryThresholdPercentage), - ConfirmationThresholdPercentage: uint8(qp.ConfirmationThresholdPercentage), + QuorumNumber: uint8(qp.QuorumNumber), // #nosec G115 + AdversaryThresholdPercentage: uint8(qp.AdversaryThresholdPercentage), // #nosec G115 + ConfirmationThresholdPercentage: uint8(qp.ConfirmationThresholdPercentage), // #nosec G115 ChunkLength: qp.ChunkLength, } }