diff --git a/app/test/check_tx_test.go b/app/test/check_tx_test.go index 8842790114..3050e1ea25 100644 --- a/app/test/check_tx_test.go +++ b/app/test/check_tx_test.go @@ -89,7 +89,7 @@ func TestCheckTx(t *testing.T) { require.NoError(t, err) return bbtx }, - expectedABCICode: blobtypes.ErrNamespaceMismatch.ABCICode(), + expectedABCICode: blobtypes.ErrInvalidShareCommitment.ABCICode(), }, { name: "PFB with no blob, CheckTxType_New", diff --git a/app/test/process_proposal_test.go b/app/test/process_proposal_test.go index 26ebeacc70..58ab43cbf5 100644 --- a/app/test/process_proposal_test.go +++ b/app/test/process_proposal_test.go @@ -21,7 +21,6 @@ import ( appns "github.com/celestiaorg/celestia-app/pkg/namespace" "github.com/celestiaorg/celestia-app/pkg/shares" "github.com/celestiaorg/celestia-app/pkg/square" - "github.com/celestiaorg/celestia-app/pkg/user" testutil "github.com/celestiaorg/celestia-app/test/util" "github.com/celestiaorg/celestia-app/test/util/blobfactory" "github.com/celestiaorg/celestia-app/test/util/testfactory" @@ -32,9 +31,6 @@ func TestProcessProposal(t *testing.T) { accounts := testfactory.GenerateAccounts(6) testApp, kr := testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams(), accounts...) infos := queryAccountInfo(testApp, accounts, kr) - addr := testfactory.GetAddress(kr, accounts[0]) - signer, err := user.NewSigner(kr, nil, addr, enc, testutil.ChainID, infos[0].AccountNum, infos[0].Sequence) - require.NoError(t, err) // create 4 single blob blobTxs that are signed with valid account numbers // and sequences @@ -201,23 +197,6 @@ func TestProcessProposal(t *testing.T) { }, expectedResult: abci.ResponseProcessProposal_REJECT, }, - { - name: "invalid namespace in index wrapper tx", - input: validData(), - mutator: func(d *tmproto.Data) { - index := 4 - tx, b := blobfactory.IndexWrappedTxWithInvalidNamespace(t, tmrand.NewRand(), signer, uint32(index)) - blobTx, err := blob.MarshalBlobTx(tx, &b) - require.NoError(t, err) - - // Replace the data with new contents - d.Txs = [][]byte{blobTx} - - // Erasure code the data to update the data root so this doesn't doesn't fail on an incorrect data root. - d.Hash = calculateNewDataHash(t, d.Txs) - }, - expectedResult: abci.ResponseProcessProposal_REJECT, - }, { name: "swap blobTxs", input: validData(), diff --git a/go.work.sum b/go.work.sum index ac481468de..d903e11d60 100644 --- a/go.work.sum +++ b/go.work.sum @@ -640,5 +640,6 @@ google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpX google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e h1:4Z09Hglb792X0kfOBBJUPFEyvVfQWrYT/l8h5EKA6JQ= diff --git a/pkg/proof/proof_test.go b/pkg/proof/proof_test.go index c29fe0ccd4..1ec6e90d69 100644 --- a/pkg/proof/proof_test.go +++ b/pkg/proof/proof_test.go @@ -185,21 +185,21 @@ func TestNewShareInclusionProof(t *testing.T) { { name: "shares from PFB namespace", startingShare: 53, - endingShare: 56, + endingShare: 55, namespaceID: appns.PayForBlobNamespace, expectErr: false, }, { name: "blob shares for first namespace", - startingShare: 56, - endingShare: 58, + startingShare: 55, + endingShare: 57, namespaceID: ns1, expectErr: false, }, { name: "blob shares for third namespace", - startingShare: 60, - endingShare: 62, + startingShare: 59, + endingShare: 61, namespaceID: ns3, expectErr: false, }, diff --git a/pkg/square/builder_test.go b/pkg/square/builder_test.go index b83faefa77..35e6f0fa37 100644 --- a/pkg/square/builder_test.go +++ b/pkg/square/builder_test.go @@ -176,11 +176,12 @@ func TestBuilderRejectsBlobTransactions(t *testing.T) { added: true, }, { - // fun fact: three blobs increases the size of the PFB to two shares, hence this fails + // fun fact: four blobs increases the size of the PFB to two shares, hence this fails blobSize: []int{ shares.AvailableBytesFromSparseShares(1), shares.AvailableBytesFromSparseShares(1), shares.AvailableBytesFromSparseShares(1), + shares.AvailableBytesFromSparseShares(1), }, added: false, }, @@ -300,7 +301,7 @@ func TestSquareBlobPostions(t *testing.T) { []ns.Namespace{ns1, ns1, ns1, ns1, ns1, ns1, ns1, ns1, ns1}, blobfactory.Repeat([]int{100}, 9), ), - expectedIndexes: [][]uint32{{7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}}, + expectedIndexes: [][]uint32{{6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}}, }, { squareSize: 4, @@ -318,7 +319,7 @@ func TestSquareBlobPostions(t *testing.T) { []ns.Namespace{ns1, ns1, ns1}, [][]int{{1000}, {10000}, {10000}}, ), - expectedIndexes: [][]uint32{{3}, {6}, {27}}, + expectedIndexes: [][]uint32{{2}, {5}, {26}}, }, { squareSize: 32, @@ -327,7 +328,7 @@ func TestSquareBlobPostions(t *testing.T) { []ns.Namespace{ns2, ns1, ns1}, [][]int{{100}, {100}, {100}}, ), - expectedIndexes: [][]uint32{{5}, {3}, {4}}, + expectedIndexes: [][]uint32{{4}, {2}, {3}}, }, { squareSize: 16, @@ -336,7 +337,7 @@ func TestSquareBlobPostions(t *testing.T) { []ns.Namespace{ns1, ns2, ns1}, [][]int{{100}, {900}, {900}}, // 1, 2, 2 shares respectively ), - expectedIndexes: [][]uint32{{3}, {6}, {4}}, + expectedIndexes: [][]uint32{{2}, {5}, {3}}, }, { squareSize: 4, @@ -432,7 +433,7 @@ func TestSquareBlobPostions(t *testing.T) { for j, tx := range txs { wrappedPFB, isWrappedPFB := coretypes.UnmarshalIndexWrapper(tx) require.True(t, isWrappedPFB) - require.Equal(t, tt.expectedIndexes[j], wrappedPFB.ShareIndexes, j) + require.Equal(t, tt.expectedIndexes[j], wrappedPFB.ShareIndexes, fmt.Sprintf("expected index %v, got %v", tt.expectedIndexes[j], wrappedPFB.ShareIndexes)) } }) } diff --git a/proto/celestia/blob/v1/event.proto b/proto/celestia/blob/v1/event.proto index c2dd049dff..52666f1754 100644 --- a/proto/celestia/blob/v1/event.proto +++ b/proto/celestia/blob/v1/event.proto @@ -3,13 +3,11 @@ package celestia.blob.v1; option go_package = "github.com/celestiaorg/celestia-app/x/blob/types"; -// EventPayForBlobs defines an event that is emitted after a pay for blob has +// EventPayForBlobs defines an event that is emitted after a PayForBlobs has // been processed. message EventPayForBlobs { string signer = 1; repeated uint32 blob_sizes = 2; - // namespaces is a list of namespaces that the blobs in blob_sizes belong to. - // A namespace has length of 29 bytes where the first byte is the - // namespaceVersion and the subsequent 28 bytes are the namespaceID. - repeated bytes namespaces = 3; + // 3 was previously used for namespaces + reserved 3; } diff --git a/proto/celestia/blob/v1/tx.proto b/proto/celestia/blob/v1/tx.proto index ad42482c96..8f0b5d40fd 100644 --- a/proto/celestia/blob/v1/tx.proto +++ b/proto/celestia/blob/v1/tx.proto @@ -18,19 +18,14 @@ message MsgPayForBlobs { // signer is the bech32 encoded signer address. See // https://en.bitcoin.it/wiki/Bech32. string signer = 1; - // namespaces is a list of namespaces that the blobs are associated with. A - // namespace is a byte slice of length 29 where the first byte is the - // namespaceVersion and the subsequent 28 bytes are the namespaceId. - repeated bytes namespaces = 2; + // 2 was previously used for namespaces. + reserved 2; // blob_sizes is a list of blob sizes (one per blob). Each size is in bytes. repeated uint32 blob_sizes = 3; // share_commitments is a list of share commitments (one per blob). repeated bytes share_commitments = 4; - // share_versions are the versions of the share format that the blobs - // associated with this message should use when included in a block. The - // share_versions specified must match the share_versions used to generate the - // share_commitment in this message. - repeated uint32 share_versions = 8; + // 8 was previously used for share_versions; + reserved 8; } // MsgPayForBlobsResponse describes the response returned after the submission diff --git a/test/util/blobfactory/payforblob_factory.go b/test/util/blobfactory/payforblob_factory.go index 40211d87bb..4c61f1ff28 100644 --- a/test/util/blobfactory/payforblob_factory.go +++ b/test/util/blobfactory/payforblob_factory.go @@ -1,7 +1,6 @@ package blobfactory import ( - "bytes" "context" "testing" @@ -234,30 +233,6 @@ func ManyMultiBlobTx( return txs } -// IndexWrappedTxWithInvalidNamespace returns an index wrapped PFB tx with an -// invalid namespace and a blob associated with that index wrapped PFB tx. -func IndexWrappedTxWithInvalidNamespace( - t *testing.T, - rand *tmrand.Rand, - signer *user.Signer, - index uint32, -) (coretypes.Tx, blob.Blob) { - t.Helper() - addr := signer.Address() - blob := ManyRandBlobs(rand, 100)[0] - msg, err := blobtypes.NewMsgPayForBlobs(addr.String(), blob) - require.NoError(t, err) - msg.Namespaces[0] = bytes.Repeat([]byte{1}, 33) // invalid namespace - - rawTx, err := signer.CreateTx([]sdk.Msg{msg}, DefaultTxOpts()...) - require.NoError(t, err) - - cTx, err := coretypes.MarshalIndexWrapper(rawTx, index) - require.NoError(t, err) - - return cTx, *blob -} - func RandBlobTxsWithNamespacesAndSigner( signer *user.Signer, namespaces []appns.Namespace, diff --git a/x/blob/keeper/keeper.go b/x/blob/keeper/keeper.go index bb69acfd29..10b9c6a6c3 100644 --- a/x/blob/keeper/keeper.go +++ b/x/blob/keeper/keeper.go @@ -47,7 +47,7 @@ func (k Keeper) PayForBlobs(goCtx context.Context, msg *types.MsgPayForBlobs) (* ctx.GasMeter().ConsumeGas(gasToConsume, payForBlobGasDescriptor) err := ctx.EventManager().EmitTypedEvent( - types.NewPayForBlobsEvent(msg.Signer, msg.BlobSizes, msg.Namespaces), + types.NewPayForBlobsEvent(msg.Signer, msg.BlobSizes), ) if err != nil { return &types.MsgPayForBlobsResponse{}, err diff --git a/x/blob/keeper/keeper_test.go b/x/blob/keeper/keeper_test.go index abe48a2ce0..37302c37a1 100644 --- a/x/blob/keeper/keeper_test.go +++ b/x/blob/keeper/keeper_test.go @@ -31,7 +31,6 @@ func TestPayForBlobs(t *testing.T) { k, _, ctx := CreateKeeper(t) signer := "celestia15drmhzw5kwgenvemy30rqqqgq52axf5wwrruf7" namespace := appns.MustNewV0(bytes.Repeat([]byte{1}, appns.NamespaceVersionZeroIDSize)) - namespaces := [][]byte{namespace.Bytes()} blobData := []byte("blob") blobSizes := []uint32{uint32(len(blobData))} @@ -54,7 +53,6 @@ func TestPayForBlobs(t *testing.T) { // verify the attributes of the event assert.Equal(t, signer, event.Signer) - assert.Equal(t, namespaces, event.Namespaces) assert.Equal(t, blobSizes, event.BlobSizes) } diff --git a/x/blob/types/blob_tx.go b/x/blob/types/blob_tx.go index b6a433304e..d1dcb1e3f9 100644 --- a/x/blob/types/blob_tx.go +++ b/x/blob/types/blob_tx.go @@ -70,24 +70,6 @@ func ValidateBlobTx(txcfg client.TxEncodingConfig, bTx blob.BlobTx) error { return ErrBlobSizeMismatch.Wrapf("actual %v declared %v", sizes, msgPFB.BlobSizes) } - for i, ns := range msgPFB.Namespaces { - msgPFBNamespace, err := appns.From(ns) - if err != nil { - return err - } - - // this not only checks that the pfb namespaces match the ones in the blobs - // but that the namespace version and namespace id are valid - blobNamespace, err := appns.New(uint8(bTx.Blobs[i].NamespaceVersion), bTx.Blobs[i].NamespaceId) - if err != nil { - return err - } - - if !bytes.Equal(blobNamespace.Bytes(), msgPFBNamespace.Bytes()) { - return ErrNamespaceMismatch.Wrapf("%v %v", blobNamespace.Bytes(), msgPFB.Namespaces[i]) - } - } - // verify that the commitment of the blob matches that of the msgPFB for i, commitment := range msgPFB.ShareCommitments { calculatedCommit, err := inclusion.CreateCommitment(bTx.Blobs[i]) diff --git a/x/blob/types/blob_tx_test.go b/x/blob/types/blob_tx_test.go index ec066c3392..52b4180bc3 100644 --- a/x/blob/types/blob_tx_test.go +++ b/x/blob/types/blob_tx_test.go @@ -73,7 +73,7 @@ func TestValidateBlobTx(t *testing.T) { btx.Blobs[0].NamespaceId = namespace.RandomBlobNamespace().ID return btx }, - expectedErr: types.ErrNamespaceMismatch, + expectedErr: types.ErrInvalidShareCommitment, }, { name: "invalid transaction, no pfb", diff --git a/x/blob/types/event.pb.go b/x/blob/types/event.pb.go index 3f6b1f2019..845ddebfc7 100644 --- a/x/blob/types/event.pb.go +++ b/x/blob/types/event.pb.go @@ -22,15 +22,11 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// EventPayForBlobs defines an event that is emitted after a pay for blob has +// EventPayForBlobs defines an event that is emitted after a PayForBlobs has // been processed. type EventPayForBlobs struct { Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` BlobSizes []uint32 `protobuf:"varint,2,rep,packed,name=blob_sizes,json=blobSizes,proto3" json:"blob_sizes,omitempty"` - // namespaces is a list of namespaces that the blobs in blob_sizes belong to. - // A namespace has length of 29 bytes where the first byte is the - // namespaceVersion and the subsequent 28 bytes are the namespaceID. - Namespaces [][]byte `protobuf:"bytes,3,rep,name=namespaces,proto3" json:"namespaces,omitempty"` } func (m *EventPayForBlobs) Reset() { *m = EventPayForBlobs{} } @@ -80,13 +76,6 @@ func (m *EventPayForBlobs) GetBlobSizes() []uint32 { return nil } -func (m *EventPayForBlobs) GetNamespaces() [][]byte { - if m != nil { - return m.Namespaces - } - return nil -} - func init() { proto.RegisterType((*EventPayForBlobs)(nil), "celestia.blob.v1.EventPayForBlobs") } @@ -94,21 +83,20 @@ func init() { func init() { proto.RegisterFile("celestia/blob/v1/event.proto", fileDescriptor_9d90f0a63835a06e) } var fileDescriptor_9d90f0a63835a06e = []byte{ - // 214 bytes of a gzipped FileDescriptorProto + // 197 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0x4e, 0xcd, 0x49, 0x2d, 0x2e, 0xc9, 0x4c, 0xd4, 0x4f, 0xca, 0xc9, 0x4f, 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x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xfb, 0xc7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x9a, 0x7b, - 0x9e, 0x60, 0xef, 0x00, 0x00, 0x00, + 0xaa, 0xd4, 0x62, 0x09, 0x26, 0x05, 0x66, 0x0d, 0xde, 0x20, 0x4e, 0x90, 0x48, 0x30, 0x48, 0xc0, + 0x8b, 0x85, 0x83, 0x59, 0x80, 0xc5, 0xc9, 0xeb, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, + 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, + 0x18, 0xa2, 0x0c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x61, 0xee, + 0xc8, 0x2f, 0x4a, 0x87, 0xb3, 0x75, 0x13, 0x0b, 0x0a, 0xf4, 0x2b, 0x20, 0xee, 0x2e, 0xa9, 0x2c, + 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xbb, 0xda, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x96, 0x92, 0xfd, + 0xf4, 0xd5, 0x00, 0x00, 0x00, } func (m *EventPayForBlobs) Marshal() (dAtA []byte, err error) { @@ -131,15 +119,6 @@ func (m *EventPayForBlobs) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Namespaces) > 0 { - for iNdEx := len(m.Namespaces) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Namespaces[iNdEx]) - copy(dAtA[i:], m.Namespaces[iNdEx]) - i = encodeVarintEvent(dAtA, i, uint64(len(m.Namespaces[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } if len(m.BlobSizes) > 0 { dAtA2 := make([]byte, len(m.BlobSizes)*10) var j1 int @@ -196,12 +175,6 @@ func (m *EventPayForBlobs) Size() (n int) { } n += 1 + sovEvent(uint64(l)) + l } - if len(m.Namespaces) > 0 { - for _, b := range m.Namespaces { - l = len(b) - n += 1 + l + sovEvent(uint64(l)) - } - } return n } @@ -348,38 +321,6 @@ func (m *EventPayForBlobs) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field BlobSizes", wireType) } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespaces", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEvent - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEvent - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthEvent - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespaces = append(m.Namespaces, make([]byte, postIndex-iNdEx)) - copy(m.Namespaces[len(m.Namespaces)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipEvent(dAtA[iNdEx:]) diff --git a/x/blob/types/events.go b/x/blob/types/events.go index 9537ba5a3f..d52f7496e4 100644 --- a/x/blob/types/events.go +++ b/x/blob/types/events.go @@ -7,10 +7,9 @@ import ( var EventTypePayForBlob = proto.MessageName(&EventPayForBlobs{}) // NewPayForBlobsEvent returns a new EventPayForBlobs -func NewPayForBlobsEvent(signer string, blobSizes []uint32, namespaces [][]byte) *EventPayForBlobs { +func NewPayForBlobsEvent(signer string, blobSizes []uint32) *EventPayForBlobs { return &EventPayForBlobs{ - Signer: signer, - BlobSizes: blobSizes, - Namespaces: namespaces, + Signer: signer, + BlobSizes: blobSizes, } } diff --git a/x/blob/types/payforblob.go b/x/blob/types/payforblob.go index 153a69691b..d2aaadd6a1 100644 --- a/x/blob/types/payforblob.go +++ b/x/blob/types/payforblob.go @@ -3,8 +3,6 @@ package types import ( fmt "fmt" - "cosmossdk.io/errors" - "github.com/celestiaorg/celestia-app/pkg/appconsts" "github.com/celestiaorg/celestia-app/pkg/blob" "github.com/celestiaorg/celestia-app/pkg/inclusion" @@ -54,34 +52,17 @@ func NewMsgPayForBlobs(signer string, blobs ...*blob.Blob) (*MsgPayForBlobs, err return nil, err } - namespaceVersions, namespaceIds, sizes, shareVersions := ExtractBlobComponents(blobs) - namespaces := []appns.Namespace{} - for i := range namespaceVersions { - namespace, err := appns.New(uint8(namespaceVersions[i]), namespaceIds[i]) - if err != nil { - return nil, err - } - namespaces = append(namespaces, namespace) - } + sizes := extractSizes(blobs) msg := &MsgPayForBlobs{ Signer: signer, - Namespaces: namespacesToBytes(namespaces), ShareCommitments: commitments, BlobSizes: sizes, - ShareVersions: shareVersions, } return msg, msg.ValidateBasic() } -func namespacesToBytes(namespaces []appns.Namespace) (result [][]byte) { - for _, namespace := range namespaces { - result = append(result, namespace.Bytes()) - } - return result -} - // Route fulfills the legacytx.LegacyMsg interface func (msg *MsgPayForBlobs) Route() string { return RouterKey } @@ -93,14 +74,6 @@ func (msg *MsgPayForBlobs) Type() string { // ValidateBasic fulfills the sdk.Msg interface by performing stateless // validity checks on the msg that also don't require having the actual blob(s) func (msg *MsgPayForBlobs) ValidateBasic() error { - if len(msg.Namespaces) == 0 { - return ErrNoNamespaces - } - - if len(msg.ShareVersions) == 0 { - return ErrNoShareVersions - } - if len(msg.BlobSizes) == 0 { return ErrNoBlobSizes } @@ -109,30 +82,13 @@ func (msg *MsgPayForBlobs) ValidateBasic() error { return ErrNoShareCommitments } - if len(msg.Namespaces) != len(msg.ShareVersions) || len(msg.Namespaces) != len(msg.BlobSizes) || len(msg.Namespaces) != len(msg.ShareCommitments) { + if len(msg.BlobSizes) != len(msg.ShareCommitments) { return ErrMismatchedNumberOfPFBComponent.Wrapf( - "namespaces %d blob sizes %d share versions %d share commitments %d", - len(msg.Namespaces), len(msg.BlobSizes), len(msg.ShareVersions), len(msg.ShareCommitments), + "blob sizes %d share commitments %d", + len(msg.BlobSizes), len(msg.ShareCommitments), ) } - for _, namespace := range msg.Namespaces { - ns, err := appns.From(namespace) - if err != nil { - return errors.Wrap(ErrInvalidNamespace, err.Error()) - } - err = ValidateBlobNamespace(ns) - if err != nil { - return err - } - } - - for _, v := range msg.ShareVersions { - if v != uint32(appconsts.ShareVersionZero) { - return ErrUnsupportedShareVersion - } - } - _, err := sdk.AccAddressFromBech32(msg.Signer) if err != nil { return err @@ -238,20 +194,11 @@ func ValidateBlobs(blobs ...*blob.Blob) error { return nil } -// ExtractBlobComponents separates and returns the components of a slice of -// blobs. -func ExtractBlobComponents(pblobs []*blob.Blob) (namespaceVersions []uint32, namespaceIds [][]byte, sizes []uint32, shareVersions []uint32) { - namespaceVersions = make([]uint32, len(pblobs)) - namespaceIds = make([][]byte, len(pblobs)) - sizes = make([]uint32, len(pblobs)) - shareVersions = make([]uint32, len(pblobs)) - - for i, pblob := range pblobs { - namespaceVersions[i] = pblob.NamespaceVersion - namespaceIds[i] = pblob.NamespaceId - sizes[i] = uint32(len(pblob.Data)) - shareVersions[i] = pblob.ShareVersion +// extractSizes returns a slice of blobs sizes. +func extractSizes(blobs []*blob.Blob) (sizes []uint32) { + for _, pblob := range blobs { + size := uint32(len(pblob.Data)) + sizes = append(sizes, size) } - - return namespaceVersions, namespaceIds, sizes, shareVersions + return sizes } diff --git a/x/blob/types/payforblob_test.go b/x/blob/types/payforblob_test.go index 5709a4a316..29f3993732 100644 --- a/x/blob/types/payforblob_test.go +++ b/x/blob/types/payforblob_test.go @@ -32,26 +32,6 @@ func TestValidateBasic(t *testing.T) { validMsg := validMsgPayForBlobs(t) - // MsgPayForBlobs that uses parity shares namespace - paritySharesMsg := validMsgPayForBlobs(t) - paritySharesMsg.Namespaces[0] = appns.ParitySharesNamespace.Bytes() - - // MsgPayForBlobs that uses tail padding namespace - tailPaddingMsg := validMsgPayForBlobs(t) - tailPaddingMsg.Namespaces[0] = appns.TailPaddingNamespace.Bytes() - - // MsgPayForBlobs that uses transaction namespace - txNamespaceMsg := validMsgPayForBlobs(t) - txNamespaceMsg.Namespaces[0] = appns.TxNamespace.Bytes() - - // MsgPayForBlobs that uses intermediateStateRoots namespace - intermediateStateRootsNamespaceMsg := validMsgPayForBlobs(t) - intermediateStateRootsNamespaceMsg.Namespaces[0] = appns.IntermediateStateRootsNamespace.Bytes() - - // MsgPayForBlobs that uses the max primary reserved namespace - maxReservedNamespaceMsg := validMsgPayForBlobs(t) - maxReservedNamespaceMsg.Namespaces[0] = appns.MaxPrimaryReservedNamespace.Bytes() - // MsgPayForBlobs that has an empty share commitment emptyShareCommitment := validMsgPayForBlobs(t) emptyShareCommitment.ShareCommitments[0] = []byte{} @@ -60,14 +40,6 @@ func TestValidateBasic(t *testing.T) { invalidShareCommitmentSize := validMsgPayForBlobs(t) invalidShareCommitmentSize.ShareCommitments[0] = bytes.Repeat([]byte{0x1}, 31) - // MsgPayForBlobs that has no namespaces - noNamespaces := validMsgPayForBlobs(t) - noNamespaces.Namespaces = [][]byte{} - - // MsgPayForBlobs that has no share versions - noShareVersions := validMsgPayForBlobs(t) - noShareVersions.ShareVersions = []uint32{} - // MsgPayForBlobs that has no blob sizes noBlobSizes := validMsgPayForBlobs(t) noBlobSizes.BlobSizes = []uint32{} @@ -82,31 +54,6 @@ func TestValidateBasic(t *testing.T) { msg: validMsg, wantErr: nil, }, - { - name: "parity shares namespace", - msg: paritySharesMsg, - wantErr: types.ErrReservedNamespace, - }, - { - name: "tail padding namespace", - msg: tailPaddingMsg, - wantErr: types.ErrReservedNamespace, - }, - { - name: "tx namespace", - msg: txNamespaceMsg, - wantErr: types.ErrReservedNamespace, - }, - { - name: "intermediate state root namespace", - msg: intermediateStateRootsNamespaceMsg, - wantErr: types.ErrReservedNamespace, - }, - { - name: "max reserved namespace", - msg: maxReservedNamespaceMsg, - wantErr: types.ErrReservedNamespace, - }, { name: "empty share commitment", msg: emptyShareCommitment, @@ -117,16 +64,6 @@ func TestValidateBasic(t *testing.T) { msg: invalidShareCommitmentSize, wantErr: types.ErrInvalidShareCommitment, }, - { - name: "no namespace ids", - msg: noNamespaces, - wantErr: types.ErrNoNamespaces, - }, - { - name: "no share versions", - msg: noShareVersions, - wantErr: types.ErrNoShareVersions, - }, { name: "no blob sizes", msg: noBlobSizes, @@ -137,11 +74,6 @@ func TestValidateBasic(t *testing.T) { msg: noShareCommitments, wantErr: types.ErrNoShareCommitments, }, - { - name: "invalid namespace version", - msg: invalidNamespaceVersionMsgPayForBlobs(t), - wantErr: types.ErrInvalidNamespaceVersion, - }, } for _, tt := range tests { @@ -185,49 +117,6 @@ func validMsgPayForBlobs(t *testing.T) *types.MsgPayForBlobs { return pfb } -func invalidNamespaceVersionMsgPayForBlobs(t *testing.T) *types.MsgPayForBlobs { - signer, err := testnode.NewOfflineSigner() - require.NoError(t, err) - ns1 := append(appns.NamespaceVersionZeroPrefix, bytes.Repeat([]byte{0x01}, appns.NamespaceVersionZeroIDSize)...) - data := bytes.Repeat([]byte{2}, totalBlobSize(appconsts.ContinuationSparseShareContentSize*12)) - - pblob := &blob.Blob{ - Data: data, - NamespaceId: ns1, - NamespaceVersion: uint32(255), - ShareVersion: uint32(appconsts.ShareVersionZero), - } - - blobs := []*blob.Blob{pblob} - - commitments, err := inclusion.CreateCommitments(blobs) - require.NoError(t, err) - - namespaceVersions, namespaceIds, sizes, shareVersions := types.ExtractBlobComponents(blobs) - namespaces := []appns.Namespace{} - for i := range namespaceVersions { - namespace, err := appns.New(uint8(namespaceVersions[i]), namespaceIds[i]) - require.NoError(t, err) - namespaces = append(namespaces, namespace) - } - - namespacesBytes := make([][]byte, len(namespaces)) - for idx, namespace := range namespaces { - namespacesBytes[idx] = namespace.Bytes() - } - - addr := signer.Address() - pfb := &types.MsgPayForBlobs{ - Signer: addr.String(), - Namespaces: namespacesBytes, - ShareCommitments: commitments, - BlobSizes: sizes, - ShareVersions: shareVersions, - } - - return pfb -} - func TestNewMsgPayForBlobs(t *testing.T) { type testCase struct { name string @@ -333,10 +222,7 @@ func TestNewMsgPayForBlobs(t *testing.T) { for i, blob := range tc.blobs { assert.Equal(t, uint32(len(blob.Data)), msgPFB.BlobSizes[i]) - ns, err := appns.From(msgPFB.Namespaces[i]) assert.NoError(t, err) - assert.Equal(t, ns.ID, blob.NamespaceId) - assert.Equal(t, uint32(ns.Version), blob.NamespaceVersion) expectedCommitment, err := inclusion.CreateCommitment(blob) require.NoError(t, err) diff --git a/x/blob/types/tx.pb.go b/x/blob/types/tx.pb.go index 781fbc1363..cd6674d3c5 100644 --- a/x/blob/types/tx.pb.go +++ b/x/blob/types/tx.pb.go @@ -33,19 +33,10 @@ type MsgPayForBlobs struct { // signer is the bech32 encoded signer address. See // https://en.bitcoin.it/wiki/Bech32. Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - // namespaces is a list of namespaces that the blobs are associated with. A - // namespace is a byte slice of length 29 where the first byte is the - // namespaceVersion and the subsequent 28 bytes are the namespaceId. - Namespaces [][]byte `protobuf:"bytes,2,rep,name=namespaces,proto3" json:"namespaces,omitempty"` // blob_sizes is a list of blob sizes (one per blob). Each size is in bytes. BlobSizes []uint32 `protobuf:"varint,3,rep,packed,name=blob_sizes,json=blobSizes,proto3" json:"blob_sizes,omitempty"` // share_commitments is a list of share commitments (one per blob). ShareCommitments [][]byte `protobuf:"bytes,4,rep,name=share_commitments,json=shareCommitments,proto3" json:"share_commitments,omitempty"` - // share_versions are the versions of the share format that the blobs - // associated with this message should use when included in a block. The - // share_versions specified must match the share_versions used to generate the - // share_commitment in this message. - ShareVersions []uint32 `protobuf:"varint,8,rep,packed,name=share_versions,json=shareVersions,proto3" json:"share_versions,omitempty"` } func (m *MsgPayForBlobs) Reset() { *m = MsgPayForBlobs{} } @@ -88,13 +79,6 @@ func (m *MsgPayForBlobs) GetSigner() string { return "" } -func (m *MsgPayForBlobs) GetNamespaces() [][]byte { - if m != nil { - return m.Namespaces - } - return nil -} - func (m *MsgPayForBlobs) GetBlobSizes() []uint32 { if m != nil { return m.BlobSizes @@ -109,13 +93,6 @@ func (m *MsgPayForBlobs) GetShareCommitments() [][]byte { return nil } -func (m *MsgPayForBlobs) GetShareVersions() []uint32 { - if m != nil { - return m.ShareVersions - } - return nil -} - // MsgPayForBlobsResponse describes the response returned after the submission // of a PayForBlobs type MsgPayForBlobsResponse struct { @@ -162,29 +139,28 @@ func init() { func init() { proto.RegisterFile("celestia/blob/v1/tx.proto", fileDescriptor_9157fbf3d3cd004d) } var fileDescriptor_9157fbf3d3cd004d = []byte{ - // 352 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xcf, 0x4a, 0xeb, 0x40, - 0x14, 0xc6, 0x9b, 0xe6, 0x52, 0x6e, 0xe7, 0xde, 0x96, 0xde, 0xe1, 0x52, 0x62, 0xa9, 0x21, 0x14, - 0x84, 0x80, 0x98, 0x58, 0x7d, 0x83, 0x0a, 0x2e, 0x84, 0x82, 0x44, 0x70, 0xe1, 0xa6, 0x4c, 0xc2, - 0x98, 0x06, 0x92, 0x39, 0xc3, 0x9c, 0xb1, 0xb6, 0x2e, 0x5c, 0xf8, 0x04, 0x82, 0x8f, 0xe3, 0x0b, - 0xb8, 0x2c, 0xb8, 0x71, 0x29, 0xad, 0x0f, 0x22, 0x49, 0xff, 0xd8, 0xba, 0x71, 0x37, 0xe7, 0x77, - 0xbe, 0xf9, 0xbe, 0x33, 0x73, 0xc8, 0x4e, 0xc4, 0x53, 0x8e, 0x3a, 0x61, 0x7e, 0x98, 0x42, 0xe8, - 0x8f, 0xba, 0xbe, 0x1e, 0x7b, 0x52, 0x81, 0x06, 0xda, 0x58, 0xb5, 0xbc, 0xbc, 0xe5, 0x8d, 0xba, - 0xad, 0x76, 0x0c, 0x10, 0xa7, 0xdc, 0x67, 0x32, 0xf1, 0x99, 0x10, 0xa0, 0x99, 0x4e, 0x40, 0xe0, - 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 0xe3, 0x44, 0x0f, 0x6f, 0x42, 0x2f, 0x82, 0xcc, 0x5f, 0x65, - 0x81, 0x8a, 0xd7, 0xe7, 0x03, 0x26, 0xa5, 0x3f, 0x5e, 0x98, 0xea, 0x89, 0xe4, 0x18, 0x56, 0x8a, - 0x55, 0x1d, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xf5, 0x8f, 0xfc, 0xf7, 0x01, 0x00, 0x00, + // 322 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x50, 0x4d, 0x4b, 0xc3, 0x40, + 0x14, 0x6c, 0x9a, 0x52, 0xda, 0xf5, 0x83, 0x18, 0xa4, 0xc4, 0x52, 0x43, 0xe8, 0x29, 0x20, 0x66, + 0xad, 0xfe, 0x83, 0x0a, 0x1e, 0x0a, 0x05, 0x89, 0x37, 0x2f, 0x65, 0x53, 0xd6, 0xed, 0x42, 0x92, + 0xb7, 0xe4, 0xad, 0xb5, 0xf5, 0x20, 0xe2, 0x2f, 0x10, 0xfc, 0x53, 0x1e, 0x0b, 0x5e, 0x3c, 0x4a, + 0xeb, 0x0f, 0x91, 0xb4, 0xa6, 0x5a, 0x2f, 0xde, 0xf6, 0xcd, 0xbc, 0x9d, 0x99, 0x37, 0xe4, 0x60, + 0xc8, 0x63, 0x8e, 0x5a, 0x32, 0x1a, 0xc5, 0x10, 0xd1, 0x71, 0x87, 0xea, 0x49, 0xa0, 0x32, 0xd0, + 0x60, 0x5b, 0x05, 0x15, 0xe4, 0x54, 0x30, 0xee, 0x34, 0x5b, 0x02, 0x40, 0xc4, 0x9c, 0x32, 0x25, + 0x29, 0x4b, 0x53, 0xd0, 0x4c, 0x4b, 0x48, 0x71, 0xb5, 0xdf, 0x7e, 0x34, 0xc8, 0x6e, 0x1f, 0xc5, + 0x25, 0x9b, 0x5e, 0x40, 0xd6, 0x8d, 0x21, 0x42, 0xbb, 0x41,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01, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -289,24 +265,6 @@ func (m *MsgPayForBlobs) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ShareVersions) > 0 { - dAtA2 := make([]byte, len(m.ShareVersions)*10) - var j1 int - for _, num := range m.ShareVersions { - for num >= 1<<7 { - dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) - num >>= 7 - j1++ - } - dAtA2[j1] = uint8(num) - j1++ - } - i -= j1 - copy(dAtA[i:], dAtA2[:j1]) - i = encodeVarintTx(dAtA, i, uint64(j1)) - i-- - dAtA[i] = 0x42 - } if len(m.ShareCommitments) > 0 { for iNdEx := len(m.ShareCommitments) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.ShareCommitments[iNdEx]) @@ -317,32 +275,23 @@ func (m *MsgPayForBlobs) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } if len(m.BlobSizes) > 0 { - dAtA4 := make([]byte, len(m.BlobSizes)*10) - var j3 int + dAtA2 := make([]byte, len(m.BlobSizes)*10) + var j1 int for _, num := range m.BlobSizes { for num >= 1<<7 { - dAtA4[j3] = uint8(uint64(num)&0x7f | 0x80) + dAtA2[j1] = uint8(uint64(num)&0x7f | 0x80) num >>= 7 - j3++ + j1++ } - dAtA4[j3] = uint8(num) - j3++ + dAtA2[j1] = uint8(num) + j1++ } - i -= j3 - copy(dAtA[i:], dAtA4[:j3]) - i = encodeVarintTx(dAtA, i, uint64(j3)) + i -= j1 + copy(dAtA[i:], dAtA2[:j1]) + i = encodeVarintTx(dAtA, i, uint64(j1)) i-- dAtA[i] = 0x1a } - if len(m.Namespaces) > 0 { - for iNdEx := len(m.Namespaces) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Namespaces[iNdEx]) - copy(dAtA[i:], m.Namespaces[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.Namespaces[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } if len(m.Signer) > 0 { i -= len(m.Signer) copy(dAtA[i:], m.Signer) @@ -397,12 +346,6 @@ func (m *MsgPayForBlobs) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if len(m.Namespaces) > 0 { - for _, b := range m.Namespaces { - l = len(b) - n += 1 + l + sovTx(uint64(l)) - } - } if len(m.BlobSizes) > 0 { l = 0 for _, e := range m.BlobSizes { @@ -416,13 +359,6 @@ func (m *MsgPayForBlobs) Size() (n int) { n += 1 + l + sovTx(uint64(l)) } } - if len(m.ShareVersions) > 0 { - l = 0 - for _, e := range m.ShareVersions { - l += sovTx(uint64(e)) - } - n += 1 + sovTx(uint64(l)) + l - } return n } @@ -502,38 +438,6 @@ func (m *MsgPayForBlobs) Unmarshal(dAtA []byte) error { } m.Signer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Namespaces", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Namespaces = append(m.Namespaces, make([]byte, postIndex-iNdEx)) - copy(m.Namespaces[len(m.Namespaces)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 3: if wireType == 0 { var v uint32 @@ -642,82 +546,6 @@ func (m *MsgPayForBlobs) Unmarshal(dAtA []byte) error { m.ShareCommitments = append(m.ShareCommitments, make([]byte, postIndex-iNdEx)) copy(m.ShareCommitments[len(m.ShareCommitments)-1], dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: - if wireType == 0 { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ShareVersions = append(m.ShareVersions, v) - } else if wireType == 2 { - var packedLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - packedLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if packedLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + packedLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - var elementCount int - var count int - for _, integer := range dAtA[iNdEx:postIndex] { - if integer < 128 { - count++ - } - } - elementCount = count - if elementCount != 0 && len(m.ShareVersions) == 0 { - m.ShareVersions = make([]uint32, 0, elementCount) - } - for iNdEx < postIndex { - var v uint32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ShareVersions = append(m.ShareVersions, v) - } - } else { - return fmt.Errorf("proto: wrong wireType = %d for field ShareVersions", wireType) - } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])