diff --git a/pkg/proof/proof_test.go b/pkg/proof/proof_test.go index a8d8ae0756..757cf0bf18 100644 --- a/pkg/proof/proof_test.go +++ b/pkg/proof/proof_test.go @@ -147,6 +147,13 @@ func TestNewShareInclusionProof(t *testing.T) { namespaceID: appns.TxNamespace, expectErr: true, }, + { + name: "ending share is equal to the starting share", + startingShare: 1, + endingShare: 1, + namespaceID: appns.TxNamespace, + expectErr: true, + }, { name: "ending share higher than number of shares available in square size of 32", startingShare: 0, diff --git a/pkg/proof/querier.go b/pkg/proof/querier.go index 9fca6c5afa..0a8ae37e40 100644 --- a/pkg/proof/querier.go +++ b/pkg/proof/querier.go @@ -123,7 +123,12 @@ func QueryShareInclusionProof(_ sdk.Context, path []string, req abci.RequestQuer // ParseNamespace validates the share range, checks if it only contains one namespace and returns // that namespace ID. +<<<<<<< HEAD func ParseNamespace(rawShares []shares.Share, startShare, endShare int) (appns.Namespace, error) { +======= +// The provided range, defined by startShare and endShare, is end-exclusive. +func ParseNamespace(rawShares []shares.Share, startShare int, endShare int) (appns.Namespace, error) { +>>>>>>> 535802c1 (chore: add (start share == end share) check in parse namespace (#3709)) if startShare < 0 { return appns.Namespace{}, fmt.Errorf("start share %d should be positive", startShare) } @@ -132,8 +137,8 @@ func ParseNamespace(rawShares []shares.Share, startShare, endShare int) (appns.N return appns.Namespace{}, fmt.Errorf("end share %d should be positive", endShare) } - if endShare < startShare { - return appns.Namespace{}, fmt.Errorf("end share %d cannot be lower than starting share %d", endShare, startShare) + if endShare <= startShare { + return appns.Namespace{}, fmt.Errorf("end share %d cannot be lower or equal to the starting share %d", endShare, startShare) } if endShare > len(rawShares) {