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

Query free space remaining in allocation before attempting an upload #241

Closed
stewartie4 opened this issue May 27, 2022 · 0 comments · Fixed by 0chain/gosdk#600 or #311
Closed

Query free space remaining in allocation before attempting an upload #241

stewartie4 opened this issue May 27, 2022 · 0 comments · Fixed by 0chain/gosdk#600 or #311
Assignees
Labels
doing enhancement New feature or request WIP

Comments

@stewartie4
Copy link
Contributor

When attempting to upload a file larger than the allocation allows, the file is first uploaded to the blobber, then the blobber returns an error if it is too large.
This is problematic for 2 reasons:

  1. It is very wasteful and time consuming for both the client and server
  2. There is a possible DOS attack vector where a giant file is uploaded to blobber temp storage even though the allocation does not allow it
  3. Sometimes (inconsistently) a panic occurs:
    ERROR extgen/config.go:201 Encountered a panic {"recovered": "runtime error: index out of range [1024] with length 1024"}
    main.(*PhaseGoal).SpawnWorkers.func3.1.1.1
    /go-external-txn-generator/go/0chain.net/txngen/extgen/config.go:201
    runtime.gopanic
    /usr/local/go/src/runtime/panic.go:965
    runtime.goPanicIndex
    /usr/local/go/src/runtime/panic.go:88
    github.com/0chain/gosdk/core/util.(*FixedMerkleTree).Write
    /go/pkg/mod/github.com/0chain/[email protected]/core/util/fixed_merkle_tree.go:52

Acceptance criteria:
First query the allocation free space and reject the upload on the client side if the file is too large

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doing enhancement New feature or request WIP
Projects
None yet
2 participants