Skip to content

Impl Parameterized Deploys: Native Typed Parameters Support#314

Open
AndriiS-DevBrother wants to merge 8 commits into
mainfrom
andriis/scala/parametrized-deploydata
Open

Impl Parameterized Deploys: Native Typed Parameters Support#314
AndriiS-DevBrother wants to merge 8 commits into
mainfrom
andriis/scala/parametrized-deploydata

Conversation

@AndriiS-DevBrother

@AndriiS-DevBrother AndriiS-DevBrother commented Jan 7, 2026

Copy link
Copy Markdown
Collaborator

Adds support for passing typed parameters (boolean, integer, string, bytes) directly to Rholang terms via URI-based injection, eliminating manual hex encoding for binary data.

Production Changes

Protocol (CasperMessage.proto)

  • New RholangValue message: union of bool_value, int_value, string_value, bytes_value
  • New DeployParameter message: named parameter with typed value
  • Extended DeployDataProto with repeated DeployParameter parameters = 13

Scala Implementation

  • RholangValueData / DeployParameterData: Domain models with validation
    • Max 50 parameters per deploy
    • Parameter names: alphanumeric + underscore, max 256 chars
    • String limit: 1MB, Bytes limit: 256MB
  • NormalizerEnv: Injects parameters as rho:deploy:param:<name> URIs
  • JSON API: Schema derivations for REST API support

Tests

New Scala Tests

Test File Coverage
ParametrizedDeployDataSpec.scala Validation, serialization, proto conversion for all parameter types
NormalizerEnvParametrizedSpec.scala Parameter injection, value-to-Par conversion
MultiParentCasperDeploySpec.scala Deploy API integration with parameters

New Python Integration Tests

Test Description
test_deploy_binary_data_via_parameter E2E test: 100KB binary data via parameters
test_deploy_encoded_binary_data Baseline hex encoding comparison

Usage

new stdout(`rho:io:stdout`),
                myData(`rho:deploy:param:myData`),
                myInt(`rho:deploy:param:myInt`),
                myString(`rho:deploy:param:myString`),
                myBytes(`rho:deploy:param:myBytes`),
                myBool(`rho:deploy:param:myBool`)
            in {
                stdout!([ "accessing bytes", *myData.length()]) |
                stdout!([ "accessing int", *myInt]) |
                stdout!([ "accessing string", *myString]) |
                stdout!([ "accessing bool", *myBool])
            }
binary_data_length = 5 * 1024 * 1024  # 5MB
binary_data = bytes(i % 256 for i in range(binary_data_length))

parameters={"myData": binary_data, "myInt": 123, "myString": "test", "myBytes": binary_data, "myBool": True}

The usage of this new api is represented in integration-tests/test/test_parametrized_deploydata.py

Expected stdout:

["accessing bool", true]
["accessing int", 123]
["accessing string", "test"]
["accessing bytes", 5242880]

Breaking Changes

None. The parameters field is optional and defaults to empty.

Comment thread models/src/main/protobuf/CasperMessage.proto
Comment thread integration-tests/test/rnode.py
Comment thread integration-tests/test/rnode.py
Comment thread integration-tests/test/rnode.py
Comment thread integration-tests/Pipfile
@AndriiS-DevBrother
AndriiS-DevBrother marked this pull request as ready for review January 9, 2026 14:15
Comment thread casper/src/test/scala/coop/rchain/casper/batch1/MultiParentCasperDeploySpec.scala Outdated
Comment thread casper/src/test/scala/coop/rchain/casper/batch1/MultiParentCasperDeploySpec.scala Outdated
Comment thread integration-tests/test/rnode.py
Comment thread models/src/test/scala/coop/rchain/models/NormalizerEnvParametrizedSpec.scala Outdated
@spreston8

Copy link
Copy Markdown
Collaborator

Nice work. Pretty much all my comments are just improvements in test coverage for these changes. I think implementing some of them would ensure robustness.

@spreston8
spreston8 requested a review from nashef January 10, 2026 02:55

@YuriiO-DevBrother YuriiO-DevBrother left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

private val deployStorageEnvConfig = LmdbEnvConfig(name = "deploystorage", maxEnvSize = 1 * gb)
private val blockStorageEnvConfig = LmdbEnvConfig(name = "blockstorage", maxEnvSize = 1 * tb)
private val dagStorageEnvConfig = LmdbEnvConfig(name = "dagstorage", maxEnvSize = 100 * gb)
// Increased from 1GB to 100GB to support large binary parameters in deploys (up to 256MB per parameter)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could this increase in 100x could be handled by nodes properly. As for me it seems like a huge exponential increase which potentially could be hard to achieve in practice. Taking into account that max binary size is limited to 256MB and MaxParameters number limited to 50 the increase to max value of 15GB should be enough.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You should store the large files on disk and then put the filename in LMDB. Otherwise your 256MB writes to the LMDB will block all other threads that want to make changes.

Comment thread models/src/main/protobuf/CasperMessage.proto
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.

5 participants