feat: EVM payment integration for client chunk storage#14
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
End-to-end EVM payment flow for storing chunks on saorsa-node. Clients request quotes from network nodes, pay on-chain (Arbitrum / local Anvil), and submit payment proofs with chunk storage requests. Nodes verify proofs before accepting data.
Why
Storage on the saorsa network must be paid. This PR implements the full cycle: quote, pay, store, verify — mirroring the autonomi MerklePaymentVault contract pricing model. Without this, nodes accept data for free with no economic incentive to run a node.
Architecture
Key changes
Payment flow (
src/payment/)Client (
src/client/)put_chunk_with_payment()— full quote > pay > store flow via DHT peer discoveryput_chunk_with_proof()— store with pre-built proof (skip payment cycle)Unified CLI (
src/bin/saorsa-cli/)file upload/download— multi-chunk file operations with EVM paymentchunk put/get— single-chunk operations (stdin/stdout support)SECRET_KEYenv var (no CLI flags for secrets)saorsa-clientbinary removed — all functionality merged intosaorsa-cliNode enforcement (
src/node.rs,src/storage/handler.rs)max_message_sizeconfigured for 4MB chunk transportE2E test suite (
tests/e2e/)complete_payment_e2e— 10-node network with full quote > pay > store > retrievepayment_flow— payment workflow tests (quotes, median pricing, caching)security_attacks— forged signatures, wrong amounts, replay attacks, oversized proofsscripts/test_e2e.sh— shell-based E2E: upload, download, SHA256 verify, on-chain TX verification, payment rejectionStats