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(congestion): reject new transactions on RPC level #11419

Merged
merged 5 commits into from
Jun 4, 2024

Commits on May 31, 2024

  1. feat(congestion): reject new transactions on RPC level

    Summary: In this PR, we introduce a new failure mode on the RPC level
    when a transaction is submitted under congestion. The error is of type
    `InvalidTxError` and called `ShardCongested` with a single field
    `shard_id` referencing the congested shard.
    
    ## Details
    
    With [cross-shard congestion
    control](near/NEPs#539) being stabilized soon,
    we want to reject new transactions as early as possible when the
    receiver shard is already overloaded with traffic.
    
    On the chunk producer level, all transactions going to a congested shard
    will be dropped. This keeps the memory requirements of chunk producers
    bounded. Further, we decided to go for a relatively low threshold in
    order to keep the latency of accepted transactions low, preventing new
    transactions as soon as we hit 25% congestion on a specific shard.
    Consequently, when shards are congested, it will not be long before
    transactions are rejected.
    
    This has consequences for the users. On the positive side, they will no
    longer have to wait for a long time not knowing if their transaction
    will be accepted or not. Either, it is executed within a bounded time
    (at most 20 blocks after inclusion) or it will be rejected immediately.
    
    But on the negative side, when a shard is congested, they will have to
    actively retry sending the transaction until it gets accepted.
    
    We hope that this can be automated by wallets, which can also provide
    useful live updates to the user about what is happening. But for this,
    they will need to understand and handle the new error `ShardCongested`
    different from existing errors.
    jakmeier committed May 31, 2024
    Configuration menu
    Copy the full SHA
    d1ea36f View commit details
    Browse the repository at this point in the history
  2. fix existing tests

    Some tests should run without congestion control to function the same
    way the did. And some congestion control tests will observe the new
    error, which is expected.
    jakmeier committed May 31, 2024
    Configuration menu
    Copy the full SHA
    f161e54 View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2024

  1. Configuration menu
    Copy the full SHA
    6891891 View commit details
    Browse the repository at this point in the history
  2. fix typo

    jakmeier committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    5b25b6c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f1b492d View commit details
    Browse the repository at this point in the history