Skip to content

fix: demo deploy verification and README corrections#296

Merged
nahimterrazas merged 2 commits intoopenintentsframework:mainfrom
0xrcinus:fix/demo-deploy-and-readme-corrections
Feb 19, 2026
Merged

fix: demo deploy verification and README corrections#296
nahimterrazas merged 2 commits intoopenintentsframework:mainfrom
0xrcinus:fix/demo-deploy-and-readme-corrections

Conversation

@0xrcinus
Copy link
Contributor

@0xrcinus 0xrcinus commented Feb 12, 2026

Summary

This PR fixes several issues encountered when running the solver-demo locally, along with README documentation corrections.

Code Fixes

On-chain contract verification before skipping deployment (crates/solver-demo/src/operations/env/mod.rs)

When init load is used with a config file that already contains contract addresses (e.g., the checked-in config/demo.toml), the session gets populated with those addresses. Previously, env deploy would see these addresses and silently skip deployment — even on a fresh Anvil where no contracts exist. The env setup step would then mint tokens to nonexistent contracts, leaving all balances at 0 with no error.

The deploy() method now calls verify_contracts_onchain() which does an eth_getCode check on the input_settler address. If no code is found, deployment proceeds.

Fix Permit2 bytecode path (crates/solver-demo/src/operations/env/deploy.rs)

Changed from CARGO_MANIFEST_DIR/src/operations/env/data/permit2_bytecode.hex to CARGO_MANIFEST_DIR/data/permit2_bytecode.hex, matching the documented location in crates/solver-demo/data/.

README Fixes

  • Token CLI syntax: Fixed token balance, token mint, and token approve examples to use the correct flag syntax (--account, --chain, --token, --amount, --spender) instead of positional args
  • Malformed JSON: Fixed missing closing quote in curl example ("user": "0x74...,"user": "0x74...",)
  • Rust version: Updated prerequisite from 1.86.0+ to 1.88.0+ to match rust-toolchain.toml
  • oif-contracts prerequisite: Added clone + forge build step to the solver-demo Quick Start since the demo requires compiled contract artifacts in oif-contracts/out/

Testing

  • All 434 unit tests pass
  • Full end-to-end demo flow verified: init loadenv startenv deployenv setuptoken balance shows correct 1000 token balances
  • Verified the previously broken flow (init load config/demo.toml on fresh Anvil) now works correctly

Summary by CodeRabbit

  • Documentation

    • README fixes (JSON snippet), raised Rust toolchain requirement, added explicit clone/build steps for contracts in Quick Start and solver demo, and standardized token CLI and balance examples to flag-based syntax.
  • Improvements

    • Deployment now verifies contracts on-chain per chain, skips unnecessary redeploys, adds clearer per-chain logging, and runs per-chain deployments in parallel.
  • Bug Fixes

    • Fixed resolution so required deployment bytecode/artifacts are located correctly.

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Refactors solver-demo deployment to verify per-chain contracts on-chain (skip or redeploy) and run per-chain deployment tasks in parallel; adjusts Permit2 bytecode path resolution; updates docs/Quick Start to require Rust 1.88.0+, add oif-contracts clone/build steps, and standardize token CLI flag syntax; fixes a README JSON snippet.

Changes

Cohort / File(s) Summary
Documentation
README.md
Bump Rust toolchain requirement to 1.88.0+, add cloning/build steps for oif-contracts and mention build artifacts location; standardize token CLI flags (--chain, --token, --amount, --spender) and unify token balance syntax; fix truncated JSON snippet.
Permit2 Bytecode Path
crates/solver-demo/src/operations/env/deploy.rs
Load embedded Permit2 bytecode from data/permit2_bytecode.hex relative to the Cargo manifest directory instead of the previous src/.../data/ path.
Deployment & Verification Logic
crates/solver-demo/src/operations/env/mod.rs
Add async verify_contracts_onchain(chain) to check on-chain bytecode at configured addresses; refactor deployment decision flow to: deploy if forced or no local contracts, otherwise verify on-chain and skip or redeploy based on result; spawn per-chain deployment tasks, await results, update session and TOML placeholders, and add per-chain logging.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as CLI
  participant EnvOps as EnvOps
  participant Session as Session
  participant Provider as Provider
  participant Deployer as Deployer

  CLI->>EnvOps: start deploy (chains, force?)
  EnvOps->>Session: get local contracts for chain
  alt no local contracts
    EnvOps->>Deployer: deploy chain
  else force == true
    EnvOps->>Deployer: deploy chain
  else local contracts exist and not forced
    EnvOps->>Provider: fetch code at configured address
    Provider-->>EnvOps: code or error
    alt code non-empty
      EnvOps->>EnvOps: log "Skipping chain (contracts verified on-chain)"
    else code empty
      EnvOps->>Deployer: deploy chain (re-deploy)
    else error
      EnvOps->>Deployer: deploy chain (could not verify on-chain)
    end
  end
  Deployer-->>EnvOps: deployed addresses
  EnvOps->>Session: store deployment addresses
  EnvOps->>CLI: report completion
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I nibbled docs and bytecode trails so bright,

checked each chain's door for code before the flight,
skipped what was waiting, re-ran what was bare,
spun tasks in parallel with a twitch of my hair,
a happy rabbit hops—deployments take flight.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely summarizes the main changes: demo deployment verification fixes and README corrections, matching the primary objectives.
Description check ✅ Passed The description covers all required template sections (Summary, Testing Process, Checklist) with comprehensive details about code fixes, README corrections, and testing verification.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@README.md`:
- Around line 986-987: Update the README entry that currently reads "Rust
toolchain (stable, 1.88.0+)" to remove the plus so it matches the pinned version
in rust-toolchain.toml; change the line to "Rust toolchain (stable, 1.88.0)" to
reflect the exact locked toolchain.
🧹 Nitpick comments (1)
crates/solver-demo/src/operations/env/mod.rs (1)

289-317: Checking only input_settler may miss partial deployment failures.

If a previous deployment crashed mid-way, input_settler could have code on-chain while later contracts (e.g., output_settler, allocator) were never deployed. The demo would then skip redeployment, leaving the environment incomplete.

For a demo tool this is likely acceptable, but consider documenting that --force (or env deploy --all) should be used if a deployment was interrupted, or check one more contract (e.g., the last one deployed: output_oracle) as a basic sanity check.

@0xrcinus 0xrcinus force-pushed the fix/demo-deploy-and-readme-corrections branch from c633080 to 3f943e3 Compare February 12, 2026 11:22
Copy link
Collaborator

@nahimterrazas nahimterrazas left a comment

Choose a reason for hiding this comment

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

Thanks @0xrcinus! LGTM.

Copy link
Collaborator

@shahnami shahnami left a comment

Choose a reason for hiding this comment

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

LGTM!

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/solver-demo/src/operations/env/mod.rs 0.0% 21 Missing ⚠️
crates/solver-demo/src/operations/env/deploy.rs 0.0% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@nahimterrazas
Copy link
Collaborator

same here! + clippy @0xrcinus thanks!

@0xrcinus 0xrcinus force-pushed the fix/demo-deploy-and-readme-corrections branch from 3f943e3 to ab9eb98 Compare February 18, 2026 22:26
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/solver-demo/src/operations/env/mod.rs (1)

190-196: Log the verification error for debuggability.

The Err(_) wildcard discards the actual error, making it harder to diagnose why on-chain verification failed (e.g., RPC timeout, DNS failure, invalid config). Include it in the log message.

🔧 Proposed fix
-				Err(_) => {
+				Err(e) => {
 					logging::verbose_operation(
 						"Re-deploying chain",
-						&format!("{chain} (could not verify on-chain)"),
+						&format!("{chain} (could not verify on-chain: {e})"),
 					);
 					true
 				},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/solver-demo/src/operations/env/mod.rs` around lines 190 - 196, The
Err(_) arm discards the verification error; change the match to capture the
error (e.g., Err(e)) and include its details in the logging::verbose_operation
message so the log shows the chain and the underlying error (reference the
Err(_) pattern in the match and the logging::verbose_operation call in mod.rs) —
ensure the message concatenates or formats the error (e) so RPC/DNS/config
errors are visible for debugging.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/solver-demo/src/operations/env/mod.rs`:
- Around line 190-196: The Err(_) arm discards the verification error; change
the match to capture the error (e.g., Err(e)) and include its details in the
logging::verbose_operation message so the log shows the chain and the underlying
error (reference the Err(_) pattern in the match and the
logging::verbose_operation call in mod.rs) — ensure the message concatenates or
formats the error (e) so RPC/DNS/config errors are visible for debugging.

@0xrcinus
Copy link
Contributor Author

Thanks @nahimterrazas , should be fixed now!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
crates/solver-demo/src/operations/env/mod.rs (2)

188-194: Include the error in the "could not verify on-chain" log message.

The Err(_) arm drops the error value entirely. When verification fails for any reason (provider unreachable, misconfigured RPC URL, network timeout, etc.) the log only says "could not verify on-chain", giving no diagnostic information. The resulting re-deploy might also be undesirable (e.g., contracts are deployed but the RPC endpoint is temporarily down).

♻️ Proposed fix
-				Err(_) => {
+				Err(e) => {
 					logging::verbose_operation(
 						"Re-deploying chain",
-						&format!("{chain} (could not verify on-chain)"),
+						&format!("{chain} (could not verify on-chain: {e})"),
 					);
 					true
 				},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/solver-demo/src/operations/env/mod.rs` around lines 188 - 194, Change
the Err(_) arm so it captures the error (e.g., Err(e)) instead of discarding it,
and include that error in the verbose log for the "Re-deploying chain" message;
update the call to logging::verbose_operation that currently formats "{chain}
(could not verify on-chain)" to include the error (e.g., "{chain} (could not
verify on-chain: {error})") so callers of the branch can see
provider/RPC/timeouts or other diagnostics—the change should be made where the
match/closure contains the Err(_) arm that returns true and uses
logging::verbose_operation.

297-314: verify_contracts_onchain checks only input_settler as a proxy for all contracts.

If input_settler was deployed in a prior run but other contracts (e.g., output_settler, permit2, tokens) were not — a partial-deploy scenario — this function returns Ok(true) and the entire chain is skipped, leaving the environment in a broken state. For an atomically-deployed demo this is low risk, but worth noting as the single check can mask partial deployment failures.

Additionally, if contracts.input_settler is None while session.has_contracts(chain) is true (a plausible config state), this returns Err(InvalidConfig(...)) which is silently swallowed by the Err(_) arm and triggers a re-deploy. The user sees "could not verify on-chain" with no indication that the root cause is a missing input_settler field in the config.

Consider checking a second independent contract (e.g., output_settler or permit2) to reduce the probability of a false positive, or document the single-check limitation explicitly in the function doc.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/solver-demo/src/operations/env/mod.rs` around lines 297 - 314, The
verify_contracts_onchain function currently only probes contracts.input_settler
which can give false positives on partial deployments and hides missing
input_settler when session.has_contracts(chain) is true; update
verify_contracts_onchain to validate at least two independent contracts (e.g.,
contracts.input_settler and contracts.output_settler, or input_settler and
contracts.permit2) by parsing both addresses (Address::parse) and fetching both
codes via provider.inner().get_code_at(addr).await, and only return Ok(true) if
both codes are present; also change the error handling so a missing
input_settler (None) when session.has_contracts(chain) is true returns or
propagates Error::InvalidConfig with a clear message instead of being silently
mapped to a generic "could not verify on-chain" path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/solver-demo/src/operations/env/mod.rs`:
- Around line 188-194: Change the Err(_) arm so it captures the error (e.g.,
Err(e)) instead of discarding it, and include that error in the verbose log for
the "Re-deploying chain" message; update the call to logging::verbose_operation
that currently formats "{chain} (could not verify on-chain)" to include the
error (e.g., "{chain} (could not verify on-chain: {error})") so callers of the
branch can see provider/RPC/timeouts or other diagnostics—the change should be
made where the match/closure contains the Err(_) arm that returns true and uses
logging::verbose_operation.
- Around line 297-314: The verify_contracts_onchain function currently only
probes contracts.input_settler which can give false positives on partial
deployments and hides missing input_settler when session.has_contracts(chain) is
true; update verify_contracts_onchain to validate at least two independent
contracts (e.g., contracts.input_settler and contracts.output_settler, or
input_settler and contracts.permit2) by parsing both addresses (Address::parse)
and fetching both codes via provider.inner().get_code_at(addr).await, and only
return Ok(true) if both codes are present; also change the error handling so a
missing input_settler (None) when session.has_contracts(chain) is true returns
or propagates Error::InvalidConfig with a clear message instead of being
silently mapped to a generic "could not verify on-chain" path.

@nahimterrazas
Copy link
Collaborator

Thanks @0xrcinus, the project required that commits must have verified signatures, so I can merge, apparently one of your comments was not signed. Also, verify Clippy too

@0xrcinus 0xrcinus force-pushed the fix/demo-deploy-and-readme-corrections branch from 97b6bd6 to a0a9d6d Compare February 19, 2026 13:34
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
crates/solver-demo/src/operations/env/mod.rs (1)

188-194: Log the verification error instead of discarding it.

The Err(_) arm silently drops the underlying cause (RPC failure, parse error, etc.). When a user hits this branch unexpectedly, the log line gives no actionable signal.

♻️ Proposed fix
-				Err(_) => {
+				Err(e) => {
 					logging::verbose_operation(
 						"Re-deploying chain",
-						&format!("{chain} (could not verify on-chain)"),
+						&format!("{chain} (could not verify on-chain: {e})"),
 					);
 					true
 				},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/solver-demo/src/operations/env/mod.rs` around lines 188 - 194, The
Err(_) match arm that calls logging::verbose_operation when on-chain
verification fails should capture the error (e.g., Err(err)) and include its
details in the log instead of discarding it; change the pattern to Err(err) and
update the formatted message passed to logging::verbose_operation (or add a
second log call) to include err (use Debug/Display as appropriate) so
RPC/parsing errors are visible during "Re-deploying chain" handling.
README.md (1)

1056-1058: git clone is not idempotent — re-running Quick Start will error if oif-contracts/ already exists.

A user who re-runs these steps (e.g., after pulling updates or rebuilding) will get fatal: destination path 'oif-contracts' already exists.

📝 Proposed fix for idempotent clone
-# 0. Clone and build the OIF contracts (needed for local deployment)
-git clone https://github.com/openintentsframework/oif-contracts.git
-cd oif-contracts && forge build && cd ..
+# 0. Clone and build the OIF contracts (needed for local deployment)
+[ -d oif-contracts ] || git clone https://github.com/openintentsframework/oif-contracts.git
+cd oif-contracts && forge build && cd ..
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 1056 - 1058, The README's clone step isn't
idempotent: replace the single "git clone
https://github.com/openintentsframework/oif-contracts.git" line with a safe
check that skips cloning if the oif-contracts directory exists (or updates it),
e.g. use a shell guard like: if [ -d oif-contracts ]; then cd oif-contracts &&
git pull --rebase; else git clone
https://github.com/openintentsframework/oif-contracts.git; fi && cd
oif-contracts && forge build && cd .. so re-running Quick Start won't fail when
oif-contracts already exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@README.md`:
- Line 1048: Update the README entry that currently reads "Rust toolchain
(stable, 1.88.0+)" to remove the trailing plus so it matches the exact pinned
version in rust-toolchain.toml; replace the string with "Rust toolchain (stable,
1.88.0)" to ensure consistency with the pinned 1.88.0 toolchain.

---

Nitpick comments:
In `@crates/solver-demo/src/operations/env/mod.rs`:
- Around line 188-194: The Err(_) match arm that calls
logging::verbose_operation when on-chain verification fails should capture the
error (e.g., Err(err)) and include its details in the log instead of discarding
it; change the pattern to Err(err) and update the formatted message passed to
logging::verbose_operation (or add a second log call) to include err (use
Debug/Display as appropriate) so RPC/parsing errors are visible during
"Re-deploying chain" handling.

In `@README.md`:
- Around line 1056-1058: The README's clone step isn't idempotent: replace the
single "git clone https://github.com/openintentsframework/oif-contracts.git"
line with a safe check that skips cloning if the oif-contracts directory exists
(or updates it), e.g. use a shell guard like: if [ -d oif-contracts ]; then cd
oif-contracts && git pull --rebase; else git clone
https://github.com/openintentsframework/oif-contracts.git; fi && cd
oif-contracts && forge build && cd .. so re-running Quick Start won't fail when
oif-contracts already exists.

@nahimterrazas nahimterrazas merged commit 9679337 into openintentsframework:main Feb 19, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments