From 171a2ff46e7bcbc2b94239119a56a0124ad5c209 Mon Sep 17 00:00:00 2001 From: Parthib Date: Sat, 10 Feb 2024 18:56:01 +0530 Subject: [PATCH 1/2] Changed share.Root to share.Dah Signed-off-by: Parthib --- das/coordinator_test.go | 2 +- das/daser_test.go | 4 ++-- docs/adr/adr-009-public-api.md | 2 +- docs/adr/adr-011-blocksync-overhaul-part-1.md | 2 +- share/availability.go | 4 ++-- share/availability/full/testing.go | 4 ++-- share/availability/light/availability.go | 2 +- share/availability/light/testing.go | 2 +- share/availability/test/testing.go | 4 ++-- share/eds/edstest/testing.go | 2 +- share/eds/store.go | 6 +++--- share/eds/store_test.go | 2 +- share/eds/utils.go | 4 ++-- share/empty.go | 4 ++-- share/getter.go | 2 +- share/getters/shrex_test.go | 2 +- share/getters/testing.go | 2 +- share/ipld/utils.go | 2 +- share/p2p/shrexnd/client.go | 4 ++-- share/p2p/shrexnd/exchange_test.go | 2 +- 20 files changed, 29 insertions(+), 29 deletions(-) diff --git a/das/coordinator_test.go b/das/coordinator_test.go index 1ae54c470f..59ca213725 100644 --- a/das/coordinator_test.go +++ b/das/coordinator_test.go @@ -432,7 +432,7 @@ func (m *mockSampler) discover(ctx context.Context, newHeight uint64, emit liste emit(ctx, &header.ExtendedHeader{ Commit: &types.Commit{}, RawHeader: header.RawHeader{Height: int64(newHeight)}, - DAH: &share.Root{RowRoots: make([][]byte, 0)}, + DAH: &share.Dah{RowRoots: make([][]byte, 0)}, }) } diff --git a/das/daser_test.go b/das/daser_test.go index 9eec6392cc..eb5f0c4358 100644 --- a/das/daser_test.go +++ b/das/daser_test.go @@ -399,7 +399,7 @@ type benchGetterStub struct { func newBenchGetter() benchGetterStub { return benchGetterStub{header: &header.ExtendedHeader{ - DAH: &share.Root{RowRoots: make([][]byte, 0)}}} + DAH: &share.Dah{RowRoots: make([][]byte, 0)}}} } func (m benchGetterStub) GetByHeight(context.Context, uint64) (*header.ExtendedHeader, error) { @@ -419,7 +419,7 @@ func (m getterStub) GetByHeight(_ context.Context, height uint64) (*header.Exten return &header.ExtendedHeader{ Commit: &types.Commit{}, RawHeader: header.RawHeader{Height: int64(height)}, - DAH: &share.Root{RowRoots: make([][]byte, 0)}}, nil + DAH: &share.Dah{RowRoots: make([][]byte, 0)}}, nil } func (m getterStub) GetRangeByHeight( diff --git a/docs/adr/adr-009-public-api.md b/docs/adr/adr-009-public-api.md index be9e8827eb..33ad409049 100644 --- a/docs/adr/adr-009-public-api.md +++ b/docs/adr/adr-009-public-api.md @@ -125,7 +125,7 @@ NetworkHead(ctx context.Context) (*header.ExtendedHeader, error) // coordinates. GetShare(ctx context.Context, root *Root, row, col int) (Share, error) // GetEDS gets the full EDS identified by the given root. - GetEDS(ctx context.Context, root *share.Root) (*rsmt2d.ExtendedDataSquare, error) + GetEDS(ctx context.Context, root *share.Dah) (*rsmt2d.ExtendedDataSquare, error) // GetSharesByNamespace gets all shares from an EDS within the given namespace. // Shares are returned in a row-by-row order if the namespace spans multiple rows. GetSharesByNamespace( diff --git a/docs/adr/adr-011-blocksync-overhaul-part-1.md b/docs/adr/adr-011-blocksync-overhaul-part-1.md index 2967f696ac..3ef39622d3 100644 --- a/docs/adr/adr-011-blocksync-overhaul-part-1.md +++ b/docs/adr/adr-011-blocksync-overhaul-part-1.md @@ -301,7 +301,7 @@ The `GetDAH` method returns the DAH (`share.Root`) of the EDS identified by `Dat ```go // GetDAH returns the DataAvailabilityHeader for the EDS identified by DataHash. -func (s *Store) GetDAH(context.Context, share.DataHash) (*share.Root, error) +func (s *Store) GetDAH(context.Context, share.DataHash) (*share.Dah, error) ``` ##### `eds.Store.Get` diff --git a/share/availability.go b/share/availability.go index f3511da450..e5a1359e43 100644 --- a/share/availability.go +++ b/share/availability.go @@ -15,11 +15,11 @@ var ErrNotAvailable = errors.New("share: data not available") // Root represents root commitment to multiple Shares. // In practice, it is a commitment to all the Data in a square. -type Root = da.DataAvailabilityHeader +type Dah = da.DataAvailabilityHeader // NewRoot generates Root(DataAvailabilityHeader) using the // provided extended data square. -func NewRoot(eds *rsmt2d.ExtendedDataSquare) (*Root, error) { +func NewRoot(eds *rsmt2d.ExtendedDataSquare) (*Dah, error) { dah, err := da.NewDataAvailabilityHeader(eds) if err != nil { return nil, err diff --git a/share/availability/full/testing.go b/share/availability/full/testing.go index 46e97581f2..d8e88e9df4 100644 --- a/share/availability/full/testing.go +++ b/share/availability/full/testing.go @@ -20,14 +20,14 @@ import ( // GetterWithRandSquare provides a share.Getter filled with 'n' NMT // trees of 'n' random shares, essentially storing a whole square. -func GetterWithRandSquare(t *testing.T, n int) (share.Getter, *share.Root) { +func GetterWithRandSquare(t *testing.T, n int) (share.Getter, *share.Dah) { bServ := ipld.NewMemBlockservice() getter := getters.NewIPLDGetter(bServ) return getter, availability_test.RandFillBS(t, n, bServ) } // RandNode creates a Full Node filled with a random block of the given size. -func RandNode(dn *availability_test.TestDagNet, squareSize int) (*availability_test.TestNode, *share.Root) { +func RandNode(dn *availability_test.TestDagNet, squareSize int) (*availability_test.TestNode, *share.Dah) { nd := Node(dn) return nd, availability_test.RandFillBS(dn.T, squareSize, nd.BlockService) } diff --git a/share/availability/light/availability.go b/share/availability/light/availability.go index 1d35542344..2091715d72 100644 --- a/share/availability/light/availability.go +++ b/share/availability/light/availability.go @@ -141,7 +141,7 @@ func (la *ShareAvailability) SharesAvailable(ctx context.Context, header *header return nil } -func rootKey(root *share.Root) datastore.Key { +func rootKey(root *share.Dah) datastore.Key { return datastore.NewKey(root.String()) } diff --git a/share/availability/light/testing.go b/share/availability/light/testing.go index 9efc9ff14a..65481aa19c 100644 --- a/share/availability/light/testing.go +++ b/share/availability/light/testing.go @@ -35,7 +35,7 @@ func EmptyGetter() (share.Getter, blockservice.BlockService) { } // RandNode creates a Light Node filled with a random block of the given size. -func RandNode(dn *availability_test.TestDagNet, squareSize int) (*availability_test.TestNode, *share.Root) { +func RandNode(dn *availability_test.TestDagNet, squareSize int) (*availability_test.TestNode, *share.Dah) { nd := Node(dn) return nd, availability_test.RandFillBS(dn.T, squareSize, nd.BlockService) } diff --git a/share/availability/test/testing.go b/share/availability/test/testing.go index 64e8d23bb7..e097673f26 100644 --- a/share/availability/test/testing.go +++ b/share/availability/test/testing.go @@ -23,13 +23,13 @@ import ( ) // RandFillBS fills the given BlockService with a random block of a given size. -func RandFillBS(t *testing.T, n int, bServ blockservice.BlockService) *share.Root { +func RandFillBS(t *testing.T, n int, bServ blockservice.BlockService) *share.Dah { shares := sharetest.RandShares(t, n*n) return FillBS(t, bServ, shares) } // FillBS fills the given BlockService with the given shares. -func FillBS(t *testing.T, bServ blockservice.BlockService, shares []share.Share) *share.Root { +func FillBS(t *testing.T, bServ blockservice.BlockService, shares []share.Share) *share.Dah { eds, err := ipld.AddShares(context.TODO(), shares, bServ) require.NoError(t, err) dah, err := share.NewRoot(eds) diff --git a/share/eds/edstest/testing.go b/share/eds/edstest/testing.go index bf5e664f90..71ac52cde9 100644 --- a/share/eds/edstest/testing.go +++ b/share/eds/edstest/testing.go @@ -38,7 +38,7 @@ func RandEDSWithNamespace( t require.TestingT, namespace share.Namespace, size int, -) (*rsmt2d.ExtendedDataSquare, *share.Root) { +) (*rsmt2d.ExtendedDataSquare, *share.Dah) { shares := sharetest.RandSharesWithNamespace(t, namespace, size*size) eds, err := rsmt2d.ComputeExtendedDataSquare(shares, share.DefaultRSMT2DCodec(), wrapper.NewConstructor(uint64(size))) require.NoError(t, err, "failure to recompute the extended data square") diff --git a/share/eds/store.go b/share/eds/store.go index 816065909e..8dde1619e6 100644 --- a/share/eds/store.go +++ b/share/eds/store.go @@ -405,7 +405,7 @@ func (s *Store) carBlockstore( } // GetDAH returns the DataAvailabilityHeader for the EDS identified by DataHash. -func (s *Store) GetDAH(ctx context.Context, root share.DataHash) (*share.Root, error) { +func (s *Store) GetDAH(ctx context.Context, root share.DataHash) (*share.Dah, error) { ctx, span := tracer.Start(ctx, "store/car-dah") tnow := time.Now() r, err := s.getDAH(ctx, root) @@ -414,7 +414,7 @@ func (s *Store) GetDAH(ctx context.Context, root share.DataHash) (*share.Root, e return r, err } -func (s *Store) getDAH(ctx context.Context, root share.DataHash) (*share.Root, error) { +func (s *Store) getDAH(ctx context.Context, root share.DataHash) (*share.Dah, error) { r, err := s.getCAR(ctx, root) if err != nil { return nil, fmt.Errorf("eds/store: failed to get CAR file: %w", err) @@ -434,7 +434,7 @@ func (s *Store) getDAH(ctx context.Context, root share.DataHash) (*share.Root, e } // dahFromCARHeader returns the DataAvailabilityHeader stored in the CIDs of a CARv1 header. -func dahFromCARHeader(carHeader *carv1.CarHeader) *share.Root { +func dahFromCARHeader(carHeader *carv1.CarHeader) *share.Dah { rootCount := len(carHeader.Roots) rootBytes := make([][]byte, 0, rootCount) for _, root := range carHeader.Roots { diff --git a/share/eds/store_test.go b/share/eds/store_test.go index 6bc6972bb4..4285361b5d 100644 --- a/share/eds/store_test.go +++ b/share/eds/store_test.go @@ -530,7 +530,7 @@ func newStore(t *testing.T) (*Store, error) { return NewStore(DefaultParameters(), t.TempDir(), ds) } -func randomEDS(t *testing.T) (*rsmt2d.ExtendedDataSquare, *share.Root) { +func randomEDS(t *testing.T) (*rsmt2d.ExtendedDataSquare, *share.Dah) { eds := edstest.RandEDS(t, 4) dah, err := share.NewRoot(eds) require.NoError(t, err) diff --git a/share/eds/utils.go b/share/eds/utils.go index b897dd14b5..02e7c04ce2 100644 --- a/share/eds/utils.go +++ b/share/eds/utils.go @@ -62,7 +62,7 @@ func closeAndLog(name string, closer io.Closer) { func RetrieveNamespaceFromStore( ctx context.Context, store *Store, - dah *share.Root, + dah *share.Dah, namespace share.Namespace, ) (shares share.NamespacedShares, err error) { if err = namespace.ValidateForData(); err != nil { @@ -111,7 +111,7 @@ func RetrieveNamespaceFromStore( func CollectSharesByNamespace( ctx context.Context, bg blockservice.BlockGetter, - root *share.Root, + root *share.Dah, namespace share.Namespace, ) (shares share.NamespacedShares, err error) { ctx, span := tracer.Start(ctx, "collect-shares-by-namespace", trace.WithAttributes( diff --git a/share/empty.go b/share/empty.go index ef3d088e1d..24a5854faa 100644 --- a/share/empty.go +++ b/share/empty.go @@ -12,7 +12,7 @@ import ( ) // EmptyRoot returns Root of the empty block EDS. -func EmptyRoot() *Root { +func EmptyRoot() *Dah { initEmpty() return emptyBlockRoot } @@ -31,7 +31,7 @@ func EmptyBlockShares() []Share { var ( emptyMu sync.Mutex - emptyBlockRoot *Root + emptyBlockRoot *Dah emptyBlockEDS *rsmt2d.ExtendedDataSquare emptyBlockShares []Share ) diff --git a/share/getter.go b/share/getter.go index 3fcc93de33..559ce41c09 100644 --- a/share/getter.go +++ b/share/getter.go @@ -58,7 +58,7 @@ type NamespacedRow struct { } // Verify validates NamespacedShares by checking every row with nmt inclusion proof. -func (ns NamespacedShares) Verify(root *Root, namespace Namespace) error { +func (ns NamespacedShares) Verify(root *Dah, namespace Namespace) error { var originalRoots [][]byte for _, row := range root.RowRoots { if !namespace.IsOutsideRange(row, row) { diff --git a/share/getters/shrex_test.go b/share/getters/shrex_test.go index 075735579b..f6608de037 100644 --- a/share/getters/shrex_test.go +++ b/share/getters/shrex_test.go @@ -199,7 +199,7 @@ func newStore(t *testing.T) (*eds.Store, error) { return eds.NewStore(eds.DefaultParameters(), t.TempDir(), ds) } -func generateTestEDS(t *testing.T) (*rsmt2d.ExtendedDataSquare, *share.Root, share.Namespace) { +func generateTestEDS(t *testing.T) (*rsmt2d.ExtendedDataSquare, *share.Dah, share.Namespace) { eds := edstest.RandEDS(t, 4) dah, err := share.NewRoot(eds) require.NoError(t, err) diff --git a/share/getters/testing.go b/share/getters/testing.go index fafeb0541c..9ff3ddd6cb 100644 --- a/share/getters/testing.go +++ b/share/getters/testing.go @@ -64,7 +64,7 @@ func (seg *SingleEDSGetter) GetSharesByNamespace(context.Context, *header.Extend panic("SingleEDSGetter: GetSharesByNamespace is not implemented") } -func (seg *SingleEDSGetter) checkRoot(root *share.Root) error { +func (seg *SingleEDSGetter) checkRoot(root *share.Dah) error { dah, err := da.NewDataAvailabilityHeader(seg.EDS) if err != nil { return err diff --git a/share/ipld/utils.go b/share/ipld/utils.go index d3e987e7f3..fa0fa3fadc 100644 --- a/share/ipld/utils.go +++ b/share/ipld/utils.go @@ -7,7 +7,7 @@ import ( ) // FilterRootByNamespace returns the row roots from the given share.Root that contain the namespace. -func FilterRootByNamespace(root *share.Root, namespace share.Namespace) []cid.Cid { +func FilterRootByNamespace(root *share.Dah, namespace share.Namespace) []cid.Cid { rowRootCIDs := make([]cid.Cid, 0, len(root.RowRoots)) for _, row := range root.RowRoots { if !namespace.IsOutsideRange(row, row) { diff --git a/share/p2p/shrexnd/client.go b/share/p2p/shrexnd/client.go index 86c5150095..2701bbdaff 100644 --- a/share/p2p/shrexnd/client.go +++ b/share/p2p/shrexnd/client.go @@ -48,7 +48,7 @@ func NewClient(params *Parameters, host host.Host) (*Client, error) { // Returns NamespacedShares with unverified inclusion proofs against the share.Root. func (c *Client) RequestND( ctx context.Context, - root *share.Root, + root *share.Dah, namespace share.Namespace, peer peer.ID, ) (share.NamespacedShares, error) { @@ -81,7 +81,7 @@ func (c *Client) RequestND( func (c *Client) doRequest( ctx context.Context, - root *share.Root, + root *share.Dah, namespace share.Namespace, peerID peer.ID, ) (share.NamespacedShares, error) { diff --git a/share/p2p/shrexnd/exchange_test.go b/share/p2p/shrexnd/exchange_test.go index cb8bbe9d74..009a821292 100644 --- a/share/p2p/shrexnd/exchange_test.go +++ b/share/p2p/shrexnd/exchange_test.go @@ -31,7 +31,7 @@ func TestExchange_RequestND_NotFound(t *testing.T) { ctx, cancel := context.WithTimeout(ctx, time.Second) t.Cleanup(cancel) - root := share.Root{} + root := share.Dah{} namespace := sharetest.RandV0Namespace() _, err := client.RequestND(ctx, &root, namespace, server.host.ID()) require.ErrorIs(t, err, p2p.ErrNotFound) From 8c1c249b58ebe3fcfe854e3db66f0c8fe99f974f Mon Sep 17 00:00:00 2001 From: Parthib Date: Sat, 10 Feb 2024 19:55:29 +0530 Subject: [PATCH 2/2] Named all Daheader hash to Datahash Signed-off-by: Parthib --- core/eds.go | 4 +- core/exchange.go | 2 +- das/worker.go | 2 +- nodebuilder/share/cmd/share.go | 4 +- share/eds/store.go | 2 +- share/getters/getter_test.go | 12 ++--- share/getters/shrex.go | 2 +- share/p2p/shrexeds/client.go | 4 +- .../shrexeds/pb/extended_data_square.pb.go | 50 +++++++++---------- .../shrexeds/pb/extended_data_square.proto | 2 +- share/p2p/shrexnd/server.go | 4 +- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/core/eds.go b/core/eds.go index eb93c249ba..72b2eac065 100644 --- a/core/eds.go +++ b/core/eds.go @@ -51,11 +51,11 @@ func extendShares(s [][]byte, options ...nmt.Option) (*rsmt2d.ExtendedDataSquare } // storeEDS will only store extended block if it is not empty and doesn't already exist. -func storeEDS(ctx context.Context, hash share.DataHash, eds *rsmt2d.ExtendedDataSquare, store *eds.Store) error { +func storeEDS(ctx context.Context, datahash share.DataHash, eds *rsmt2d.ExtendedDataSquare, store *eds.Store) error { if eds == nil { return nil } - err := store.Put(ctx, hash, eds) + err := store.Put(ctx, datahash, eds) if errors.Is(err, dagstore.ErrShardExists) { // block with given root already exists, return nil return nil diff --git a/core/exchange.go b/core/exchange.go index cf889a38bb..38bf8859a7 100644 --- a/core/exchange.go +++ b/core/exchange.go @@ -120,7 +120,7 @@ func (ce *Exchange) getRangeByHeight(ctx context.Context, from, amount uint64) ( } func (ce *Exchange) Get(ctx context.Context, hash libhead.Hash) (*header.ExtendedHeader, error) { - log.Debugw("requesting header", "hash", hash.String()) + log.Debugw("requesting header", "datahash", hash.String()) block, err := ce.fetcher.GetBlockByHash(ctx, hash) if err != nil { return nil, fmt.Errorf("fetching block by hash %s: %w", hash.String(), err) diff --git a/das/worker.go b/das/worker.go index f2e8c4d821..cdf5e0e1e1 100644 --- a/das/worker.go +++ b/das/worker.go @@ -119,7 +119,7 @@ func (w *worker) sample(ctx context.Context, timeout time.Duration, height uint6 "failed to sample header", "type", w.state.jobType, "height", h.Height(), - "hash", h.Hash(), + "datahash", h.Hash(), "square width", len(h.DAH.RowRoots), "data root", h.DAH.String(), "err", err, diff --git a/nodebuilder/share/cmd/share.go b/nodebuilder/share/cmd/share.go index b890f2d4c0..8bc18c7d53 100644 --- a/nodebuilder/share/cmd/share.go +++ b/nodebuilder/share/cmd/share.go @@ -56,11 +56,11 @@ var sharesAvailableCmd = &cobra.Command{ } return struct { Available bool `json:"available"` - Hash []byte `json:"dah_hash"` + DataHash []byte `json:"dah_hash"` Reason error `json:"reason,omitempty"` }{ Available: available, - Hash: []byte(args[0]), + DataHash: []byte(args[0]), Reason: err, } } diff --git a/share/eds/store.go b/share/eds/store.go index 8dde1619e6..205a1b4fe9 100644 --- a/share/eds/store.go +++ b/share/eds/store.go @@ -440,7 +440,7 @@ func dahFromCARHeader(carHeader *carv1.CarHeader) *share.Dah { for _, root := range carHeader.Roots { rootBytes = append(rootBytes, ipld.NamespacedSha256FromCID(root)) } - return &share.Root{ + return &share.Dah{ RowRoots: rootBytes[:rootCount/2], ColumnRoots: rootBytes[rootCount/2:], } diff --git a/share/getters/getter_test.go b/share/getters/getter_test.go index 7297766652..92fa0696ea 100644 --- a/share/getters/getter_test.go +++ b/share/getters/getter_test.go @@ -76,8 +76,8 @@ func TestStoreGetter(t *testing.T) { assert.True(t, randEds.Equals(retrievedEDS)) // root not found - emptyRoot := da.MinDataAvailabilityHeader() - eh.DAH = &emptyRoot + emptyDah := da.MinDataAvailabilityHeader() + eh.DAH = &emptyDah _, err = sg.GetEDS(ctx, eh) require.ErrorIs(t, err, share.ErrNotFound) }) @@ -99,8 +99,8 @@ func TestStoreGetter(t *testing.T) { require.Empty(t, emptyShares.Flatten()) // root not found - emptyRoot := da.MinDataAvailabilityHeader() - eh.DAH = &emptyRoot + emptyDah := da.MinDataAvailabilityHeader() + eh.DAH = &emptyDah _, err = sg.GetSharesByNamespace(ctx, eh, namespace) require.ErrorIs(t, err, share.ErrNotFound) }) @@ -232,8 +232,8 @@ func TestIPLDGetter(t *testing.T) { require.Empty(t, emptyShares.Flatten()) // nid doesn't exist in root - emptyRoot := da.MinDataAvailabilityHeader() - eh.DAH = &emptyRoot + emptyDah := da.MinDataAvailabilityHeader() + eh.DAH = &emptyDah emptyShares, err = sg.GetSharesByNamespace(ctx, eh, namespace) require.NoError(t, err) require.Empty(t, emptyShares.Flatten()) diff --git a/share/getters/shrex.go b/share/getters/shrex.go index 826c6b1a10..aaddf88a5f 100644 --- a/share/getters/shrex.go +++ b/share/getters/shrex.go @@ -145,7 +145,7 @@ func (sg *ShrexGetter) GetEDS(ctx context.Context, header *header.ExtendedHeader peer, setStatus, getErr := sg.peerManager.Peer(ctx, header.DAH.Hash(), header.Height()) if getErr != nil { log.Debugw("eds: couldn't find peer", - "hash", header.DAH.String(), + "datahash", header.DAH.String(), "err", getErr, "finished (s)", time.Since(start)) sg.metrics.recordEDSAttempt(ctx, attempt, false) diff --git a/share/p2p/shrexeds/client.go b/share/p2p/shrexeds/client.go index 7602bb5fb0..e55018e6bb 100644 --- a/share/p2p/shrexeds/client.go +++ b/share/p2p/shrexeds/client.go @@ -71,7 +71,7 @@ func (c *Client) RequestEDS( if err != p2p.ErrNotFound { log.Warnw("client: eds request to peer failed", "peer", peer.String(), - "hash", dataHash.String(), + "datahash", dataHash.String(), "err", err) } @@ -93,7 +93,7 @@ func (c *Client) doRequest( c.setStreamDeadlines(ctx, stream) - req := &pb.EDSRequest{Hash: dataHash} + req := &pb.EDSRequest{Datahash: dataHash} // request ODS log.Debugw("client: requesting ods", "hash", dataHash.String(), "peer", to.String()) diff --git a/share/p2p/shrexeds/pb/extended_data_square.pb.go b/share/p2p/shrexeds/pb/extended_data_square.pb.go index ed1a96ae3b..098ead37c3 100644 --- a/share/p2p/shrexeds/pb/extended_data_square.pb.go +++ b/share/p2p/shrexeds/pb/extended_data_square.pb.go @@ -54,7 +54,7 @@ func (Status) EnumDescriptor() ([]byte, []int) { } type EDSRequest struct { - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Datahash []byte `protobuf:"bytes,1,opt,name=datahash,proto3" json:"datahash,omitempty"` } func (m *EDSRequest) Reset() { *m = EDSRequest{} } @@ -90,9 +90,9 @@ func (m *EDSRequest) XXX_DiscardUnknown() { var xxx_messageInfo_EDSRequest proto.InternalMessageInfo -func (m *EDSRequest) GetHash() []byte { +func (m *EDSRequest) GetDatahash() []byte { if m != nil { - return m.Hash + return m.Datahash } return nil } @@ -152,22 +152,22 @@ func init() { } var fileDescriptor_49d42aa96098056e = []byte{ - // 227 bytes of a gzipped FileDescriptorProto + // 229 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x28, 0xce, 0x48, 0x2c, 0x4a, 0xd5, 0x2f, 0x30, 0x2a, 0xd0, 0x2f, 0xce, 0x28, 0x4a, 0xad, 0x48, 0x4d, 0x29, 0xd6, 0x2f, 0x48, 0xd2, 0x4f, 0xad, 0x28, 0x49, 0xcd, 0x4b, 0x49, 0x4d, 0x89, 0x4f, 0x49, 0x2c, 0x49, 0x8c, - 0x2f, 0x2e, 0x2c, 0x4d, 0x2c, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x52, 0xe0, 0xe2, - 0x72, 0x75, 0x09, 0x0e, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0x12, 0xe2, 0x62, 0xc9, 0x48, - 0x2c, 0xce, 0x90, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, 0x02, 0xb3, 0x95, 0xf4, 0xb8, 0xb8, 0xc1, - 0x2a, 0x8a, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0xe4, 0xb9, 0xd8, 0x8a, 0x4b, 0x12, 0x4b, 0x4a, - 0x8b, 0xc1, 0x8a, 0xf8, 0x8c, 0xd8, 0xf5, 0x82, 0xc1, 0xdc, 0x20, 0xa8, 0xb0, 0x96, 0x15, 0x17, - 0x1b, 0x44, 0x44, 0x88, 0x9b, 0x8b, 0xdd, 0xd3, 0x2f, 0xcc, 0xd1, 0xc7, 0xd3, 0x45, 0x80, 0x41, - 0x88, 0x8d, 0x8b, 0xc9, 0xdf, 0x5b, 0x80, 0x51, 0x88, 0x97, 0x8b, 0xd3, 0xcf, 0x3f, 0x24, 0xde, - 0xcd, 0x3f, 0xd4, 0xcf, 0x45, 0x80, 0x49, 0x88, 0x87, 0x8b, 0xc3, 0xd3, 0x2f, 0xc4, 0x35, 0xc8, - 0xcf, 0xd1, 0x47, 0x80, 0xd9, 0x49, 0xe2, 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, - 0x92, 0xd8, 0xc0, 0xce, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x1d, 0xd4, 0xa7, 0xe2, - 0x00, 0x00, 0x00, + 0x2f, 0x2e, 0x2c, 0x4d, 0x2c, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0xd2, 0xe0, 0xe2, + 0x72, 0x75, 0x09, 0x0e, 0x4a, 0x2d, 0x2c, 0x4d, 0x2d, 0x2e, 0x11, 0x92, 0xe2, 0xe2, 0x00, 0x29, + 0xc9, 0x48, 0x2c, 0xce, 0x90, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x09, 0x82, 0xf3, 0x95, 0xf4, 0xb8, + 0xb8, 0xc1, 0x2a, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x85, 0xe4, 0xb9, 0xd8, 0x8a, 0x4b, 0x12, + 0x4b, 0x4a, 0x8b, 0xc1, 0x0a, 0xf9, 0x8c, 0xd8, 0xf5, 0x82, 0xc1, 0xdc, 0x20, 0xa8, 0xb0, 0x96, + 0x15, 0x17, 0x1b, 0x44, 0x44, 0x88, 0x9b, 0x8b, 0xdd, 0xd3, 0x2f, 0xcc, 0xd1, 0xc7, 0xd3, 0x45, + 0x80, 0x41, 0x88, 0x8d, 0x8b, 0xc9, 0xdf, 0x5b, 0x80, 0x51, 0x88, 0x97, 0x8b, 0xd3, 0xcf, 0x3f, + 0x24, 0xde, 0xcd, 0x3f, 0xd4, 0xcf, 0x45, 0x80, 0x49, 0x88, 0x87, 0x8b, 0xc3, 0xd3, 0x2f, 0xc4, + 0x35, 0xc8, 0xcf, 0xd1, 0x47, 0x80, 0xd9, 0x49, 0xe2, 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, 0x92, 0xd8, 0xc0, 0xce, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x5b, 0xb5, + 0x22, 0xea, 0x00, 0x00, 0x00, } func (m *EDSRequest) Marshal() (dAtA []byte, err error) { @@ -190,10 +190,10 @@ func (m *EDSRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintExtendedDataSquare(dAtA, i, uint64(len(m.Hash))) + if len(m.Datahash) > 0 { + i -= len(m.Datahash) + copy(dAtA[i:], m.Datahash) + i = encodeVarintExtendedDataSquare(dAtA, i, uint64(len(m.Datahash))) i-- dAtA[i] = 0xa } @@ -245,7 +245,7 @@ func (m *EDSRequest) Size() (n int) { } var l int _ = l - l = len(m.Hash) + l = len(m.Datahash) if l > 0 { n += 1 + l + sovExtendedDataSquare(uint64(l)) } @@ -301,7 +301,7 @@ func (m *EDSRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Datahash", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -328,9 +328,9 @@ func (m *EDSRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} + m.Datahash = append(m.Datahash[:0], dAtA[iNdEx:postIndex]...) + if m.Datahash == nil { + m.Datahash = []byte{} } iNdEx = postIndex default: diff --git a/share/p2p/shrexeds/pb/extended_data_square.proto b/share/p2p/shrexeds/pb/extended_data_square.proto index 63750962e9..5a116cb86b 100644 --- a/share/p2p/shrexeds/pb/extended_data_square.proto +++ b/share/p2p/shrexeds/pb/extended_data_square.proto @@ -1,7 +1,7 @@ syntax = "proto3"; message EDSRequest { - bytes hash = 1; // identifies the requested EDS. + bytes datahash = 1; // identifies the requested EDS. } enum Status { diff --git a/share/p2p/shrexnd/server.go b/share/p2p/shrexnd/server.go index 33e61ff472..2fdbab0fd9 100644 --- a/share/p2p/shrexnd/server.go +++ b/share/p2p/shrexnd/server.go @@ -172,8 +172,8 @@ func (srv *Server) readRequest( } func (srv *Server) getNamespaceData(ctx context.Context, - hash share.DataHash, namespace share.Namespace) (share.NamespacedShares, pb.StatusCode, error) { - dah, err := srv.store.GetDAH(ctx, hash) + datahash share.DataHash, namespace share.Namespace) (share.NamespacedShares, pb.StatusCode, error) { + dah, err := srv.store.GetDAH(ctx, datahash) if err != nil { if errors.Is(err, eds.ErrNotFound) { return nil, pb.StatusCode_NOT_FOUND, nil