From 509a5c1ee83a8db834a62e09062e08ee6165986d Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Mon, 12 Feb 2024 11:02:22 -0800 Subject: [PATCH 1/6] fix(da): update go-da interface v0.4.0 --- celestia/celestia.go | 103 ++++++++++++++++++++------------------ celestia/celestia_test.go | 49 +++++++++--------- celestia/mock.go | 2 +- cmd/celestia-da/cmd.go | 2 +- go.mod | 50 +++++++++--------- go.sum | 97 ++++++++++++++++++----------------- 6 files changed, 155 insertions(+), 148 deletions(-) diff --git a/celestia/celestia.go b/celestia/celestia.go index 4a031b7..cc2a736 100644 --- a/celestia/celestia.go +++ b/celestia/celestia.go @@ -4,17 +4,13 @@ import ( "context" "encoding/binary" "log" - "math" "strings" - "github.com/celestiaorg/celestia-app/pkg/appconsts" "github.com/celestiaorg/celestia-app/x/blob/types" rpc "github.com/celestiaorg/celestia-node/api/rpc/client" "github.com/celestiaorg/celestia-node/blob" "github.com/celestiaorg/celestia-node/share" "github.com/celestiaorg/nmt" - sdktypes "github.com/cosmos/cosmos-sdk/types" - auth "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/rollkit/go-da" ) @@ -54,11 +50,14 @@ func (c *CelestiaDA) MaxBlobSize(ctx context.Context) (uint64, error) { } // Get returns Blob for each given ID, or an error. -func (c *CelestiaDA) Get(ctx context.Context, ids []da.ID) ([]da.Blob, error) { +func (c *CelestiaDA) Get(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Blob, error) { + if ns == nil { + ns = c.namespace + } var blobs []da.Blob for _, id := range ids { - height, commitment := splitID(id) - blob, err := c.client.Blob.Get(ctx, height, c.namespace, commitment) + height, commitment := SplitID(id) + blob, err := c.client.Blob.Get(ctx, height, ns, commitment) if err != nil { return nil, err } @@ -68,9 +67,9 @@ func (c *CelestiaDA) Get(ctx context.Context, ids []da.ID) ([]da.Blob, error) { } // GetIDs returns IDs of all Blobs located in DA at given height. -func (c *CelestiaDA) GetIDs(ctx context.Context, height uint64) ([]da.ID, error) { +func (c *CelestiaDA) GetIDs(ctx context.Context, height uint64, ns da.Namespace) ([]da.ID, error) { var ids []da.ID - blobs, err := c.client.Blob.GetAll(ctx, height, []share.Namespace{c.namespace}) + blobs, err := c.client.Blob.GetAll(ctx, height, []share.Namespace{ns}) if err != nil { if strings.Contains(err.Error(), blob.ErrBlobNotFound.Error()) { return nil, nil @@ -78,64 +77,66 @@ func (c *CelestiaDA) GetIDs(ctx context.Context, height uint64) ([]da.ID, error) return nil, err } for _, b := range blobs { - ids = append(ids, makeID(height, b.Commitment)) + ids = append(ids, MakeID(height, b.Commitment)) } return ids, nil } // Commit creates a Commitment for each given Blob. -func (c *CelestiaDA) Commit(ctx context.Context, daBlobs []da.Blob) ([]da.Commitment, error) { - _, commitments, err := c.blobsAndCommitments(daBlobs) +func (c *CelestiaDA) Commit(ctx context.Context, daBlobs []da.Blob, ns da.Namespace) ([]da.Commitment, error) { + if ns == nil { + ns = c.namespace + } + _, commitments, err := c.blobsAndCommitments(daBlobs, ns) return commitments, err } // Submit submits the Blobs to Data Availability layer. -func (c *CelestiaDA) Submit(ctx context.Context, daBlobs []da.Blob, gasPrice float64) ([]da.ID, []da.Proof, error) { - blobs, commitments, err := c.blobsAndCommitments(daBlobs) +func (c *CelestiaDA) Submit(ctx context.Context, daBlobs []da.Blob, gasPrice float64, ns da.Namespace) ([]da.ID, error) { + if ns == nil { + ns = c.namespace + } + blobs, _, err := c.blobsAndCommitments(daBlobs, ns) if err != nil { - return nil, nil, err + return nil, err } - options := blob.DefaultSubmitOptions() - // if gas price was configured globally use that as the default - if c.gasPrice >= 0 && gasPrice < 0 { - gasPrice = c.gasPrice + height, err := c.client.Blob.Submit(ctx, blobs, blob.GasPrice(gasPrice)) + if err != nil { + return nil, err } - if gasPrice >= 0 { - blobSizes := make([]uint32, len(blobs)) - for i, blob := range blobs { - blobSizes[i] = uint32(len(blob.Data)) - } - options.GasLimit = types.EstimateGas(blobSizes, appconsts.DefaultGasPerBlobByte, auth.DefaultTxSizeCostPerByte) - options.Fee = sdktypes.NewInt(int64(math.Ceil(gasPrice * float64(options.GasLimit)))).Int64() + log.Println("successfully submitted blobs", "height", height, "gasPrice", gasPrice) + ids := make([]da.ID, len(blobs)) + for i, blob := range blobs { + ids[i] = MakeID(height, blob.Commitment) } - height, err := c.client.Blob.Submit(ctx, blobs, options) - if err != nil { - return nil, nil, err - } - log.Println("successfully submitted blobs", "height", height, "gas", options.GasLimit, "fee", options.Fee) - ids := make([]da.ID, len(daBlobs)) - proofs := make([]da.Proof, len(daBlobs)) - for i, commitment := range commitments { - ids[i] = makeID(height, commitment) - proof, err := c.client.Blob.GetProof(ctx, height, c.namespace, commitment) + return ids, nil +} + +func (c *CelestiaDA) GetProofs(ctx context.Context, daIDs []da.ID, ns da.Namespace) ([]da.Proof, error) { + if ns == nil { + ns = c.namespace + } + proofs := make([]da.Proof, len(daIDs)) + for i, id := range daIDs { + height, commitment := SplitID(id) + proof, err := c.client.Blob.GetProof(ctx, height, ns, commitment) if err != nil { - return nil, nil, err + return nil, err } - // TODO(tzdybal): does always len(*proof) == 1? - proofs[i], err = (*proof)[0].MarshalJSON() + proofs[i], err = proof.MarshalJSON() if err != nil { - return nil, nil, err + return nil, err } } - return ids, proofs, nil + return proofs, nil } // blobsAndCommitments converts []da.Blob to []*blob.Blob and generates corresponding []da.Commitment -func (c *CelestiaDA) blobsAndCommitments(daBlobs []da.Blob) ([]*blob.Blob, []da.Commitment, error) { +func (c *CelestiaDA) blobsAndCommitments(daBlobs []da.Blob, ns da.Namespace) ([]*blob.Blob, []da.Commitment, error) { var blobs []*blob.Blob var commitments []da.Commitment for _, daBlob := range daBlobs { - b, err := blob.NewBlobV0(c.namespace, daBlob) + b, err := blob.NewBlobV0(ns, daBlob) if err != nil { return nil, nil, err } @@ -151,7 +152,10 @@ func (c *CelestiaDA) blobsAndCommitments(daBlobs []da.Blob) ([]*blob.Blob, []da. } // Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs. -func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Proof) ([]bool, error) { +func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Proof, ns da.Namespace) ([]bool, error) { + if ns == nil { + ns = c.namespace + } var included []bool var proofs []*blob.Proof for _, daProof := range daProofs { @@ -163,11 +167,11 @@ func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Pr proofs = append(proofs, proof) } for i, id := range ids { - height, commitment := splitID(id) + height, commitment := SplitID(id) // TODO(tzdybal): for some reason, if proof doesn't match commitment, API returns (false, "blob: invalid proof") // but analysis of the code in celestia-node implies this should never happen - maybe it's caused by openrpc? // there is no way of gently handling errors here, but returned value is fine for us - isIncluded, _ := c.client.Blob.Included(ctx, height, c.namespace, proofs[i], commitment) + isIncluded, _ := c.client.Blob.Included(ctx, height, ns, proofs[i], commitment) included = append(included, isIncluded) } return included, nil @@ -178,18 +182,19 @@ func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Pr // This is 8 as uint64 consist of 8 bytes. const heightLen = 8 -func makeID(height uint64, commitment da.Commitment) da.ID { +func MakeID(height uint64, commitment da.Commitment) da.ID { id := make([]byte, heightLen+len(commitment)) binary.LittleEndian.PutUint64(id, height) copy(id[heightLen:], commitment) return id } -func splitID(id da.ID) (uint64, da.Commitment) { +func SplitID(id da.ID) (uint64, da.Commitment) { if len(id) <= heightLen { return 0, nil } - return binary.LittleEndian.Uint64(id[:heightLen]), id[heightLen:] + commitment := id[heightLen:] + return binary.LittleEndian.Uint64(id[:heightLen]), commitment } var _ da.DA = &CelestiaDA{} diff --git a/celestia/celestia_test.go b/celestia/celestia_test.go index 0d04a8f..a376f64 100644 --- a/celestia/celestia_test.go +++ b/celestia/celestia_test.go @@ -29,14 +29,15 @@ func setup(t *testing.T) *mockDA { t.Logf("mock json-rpc server listening on: %s", mockService.server.URL) - ctx := context.TODO() - client, err := rpc.NewClient(ctx, mockService.server.URL, "test") + nsHex, err := hex.DecodeString("0000c9761e8b221ae42f") assert.NoError(t, err) - ns, err := hex.DecodeString("0000c9761e8b221ae42f") + ns, err := share.NewBlobNamespaceV0(nsHex) assert.NoError(t, err) - namespace, err := share.NewBlobNamespaceV0(ns) + + ctx := context.TODO() + client, err := rpc.NewClient(ctx, mockService.server.URL, "test") assert.NoError(t, err) - da := NewCelestiaDA(client, namespace, -1, ctx) + da := NewCelestiaDA(client, ns, -1, ctx) assert.Equal(t, da.client, client) return &mockDA{mockService, *da} @@ -54,6 +55,12 @@ func TestCelestiaDA(t *testing.T) { m := setup(t) defer teardown(m) + nsHex, err := hex.DecodeString("0000c9761e8b221ae42f") + assert.NoError(t, err) + ns, err := share.NewBlobNamespaceV0(nsHex) + assert.NoError(t, err) + + assert.NoError(t, err) t.Run("MaxBlobSize", func(t *testing.T) { maxBlobSize, err := m.MaxBlobSize(ctx) assert.NoError(t, err) @@ -61,32 +68,31 @@ func TestCelestiaDA(t *testing.T) { }) t.Run("Get_empty", func(t *testing.T) { - blobs, err := m.Get(ctx, nil) + blobs, err := m.Get(ctx, nil, ns) assert.NoError(t, err) assert.Equal(t, 0, len(blobs)) }) t.Run("GetIDs_empty", func(t *testing.T) { - blobs, err := m.GetIDs(ctx, 0) + blobs, err := m.GetIDs(ctx, 0, ns) assert.NoError(t, err) assert.Equal(t, 0, len(blobs)) }) t.Run("Commit_empty", func(t *testing.T) { - commitments, err := m.Commit(ctx, nil) + commitments, err := m.Commit(ctx, nil, ns) assert.NoError(t, err) assert.Equal(t, 0, len(commitments)) }) t.Run("Submit_empty", func(t *testing.T) { - blobs, proofs, err := m.Submit(ctx, nil, -1) + blobs, err := m.Submit(ctx, nil, -1, ns) assert.NoError(t, err) assert.Equal(t, 0, len(blobs)) - assert.Equal(t, 0, len(proofs)) }) t.Run("Validate_empty", func(t *testing.T) { - valids, err := m.Validate(ctx, nil, nil) + valids, err := m.Validate(ctx, nil, nil, ns) assert.NoError(t, err) assert.Equal(t, 0, len(valids)) }) @@ -94,7 +100,7 @@ func TestCelestiaDA(t *testing.T) { t.Run("Get_existing", func(t *testing.T) { commitment, err := hex.DecodeString("1b454951cd722b2cf7be5b04554b76ccf48f65a7ad6af45055006994ce70fd9d") assert.NoError(t, err) - blobs, err := m.Get(ctx, []ID{makeID(42, commitment)}) + blobs, err := m.Get(ctx, []ID{MakeID(42, commitment)}, ns) assert.NoError(t, err) assert.Equal(t, 1, len(blobs)) blob1 := blobs[0] @@ -102,41 +108,38 @@ func TestCelestiaDA(t *testing.T) { }) t.Run("GetIDs_existing", func(t *testing.T) { - ids, err := m.GetIDs(ctx, 42) + ids, err := m.GetIDs(ctx, 42, ns) assert.NoError(t, err) assert.Equal(t, 1, len(ids)) id1 := ids[0] commitment, err := hex.DecodeString("1b454951cd722b2cf7be5b04554b76ccf48f65a7ad6af45055006994ce70fd9d") assert.NoError(t, err) - assert.Equal(t, makeID(42, commitment), id1) + assert.Equal(t, MakeID(42, commitment), id1) }) t.Run("Commit_existing", func(t *testing.T) { - commitments, err := m.Commit(ctx, []Blob{[]byte{0x00, 0x01, 0x02}}) + commitments, err := m.Commit(ctx, []Blob{[]byte{0x00, 0x01, 0x02}}, ns) assert.NoError(t, err) assert.Equal(t, 1, len(commitments)) }) t.Run("Submit_existing", func(t *testing.T) { - blobs, proofs, err := m.Submit(ctx, []Blob{[]byte{0x00, 0x01, 0x02}}, -1) + blobs, err := m.Submit(ctx, []Blob{[]byte{0x00, 0x01, 0x02}}, -1, ns) assert.NoError(t, err) assert.Equal(t, 1, len(blobs)) - assert.Equal(t, 1, len(proofs)) }) t.Run("Submit_existing_with_gasprice_global", func(t *testing.T) { m.CelestiaDA.gasPrice = 0.01 - blobs, proofs, err := m.Submit(ctx, []Blob{[]byte{0x00, 0x01, 0x02}}, -1) + blobs, err := m.Submit(ctx, []Blob{[]byte{0x00, 0x01, 0x02}}, -1, ns) assert.NoError(t, err) assert.Equal(t, 1, len(blobs)) - assert.Equal(t, 1, len(proofs)) }) t.Run("Submit_existing_with_gasprice_override", func(t *testing.T) { - blobs, proofs, err := m.Submit(ctx, []Blob{[]byte{0x00, 0x01, 0x02}}, 0.5) + blobs, err := m.Submit(ctx, []Blob{[]byte{0x00, 0x01, 0x02}}, 0.5, ns) assert.NoError(t, err) assert.Equal(t, 1, len(blobs)) - assert.Equal(t, 1, len(proofs)) }) t.Run("Validate_existing", func(t *testing.T) { @@ -145,9 +148,9 @@ func TestCelestiaDA(t *testing.T) { proof := nmt.NewInclusionProof(0, 4, [][]byte{[]byte("test")}, true) proofJSON, err := proof.MarshalJSON() assert.NoError(t, err) - ids := []ID{makeID(42, commitment)} + ids := []ID{MakeID(42, commitment)} proofs := []Proof{proofJSON} - valids, err := m.Validate(ctx, ids, proofs) + valids, err := m.Validate(ctx, ids, proofs, ns) assert.NoError(t, err) assert.Equal(t, 1, len(valids)) }) diff --git a/celestia/mock.go b/celestia/mock.go index 81ef106..7da8c21 100644 --- a/celestia/mock.go +++ b/celestia/mock.go @@ -17,7 +17,7 @@ type MockBlobAPI struct { } // Submit mocks the blob.Submit method -func (m *MockBlobAPI) Submit(ctx context.Context, blobs []*blob.Blob, options *blob.SubmitOptions) (uint64, error) { +func (m *MockBlobAPI) Submit(ctx context.Context, blobs []*blob.Blob, gasPrice float64) (uint64, error) { m.height += 1 return m.height, nil } diff --git a/cmd/celestia-da/cmd.go b/cmd/celestia-da/cmd.go index d290f21..399438c 100644 --- a/cmd/celestia-da/cmd.go +++ b/cmd/celestia-da/cmd.go @@ -21,7 +21,7 @@ func WithDataAvailabilityService(flags []*pflag.FlagSet) func(*cobra.Command) { grpcFlags := &pflag.FlagSet{} grpcFlags.String(grpcAddrFlag, "http://127.0.0.1:26658", "celestia-node RPC endpoint address") grpcFlags.String(grpcTokenFlag, "", "celestia-node RPC auth token") - grpcFlags.String(grpcNamespaceFlag, "", "celestia namespace to use (hex encoded)") + grpcFlags.String(grpcNamespaceFlag, "", "celestia namespace to use (hex encoded) [Deprecated]") grpcFlags.String(grpcListenFlag, "127.0.0.1:0", "gRPC service listen address") grpcFlags.String(grpcNetworkFlag, "tcp", "gRPC service listen network type must be \"tcp\", \"tcp4\", \"tcp6\", \"unix\" or \"unixpacket\"") grpcFlags.Float64(grpcGasPriceFlag, -1, "gas price for estimating fee (utia/gas) default: -1 for default fees") diff --git a/go.mod b/go.mod index 56acedc..e641078 100644 --- a/go.mod +++ b/go.mod @@ -6,15 +6,14 @@ replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alp require ( github.com/celestiaorg/celestia-app v1.6.0 - github.com/celestiaorg/celestia-node v0.12.4 + github.com/celestiaorg/celestia-node v0.13.0 github.com/celestiaorg/nmt v0.20.0 - github.com/cosmos/cosmos-sdk v0.46.14 github.com/cristalhq/jwt v1.2.0 github.com/filecoin-project/go-jsonrpc v0.3.1 github.com/ipfs/go-log/v2 v2.5.1 github.com/mitchellh/go-homedir v1.1.0 github.com/ory/dockertest/v3 v3.10.0 - github.com/rollkit/go-da v0.2.0 + github.com/rollkit/go-da v0.4.0 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 @@ -22,12 +21,12 @@ require ( ) require ( - cloud.google.com/go v0.110.8 // indirect - cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go v0.110.10 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.2 // indirect + cloud.google.com/go/iam v1.1.5 // indirect cloud.google.com/go/storage v1.30.1 // indirect - cosmossdk.io/errors v1.0.0 // indirect + cosmossdk.io/errors v1.0.1 // indirect cosmossdk.io/math v1.2.0 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -48,9 +47,8 @@ require ( github.com/bgentry/speakeasy v0.1.0 // indirect github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/celestiaorg/go-ds-badger4 v0.0.0-20230712104058-7ede1c814ac5 // indirect github.com/celestiaorg/go-fraud v0.2.0 // indirect - github.com/celestiaorg/go-header v0.5.2 // indirect + github.com/celestiaorg/go-header v0.5.3 // indirect github.com/celestiaorg/go-libp2p-messenger v0.2.0 // indirect github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect github.com/celestiaorg/quantum-gravity-bridge/v2 v2.1.2 // indirect @@ -70,6 +68,7 @@ require ( github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/cosmos-proto v1.0.0-alpha8 // indirect + github.com/cosmos/cosmos-sdk v0.46.14 // indirect github.com/cosmos/cosmos-sdk/api v0.1.0 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogoproto v1.4.11 // indirect @@ -88,7 +87,7 @@ require ( github.com/deepmap/oapi-codegen v1.8.2 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581 // indirect + github.com/dgraph-io/badger/v4 v4.2.1-0.20240106094458-1c417aa3799c // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect github.com/docker/cli v20.10.17+incompatible // indirect @@ -129,10 +128,10 @@ require ( github.com/google/gopacket v1.1.19 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect - github.com/google/s2a-go v0.1.4 // indirect + github.com/google/s2a-go v0.1.7 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.5.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f // indirect github.com/gorilla/handlers v1.5.1 // indirect @@ -170,6 +169,7 @@ require ( github.com/ipfs/go-blockservice v0.5.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect + github.com/ipfs/go-ds-badger4 v0.1.5 // indirect github.com/ipfs/go-ipfs-blockstore v1.3.1 // indirect github.com/ipfs/go-ipfs-delay v0.0.1 // indirect github.com/ipfs/go-ipfs-ds-help v1.1.1 // indirect @@ -234,7 +234,7 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect - github.com/multiformats/go-multiaddr v0.12.1 // indirect + github.com/multiformats/go-multiaddr v0.12.2 // indirect github.com/multiformats/go-multiaddr-dns v0.3.1 // indirect github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect @@ -301,15 +301,15 @@ require ( go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/runtime v0.45.0 // indirect - go.opentelemetry.io/otel v1.21.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/sdk v1.21.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/sdk v1.22.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/dig v1.17.1 // indirect @@ -329,11 +329,11 @@ require ( golang.org/x/tools v0.16.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect gonum.org/v1/gonum v0.13.0 // indirect - google.golang.org/api v0.128.0 // indirect + google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c // indirect + google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect google.golang.org/protobuf v1.32.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 83ff579..2b5fc6a 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= -cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= +cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= +cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= @@ -75,8 +75,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -116,8 +116,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= -cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -193,8 +193,8 @@ cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuW cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04= -cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= +cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= +cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/math v1.2.0 h1:8gudhTkkD3NxOP2YyyJIYYmt6dQ55ZfJkDOaxXpy7Ig= cosmossdk.io/math v1.2.0/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= @@ -352,18 +352,16 @@ github.com/celestiaorg/celestia-app v1.6.0 h1:B5hFoeLHqMsC8rHmtqEcbXhP9SdLetSb+c github.com/celestiaorg/celestia-app v1.6.0/go.mod h1:zhdQIFGFZRRxrDVtFE4OFIT7/12RE8DRyfvNZdW8ceM= github.com/celestiaorg/celestia-core v1.29.0-tm-v0.34.29 h1:Fd7ymPUzExPGNl2gZw4i5S74arMw+iDHLE78M/cCxl4= github.com/celestiaorg/celestia-core v1.29.0-tm-v0.34.29/go.mod h1:xrICN0PBhp3AdTaZ8q4wS5Jvi32V02HNjaC2EsWiEKk= -github.com/celestiaorg/celestia-node v0.12.4 h1:iNfIzdLcKqVv0HuuDtro9wsSGLyqS+EAZ+9wbQVTxvs= -github.com/celestiaorg/celestia-node v0.12.4/go.mod h1:oxcUuO0S9IUbaaT2PbBAPkQdFwj19LwtvDfKFBKN/AI= +github.com/celestiaorg/celestia-node v0.13.0 h1:Bd/1pgsacMlpLZWNa5Zg5H/jBK8/1m/mOekEI+11LaA= +github.com/celestiaorg/celestia-node v0.13.0/go.mod h1:EmTh+B1s556yyi8JIFPcuOnti9s12mZwyIkEoN87VQU= github.com/celestiaorg/cosmos-sdk v1.18.1-sdk-v0.46.14 h1:c4cMVLU2bGTesZW1ZVgeoCB++gOOJTF3OvBsqBvo6n0= github.com/celestiaorg/cosmos-sdk v1.18.1-sdk-v0.46.14/go.mod h1:D5y5Exw0bJkcDv9fvYDiZfZrDV1b6+xsFyiungxrCsU= github.com/celestiaorg/dagstore v0.0.0-20230824094345-537c012aa403 h1:Lj73O3S+KJx5/hgZ+IeOLEIoLsAveJN/7/ZtQQtPSVw= github.com/celestiaorg/dagstore v0.0.0-20230824094345-537c012aa403/go.mod h1:cCGM1UoMvyTk8k62mkc+ReVu8iHBCtSBAAL4wYU7KEI= -github.com/celestiaorg/go-ds-badger4 v0.0.0-20230712104058-7ede1c814ac5 h1:MJgXvhJP1Au8rXTvMMlBXodu9jplEK1DxiLtMnEphOs= -github.com/celestiaorg/go-ds-badger4 v0.0.0-20230712104058-7ede1c814ac5/go.mod h1:r6xB3nvGotmlTACpAr3SunxtoXeesbqb57elgMJqflY= github.com/celestiaorg/go-fraud v0.2.0 h1:aaq2JiW0gTnhEdac3l51UCqSyJ4+VjFGTTpN83V4q7I= github.com/celestiaorg/go-fraud v0.2.0/go.mod h1:lNY1i4K6kUeeE60Z2VK8WXd+qXb8KRzfBhvwPkK6aUc= -github.com/celestiaorg/go-header v0.5.2 h1:CFsTAXcs1o38JVd8YN1Naq/Yzs6m9orMPEPNpLEgFJA= -github.com/celestiaorg/go-header v0.5.2/go.mod h1:7BVR6myjRfACbqW1de6s8OjuK66XzHm8MpFNYr0G+nU= +github.com/celestiaorg/go-header v0.5.3 h1:8CcflT6aIlcQXKNWcMekoBNs3EU50mEmDp17gbn1pP4= +github.com/celestiaorg/go-header v0.5.3/go.mod h1:7BVR6myjRfACbqW1de6s8OjuK66XzHm8MpFNYr0G+nU= github.com/celestiaorg/go-libp2p-messenger v0.2.0 h1:/0MuPDcFamQMbw9xTZ73yImqgTO3jHV7wKHvWD/Irao= github.com/celestiaorg/go-libp2p-messenger v0.2.0/go.mod h1:s9PIhMi7ApOauIsfBcQwbr7m+HBzmVfDIS+QLdgzDSo= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= @@ -545,8 +543,8 @@ github.com/dgraph-io/badger v1.6.2 h1:mNw0qs90GVgGGWylh0umH5iag1j6n/PeJtNvL6KY/x github.com/dgraph-io/badger v1.6.2/go.mod h1:JW2yswe3V058sS0kZ2h/AXeDSqFjxnZcRrVH//y2UQE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= -github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581 h1:yy45brf1ktmnkTCZlHynP1gRlVwZ9g19oz5D9wG81v4= -github.com/dgraph-io/badger/v4 v4.2.1-0.20231013074411-fb1b00959581/go.mod h1:T/uWAYxrXdaXw64ihI++9RMbKTCpKd/yE9+saARew7k= +github.com/dgraph-io/badger/v4 v4.2.1-0.20240106094458-1c417aa3799c h1:Z9rm0wkQBM+VF7vpyrbKnCcSbww0PKygLoptTpkX3d4= +github.com/dgraph-io/badger/v4 v4.2.1-0.20240106094458-1c417aa3799c/go.mod h1:T/uWAYxrXdaXw64ihI++9RMbKTCpKd/yE9+saARew7k= github.com/dgraph-io/ristretto v0.0.2/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= @@ -851,8 +849,8 @@ github.com/google/pprof v0.0.0-20221203041831-ce31453925ec/go.mod h1:dDKJzRmX4S3 github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b h1:RMpPgZTSApbPf7xaVel+QkoGPRLFLrwFO89uDUHEGf0= github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= +github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= @@ -866,8 +864,8 @@ github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= -github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= @@ -1087,6 +1085,8 @@ github.com/ipfs/go-ds-badger v0.2.1/go.mod h1:Tx7l3aTph3FMFrRS838dcSJh+jjA7cX9Dr github.com/ipfs/go-ds-badger v0.2.3/go.mod h1:pEYw0rgg3FIrywKKnL+Snr+w/LjJZVMTBRn4FS6UHUk= github.com/ipfs/go-ds-badger v0.3.0 h1:xREL3V0EH9S219kFFueOYJJTcjgNSZ2HY1iSvN7U1Ro= github.com/ipfs/go-ds-badger v0.3.0/go.mod h1:1ke6mXNqeV8K3y5Ak2bAA0osoTfmxUdupVCGm4QUIek= +github.com/ipfs/go-ds-badger4 v0.1.5 h1:MwrTsIUJIqH/ChuDdUOzxwxMxHx/Li1ECoSCKsCUxiA= +github.com/ipfs/go-ds-badger4 v0.1.5/go.mod h1:LUU2FbhNdmhAbJmMeoahVRbe4GsduAODSJHWJJh2Vo4= github.com/ipfs/go-ds-leveldb v0.0.1/go.mod h1:feO8V3kubwsEF22n0YRQCffeb79OOYIykR4L04tMOYc= github.com/ipfs/go-ds-leveldb v0.1.0/go.mod h1:hqAW8y4bwX5LWcCtku2rFNX3vjDZCy5LZCg+cSZvYb8= github.com/ipfs/go-ds-leveldb v0.4.1/go.mod h1:jpbku/YqBSsBc1qgME8BkWS4AxzF2cEu1Ii2r79Hh9s= @@ -1815,8 +1815,8 @@ github.com/multiformats/go-multiaddr v0.5.0/go.mod h1:3KAxNkUqLTJ20AAwN4XVX4kZar github.com/multiformats/go-multiaddr v0.6.0/go.mod h1:F4IpaKZuPP360tOMn2Tpyu0At8w23aRyVqeK0DbFeGM= github.com/multiformats/go-multiaddr v0.7.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs= github.com/multiformats/go-multiaddr v0.8.0/go.mod h1:Fs50eBDWvZu+l3/9S6xAE7ZYj6yhxlvaVZjakWN7xRs= -github.com/multiformats/go-multiaddr v0.12.1 h1:vm+BA/WZA8QZDp1pF1FWhi5CT3g1tbi5GJmqpb6wnlk= -github.com/multiformats/go-multiaddr v0.12.1/go.mod h1:7mPkiBMmLeFipt+nNSq9pHZUeJSt8lHBgH6yhj0YQzE= +github.com/multiformats/go-multiaddr v0.12.2 h1:9G9sTY/wCYajKa9lyfWPmpZAwe6oV+Wb1zcmMS1HG24= +github.com/multiformats/go-multiaddr v0.12.2/go.mod h1:GKyaTYjZRdcUhyOetrxTk9z0cW+jA/YrnqTOvKgi44M= github.com/multiformats/go-multiaddr-dns v0.0.1/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.0.2/go.mod h1:9kWcqw/Pj6FwxAwW38n/9403szc57zJPs45fmnznu3Q= github.com/multiformats/go-multiaddr-dns v0.2.0/go.mod h1:TJ5pr5bBO7Y1B18djPuRsVkduhQH2YqYSbxWJzYGdK0= @@ -2104,8 +2104,8 @@ github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTE github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/rollkit/go-da v0.2.0 h1:rNpWBa2inczgZ955ky3wy8FbrMajzVbm0UfbBGzm5UE= -github.com/rollkit/go-da v0.2.0/go.mod h1:Kef0XI5ecEKd3TXzI8S+9knAUJnZg0svh2DuXoCsPlM= +github.com/rollkit/go-da v0.4.0 h1:/s7ZrVq7DC2aK8UXIvB7rsXrZ2mVGRw7zrexcxRvhlw= +github.com/rollkit/go-da v0.4.0/go.mod h1:Kef0XI5ecEKd3TXzI8S+9knAUJnZg0svh2DuXoCsPlM= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE= github.com/rs/cors v1.9.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= @@ -2380,32 +2380,32 @@ go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzox go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk= go.opentelemetry.io/otel v1.13.0/go.mod h1:FH3RtdZCzRkJYFTCsAKDy9l/XYjMdNv6QrkFFB8DvVg= go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= -go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= -go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0 h1:bflGWrfYyuulcdxf14V6n9+CoQcu5SAAdHmDPAJnlps= -go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.44.0/go.mod h1:qcTO4xHAxZLaLxPd60TdE88rxtItPHgHWqOhOGRr0as= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 h1:cl5P5/GIfFh4t6xyruOgJP5QiA1pw4fYYdv6nc6CBWw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0/go.mod h1:zgBdWWAu7oEEMC06MMKc5NLbA/1YDXV1sMpSqEeLQLg= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 h1:digkEZCJWobwBqMwC0cwCq8/wkkRy/OowZg5OArWZrM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0/go.mod h1:/OpE/y70qVkndM0TrxT4KBoN3RsFZP0QaofcfYrj76I= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0 h1:+RbSCde0ERway5FwKvXR3aRJIFeDu9rtwC6E7BC6uoM= +go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v0.45.0/go.mod h1:zcI8u2EJxbLPyoZ3SkVAAcQPgYb1TDRzW93xLFnsggU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 h1:9M3+rhx7kZCIQQhQRYaZCdNu1V73tm4TvXs2ntl98C4= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0/go.mod h1:noq80iT8rrHP1SfybmPiRGc9dc5M8RPmGvtwo7Oo7tc= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 h1:FyjCyI9jVEfqhUh2MoSkmolPjfh5fp2hnV0b0irxH4Q= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0/go.mod h1:hYwym2nDEeZfG/motx0p7L7J1N1vyzIThemQsb4g2qY= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1 h1:2PunuO5SbkN5MhCbuHCd3tC6qrcaj+uDAkX/qBU5BAs= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.15.1/go.mod h1:q8+Tha+5LThjeSU8BW93uUC5w5/+DnYHMKBMpRCsui0= go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU= go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= -go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw= go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc= -go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= -go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/sdk/metric v1.21.0 h1:smhI5oD714d6jHE6Tie36fPx4WDFIg+Y6RfAY4ICcR0= -go.opentelemetry.io/otel/sdk/metric v1.21.0/go.mod h1:FJ8RAsoPGv/wYMgBdUJXOm+6pzFY3YdljnXtv1SBE8Q= +go.opentelemetry.io/otel/sdk v1.22.0 h1:6coWHw9xw7EfClIC/+O31R8IY3/+EiRFHevmHafB2Gw= +go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= +go.opentelemetry.io/otel/sdk/metric v1.22.0 h1:ARrRetm1HCVxq0cbnaZQlfwODYJHo3gFL8Z3tSmHBcI= +go.opentelemetry.io/otel/sdk/metric v1.22.0/go.mod h1:KjQGeMIDlBNEOo6HvjhxIec1p/69/kULDcp4gr0oLQQ= go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw= go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU= go.opentelemetry.io/otel/trace v1.13.0/go.mod h1:muCvmmO9KKpvuXSf3KKAXXB2ygNYHQ+ZfI5X08d3tds= go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= -go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= -go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= @@ -2495,7 +2495,6 @@ golang.org/x/crypto v0.0.0-20210506145944-38f3c27a63bf/go.mod h1:P+XmwS30IXTQdn5 golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -3039,8 +3038,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.128.0 h1:RjPESny5CnQRn9V6siglged+DZCgfu9l6mO9dkX9VOg= -google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= +google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= +google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -3165,12 +3164,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c h1:jHkCUWkseRf+W+edG5hMzr/Uh1xkDREY4caybAq4dpY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231009173412-8bfb1ae86b6c/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= +google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3 h1:1hfbdAfFbkmpg41000wDVqr7jUpK/Yo+LPnIxxGzmkg= +google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3/go.mod h1:5RBcpGRxr25RbDzY5w+dmaqpSEvl8Gwl1x2CICf60ic= +google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f h1:2yNACc1O40tTnrsbk9Cv6oxiW8pxI/pXj0wRtdlYmgY= +google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f/go.mod h1:Uy9bTZJqmfrw2rIBxgGLnamc78euZULUBrLZ9XTITKI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 h1:/jFB8jK5R3Sq3i/lmeZO0cATSzFfZaJq1J2Euan3XKU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA= google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= From 214d131ca9ba1bb393acee0d343437053d9d82a4 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Mon, 12 Feb 2024 11:30:20 -0800 Subject: [PATCH 2/6] nit: doc --- celestia/celestia.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/celestia/celestia.go b/celestia/celestia.go index cc2a736..294bf71 100644 --- a/celestia/celestia.go +++ b/celestia/celestia.go @@ -112,6 +112,7 @@ func (c *CelestiaDA) Submit(ctx context.Context, daBlobs []da.Blob, gasPrice flo return ids, nil } +// GetProofs returns the inclusion proofs for the given IDs. func (c *CelestiaDA) GetProofs(ctx context.Context, daIDs []da.ID, ns da.Namespace) ([]da.Proof, error) { if ns == nil { ns = c.namespace @@ -182,6 +183,7 @@ func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Pr // This is 8 as uint64 consist of 8 bytes. const heightLen = 8 +// MakeID returns the ID from the height and commitment. func MakeID(height uint64, commitment da.Commitment) da.ID { id := make([]byte, heightLen+len(commitment)) binary.LittleEndian.PutUint64(id, height) @@ -189,6 +191,7 @@ func MakeID(height uint64, commitment da.Commitment) da.ID { return id } +// SplitID returns the height and commitment from the ID. func SplitID(id da.ID) (uint64, da.Commitment) { if len(id) <= heightLen { return 0, nil From 8c4a8c912366debb39461d1413aebffff022815f Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Mon, 12 Feb 2024 12:03:40 -0800 Subject: [PATCH 3/6] nit: unexport makeid, splitid --- celestia/celestia.go | 14 +++++++------- celestia/celestia_test.go | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/celestia/celestia.go b/celestia/celestia.go index 294bf71..13b26d4 100644 --- a/celestia/celestia.go +++ b/celestia/celestia.go @@ -56,7 +56,7 @@ func (c *CelestiaDA) Get(ctx context.Context, ids []da.ID, ns da.Namespace) ([]d } var blobs []da.Blob for _, id := range ids { - height, commitment := SplitID(id) + height, commitment := splitID(id) blob, err := c.client.Blob.Get(ctx, height, ns, commitment) if err != nil { return nil, err @@ -77,7 +77,7 @@ func (c *CelestiaDA) GetIDs(ctx context.Context, height uint64, ns da.Namespace) return nil, err } for _, b := range blobs { - ids = append(ids, MakeID(height, b.Commitment)) + ids = append(ids, makeID(height, b.Commitment)) } return ids, nil } @@ -107,7 +107,7 @@ func (c *CelestiaDA) Submit(ctx context.Context, daBlobs []da.Blob, gasPrice flo log.Println("successfully submitted blobs", "height", height, "gasPrice", gasPrice) ids := make([]da.ID, len(blobs)) for i, blob := range blobs { - ids[i] = MakeID(height, blob.Commitment) + ids[i] = makeID(height, blob.Commitment) } return ids, nil } @@ -119,7 +119,7 @@ func (c *CelestiaDA) GetProofs(ctx context.Context, daIDs []da.ID, ns da.Namespa } proofs := make([]da.Proof, len(daIDs)) for i, id := range daIDs { - height, commitment := SplitID(id) + height, commitment := splitID(id) proof, err := c.client.Blob.GetProof(ctx, height, ns, commitment) if err != nil { return nil, err @@ -168,7 +168,7 @@ func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Pr proofs = append(proofs, proof) } for i, id := range ids { - height, commitment := SplitID(id) + height, commitment := splitID(id) // TODO(tzdybal): for some reason, if proof doesn't match commitment, API returns (false, "blob: invalid proof") // but analysis of the code in celestia-node implies this should never happen - maybe it's caused by openrpc? // there is no way of gently handling errors here, but returned value is fine for us @@ -184,7 +184,7 @@ func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Pr const heightLen = 8 // MakeID returns the ID from the height and commitment. -func MakeID(height uint64, commitment da.Commitment) da.ID { +func makeID(height uint64, commitment da.Commitment) da.ID { id := make([]byte, heightLen+len(commitment)) binary.LittleEndian.PutUint64(id, height) copy(id[heightLen:], commitment) @@ -192,7 +192,7 @@ func MakeID(height uint64, commitment da.Commitment) da.ID { } // SplitID returns the height and commitment from the ID. -func SplitID(id da.ID) (uint64, da.Commitment) { +func splitID(id da.ID) (uint64, da.Commitment) { if len(id) <= heightLen { return 0, nil } diff --git a/celestia/celestia_test.go b/celestia/celestia_test.go index a376f64..fe6e32b 100644 --- a/celestia/celestia_test.go +++ b/celestia/celestia_test.go @@ -100,7 +100,7 @@ func TestCelestiaDA(t *testing.T) { t.Run("Get_existing", func(t *testing.T) { commitment, err := hex.DecodeString("1b454951cd722b2cf7be5b04554b76ccf48f65a7ad6af45055006994ce70fd9d") assert.NoError(t, err) - blobs, err := m.Get(ctx, []ID{MakeID(42, commitment)}, ns) + blobs, err := m.Get(ctx, []ID{makeID(42, commitment)}, ns) assert.NoError(t, err) assert.Equal(t, 1, len(blobs)) blob1 := blobs[0] @@ -114,7 +114,7 @@ func TestCelestiaDA(t *testing.T) { id1 := ids[0] commitment, err := hex.DecodeString("1b454951cd722b2cf7be5b04554b76ccf48f65a7ad6af45055006994ce70fd9d") assert.NoError(t, err) - assert.Equal(t, MakeID(42, commitment), id1) + assert.Equal(t, makeID(42, commitment), id1) }) t.Run("Commit_existing", func(t *testing.T) { @@ -148,7 +148,7 @@ func TestCelestiaDA(t *testing.T) { proof := nmt.NewInclusionProof(0, 4, [][]byte{[]byte("test")}, true) proofJSON, err := proof.MarshalJSON() assert.NoError(t, err) - ids := []ID{MakeID(42, commitment)} + ids := []ID{makeID(42, commitment)} proofs := []Proof{proofJSON} valids, err := m.Validate(ctx, ids, proofs, ns) assert.NoError(t, err) From 6533c4e8ba77090f182e16557846d54f4a791b77 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Mon, 12 Feb 2024 12:20:45 -0800 Subject: [PATCH 4/6] nit: inline; GetIDs ns --- celestia/celestia.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/celestia/celestia.go b/celestia/celestia.go index 13b26d4..973946f 100644 --- a/celestia/celestia.go +++ b/celestia/celestia.go @@ -68,6 +68,9 @@ func (c *CelestiaDA) Get(ctx context.Context, ids []da.ID, ns da.Namespace) ([]d // GetIDs returns IDs of all Blobs located in DA at given height. func (c *CelestiaDA) GetIDs(ctx context.Context, height uint64, ns da.Namespace) ([]da.ID, error) { + if ns == nil { + ns = c.namespace + } var ids []da.ID blobs, err := c.client.Blob.GetAll(ctx, height, []share.Namespace{ns}) if err != nil { @@ -196,8 +199,7 @@ func splitID(id da.ID) (uint64, da.Commitment) { if len(id) <= heightLen { return 0, nil } - commitment := id[heightLen:] - return binary.LittleEndian.Uint64(id[:heightLen]), commitment + return binary.LittleEndian.Uint64(id[:heightLen]), id[heightLen:] } var _ da.DA = &CelestiaDA{} From 49591b20b0b1090d278bb6014dcddba9dc4a743e Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Mon, 12 Feb 2024 12:36:47 -0800 Subject: [PATCH 5/6] nit: doc fix --- celestia/celestia.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/celestia/celestia.go b/celestia/celestia.go index 973946f..77b647b 100644 --- a/celestia/celestia.go +++ b/celestia/celestia.go @@ -186,7 +186,6 @@ func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Pr // This is 8 as uint64 consist of 8 bytes. const heightLen = 8 -// MakeID returns the ID from the height and commitment. func makeID(height uint64, commitment da.Commitment) da.ID { id := make([]byte, heightLen+len(commitment)) binary.LittleEndian.PutUint64(id, height) @@ -194,7 +193,6 @@ func makeID(height uint64, commitment da.Commitment) da.ID { return id } -// SplitID returns the height and commitment from the ID. func splitID(id da.ID) (uint64, da.Commitment) { if len(id) <= heightLen { return 0, nil From a648be688e0ac6cff12125eaacdc7e1761fea560 Mon Sep 17 00:00:00 2001 From: Javed Khan Date: Mon, 12 Feb 2024 13:04:48 -0800 Subject: [PATCH 6/6] nit: default namespace --- celestia/celestia.go | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/celestia/celestia.go b/celestia/celestia.go index 77b647b..604bd04 100644 --- a/celestia/celestia.go +++ b/celestia/celestia.go @@ -43,6 +43,13 @@ func NewCelestiaDA(client *rpc.Client, namespace share.Namespace, gasPrice float } } +func (c *CelestiaDA) defaultNamespace(ns da.Namespace) da.Namespace { + if ns == nil { + return c.namespace + } + return ns +} + // MaxBlobSize returns the max blob size func (c *CelestiaDA) MaxBlobSize(ctx context.Context) (uint64, error) { // TODO: pass-through query to node, app @@ -51,13 +58,11 @@ func (c *CelestiaDA) MaxBlobSize(ctx context.Context) (uint64, error) { // Get returns Blob for each given ID, or an error. func (c *CelestiaDA) Get(ctx context.Context, ids []da.ID, ns da.Namespace) ([]da.Blob, error) { - if ns == nil { - ns = c.namespace - } + c.namespace = c.defaultNamespace(ns) var blobs []da.Blob for _, id := range ids { height, commitment := splitID(id) - blob, err := c.client.Blob.Get(ctx, height, ns, commitment) + blob, err := c.client.Blob.Get(ctx, height, c.namespace, commitment) if err != nil { return nil, err } @@ -68,11 +73,9 @@ func (c *CelestiaDA) Get(ctx context.Context, ids []da.ID, ns da.Namespace) ([]d // GetIDs returns IDs of all Blobs located in DA at given height. func (c *CelestiaDA) GetIDs(ctx context.Context, height uint64, ns da.Namespace) ([]da.ID, error) { - if ns == nil { - ns = c.namespace - } + c.namespace = c.defaultNamespace(ns) var ids []da.ID - blobs, err := c.client.Blob.GetAll(ctx, height, []share.Namespace{ns}) + blobs, err := c.client.Blob.GetAll(ctx, height, []share.Namespace{c.namespace}) if err != nil { if strings.Contains(err.Error(), blob.ErrBlobNotFound.Error()) { return nil, nil @@ -87,19 +90,15 @@ func (c *CelestiaDA) GetIDs(ctx context.Context, height uint64, ns da.Namespace) // Commit creates a Commitment for each given Blob. func (c *CelestiaDA) Commit(ctx context.Context, daBlobs []da.Blob, ns da.Namespace) ([]da.Commitment, error) { - if ns == nil { - ns = c.namespace - } - _, commitments, err := c.blobsAndCommitments(daBlobs, ns) + c.namespace = c.defaultNamespace(ns) + _, commitments, err := c.blobsAndCommitments(daBlobs, c.namespace) return commitments, err } // Submit submits the Blobs to Data Availability layer. func (c *CelestiaDA) Submit(ctx context.Context, daBlobs []da.Blob, gasPrice float64, ns da.Namespace) ([]da.ID, error) { - if ns == nil { - ns = c.namespace - } - blobs, _, err := c.blobsAndCommitments(daBlobs, ns) + c.namespace = c.defaultNamespace(ns) + blobs, _, err := c.blobsAndCommitments(daBlobs, c.namespace) if err != nil { return nil, err } @@ -117,13 +116,11 @@ func (c *CelestiaDA) Submit(ctx context.Context, daBlobs []da.Blob, gasPrice flo // GetProofs returns the inclusion proofs for the given IDs. func (c *CelestiaDA) GetProofs(ctx context.Context, daIDs []da.ID, ns da.Namespace) ([]da.Proof, error) { - if ns == nil { - ns = c.namespace - } + c.namespace = c.defaultNamespace(ns) proofs := make([]da.Proof, len(daIDs)) for i, id := range daIDs { height, commitment := splitID(id) - proof, err := c.client.Blob.GetProof(ctx, height, ns, commitment) + proof, err := c.client.Blob.GetProof(ctx, height, c.namespace, commitment) if err != nil { return nil, err } @@ -157,9 +154,7 @@ func (c *CelestiaDA) blobsAndCommitments(daBlobs []da.Blob, ns da.Namespace) ([] // Validate validates Commitments against the corresponding Proofs. This should be possible without retrieving the Blobs. func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Proof, ns da.Namespace) ([]bool, error) { - if ns == nil { - ns = c.namespace - } + c.namespace = c.defaultNamespace(ns) var included []bool var proofs []*blob.Proof for _, daProof := range daProofs { @@ -175,7 +170,7 @@ func (c *CelestiaDA) Validate(ctx context.Context, ids []da.ID, daProofs []da.Pr // TODO(tzdybal): for some reason, if proof doesn't match commitment, API returns (false, "blob: invalid proof") // but analysis of the code in celestia-node implies this should never happen - maybe it's caused by openrpc? // there is no way of gently handling errors here, but returned value is fine for us - isIncluded, _ := c.client.Blob.Included(ctx, height, ns, proofs[i], commitment) + isIncluded, _ := c.client.Blob.Included(ctx, height, c.namespace, proofs[i], commitment) included = append(included, isIncluded) } return included, nil