Skip to content

remove connections param #17

Open
RaveenaBhasin wants to merge 13 commits into
devfrom
rb/refactor
Open

remove connections param #17
RaveenaBhasin wants to merge 13 commits into
devfrom
rb/refactor

Conversation

@RaveenaBhasin

@RaveenaBhasin RaveenaBhasin commented Sep 3, 2025

Copy link
Copy Markdown

PR Type

Enhancement


Description

  • Refactor connection handling to compute full mesh automatically

  • Add package documentation and configuration details

  • Update network configuration with new chain IDs and RPC endpoints

  • Add funding configuration for OP Retro project


Diagram Walkthrough

flowchart LR
  A["Input Args"] --> B["Input Parser"]
  B --> C["Compute Connections"]
  C --> D["Full Mesh Network"]
  B --> E["Network Validation"]
  E --> F["Deploy DVN/Executor"]
Loading

File Walkthrough

Relevant files
Configuration changes
funding.json
Add funding configuration                                                               

funding.json

  • Add OP Retro funding configuration with project ID
+5/-0     
network_custom.yaml
Update network configuration and defaults                               

network_custom.yaml

  • Update chain IDs and RPC URLs for ethereum and arbitrum networks
  • Remove explicit connections configuration
  • Add default fee configuration (exec_fee_default, dvn_fee_default)
+8/-11   
Documentation
kurtosis.yml
Add package documentation and metadata                                     

kurtosis.yml

  • Add comprehensive package description and documentation
  • Include prerequisites, configuration details, and usage instructions
  • Document network, DVN, and executor configuration parameters
+26/-1   
Enhancement
main.star
Refactor connection handling logic                                             

main.star

  • Remove connections argument from input parameters
  • Use compute_connections() to generate connections automatically
  • Remove manual DVN and executor deployment loops
+1/-44   
input_parser.star
Refactor input parsing and connection computation               

src/package_io/input_parser.star

  • Remove connections validation logic from input parser
  • Add compute_connections() function to generate full mesh connections
  • Improve RPC validation with better error handling
  • Add warning messages for inaccessible RPC endpoints
+31/-35 


Open with Devin

@qodo-code-review

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 Security concerns

Sensitive information exposure:
Private keys are present in 'network_custom.yaml' and may be real or reused. Move secrets to environment variables, Kurtosis secrets, or external secret management. Additionally, ensure the new RPC endpoints and the OP Retro projectId in 'funding.json' are not sensitive or misused.

⚡ Recommended focus areas for review

Sensitive Keys

Private keys are committed in plain text; ensure these are non-sensitive test keys and not used in production. Consider referencing env vars or Kurtosis secrets instead of inline values.

  private_key: 0x928eb5b8ba4e2560909debd29862e49b3f07a9feaf4d18b743c21d14bab3b2d8
- name: arbitrum
  chain_id: "5257230"
  rpc: https://5de863e54f7e4cd68cf5071ec493cd3f-rpc.network.bloctopus.io
  endpoint: 0x1a44076050125825900e736c501f859c50fE728c
  trusted_send_lib: 0x975bcD720be66659e3EB3C0e4F1866a3020E493A
  trusted_receive_lib: 0x7B9E184e07a6EE1aC23eAe0fe8D6Be2f663f05e6
  eid: "30110"
  private_key: 0x928eb5b8ba4e2560909debd29862e49b3f07a9feaf4d18b743c21d14bab3b2d8
Silent RPC Failures

When RPC is unavailable, the parser only logs a warning and continues; downstream steps may fail later. Consider failing fast or adding a strict mode to stop on RPC_UNAVAILABLE.

# Check if RPC is available
if result.output == "RPC_UNAVAILABLE":
    plan.print("WARNING: RPC validation failed for network '%s' - RPC endpoint not accessible from Kurtosis environment" % network["name"])
    plan.print("Expected chain id: %s, RPC URL: %s" % (expected_chain_id, rpc_url))
else:
    # Verify that the chain id matches the expected value using plan.verify
    plan.verify(
        value = result.output,
        assertion = "==",
        target_value = expected_chain_id,
        description = "Verifying chain id for network %s" % network["name"]
    )
    plan.print("RPC verification passed for network '%s' (chain id: %s)" % (network["name"], result.output))
Default Fees

Full-mesh connections use default fees from inputs; if not provided, they default to "0". Validate presence or provide safer defaults per network pair to avoid unexpected zero-fee behavior.

def compute_connections(input_args, networks):
    # Create a full mesh using provided defaults
    out = []
    exec_default = input_args.get("exec_fee_default", "0")
    dvn_default = input_args.get("dvn_fee_default", "0")
    for i, src in enumerate(networks):
        for j, dst in enumerate(networks):
            if i == j:
                continue
            out.append({
                "from": src.name,
                "to": dst.name,
                "exec_fee": exec_default,
                "dvn_fee": dvn_default,
            })
    return out

@RaveenaBhasin RaveenaBhasin changed the title Rb/refactor remove connections param Sep 3, 2025
@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
High-level
Restore DVN/Executor service deployment

The refactor removes the per-connection loops that call dvn_deployer.add_dvn and
executor_deployer.add_executor, so no DVN or Executor services are actually
launched. This leaves only the contracts and address server deployed, breaking
end-to-end cross-chain messaging. Reintroduce service orchestration using the
computed full-mesh connections (or an equivalent aggregate deploy call) so
DVN/Executor processes are started for each required pair.

Examples:

main.star [45-48]
    # Add server to serve contract addresses for front-end
    address_server.add_server(plan, dvn_addresses, executor_addresses)

Solution Walkthrough:

Before:

# main.star
def run(plan, args):
    # ...
    networks = input_parser.input_parser(plan, args)
    connections = input_parser.compute_connections(args, networks)

    # Deploy contracts
    dvn_addresses = dvn_contract_deployer.deploy_contract(...)
    executor_addresses = executor_contract_deployer.deploy_contract(...)
    
    # ... map addresses ...

    # CRITICAL BUG: The loop to deploy DVN and Executor services was removed.
    # No services are launched for the computed connections.

    address_server.add_server(plan, dvn_addresses, executor_addresses)
    # ...

After:

# main.star
def run(plan, args):
    # ...
    networks = input_parser.input_parser(plan, args)
    connections = input_parser.compute_connections(args, networks)

    # ... deploy contracts and map addresses ...

    # Restore the loop to deploy services for each computed connection
    for conn in connections:
        src = [net for net in networks if net.name == conn["from"]][0]
        dst = [net for net in networks if net.name == conn["to"]][0]

        dvn_deployer.add_dvn(plan, src_name=src.name, dst_name=dst.name, ...)
        executor_deployer.add_executor(plan, src_name=src.name, dst_name=dst.name, ...)

    address_server.add_server(plan, dvn_addresses, executor_addresses)
    # ...
Suggestion importance[1-10]: 10

__

Why: This suggestion correctly identifies a critical regression where the DVN/Executor service deployment loop was removed from main.star, rendering the entire cross-chain messaging system non-functional.

High
Possible issue
Fail on RPC validation errors

The code continues execution even when RPC validation fails, which could lead to
runtime errors later. Consider failing the execution or providing a mechanism to
handle unavailable RPCs gracefully throughout the deployment process.

src/package_io/input_parser.star [56-68]

 # Check if RPC is available
 if result.output == "RPC_UNAVAILABLE":
-    plan.print("WARNING: RPC validation failed for network '%s' - RPC endpoint not accessible from Kurtosis environment" % network["name"])
+    plan.print("ERROR: RPC validation failed for network '%s' - RPC endpoint not accessible from Kurtosis environment" % network["name"])
     plan.print("Expected chain id: %s, RPC URL: %s" % (expected_chain_id, rpc_url))
+    fail("RPC endpoint for network '%s' is not accessible. Please verify the RPC URL and network connectivity." % network["name"])
 else:
     # Verify that the chain id matches the expected value using plan.verify
     plan.verify(
         value = result.output,
         assertion = "==",
         target_value = expected_chain_id,
         description = "Verifying chain id for network %s" % network["name"]
     )
     plan.print("RPC verification passed for network '%s' (chain id: %s)" % (network["name"], result.output))
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that continuing execution after an RPC validation failure will likely cause subsequent errors; failing early makes the script more robust and user-friendly.

Medium
General
Make project ID configurable

The project ID appears to be a hardcoded hash value that may be
environment-specific or temporary. Consider using a configuration parameter or
environment variable to make this value configurable across different
deployments.

funding.json [1-5]

 {
   "opRetro": {
-    "projectId": "0x66818708d041152b7f9b45ee48e56ab6507ad493955fd256b62d7c9d8a27724f"
+    "projectId": "${PROJECT_ID:-0x66818708d041152b7f9b45ee48e56ab6507ad493955fd256b62d7c9d8a27724f}"
   }
 }
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly points out that hardcoding the projectId is not ideal for flexibility, and parameterizing it is a good practice, although the proposed syntax is not valid JSON.

Low
  • More

@RaveenaBhasin RaveenaBhasin requested a review from tiljrd September 3, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants