Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(go.mod) bump go-square #3958

Merged
merged 5 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/celestiaorg/go-header v0.6.3
github.com/celestiaorg/go-libp2p-messenger v0.2.0
github.com/celestiaorg/go-square/merkle v0.0.0-20240117232118-fd78256df076
github.com/celestiaorg/go-square/v2 v2.1.0-rc0
github.com/celestiaorg/go-square/v2 v2.1.0
github.com/celestiaorg/nmt v0.22.2
github.com/celestiaorg/rsmt2d v0.14.0
github.com/cosmos/cosmos-sdk v0.46.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ github.com/celestiaorg/go-square v1.1.1 h1:Cy3p8WVspVcyOqHM8BWFuuYPwMitO1pYGe+Im
github.com/celestiaorg/go-square v1.1.1/go.mod h1:1EXMErhDrWJM8B8V9hN7dqJ2kUTClfwdqMOmF9yQUa0=
github.com/celestiaorg/go-square/merkle v0.0.0-20240117232118-fd78256df076 h1:PYInrsYzrDIsZW9Yb86OTi2aEKuPcpgJt6Mc0Jlc/yg=
github.com/celestiaorg/go-square/merkle v0.0.0-20240117232118-fd78256df076/go.mod h1:hlidgivKyvv7m4Yl2Fdf2mSTmazZYxX8+bnr5IQrI98=
github.com/celestiaorg/go-square/v2 v2.1.0-rc0 h1:Ra6bp+mVUXmUT1KYMiOCmW4tBK6EIknpP10uhPngOR8=
github.com/celestiaorg/go-square/v2 v2.1.0-rc0/go.mod h1:n3ztrh8CBjWOD6iWYMo3pPOlQIgzLK9yrnqMPcNo6g8=
github.com/celestiaorg/go-square/v2 v2.1.0 h1:ECIvYEeHIWiIJGDCJxQNtzqm5DmnBly7XGhSpLsl+Lw=
github.com/celestiaorg/go-square/v2 v2.1.0/go.mod h1:n3ztrh8CBjWOD6iWYMo3pPOlQIgzLK9yrnqMPcNo6g8=
github.com/celestiaorg/merkletree v0.0.0-20230308153949-c33506a7aa26 h1:P2RI1xJ49EZ8cuHMcH+ZSBonfRDtBS8OS9Jdt1BWX3k=
github.com/celestiaorg/merkletree v0.0.0-20230308153949-c33506a7aa26/go.mod h1:2m8ukndOegwB0PU0AfJCwDUQHqd7QQRlSXvQL5VToVY=
github.com/celestiaorg/nmt v0.22.2 h1:JmOMtZL9zWAed1hiwb9DDs+ELcKp/ZQZ3rPverge/V8=
Expand Down
46 changes: 46 additions & 0 deletions nodebuilder/tests/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
package tests

import (
"bytes"
"context"
"fmt"
"net/http"
"os"
"testing"
"time"

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

"github.com/celestiaorg/celestia-node/api/rpc/client"
"github.com/celestiaorg/celestia-node/api/rpc/perms"
"github.com/celestiaorg/celestia-node/blob"
"github.com/celestiaorg/celestia-node/nodebuilder"
"github.com/celestiaorg/celestia-node/nodebuilder/node"
Expand Down Expand Up @@ -122,6 +127,15 @@ func TestBlobRPC(t *testing.T) {
height, err := rpcClient.Blob.Submit(ctx, []*blob.Blob{newBlob}, state.NewTxConfig())
require.NoError(t, err)
require.True(t, height != 0)

txResp, err := rpcClient.State.SubmitPayForBlob(ctx, libBlobs, state.NewTxConfig())
require.NoError(t, err)
require.NotNil(t, txResp)
require.Equal(t, uint32(0), txResp.Code)

b, err := rpcClient.Blob.Get(ctx, uint64(txResp.Height), newBlob.Namespace(), newBlob.Commitment)
require.NoError(t, err)
require.NotNil(t, b)
}

// TestHeaderSubscription ensures that the header subscription over RPC works
Expand Down Expand Up @@ -168,3 +182,35 @@ func TestHeaderSubscription(t *testing.T) {
err = light.Stop(ctx)
require.NoError(t, err)
}

func TestSubmitBlobOverHTTP(t *testing.T) {
renaynay marked this conversation as resolved.
Show resolved Hide resolved
ctx, cancel := context.WithTimeout(context.Background(), swamp.DefaultTestTimeout)
t.Cleanup(cancel)

sw := swamp.NewSwamp(t, swamp.WithBlockTime(time.Second))
// start a bridge node
bridge := sw.NewBridgeNode()
err := bridge.Start(ctx)
require.NoError(t, err)

adminPerms := []auth.Permission{"public", "read", "write", "admin"}
jwt, err := bridge.AdminServ.AuthNew(ctx, adminPerms)
require.NoError(t, err)

payload, err := os.ReadFile("testdata/submitPFB.json")
require.NoError(t, err)

bridgeAddr := "http://" + bridge.RPCServer.ListenAddr()
req, err := http.NewRequest("POST", bridgeAddr, bytes.NewBuffer(payload))
require.NoError(t, err)

req.Header = http.Header{
perms.AuthKey: []string{fmt.Sprintf("Bearer %s", jwt)},
}

httpClient := &http.Client{Timeout: time.Second * 5}
resp, err := httpClient.Do(req)
require.NoError(t, err)
defer resp.Body.Close()
require.Equal(t, http.StatusOK, resp.StatusCode)
}
14 changes: 14 additions & 0 deletions nodebuilder/tests/testdata/submitPFB.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"jsonrpc": "2.0",
"id": 1,
"method": "state.SubmitPayForBlob",
"params": [
[{
"namespace_id": "AAAAAAAAAAAAAAAAAAAAAAAAOUuI3+tg+3TyEw==",
"data": "4PdKsZcCJsDR/BErNf8Q0al/DMHmV606NylMHKBjzutMuJrcQr11as52hPPv4P2X2zccCUUALfq0N4SITHVBNUa15j4y+t/+WkyIZ8IDe+ZHYVX9z0AQWQVW6AZ70BJHZYuhWQ1xJZp2BIeqh0xVYVhauB7DmgXR66dBBEfSuMewl9NKkNINNhAvIeW/NHLS41y4FWi0v2zH8HyA+IJjTO7okTgii1xz5yQ5wZ6UileWLuNldqH9/+77bf4M6J+n+Dtf6LL0QbwpEG1M6f2iZAJsSYCb680Q9xkrMyLFSdgYL3wPirloC64n1p5MuwYiY5o6skqJ1kGDWI4ASr+9NPIV0GdiW76FhsBuimqO3d+wKhvrPdheH/yPRx0Xq6ky9azT/Iq6KL5VW/978JvT7Mk7sVSU0vFoE8zL9ZyGRtW5yfADxY5tGWjDVKtknOv+STLGnLHeJAAPVjFebWuI7it3UvKhOPPXrdYBr6zF4uVyzNS9UsK87SjtkNLSXn4loIcsupnA9VSmqZxYI+AtFd2AspQ8hzOwQoPiLWVDyS9KJOtHCCRgFJmG5cZ9ZlXHOwQh8iHvBWNvOV25XJs2Cm4wYjEu5vCVrh04xB+U7Pmr+ANWwjth6w6qa0SkQf9ck2zPBElkv50Ajjx5jK+BOAES78E=",
"share_version": 0,
"namespace_version": 0
}],
{}
]
}
Loading