Commit Graph

21 Commits

Author SHA1 Message Date
Felipe Andrade
05536fa181 proxyd: add consensus poller 2023-04-20 16:27:36 -07:00
Matthew Slipper
336c3a7c54 proxyd: Remove logging 2023-02-15 10:07:44 -07:00
Matthew Slipper
c17bcc9b83 proxyd: Add global flag to method overrides
This allows us to set global limits on individual RPCs that ignore any origin/user agent exemption.
2023-02-15 00:44:19 -07:00
Matthew Slipper
454bc10e44 Merge pull request #4797 from ethereum-optimism/bugfix/include-nonce-in-rate-limit
proxyd: Add nonce to sender-based rate limit
2023-01-27 12:42:30 -07:00
Matthew Slipper
d7c80a5a8c proxyd: Add nonce to sender-based rate limit 2023-01-27 12:36:20 -07:00
inphi
2a87efb68a proxyd: Add missing req_id to log entry 2023-01-27 13:23:20 -05:00
Matthew Slipper
aa3a5c859a proxyd: Add sender-based rate limiter
This PR adds a sender-based rate limiter to proxyd. This rate limiter throttles eth_sendRawTransaction requests based on sender in order to prevent abusive behavior on the sequencer.

Integration tests have been added to test this functionality.
2023-01-23 10:59:40 -07:00
Matthew Slipper
fe8a89e61d proxyd: Support pattern matching in origin and user agent
Adds support for pattern matchin in exempt origins. This should help with some of the issues Synthetix and others are seeing.
2022-10-17 07:08:33 -06:00
Matthew Slipper
f737002baa proxyd: Integrate custom rate limiter
Integrates the custom rate limiter in the previous PR into the rest of the application. Also takes the opportunity to clean up how we instantiate Redis clients so that we can share them among multiple different services.

There are some config changes in this PR. Specifically, you must specify a `base_rate` and `base_interval` in the rate limit config.
2022-10-11 17:20:23 -05:00
Matthew Slipper
537717610e proxyd: Add batch size metric and configurable max (#3545)
* proxyd: Add batch size metric and configurable max

The max batch size will be overwritten if it is over `MaxBatchRPCCallsHardLimit`.

Builds on https://github.com/ethereum-optimism/optimism/pull/3544.

* changeset

* fix lint

* fix test
2022-09-23 15:06:02 -06:00
Matthew Slipper
485258d3c2 proxyd: Add customizable whitelist error message (#3544)
* proxyd: Add customizable whitelist error message

Alchemy is asking for this so that we can include their affiliate link.

* add missing test case

* fix error message

* goimports
2022-09-23 14:21:12 -06:00
Matthew Slipper
d228a55bd7 proxyd: Fix error message in tests (#3503)
* proxyd: Fix error message in tests

The custom error message wasn't being carried over in batch responses.

* review fixes

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-09-19 16:44:08 +00:00
Matthew Slipper
3fb4debfe1 proxyd: Add logging for origin and remote IP (#3482)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Mark Tyneway <mark.tyneway@gmail.com>
2022-09-16 17:28:56 +00:00
Matthew Slipper
ccf0934459 proxyd: Support per-RPC rate limits (#3471)
* proxyd: Support per-RPC rate limits

* add log

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-09-15 08:46:11 +00:00
protolambda
9a4626856a style(batch-submitter,bss-core,proxyd): Fix lint Go (#3328)
* style(batch-submitter): fix lint

* style(bss-core): fix lint

* chore(proxyd): use io and os instead of deprecated ioutil methods, fixes lint
2022-08-26 19:39:30 -06:00
Matthew Slipper
7a2b4bdf45 proxyd: Add rate limit logging (#3173) 2022-08-04 18:44:46 +00:00
Matthew Slipper
f3d3492a81 proxyd: Add frontend rate limiting (#3166)
* proxyd: Add frontend rate limiting

To give us more flexibiltiy with rate limiting, proxyd now supports rate limiting of client (frontend) requests in addition to upstream (backend) requests. This PR also gives us the ability to exempt certain user agents/origins from rate limiting.

* lint
2022-08-04 11:34:43 -06:00
Matthew Slipper
cd0afa3176 proxyd: Parameterize full RPC request logging (#3110)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-07-27 17:12:47 +00:00
Matthew Slipper
e2e3a622ce proxyd: Use canned response for eth_accounts (#2801)
We never want to expose Geth's accounts to the public internet, so proxyd will now return `[]` for `eth_accounts` RPC calls without hitting the backend.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-06-16 19:02:39 +00:00
Matthew Slipper
e41cfc1d94 proxyd: Fix concurrent WS write panic (#2711)
Fixes a panic in the websocket proxyd logic. Normally, the `clientPump` and `backendPump` methods in `WSProxier` send data in one direction. However, when the client sends an invalid RPC, the `clientPump` will send a response _directly to the client_ in order to avoid unnecessary roundtrips to the backend. This could be interleaved with concurrent writes to the client's WS in `backendPump`, and would cause a panic in the WS library.

To test this, this PR includes a dedicated integration test that reliably triggers the issue. In addition, this PR adds additional testing for WS functionality.
2022-06-08 15:09:32 +00:00
Matthew Slipper
67a4016fdf maint: Move Go packages into root of repo, adopt go.work (#2524)
- Adopts Go workspaces for future compatibility with the Bedrock move into the monorepo
- Moves Go packages to the root of the repo in order to fix import paths
- Rewrites existing Go import paths
- Removes Stackman, since it's not needed anymore

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-05-04 21:51:24 +00:00