feat: normalize Plutus V4 backend handling#258
Open
wolf31o2 wants to merge 1 commit into
Open
Conversation
wolf31o2
force-pushed
the
codex-audit-plutus-v4
branch
2 times, most recently
from
July 21, 2026 21:56
de29eb2 to
d2fba4d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends Apollo v2’s Plutus support to recognize and normalize Plutus V4 across backends (protocol params + reference scripts), while explicitly rejecting constructing Conway-era transactions that would require Dijkstra-era Plutus V4 witness/reference-script support.
Changes:
- Added Plutus V4 language-view support in
ComputeScriptDataHashand expanded ScriptRef decoding/creation paths to understandPlutusV4. - Normalized backend protocol-parameter cost model parsing/mapping to include
"PlutusV4"(UTxO RPC, Ogmios/Kupo, Maestro, Blockfrost) and added V4 reference-script decoding. - Introduced explicit builder-level rejection (
ErrPlutusV4RequiresDijkstra) for attaching/using Plutus V4 scripts in Conway-era transaction construction, with targeted tests.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| helpers.go | Adds PlutusV4 cost-model language mapping and ScriptRef type detection for V4. |
| helpers_test.go | Adds script-data-hash language-view test coverage for PlutusV4. |
| backend/utxorpc/utxorpc.go | Refactors cost-model parsing and adds PlutusV4 extraction from RPC protocol params. |
| backend/utxorpc/utxorpc_test.go | Tests that RPC cost-model translation includes PlutusV4. |
| backend/ogmios/ogmios.go | Extends Ogmios cost-model key mapping and reference-script decoding to PlutusV4; adds Kupo language constant shim. |
| backend/ogmios/ogmios_test.go | Adds tests for PlutusV4 script-ref decoding and cost-model key translation. |
| backend/maestro/maestro.go | Extends Maestro cost-model key mapping and script-ref decoding to PlutusV4. |
| backend/maestro/maestro_test.go | Adds tests for Maestro PlutusV4 script-ref and cost-model key translation. |
| backend/blockfrost/blockfrost.go | Extends script language detection-from-hash to include PlutusV4. |
| backend/blockfrost/blockfrost_test.go | Adds PlutusV4 cost-model parsing and script-ref detection test coverage. |
| backend/base.go | Adds ScriptRefFromBytes support for ScriptRefTypePlutusV4. |
| backend/base_test.go | Adds ScriptRefFromBytes PlutusV4 test coverage. |
| apollo.go | Adds ErrPlutusV4RequiresDijkstra and rejects PlutusV4 witness/reference-script construction paths. |
| apollo_test.go | Adds tests for V4 rejection behavior and V4 ScriptRef construction behavior. |
Comments suppressed due to low confidence (1)
helpers.go:604
- NewScriptRef only matches non-pointer Plutus script types and uses hard-coded numeric type tags (0..4). This makes it easy to reject valid
*common.PlutusVxScriptvalues and risks drifting fromcommon.ScriptRefType*constants used elsewhere (e.g. backend/base.go:309+). Consider accepting pointer forms and using the shared constants for the ref type codes.
func NewScriptRef(script common.Script) (*common.ScriptRef, error) {
var scriptType uint
switch script.(type) {
case common.NativeScript:
scriptType = 0
case common.PlutusV1Script:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
2914
to
+2918
| case common.PlutusV3Script, *common.PlutusV3Script: | ||
| used["PlutusV3"] = struct{}{} | ||
| case common.PlutusV4Script, *common.PlutusV4Script: | ||
| used["PlutusV4"] = struct{}{} | ||
| } |
wolf31o2
force-pushed
the
codex-audit-plutus-v4
branch
from
July 21, 2026 22:44
d2fba4d to
403fdb8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests