Skip to content

Set stream.getminiblockmaxpagesize onchain setting#4706

Open
begmaroman wants to merge 5 commits into
mainfrom
begmaroman/set-get-miniblocks-max-page-size
Open

Set stream.getminiblockmaxpagesize onchain setting#4706
begmaroman wants to merge 5 commits into
mainfrom
begmaroman/set-get-miniblocks-max-page-size

Conversation

@begmaroman

Copy link
Copy Markdown
Contributor

No description provided.

@vercel

vercel Bot commented Dec 15, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
river-sample-app Ready Ready Preview, Comment Dec 16, 2025 10:15pm

@begmaroman begmaroman self-assigned this Dec 15, 2025
@cursor

cursor Bot commented Dec 15, 2025

Copy link
Copy Markdown

PR Summary

Standardizes the setting key to stream.getminiblocksmaxpagesize, sets its default to 200, and adds a contract interaction to configure it on-chain.

  • Config/Node:
    • Rename/standardize key to stream.getminiblocksmaxpagesize; update StreamGetMiniblocksMaxPageSizeConfigKey, struct tags, and comments in core/node/crypto/config.go and core/node/events/remote_provider.go.
    • Set GetMiniblocksMaxPageSize default to 200 in DefaultOnChainSettings.
  • Env:
    • Update core/env/local/local_dev/on_chain.csv to use stream.getminiblocksmaxpagesize with value 200.
  • Contracts:
    • Add interaction packages/contracts/scripts/interactions/InteractSetGetMiniblocksMaxPageSize.s.sol to set the value on-chain.
    • Add STREAM_GET_MINIBLOCKS_MAX_PAGE_SIZE constant in packages/contracts/scripts/interactions/helpers/RiverConfigValues.sol.

Written by Cursor Bugbot for commit 59b13fa. This will update automatically on new commits. Configure here.

@coderabbitai

coderabbitai Bot commented Dec 15, 2025

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Standardizes the miniblocks max page-size config key to lowercase, sets the Go default to 200, adds a Solidity keccak256 constant for the key, and adds a Foundry interaction script to set the on-chain config; a doc comment was updated accordingly.

Changes

Cohort / File(s) Summary
Config key & default
core/node/crypto/config.go
Changed constant value and mapstructure tag from stream.getMiniblocksMaxPageSize to stream.getminiblocksmaxpagesize and set GetMiniblocksMaxPageSize default to 200.
Documentation
core/node/events/remote_provider.go
Updated RemoteProvider.GetMbs comment to reference the lowercase config key name.
Solidity config constant
packages/contracts/scripts/interactions/helpers/RiverConfigValues.sol
Added STREAM_GET_MINIBLOCKS_MAX_PAGE_SIZE = keccak256("stream.getminiblocksmaxpagesize").
Interaction script
packages/contracts/scripts/interactions/InteractSetGetMiniblocksMaxPageSize.s.sol
New Foundry script broadcasting IRiverConfig.setConfiguration to set the miniblocks max page size to 200.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify exact lowercase key string matches across Go and Solidity.
  • Confirm default value 200 aligns with on-chain and runtime expectations.
  • Review Foundry script: broadcast flow, ABI encoding, and target config key.
  • Quick check of updated doc comment for accuracy.

Suggested reviewers

  • jterzis
  • pfives
  • texuf
  • giuseppecrj

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess relevance to the changeset. Add a description explaining the purpose of setting this onchain configuration and any context around the change.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed Title directly references the main change: setting the stream.getminiblocksmaxpagesize onchain setting, which is reflected across all modified files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch begmaroman/set-get-miniblocks-max-page-size

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b384ed and 397f839.

📒 Files selected for processing (1)
  • core/node/crypto/config.go (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/node/crypto/config.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: XChain_Integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
core/node/events/remote_provider.go (1)

32-36: Doc key matches config; tiny wording nit

Comment correctly points to stream.getminiblocksmaxpagesize. If you touch this again, consider Range is limited to chain config setting ... for slightly clearer phrasing.

packages/contracts/scripts/interactions/InteractSetGetMiniblocksMaxPageSize.s.sol (1)

14-26: Interaction logic is straightforward; keep 200 in sync with node default

The script cleanly sets the new config via STREAM_GET_MINIBLOCKS_MAX_PAGE_SIZE and abi.encode(uint64(200)), matching the Go default. Just be aware this 200 is now duplicated here and in DefaultOnChainSettings; if the limit ever changes, both will need updating.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 84bc120 and 61ee7ed.

⛔ Files ignored due to path filters (1)
  • core/env/local/local_dev/on_chain.csv is excluded by !**/*.csv
📒 Files selected for processing (4)
  • core/node/crypto/config.go (3 hunks)
  • core/node/events/remote_provider.go (1 hunks)
  • packages/contracts/scripts/interactions/InteractSetGetMiniblocksMaxPageSize.s.sol (1 hunks)
  • packages/contracts/scripts/interactions/helpers/RiverConfigValues.sol (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.go

📄 CodeRabbit inference engine (AGENTS.md)

**/*.go: Format all Go files using ./fmt.sh script from the /core directory
Run the linter using ./lint.sh script from the /core directory for Go code
Use structured logging with zap for Go backend code
Implement proper error handling with RiverError types in Go code
Implement proper context cancellation for graceful shutdowns in Go code

Files:

  • core/node/crypto/config.go
  • core/node/events/remote_provider.go
core/**/*.go

📄 CodeRabbit inference engine (core/AGENTS.md)

core/**/*.go: Format all modified Go files by running ./fmt.sh from the /core directory before committing
Run the linter via ./lint.sh from the /core directory to check code quality using golangci-lint and staticcheck, and fix any issues before committing
Use RiverError type from node/base/error.go for structured errors
Use RiverErrorWithBase to construct a river error derived from an error of arbitrary or unknown type
Wrap blockchain errors with context using crypto/ utilities
Log errors with structured fields using zap logger
Use structured JSON logging via zap with custom extensions in node/logging/ for log output
Use PostgreSQL connection pooling via pgx/v5 for database connections

Files:

  • core/node/crypto/config.go
  • core/node/events/remote_provider.go
packages/contracts/**/*.sol

📄 CodeRabbit inference engine (packages/contracts/.cursor/rules/contracts.mdc)

packages/contracts/**/*.sol: All contracts must follow the Diamond Pattern for upgradeability
Use explicit visibility modifiers for all functions and state variables
Implement proper access control using modifiers
Follow gas optimization best practices
Use events for important state changes
Implement proper input validation
Follow semantic versioning for contract upgrades
Use calldata in external function argument definitions when possible
Prefer clear/descriptive names over excessive comments
Library functions should be pure in the functional programming sense (no side effects)
Use diamond storage pattern for all state variables
Namespace storage slots to avoid collisions
Use efficient data structures for gas
Use proper mapping patterns for complex data
Use strict typing for all variables/parameters
Implement interface inheritance
Use enums for predefined sets
Use structs for complex types
Follow ABI encoding/decoding best practices
Implement granular permission checks
Use role-based access control
Validate cross-chain entitlements
Implement permission override mechanisms
Use NatSpec for all public/external functions
Document complex logic/algorithms
Keep inline comments concise
Document upgrade procedures
Use efficient data structures, pack storage
Implement batch operations where possible
Minimize storage reads/writes
Cache frequently accessed storage
Use unchecked blocks where safe
Use msg.sender directly
Follow CEI (Checks-Effects-Interactions) pattern
Use reentrancy guards
Validate all inputs
Use safe math
Implement access control
Use for (uint256 i; i < length; ++i) for loops
Follow upgrade best practices

packages/contracts/**/*.sol: Minimize complexity in software structure, prioritizing obviousness and ease of modification in Solidity contracts and facets
Invest time in design upfront rather than quick tactical fixes; prioritize long-term structure over short-term convenience when adding new facets or features
Design code to be obvious: developers ...

Files:

  • packages/contracts/scripts/interactions/InteractSetGetMiniblocksMaxPageSize.s.sol
  • packages/contracts/scripts/interactions/helpers/RiverConfigValues.sol
**/*.{ts,tsx,js,jsx,yaml,yml,sol,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

All non-Go files (TypeScript, JavaScript, YAML, Solidity) must pass Prettier formatting by running bun run prettier:fix

Files:

  • packages/contracts/scripts/interactions/InteractSetGetMiniblocksMaxPageSize.s.sol
  • packages/contracts/scripts/interactions/helpers/RiverConfigValues.sol
🧠 Learnings (2)
📚 Learning: 2025-11-25T08:48:08.084Z
Learnt from: CR
Repo: towns-protocol/towns PR: 0
File: core/node/storage/AGENTS.md:0-0
Timestamp: 2025-11-25T08:48:08.084Z
Learning: Applies to core/node/storage/storage/**/*.go : Enforce miniblock requirement constraint: if a stream exists in the `es` (event streams) table, it MUST have at least one miniblock; empty streams are not allowed

Applied to files:

  • core/node/crypto/config.go
📚 Learning: 2025-11-25T08:48:08.084Z
Learnt from: CR
Repo: towns-protocol/towns PR: 0
File: core/node/storage/AGENTS.md:0-0
Timestamp: 2025-11-25T08:48:08.084Z
Learning: Applies to core/node/storage/storage/**/*.go : Enforce minipool generation sequencing constraint: the minipool generation number MUST always be set to the last miniblock number + 1

Applied to files:

  • core/node/crypto/config.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: XChain_Integration
  • GitHub Check: Build_Anvil_Docker
🔇 Additional comments (3)
packages/contracts/scripts/interactions/helpers/RiverConfigValues.sol (1)

26-27: New config key constant matches Go side

The STREAM_GET_MINIBLOCKS_MAX_PAGE_SIZE hash over "stream.getminiblocksmaxpagesize" is aligned with the Go config key and lowercase hashing convention; this should decode correctly on the node side.

packages/contracts/scripts/interactions/InteractSetGetMiniblocksMaxPageSize.s.sol (1)

1-2: Solidity pragma differs from stated baseline

This script uses pragma solidity ^0.8.24; while guidelines reference ^0.8.23. That’s fine if your toolchain/compiler is already on 0.8.24, but worth confirming or aligning with the rest of the contracts for consistency.

core/node/crypto/config.go (1)

47-47: Config key rename is consistent and complete

Lowercase key "stream.getminiblocksmaxpagesize" correctly applied to the constant, struct tag, and default value (200). No lingering references to the old camelCase variant.

@bas-vk

bas-vk commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

There is already a sub command that allows you to set on-chain settings.

For this you can run: ./run.sh on-chain-config set stream.getMiniblocksMaxPageSize 0 200 with the private key set through the environment.

function __interact(address deployer) internal override {
address riverRegistry = getDeployment("riverRegistry");

uint64 value = 200;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need to be careful with such a large number. Currently there are streams that have a large range of miniblocks with each miniblock of 10MB in size. If something requests 200 of these miniblocks it will result in 2GB DB resultset which is problematic. This was the result of temporarily problems so after these huge ranges are trimmed this should not be a problem anymore.

@begmaroman begmaroman Dec 15, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@begmaroman

Copy link
Copy Markdown
Contributor Author

There is already a sub command that allows you to set on-chain settings.

For this you can run: ./run.sh on-chain-config set stream.getMiniblocksMaxPageSize 0 200 with the private key set through the environment.

As far as I remember, we should do it via solidity scripts and pass it through the governance so the script is required.

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.

2 participants