Skip to content

Conversation

@usmanmani1122
Copy link
Contributor

image building process

TODO

@agoric/synthetic-chain library

TODO

tooling improvements

TODO

@usmanmani1122 usmanmani1122 self-assigned this Jul 7, 2025
@semanticdiff-com
Copy link

semanticdiff-com bot commented Jul 7, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  packages/synthetic-chain/public/upgrade-test-scripts/run_use_final.sh Unsupported file format
  packages/synthetic-chain/public/upgrade-test-scripts/source.sh Unsupported file format
  packages/synthetic-chain/src/cli/dockerfileGen.ts  0% smaller

@changeset-bot
Copy link

changeset-bot bot commented Jul 7, 2025

⚠️ No Changeset found

Latest commit: 80690b6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @usmanmani1122, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new feature to limit the number of concurrently running vats to five, a crucial step for resource management. Beyond this feature, it includes a substantial refactoring of the test preparation scripts, centralizing configuration parameters and standardizing file path handling to improve overall maintainability and robustness.

Highlights

  • Vat Concurrency Restriction: Implemented the core feature of restricting the number of concurrently running vats to a maximum of 5. This is achieved by adding or updating the max-vats-online setting within the app.toml configuration file.
  • Script Parameterization and Centralization: Introduced a new source.sh file to centralize and parameterize common configuration values. This includes variables for CHAIN_ID, MONIKER, MAX_RUNNING_VATS, VOTING_PERIOD, and standardized paths to configuration files, improving script flexibility and reducing hardcoding.
  • Test Script Refactoring: The run_prepare_zero.sh script was significantly refactored to leverage the new environment variables defined in source.sh. This includes updating agd init, agd gentx, sed, and jq commands to use these parameterized values, enhancing the script's readability, maintainability, and robustness.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a new configuration setting to restrict the number of running vats and refactors the run_prepare_zero.sh script for better maintainability.

voting_period_s=10
latest_height=$(agd status | jq -r .SyncInfo.latest_block_height)
height=$((latest_height + voting_period_s + 20))
height=$((latest_height + VOTING_PERIOD + 20))

Choose a reason for hiding this comment

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

critical

The script will fail at this line because $VOTING_PERIOD is "10s" (a string with a suffix), which is not valid in a bash arithmetic expression. This will cause an error like bash: 10s: value too great for base (error token is "10s").

To fix this, you should strip the s suffix from the variable before using it in the calculation. The jq command on line 72 requires the s suffix, so the variable itself should not be changed.

Suggested change
height=$((latest_height + VOTING_PERIOD + 20))
height=$((latest_height + ${VOTING_PERIOD%s} + 20))

Comment on lines 39 to 45
--expression 's|^enable-unsafe-cors =.*|^enable-unsafe-cors = true|' \
--expression 's|^enabled-unsafe-cors =.*|enabled-unsafe-cors = true|' \
--expression 's|^pruning =.*|pruning = "nothing"|' \
--expression '/^\[api]/,/^\[/{s|^enable =.*|enable = true|}' \
--expression '/^[swingset]/a max-vats-online = 5' \
--in-place
sed "$CONFIG_FILE_PATH" \

Choose a reason for hiding this comment

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

medium

The expression on line 44, which adds max-vats-online = 5, is redundant. The if/else block on lines 52-61 correctly handles adding or updating the max-vats-online configuration using the $MAX_RUNNING_VATS variable.

Having both is confusing and could lead to issues if the variable's value changes. The logic in lines 52-61 is sufficient. I recommend removing the redundant expression from this sed command.

Suggested change
sed "$APP_CONFIG_FILE_PATH" \
--expression 's|^enable-unsafe-cors =.*|^enable-unsafe-cors = true|' \
--expression 's|^enabled-unsafe-cors =.*|enabled-unsafe-cors = true|' \
--expression 's|^pruning =.*|pruning = "nothing"|' \
--expression '/^\[api]/,/^\[/{s|^enable =.*|enable = true|}' \
--expression '/^[swingset]/a max-vats-online = 5' \
--in-place
sed "$APP_CONFIG_FILE_PATH" \
--expression 's|^enable-unsafe-cors =.*|^enable-unsafe-cors = true|' \
--expression 's|^enabled-unsafe-cors =.*|enabled-unsafe-cors = true|' \
--expression 's|^pruning =.*|pruning = "nothing"|' \
--expression '/^\[api]/,/^\[/{s|^enable =.*|enable = true|}' \
--in-place

Comment on lines 63 to 74
jq --arg denom "$BLD_DENOM" \
--arg voting_period "$VOTING_PERIOD" \
'
.app_state.crisis.constant_fee.denom = $denom |
.app_state.mint.params.mint_denom = $denom |
.app_state.gov.deposit_params.min_deposit[0].denom = $denom |
.app_state.staking.params.bond_denom = $denom |
.app_state.slashing.params.signed_blocks_window = "20000" |
.app_state.gov.voting_params.voting_period = $voting_period
' <"$GENESIS_FILE_PATH"
)"

Choose a reason for hiding this comment

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

medium

The logic for setting voting_period has changed. The original code used a deep merge (* operator), which is more robust as it works even if parts of the JSON path (like voting_params) don't exist. The new implementation uses direct assignment, which will fail if .app_state.gov.voting_params is null or doesn't exist.

To retain the robustness of the original approach while keeping the single jq call, you could perform the deep merge for voting_period first, and then apply the other assignments. This preserves the special handling that voting_period had previously.

Suggested change
contents="$(
jq --arg denom "$BLD_DENOM" \
--arg voting_period "$VOTING_PERIOD" \
'
.app_state.crisis.constant_fee.denom = $denom |
.app_state.mint.params.mint_denom = $denom |
.app_state.gov.deposit_params.min_deposit[0].denom = $denom |
.app_state.staking.params.bond_denom = $denom |
.app_state.slashing.params.signed_blocks_window = "20000" |
.app_state.gov.voting_params.voting_period = $voting_period
' <"$GENESIS_FILE_PATH"
)"
contents="$(
jq --arg denom "$BLD_DENOM" \
--arg voting_period "$VOTING_PERIOD" \
'\
( . * { app_state: { gov: { voting_params: { voting_period: $voting_period } } } } ) |\
.app_state.crisis.constant_fee.denom = $denom |\
.app_state.mint.params.mint_denom = $denom |\
.app_state.gov.deposit_params.min_deposit[0].denom = $denom |\
.app_state.staking.params.bond_denom = $denom |\
.app_state.slashing.params.signed_blocks_window = \"20000\"\
' <"$GENESIS_FILE_PATH"
)"

@usmanmani1122 usmanmani1122 added the force:from-scratch Rebuild all docker images label Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

force:from-scratch Rebuild all docker images

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants