Skip to content

Commit f019e10

Browse files
vgonkivsrenaynay
andauthored
chore(go.mod) bump go-square (#3958)
Co-authored-by: rene <[email protected]>
1 parent eff19e8 commit f019e10

File tree

4 files changed

+63
-3
lines changed

4 files changed

+63
-3
lines changed

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/celestiaorg/go-header v0.6.3
1313
github.com/celestiaorg/go-libp2p-messenger v0.2.0
1414
github.com/celestiaorg/go-square/merkle v0.0.0-20240117232118-fd78256df076
15-
github.com/celestiaorg/go-square/v2 v2.1.0-rc0
15+
github.com/celestiaorg/go-square/v2 v2.1.0
1616
github.com/celestiaorg/nmt v0.22.2
1717
github.com/celestiaorg/rsmt2d v0.14.0
1818
github.com/cosmos/cosmos-sdk v0.46.16

Diff for: go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ github.com/celestiaorg/go-square v1.1.1 h1:Cy3p8WVspVcyOqHM8BWFuuYPwMitO1pYGe+Im
363363
github.com/celestiaorg/go-square v1.1.1/go.mod h1:1EXMErhDrWJM8B8V9hN7dqJ2kUTClfwdqMOmF9yQUa0=
364364
github.com/celestiaorg/go-square/merkle v0.0.0-20240117232118-fd78256df076 h1:PYInrsYzrDIsZW9Yb86OTi2aEKuPcpgJt6Mc0Jlc/yg=
365365
github.com/celestiaorg/go-square/merkle v0.0.0-20240117232118-fd78256df076/go.mod h1:hlidgivKyvv7m4Yl2Fdf2mSTmazZYxX8+bnr5IQrI98=
366-
github.com/celestiaorg/go-square/v2 v2.1.0-rc0 h1:Ra6bp+mVUXmUT1KYMiOCmW4tBK6EIknpP10uhPngOR8=
367-
github.com/celestiaorg/go-square/v2 v2.1.0-rc0/go.mod h1:n3ztrh8CBjWOD6iWYMo3pPOlQIgzLK9yrnqMPcNo6g8=
366+
github.com/celestiaorg/go-square/v2 v2.1.0 h1:ECIvYEeHIWiIJGDCJxQNtzqm5DmnBly7XGhSpLsl+Lw=
367+
github.com/celestiaorg/go-square/v2 v2.1.0/go.mod h1:n3ztrh8CBjWOD6iWYMo3pPOlQIgzLK9yrnqMPcNo6g8=
368368
github.com/celestiaorg/merkletree v0.0.0-20230308153949-c33506a7aa26 h1:P2RI1xJ49EZ8cuHMcH+ZSBonfRDtBS8OS9Jdt1BWX3k=
369369
github.com/celestiaorg/merkletree v0.0.0-20230308153949-c33506a7aa26/go.mod h1:2m8ukndOegwB0PU0AfJCwDUQHqd7QQRlSXvQL5VToVY=
370370
github.com/celestiaorg/nmt v0.22.2 h1:JmOMtZL9zWAed1hiwb9DDs+ELcKp/ZQZ3rPverge/V8=

Diff for: nodebuilder/tests/api_test.go

+46
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
package tests
44

55
import (
6+
"bytes"
67
"context"
8+
"fmt"
9+
"net/http"
10+
"os"
711
"testing"
812
"time"
913

@@ -15,6 +19,7 @@ import (
1519
libshare "github.com/celestiaorg/go-square/v2/share"
1620

1721
"github.com/celestiaorg/celestia-node/api/rpc/client"
22+
"github.com/celestiaorg/celestia-node/api/rpc/perms"
1823
"github.com/celestiaorg/celestia-node/blob"
1924
"github.com/celestiaorg/celestia-node/nodebuilder"
2025
"github.com/celestiaorg/celestia-node/nodebuilder/node"
@@ -122,6 +127,15 @@ func TestBlobRPC(t *testing.T) {
122127
height, err := rpcClient.Blob.Submit(ctx, []*blob.Blob{newBlob}, state.NewTxConfig())
123128
require.NoError(t, err)
124129
require.True(t, height != 0)
130+
131+
txResp, err := rpcClient.State.SubmitPayForBlob(ctx, libBlobs, state.NewTxConfig())
132+
require.NoError(t, err)
133+
require.NotNil(t, txResp)
134+
require.Equal(t, uint32(0), txResp.Code)
135+
136+
b, err := rpcClient.Blob.Get(ctx, uint64(txResp.Height), newBlob.Namespace(), newBlob.Commitment)
137+
require.NoError(t, err)
138+
require.NotNil(t, b)
125139
}
126140

127141
// TestHeaderSubscription ensures that the header subscription over RPC works
@@ -168,3 +182,35 @@ func TestHeaderSubscription(t *testing.T) {
168182
err = light.Stop(ctx)
169183
require.NoError(t, err)
170184
}
185+
186+
func TestSubmitBlobOverHTTP(t *testing.T) {
187+
ctx, cancel := context.WithTimeout(context.Background(), swamp.DefaultTestTimeout)
188+
t.Cleanup(cancel)
189+
190+
sw := swamp.NewSwamp(t, swamp.WithBlockTime(time.Second))
191+
// start a bridge node
192+
bridge := sw.NewBridgeNode()
193+
err := bridge.Start(ctx)
194+
require.NoError(t, err)
195+
196+
adminPerms := []auth.Permission{"public", "read", "write", "admin"}
197+
jwt, err := bridge.AdminServ.AuthNew(ctx, adminPerms)
198+
require.NoError(t, err)
199+
200+
payload, err := os.ReadFile("testdata/submitPFB.json")
201+
require.NoError(t, err)
202+
203+
bridgeAddr := "http://" + bridge.RPCServer.ListenAddr()
204+
req, err := http.NewRequest("POST", bridgeAddr, bytes.NewBuffer(payload))
205+
require.NoError(t, err)
206+
207+
req.Header = http.Header{
208+
perms.AuthKey: []string{fmt.Sprintf("Bearer %s", jwt)},
209+
}
210+
211+
httpClient := &http.Client{Timeout: time.Second * 5}
212+
resp, err := httpClient.Do(req)
213+
require.NoError(t, err)
214+
defer resp.Body.Close()
215+
require.Equal(t, http.StatusOK, resp.StatusCode)
216+
}

Diff for: nodebuilder/tests/testdata/submitPFB.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"jsonrpc": "2.0",
3+
"id": 1,
4+
"method": "state.SubmitPayForBlob",
5+
"params": [
6+
[{
7+
"namespace_id": "AAAAAAAAAAAAAAAAAAAAAAAAOUuI3+tg+3TyEw==",
8+
"data": "4PdKsZcCJsDR/BErNf8Q0al/DMHmV606NylMHKBjzutMuJrcQr11as52hPPv4P2X2zccCUUALfq0N4SITHVBNUa15j4y+t/+WkyIZ8IDe+ZHYVX9z0AQWQVW6AZ70BJHZYuhWQ1xJZp2BIeqh0xVYVhauB7DmgXR66dBBEfSuMewl9NKkNINNhAvIeW/NHLS41y4FWi0v2zH8HyA+IJjTO7okTgii1xz5yQ5wZ6UileWLuNldqH9/+77bf4M6J+n+Dtf6LL0QbwpEG1M6f2iZAJsSYCb680Q9xkrMyLFSdgYL3wPirloC64n1p5MuwYiY5o6skqJ1kGDWI4ASr+9NPIV0GdiW76FhsBuimqO3d+wKhvrPdheH/yPRx0Xq6ky9azT/Iq6KL5VW/978JvT7Mk7sVSU0vFoE8zL9ZyGRtW5yfADxY5tGWjDVKtknOv+STLGnLHeJAAPVjFebWuI7it3UvKhOPPXrdYBr6zF4uVyzNS9UsK87SjtkNLSXn4loIcsupnA9VSmqZxYI+AtFd2AspQ8hzOwQoPiLWVDyS9KJOtHCCRgFJmG5cZ9ZlXHOwQh8iHvBWNvOV25XJs2Cm4wYjEu5vCVrh04xB+U7Pmr+ANWwjth6w6qa0SkQf9ck2zPBElkv50Ajjx5jK+BOAES78E=",
9+
"share_version": 0,
10+
"namespace_version": 0
11+
}],
12+
{}
13+
]
14+
}

0 commit comments

Comments
 (0)