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

Add rate limiter for RPC requests #6264

Merged
merged 10 commits into from
May 16, 2024
Merged

Add rate limiter for RPC requests #6264

merged 10 commits into from
May 16, 2024

Conversation

NumberFour8
Copy link
Contributor

@NumberFour8 NumberFour8 commented May 14, 2024

This PR adds a rate limiter to all RPC requests.
The limit can be configured via max_rpc_requests_per_sec CLI argument or HOPRD_MAX_RPC_REQUESTS_PER_SEC env variable

Also the protocol_config.json updated so that this value can be set in the chain section per-chain. The CLI/env argument takes precedence (if specified).
The default value for Anvil is set to 100, as it can handle almost arbitrary amount of RPC requests locallly.

Default is 10.

@NumberFour8 NumberFour8 added this to the 2.2.0-rc.1 milestone May 14, 2024
@NumberFour8 NumberFour8 self-assigned this May 14, 2024
@github-actions github-actions bot added dependencies Pull requests that update a dependency file crate:chain-rpc labels May 14, 2024
Copy link
Contributor

coderabbitai bot commented May 14, 2024

Walkthrough

Walkthrough

The recent updates introduce a new configuration parameter, max_rpc_requests_per_sec, across various components of the system. This parameter is designed to control the maximum number of RPC requests per second, providing a mechanism for rate limiting. Changes include updates to configuration files, struct definitions, and initialization logic to incorporate this new field. Additionally, some minor documentation and comment improvements were made for clarity.

Changes

Files/Paths Change Summary
chain/api/src/config.rs Added max_rpc_requests_per_sec to ChainOptions and ChainNetworkConfig structs.
chain/api/src/lib.rs Modified rpc_http_config initialization to include max_requests_per_sec based on chain_config.
chain/rpc/src/client.rs Updated SimpleJsonRpcRetryPolicy comment and added max_requests_per_sec to HttpPostRequestorConfig.
hopli/src/environment_config.rs Adjusted DefaultHttpPostRequestor::new to include max_requests_per_sec in the configuration.
hoprd/hoprd/example_cfg.yaml Added max_rpc_requests_per_sec: 100 under the hopr section.
hoprd/hoprd/src/config.rs Updated deprecation warning and added max_rpc_requests_per_sec to configuration handling.
scripts/protocol-config-anvil.json Added "max_rpc_requests_per_sec": 100 under the network section.

Warning

Review ran into problems

Problems (1)
  • Git: Failed to clone repository. Please contact CodeRabbit support.

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration 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.

@NumberFour8 NumberFour8 marked this pull request as ready for review May 14, 2024 14:41
@NumberFour8 NumberFour8 requested a review from a team May 14, 2024 14:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review Details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits Files that changed from the base of the PR and between fd1b981 and 6cca020.
Files ignored due to path filters (202)
  • Cargo.lock is excluded by !**/*.lock
  • vendor/cargo/crc32fast-1.3.2/Cargo.toml is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/LICENSE-APACHE is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/LICENSE-MIT is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/README.md is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/benches/bench.rs is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/build.rs is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/src/baseline.rs is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/src/combine.rs is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/src/lib.rs is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/src/specialized/aarch64.rs is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/src/specialized/mod.rs is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/src/specialized/pclmulqdq.rs is excluded by !vendor/**
  • vendor/cargo/crc32fast-1.3.2/src/table.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/Cargo.toml is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/LICENSE is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/README.md is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/rust-toolchain.toml is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/arbitrary.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/iter.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/iter_set.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/lib.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/lock.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/mapref/entry.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/mapref/mod.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/mapref/multiple.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/mapref/one.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/rayon/map.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/rayon/read_only.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/rayon/set.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/read_only.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/serde.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/set.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/setref/mod.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/setref/multiple.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/setref/one.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/t.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/try_result.rs is excluded by !vendor/**
  • vendor/cargo/dashmap-5.5.3/src/util.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/CHANGELOG.md is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/Cargo.toml is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/README.md is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/benches/governor_criterion_benches.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/benches/multi_threaded.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/benches/realtime_clock.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/benches/single_threaded.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/doc/centrifugal-governor.png is excluded by !**/*.png, !vendor/**
  • vendor/cargo/governor-0.6.3/release.toml is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/_guide.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/clock.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/clock/default.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/clock/quanta.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/clock/with_std.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/errors.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/gcra.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/jitter.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/lib.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/middleware.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/nanos.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/quota.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/direct.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/direct/future.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/direct/sinks.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/direct/streams.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/in_memory.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/keyed.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/keyed/dashmap.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/keyed/future.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/src/state/keyed/hashmap.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/direct.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/future.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/keyed.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/keyed_dashmap.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/keyed_hashmap.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/memory_leaks.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/middleware.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/proptests.regressions is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/proptests.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/sinks.rs is excluded by !vendor/**
  • vendor/cargo/governor-0.6.3/tests/streams.rs is excluded by !vendor/**
  • vendor/cargo/no-std-compat-0.4.1/Cargo.toml is excluded by !vendor/**
  • vendor/cargo/no-std-compat-0.4.1/LICENSE is excluded by !vendor/**
  • vendor/cargo/no-std-compat-0.4.1/README.md is excluded by !vendor/**
  • vendor/cargo/no-std-compat-0.4.1/check.py is excluded by !vendor/**
  • vendor/cargo/no-std-compat-0.4.1/generate.py is excluded by !vendor/**
  • vendor/cargo/no-std-compat-0.4.1/src/generated.rs is excluded by !vendor/**
  • vendor/cargo/no-std-compat-0.4.1/src/lib.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/CHANGELOG.md is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/CONTRIBUTING.md is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/Cargo.toml is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/CoC.md is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/LICENSE.txt is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/README.md is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/bors.toml is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/deny.toml is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/release.toml is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/src/lib.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/src/literals.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.45/immoral_math.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.45/immoral_math.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.45/zero_u8.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.45/zero_u8.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.45/zero_usize.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.45/zero_usize.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.46/immoral_math.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.46/immoral_math.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.46/zero_u8.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.46/zero_u8.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.46/zero_usize.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.46/zero_usize.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.48/immoral_math.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.48/immoral_math.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.48/zero_u8.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.48/zero_u8.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.48/zero_usize.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.48/zero_usize.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.54/immoral_math.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.54/immoral_math.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.54/issue-17--adverse-conditions.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.54/issue-17--adverse-conditions.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.54/zero_u8.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.54/zero_u8.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.54/zero_usize.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_1.54/zero_usize.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_nightly/immoral_math.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_nightly/immoral_math.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_nightly/zero_u8.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_nightly/zero_u8.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_nightly/zero_usize.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compile-fail_nightly/zero_usize.stderr is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/compiletest.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/macro.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/run-pass/const_expression.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/run-pass/negative_i32.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/run-pass/nonzero_isize.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/run-pass/nonzero_usize.rs is excluded by !vendor/**
  • vendor/cargo/nonzero_ext-0.3.0/tests/run-pass/virtuous_math.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/CHANGELOG.md is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/Cargo.toml is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/LICENSE-APACHE is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/LICENSE-MIT is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/README.md is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/build.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/no_atomic.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/cfgs.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/gen/utils.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/arm_linux.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/README.md is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/aarch64.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/detect/aarch64_aa64reg.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/detect/aarch64_fuchsia.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/detect/aarch64_macos.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/detect/aarch64_windows.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/detect/auxv.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/detect/common.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/detect/x86_64.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/intrinsics.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/macros.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/powerpc64.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/s390x.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/atomic128/x86_64.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/core_atomic.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/fallback/mod.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/fallback/outline_atomics.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/fallback/seq_lock.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/fallback/seq_lock_wide.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/fallback/utils.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/float.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/interrupt/README.md is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/interrupt/armv4t.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/interrupt/armv6m.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/interrupt/avr.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/interrupt/mod.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/interrupt/msp430.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/interrupt/riscv.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/interrupt/xtensa.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/mod.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/msp430.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/riscv.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/imp/x86.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/lib.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/tests/helper.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/tests/mod.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/src/utils.rs is excluded by !vendor/**
  • vendor/cargo/portable-atomic-1.6.0/version.rs is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/Cargo.toml is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/Changelog.md is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/LICENSE-APACHE is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/LICENSE-MIT is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/README.md is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/img/top.png is excluded by !**/*.png, !vendor/**
  • vendor/cargo/spinning_top-0.3.0/src/lib.rs is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/src/relax.rs is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/src/rw_spinlock.rs is excluded by !vendor/**
  • vendor/cargo/spinning_top-0.3.0/src/spinlock.rs is excluded by !vendor/**
  • vendor/cargo/surf-governor-0.2.0/CHANGELOG.md is excluded by !vendor/**
  • vendor/cargo/surf-governor-0.2.0/Cargo.toml is excluded by !vendor/**
  • vendor/cargo/surf-governor-0.2.0/LICENSE-APACHE is excluded by !vendor/**
  • vendor/cargo/surf-governor-0.2.0/LICENSE-MIT is excluded by !vendor/**
  • vendor/cargo/surf-governor-0.2.0/README.md is excluded by !vendor/**
  • vendor/cargo/surf-governor-0.2.0/src/lib.rs is excluded by !vendor/**
Files selected for processing (14)
  • chain/api/src/config.rs (3 hunks)
  • chain/api/src/lib.rs (1 hunks)
  • chain/rpc/Cargo.toml (1 hunks)
  • chain/rpc/src/client.rs (4 hunks)
  • hopr/hopr-lib/src/config.rs (1 hunks)
  • hopr/hopr-lib/src/lib.rs (1 hunks)
  • hoprd/hoprd/src/cli.rs (1 hunks)
  • hoprd/hoprd/src/config.rs (2 hunks)
  • vendor/cargo/crc32fast-1.3.2/.cargo-checksum.json (1 hunks)
  • vendor/cargo/dashmap-5.5.3/.cargo-checksum.json (1 hunks)
  • vendor/cargo/governor-0.6.3/.cargo-checksum.json (1 hunks)
  • vendor/cargo/no-std-compat-0.4.1/.cargo-checksum.json (1 hunks)
  • vendor/cargo/nonzero_ext-0.3.0/.cargo-checksum.json (1 hunks)
  • vendor/cargo/portable-atomic-1.6.0/.cargo-checksum.json (1 hunks)
Files skipped from review due to trivial changes (6)
  • vendor/cargo/crc32fast-1.3.2/.cargo-checksum.json
  • vendor/cargo/dashmap-5.5.3/.cargo-checksum.json
  • vendor/cargo/governor-0.6.3/.cargo-checksum.json
  • vendor/cargo/no-std-compat-0.4.1/.cargo-checksum.json
  • vendor/cargo/nonzero_ext-0.3.0/.cargo-checksum.json
  • vendor/cargo/portable-atomic-1.6.0/.cargo-checksum.json
Additional comments not posted (7)
chain/rpc/Cargo.toml (1)

39-39: Dependency added correctly.

hopr/hopr-lib/src/config.rs (1)

49-50: Field added correctly to the Chain struct.

hoprd/hoprd/src/cli.rs (1)

164-172: Argument added correctly to the CliArgs struct.

chain/api/src/config.rs (2)

149-150: Field added correctly to the ChainNetworkConfig struct.


171-172: Method updated correctly to accept the new parameter.

Also applies to: 206-206

chain/api/src/lib.rs (1)

158-161: Method updated correctly to set max_requests_per_sec in the rpc_http_config.

hopr/hopr-lib/src/lib.rs (1)

443-443: Ensure the max_rpc_requests_per_sec parameter is correctly passed and utilized in the ChainNetworkConfig::new function.

Verification successful

max_rpc_requests_per_sec parameter is correctly passed and utilized

The max_rpc_requests_per_sec parameter is correctly passed and utilized in the ChainNetworkConfig::new function.

  • The parameter is passed to the ChainNetworkConfig::new function in hopr/hopr-lib/src/lib.rs.
  • The ChainNetworkConfig::new function in chain/api/src/config.rs accepts max_rpc_requests_per_sec as an argument.
  • The parameter is used within the function to set max_requests_per_sec in the ChainNetworkConfig struct.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of the `max_rpc_requests_per_sec` parameter in the `ChainNetworkConfig::new` function.

# Test: Search for the function definition and usage. Expect: Correct handling of the new parameter.
rg --type rust 'fn new' | rg 'max_rpc_requests_per_sec'

Length of output: 55



Script:

#!/bin/bash
# Description: Locate the `ChainNetworkConfig::new` function and check for the usage of `max_rpc_requests_per_sec`.

# Step 1: Locate the `ChainNetworkConfig::new` function definition.
ast-grep --lang rust --pattern 'impl ChainNetworkConfig {
  $$$
  fn new($_) {
    $$$
  }
  $$$
}'

# Step 2: Check for the usage of `max_rpc_requests_per_sec` within the function.
rg 'max_rpc_requests_per_sec' -A 10 -B 10

Length of output: 8050

hoprd/hoprd/src/config.rs Show resolved Hide resolved
chain/rpc/src/client.rs Outdated Show resolved Hide resolved
chain/rpc/src/client.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits Files that changed from the base of the PR and between 6cca020 and 02f9c4b.
Files selected for processing (1)
  • chain/api/src/lib.rs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • chain/api/src/lib.rs

@github-actions github-actions bot added toolchain Developer and product happiness crate:hopli labels May 15, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Review Details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits Files that changed from the base of the PR and between 02f9c4b and fefc1df.
Files selected for processing (7)
  • chain/api/src/config.rs (4 hunks)
  • chain/api/src/lib.rs (1 hunks)
  • chain/rpc/src/client.rs (9 hunks)
  • hopli/src/environment_config.rs (1 hunks)
  • hoprd/hoprd/example_cfg.yaml (1 hunks)
  • hoprd/hoprd/src/config.rs (3 hunks)
  • scripts/protocol-config-anvil.json (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • chain/api/src/lib.rs
  • chain/rpc/src/client.rs
  • hoprd/hoprd/src/config.rs

scripts/protocol-config-anvil.json Show resolved Hide resolved
hopli/src/environment_config.rs Show resolved Hide resolved
hoprd/hoprd/example_cfg.yaml Show resolved Hide resolved
chain/api/src/config.rs Show resolved Hide resolved
chain/api/src/config.rs Show resolved Hide resolved
chain/api/src/config.rs Show resolved Hide resolved
chain/api/src/config.rs Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits Files that changed from the base of the PR and between fefc1df and 73274b3.
Files selected for processing (1)
  • chain/rpc/src/client.rs (10 hunks)
Files skipped from review as they are similar to previous changes (1)
  • chain/rpc/src/client.rs

@NumberFour8 NumberFour8 added this pull request to the merge queue May 16, 2024
Merged via the queue into master with commit eca04ac May 16, 2024
9 checks passed
@NumberFour8 NumberFour8 deleted the lukas/add-rate-limiter branch May 16, 2024 08:58
NumberFour8 added a commit that referenced this pull request May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate:chain-api crate:chain-rpc crate:hopli crate:hopr-lib crate:hoprd dependencies Pull requests that update a dependency file toolchain Developer and product happiness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants