Skip to content

Change the structure of input configuration#131

Merged
adithyaov merged 5 commits intomainfrom
compul-name
Feb 10, 2026
Merged

Change the structure of input configuration#131
adithyaov merged 5 commits intomainfrom
compul-name

Conversation

@adithyaov
Copy link
Member

@adithyaov adithyaov commented Jan 27, 2026

The new config is of the form:


# Example of the starting point:
# start:
#   tag: ChainPoint
#   slot: 11617
#   blockHash: 9b65597bb73e21d5b58a1f5958f8b95324b142727efb2746c577998e93df3463

scripts:
  # The target script hash that we want to re-run locally.
  # In this example it's just a random hash, so please replace with your own.
  - script_hash: "22734734b6b0410cf4a0e3bd731fb98c55ac2b2a27b1eecb8d3b438c"
    # List of substitution scripts we want to run on wherever the target script
    # is found.
    substitutions:
      - # Name of the substitution script for easier identification (optional)
        name: "Local Policy"
        # The hash of the substitution script. The plutus-script-reexecutor will
        # check and fail if the hash does not match.
        #
        # Tip: Leave this as an empty string and let plutus-script-reexecutor
        # error out with the expected script hash.
        hash: "6bfbd8fc6567153cbaacdcd0ee9fff9e69ba2a0eb62c129b303ade19"
        source:
          # The source of the substitution script. This can either be a
          # "file_path" or a "cbor_hex".
          cbor_hex: "4e4d01000033222220051200120011"
          # file_path: "local-config/policy-debug.plutus"



@adithyaov adithyaov force-pushed the compul-name branch 2 times, most recently from d776d53 to 658113e Compare January 27, 2026 12:13
Copy link
Contributor

@axman6 axman6 left a comment

Choose a reason for hiding this comment

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

Looks good to me, other than making the name required I think this is good to go.

@tweag-ev-ak
Copy link
Collaborator

tweag-ev-ak commented Jan 29, 2026

Our discussion summary:

  1. the script name for each substitution stays optional
  2. we should store the actual script hash and make the actual_script_hash mandatory in the configuration map
  3. add validation of the config map and provide calculated script hashes as feedback, fail if not provided (very UX friendly) or incorrect
  4. add the optional script name for the target_script_hash

@adithyaov adithyaov force-pushed the compul-name branch 3 times, most recently from 9f7d57f to 9a08ecd Compare January 30, 2026 08:12
Copy link
Contributor

@axman6 axman6 left a comment

Choose a reason for hiding this comment

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

Looks good, a few minor things before it's ready.

Ensure every substitution script has a canonical name associated with it
The script hash being scrutinized may have an associated name
Make the user config errors more elaborate
Ensure non-empty substitution list
Copy link
Collaborator

@tweag-ev-ak tweag-ev-ak left a comment

Choose a reason for hiding this comment

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

LGTM 👍

instance ToJSON ConfigMapFile where
toJSON (ConfigMapFile strt scrpts) =
object ["start" .= strt, "scripts" .= scrpts]
$(deriveJSONSimpleSum "S" ''ScriptSource)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I personally prefer explicit instances in API and configuration files, since if we omit one field we can break the "contract" established with the user.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, and so we should not omit fields and be careful when updating the fields ensuring backwards compatibility.
That said, having an explicit deserialisation gives us more control but it's too verbose.

Is there a way to have explicit deserialisation that is less verbose?
Something like,

$(deriveJSONSimpleSum ''ScriptSource [ 'SCborHex ~ "cbor", 'SFilePath ~ "file" ])

An interface like this, with explicit options, should be possible.
Opening an issue so we can think more about it: #140

Copy link
Contributor

@axman6 axman6 left a comment

Choose a reason for hiding this comment

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

LGTM

@adithyaov adithyaov merged commit 8d5cedb into main Feb 10, 2026
2 checks passed
@adithyaov adithyaov deleted the compul-name branch February 10, 2026 06:47
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