Skip to content

feat: deploy scripts for midprice pino#2164

Open
LukasDeco wants to merge 1 commit intomasterfrom
lukas/midprice-pino-deploy-scripts
Open

feat: deploy scripts for midprice pino#2164
LukasDeco wants to merge 1 commit intomasterfrom
lukas/midprice-pino-deploy-scripts

Conversation

@LukasDeco
Copy link
Copy Markdown
Collaborator

@LukasDeco LukasDeco commented Mar 25, 2026

Summary by CodeRabbit

  • New Features
    • Added automated build tooling for the midprice_pino Solana program.
    • Added deployment capability to Solana devnet with configurable environment settings.
    • Added IDL update functionality for program metadata management.
    • Introduced build and deployment automation through command-line interface.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

Walkthrough

New deployment automation framework added for the midprice_pino Solana program. Includes a Makefile orchestrating three shell scripts—build, deploy, and IDL update—plus a Cargo.toml manifest defining the program's dependencies.

Changes

Cohort / File(s) Summary
Devnet Deployment Orchestration
deploy-scripts/midprice_pino/Makefile, deploy-scripts/midprice_pino/build-devnet.sh, deploy-scripts/midprice_pino/deploy-devnet.sh, deploy-scripts/midprice_pino/update-devnet-idl.sh
Makefile defines .PHONY targets (build-devnet, deploy-devnet, update-devnet-idl) with configurable environment variables for RPC, keypairs, and IDL location. Three shell scripts implement build (cargo compile to .so), deployment (solana program deploy), and IDL metadata update (npx @solana-program/program-metadata write idl) with path resolution, validation, and error handling.
Program Manifest
programs/midprice_pino/Cargo.toml
Cargo manifest for midprice_pino crate (v0.1.0, 2021 edition) configured as cdylib library. Dependencies include pinocchio, pinocchio-log, local path dependency on midprice_book_view, and Solana-related crates (solana-pubkey, solana-address with curve25519 and decode features, solana-account-view optional/dev-only).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hop along the devnet path
Scripts build, deploy, with no wrath
IDL updates dance so bright
Midprice soars to blockchain height!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat: deploy scripts for midprice pino' directly and clearly summarizes the main change—the addition of deployment scripts for the midprice_pino Solana program. It is concise, specific, and accurately reflects the core changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


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

Copy link
Copy Markdown

@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: 2

🧹 Nitpick comments (3)
deploy-scripts/midprice_pino/build-devnet.sh (1)

27-27: Consider making --tools-version configurable.

The tools version v1.52 is hardcoded, which may become outdated as Solana SDK evolves. Consider making this configurable via an environment variable for easier maintenance.

♻️ Proposed improvement
+SBF_TOOLS_VERSION="${SBF_TOOLS_VERSION:-v1.52}"
+
 echo "Building midprice_pino in $MIDPRICE_DIR..."
 mkdir -p "$ROOT/target/deploy"
-(cd "$MIDPRICE_DIR" && cargo build-sbf --tools-version v1.52)
+(cd "$MIDPRICE_DIR" && cargo build-sbf --tools-version "$SBF_TOOLS_VERSION")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deploy-scripts/midprice_pino/build-devnet.sh` at line 27, The hardcoded tools
version in the build command should be made configurable: introduce an
environment variable (e.g., SBF_TOOLS_VERSION or MIDPRICE_SBF_TOOLS_VERSION)
with a default of "v1.52" and replace the literal "--tools-version v1.52" in the
build-devnet.sh invocation "(cd \"$MIDPRICE_DIR\" && cargo build-sbf
--tools-version v1.52)" to use that variable so callers can override the tools
version without editing the script.
deploy-scripts/midprice_pino/update-devnet-idl.sh (2)

57-60: Pin @solana-program/program-metadata to a specific version instead of using @latest.

Using @latest in a deployment script creates non-reproducible builds and risks breaking changes. Pin to a specific version like @0.5.1 (current latest, published Feb 2026) or document the required version.

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

In `@deploy-scripts/midprice_pino/update-devnet-idl.sh` around lines 57 - 60,
Replace the non-reproducible npx invocation that uses
`@solana-program/program-metadata`@latest in the exec command with a specific
pinned version (e.g., `@0.5.1`) so deployments are deterministic; update the exec
line invoking npx `@solana-program/program-metadata` (used to write idl) to
reference the chosen version and, if desired, add a short comment in the script
documenting the pinned version and why it was chosen.

34-48: Consider adding an example or template idl.json file for clarity.

The script requires an idl.json file which is not included in this PR. While the error handling (lines 44-48) clearly documents how to provide it via IDL_JSON environment variable, users invoking make update-devnet-idl without prior knowledge will encounter the error. Since midprice_pino is a Pinocchio program (not Anchor), the IDL must be manually created and provided. Adding a sample or template idl.json in deploy-scripts/midprice_pino/ would improve discoverability.

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

In `@deploy-scripts/midprice_pino/update-devnet-idl.sh` around lines 34 - 48, The
script checks for IDL_JSON and will fail if the IDL file is missing (see
IDL_JSON check and error block), so add a template/sample IDL at
deploy-scripts/midprice_pino/idl.json and document its usage so users running
make update-devnet-idl have something to start from; create a minimal idl.json
example matching the midprice_pino program shape (instructions, accounts, types)
and commit it next to the script, and optionally add a one-line note in the
script or README referencing IDL_JSON and the sample file to make discovery
explicit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@deploy-scripts/midprice_pino/Makefile`:
- Around line 34-48: The Makefile uses relative script paths which break when
invoked from another directory; add a top-level MIDPRICE_MK_DIR variable (e.g.
MIDPRICE_MK_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))) and update
the targets build-devnet, deploy-devnet, and update-devnet-idl to call scripts
via "$(MIDPRICE_MK_DIR)/build-devnet.sh", "$(MIDPRICE_MK_DIR)/deploy-devnet.sh",
and "$(MIDPRICE_MK_DIR)/update-devnet-idl.sh" respectively while preserving
exported environment variables.

In `@programs/midprice_pino/Cargo.toml`:
- Line 1: Remove the standalone [workspace] declaration from this crate's
Cargo.toml (the lone "[workspace]" header) so it doesn't define its own
workspace; delete that section/header entirely so the crate is only a member of
the root workspace which already includes programs/*.

---

Nitpick comments:
In `@deploy-scripts/midprice_pino/build-devnet.sh`:
- Line 27: The hardcoded tools version in the build command should be made
configurable: introduce an environment variable (e.g., SBF_TOOLS_VERSION or
MIDPRICE_SBF_TOOLS_VERSION) with a default of "v1.52" and replace the literal
"--tools-version v1.52" in the build-devnet.sh invocation "(cd \"$MIDPRICE_DIR\"
&& cargo build-sbf --tools-version v1.52)" to use that variable so callers can
override the tools version without editing the script.

In `@deploy-scripts/midprice_pino/update-devnet-idl.sh`:
- Around line 57-60: Replace the non-reproducible npx invocation that uses
`@solana-program/program-metadata`@latest in the exec command with a specific
pinned version (e.g., `@0.5.1`) so deployments are deterministic; update the exec
line invoking npx `@solana-program/program-metadata` (used to write idl) to
reference the chosen version and, if desired, add a short comment in the script
documenting the pinned version and why it was chosen.
- Around line 34-48: The script checks for IDL_JSON and will fail if the IDL
file is missing (see IDL_JSON check and error block), so add a template/sample
IDL at deploy-scripts/midprice_pino/idl.json and document its usage so users
running make update-devnet-idl have something to start from; create a minimal
idl.json example matching the midprice_pino program shape (instructions,
accounts, types) and commit it next to the script, and optionally add a one-line
note in the script or README referencing IDL_JSON and the sample file to make
discovery explicit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 18ea7ee9-f859-46b3-a614-c59065a03718

📥 Commits

Reviewing files that changed from the base of the PR and between 19c096f and 31e824c.

⛔ Files ignored due to path filters (1)
  • programs/midprice_pino/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • deploy-scripts/midprice_pino/Makefile
  • deploy-scripts/midprice_pino/build-devnet.sh
  • deploy-scripts/midprice_pino/deploy-devnet.sh
  • deploy-scripts/midprice_pino/update-devnet-idl.sh
  • programs/midprice_pino/Cargo.toml

Comment on lines +34 to +48
build-devnet:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" bash ./build-devnet.sh

deploy-devnet:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" SOLANA_URL="$(SOLANA_URL)" \
DEPLOYER_KEYPAIR="$(DEPLOYER_KEYPAIR)" PROGRAM_KEYPAIR="$(PROGRAM_KEYPAIR)" \
SOLANA_PATH="$(SOLANA_PATH)" DEVNET_ADMIN="$(DEVNET_ADMIN)" \
bash ./deploy-devnet.sh

update-devnet-idl:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" SOLANA_URL="$(SOLANA_URL)" \
DEPLOYER_KEYPAIR="$(DEPLOYER_KEYPAIR)" PROGRAM_KEYPAIR="$(PROGRAM_KEYPAIR)" \
SOLANA_PATH="$(SOLANA_PATH)" DEVNET_ADMIN="$(DEVNET_ADMIN)" \
IDL_JSON="$(IDL_JSON)" \
bash ./update-devnet-idl.sh
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Relative script paths break when Makefile is invoked from a different directory.

The targets use bash ./build-devnet.sh etc., which only works when the Makefile is invoked from its directory. When using make -f deploy-scripts/midprice_pino/Makefile build-devnet from the repo root (as shown in line 1's comment), the relative paths will fail.

🔧 Proposed fix — use absolute paths via MIDPRICE_MK_DIR
 build-devnet:
-	PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" bash ./build-devnet.sh
+	PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" bash "$(MIDPRICE_MK_DIR)build-devnet.sh"

 deploy-devnet:
 	PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" SOLANA_URL="$(SOLANA_URL)" \
 	DEPLOYER_KEYPAIR="$(DEPLOYER_KEYPAIR)" PROGRAM_KEYPAIR="$(PROGRAM_KEYPAIR)" \
 	SOLANA_PATH="$(SOLANA_PATH)" DEVNET_ADMIN="$(DEVNET_ADMIN)" \
-	bash ./deploy-devnet.sh
+	bash "$(MIDPRICE_MK_DIR)deploy-devnet.sh"

 update-devnet-idl:
 	PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" SOLANA_URL="$(SOLANA_URL)" \
 	DEPLOYER_KEYPAIR="$(DEPLOYER_KEYPAIR)" PROGRAM_KEYPAIR="$(PROGRAM_KEYPAIR)" \
 	SOLANA_PATH="$(SOLANA_PATH)" DEVNET_ADMIN="$(DEVNET_ADMIN)" \
 	IDL_JSON="$(IDL_JSON)" \
-	bash ./update-devnet-idl.sh
+	bash "$(MIDPRICE_MK_DIR)update-devnet-idl.sh"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
build-devnet:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" bash ./build-devnet.sh
deploy-devnet:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" SOLANA_URL="$(SOLANA_URL)" \
DEPLOYER_KEYPAIR="$(DEPLOYER_KEYPAIR)" PROGRAM_KEYPAIR="$(PROGRAM_KEYPAIR)" \
SOLANA_PATH="$(SOLANA_PATH)" DEVNET_ADMIN="$(DEVNET_ADMIN)" \
bash ./deploy-devnet.sh
update-devnet-idl:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" SOLANA_URL="$(SOLANA_URL)" \
DEPLOYER_KEYPAIR="$(DEPLOYER_KEYPAIR)" PROGRAM_KEYPAIR="$(PROGRAM_KEYPAIR)" \
SOLANA_PATH="$(SOLANA_PATH)" DEVNET_ADMIN="$(DEVNET_ADMIN)" \
IDL_JSON="$(IDL_JSON)" \
bash ./update-devnet-idl.sh
build-devnet:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" bash "$(MIDPRICE_MK_DIR)build-devnet.sh"
deploy-devnet:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" SOLANA_URL="$(SOLANA_URL)" \
DEPLOYER_KEYPAIR="$(DEPLOYER_KEYPAIR)" PROGRAM_KEYPAIR="$(PROGRAM_KEYPAIR)" \
SOLANA_PATH="$(SOLANA_PATH)" DEVNET_ADMIN="$(DEVNET_ADMIN)" \
bash "$(MIDPRICE_MK_DIR)deploy-devnet.sh"
update-devnet-idl:
PROTOCOL_V2_ROOT="$(PROTOCOL_V2_ROOT)" SOLANA_URL="$(SOLANA_URL)" \
DEPLOYER_KEYPAIR="$(DEPLOYER_KEYPAIR)" PROGRAM_KEYPAIR="$(PROGRAM_KEYPAIR)" \
SOLANA_PATH="$(SOLANA_PATH)" DEVNET_ADMIN="$(DEVNET_ADMIN)" \
IDL_JSON="$(IDL_JSON)" \
bash "$(MIDPRICE_MK_DIR)update-devnet-idl.sh"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deploy-scripts/midprice_pino/Makefile` around lines 34 - 48, The Makefile
uses relative script paths which break when invoked from another directory; add
a top-level MIDPRICE_MK_DIR variable (e.g. MIDPRICE_MK_DIR := $(dir $(abspath
$(lastword $(MAKEFILE_LIST))))) and update the targets build-devnet,
deploy-devnet, and update-devnet-idl to call scripts via
"$(MIDPRICE_MK_DIR)/build-devnet.sh", "$(MIDPRICE_MK_DIR)/deploy-devnet.sh", and
"$(MIDPRICE_MK_DIR)/update-devnet-idl.sh" respectively while preserving exported
environment variables.

@@ -0,0 +1,26 @@
[workspace]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove standalone [workspace] declaration — this crate is already a workspace member.

The root Cargo.toml uses the glob pattern programs/* to register all program directories as workspace members. Having an empty [workspace] declaration here creates a conflicting standalone workspace, which can cause cargo resolution issues and break cargo build from the repository root.

🔧 Proposed fix
-[workspace]
-
 [package]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
[workspace]
[package]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@programs/midprice_pino/Cargo.toml` at line 1, Remove the standalone
[workspace] declaration from this crate's Cargo.toml (the lone "[workspace]"
header) so it doesn't define its own workspace; delete that section/header
entirely so the crate is only a member of the root workspace which already
includes programs/*.

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.

1 participant