Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(share): remove unused ShareWithProof #3893

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions share/share.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package share

import (
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
libshare "github.com/celestiaorg/go-square/v2/share"
"github.com/celestiaorg/nmt"
"github.com/celestiaorg/rsmt2d"
)

// DefaultRSMT2DCodec sets the default rsmt2d.Codec for shares.
Expand All @@ -13,28 +10,3 @@ var DefaultRSMT2DCodec = appconsts.DefaultCodec
// MaxSquareSize is currently the maximum size supported for unerasured data in
// rsmt2d.ExtendedDataSquare.
var MaxSquareSize = appconsts.SquareSizeUpperBound(appconsts.LatestVersion)

// ShareWithProof contains data with corresponding Merkle Proof
type ShareWithProof struct { //nolint: revive
// Share is a full data including namespace
libshare.Share
// Proof is a Merkle Proof of current share
Proof *nmt.Proof
// Axis is a type of axis against which the share proof is computed
Axis rsmt2d.Axis
}

// Validate validates inclusion of the share under the given root CID.
func (s *ShareWithProof) Validate(rootHash []byte, x, y, edsSize int) bool {
isParity := x >= edsSize/2 || y >= edsSize/2
namespace := libshare.ParitySharesNamespace
if !isParity {
namespace = s.Share.Namespace()
}
return s.Proof.VerifyInclusion(
NewSHA256Hasher(),
namespace.Bytes(),
[][]byte{s.Share.ToBytes()},
rootHash,
)
}
Loading