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

Possible missalignment of rpc cli and api endpoint when using GetSharesByNamespace #2381

Closed
zvolin opened this issue Jun 19, 2023 · 3 comments
Assignees
Labels
bug Something isn't working external Issues created by non node team members

Comments

@zvolin
Copy link

zvolin commented Jun 19, 2023

Celestia Node version

6654cdf

OS

Archlinux 6.3.6-zen

Install tools

make build
sudo make install

Others

No response

Steps to reproduce it

I wanted to set up local private network and then go through the base64 svg tutorial

# celestia app 6c23dee8da9850f78f8bd85482a9478e105a2c4d
./scripts/single-node.sh
# bridge node
export CELESTIA_HOME=/tmp/celestia_app_UZEW3Uqzc7x4C
celestia bridge init --p2p.network private
# then I edited $CELESTIA_HOME/.celestia-bridge-private/config.toml providing it with Headers.TrustedHash of genesis block
celestia bridge start --gateway --core.ip 127.0.0.1 --p2p.network private

# Get some credits
CELESTIA_NODE_AUTH_TOKEN=$(celestia bridge auth admin --p2p.network private --core.ip 127.0.0.1)
ADDRESS=$(celestia rpc state AccountAddress | jq '.result' | tr -d '"')
celestia-appd tx bank send validator $ADDRESS 1000000utia --home $CELESTIA_HOME --fees 21000utia

# Publish SVG
❯ celestia rpc blob Submit 0x0c204d39600fddd3 "\"$SVG_DATA\""                                                                                                                                         
{                                                                                                                                                                                              
  "jsonrpc": "2.0",                                                                                                                                                                            
  "result": 243,                                                                                                                                                                               
  "id": 1                                                                                                                                                                                      
}                                                                                                                                                                                              

Expected result

celestia rpc command should be able to take HEX or BASE64 encoded namespace id and pass it correctly to RPC endpoint, or RPC endpoint should be able to decode values passed by celestia rpc.

Actual result

# When passing HEX encoded namespace ID, it complains of it not being BASE64
celestia-app on  main [?] via  v1.20.5 
❯ celestia rpc share GetSharesByNamespace "$(celestia rpc header GetByHeight $HEIGHT | jq '.result.dah' -r)" 0x0c204d39600fddd3 --print-request
{
  "Request": {
    "id": 1,
    "jsonrpc": "2.0",
    "method": "share.GetSharesByNamespace",
    "params": [
      {
        "row_roots": [
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAMIE05YA/d02utaKziDybNkLSlrS1Fpzqp0ddNsRfvivRxNEkG6Na5",
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAADCBNOWAP3dP//////////////////////////////////////mhj9Ga7Pr61TCDlxiRGzE9tDknX7DyfWAlpOFTH+wLR",
          "/////////////////////////////////////////////////////////////////////////////6db1GVEnhSAq7ZqLnHIewX6nk1oen5CzyQDI+w9i2GY",
          "/////////////////////////////////////////////////////////////////////////////5CwvkK3zKC5Wsx3cJ3cUB7xDk0Flort4E5z6/Vtot6L"
        ],
        "column_roots": [
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAMIE05YA/d0wdv/n2VOOlTjQlQeEAiHCgDYGaeOeYBmlbBZy70y3Zt",
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAADCBNOWAP3dP//////////////////////////////////////s0HNgPKH0iA1IWoe1r8j8QJs6MPEh+nJLeMk+RjFkPN",
          "/////////////////////////////////////////////////////////////////////////////22X4FXc7V6RwgBW/Jqxup9C/4WwS01NOAYG2oCO3jR7",
          "/////////////////////////////////////////////////////////////////////////////06vRwTZfgxGry7SF6SIW2Z/KbuHeohoX4575Ivk6FYv"
        ]
      },
      "0x0c204d39600fddd3"
    ]
  },
  "Response": {
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
      "code": -32700,
      "message": "unmarshaling params for 'share.GetSharesByNamespace' (param: *namespace.ID): illegal base64 data at input byte 16"
    }
  }
}

# Converted 0x0c204d39600fddd3 to base64 with python
python -c 'import base64; print(base64.b64encode(0x0c204d39600fddd3.to_bytes(10)))'

# When passing BASE64 decoded namespace of length 10, it fails on the node side
celestia-app on  main [?] via  v1.20.5 
❯ celestia rpc share GetSharesByNamespace "$(celestia rpc header GetByHeight $HEIGHT | jq '.result.dah' -r)" AAAMIE05YA/d0w== --print-request
{
  "Request": {
    "id": 1,
    "jsonrpc": "2.0",
    "method": "share.GetSharesByNamespace",
    "params": [
      {
        "row_roots": [
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAMIE05YA/d02utaKziDybNkLSlrS1Fpzqp0ddNsRfvivRxNEkG6Na5",
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAADCBNOWAP3dP//////////////////////////////////////mhj9Ga7Pr61TCDlxiRGzE9tDknX7DyfWAlpOFTH+wLR",
          "/////////////////////////////////////////////////////////////////////////////6db1GVEnhSAq7ZqLnHIewX6nk1oen5CzyQDI+w9i2GY",
          "/////////////////////////////////////////////////////////////////////////////5CwvkK3zKC5Wsx3cJ3cUB7xDk0Flort4E5z6/Vtot6L"
        ],
        "column_roots": [
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAMIE05YA/d0wdv/n2VOOlTjQlQeEAiHCgDYGaeOeYBmlbBZy70y3Zt",
          "AAAAAAAAAAAAAAAAAAAAAAAAAAAADCBNOWAP3dP//////////////////////////////////////s0HNgPKH0iA1IWoe1r8j8QJs6MPEh+nJLeMk+RjFkPN",
          "/////////////////////////////////////////////////////////////////////////////22X4FXc7V6RwgBW/Jqxup9C/4WwS01NOAYG2oCO3jR7",
          "/////////////////////////////////////////////////////////////////////////////06vRwTZfgxGry7SF6SIW2Z/KbuHeohoX4575Ivk6FYv"
        ]
      },
      "AAAMIE05YA/d0w=="
    ]
  },
  "Response": {
    "jsonrpc": "2.0",
    "id": 1,
    "error": {
      "code": 1,
      "message": "getter/store: invalid namespace ID: expected namespace ID of size 29, got 10"
    }
  }
}

# Converted 0x0c204d39600fddd3 to 29bytes base64 with python
python -c 'import base64; print(base64.b64encode(0x0c204d39600fddd3.to_bytes(29)))'

# When passing BASE64 decoded namespace of length 29, it fails on the client side
❯ celestia rpc share GetSharesByNamespace "$(celestia rpc header GetByHeight $HEIGHT | jq '.result.dah' -r)" AAAAAAAAAAAAAAAAAAAAAAAAAAAADCBNOWAP3dM= --print-request
panic: Error parsing namespace ID: namespace id must be <= 10, but it was 29 bytes

Relevant log output

No response

Notes

No response

@zvolin zvolin added the bug Something isn't working label Jun 19, 2023
@github-actions github-actions bot added the external Issues created by non node team members label Jun 19, 2023
@distractedm1nd
Copy link
Collaborator

Support for full namespaces was removed accidentally and I will update in this thread when the support is added back on main. We are going to wait for #2376 to land first

@renaynay
Copy link
Member

Now #2388

@renaynay
Copy link
Member

renaynay commented Dec 1, 2023

Closing as resolved.

@renaynay renaynay closed this as completed Dec 1, 2023
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

No branches or pull requests

3 participants