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

slice bounds out of range Error When Downloading File from RPC Endpoint #143

Open
Josephtran102 opened this issue Jul 23, 2024 · 0 comments

Comments

@Josephtran102
Copy link

Josephtran102 commented Jul 23, 2024

Description:

When attempting to download a file from certain RPC endpoints using the 0g-storage-client, I encounter a runtime error: slice bounds out of range. This error occurs consistently when using specific endpoints but not others.

  1. Steps to Reproduce:

Upload a file to a storage node using the following command:

./0g-storage-client upload \
--url https://evm.rpc2.0gchain.josephtran.xyz \
--contract "0x8873cc79c5b3b5666535C825205C9a128B1D75F1" \
--key $PRIVATE_KEY \
--node "https://storage-node3.0gchain.josephtran.xyz/" \
--file $HOME/0g-storage-client/test.txt
  1. Attempt to download the file from the same node using:
./0g-storage-client download \
--node "https://storage-node3.0gchain.josephtran.xyz/" \
--root 0xf6cec803a2c135fd75e0e6bcbcb5ff48e4774b62e762cf5e475d3a8247601d6b \
--file /root/0g-storage-client/outtt.test100.txt

The download succeeds without errors.
Screen Shot 2024-07-23 at 11 33 00

  1. Attempt to download the same file from different RPC endpoints using:
./0g-storage-client download \
--node "https://storage-node1.0gchain.josephtran.xyz/" \
--root 0xf6cec803a2c135fd75e0e6bcbcb5ff48e4774b62e762cf5e475d3a8247601d6b \
--file /root/0g-storage-client/outtttt.test100.txt

or

./0g-storage-client download \
--node "https://rpc-storage-testnet.0g.ai" \
--root 0xf6cec803a2c135fd75e0e6bcbcb5ff48e4774b62e762cf5e475d3a8247601d6b \
--file /root/0g-storage-client/outttttt.test100.txt

Observed Results:

The command fails with the following error:

panic: runtime error: slice bounds out of range [:-83]

goroutine 56 [running]:
github.com/0glabs/0g-storage-client/transfer.(*SegmentDownloader).ParallelDo(0xc000170740?, 0xc000170708?, 0x0?)
        /root/0g-storage-client/transfer/download_parallel.go:107 +0x905
github.com/0glabs/0g-storage-client/common/parallel.work({0xdfe300, 0xc00017ac30}, 0x0, {0xdfac20, 0xc000127860}, 0xc00007e0e0, 0xc0001278c0, 0xc0005de141?)
        /root/0g-storage-client/common/parallel/serial.go:59 +0x131
created by github.com/0glabs/0g-storage-client/common/parallel.Serial in goroutine 1
        /root/0g-storage-client/common/parallel/serial.go:37 +0x1bf

Screen Shot 2024-07-23 at 11 33 19

Expected Results:
The file should download successfully from any RPC endpoint.

Environment:

0g-storage-client 
0g-storage-node: v.0.3.4
Operating System: Ubuntu 22.04.4 LTS
Node URLs:
Working: https://storage-node3.0gchain.josephtran.xyz/
Failing: https://storage-node1.0gchain.josephtran.xyz/, https://rpc-storage-testnet.0g.ai

Additional Information:

I have verified that the file uploads and downloads successfully from the working endpoint, and the issue consistently occurs with other endpoints.
I have also checked that all endpoints are reachable and the network connection is stable.
Logs:

Include any relevant logs if necessary (e.g., from 0g-storage-client or the node).
Suggested Fix:

Investigate the ParallelDo method in download_parallel.go for possible issues with handling slice bounds or RPC responses.

Thank you for your assistance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant