├── .dockerignore ├── .dprint.jsonc ├── .env.broker-template ├── .env.localnet-template ├── .gitattributes ├── .github ├── CODEOWNERS ├── actions │ ├── bininstall-risc0 │ │ └── action.yml │ └── sccache │ │ └── action.yml └── workflows │ ├── bento-release.yml │ ├── bento.yml │ ├── broker-release.yml │ ├── contracts.yml │ ├── documentation.yml │ ├── linear.yml │ └── main.yml ├── .gitignore ├── .gitmodules ├── .ignore ├── .vim └── coc-settings.json ├── .vscode ├── extensions.json └── settings.json ├── .watchmanconfig ├── Boundless_Logo black.png ├── Cargo.lock ├── Cargo.toml ├── LICENSE-Apache-2.0 ├── LICENSE-BSL ├── README.md ├── _typos.toml ├── balance_plot.py ├── bento ├── .sqlx │ ├── query-09bf971c1479e2e1210e8fc406f0a6b83c3a89757306068a8b39eb3e669bb9e0.json │ ├── query-2bbd0c900dd78c6bbfd9fd26169d514fa9836ccac402906287b8e8065401b4b6.json │ ├── query-4c18a58f2978cf38cb21861e588d6baff1e17c78408ada56ba40355232d034fe.json │ ├── query-62f1078237433da96ae4e0357756d6ff6d2e05af98248fae251e238a4dfed040.json │ ├── query-676560153f5314b20b8249029c80a4b427ea0763d22556e99a96589abef72922.json │ ├── query-6bd30587f76885d761a33dd40230f799904e4d790546854087116317f725f0d8.json │ ├── query-7c9ffb3cea5e4d88731a2ce2002aa9fe7c4cf0fe70290acf5d5a457012329e5b.json │ ├── query-98be52d31f130729d200e46dca8fb8bba9eed011f6bb6b2c18b8f3b8a3112acb.json │ ├── query-ad0b9dd321787be38b84b7be95c003e48a53b62043627987dcddf35fbe08dc6c.json │ ├── query-e1f13dbd0322f3cbc6cb5226c45974f8a57e7e5e06e12a799679c2a8ee4c968e.json │ ├── query-ef499e1ce903a51b633d7fe62f1fb00a8219d5ab4e9da02144d949ffefe6cef6.json │ └── query-f7ae8c9ab7f7bf604f4877640959147b53fe47a2d2e90ca14bc4579012e8f01f.json ├── Cargo.lock ├── Cargo.toml ├── LICENSE-BSL ├── README.md ├── crates │ ├── api │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── bin │ │ │ └── rest_api.rs │ │ │ ├── helpers.rs │ │ │ └── lib.rs │ ├── bento-client │ │ ├── Cargo.toml │ │ └── src │ │ │ └── bento_cli.rs │ ├── sample-guest │ │ ├── common │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── lib.rs │ │ └── methods │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ ├── guest │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── main.rs │ │ │ └── src │ │ │ └── lib.rs │ ├── taskdb │ │ ├── Cargo.toml │ │ ├── benches │ │ │ └── taskdb.rs │ │ ├── examples │ │ │ └── stress.rs │ │ ├── migrations │ │ │ ├── 1_taskdb.sql │ │ │ ├── 2_optimizations.sql │ │ │ ├── 3_maintenance.sql │ │ │ └── 4_clear_completed_streams.sql │ │ ├── src │ │ │ ├── lib.rs │ │ │ └── planner │ │ │ │ ├── mod.rs │ │ │ │ └── task.rs │ │ └── tests │ │ │ └── e2e.rs │ ├── workflow-common │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── s3.rs │ └── workflow │ │ ├── Cargo.toml │ │ └── src │ │ ├── bin │ │ └── agent.rs │ │ ├── lib.rs │ │ ├── redis.rs │ │ └── tasks │ │ ├── executor.rs │ │ ├── finalize.rs │ │ ├── join.rs │ │ ├── join_povw.rs │ │ ├── keccak.rs │ │ ├── mod.rs │ │ ├── prove.rs │ │ ├── resolve.rs │ │ ├── resolve_povw.rs │ │ ├── snark.rs │ │ └── union.rs └── scripts │ ├── docker-cleanup.sh │ ├── docker-setup.sh │ └── run_tests.sh ├── biome.json ├── broker-template.toml ├── compose.yml ├── contracts ├── deployment-test │ ├── Deploymnet.t.sol │ └── PoVWDeployment.t.sol ├── deployment.toml ├── reference-contract │ └── test │ │ └── Upgrade.t.sol ├── scripts │ ├── BoundlessScript.s.sol │ ├── Config.s.sol │ ├── Deploy.PoVW.s.sol │ ├── Deploy.s.sol │ ├── HitPointsOperator.md │ ├── Manage.PoVW.s.sol │ ├── Manage.s.sol │ ├── VERIFY.md │ ├── find_rollback_address │ ├── hp │ ├── manage │ ├── manage-povw │ └── test ├── snapshots │ ├── BoundlessMarketBasicTest.json │ └── BoundlessMarketBench.json ├── src │ ├── BoundlessMarket.sol │ ├── BoundlessMarketCallback.sol │ ├── HitPoints.sol │ ├── IBoundlessMarket.sol │ ├── IBoundlessMarketCallback.sol │ ├── IHitPoints.sol │ ├── libraries │ │ ├── BoundlessMarketLib.sol │ │ └── MerkleProofish.sol │ ├── povw │ │ ├── IPovwAccounting.sol │ │ ├── IPovwMint.sol │ │ ├── PovwAccounting.sol │ │ └── PovwMint.sol │ ├── types │ │ ├── Account.sol │ │ ├── AssessorCallback.sol │ │ ├── AssessorCommitment.sol │ │ ├── AssessorJournal.sol │ │ ├── AssessorReceipt.sol │ │ ├── Callback.sol │ │ ├── Fulfillment.sol │ │ ├── FulfillmentContext.sol │ │ ├── FulfillmentData.sol │ │ ├── Input.sol │ │ ├── LockRequest.sol │ │ ├── Offer.sol │ │ ├── Predicate.sol │ │ ├── ProofRequest.sol │ │ ├── RequestId.sol │ │ ├── RequestLock.sol │ │ ├── Requirements.sol │ │ └── Selector.sol │ └── zkc │ │ └── IStakingRewards.sol ├── test │ ├── BoundlessMarket.t.sol │ ├── BoundlessMarketCallback.t.sol │ ├── HitPoints.t.sol │ ├── MockCallback.sol │ ├── MockZKC.sol │ ├── TestUtils.sol │ ├── TestUtilsZKC.sol │ ├── clients │ │ ├── BaseClient.sol │ │ ├── Client.sol │ │ ├── MockSmartContractWallet.sol │ │ └── SmartContractClient.sol │ └── types │ │ ├── Account.t.sol │ │ ├── FulfillmentContext.t.sol │ │ ├── Input.t.sol │ │ ├── MerkleProofish.t.sol │ │ ├── Offer.t.sol │ │ ├── Predicate.t.sol │ │ ├── ProofRequest.t.sol │ │ ├── RequestId.t.sol │ │ └── RequestLock.t.sol ├── update_deployment_toml.py └── version-management-design.md ├── crates ├── assessor │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── bench │ ├── Cargo.toml │ ├── README.md │ ├── data │ │ └── small_test.json │ ├── scripts │ │ └── process.py │ └── src │ │ ├── bench.rs │ │ ├── db.rs │ │ ├── lib.rs │ │ └── main.rs ├── boundless-cli │ ├── Cargo.toml │ ├── build.rs │ ├── src │ │ ├── bin │ │ │ ├── boundless-ffi.rs │ │ │ └── boundless.rs │ │ ├── commands │ │ │ ├── mod.rs │ │ │ ├── povw │ │ │ │ ├── claim.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── prepare.rs │ │ │ │ ├── state.rs │ │ │ │ └── submit.rs │ │ │ └── zkc │ │ │ │ ├── balance_of.rs │ │ │ │ ├── calculate_rewards.rs │ │ │ │ ├── claim_rewards.rs │ │ │ │ ├── delegate_rewards.rs │ │ │ │ ├── get_active_token_id.rs │ │ │ │ ├── get_current_epoch.rs │ │ │ │ ├── get_epoch_end_time.rs │ │ │ │ ├── get_rewards_delegates.rs │ │ │ │ ├── get_staked_amount.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── stake.rs │ │ │ │ └── unstake.rs │ │ ├── config.rs │ │ └── lib.rs │ └── tests │ │ ├── povw.rs │ │ └── zkc.rs ├── boundless-market │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── src │ │ ├── balance_alerts_layer.rs │ │ ├── client.rs │ │ ├── contracts │ │ │ ├── artifacts │ │ │ │ ├── Account.sol │ │ │ │ ├── AssessorCallback.sol │ │ │ │ ├── AssessorCommitment.sol │ │ │ │ ├── AssessorJournal.sol │ │ │ │ ├── AssessorReceipt.sol │ │ │ │ ├── Callback.sol │ │ │ │ ├── Fulfillment.sol │ │ │ │ ├── FulfillmentContext.sol │ │ │ │ ├── FulfillmentData.sol │ │ │ │ ├── IBoundlessMarket.sol │ │ │ │ ├── IHitPoints.sol │ │ │ │ ├── Input.sol │ │ │ │ ├── LockRequest.sol │ │ │ │ ├── Offer.sol │ │ │ │ ├── Predicate.sol │ │ │ │ ├── ProofRequest.sol │ │ │ │ ├── RequestId.sol │ │ │ │ ├── RequestLock.sol │ │ │ │ ├── Requirements.sol │ │ │ │ └── Selector.sol │ │ │ ├── boundless_market.rs │ │ │ ├── bytecode.rs │ │ │ ├── hit_points.rs │ │ │ └── mod.rs │ │ ├── deployments.rs │ │ ├── dynamic_gas_filler.rs │ │ ├── input.rs │ │ ├── lib.rs │ │ ├── nonce_layer.rs │ │ ├── order_stream_client.rs │ │ ├── request_builder │ │ │ ├── finalizer.rs │ │ │ ├── mod.rs │ │ │ ├── offer_layer.rs │ │ │ ├── preflight_layer.rs │ │ │ ├── request_id_layer.rs │ │ │ ├── requirements_layer.rs │ │ │ └── storage_layer.rs │ │ ├── selector.rs │ │ ├── storage │ │ │ ├── fetch.rs │ │ │ ├── file.rs │ │ │ ├── mock.rs │ │ │ ├── mod.rs │ │ │ ├── pinata.rs │ │ │ └── s3.rs │ │ └── util.rs │ └── tests │ │ └── e2e.rs ├── broker-stress │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── main.rs │ │ └── toxiproxy.rs ├── broker │ ├── Cargo.toml │ ├── migrations │ │ ├── 1_broker.sql │ │ └── 2_fulfill_and_locked.sql │ └── src │ │ ├── aggregator.rs │ │ ├── bin │ │ └── broker.rs │ │ ├── chain_monitor.rs │ │ ├── config.rs │ │ ├── db │ │ ├── fuzz_db.rs │ │ └── mod.rs │ │ ├── errors.rs │ │ ├── futures_retry.rs │ │ ├── lib.rs │ │ ├── market_monitor.rs │ │ ├── offchain_market_monitor.rs │ │ ├── order_monitor.rs │ │ ├── order_picker.rs │ │ ├── prioritization.rs │ │ ├── provers │ │ ├── bonsai.rs │ │ ├── default.rs │ │ └── mod.rs │ │ ├── proving.rs │ │ ├── reaper.rs │ │ ├── requestor_monitor.rs │ │ ├── rpc_retry_policy.rs │ │ ├── storage.rs │ │ ├── submitter.rs │ │ ├── task.rs │ │ ├── tests │ │ ├── e2e.rs │ │ └── mod.rs │ │ └── utils.rs ├── distributor │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── guest │ ├── assessor │ │ ├── Cargo.toml │ │ ├── assessor-guest │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ └── main.rs │ │ ├── build.rs │ │ └── src │ │ │ └── lib.rs │ └── util │ │ ├── Cargo.toml │ │ ├── build.rs │ │ ├── echo │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ ├── identity │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ ├── loop │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ └── src │ │ └── lib.rs ├── indexer │ ├── Cargo.toml │ ├── migrations │ │ ├── 10_staking_positions.sql │ │ ├── 11_delegation_powers.sql │ │ ├── 12_address_history_indexes.sql │ │ ├── 13_summary_statistics.sql │ │ ├── 14_staking_rewards.sql │ │ ├── 15_staking_rewards_refactor.sql │ │ ├── 16_add_epoch_times_to_staking.sql │ │ ├── 17_add_updated_at_to_summaries.sql │ │ ├── 18_order_stream_state.sql │ │ ├── 19_add_request_source.sql │ │ ├── 1_transactions.sql │ │ ├── 2_events.sql │ │ ├── 3_proof_requests.sql │ │ ├── 4_fulfillments.sql │ │ ├── 5_metrics.sql │ │ ├── 6_blocks.sql │ │ ├── 7_povw_rewards_by_epoch.sql │ │ ├── 8_povw_rewards_aggregate.sql │ │ └── 9_add_staked_amount.sql │ ├── src │ │ ├── bin │ │ │ ├── market-indexer.rs │ │ │ └── rewards-indexer.rs │ │ ├── db │ │ │ ├── market.rs │ │ │ ├── mod.rs │ │ │ └── rewards.rs │ │ ├── lib.rs │ │ ├── market │ │ │ ├── mod.rs │ │ │ └── service.rs │ │ ├── rewards │ │ │ ├── mod.rs │ │ │ └── service.rs │ │ └── test_utils.rs │ └── tests │ │ ├── market.rs │ │ ├── market │ │ └── basic.rs │ │ ├── rewards.rs │ │ └── rewards │ │ ├── common │ │ └── mod.rs │ │ ├── delegations_integration.rs │ │ ├── povw_integration.rs │ │ └── staking_integration.rs ├── lambdas │ ├── indexer-api │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── local_test.db │ │ ├── manage_local │ │ ├── src │ │ │ ├── bin │ │ │ │ └── local-server.rs │ │ │ ├── db.rs │ │ │ ├── handler.rs │ │ │ ├── lib.rs │ │ │ ├── main.rs │ │ │ ├── models.rs │ │ │ ├── openapi.rs │ │ │ ├── routes │ │ │ │ ├── delegations.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── povw.rs │ │ │ │ └── staking.rs │ │ │ └── utils.rs │ │ └── tests │ │ │ ├── local_integration.rs │ │ │ └── local_integration │ │ │ ├── delegations.rs │ │ │ ├── docs.rs │ │ │ ├── povw.rs │ │ │ └── staking.rs │ └── indexer-monitor │ │ ├── .gitignore │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ ├── handler.rs │ │ ├── lib.rs │ │ ├── main.rs │ │ └── monitor.rs ├── order-generator │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── order-stream │ ├── Cargo.toml │ ├── migrations │ │ ├── 1_order_stream.sql │ │ ├── 2_broker_updated.sql │ │ └── 3_order_time.sql │ └── src │ │ ├── api.rs │ │ ├── bin │ │ └── order_stream.rs │ │ ├── lib.rs │ │ ├── order_db.rs │ │ └── ws.rs ├── povw │ ├── Cargo.toml │ ├── build.rs │ ├── elfs │ │ ├── boundless-povw-log-updater.bin │ │ ├── boundless-povw-log-updater.iid │ │ ├── boundless-povw-mint-calculator.bin │ │ └── boundless-povw-mint-calculator.iid │ ├── log-updater │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── mint-calculator │ │ ├── Cargo.lock │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── src │ │ ├── contracts │ │ │ ├── artifacts │ │ │ │ ├── IPovwAccounting.sol │ │ │ │ ├── IPovwMint.sol │ │ │ │ └── IZKC.sol │ │ │ ├── bytecode.rs │ │ │ └── mod.rs │ │ ├── deployments.rs │ │ ├── lib.rs │ │ ├── log_updater.rs │ │ ├── mint_calculator.rs │ │ └── zkc.rs │ ├── tests │ │ ├── log-updater.rs │ │ ├── mint-calculator.rs │ │ └── workflow.rs │ └── update-guest-bins.sh ├── requestor-lists │ ├── Cargo.toml │ ├── README.md │ ├── requestor-list.v1.schema.json │ ├── src │ │ └── lib.rs │ └── tests │ │ └── parse_example_list.rs ├── rewards │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── cache.rs │ │ ├── events.rs │ │ ├── lib.rs │ │ ├── povw.rs │ │ ├── powers.rs │ │ └── staking.rs ├── slasher │ ├── Cargo.toml │ ├── migrations │ │ └── 1_slasher.sql │ ├── src │ │ ├── db.rs │ │ ├── lib.rs │ │ └── main.rs │ └── tests │ │ └── basic.rs ├── test-utils │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── market.rs │ │ ├── povw.rs │ │ ├── verifier.rs │ │ └── zkc.rs └── zkc │ ├── Cargo.toml │ ├── build.rs │ └── src │ ├── contracts │ ├── artifacts │ │ ├── IRewards.sol │ │ ├── IStaking.sol │ │ ├── IStakingRewards.sol │ │ ├── IVotes.sol │ │ └── IZKC.sol │ └── mod.rs │ ├── deployments.rs │ └── lib.rs ├── deployments-check.py ├── dockerfiles ├── agent.dockerfile ├── agent.prebuilt.dockerfile ├── bento_cli.dockerfile ├── broker.dockerfile ├── broker.prebuilt.dockerfile ├── ci-cache-creds.txt ├── compose.ci.yml ├── distributor.dockerfile ├── grafana │ ├── dashboards │ │ ├── bento.json │ │ ├── broker.json │ │ └── dashboard.yml │ └── datasources │ │ ├── postgres.yml │ │ └── sqlite.yml ├── market-indexer.dockerfile ├── order_generator.dockerfile ├── order_stream.dockerfile ├── rest_api.dockerfile ├── rest_api.prebuilt.dockerfile ├── rewards-indexer.dockerfile ├── sccache-config.sh ├── sccache-setup.sh └── slasher.dockerfile ├── documentation ├── .editorconfig ├── .gitignore ├── .remarkrc ├── README.md ├── bun.lock ├── doc-test │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ └── lib.rs ├── package.json ├── scripts │ ├── check-links.ts │ ├── generate-link-previews.ts │ ├── process-forge-docs.ts │ └── reindex.ts ├── site │ ├── components │ │ ├── home-page.tsx │ │ ├── link-preview.tsx │ │ ├── strip-rust-code-comments.tsx │ │ ├── time-calculator.tsx │ │ └── youtube-embed.tsx │ ├── footer.tsx │ ├── layout.tsx │ ├── pages │ │ ├── developers │ │ │ ├── kailua │ │ │ │ ├── intro.mdx │ │ │ │ └── quick-start.mdx │ │ │ ├── proof-lifecycle.mdx │ │ │ ├── quick-start.mdx │ │ │ ├── smart-contracts │ │ │ │ ├── deployments.mdx │ │ │ │ ├── reference │ │ │ │ │ └── .gitignore │ │ │ │ ├── smart-contract-docs.mdx │ │ │ │ └── verifier-contracts.mdx │ │ │ ├── steel │ │ │ │ ├── commitments.mdx │ │ │ │ ├── events.mdx │ │ │ │ ├── history.mdx │ │ │ │ ├── how-it-works.mdx │ │ │ │ ├── quick-start.mdx │ │ │ │ └── what-is-steel.mdx │ │ │ ├── terminology.mdx │ │ │ ├── tooling │ │ │ │ ├── cli.mdx │ │ │ │ └── sdk.mdx │ │ │ ├── tutorials │ │ │ │ ├── auction.mdx │ │ │ │ ├── bonsai.mdx │ │ │ │ ├── build.mdx │ │ │ │ ├── callbacks.mdx │ │ │ │ ├── proof-composition.mdx │ │ │ │ ├── proof-types.mdx │ │ │ │ ├── request.mdx │ │ │ │ ├── sensitive-inputs.mdx │ │ │ │ ├── smart-contract-requestor.mdx │ │ │ │ ├── tracking.mdx │ │ │ │ ├── troubleshooting.mdx │ │ │ │ └── use.mdx │ │ │ ├── what.mdx │ │ │ └── why.mdx │ │ ├── index.mdx │ │ ├── provers │ │ │ ├── bento.mdx │ │ │ ├── broker.mdx │ │ │ ├── monitoring.mdx │ │ │ ├── performance-optimization.mdx │ │ │ ├── proving-stack.mdx │ │ │ ├── quick-start.mdx │ │ │ └── terminology.mdx │ │ └── zkc │ │ │ ├── collateral.mdx │ │ │ ├── mining │ │ │ ├── claiming-rewards.mdx │ │ │ ├── enable.mdx │ │ │ ├── overview.mdx │ │ │ ├── walkthrough.mdx │ │ │ └── wallet-setup.mdx │ │ │ └── quick-start.mdx │ ├── public │ │ ├── bento.png │ │ ├── bento_broker.png │ │ ├── bento_technical_diagram.png │ │ ├── boundless-foundry-template.png │ │ ├── boundless_wallet_setup.png │ │ ├── cubes.png │ │ ├── execution-model.png │ │ ├── explorer.png │ │ ├── favicon.svg │ │ ├── fonts │ │ │ ├── replica │ │ │ │ ├── ReplicaBold.otf │ │ │ │ ├── ReplicaBoldItalic.otf │ │ │ │ ├── ReplicaItalic.otf │ │ │ │ ├── ReplicaLight.otf │ │ │ │ ├── ReplicaLightItalic.otf │ │ │ │ └── ReplicaRegular.otf │ │ │ └── self-modern │ │ │ │ ├── SelfModernBold.otf │ │ │ │ ├── SelfModernItalic.otf │ │ │ │ ├── SelfModernRegular.otf │ │ │ │ └── SelfModernSemiBold.otf │ │ ├── launch-video-thumbnail.jpg │ │ ├── logo.svg │ │ ├── multi_chain_proving.png │ │ ├── nvtop.png │ │ ├── og.png │ │ ├── proof-lifecycle.png │ │ ├── protocol.png │ │ ├── prover-quick-start-thumbnail.jpg │ │ ├── request_diagram.png │ │ ├── reward_claim_flow.png │ │ ├── stake_ZKC.png │ │ ├── test-proof.png │ │ ├── use-a-proof.png │ │ └── ys.svg │ └── styles.css ├── tsconfig.json └── vocs.config.ts ├── examples ├── composition │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ ├── README.md │ ├── apps │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── contracts │ │ ├── scripts │ │ │ └── Deploy.s.sol │ │ ├── src │ │ │ ├── Counter.sol │ │ │ └── ICounter.sol │ │ └── test │ │ │ └── Counter.t.sol │ ├── foundry.toml │ ├── lib │ ├── remappings.txt │ ├── rust-toolchain.toml │ └── rustfmt.toml ├── counter-with-callback │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ ├── README.md │ ├── apps │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── contracts │ │ ├── scripts │ │ │ └── Deploy.s.sol │ │ ├── src │ │ │ ├── Counter.sol │ │ │ └── ICounter.sol │ │ └── test │ │ │ └── Counter.t.sol │ ├── foundry.toml │ ├── lib │ ├── remappings.txt │ ├── rust-toolchain.toml │ └── rustfmt.toml ├── counter │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ ├── README.md │ ├── apps │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ ├── contracts │ │ ├── scripts │ │ │ └── Deploy.s.sol │ │ ├── src │ │ │ ├── Counter.sol │ │ │ └── ICounter.sol │ │ └── test │ │ │ └── Counter.t.sol │ ├── foundry.toml │ ├── lib │ ├── remappings.txt │ ├── rust-toolchain.toml │ └── rustfmt.toml └── smart-contract-requestor │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ ├── README.md │ ├── apps │ ├── Cargo.toml │ └── src │ │ └── main.rs │ ├── contracts │ ├── src │ │ └── SmartContractRequestor.sol │ └── test │ │ └── SmartContractRequestor.t.sol │ ├── foundry.toml │ ├── lib │ ├── remappings.txt │ ├── rust-toolchain.toml │ └── rustfmt.toml ├── foundry.toml ├── infra ├── README ├── bootstrap │ ├── .gitignore │ ├── Pulumi.services-prod.yaml │ ├── Pulumi.services-staging.yaml │ ├── Pulumi.yaml │ ├── README │ ├── index.ts │ ├── lib │ │ └── vpc.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── builder │ ├── .gitignore │ ├── Pulumi.dev.yaml │ ├── Pulumi.yaml │ ├── README │ ├── configure_builder.sh │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── pulumiResources.ts │ ├── stop_builder.sh │ └── tsconfig.json ├── distributor │ ├── .gitignore │ ├── Pulumi.l-prod-11155111.yaml │ ├── Pulumi.l-prod-8453.yaml │ ├── Pulumi.l-prod-84532.yaml │ ├── Pulumi.l-staging-84532.yaml │ ├── Pulumi.prod-11155111.yaml │ ├── Pulumi.prod-8453.yaml │ ├── Pulumi.prod-84532.yaml │ ├── Pulumi.staging-11155111.yaml │ ├── Pulumi.staging-84532.yaml │ ├── Pulumi.yaml │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── indexer │ ├── .gitignore │ ├── Pulumi.l-prod-1.yaml │ ├── Pulumi.l-prod-11155111.yaml │ ├── Pulumi.l-prod-8453.yaml │ ├── Pulumi.l-prod-84532.yaml │ ├── Pulumi.l-staging-11155111.yaml │ ├── Pulumi.l-staging-84532.yaml │ ├── Pulumi.yaml │ ├── alarmConfig.ts │ ├── components │ │ ├── alarms.ts │ │ ├── indexer-api.ts │ │ ├── indexer-infra.ts │ │ ├── market-indexer.ts │ │ ├── monitor-lambda.ts │ │ ├── rewards-indexer.ts │ │ └── rust-lambda.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── order-generator │ ├── .gitignore │ ├── Pulumi.l-prod-11155111.yaml │ ├── Pulumi.l-prod-8453.yaml │ ├── Pulumi.l-prod-84532.yaml │ ├── Pulumi.l-staging-84532.yaml │ ├── Pulumi.yaml │ ├── README │ ├── components │ │ └── order-generator.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── order-stream │ ├── .gitignore │ ├── Pulumi.l-prod-11155111.yaml │ ├── Pulumi.l-prod-8453.yaml │ ├── Pulumi.l-prod-84532.yaml │ ├── Pulumi.l-staging-84532.yaml │ ├── Pulumi.prod-11155111.yaml │ ├── Pulumi.prod-8453.yaml │ ├── Pulumi.prod-84532.yaml │ ├── Pulumi.staging-11155111.yaml │ ├── Pulumi.staging-84532.yaml │ ├── Pulumi.test.yaml │ ├── Pulumi.yaml │ ├── components │ │ └── order-stream.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── packer │ ├── README.md │ ├── bento.pkr.hcl │ ├── bento_nightly.pkr.hcl │ ├── config_files │ │ └── vector.yaml │ ├── scripts │ │ ├── base.sh │ │ ├── setup_nightly.sh │ │ └── setup_release.sh │ ├── service_files │ │ ├── bento-api.service │ │ ├── bento-aux.service │ │ ├── bento-broker.service │ │ ├── bento-executor.service │ │ └── bento-prover.service │ └── variables.pkr.hcl ├── pipelines │ ├── .gitignore │ ├── Pulumi.prod.yaml │ ├── Pulumi.yaml │ ├── README │ ├── accountConstants.ts │ ├── components │ │ ├── codePipelineResources.ts │ │ ├── notifications.ts │ │ ├── pulumiSecrets.ts │ │ └── pulumiState.ts │ ├── index.ts │ ├── log-lambda │ │ ├── jest.config.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── logGroups.ts │ │ │ ├── logQueries.ts │ │ │ ├── roles.ts │ │ │ └── urls.ts │ │ ├── test │ │ │ └── index.test.ts │ │ ├── tsconfig.json │ │ └── tsconfig.tsbuildinfo │ ├── package-lock.json │ ├── package.json │ ├── pipelines │ │ ├── base │ │ │ ├── BasePipelineArgs.ts │ │ │ ├── LaunchBasePipeline.ts │ │ │ ├── LaunchDefaultPipeline.ts │ │ │ └── index.ts │ │ ├── l-base.ts │ │ ├── l-distributor.ts │ │ ├── l-indexer.ts │ │ ├── l-order-generator.ts │ │ ├── l-order-stream.ts │ │ ├── l-prover.ts │ │ ├── l-requestor-lists.ts │ │ ├── l-slasher.ts │ │ ├── packer-nightly.ts │ │ ├── packer.ts │ │ ├── prover-cluster.ts │ │ └── sample.ts │ └── tsconfig.json ├── prover-cluster │ ├── .gitignore │ ├── .pulumi │ │ ├── meta.yaml │ │ └── meta.yaml.attrs │ ├── Pulumi.prod-nightly-8453.yaml │ ├── Pulumi.prod-release-8453.yaml │ ├── Pulumi.staging-11155111.yaml │ ├── Pulumi.staging-84532.yaml │ ├── Pulumi.staging-nightly-84532.yaml │ ├── Pulumi.yaml │ ├── README.md │ ├── components │ │ ├── AutoScalingGroupComponent.ts │ │ ├── BaseComponent.ts │ │ ├── LaunchTemplateComponent.ts │ │ ├── ManagerComponent.ts │ │ ├── SecurityComponent.ts │ │ ├── WorkerClusterComponent.ts │ │ └── index.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── prover │ ├── .gitignore │ ├── Pulumi.l-prod-11155111.yaml │ ├── Pulumi.l-prod-8453.yaml │ ├── Pulumi.l-prod-84532.yaml │ ├── Pulumi.l-staging-84532.yaml │ ├── Pulumi.yaml │ ├── README │ ├── components │ │ ├── bentoBroker.ts │ │ ├── bonsaiBroker.ts │ │ └── brokerAlarms.ts │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── tomls │ │ └── bento │ │ │ ├── broker-dev.toml │ │ │ ├── broker-prod-11155111.toml │ │ │ ├── broker-prod-8453.toml │ │ │ ├── broker-prod-84532.toml │ │ │ └── broker-staging-84532.toml │ └── tsconfig.json ├── requestor-lists │ ├── .gitignore │ ├── Pulumi.l-prod.yaml │ ├── Pulumi.l-staging.yaml │ ├── Pulumi.yaml │ ├── README.md │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── sample │ ├── .gitignore │ ├── Pulumi.dev.yaml │ ├── Pulumi.prod.yaml │ ├── Pulumi.staging.yaml │ ├── Pulumi.yaml │ ├── README │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ ├── tsconfig.json │ └── util │ │ └── env.ts ├── slasher │ ├── .gitignore │ ├── Pulumi.l-prod-11155111.yaml │ ├── Pulumi.l-prod-8453.yaml │ ├── Pulumi.l-prod-84532.yaml │ ├── Pulumi.l-staging-84532.yaml │ ├── Pulumi.prod-11155111.yaml │ ├── Pulumi.prod-8453.yaml │ ├── Pulumi.prod-84532.yaml │ ├── Pulumi.staging-11155111.yaml │ ├── Pulumi.staging-84532.yaml │ ├── Pulumi.yaml │ ├── README │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json └── util │ ├── .gitignore │ ├── copy_config.sh │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── justfile ├── license-check.py ├── licenses ├── boundless-license-date └── boundless-license-grants ├── lychee.toml ├── offer.yaml ├── remappings.txt ├── request.yaml ├── requestor-lists ├── boundless-priority-list.large.json └── boundless-priority-list.standard.json ├── rust-toolchain.toml ├── rustfmt.toml ├── scripts ├── job_status.sh └── setup.sh └── test_keydb_compatibility.sh /.dockerignore: -------------------------------------------------------------------------------- 1 | target 2 | .git 3 | .gitignore 4 | .gitmodules 5 | compose.yml 6 | .env 7 | contracts/out 8 | broadcast 9 | cache 10 | .github 11 | scripts 12 | examples 13 | crates/**/target 14 | examples/**/target 15 | -------------------------------------------------------------------------------- /.dprint.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "markdown": { 3 | "ignoreDirective": "prettier-ignore", 4 | "ignoreFileDirective": "prettier-ignore-file", 5 | "ignoreStartDirective": "prettier-ignore-start", 6 | "ignoreEndDirective": "prettier-ignore-end" 7 | }, 8 | // Install more plugins: https://dprint.dev/plugins 9 | // "json": { 10 | // }, 11 | // "toml": { 12 | // }, 13 | // "dockerfile": { 14 | // }, 15 | "excludes": ["./docs/book", "lib"], 16 | "plugins": ["https://plugins.dprint.dev/markdown-0.17.8.wasm"] 17 | } 18 | -------------------------------------------------------------------------------- /.env.broker-template: -------------------------------------------------------------------------------- 1 | # Prover node configs 2 | 3 | RUST_LOG=info 4 | 5 | REDIS_HOST=redis 6 | REDIS_IMG=redis:7.2.5-alpine3.19 7 | 8 | POSTGRES_HOST=postgres 9 | POSTGRES_IMG=postgres:16.3-bullseye 10 | POSTGRES_DB=taskdb 11 | POSTGRES_PORT=5432 12 | POSTGRES_USER=worker 13 | POSTGRES_PASSWORD=password 14 | 15 | MINIO_HOST=minio 16 | MINIO_IMG=minio/minio:RELEASE.2024-05-28T17-19-04Z 17 | MINIO_ROOT_USER=admin 18 | MINIO_ROOT_PASS=password 19 | MINIO_BUCKET=workflow 20 | 21 | GRAFANA_IMG=grafana/grafana:11.0.0 22 | 23 | SEGMENT_SIZE=21 24 | RISC0_KECCAK_PO2=17 25 | 26 | PRIVATE_KEY= 27 | 28 | # Note you must use an RPC URL that supports event filters. Many free RPC providers 29 | # do not support them. 30 | RPC_URL= 31 | -------------------------------------------------------------------------------- /.env.localnet-template: -------------------------------------------------------------------------------- 1 | # Default anvil node and order stream endpoint 2 | export RPC_URL="http://localhost:8545" 3 | export ORDER_STREAM_URL="http://localhost:8585" 4 | 5 | ### Contracts ### 6 | # This will be copied to .env.localnet and filled with `just localnet` 7 | 8 | export VERIFIER_ADDRESS= 9 | export SET_VERIFIER_ADDRESS= 10 | export BOUNDLESS_MARKET_ADDRESS= 11 | export HIT_POINTS_ADDRESS= 12 | 13 | ### Wallets private keys ### 14 | # Note: This is a funded address by default with anvil test configuration (index 3). 15 | 16 | export PRIVATE_KEY="0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6" 17 | export ADDRESS="0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" 18 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | Cargo.lock binary 2 | *.iid binary 3 | # Artifacts are generated on build, from checked-in files. 4 | crates/boundless-market/src/contracts/artifacts/* binary 5 | crates/povw/src/contracts/artifacts/* binary 6 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # CODEOWNERS 2 | 3 | # Note: Order is important; the last matching pattern takes the most 4 | # precedence. 5 | 6 | * @boundless-xyz/maintainers @capossele @Wollac @zeroecco @austinabell @willemolding @zeroecco @ec2 7 | /docs/ @boundless-xyz/maintainers @capossele @Wollac @zeroecco @austinabell @willemolding @zeroecco @ec2 @neutronmoderator 8 | -------------------------------------------------------------------------------- /.github/workflows/linear.yml: -------------------------------------------------------------------------------- 1 | name: Find or create Linear issue for PR 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | branches: 7 | - main 8 | types: ["opened", "edited", "reopened", "synchronize"] 9 | 10 | permissions: 11 | pull-requests: write 12 | repository-projects: read 13 | 14 | concurrency: 15 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 16 | cancel-in-progress: false 17 | 18 | jobs: 19 | create-linear-issue-pr: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - name: checkout code 23 | uses: actions/checkout@v4 24 | - name: Find or create a Linear Issue 25 | uses: risc0/action-find-or-create-linear-issue@risc0 26 | with: 27 | github-token: ${{ secrets.GITHUB_TOKEN }} 28 | linear-api-key: ${{ secrets.LINEAR_API_KEY }} 29 | linear-team-key: "BM" 30 | linear-created-issue-state-id: "7a07543b-1fc1-48d6-ae7a-a6d042564224" # in progress 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiler files 2 | cache/ 3 | out/ 4 | build-info-reference/ 5 | **/node_modules/ 6 | 7 | # Ignores development broadcast logs 8 | /broadcast 9 | /broadcast/*/31337/ 10 | /broadcast/*/11155111/ 11 | /broadcast/**/dry-run/ 12 | 13 | # Ignore the file with RPC and Etherscan API keys for deployment. 14 | deployment_secrets.toml 15 | 16 | # Devnet logs 17 | /logs 18 | 19 | # Ignore all env files 20 | .env* 21 | # Except for the templates and running network env files 22 | !.env.broker-template 23 | !.env.localnet-template 24 | !.env.eth-sepolia 25 | !.env.base-sepolia 26 | !.env.base 27 | 28 | # Ignore broker config file(s) 29 | *broker*.toml 30 | 31 | # Cargo 32 | target/ 33 | 34 | # Misc 35 | .DS_Store 36 | .idea 37 | .aider* 38 | .claude 39 | **/CLAUDE.md 40 | **/AGENTS.md 41 | .cursor 42 | .codex 43 | 44 | 45 | # Ignore generated files 46 | contracts/src/EchoImageID.sol 47 | contracts/src/ResolveImageID.sol 48 | contracts/src/SetBuilderImageID.sol 49 | contracts/src/libraries/AssessorImageID.sol 50 | contracts/src/libraries/PovwImageID.sol 51 | contracts/src/libraries/UtilImageID.sol 52 | contracts/test/AssessorElf.sol 53 | contracts/test/EchoElf.sol 54 | contracts/test/PovwElf.sol 55 | contracts/test/ResolveElf.sol 56 | contracts/test/SetBuilderElf.sol 57 | contracts/test/UtilElf.sol 58 | 59 | # Lints & Format Caches 60 | .lycheecache 61 | # Ignore sccache install location created in CI 62 | sccache-v0.* 63 | 64 | # Ignore generated docs 65 | /docs 66 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/forge-std"] 2 | path = lib/forge-std 3 | url = https://github.com/foundry-rs/forge-std 4 | [submodule "lib/openzeppelin-contracts"] 5 | path = lib/openzeppelin-contracts 6 | url = https://github.com/OpenZeppelin/openzeppelin-contracts 7 | [submodule "lib/openzeppelin-contracts-upgradeable"] 8 | path = lib/openzeppelin-contracts-upgradeable 9 | url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable 10 | [submodule "lib/risc0-ethereum"] 11 | path = lib/risc0-ethereum 12 | url = https://github.com/risc0/risc0-ethereum 13 | [submodule "lib/openzeppelin-foundry-upgrades"] 14 | path = lib/openzeppelin-foundry-upgrades 15 | url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades 16 | [submodule "lib/solmate"] 17 | path = lib/solmate 18 | url = https://github.com/transmissions11/solmate 19 | [submodule "lib/steel"] 20 | path = lib/steel 21 | url = https://github.com/boundless-xyz/steel.git 22 | [submodule "lib/zkc"] 23 | path = lib/zkc 24 | url = https://github.com/boundless-xyz/zkc 25 | -------------------------------------------------------------------------------- /.ignore: -------------------------------------------------------------------------------- 1 | /lib/ 2 | -------------------------------------------------------------------------------- /.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "rust-analyzer.check.allTargets": true, 3 | "rust-analyzer.check.features": [], 4 | "rust-analyzer.check.extraEnv": { 5 | "RISC0_SKIP_BUILD": "1", 6 | "RISC0_SKIP_BUILD_KERNELS": "1" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "biomejs.biome", 4 | "EditorConfig.EditorConfig", 5 | "bradlc.vscode-tailwindcss", 6 | "unifiedjs.vscode-remark" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": [ 3 | "target", 4 | "crates/guest/resolve/resolve-guest/target", 5 | "crates/guest/util/echo/target", 6 | "crates/guest/util/identity/target", 7 | "crates/guest/assessor/assessor-guest/target", 8 | "crates/guest/set-builder/set-builder-guest/target", 9 | "examples/counter/target", 10 | "lib", 11 | "examples/counter/lib" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /Boundless_Logo black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boundless-xyz/boundless/33fa8f11388b4dad1ad946f426bc451fe31cd0c2/Boundless_Logo black.png -------------------------------------------------------------------------------- /_typos.toml: -------------------------------------------------------------------------------- 1 | [default.extend-words] 2 | groth = "groth" 3 | Groth = "Groth" 4 | -------------------------------------------------------------------------------- /bento/.sqlx/query-09bf971c1479e2e1210e8fc406f0a6b83c3a89757306068a8b39eb3e669bb9e0.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT create_stream($1, $2, $3, $4) as id", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "id", 9 | "type_info": "Uuid" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Text", 15 | "Int4", 16 | "Float4", 17 | "Text" 18 | ] 19 | }, 20 | "nullable": [ 21 | null 22 | ] 23 | }, 24 | "hash": "09bf971c1479e2e1210e8fc406f0a6b83c3a89757306068a8b39eb3e669bb9e0" 25 | } 26 | -------------------------------------------------------------------------------- /bento/.sqlx/query-2bbd0c900dd78c6bbfd9fd26169d514fa9836ccac402906287b8e8065401b4b6.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT * FROM update_task_progress($1, $2, $3) as updated", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "updated", 9 | "type_info": "Bool" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Uuid", 15 | "Text", 16 | "Float4" 17 | ] 18 | }, 19 | "nullable": [ 20 | null 21 | ] 22 | }, 23 | "hash": "2bbd0c900dd78c6bbfd9fd26169d514fa9836ccac402906287b8e8065401b4b6" 24 | } 25 | -------------------------------------------------------------------------------- /bento/.sqlx/query-4c18a58f2978cf38cb21861e588d6baff1e17c78408ada56ba40355232d034fe.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT job_id, task_id\n FROM tasks\n WHERE\n state = 'running' AND timeout_secs < EXTRACT(EPOCH FROM (now() - GREATEST(started_at, updated_at)))\n LIMIT $1", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "job_id", 9 | "type_info": "Uuid" 10 | }, 11 | { 12 | "ordinal": 1, 13 | "name": "task_id", 14 | "type_info": "Text" 15 | } 16 | ], 17 | "parameters": { 18 | "Left": [ 19 | "Int8" 20 | ] 21 | }, 22 | "nullable": [ 23 | false, 24 | false 25 | ] 26 | }, 27 | "hash": "4c18a58f2978cf38cb21861e588d6baff1e17c78408ada56ba40355232d034fe" 28 | } 29 | -------------------------------------------------------------------------------- /bento/.sqlx/query-676560153f5314b20b8249029c80a4b427ea0763d22556e99a96589abef72922.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT * FROM request_work($1)", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "job_id", 9 | "type_info": "Uuid" 10 | }, 11 | { 12 | "ordinal": 1, 13 | "name": "task_id", 14 | "type_info": "Text" 15 | }, 16 | { 17 | "ordinal": 2, 18 | "name": "task_def", 19 | "type_info": "Jsonb" 20 | }, 21 | { 22 | "ordinal": 3, 23 | "name": "prereqs", 24 | "type_info": "Jsonb" 25 | }, 26 | { 27 | "ordinal": 4, 28 | "name": "max_retries", 29 | "type_info": "Int4" 30 | } 31 | ], 32 | "parameters": { 33 | "Left": [ 34 | "Text" 35 | ] 36 | }, 37 | "nullable": [ 38 | null, 39 | null, 40 | null, 41 | null, 42 | null 43 | ] 44 | }, 45 | "hash": "676560153f5314b20b8249029c80a4b427ea0763d22556e99a96589abef72922" 46 | } 47 | -------------------------------------------------------------------------------- /bento/.sqlx/query-6bd30587f76885d761a33dd40230f799904e4d790546854087116317f725f0d8.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT id, state as \"state: _\", error, user_id FROM jobs WHERE id = $1", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "id", 9 | "type_info": "Uuid" 10 | }, 11 | { 12 | "ordinal": 1, 13 | "name": "state: _", 14 | "type_info": { 15 | "Custom": { 16 | "name": "job_state", 17 | "kind": { 18 | "Enum": [ 19 | "running", 20 | "done", 21 | "failed" 22 | ] 23 | } 24 | } 25 | } 26 | }, 27 | { 28 | "ordinal": 2, 29 | "name": "error", 30 | "type_info": "Text" 31 | }, 32 | { 33 | "ordinal": 3, 34 | "name": "user_id", 35 | "type_info": "Text" 36 | } 37 | ], 38 | "parameters": { 39 | "Left": [ 40 | "Uuid" 41 | ] 42 | }, 43 | "nullable": [ 44 | false, 45 | false, 46 | true, 47 | false 48 | ] 49 | }, 50 | "hash": "6bd30587f76885d761a33dd40230f799904e4d790546854087116317f725f0d8" 51 | } 52 | -------------------------------------------------------------------------------- /bento/.sqlx/query-7c9ffb3cea5e4d88731a2ce2002aa9fe7c4cf0fe70290acf5d5a457012329e5b.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT create_job($1, $2, $3, $4, $5) as id", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "id", 9 | "type_info": "Uuid" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Uuid", 15 | "Jsonb", 16 | "Int4", 17 | "Int4", 18 | "Text" 19 | ] 20 | }, 21 | "nullable": [ 22 | null 23 | ] 24 | }, 25 | "hash": "7c9ffb3cea5e4d88731a2ce2002aa9fe7c4cf0fe70290acf5d5a457012329e5b" 26 | } 27 | -------------------------------------------------------------------------------- /bento/.sqlx/query-98be52d31f130729d200e46dca8fb8bba9eed011f6bb6b2c18b8f3b8a3112acb.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT * FROM update_task_done($1, $2, $3) as updated", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "updated", 9 | "type_info": "Bool" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Uuid", 15 | "Text", 16 | "Jsonb" 17 | ] 18 | }, 19 | "nullable": [ 20 | null 21 | ] 22 | }, 23 | "hash": "98be52d31f130729d200e46dca8fb8bba9eed011f6bb6b2c18b8f3b8a3112acb" 24 | } 25 | -------------------------------------------------------------------------------- /bento/.sqlx/query-ad0b9dd321787be38b84b7be95c003e48a53b62043627987dcddf35fbe08dc6c.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT * FROM update_task_retry($1, $2) as updated", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "updated", 9 | "type_info": "Bool" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Uuid", 15 | "Text" 16 | ] 17 | }, 18 | "nullable": [ 19 | null 20 | ] 21 | }, 22 | "hash": "ad0b9dd321787be38b84b7be95c003e48a53b62043627987dcddf35fbe08dc6c" 23 | } 24 | -------------------------------------------------------------------------------- /bento/.sqlx/query-e1f13dbd0322f3cbc6cb5226c45974f8a57e7e5e06e12a799679c2a8ee4c968e.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "CALL create_task($1, $2, $3, $4, $5, $6, $7)", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Uuid", 9 | "Text", 10 | "Uuid", 11 | "Jsonb", 12 | "Jsonb", 13 | "Int4", 14 | "Int4" 15 | ] 16 | }, 17 | "nullable": [] 18 | }, 19 | "hash": "e1f13dbd0322f3cbc6cb5226c45974f8a57e7e5e06e12a799679c2a8ee4c968e" 20 | } 21 | -------------------------------------------------------------------------------- /bento/.sqlx/query-ef499e1ce903a51b633d7fe62f1fb00a8219d5ab4e9da02144d949ffefe6cef6.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT * FROM update_task_failed($1, $2, $3) as updated", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "updated", 9 | "type_info": "Bool" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Uuid", 15 | "Text", 16 | "Text" 17 | ] 18 | }, 19 | "nullable": [ 20 | null 21 | ] 22 | }, 23 | "hash": "ef499e1ce903a51b633d7fe62f1fb00a8219d5ab4e9da02144d949ffefe6cef6" 24 | } 25 | -------------------------------------------------------------------------------- /bento/crates/api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "api" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [dependencies] 14 | anyhow = { workspace = true } 15 | axum = "0.7" 16 | bonsai-sdk = { workspace = true } 17 | clap = { workspace = true, features = ["env", "derive"] } 18 | risc0-zkvm = { workspace = true } 19 | serde = { workspace = true } 20 | serde_json = { workspace = true } 21 | sqlx = { workspace = true } 22 | taskdb = { workspace = true } 23 | thiserror = { workspace = true } 24 | tokio = { workspace = true } 25 | tracing = { workspace = true } 26 | tracing-subscriber = { workspace = true, features = ["env-filter"] } 27 | uuid = { workspace = true, features = ["serde"] } 28 | workflow-common = { workspace = true } 29 | -------------------------------------------------------------------------------- /bento/crates/api/src/bin/rest_api.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | use anyhow::{Context, Result}; 7 | use api::Args; 8 | use clap::Parser; 9 | 10 | #[tokio::main] 11 | async fn main() -> Result<()> { 12 | tracing_subscriber::fmt() 13 | .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) 14 | .init(); 15 | 16 | let args = Args::parse(); 17 | api::run(&args).await.context("Running REST api failed")?; 18 | tracing::info!("REST_API task shutdown"); 19 | 20 | Ok(()) 21 | } 22 | -------------------------------------------------------------------------------- /bento/crates/bento-client/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "bento-client" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [[bin]] 14 | name = "bento_cli" 15 | path = "src/bento_cli.rs" 16 | 17 | [dependencies] 18 | anyhow = { workspace = true } 19 | bincode = "1.3.3" 20 | bonsai-sdk = { workspace = true } 21 | bytemuck = { workspace = true } 22 | clap = { workspace = true, features = ["env", "derive"] } 23 | risc0-zkvm = { workspace = true } 24 | sample-guest-common = { workspace = true } 25 | sample-guest-methods = { workspace = true } 26 | serde = { workspace = true } 27 | tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } 28 | tracing = { workspace = true } 29 | tracing-subscriber = { workspace = true, features = ["env-filter"] } 30 | -------------------------------------------------------------------------------- /bento/crates/sample-guest/common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sample-guest-common" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | [dependencies] 7 | risc0-zkvm = { workspace = true } 8 | serde = { version = "1.0", features = ["derive"] } 9 | -------------------------------------------------------------------------------- /bento/crates/sample-guest/common/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | use risc0_zkvm::sha::Digest; 7 | use serde::{Deserialize, Serialize}; 8 | 9 | #[derive(Deserialize, Serialize)] 10 | pub enum IterReq { 11 | Iter(u64), 12 | Composition(u64, Digest), 13 | CompositionKeccak([u8; 32], Digest, bool), 14 | DoubleComposition(u64, Digest, Digest), 15 | Keccak(String), 16 | KeccakUnion(usize), 17 | CompositionKeccakUnion(u64, Digest, usize), 18 | } 19 | 20 | pub const PANIC_STR: &str = "GUEST CODE PANIC TEST STRING"; 21 | -------------------------------------------------------------------------------- /bento/crates/sample-guest/methods/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sample-guest-methods" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | [package.metadata.risc0] 7 | methods = ["guest"] 8 | 9 | [build-dependencies] 10 | risc0-build = { workspace = true } 11 | -------------------------------------------------------------------------------- /bento/crates/sample-guest/methods/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | fn main() { 7 | risc0_build::embed_methods(); 8 | } 9 | -------------------------------------------------------------------------------- /bento/crates/sample-guest/methods/guest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "method_name" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | [workspace] 7 | 8 | [dependencies] 9 | bytemuck = "1.13" 10 | risc0-zkvm = { version = "3.0.3", default-features = false, features = ["std", "unstable"] } 11 | sample-guest-common = { path = "../../common" } 12 | tiny-keccak = { git = "https://github.com/risc0/tiny-keccak", rev = "7ff2b8465891d1cbb55a69e553e05d369ce41d72", features = [ 13 | "keccak", 14 | ] } 15 | -------------------------------------------------------------------------------- /bento/crates/sample-guest/methods/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | include!(concat!(env!("OUT_DIR"), "/methods.rs")); 7 | -------------------------------------------------------------------------------- /bento/crates/taskdb/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "taskdb" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [dependencies] 14 | anyhow = { workspace = true } 15 | serde = { workspace = true } 16 | serde_json = { workspace = true } 17 | sqlx = { workspace = true, features = [ 18 | "runtime-tokio", 19 | "postgres", 20 | "uuid", 21 | "macros", 22 | "bigdecimal", 23 | "chrono", 24 | "migrate", 25 | "json", 26 | "tls-rustls", 27 | ] } 28 | thiserror = { workspace = true } 29 | tokio = { workspace = true, features = ["rt-multi-thread", "macros", "signal"] } 30 | 31 | [dev-dependencies] 32 | clap = { workspace = true, features = ["derive"] } 33 | criterion = { version = "0.5", features = ["async_tokio"] } 34 | rand = "0.9.1" 35 | tracing = { workspace = true, features = ["log"] } 36 | tracing-subscriber = { workspace = true, features = ["fmt", "env-filter"] } 37 | 38 | [[bench]] 39 | name = "taskdb" 40 | harness = false 41 | -------------------------------------------------------------------------------- /bento/crates/taskdb/migrations/4_clear_completed_streams.sql: -------------------------------------------------------------------------------- 1 | -- clear out completed jobs 2 | CREATE OR REPLACE FUNCTION clear_completed_jobs() 3 | RETURNS INTEGER AS $$ 4 | DECLARE 5 | total_cleared INTEGER := 0; 6 | BEGIN 7 | -- Store the count before deletion 8 | SELECT COUNT(*) INTO total_cleared FROM jobs WHERE state = 'done'; 9 | 10 | -- Delete in correct order (respecting foreign keys) 11 | -- First delete task_deps (references tasks) 12 | DELETE FROM task_deps WHERE job_id IN (SELECT id FROM jobs WHERE state = 'done'); 13 | 14 | -- Then delete tasks (references streams) 15 | DELETE FROM tasks WHERE job_id IN (SELECT id FROM jobs WHERE state = 'done'); 16 | 17 | -- Delete orphaned streams (streams that are no longer referenced by any tasks) 18 | DELETE FROM streams WHERE id NOT IN (SELECT DISTINCT stream_id FROM tasks); 19 | 20 | -- Finally delete jobs 21 | DELETE FROM jobs WHERE state = 'done'; 22 | 23 | RETURN total_cleared; 24 | END; 25 | $$ LANGUAGE plpgsql; 26 | -------------------------------------------------------------------------------- /bento/crates/workflow-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "workflow-common" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [dependencies] 14 | anyhow = { workspace = true } 15 | aws-sdk-s3 = { workspace = true } 16 | bincode = { workspace = true } 17 | risc0-zkvm = { workspace = true } 18 | serde = { workspace = true } 19 | -------------------------------------------------------------------------------- /bento/crates/workflow/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "workflow" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [[bin]] 14 | name = "agent" 15 | path = "src/bin/agent.rs" 16 | 17 | [features] 18 | default = [] 19 | cuda = ["risc0-zkvm/cuda"] 20 | 21 | [dependencies] 22 | anyhow = { workspace = true } 23 | bincode = { workspace = true } 24 | bytemuck = { workspace = true } 25 | clap = { workspace = true, features = ["env", "derive"] } 26 | deadpool-redis = { workspace = true } 27 | hex = { workspace = true } 28 | nix = { version = "0.29", features = ["fs"] } 29 | rand = { workspace = true } 30 | redis = { workspace = true, features = ["tokio-rustls-comp", "tokio-comp"] } 31 | risc0-binfmt = { workspace = true } 32 | risc0-zkvm = { workspace = true, default-features = false, features = [ 33 | "prove", 34 | ] } 35 | serde = { workspace = true } 36 | serde_json = { workspace = true } 37 | signal-hook = "0.3" 38 | sqlx = { workspace = true } 39 | taskdb = { workspace = true } 40 | tempfile = { workspace = true } 41 | tokio = { workspace = true, features = ["process"] } 42 | tracing = { workspace = true } 43 | tracing-subscriber = { workspace = true, features = ["env-filter"] } 44 | uuid = { workspace = true } 45 | workflow-common = { workspace = true } 46 | -------------------------------------------------------------------------------- /bento/crates/workflow/src/bin/agent.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | use anyhow::{Context, Result}; 7 | use clap::Parser; 8 | use tracing_subscriber::filter::EnvFilter; 9 | use workflow::{Agent, Args}; 10 | 11 | #[tokio::main] 12 | async fn main() -> Result<()> { 13 | tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()).init(); 14 | 15 | let args = Args::parse(); 16 | let task_stream = args.task_stream.clone(); 17 | let agent = Agent::new(args).await.context("Failed to initialize Agent")?; 18 | 19 | sqlx::migrate!("../taskdb/migrations") 20 | .run(&agent.db_pool) 21 | .await 22 | .context("Failed to run migrations")?; 23 | 24 | tracing::info!("Successful agent startup! Worker type: {task_stream}"); 25 | 26 | // Poll until agent is signaled to exit: 27 | agent.poll_work().await.context("Exiting agent polling") 28 | } 29 | -------------------------------------------------------------------------------- /biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["./documentation/node_modules/@risc0/ui/config/biome.base.jsonc"], 3 | "files": { 4 | "includes": [ 5 | "**", 6 | "!**/crates", 7 | "!**/target", 8 | "!**/contracts/out", 9 | "!**/generated", 10 | "!**/lib", 11 | "!**/.turbo", 12 | "!**/.sqlx", 13 | "!**/documentation/**/*.ts.timestamp-*.mjs", 14 | "!**/site/dist/**" 15 | ] 16 | }, 17 | "linter": { 18 | "rules": { 19 | "style": { 20 | "noNonNullAssertion": "off" 21 | }, 22 | "correctness": { 23 | "noUnusedVariables": "off", 24 | "noUnusedImports": "off" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /contracts/reference-contract/test/Upgrade.t.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | pragma solidity ^0.8.26; 7 | 8 | import {Test} from "forge-std/Test.sol"; 9 | import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; 10 | import {Options as UpgradeOptions} from "openzeppelin-foundry-upgrades/Options.sol"; 11 | 12 | contract UpgradeTest is Test { 13 | function testUpgradeability() public { 14 | UpgradeOptions memory opts; 15 | opts.referenceContract = "build-info-reference:BoundlessMarket"; 16 | opts.referenceBuildInfoDir = "contracts/reference-contract/build-info-reference"; 17 | Upgrades.validateUpgrade("BoundlessMarket.sol:BoundlessMarket", opts); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /contracts/snapshots/BoundlessMarketBench.json: -------------------------------------------------------------------------------- 1 | { 2 | "fulfill (with callback): batch of 001": "129170", 3 | "fulfill (with callback): batch of 002": "211957", 4 | "fulfill (with callback): batch of 004": "378227", 5 | "fulfill (with callback): batch of 008": "709522", 6 | "fulfill (with callback): batch of 016": "1208438", 7 | "fulfill (with callback): batch of 032": "2238870", 8 | "fulfill (with selector): batch of 001": "89529", 9 | "fulfill (with selector): batch of 002": "132769", 10 | "fulfill (with selector): batch of 004": "221274", 11 | "fulfill (with selector): batch of 008": "388324", 12 | "fulfill (with selector): batch of 016": "723114", 13 | "fulfill (with selector): batch of 032": "1417729", 14 | "fulfill: batch of 001": "87281", 15 | "fulfill: batch of 002": "128256", 16 | "fulfill: batch of 004": "212234", 17 | "fulfill: batch of 008": "370240", 18 | "fulfill: batch of 016": "686422", 19 | "fulfill: batch of 032": "1343691", 20 | "fulfill: batch of 064": "2722486", 21 | "fulfill: batch of 128": "5673869" 22 | } -------------------------------------------------------------------------------- /contracts/src/IBoundlessMarketCallback.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | /// @title IBoundlessMarketCallback 8 | /// @notice Interface for handling proof callbacks from BoundlessMarket with proof verification 9 | /// @dev Inherit from this contract to implement custom proof handling logic for BoundlessMarket proofs 10 | interface IBoundlessMarketCallback { 11 | /// @notice Handles submitting proofs with RISC Zero proof verification 12 | /// @param imageId The ID of the RISC Zero guest image that produced the proof 13 | /// @param journal The output journal from the RISC Zero guest execution 14 | /// @param seal The cryptographic seal proving correct execution 15 | function handleProof(bytes32 imageId, bytes calldata journal, bytes calldata seal) external; 16 | } 17 | -------------------------------------------------------------------------------- /contracts/src/libraries/BoundlessMarketLib.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | pragma solidity ^0.8.26; 7 | 8 | import {IRiscZeroVerifier} from "risc0/IRiscZeroVerifier.sol"; 9 | 10 | library BoundlessMarketLib { 11 | string constant EIP712_DOMAIN = "IBoundlessMarket"; 12 | string constant EIP712_DOMAIN_VERSION = "1"; 13 | 14 | /// @notice ABI encode the constructor args for this contract. 15 | /// @dev This function exists to provide a type-safe way to ABI-encode constructor args, for 16 | /// use in the deployment process with OpenZeppelin Upgrades. Must be kept in sync with the 17 | /// signature of the BoundlessMarket constructor. 18 | function encodeConstructorArgs( 19 | IRiscZeroVerifier verifier, 20 | bytes32 assessorId, 21 | bytes32 deprecatedAssessorId, 22 | uint32 deprecatedAssessorDuration, 23 | address stakeTokenContract 24 | ) internal pure returns (bytes memory) { 25 | return abi.encode(verifier, assessorId, deprecatedAssessorId, deprecatedAssessorDuration, stakeTokenContract); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /contracts/src/types/AssessorCallback.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | struct AssessorCallback { 8 | /// @notice The index of the fill in the request 9 | uint16 index; 10 | /// @notice The address of the contract to call back 11 | address addr; 12 | /// @notice Maximum gas to use for the callback 13 | uint96 gasLimit; 14 | } 15 | -------------------------------------------------------------------------------- /contracts/src/types/AssessorJournal.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | import {AssessorCallback} from "./AssessorCallback.sol"; 8 | import {Selector} from "./Selector.sol"; 9 | 10 | /// @title Assessor Journal Struct 11 | /// @notice Represents the structured journal of the Assessor guest which verifies the signature(s) 12 | /// from client(s) and that the requirements are met by claim digest(s) in the Merkle tree committed 13 | /// to by the given root. 14 | struct AssessorJournal { 15 | /// @notice The (optional) callbacks for the requests committed by the assessor. 16 | AssessorCallback[] callbacks; 17 | /// @notice The (optional) selectors for the requests committed by the assessor. 18 | /// @dev This is used to verify the fulfillment of the request against its selector's seal. 19 | Selector[] selectors; 20 | /// @notice Root of the Merkle tree committing to the set of proven claims. 21 | /// @dev In the case of a batch of size one, this may simply be the eip712Digest of the `AssessorCommitment`. 22 | bytes32 root; 23 | /// @notice The address of the prover that produced the assessor receipt. 24 | address prover; 25 | } 26 | -------------------------------------------------------------------------------- /contracts/src/types/AssessorReceipt.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | import {AssessorCallback} from "./AssessorCallback.sol"; 8 | import {Selector} from "./Selector.sol"; 9 | 10 | /// @title AssessorReceipt Struct and Library 11 | /// @notice Represents the output of the assessor and proof of correctness, allowing request fulfillment. 12 | struct AssessorReceipt { 13 | /// @notice Cryptographic proof for the validity of the execution results. 14 | /// @dev This will be sent to the `IRiscZeroVerifier` associated with this contract. 15 | bytes seal; 16 | /// @notice Optional callbacks committed into the journal. 17 | AssessorCallback[] callbacks; 18 | /// @notice Optional selectors committed into the journal. 19 | Selector[] selectors; 20 | /// @notice Address of the prover 21 | address prover; 22 | } 23 | -------------------------------------------------------------------------------- /contracts/src/types/Callback.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | using CallbackLibrary for Callback global; 8 | 9 | /// @title Callback Struct and Library 10 | /// @notice Represents a callback configuration for proof delivery 11 | struct Callback { 12 | /// @notice The address of the contract to call back 13 | address addr; 14 | /// @notice Maximum gas to use for the callback 15 | uint96 gasLimit; 16 | } 17 | 18 | library CallbackLibrary { 19 | string constant CALLBACK_TYPE = "Callback(address addr,uint96 gasLimit)"; 20 | bytes32 constant CALLBACK_TYPEHASH = keccak256(bytes(CALLBACK_TYPE)); 21 | 22 | /// @notice Computes the EIP-712 digest for the given callback 23 | /// @param callback The callback to compute the digest for 24 | /// @return The EIP-712 digest of the callback 25 | function eip712Digest(Callback memory callback) internal pure returns (bytes32) { 26 | return keccak256(abi.encode(CALLBACK_TYPEHASH, callback.addr, callback.gasLimit)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /contracts/src/types/Selector.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | /// @title Selector - A representation of the bytes4 selector and its index within a batch. 8 | /// @dev This is only used as part of the AssessorJournal and AssessorReceipt. 9 | struct Selector { 10 | /// @notice Index within a batch where the selector is required. 11 | uint16 index; 12 | /// @notice The actual required selector. 13 | bytes4 value; 14 | } 15 | -------------------------------------------------------------------------------- /contracts/test/TestUtilsZKC.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | pragma solidity ^0.8.26; 7 | 8 | import {ZKC} from "zkc/ZKC.sol"; 9 | import {veZKC} from "zkc/veZKC.sol"; 10 | import {StakingRewards} from "zkc/rewards/StakingRewards.sol"; 11 | 12 | // Contracts definitions to force forge build to build the json for these contracts 13 | // so that they can be used by the test-utils crate 14 | 15 | contract TestUtilsZKC is ZKC {} 16 | 17 | contract TestUtilsVeZKC is veZKC {} 18 | 19 | contract TestUtilsStakingRewards is StakingRewards {} 20 | -------------------------------------------------------------------------------- /contracts/test/types/Input.t.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | pragma solidity ^0.8.26; 7 | 8 | import {Test} from "forge-std/Test.sol"; 9 | import {Input, InputLibrary, InputType} from "../../src/types/Input.sol"; 10 | 11 | contract InputTest is Test { 12 | function testCreateInlineInput() public pure { 13 | bytes memory data = "inline data"; 14 | Input memory input = InputLibrary.createInlineInput(data); 15 | 16 | assertEq(uint8(input.inputType), uint8(InputType.Inline), "Input type should be Inline"); 17 | assertEq(input.data, data, "Input data should match"); 18 | } 19 | 20 | function testCreateUrlInput() public pure { 21 | string memory url = "https://example.com"; 22 | Input memory input = InputLibrary.createUrlInput(url); 23 | 24 | assertEq(uint8(input.inputType), uint8(InputType.Url), "Input type should be Url"); 25 | assertEq(string(input.data), url, "Input data should match the URL"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /contracts/test/types/MerkleProofish.t.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | pragma solidity ^0.8.26; 7 | 8 | import {Test} from "forge-std/Test.sol"; 9 | import {MerkleProofish} from "../../src/libraries/MerkleProofish.sol"; 10 | 11 | contract MerkleProofishTest is Test { 12 | function testProcessTree2() public pure { 13 | bytes32[] memory leaves = new bytes32[](2); 14 | leaves[0] = 0x6a428060b5d51f04583182f2ff1b565f9db661da12ee7bdc003e9ab6d5d91ba9; 15 | leaves[1] = 0x6a428060b5d51f04583182f2ff1b565f9db661da12ee7bdc003e9ab6d5d91ba9; 16 | 17 | bytes32 root = MerkleProofish.processTree(leaves); 18 | assertEq(root, 0x5032880539b5d039d4a4a8042745c9ad14934c96b76d7e61ea03550e29b234af); 19 | } 20 | 21 | function testProcessTree3() public pure { 22 | bytes32[] memory leaves = new bytes32[](3); 23 | leaves[0] = 0x6a428060b5d51f04583182f2ff1b565f9db661da12ee7bdc003e9ab6d5d91ba9; 24 | leaves[1] = 0x6a428060b5d51f04583182f2ff1b565f9db661da12ee7bdc003e9ab6d5d91ba9; 25 | leaves[2] = 0x6a428060b5d51f04583182f2ff1b565f9db661da12ee7bdc003e9ab6d5d91ba9; 26 | 27 | bytes32 root = MerkleProofish.processTree(leaves); 28 | assertEq(root, 0xe004c72e4cb697fa97669508df099edbc053309343772a25e56412fc7db8ebef); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /contracts/test/types/RequestId.t.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | pragma solidity ^0.8.26; 7 | 8 | import {Test} from "forge-std/Test.sol"; 9 | import {RequestId, RequestIdLibrary} from "../../src/types/RequestId.sol"; 10 | 11 | contract RequestIdTest is Test { 12 | function testClientAndIndex() public view { 13 | address testClient = address(this); 14 | uint32 testIndex = 1; 15 | 16 | RequestId id = RequestIdLibrary.from(testClient, testIndex); 17 | (address client, uint32 index) = id.clientAndIndex(); 18 | assertEq(client, testClient, "Client address should match the original address"); 19 | assertEq(index, testIndex, "Index should match the original index"); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /crates/assessor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "boundless-assessor" 3 | description = "Assessor guest APIs, part of the Boundless Market" 4 | resolver = "2" 5 | version = { workspace = true } 6 | edition = { workspace = true } 7 | homepage = { workspace = true } 8 | repository = { workspace = true } 9 | license = "Apache-2.0" 10 | 11 | [dependencies] 12 | alloy-primitives = { workspace = true, features = ["k256"] } 13 | alloy-sol-types = { workspace = true, features = ["eip712-serde"] } 14 | boundless-market = { workspace = true } 15 | postcard = { workspace = true, features = ["alloc"] } 16 | risc0-zkvm = { workspace = true, features = ["unstable"] } 17 | serde = { workspace = true } 18 | thiserror = { workspace = true } 19 | 20 | [dev-dependencies] 21 | alloy = { workspace = true } 22 | guest-assessor = { workspace = true } 23 | guest-util = { workspace = true } 24 | risc0-zkvm = { workspace = true, features = ["client"] } 25 | test-log = { workspace = true } 26 | tokio = { workspace = true } 27 | -------------------------------------------------------------------------------- /crates/bench/README.md: -------------------------------------------------------------------------------- 1 | # Benchmark 2 | 3 | ## Local Devnet (Dev Mode) 4 | 5 | To run a benchmark against a local devnet: 6 | 7 | 1. Start a local devnet: 8 | 9 | ```bash 10 | just localnet up 11 | ``` 12 | 13 | 2. Export the env variables: 14 | 15 | ```bash 16 | source .env.localnet 17 | ``` 18 | 19 | 3. Start a broker 20 | 21 | Simplest way is just to run the binary in debug mode 22 | 23 | ``` 24 | RUST_LOG=info cargo run --bin broker 25 | ``` 26 | 27 | 4. Define your Benchmark config file. You can find an example in the [data folder](./data/small_test.json). 28 | 29 | 5. Estimate the benchmark cost (Optional) 30 | 31 | ```bash 32 | RUST_LOG=boundless_bench=info cargo run --bin boundless-bench -- --bench crates/bench/data/small_test.json --estimate 33 | ``` 34 | 35 | 6. Run your benchmark: 36 | 37 | ```bash 38 | RUST_LOG=boundless_bench=info cargo run --bin boundless-bench -- --bench crates/bench/data/small_test.json 39 | ``` 40 | 41 | 7. Process the results: 42 | 43 | ```bash 44 | python ./crates/bench/scripts/process.py ./out/bench_1747653790.csv 45 | ``` 46 | 47 | > Note: This workflow can be run with `RISC0_DEV_MODE=false` and with a full bento cluster. By default will run localnet in dev mode. 48 | 49 | ## Testnet 50 | 51 | To run a benchmark against a real deployment, just export the correct env variables, then follow the steps of the previous section. 52 | -------------------------------------------------------------------------------- /crates/bench/data/small_test.json: -------------------------------------------------------------------------------- 1 | { 2 | "cycle_count_per_request": 1000000, 3 | "requests_count": 400, 4 | "interval": 0, 5 | "timeout": 1200, 6 | "lock_timeout": 900, 7 | "min_price_per_mcycle": "0.0", 8 | "max_price_per_mcycle": "0.00001", 9 | "lockin_stake": "0.0", 10 | "ramp_up": 100, 11 | "threads": 4 12 | } -------------------------------------------------------------------------------- /crates/bench/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use anyhow::Result; 16 | use boundless_bench::{run, MainArgs}; 17 | use clap::Parser; 18 | 19 | #[tokio::main] 20 | async fn main() -> Result<()> { 21 | tracing_subscriber::fmt() 22 | .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) 23 | .init(); 24 | 25 | let args = MainArgs::parse(); 26 | 27 | run(&args).await?; 28 | 29 | Ok(()) 30 | } 31 | -------------------------------------------------------------------------------- /crates/boundless-cli/build.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use shadow_rs::ShadowBuilder; 16 | 17 | fn main() { 18 | ShadowBuilder::builder().build().unwrap(); 19 | println!("cargo:rustc-link-lib=static=ckzg"); 20 | println!("cargo:rustc-link-lib=static=blst"); 21 | } 22 | -------------------------------------------------------------------------------- /crates/boundless-cli/src/commands/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Commands within the Boundless CLI 16 | 17 | // TODO(victor): Move the main command groups (e.g. prove, request, account) to modules under this 18 | // one. 19 | 20 | pub mod povw; 21 | pub mod zkc; 22 | -------------------------------------------------------------------------------- /crates/boundless-market/README.md: -------------------------------------------------------------------------------- 1 | # Boundless Market SDK 2 | 3 | Boundless is the first universal ZK protocol that transforms how developers build with zero-knowledge proofs across any chain. 4 | Core to Boundless is a decentralized proof market. Competitive proving services ensure reliable delivery, liveness, and best-in-class pricing. 5 | 6 | This crate is the SDK for interacting with the Boundless Market. 7 | 8 | For more information about using Boundless, see [docs.beboundless.xyz](https://docs.beboundless.xyz). 9 | -------------------------------------------------------------------------------- /crates/boundless-market/src/contracts/artifacts/AssessorCallback.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | struct AssessorCallback { 8 | /// @notice The index of the fill in the request 9 | uint16 index; 10 | /// @notice The address of the contract to call back 11 | address addr; 12 | /// @notice Maximum gas to use for the callback 13 | uint96 gasLimit; 14 | } 15 | -------------------------------------------------------------------------------- /crates/boundless-market/src/contracts/artifacts/AssessorJournal.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | import {AssessorCallback} from "./AssessorCallback.sol"; 8 | import {Selector} from "./Selector.sol"; 9 | 10 | /// @title Assessor Journal Struct 11 | /// @notice Represents the structured journal of the Assessor guest which verifies the signature(s) 12 | /// from client(s) and that the requirements are met by claim digest(s) in the Merkle tree committed 13 | /// to by the given root. 14 | struct AssessorJournal { 15 | /// @notice The (optional) callbacks for the requests committed by the assessor. 16 | AssessorCallback[] callbacks; 17 | /// @notice The (optional) selectors for the requests committed by the assessor. 18 | /// @dev This is used to verify the fulfillment of the request against its selector's seal. 19 | Selector[] selectors; 20 | /// @notice Root of the Merkle tree committing to the set of proven claims. 21 | /// @dev In the case of a batch of size one, this may simply be the eip712Digest of the `AssessorCommitment`. 22 | bytes32 root; 23 | /// @notice The address of the prover that produced the assessor receipt. 24 | address prover; 25 | } 26 | -------------------------------------------------------------------------------- /crates/boundless-market/src/contracts/artifacts/AssessorReceipt.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | import {AssessorCallback} from "./AssessorCallback.sol"; 8 | import {Selector} from "./Selector.sol"; 9 | 10 | /// @title AssessorReceipt Struct and Library 11 | /// @notice Represents the output of the assessor and proof of correctness, allowing request fulfillment. 12 | struct AssessorReceipt { 13 | /// @notice Cryptographic proof for the validity of the execution results. 14 | /// @dev This will be sent to the `IRiscZeroVerifier` associated with this contract. 15 | bytes seal; 16 | /// @notice Optional callbacks committed into the journal. 17 | AssessorCallback[] callbacks; 18 | /// @notice Optional selectors committed into the journal. 19 | Selector[] selectors; 20 | /// @notice Address of the prover 21 | address prover; 22 | } 23 | -------------------------------------------------------------------------------- /crates/boundless-market/src/contracts/artifacts/Callback.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | using CallbackLibrary for Callback global; 8 | 9 | /// @title Callback Struct and Library 10 | /// @notice Represents a callback configuration for proof delivery 11 | struct Callback { 12 | /// @notice The address of the contract to call back 13 | address addr; 14 | /// @notice Maximum gas to use for the callback 15 | uint96 gasLimit; 16 | } 17 | 18 | library CallbackLibrary { 19 | string constant CALLBACK_TYPE = "Callback(address addr,uint96 gasLimit)"; 20 | bytes32 constant CALLBACK_TYPEHASH = keccak256(bytes(CALLBACK_TYPE)); 21 | 22 | /// @notice Computes the EIP-712 digest for the given callback 23 | /// @param callback The callback to compute the digest for 24 | /// @return The EIP-712 digest of the callback 25 | function eip712Digest(Callback memory callback) internal pure returns (bytes32) { 26 | return keccak256(abi.encode(CALLBACK_TYPEHASH, callback.addr, callback.gasLimit)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /crates/boundless-market/src/contracts/artifacts/Selector.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | pragma solidity ^0.8.26; 6 | 7 | /// @title Selector - A representation of the bytes4 selector and its index within a batch. 8 | /// @dev This is only used as part of the AssessorJournal and AssessorReceipt. 9 | struct Selector { 10 | /// @notice Index within a batch where the selector is required. 11 | uint16 index; 12 | /// @notice The actual required selector. 13 | bytes4 value; 14 | } 15 | -------------------------------------------------------------------------------- /crates/broker-stress/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "broker-stress" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [dependencies] 11 | alloy = { workspace = true, features = ["node-bindings"] } 12 | anyhow = { workspace = true } 13 | axum = { workspace = true } 14 | boundless-market = { workspace = true } 15 | boundless-test-utils = { workspace = true } 16 | broker = { path = "../broker", features = ["test-utils"] } 17 | clap = { workspace = true, features = ["derive"] } 18 | rand = { workspace = true } 19 | reqwest = { workspace = true } 20 | risc0-zkp = { workspace = true } 21 | serde_json = { workspace = true } 22 | tempfile = { workspace = true } 23 | tokio = { workspace = true, features = ["rt-multi-thread", "macros", "time", "signal", "process"] } 24 | tracing = { workspace = true } 25 | tracing-subscriber = { workspace = true, features = ["env-filter"] } 26 | url = { workspace = true } 27 | -------------------------------------------------------------------------------- /crates/broker-stress/README.md: -------------------------------------------------------------------------------- 1 | # Broker Stress Test 2 | 3 | This is a stress test for running the broker as a whole, with some chaos testing with random TCP errors. 4 | 5 | ## Usage 6 | 7 | [Install toxiproxy](https://github.com/Shopify/toxiproxy#1-installing-toxiproxy) 8 | 9 | ```sh 10 | RUST_LOG=info cargo run -p broker-stress -- --spawners 4 --rpc-reset-toxicity 0.0 11 | ``` 12 | 13 | > --rpc-reset-toxicity is the probability that the RPC connection will be reset (0.0-1.0) 14 | 15 | And to run with a file based DB: 16 | 17 | ```sh 18 | # Initialize the DB by calling VACUUM 19 | sqlite3 /tmp/broker.db "VACUUM;" 20 | 21 | RUST_LOG=info cargo run -p broker-stress -- --spawners 4 --database-url "sqlite:///tmp/broker.db" 22 | ``` 23 | -------------------------------------------------------------------------------- /crates/broker/migrations/1_broker.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE orders ( 2 | id TEXT PRIMARY KEY, 3 | data JSONB 4 | ); 5 | 6 | CREATE TABLE batches ( 7 | id INTEGER PRIMARY KEY AUTOINCREMENT, 8 | data JSONB 9 | ); 10 | 11 | CREATE TABLE last_block ( 12 | id INTEGER PRIMARY KEY, 13 | block TEXT 14 | ) -------------------------------------------------------------------------------- /crates/broker/migrations/2_fulfill_and_locked.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE fulfilled_requests ( 2 | id TEXT PRIMARY KEY, 3 | block_number INTEGER 4 | ); 5 | 6 | CREATE TABLE locked_requests ( 7 | id TEXT PRIMARY KEY, 8 | locker TEXT, 9 | block_number INTEGER 10 | ); 11 | -------------------------------------------------------------------------------- /crates/broker/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod e2e; 16 | -------------------------------------------------------------------------------- /crates/distributor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "boundless-distributor" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [dependencies] 14 | alloy = { workspace = true, features = ["network", "node-bindings", "rpc-types", "providers", "transports", "sol-types", "contract", "signers", "signer-local"] } 15 | anyhow = { workspace = true } 16 | boundless-market = { workspace = true } 17 | clap = { workspace = true, features = ["env"] } 18 | hex = { workspace = true } 19 | rand = { workspace = true } 20 | reqwest = { workspace = true } 21 | risc0-zkvm = { workspace = true, features = ["std", "default"] } 22 | tokio = { workspace = true, features = ["rt-multi-thread"] } 23 | tracing = { workspace = true } 24 | tracing-subscriber = { workspace = true, features = ["json", "fmt", "env-filter"] } 25 | url = { workspace = true } 26 | 27 | [dev-dependencies] 28 | boundless-test-utils = { workspace = true } 29 | tracing-test = { workspace = true } 30 | 31 | [features] 32 | -------------------------------------------------------------------------------- /crates/guest/assessor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "guest-assessor" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [build-dependencies] 11 | hex = { workspace = true } 12 | risc0-build = { workspace = true, features = ["unstable"] } 13 | risc0-build-ethereum = { workspace = true } 14 | 15 | [package.metadata.risc0] 16 | methods = ["assessor-guest"] 17 | 18 | [package.metadata.release] 19 | release = false 20 | -------------------------------------------------------------------------------- /crates/guest/assessor/assessor-guest/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "assessor-guest" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [workspace] 7 | 8 | [dependencies] 9 | alloy-primitives = { version = "1.0" } 10 | alloy-sol-types = { version = "1.0", features = ["eip712-serde"] } 11 | boundless-assessor = { path = "../../../assessor" } 12 | boundless-market = { path = "../../../boundless-market", default-features = false } 13 | risc0-zkvm = { version = "3.0.3", default-features = false, features = ["std", "unstable"] } 14 | 15 | [patch.crates-io] 16 | # use optimized risc0 circuit 17 | sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" } 18 | k256 = { git = "https://github.com/risc0/RustCrypto-elliptic-curves", tag = "k256/v0.13.4-risczero.1" } 19 | crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } 20 | -------------------------------------------------------------------------------- /crates/guest/assessor/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | include!(concat!(env!("OUT_DIR"), "/methods.rs")); 7 | -------------------------------------------------------------------------------- /crates/guest/util/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "guest-util" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [build-dependencies] 11 | hex = { workspace = true } 12 | risc0-build = { workspace = true } 13 | risc0-build-ethereum = { workspace = true } 14 | 15 | [package.metadata.risc0] 16 | methods = ["echo", "identity", "loop"] 17 | 18 | [package.metadata.release] 19 | release = false 20 | -------------------------------------------------------------------------------- /crates/guest/util/echo/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "echo" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [workspace] 7 | 8 | [dependencies] 9 | risc0-zkvm = { version = "3.0.3", default-features = false, features = ["std"] } 10 | -------------------------------------------------------------------------------- /crates/guest/util/echo/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use std::io::Read; 16 | 17 | use risc0_zkvm::guest::env; 18 | 19 | pub fn main() { 20 | // Read the entire input stream as raw bytes. 21 | let mut message = Vec::::new(); 22 | env::stdin().read_to_end(&mut message).unwrap(); 23 | 24 | // Commit exactly what the host provided to the journal. 25 | env::commit_slice(message.as_slice()); 26 | } 27 | -------------------------------------------------------------------------------- /crates/guest/util/identity/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "identity" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [workspace] 7 | 8 | [dependencies] 9 | postcard = "1.0" 10 | risc0-zkvm = { version = "3.0.3", default-features = false, features = ["std", "unstable", "disable-dev-mode"] } 11 | 12 | [patch.crates-io] 13 | sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" } 14 | -------------------------------------------------------------------------------- /crates/guest/util/identity/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Verify the receipt given as input and commit to its claim digest. 16 | 17 | #![no_main] 18 | 19 | use risc0_zkvm::{ 20 | guest::env, 21 | sha::{Digest, Digestible}, 22 | Receipt, 23 | }; 24 | 25 | risc0_zkvm::guest::entry!(main); 26 | 27 | pub fn main() { 28 | let bytes = env::read_frame(); 29 | let (image_id, receipt): (Digest, Receipt) = 30 | postcard::from_bytes(&bytes).expect("failed to deserialize input"); 31 | 32 | let claim = receipt.claim().unwrap(); 33 | receipt.verify(image_id).unwrap(); 34 | 35 | env::commit_slice(claim.digest().as_bytes()); 36 | } 37 | -------------------------------------------------------------------------------- /crates/guest/util/loop/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "loop" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [workspace] 7 | 8 | [dependencies] 9 | risc0-zkvm = { version = "3.0.3", default-features = false, features = ["std"] } 10 | -------------------------------------------------------------------------------- /crates/guest/util/loop/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use risc0_zkvm::guest::env; 16 | 17 | pub fn main() { 18 | let cycles: u64 = env::read(); 19 | // The nonce is used to ensure that the input is unique 20 | let nonce: u64 = env::read(); 21 | let mut last_cycles = env::cycle_count(); 22 | let mut tot_cycles = last_cycles; 23 | 24 | while tot_cycles < cycles { 25 | let now_cycles = env::cycle_count(); 26 | if now_cycles <= last_cycles { 27 | tot_cycles += now_cycles; 28 | } else { 29 | tot_cycles += now_cycles - last_cycles; 30 | } 31 | last_cycles = now_cycles; 32 | } 33 | 34 | env::commit(&(cycles, nonce)); 35 | } 36 | -------------------------------------------------------------------------------- /crates/guest/util/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | include!(concat!(env!("OUT_DIR"), "/methods.rs")); 16 | -------------------------------------------------------------------------------- /crates/indexer/migrations/12_address_history_indexes.sql: -------------------------------------------------------------------------------- 1 | -- These composite indexes optimize queries that filter by address and optionally by epoch range 2 | 3 | -- Index for staking history by address 4 | CREATE INDEX IF NOT EXISTS idx_staking_address_epoch 5 | ON staking_positions_by_epoch(staker_address, epoch DESC); 6 | 7 | -- Index for PoVW rewards history by address 8 | CREATE INDEX IF NOT EXISTS idx_povw_rewards_address_epoch 9 | ON povw_rewards_by_epoch(work_log_id, epoch DESC); 10 | 11 | -- Index for vote delegations received by delegate address 12 | CREATE INDEX IF NOT EXISTS idx_vote_delegation_delegate_epoch 13 | ON vote_delegation_powers_by_epoch(delegate_address, epoch DESC); 14 | 15 | -- Index for reward delegations received by delegate address 16 | CREATE INDEX IF NOT EXISTS idx_reward_delegation_delegate_epoch 17 | ON reward_delegation_powers_by_epoch(delegate_address, epoch DESC); -------------------------------------------------------------------------------- /crates/indexer/migrations/15_staking_rewards_refactor.sql: -------------------------------------------------------------------------------- 1 | -- Add rewards_generated field to track rewards created by positions (regardless of delegation) 2 | ALTER TABLE staking_positions_by_epoch 3 | ADD COLUMN rewards_generated TEXT NOT NULL DEFAULT '0000000000000000000000000000000000000000000000000000000000000000'; 4 | 5 | -- Add total_rewards_generated to track lifetime rewards generated by positions owned 6 | ALTER TABLE staking_positions_aggregate 7 | ADD COLUMN total_rewards_generated TEXT NOT NULL DEFAULT '0000000000000000000000000000000000000000000000000000000000000000'; 8 | 9 | -- Note: total_rewards_earned already exists and tracks rewards actually received 10 | -- This allows us to distinguish between: 11 | -- - total_rewards_generated: rewards created by positions owned by this address 12 | -- - total_rewards_earned: rewards actually received by this address (from own positions or delegations) -------------------------------------------------------------------------------- /crates/indexer/migrations/16_add_epoch_times_to_staking.sql: -------------------------------------------------------------------------------- 1 | -- Add epoch start and end times to staking summary table 2 | ALTER TABLE epoch_staking_summary 3 | ADD COLUMN epoch_start_time BIGINT NOT NULL DEFAULT 0; 4 | 5 | ALTER TABLE epoch_staking_summary 6 | ADD COLUMN epoch_end_time BIGINT NOT NULL DEFAULT 0; -------------------------------------------------------------------------------- /crates/indexer/migrations/17_add_updated_at_to_summaries.sql: -------------------------------------------------------------------------------- 1 | -- Add updated_at timestamps to summary tables 2 | -- Using TEXT for better compatibility with sqlx Any driver 3 | 4 | -- Add updated_at to global PoVW summary statistics 5 | ALTER TABLE povw_summary_stats 6 | ADD COLUMN updated_at TEXT; 7 | 8 | -- Add updated_at to per-epoch PoVW summary 9 | ALTER TABLE epoch_povw_summary 10 | ADD COLUMN updated_at TEXT; 11 | 12 | -- Add updated_at to global staking summary statistics 13 | ALTER TABLE staking_summary_stats 14 | ADD COLUMN updated_at TEXT; 15 | 16 | -- Add updated_at to per-epoch staking summary 17 | ALTER TABLE epoch_staking_summary 18 | ADD COLUMN updated_at TEXT; -------------------------------------------------------------------------------- /crates/indexer/migrations/18_order_stream_state.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS order_stream_state ( 2 | id BOOLEAN PRIMARY KEY DEFAULT TRUE, 3 | last_processed_timestamp TEXT 4 | ); 5 | 6 | INSERT INTO order_stream_state (id) VALUES (TRUE) 7 | ON CONFLICT (id) DO NOTHING; -------------------------------------------------------------------------------- /crates/indexer/migrations/19_add_request_source.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE proof_requests ADD COLUMN source TEXT NOT NULL DEFAULT 'unknown'; 2 | 3 | CREATE INDEX IF NOT EXISTS idx_proof_requests_source ON proof_requests(source); 4 | -------------------------------------------------------------------------------- /crates/indexer/migrations/1_transactions.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS last_block ( 2 | id INTEGER PRIMARY KEY, 3 | block TEXT 4 | ); 5 | 6 | CREATE TABLE IF NOT EXISTS transactions ( 7 | tx_hash TEXT PRIMARY KEY, 8 | block_number BIGINT NOT NULL, 9 | from_address TEXT NOT NULL, 10 | block_timestamp BIGINT NOT NULL 11 | ); 12 | -------------------------------------------------------------------------------- /crates/indexer/migrations/4_fulfillments.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS assessor_receipts ( 2 | tx_hash TEXT PRIMARY KEY REFERENCES transactions(tx_hash), 3 | prover_address TEXT NOT NULL, 4 | seal TEXT NOT NULL, 5 | block_number BIGINT NOT NULL, 6 | block_timestamp BIGINT NOT NULL 7 | ); 8 | 9 | CREATE TABLE IF NOT EXISTS fulfillments ( 10 | request_digest TEXT NOT NULL, 11 | request_id TEXT NOT NULL, 12 | prover_address TEXT NOT NULL, 13 | claim_digest TEXT NOT NULL, 14 | fulfillment_data_type TEXT NOT NULL, 15 | fulfillment_data TEXT, 16 | 17 | seal TEXT NOT NULL, 18 | tx_hash TEXT NOT NULL REFERENCES transactions(tx_hash), 19 | block_number BIGINT NOT NULL, 20 | block_timestamp BIGINT NOT NULL, 21 | PRIMARY KEY (request_digest, tx_hash) 22 | ); 23 | 24 | CREATE INDEX IF NOT EXISTS idx_fulfillments_request_id ON fulfillments(request_id); 25 | CREATE INDEX IF NOT EXISTS idx_fulfillments_prover_address ON fulfillments(prover_address); 26 | -------------------------------------------------------------------------------- /crates/indexer/migrations/5_metrics.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS metric_state ( 2 | id BOOLEAN PRIMARY KEY DEFAULT TRUE, 3 | last_run BIGINT NOT NULL DEFAULT 0 4 | ); 5 | 6 | INSERT INTO metric_state (id) VALUES (TRUE) 7 | ON CONFLICT (id) DO NOTHING; 8 | -------------------------------------------------------------------------------- /crates/indexer/migrations/6_blocks.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS blocks ( 2 | block_number BIGINT PRIMARY KEY, 3 | block_timestamp BIGINT NOT NULL 4 | ); 5 | -------------------------------------------------------------------------------- /crates/indexer/migrations/7_povw_rewards_by_epoch.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS povw_rewards_by_epoch ( 2 | work_log_id TEXT NOT NULL, 3 | epoch BIGINT NOT NULL, 4 | work_submitted TEXT NOT NULL, 5 | percentage DOUBLE PRECISION NOT NULL, 6 | uncapped_rewards TEXT NOT NULL, 7 | reward_cap TEXT NOT NULL, 8 | actual_rewards TEXT NOT NULL, 9 | is_capped INTEGER NOT NULL, 10 | updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 11 | PRIMARY KEY (work_log_id, epoch) 12 | ); 13 | 14 | CREATE INDEX idx_povw_rewards_epoch ON povw_rewards_by_epoch(epoch); 15 | CREATE INDEX idx_povw_rewards_actual ON povw_rewards_by_epoch(actual_rewards DESC); 16 | CREATE INDEX idx_povw_rewards_work_log ON povw_rewards_by_epoch(work_log_id); -------------------------------------------------------------------------------- /crates/indexer/migrations/8_povw_rewards_aggregate.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS povw_rewards_aggregate ( 2 | work_log_id TEXT PRIMARY KEY, 3 | total_work_submitted TEXT NOT NULL, 4 | total_actual_rewards TEXT NOT NULL, 5 | total_uncapped_rewards TEXT NOT NULL, 6 | epochs_participated BIGINT DEFAULT 0, 7 | updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 8 | ); 9 | 10 | CREATE INDEX idx_povw_aggregate_rewards ON povw_rewards_aggregate(total_actual_rewards DESC); 11 | CREATE INDEX idx_povw_aggregate_work ON povw_rewards_aggregate(total_work_submitted DESC); 12 | 13 | -- Table to store indexer state (current epoch, last processed block, etc) 14 | CREATE TABLE IF NOT EXISTS indexer_state ( 15 | key TEXT PRIMARY KEY, 16 | value TEXT NOT NULL, 17 | updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP 18 | ); -------------------------------------------------------------------------------- /crates/indexer/migrations/9_add_staked_amount.sql: -------------------------------------------------------------------------------- 1 | -- Add staked_amount column to povw_rewards_by_epoch table 2 | ALTER TABLE povw_rewards_by_epoch ADD COLUMN staked_amount TEXT NOT NULL DEFAULT '000000000000000000000000000000000000000000000000000000000000000000000000000000'; -------------------------------------------------------------------------------- /crates/indexer/src/db/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod market; 16 | pub mod rewards; 17 | 18 | use thiserror::Error; 19 | 20 | // Re-export common types from market module for backwards compatibility 21 | pub use market::{AnyDb, DbObj, IndexerDb, TxMetadata}; 22 | 23 | #[derive(Error, Debug)] 24 | pub enum DbError { 25 | #[error("SQL error {0:?}")] 26 | SqlErr(#[from] sqlx::Error), 27 | 28 | #[error("SQL Migration error {0:?}")] 29 | MigrateErr(#[from] sqlx::migrate::MigrateError), 30 | 31 | #[error("Invalid block number: {0}")] 32 | BadBlockNumb(String), 33 | 34 | #[error("Failed to set last block")] 35 | SetBlockFail, 36 | 37 | #[error("Invalid transaction: {0}")] 38 | BadTransaction(String), 39 | } 40 | -------------------------------------------------------------------------------- /crates/indexer/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod db; 16 | pub mod market; 17 | pub mod rewards; 18 | pub mod test_utils; 19 | 20 | // Re-export for backwards compatibility 21 | pub use market::{IndexerService, IndexerServiceConfig, ServiceError}; 22 | -------------------------------------------------------------------------------- /crates/indexer/src/market/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod service; 16 | 17 | pub use service::{IndexerService, IndexerServiceConfig, ServiceError}; 18 | -------------------------------------------------------------------------------- /crates/indexer/src/rewards/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod service; 16 | 17 | pub use service::{RewardsIndexerService, RewardsIndexerServiceConfig}; 18 | -------------------------------------------------------------------------------- /crates/indexer/tests/market.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Integration tests for market indexer 16 | 17 | // Test modules 18 | #[path = "market/basic.rs"] 19 | mod basic; 20 | -------------------------------------------------------------------------------- /crates/indexer/tests/rewards.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Integration tests for rewards indexer 16 | 17 | // Common test utilities 18 | #[path = "rewards/common/mod.rs"] 19 | mod common; 20 | 21 | // Test modules 22 | #[path = "rewards/delegations_integration.rs"] 23 | mod delegations_integration; 24 | 25 | #[path = "rewards/povw_integration.rs"] 26 | mod povw_integration; 27 | 28 | #[path = "rewards/staking_integration.rs"] 29 | mod staking_integration; 30 | -------------------------------------------------------------------------------- /crates/lambdas/indexer-api/local_test.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boundless-xyz/boundless/33fa8f11388b4dad1ad946f426bc451fe31cd0c2/crates/lambdas/indexer-api/local_test.db -------------------------------------------------------------------------------- /crates/lambdas/indexer-api/src/db.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use anyhow::Result; 16 | use boundless_indexer::db::rewards::{RewardsDb, RewardsDbObj}; 17 | use std::sync::Arc; 18 | 19 | /// Application state containing database connections 20 | pub struct AppState { 21 | pub rewards_db: RewardsDbObj, 22 | } 23 | 24 | impl AppState { 25 | /// Create new application state with database connection 26 | pub async fn new(database_url: &str) -> Result { 27 | tracing::info!("Connecting to database..."); 28 | 29 | // Create rewards database connection 30 | let rewards_db = RewardsDb::new(database_url).await?; 31 | let rewards_db: RewardsDbObj = Arc::new(rewards_db); 32 | 33 | tracing::info!("Database connection established"); 34 | 35 | Ok(Self { rewards_db }) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /crates/lambdas/indexer-api/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod db; 16 | pub mod handler; 17 | pub mod models; 18 | pub mod openapi; 19 | pub mod routes; 20 | pub mod utils; 21 | -------------------------------------------------------------------------------- /crates/lambdas/indexer-api/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use anyhow::Result; 16 | use lambda_http::{run, Error}; 17 | use tracing_subscriber::{fmt, prelude::*, EnvFilter}; 18 | 19 | mod db; 20 | mod handler; 21 | mod models; 22 | mod openapi; 23 | mod routes; 24 | mod utils; 25 | 26 | #[tokio::main] 27 | async fn main() -> Result<(), Error> { 28 | // Initialize tracing 29 | tracing_subscriber::registry() 30 | .with(fmt::layer()) 31 | .with(EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"))) 32 | .init(); 33 | 34 | tracing::info!("Starting indexer-api Lambda function"); 35 | 36 | // Get the axum app 37 | let app = handler::create_handler().await?; 38 | 39 | // Run the Lambda runtime with the axum app 40 | run(app).await 41 | } 42 | -------------------------------------------------------------------------------- /crates/lambdas/indexer-api/src/routes/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod delegations; 16 | pub mod povw; 17 | pub mod staking; 18 | -------------------------------------------------------------------------------- /crates/lambdas/indexer-monitor/.gitignore: -------------------------------------------------------------------------------- 1 | target -------------------------------------------------------------------------------- /crates/lambdas/indexer-monitor/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "indexer-monitor" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [dependencies] 14 | alloy = { workspace = true, default-features = false } 15 | anyhow = { workspace = true } 16 | aws-config = { version = "1.6", features = ["behavior-version-latest"] } 17 | aws-sdk-cloudwatch = "1.73" 18 | aws-smithy-types = "1.3" 19 | chrono = "0.4" 20 | lambda_runtime = "0.13.0" 21 | serde = { workspace = true, features = ["derive"] } 22 | serde_json = { workspace = true } 23 | sqlx = { workspace = true, features = [ "any", "postgres", "sqlite", "runtime-tokio", "json", "migrate", "macros", "runtime-tokio-rustls"] } 24 | tokio = { workspace = true, features = ["macros"] } 25 | tracing = { workspace = true } 26 | tracing-subscriber = { workspace = true, features = [ 27 | "fmt", 28 | "env-filter", 29 | ] } 30 | 31 | -------------------------------------------------------------------------------- /crates/lambdas/indexer-monitor/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod handler; 16 | pub mod monitor; 17 | -------------------------------------------------------------------------------- /crates/lambdas/indexer-monitor/src/main.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use indexer_monitor::handler::function_handler; 16 | use lambda_runtime::{run, service_fn, Error}; 17 | 18 | #[tokio::main] 19 | async fn main() -> Result<(), Error> { 20 | tracing_subscriber::fmt() 21 | .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) 22 | .with_ansi(false) 23 | .with_target(false) 24 | .with_line_number(true) 25 | .without_time() 26 | .json() 27 | .init(); 28 | 29 | run(service_fn(function_handler)).await 30 | } 31 | -------------------------------------------------------------------------------- /crates/order-generator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "boundless-order-generator" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [dependencies] 14 | alloy = { workspace = true, features = ["network", "node-bindings", "rpc-types", "providers", "transports", "sol-types", "contract", "signers", "signer-local"] } 15 | anyhow = { workspace = true } 16 | boundless-market = { workspace = true } 17 | clap = { workspace = true, features = ["env"] } 18 | hex = { workspace = true } 19 | rand = { workspace = true } 20 | reqwest = { workspace = true } 21 | risc0-zkvm = { workspace = true, features = ["std", "default"] } 22 | tokio = { workspace = true, features = ["rt-multi-thread"] } 23 | tracing = { workspace = true } 24 | tracing-subscriber = { workspace = true, features = ["json", "fmt", "env-filter"] } 25 | url = { workspace = true } 26 | 27 | [dev-dependencies] 28 | boundless-test-utils = { workspace = true } 29 | tracing-test = { workspace = true } 30 | 31 | [features] 32 | -------------------------------------------------------------------------------- /crates/order-stream/migrations/1_order_stream.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE orders ( 2 | id BIGSERIAL NOT NULL PRIMARY KEY, 3 | request_id TEXT NOT NULL, 4 | request_digest TEXT NOT NULL UNIQUE, 5 | order_data JSONB NOT NULL 6 | ); 7 | 8 | ALTER TABLE orders 9 | ADD CONSTRAINT unique_request_digest UNIQUE (request_digest); 10 | 11 | CREATE TABLE brokers ( 12 | addr BYTEA NOT NULL PRIMARY KEY, 13 | nonce TEXT NOT NULL, 14 | connections INTEGER NOT NULL DEFAULT 0 CHECK (connections >= 0) 15 | ) -------------------------------------------------------------------------------- /crates/order-stream/migrations/2_broker_updated.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE brokers ADD COLUMN updated_at TIMESTAMPTZ; 2 | -------------------------------------------------------------------------------- /crates/order-stream/migrations/3_order_time.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE orders ADD COLUMN created_at TIMESTAMPTZ; 2 | -------------------------------------------------------------------------------- /crates/order-stream/src/bin/order_stream.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use anyhow::Result; 16 | use clap::Parser; 17 | use order_stream::Args; 18 | 19 | #[tokio::main] 20 | async fn main() -> Result<()> { 21 | tracing_subscriber::fmt() 22 | .with_env_filter(tracing_subscriber::EnvFilter::from_default_env()) 23 | .init(); 24 | 25 | let args = Args::parse(); 26 | let result = order_stream::run(&args).await; 27 | if let Err(e) = result { 28 | tracing::error!("FATAL: {:?}", e); 29 | } 30 | 31 | Ok(()) 32 | } 33 | -------------------------------------------------------------------------------- /crates/povw/elfs/boundless-povw-log-updater.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boundless-xyz/boundless/33fa8f11388b4dad1ad946f426bc451fe31cd0c2/crates/povw/elfs/boundless-povw-log-updater.bin -------------------------------------------------------------------------------- /crates/povw/elfs/boundless-povw-log-updater.iid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boundless-xyz/boundless/33fa8f11388b4dad1ad946f426bc451fe31cd0c2/crates/povw/elfs/boundless-povw-log-updater.iid -------------------------------------------------------------------------------- /crates/povw/elfs/boundless-povw-mint-calculator.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boundless-xyz/boundless/33fa8f11388b4dad1ad946f426bc451fe31cd0c2/crates/povw/elfs/boundless-povw-mint-calculator.bin -------------------------------------------------------------------------------- /crates/povw/elfs/boundless-povw-mint-calculator.iid: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boundless-xyz/boundless/33fa8f11388b4dad1ad946f426bc451fe31cd0c2/crates/povw/elfs/boundless-povw-mint-calculator.iid -------------------------------------------------------------------------------- /crates/povw/log-updater/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "boundless-povw-log-updater" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [workspace] 7 | 8 | [dependencies] 9 | alloy-primitives = { version = "1.0", features = ["serde", "k256"] } 10 | alloy-sol-types = "1.0" 11 | borsh = { version = "1.5", default-features = false, features = ["std"] } 12 | boundless-povw = { path = "..", default-features = false } 13 | risc0-povw = { version = "0.4", default-features = false, features = ["guest"] } 14 | risc0-zkvm = { version = "3.0.3", default-features = false, features = ["std", "unstable"] } 15 | 16 | [patch.crates-io] 17 | # enable RISC Zero's precompiles 18 | blst = { git = "https://github.com/risc0/blst", tag = "v0.3.15-risczero.1" } 19 | c-kzg = { git = "https://github.com/risc0/c-kzg-4844", tag = "c-kzg/v2.1.1-risczero.2" } 20 | crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } 21 | k256 = { git = "https://github.com/risc0/RustCrypto-elliptic-curves", tag = "k256/v0.13.4-risczero.1" } 22 | sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.9-risczero.0" } 23 | tiny-keccak = { git = "https://github.com/risc0/tiny-keccak", tag = "tiny-keccak/v2.0.2-risczero.0" } 24 | -------------------------------------------------------------------------------- /crates/povw/mint-calculator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "boundless-povw-mint-calculator" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [workspace] 7 | 8 | [dependencies] 9 | alloy-primitives = { version = "1.0" } 10 | alloy-sol-types = { version = "1.0" } 11 | boundless-povw = { path = "..", default-features = false } 12 | risc0-steel = { git = "https://github.com/boundless-xyz/steel", branch = "release-2.4" } 13 | risc0-zkvm = { version = "3.0.3", default-features = false, features = ["std", "unstable"] } 14 | 15 | [patch.crates-io] 16 | # enable RISC Zero's precompiles 17 | blst = { git = "https://github.com/risc0/blst", tag = "v0.3.15-risczero.1" } 18 | c-kzg = { git = "https://github.com/risc0/c-kzg-4844", tag = "c-kzg/v2.1.1-risczero.2" } 19 | crypto-bigint = { git = "https://github.com/risc0/RustCrypto-crypto-bigint", tag = "v0.5.5-risczero.0" } 20 | k256 = { git = "https://github.com/risc0/RustCrypto-elliptic-curves", tag = "k256/v0.13.4-risczero.1" } 21 | sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.9-risczero.0" } 22 | tiny-keccak = { git = "https://github.com/risc0/tiny-keccak", tag = "tiny-keccak/v2.0.2-risczero.0" } 23 | -------------------------------------------------------------------------------- /crates/povw/src/contracts/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | //! Smart contract interfaces and bytecode for PoVW contracts. 7 | 8 | #[cfg(feature = "host")] 9 | pub mod bytecode; 10 | -------------------------------------------------------------------------------- /crates/povw/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | #[cfg(feature = "build-guest")] 7 | mod guest_artifacts { 8 | include!(concat!(env!("OUT_DIR"), "/methods.rs")); 9 | } 10 | 11 | #[cfg(not(feature = "build-guest"))] 12 | mod guest_artifacts { 13 | // NOTE: Image IDs are cast to [u32; 8] to match the auto-generated methods.rs file. 14 | 15 | pub const BOUNDLESS_POVW_MINT_CALCULATOR_ELF: &[u8] = 16 | include_bytes!("../elfs/boundless-povw-mint-calculator.bin"); 17 | pub const BOUNDLESS_POVW_MINT_CALCULATOR_ID: [u32; 8] = 18 | bytemuck::must_cast(*include_bytes!("../elfs/boundless-povw-mint-calculator.iid")); 19 | pub const BOUNDLESS_POVW_LOG_UPDATER_ELF: &[u8] = 20 | include_bytes!("../elfs/boundless-povw-log-updater.bin"); 21 | pub const BOUNDLESS_POVW_LOG_UPDATER_ID: [u32; 8] = 22 | bytemuck::must_cast(*include_bytes!("../elfs/boundless-povw-log-updater.iid")); 23 | } 24 | 25 | pub mod contracts; 26 | #[cfg(feature = "host")] 27 | pub mod deployments; 28 | pub mod log_updater; 29 | pub mod mint_calculator; 30 | pub mod zkc; 31 | -------------------------------------------------------------------------------- /crates/povw/src/zkc.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | alloy_sol_types::sol!("./src/contracts/artifacts/IZKC.sol",); 7 | -------------------------------------------------------------------------------- /crates/povw/update-guest-bins.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This hacky script will update the built binaries in the elfs folder. 4 | # It should be retired as soon as cargo risczero build has support to more natively handle this e.g. https://github.com/risc0/risc0/pull/3329. 5 | 6 | set -eo pipefail 7 | 8 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 9 | 10 | cargo risczero build --manifest-path "${SCRIPT_DIR:?}/log-updater/Cargo.toml" 11 | cp "${SCRIPT_DIR:?}/log-updater/target/riscv32im-risc0-zkvm-elf/docker/boundless-povw-log-updater.bin" "${SCRIPT_DIR:?}/elfs" 12 | r0vm --id --elf "${SCRIPT_DIR:?}/elfs/boundless-povw-log-updater.bin" | xxd -r -p > "${SCRIPT_DIR:?}/elfs/boundless-povw-log-updater.iid" 13 | 14 | cargo risczero build --manifest-path "${SCRIPT_DIR:?}/mint-calculator/Cargo.toml" 15 | cp "${SCRIPT_DIR:?}/mint-calculator/target/riscv32im-risc0-zkvm-elf/docker/boundless-povw-mint-calculator.bin" "${SCRIPT_DIR:?}/elfs" 16 | r0vm --id --elf "${SCRIPT_DIR:?}/elfs/boundless-povw-mint-calculator.bin" | xxd -r -p > "${SCRIPT_DIR:?}/elfs/boundless-povw-mint-calculator.iid" 17 | -------------------------------------------------------------------------------- /crates/requestor-lists/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "requestor-lists" 3 | version = { workspace = true } 4 | edition = { workspace = true } 5 | homepage = { workspace = true } 6 | repository = { workspace = true } 7 | 8 | [dependencies] 9 | alloy = { workspace = true, features = ["serde"] } 10 | reqwest = { version = "0.12", features = ["json"] } 11 | serde = { version = "1.0", features = ["derive"] } 12 | serde_json = "1.0" 13 | thiserror = "2.0" 14 | url = "2.5" 15 | -------------------------------------------------------------------------------- /crates/requestor-lists/tests/parse_example_list.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use requestor_lists::RequestorList; 16 | 17 | #[test] 18 | fn test_parse_boundless_recommended_list() { 19 | let json = include_str!("../../../requestor-lists/boundless-priority-list.standard.json"); 20 | let list = RequestorList::from_json(json).expect("Failed to parse list"); 21 | 22 | assert_eq!(list.name, "Boundless Recommended Priority List"); 23 | assert_eq!( 24 | list.description, 25 | "List of recommended priority requestors for provers. The request sizes here should be suitable for most provers." 26 | ); 27 | assert_eq!(list.schema_version.major, 1); 28 | assert_eq!(list.schema_version.minor, 0); 29 | assert_eq!(list.version.major, 1); 30 | assert_eq!(list.version.minor, 0); 31 | assert_eq!(list.requestors.len(), 1); 32 | } 33 | -------------------------------------------------------------------------------- /crates/rewards/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "boundless-rewards" 3 | description = "Rewards computation for Boundless PoVW system" 4 | resolver = "2" 5 | version = { workspace = true } 6 | edition = { workspace = true } 7 | homepage = { workspace = true } 8 | repository = { workspace = true } 9 | publish = false 10 | 11 | [dependencies] 12 | alloy = { version = "1.0.34", features = ["network", "providers", "transports", "sol-types", "contract", "rpc-client"] } 13 | anyhow = { workspace = true } 14 | boundless-povw = { workspace = true } 15 | boundless-zkc = { workspace = true } 16 | chrono = { workspace = true } 17 | futures-util = { workspace = true } 18 | serde = { workspace = true } 19 | tokio = { workspace = true } 20 | tracing = { workspace = true } 21 | 22 | [dev-dependencies] 23 | -------------------------------------------------------------------------------- /crates/rewards/README.md: -------------------------------------------------------------------------------- 1 | # Rewards 2 | 3 | Contains utility functions for fetching rewards data form chain, and pre-processing it to be used in other applications (e.g. explorers, indexers, jupyter notebooks) 4 | -------------------------------------------------------------------------------- /crates/slasher/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "boundless-slasher" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [dependencies] 14 | alloy = { workspace = true, features = ["network", "node-bindings", "rpc-types", "providers", "transports", "sol-types", "contract", "signers", "signer-local"] } 15 | anyhow = { workspace = true } 16 | async-trait = { workspace = true } 17 | boundless-market = { workspace = true } 18 | clap = { workspace = true } 19 | hex = { workspace = true } 20 | risc0-zkvm = { workspace = true, features = ["std", "default"] } 21 | sqlx = { workspace = true, features = [ "sqlite", "runtime-tokio", "json", "migrate", "macros" ] } 22 | thiserror = { workspace = true } 23 | tokio = { workspace = true, features = ["rt-multi-thread"] } 24 | tracing = { workspace = true } 25 | tracing-subscriber = { workspace = true, features = ["json","env-filter"] } 26 | url = { workspace = true } 27 | 28 | [dev-dependencies] 29 | boundless-cli = { workspace = true } 30 | boundless-test-utils = { workspace = true } 31 | futures-util = { workspace = true } 32 | risc0-ethereum-contracts = { workspace = true } 33 | tracing-test = { workspace = true } 34 | 35 | -------------------------------------------------------------------------------- /crates/slasher/migrations/1_slasher.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE orders ( 2 | id TEXT PRIMARY KEY, 3 | expires_at BIGINT NOT NULL, 4 | lock_expires_at BIGINT NOT NULL 5 | ); 6 | 7 | CREATE TABLE last_block ( 8 | id INTEGER PRIMARY KEY, 9 | block TEXT 10 | ) -------------------------------------------------------------------------------- /crates/zkc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "boundless-zkc" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [dependencies] 11 | alloy = { workspace = true, features = ["network", "node-bindings", "rpc-types", "providers", "transports", "sol-types", "contract", "signers", "signer-local"] } 12 | alloy-chains = "0.2" 13 | anyhow = "1.0" 14 | clap = { workspace = true } 15 | derive_builder = "0.20.2" 16 | risc0-zkvm = { workspace = true, features = ["client", "unstable"] } 17 | serde = { workspace = true } 18 | tokio = { workspace = true } 19 | tracing = { workspace = true } 20 | 21 | [dev-dependencies] 22 | boundless-test-utils = { workspace = true, features = ["povw"] } 23 | rand = "0.9" 24 | 25 | [build-dependencies] 26 | risc0-build = { workspace = true, features = ["unstable"] } 27 | risc0-build-ethereum = { workspace = true } 28 | serde_json = { version = "1.0" } 29 | 30 | [package.metadata.release] 31 | release = false 32 | -------------------------------------------------------------------------------- /crates/zkc/src/contracts/artifacts/IVotes.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity 0.8.26; 3 | 4 | import {IVotes as OZIVotes} from "@openzeppelin/contracts/interfaces/IERC5805.sol"; 5 | 6 | /// @title IVotes 7 | /// @notice Interface that extends OpenZeppelin's IVotes interface with custom errors 8 | /// @dev This allows us to extend the standard IVotes interface in the future if needed 9 | interface IVotes is OZIVotes { 10 | // Custom errors 11 | error CannotDelegateVotesWhileWithdrawing(); 12 | 13 | // This interface extends OpenZeppelin's IVotes interface 14 | } 15 | -------------------------------------------------------------------------------- /crates/zkc/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Use of this source code is governed by the Business Source License 4 | // as found in the LICENSE-BSL file. 5 | 6 | pub mod contracts; 7 | pub mod deployments; 8 | -------------------------------------------------------------------------------- /dockerfiles/broker.prebuilt.dockerfile: -------------------------------------------------------------------------------- 1 | # Dockerfile for pre-built broker binary 2 | # Usage: docker build -f dockerfiles/broker.prebuilt.dockerfile --build-arg BINARY_URL= -t broker:prebuilt . 3 | 4 | # Use Ubuntu 24.04 for GLIBC 2.38+ compatibility 5 | FROM ubuntu:24.04 6 | 7 | ARG BINARY_URL 8 | 9 | # Install runtime dependencies 10 | RUN apt-get update && \ 11 | apt-get install -y curl ca-certificates && \ 12 | rm -rf /var/lib/apt/lists/* 13 | 14 | # Download broker binary directly 15 | RUN if [ -z "$BINARY_URL" ]; then echo "ERROR: BINARY_URL is required" && exit 1; fi && \ 16 | mkdir -p /app && \ 17 | curl -L -o /app/broker "$BINARY_URL" && \ 18 | chmod +x /app/broker 19 | 20 | WORKDIR /app 21 | ENTRYPOINT ["/app/broker"] -------------------------------------------------------------------------------- /dockerfiles/ci-cache-creds.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boundless-xyz/boundless/33fa8f11388b4dad1ad946f426bc451fe31cd0c2/dockerfiles/ci-cache-creds.txt -------------------------------------------------------------------------------- /dockerfiles/compose.ci.yml: -------------------------------------------------------------------------------- 1 | services: 2 | broker: 3 | build: 4 | secrets: 5 | - ci_cache_creds 6 | cache_to: 7 | - type=s3,name=broker-cache,manifests_prefix=shared/boundless/docker/manifests/,blobs_prefix=shared/boundless/docker/blobs/,region=us-west-2,bucket=risc0-ci-cache,mode=max 8 | cache_from: 9 | - type=s3,name=broker-cache,manifests_prefix=shared/boundless/docker/manifests/,blobs_prefix=shared/boundless/docker/blobs/,region=us-west-2,bucket=risc0-ci-cache 10 | 11 | secrets: 12 | # Optional s3 credentials file, used in risc0 CI for sccache'ing inside docker builds. 13 | # unused in local builds, see sccache-config.sh for details. 14 | ci_cache_creds: 15 | file: ./dockerfiles/ci-cache-creds.txt 16 | -------------------------------------------------------------------------------- /dockerfiles/grafana/dashboards/dashboard.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'Folder' 5 | allowUiUpdates: true 6 | options: 7 | path: /etc/grafana/provisioning/dashboards -------------------------------------------------------------------------------- /dockerfiles/grafana/datasources/postgres.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: postgres-taskdb 5 | type: postgres 6 | url: $POSTGRES_HOST:$POSTGRES_PORT 7 | user: $POSTGRES_USER 8 | access: proxy 9 | basicAuth: false 10 | isDefault: true 11 | secureJsonData: 12 | password: '$POSTGRES_PASS' 13 | jsonData: 14 | sslmode: disable 15 | database: $POSTGRES_DB 16 | maxIdleConnsAuto: true 17 | maxIdleConns: 5 18 | maxOpenConns: 5 19 | connMaxLifetime: 14400 20 | postgresVersion: 1500 21 | timescaledb: false 22 | version: 1 23 | editable: true -------------------------------------------------------------------------------- /dockerfiles/grafana/datasources/sqlite.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: broker-sqlite-datasource 5 | type: frser-sqlite-datasource 6 | access: proxy 7 | isDefault: false 8 | editable: true 9 | jsonData: 10 | path: /db/broker.db 11 | -------------------------------------------------------------------------------- /dockerfiles/rest_api.dockerfile: -------------------------------------------------------------------------------- 1 | ARG S3_CACHE_PREFIX="public/rust-cache-docker-Linux-X64/sccache" 2 | 3 | FROM rust:1.85.0-bookworm AS builder 4 | 5 | RUN apt-get -qq update && apt-get install -y -q clang 6 | 7 | FROM builder AS rust-builder 8 | 9 | ARG S3_CACHE_PREFIX 10 | 11 | WORKDIR /src/ 12 | COPY . . 13 | RUN dockerfiles/sccache-setup.sh "x86_64-unknown-linux-musl" "v0.8.2" 14 | SHELL ["/bin/bash", "-c"] 15 | 16 | # Prevent sccache collision in compose-builds 17 | ENV SCCACHE_SERVER_PORT=4230 18 | 19 | RUN --mount=type=secret,id=ci_cache_creds,target=/root/.aws/credentials \ 20 | --mount=type=cache,target=/root/.cache/sccache/,id=bento_api_sccache \ 21 | source dockerfiles/sccache-config.sh ${S3_CACHE_PREFIX} && \ 22 | cargo build --manifest-path bento/Cargo.toml --release -p api --bin rest_api && \ 23 | cp bento/target/release/rest_api /src/rest_api && \ 24 | sccache --show-stats 25 | 26 | FROM rust:1.85.0-bookworm AS runtime 27 | 28 | RUN mkdir /app/ && \ 29 | apt -qq update && \ 30 | apt install -y -q openssl 31 | 32 | COPY --from=rust-builder /src/rest_api /app/rest_api 33 | ENTRYPOINT ["/app/rest_api"] 34 | -------------------------------------------------------------------------------- /dockerfiles/rest_api.prebuilt.dockerfile: -------------------------------------------------------------------------------- 1 | # Dockerfile for pre-built bento-rest-api binary 2 | # Usage: docker build -f dockerfiles/rest_api.prebuilt.dockerfile --build-arg BINARY_URL= -t bento-rest-api:prebuilt . 3 | 4 | # Use Ubuntu 24.04 for GLIBC 2.38+ compatibility 5 | FROM ubuntu:24.04 6 | 7 | ARG BINARY_URL 8 | 9 | # Install runtime dependencies matching non-prebuilt version 10 | RUN apt-get update && \ 11 | apt-get install -y openssl curl tar ca-certificates && \ 12 | rm -rf /var/lib/apt/lists/* 13 | 14 | # Download and extract bento bundle tar.gz 15 | RUN if [ -z "$BINARY_URL" ]; then echo "ERROR: BINARY_URL is required" && exit 1; fi && \ 16 | mkdir -p /app && \ 17 | curl -L -o /tmp/bento-bundle.tar.gz "$BINARY_URL" && \ 18 | tar -xzf /tmp/bento-bundle.tar.gz -C /tmp && \ 19 | mv /tmp/bento-bundle/bento-rest-api /app/rest_api && \ 20 | rm -rf /tmp/* 21 | 22 | WORKDIR /app 23 | ENTRYPOINT ["/app/rest_api"] -------------------------------------------------------------------------------- /dockerfiles/sccache-config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -u -o pipefail 3 | 4 | export CC="sccache clang" 5 | export CXX="sccache clang++" 6 | export SCCACHE_IDLE_TIMEOUT=0 7 | export CARGO_INCREMENTAL=0 8 | export CARGO_PROFILE_DEV_DEBUG=0 9 | export CMAKE_C_COMPILER_LAUNCHER=sccache 10 | export CMAKE_CXX_COMPILER_LAUNCHER=sccache 11 | export RUSTC_WRAPPER=sccache 12 | S3_CACHE_PREFIX=$1 13 | 14 | if [ -f /root/.aws/credentials ]; then 15 | CREDS_FILE_SIZE=$(stat -c%s /root/.aws/credentials) 16 | if [ $CREDS_FILE_SIZE -gt 0 ]; then 17 | export SCCACHE_BUCKET="risc0-ci-cache" 18 | export SCCACHE_REGION="us-west-2" 19 | export SCCACHE_S3_KEY_PREFIX=$S3_CACHE_PREFIX 20 | 21 | echo "Using s3 [$SCCACHE_BUCKET/$SCCACHE_S3_KEY_PREFIX] caching and sccache..." 22 | else 23 | echo "Using local sccache" 24 | export SCCACHE_DIR=/root/.cache/sccache/ 25 | fi 26 | else 27 | echo "Using local sccache" 28 | export SCCACHE_DIR=/root/.cache/sccache/ 29 | fi -------------------------------------------------------------------------------- /dockerfiles/sccache-setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e -u -o pipefail 3 | 4 | SCCACHE_ARCH=$1 5 | SCCACHE_VERSION=$2 6 | SCCACHE_FILE=sccache-$SCCACHE_VERSION-$SCCACHE_ARCH 7 | SCCACHE_URL=https://github.com/mozilla/sccache/releases/download 8 | curl -L "$SCCACHE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz 9 | mv -f $SCCACHE_FILE/sccache /usr/local/bin 10 | -------------------------------------------------------------------------------- /documentation/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | tab_width = 4 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | end_of_line = lf 10 | -------------------------------------------------------------------------------- /documentation/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | node_modules 4 | 5 | dist 6 | vocs.config.ts.* 7 | .vercel 8 | tsconfig.tsbuildinfo 9 | site/pages/smart-contracts 10 | site/pages/tmp 11 | 12 | site/public/link-previews.json 13 | vocs.config.tsx.timestamp-*.mjs 14 | -------------------------------------------------------------------------------- /documentation/.remarkrc: -------------------------------------------------------------------------------- 1 | { 2 | "settings": { 3 | "bullet": "-", 4 | "emphasis": "_", 5 | "rule": "-", 6 | "resourceLink": true, 7 | "tightDefinitions": true 8 | }, 9 | "plugins": [ 10 | "remark-preset-lint-consistent", 11 | "remark-preset-lint-recommended", 12 | "remark-preset-lint-markdown-style-guide", 13 | "remark-frontmatter", 14 | "remark-gfm", 15 | "remark-directive", 16 | "remark-remove-url-trailing-slash", 17 | "remark-math", 18 | ["remark-lint-heading-case", ["warn", "title"]], 19 | ["remark-lint-no-shortcut-reference-link", false], 20 | ["remark-lint-maximum-line-length", false], 21 | ["remark-lint-list-item-spacing", false], 22 | ["remark-lint-list-item-indent", false], 23 | ["remark-lint-ordered-list-marker-value", false], 24 | ["remark-lint-maximum-heading-length", false], 25 | ["remark-lint-no-file-name-mixed-case", false], 26 | ["remark-lint-emphasis-marker", "_"] 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /documentation/README.md: -------------------------------------------------------------------------------- 1 | # Boundless Documentation 2 | 3 | Welcome to the Boundless documentation. 4 | 5 | ## Contents 6 | 7 | - [Getting Started](#getting-started) 8 | - [Contributing](#contributing) 9 | 10 | ## Prerequisites 11 | 12 | - [Bun](https://bun.sh) 13 | 14 | ## Getting Started 15 | 16 | 1. Clone the repository 17 | 18 | ```bash 19 | git clone https://github.com/boundless-xyz/boundless.git 20 | ``` 21 | 22 | 2. Install dependencies 23 | 24 | ```bash 25 | bun install 26 | ``` 27 | 28 | 3. Start the development server 29 | 30 | ```bash 31 | bun run dev 32 | ``` 33 | 34 | 4. Open your browser and navigate to `http://localhost:5173` 35 | 36 | ## Contributing 37 | 38 | 1. Create your feature branch 39 | 2. Submit a pull request with your changes 40 | -------------------------------------------------------------------------------- /documentation/doc-test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "doc-test" 3 | resolver = "2" 4 | version = { workspace = true } 5 | edition = { workspace = true } 6 | homepage = { workspace = true } 7 | repository = { workspace = true } 8 | publish = false 9 | 10 | [package.metadata.release] 11 | release = false 12 | 13 | [dev-dependencies] 14 | alloy = { workspace = true } 15 | alloy-primitives = { workspace = true } 16 | alloy-sol-types = { workspace = true } 17 | anyhow = "1.0" 18 | boundless-market = { workspace = true } 19 | postcard = { workspace = true } 20 | risc0-steel = { git = "https://github.com/boundless-xyz/steel", branch = "release-2.4", features = ["host"] } 21 | risc0-zkvm = { workspace = true, default-features = false, features = ["std"] } 22 | tracing = { workspace = true } 23 | url = { workspace = true } 24 | 25 | [build-dependencies] 26 | glob = "0.3" 27 | regex = "1.11" 28 | -------------------------------------------------------------------------------- /documentation/doc-test/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2025 RISC Zero, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | include!(concat!(env!("OUT_DIR"), "/doctests.rs")); 16 | -------------------------------------------------------------------------------- /documentation/site/components/strip-rust-code-comments.tsx: -------------------------------------------------------------------------------- 1 | import { type PropsWithChildren, type ReactNode, cloneElement } from "react"; 2 | 3 | function hasHashPrefix(node: ReactNode): boolean { 4 | if (typeof node === "string") { 5 | return node.startsWith("# "); 6 | } 7 | 8 | if (Array.isArray(node)) { 9 | return node.some((child) => hasHashPrefix(child)); 10 | } 11 | 12 | if (node && typeof node === "object" && "props" in node) { 13 | return hasHashPrefix(node.props.children); 14 | } 15 | 16 | return false; 17 | } 18 | 19 | function shouldKeepLine(node: ReactNode): boolean { 20 | if (node && typeof node === "object" && "props" in node) { 21 | if (node.props.className?.includes("line")) { 22 | return !hasHashPrefix(node.props.children); 23 | } 24 | } 25 | 26 | return true; 27 | } 28 | 29 | function processNode(node: ReactNode, index: number): ReactNode { 30 | if (Array.isArray(node)) { 31 | return node.filter((child) => shouldKeepLine(child)).map((child, i) => processNode(child, i)); 32 | } 33 | 34 | if (node && typeof node === "object" && "props" in node) { 35 | return cloneElement(node, { ...node.props, key: index }, processNode(node.props.children, index)); 36 | } 37 | 38 | return node; 39 | } 40 | 41 | export function StripRustCodeComments({ children }: PropsWithChildren) { 42 | return processNode(children, 0); 43 | } 44 | -------------------------------------------------------------------------------- /documentation/site/components/youtube-embed.tsx: -------------------------------------------------------------------------------- 1 | import type React from "react"; 2 | 3 | interface YoutubeEmbedProps { 4 | videoId: string; 5 | } 6 | 7 | export const YoutubeEmbed: React.FC = ({ videoId }) => { 8 | return ( 9 |
20 |