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

libshare.Blob json marshaling is broken, making state.SubmitPayForBlob unusable #3956

Closed
zvolin opened this issue Nov 21, 2024 · 1 comment · Fixed by #3958
Closed

libshare.Blob json marshaling is broken, making state.SubmitPayForBlob unusable #3956

zvolin opened this issue Nov 21, 2024 · 1 comment · Fixed by #3958
Labels
bug Something isn't working external Issues created by non node team members

Comments

@zvolin
Copy link

zvolin commented Nov 21, 2024

Celestia Node version

v0.20.2

OS

nixos unstable with asahi

Install tools

docker

Others

No response

Steps to reproduce it

git clone https://github.com/celestiaorg/go-square && cd go-square 

patch -p1 --ignore-whitespace <<'EOF'
diff --git a/share/blob_test.go b/share/blob_test.go
index 771328e..fa58b0c 100644
--- a/share/blob_test.go
+++ b/share/blob_test.go
@@ -3,6 +3,8 @@ package share
 import (
        "bytes"
        "crypto/rand"
+       "encoding/json"
+       "fmt"
        "testing"

        v1 "github.com/celestiaorg/go-square/v2/proto/blob/v1"
@@ -22,6 +24,18 @@ func TestProtoEncoding(t *testing.T) {
        newBlob, err := UnmarshalBlob(blobBytes)
        require.NoError(t, err)

+       blobJson, err := json.Marshal(blob)
+       require.NoError(t, err)
+
+       fmt.Println("blob", *blob)
+       fmt.Println("json blob", string(blobJson))
+
+       blob = &Blob{}
+       err = json.Unmarshal(blobJson, blob)
+       require.NoError(t, err)
+
+       fmt.Println("blob", *blob)
+
        require.Equal(t, blob, newBlob)
 }

EOF

make test

Expected result

state.SubmitPayForBlob to work

Actual result

⇒ {
    "jsonrpc":"2.0",
    "id":1,
    "method":"state.SubmitPayForBlob",
    "params":[
        [{
            "namespace_id":"AAAAAAAAAAAAAAAAAAAAAAAAOUuI4+yg+3IeEw==",
            "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
        }],
        {}
    ]
}
⇐ {
    "error":{
        "code":1,
        "message":"cannot use zero blob size"
    },
    "id":1,
    "jsonrpc":"2.0"
}

Relevant log output

No response

Is the node "stuck"? Has it stopped syncing?

No response

Notes

No matter what input is passed to unmarshal, it deserializes to Blob{} and all blobs are serialized as {}

@zvolin zvolin added the bug Something isn't working label Nov 21, 2024
@github-actions github-actions bot added the external Issues created by non node team members label Nov 21, 2024
@jcstein
Copy link
Member

jcstein commented Nov 22, 2024

cc: @celestiaorg/celestia-node ICYMI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external Issues created by non node team members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants