Skip to content

Conversation

@PatStiles
Copy link
Contributor

@PatStiles PatStiles commented Dec 4, 2024

Price Estimates in Aligned CLI

Description

Addresses No. 1 in #1570. Adds a new pricing parameter for the cli using PriceEstimate from the sdk. Refactors some parts of the sdk.

Type of change

Please delete options that are not relevant.

  • New feature
  • Bug fix
  • Optimization
  • Refactor

To Test:

  • Start local devnet
  • If you prefer to use a paying address run the following:
cast send --rpc-url http://localhost:8545 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --value 9999.9999999ether --private-key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
  • Try submitting proofs with the following commands and observe the following edge cases are successfully submit a proof to the batcher:

Not specifying a fee should use the default.

cargo run --release -- submit \
                --proving_system SP1 \
                --proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
                --vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
                --repetitions 20 \
                --proof_generator_addr 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
                --rpc_url http://localhost:8545 \
                --network devnet --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
Screenshot 2024-12-05 at 20 30 24

--max_fee

cargo run --release -- submit \
                --proving_system SP1 \
                --proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
                --vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
                --repetitions 20 \
                --proof_generator_addr 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
                --rpc_url http://localhost:8545 \
                --network devnet --max_fee 0.001ether --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a

--default_fee_estimate

cargo run --release -- submit \
                --proving_system SP1 \
                --proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
                --vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
                --repetitions 20 \
                --proof_generator_addr 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
                --rpc_url http://localhost:8545 \
                --network devnet --default_fee_estimate --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a

--instant_fee_estimate

cargo run --release -- submit \
                --proving_system SP1 \
                --proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
                --vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
                --repetitions 20 \
                --proof_generator_addr 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
                --rpc_url http://localhost:8545 \
                --network devnet --instant_fee_estimate --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a

`--custom_fee_estimate <NUM_PROOFS_IN_BATCH>"

cargo run --release -- submit \
                --proving_system SP1 \
                --proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
                --vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
                --repetitions 20 \
                --proof_generator_addr 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
                --rpc_url http://localhost:8545 \
                --network devnet --custom_fee_estimate <NUM_PROOFS_IN_BATCH> --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
  • Try submitting proofs with the following commands and observe the following edge cases are triggered:

max_fee and default_fee_estimate/instant_fee_estimate/custom_fee_estimate should not be displayed.

cargo run --release -- submit \
                --proving_system SP1 \
                --proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
                --vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
                --repetitions 20 \
                --proof_generator_addr 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
                --rpc_url http://localhost:8545 \
                --network devnet --max_fee 1000000000 --custom_fee_estimate --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
Screenshot 2024-12-05 at 20 28 45

Clap errors if custom does not have <NUM_PROOFS_PER_BATCH>

cargo run --release -- submit \
                --proving_system SP1 \
                --proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
                --vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
                --repetitions 20 \
                --proof_generator_addr 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
                --rpc_url http://localhost:8545 \
                --network devnet --custom_fee_estimate --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
Screenshot 2024-12-05 at 20 29 20

Parsing errors for "--custom_fee_estimate" if incorrect value is supplied for num_proofs_in_batch

cargo run --release -- submit \
                --proving_system SP1 \
                --proof ../../scripts/test_files/sp1/sp1_fibonacci.proof \
                --vm_program ../../scripts/test_files/sp1/sp1_fibonacci.elf \
                --repetitions 20 \
                --proof_generator_addr 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 \
                --rpc_url http://localhost:8545 \
                --network devnet --price_estimate "custom u" --private_key 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a
Screenshot 2024-12-05 at 20 29 44

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@PatStiles PatStiles changed the title feat(sdk): sdk pricing feat(cli): Price Estimates in Aligned CLI Dec 4, 2024
Copy link
Member

@MarcosNicolau MarcosNicolau left a comment

Choose a reason for hiding this comment

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

Working nicely!

@uri-99 uri-99 requested a review from MauroToscano January 17, 2025 17:43
@uri-99 uri-99 changed the base branch from staging to feat/deprecate-batcher-url January 17, 2025 21:26
Base automatically changed from feat/deprecate-batcher-url to staging January 17, 2025 23:05
Copy link
Contributor

@MauroToscano MauroToscano left a comment

Choose a reason for hiding this comment

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

Ok but has conflicts

uri-99 and others added 2 commits January 20, 2025 12:16
fix: remove mix.lock changes from explorer
@JuArce JuArce added this pull request to the merge queue Jan 20, 2025
Merged via the queue into staging with commit 3a47b87 Jan 20, 2025
3 checks passed
@JuArce JuArce deleted the feat/sdk-pricing branch January 20, 2025 17:34
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.

9 participants