Skip to content

fix: cap stdin size at 16 GiB and report it to the network - #218

Open
bergkvist wants to merge 1 commit into
tobias/cap-fulfiller-download-sizefrom
tobias/cap-stdin-size
Open

bergkvist wants to merge 1 commit into
tobias/cap-fulfiller-download-sizefrom
tobias/cap-stdin-size

Conversation

@bergkvist

Copy link
Copy Markdown
Contributor

Summary

  • The S3 and Redis artifact clients refuse a stdin above 16 GiB before download, and they stop the zstd decode at the same cap. This applies to Stdin and PrivateStdin.
  • A refused stdin fails the proof at once. The worker records STDIN_TOO_LARGE in the failure payload, and the fulfiller passes that code to the network. The fulfiller also refuses to copy a stdin above the cap, and it fails the request with the same code.
  • The decode buffer now doubles up to the cap. It does not reserve the full cap up front, because a 16 GiB reservation can fail on a node with less memory.
  • The SP1 family points at the branch of feat(sdk): add StdinTooLarge proof request error sp1#3040. The spn-* crates point at the branch of feat(proto): add STDIN_TOO_LARGE proof request error network#250. Both add the new error value.

Motivation

The stdin is customer bytes, like the program. #214 gave the program a cap and left the stdin without one. A zstd bomb as stdin can use all the memory of a worker in the same way as a program bomb. The coordinator then requeues the tasks of the dead worker without a retry count.

Validation

  • Unit tests cover the cap for both stdin types, a decode that grows past the first buffer and returns the exact input, the error code of the worker, and the error code of the fulfiller. The program tests still pass at 512 MiB, including the test that the buffer does not grow past the cap.
  • Redis-backed tests ran against a local Redis 7 container: 11 passed.
  • Workspace cargo test: 234 passed, 0 failed, 19 ignored. Clippy with the CI flags, cargo fmt --check and cargo deny check pass.
  • No test decodes a stdin at the cap, because that needs 16 GiB of memory. The program tests run the same decode loop.

Caveats

Comment thread Cargo.toml
spn-network-types = { git = "https://github.com/succinctlabs/network", branch = "tobias/cap-artifact-download-size", features = ["network"] }
spn-pricing = { git = "https://github.com/succinctlabs/network", branch = "tobias/cap-artifact-download-size" }
spn-utils = { git = "https://github.com/succinctlabs/network", branch = "tobias/cap-artifact-download-size" }
spn-artifacts = { git = "https://github.com/succinctlabs/network", branch = "tobias/proto-stdin-too-large" }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to update to the 'main' branch before merging

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

2 participants