Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: param changes for block and cost per byte #8598

Merged
merged 5 commits into from
Aug 19, 2024
Merged

Conversation

PaddyMc
Copy link
Collaborator

@PaddyMc PaddyMc commented Aug 6, 2024

What is the purpose of the change

Param changes for block size and cost per byte

Analysis

  1. with the tx_size_cost_per_byte=20 rn, a swap from osmo => usdc through pool 1464 costs => 0.0003c
  2. continuing if we 10x the value of osmo, swaps cost => 0.003c
  3. with the tx_size_cost_per_byte=30 change the same swap goes to => 0.0004c
  4. continuing if we 10x the value of osmo, swaps cost => 0.004c

TLDR: I think we're good to increase cost per byte from 20 => 30

Average blocks

Block 18679972: Size 0.059330 MB
Block 18679973: Size 0.087567 MB
Block 18679974: Size 0.037231 MB
Block 18679975: Size 0.067585 MB
Block 18679976: Size 0.042751 MB
Block 18679977: Size 0.086765 MB
Block 18679978: Size 0.069870 MB
Block 18679979: Size 0.067013 MB
Block 18679980: Size 0.120811 MB
Block 18679981: Size 0.037151 MB

How to test

  • test with in-place-testnet and
  • curl http://localhost:1317/cosmos/consensus/v1/params | jq
{
  "params": {
    "block": {
      "max_bytes": "2000000",
      "max_gas": "300000000"
    },
    "evidence": {
      "max_age_num_blocks": "100000",
      "max_age_duration": "172800s",
      "max_bytes": "1048576"
    },
    "validator": {
      "pub_key_types": [
        "ed25519"
      ]
    },
    "version": {
      "app": "0"
    },
    "abci": {
      "vote_extensions_enable_height": "0"
    }
  }
}

  • osmosisd q auth params --output json | jq
{
  "params": {
    "max_memo_characters": "256",
    "tx_sig_limit": "7",
    "tx_size_cost_per_byte": "30",
    "sig_verify_cost_ed25519": "590",
    "sig_verify_cost_secp256k1": "1000"
  }
}

Copy link
Contributor

coderabbitai bot commented Aug 6, 2024

Walkthrough

The recent updates enhance blockchain transaction processing by introducing new constants for maximum block size, gas limits, and the cost per byte, improving both performance and resource management. The upgrade handling logic has been revised to utilize these constants, replacing hardcoded values to bolster security. Additionally, the test suite has been expanded to ensure robust validation of these parameters during the upgrade process, contributing to overall system reliability.

Changes

Files Change Summary
app/upgrades/v26/constants.go, app/upgrades/v26/upgrades.go Added constants for block size (BlockMaxBytes), gas limits (BlockMaxGas), and cost per byte (CostPerByte); updated upgrade logic to utilize these constants for enhanced security and performance.
app/upgrades/v26/upgrades_test.go Introduced new test preparation and execution functions to validate blockchain parameters during the upgrade processes.
CHANGELOG.md Added new entry for parameter changes related to block size and costs; reformatted existing entries for clarity.

Sequence Diagram(s)

sequenceDiagram
    participant UpgradeHandler
    participant Constants
    participant TestSuite

    UpgradeHandler->>Constants: Access BlockMaxBytes, BlockMaxGas, CostPerByte
    UpgradeHandler->>Blockchain: Set parameters for block processing
    Blockchain->>UpgradeHandler: Acknowledge set parameters
    UpgradeHandler->>TestSuite: Trigger parameter validation tests
    TestSuite->>Blockchain: Validate parameters
    Blockchain->>TestSuite: Return validation results
    TestSuite->>UpgradeHandler: Report test outcomes
Loading

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8575cb4 and b2d99d4.

Files selected for processing (1)
  • app/upgrades/v26/constants.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/upgrades/v26/constants.go

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the C:app-wiring Changes to the app folder label Aug 6, 2024
Copy link
Member

@czarcas7ic czarcas7ic left a comment

Choose a reason for hiding this comment

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

Nice, where were these values picked from btw?

@PaddyMc
Copy link
Collaborator Author

PaddyMc commented Aug 9, 2024

Nice, where were these values picked from btw?

Blocksize:
The 2mb was based on a discussion after looking at benchmarks more details here => https://linear.app/osmosis/issue/CHAIN-603/update-max-bytes-param-in-consensus-param-to-be-2mb

CostPerByte:
I need to do more investigation here, this was just a hand wavy estimate, will add more details to the PR description today

@PaddyMc PaddyMc closed this Aug 13, 2024
@PaddyMc PaddyMc reopened this Aug 13, 2024
@PaddyMc PaddyMc added the V:state/breaking State machine breaking PR label Aug 13, 2024
Copy link
Member

@ValarDragon ValarDragon left a comment

Choose a reason for hiding this comment

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

LGTM!

@PaddyMc PaddyMc merged commit 0cc6905 into main Aug 19, 2024
1 check passed
@PaddyMc PaddyMc deleted the feat/reduce-blocksize branch August 19, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:app-wiring Changes to the app folder V:state/breaking State machine breaking PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants