-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RelayMiner] Supplier rate limiting (#895)
## Summary This PR adds an optimistic `RelayMeter` to the `RelayMiner` to monitor the consumed stake and stops servicing when `maxStake` is reached. It works by * Intercepting `RelayRequest`s before being served. * Assume the relay will be mined and deduce the corresponding amount from the consumed stake. * Send a `rate-limited` error if app stake share cannot cover of a minable `RelayRequest`. * After a relay has been served check if the `Relay` is volume applicable and revert the initial deduction if it is not. * Updates the known `Application`s stake if an `EventApplicationStaked` is observed. * Resets the `Application`s stakes at the beginning of every session. ## Issue `RelayMiner`s need to know how much of the `Application`'s stake they are allowed to consume without over-servicing. ![image](https://github.com/user-attachments/assets/4354c747-23a6-4b44-a63a-62a13617d796) ## Type of change Select one or more from the following: - [x] New feature, functionality or library ## Testing - [x] **Unit Tests**: `make go_develop_and_test` - [x] **LocalNet E2E Tests**: `make test_e2e` - [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR. ## Sanity Checklist - [x] I have tested my changes using the available tooling - [x] I have commented my code - [x] I have performed a self-review of my own code; both comments & source code --------- Co-authored-by: Daniel Olshansky <[email protected]>
- Loading branch information
Showing
18 changed files
with
657 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.