Skip to content

Commit

Permalink
Update ESLint rules and rate limiting
Browse files Browse the repository at this point in the history
documentation
  • Loading branch information
odysseus0 committed Dec 2, 2023
1 parent d88b39e commit b2e1f63
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 46 deletions.
23 changes: 13 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,24 @@ module.exports = {
],
],
'import/no-unresolved': ERROR,
'import/no-extraneous-dependencies': [ERROR, {"includeTypes": true}],
"react/require-default-props": [WARNING, {
"functions": "defaultArguments"
}],
'react/jsx-filename-extension': [WARNING, { extensions: ['.js', '.jsx', '.ts', '.tsx'] }]
'import/no-extraneous-dependencies': [ERROR, {includeTypes: true}],
'react/require-default-props': [
WARNING,
{
functions: 'defaultArguments',
},
],
'react/jsx-filename-extension': [
WARNING,
{extensions: ['.js', '.jsx', '.ts', '.tsx']},
],
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
'webpack': true,
'typescript': {
'alwaysTryTypes': true,
},
typescript: {},
},
// optional, if you want to lint code blocks at the same time
'mdx/code-blocks': true,
Expand All @@ -85,4 +88,4 @@ module.exports = {
extends: ['plugin:mdx/overrides'],
},
],
}
};
76 changes: 45 additions & 31 deletions docs/flashbots-auction/advanced/rpc-endpoint.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: RPC Endpoint
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Hints from "../../specs/mev-share/HintsTable";
import Builders from "../../specs/mev-share/_builders.mdx";
import SendBundleSpec from "../../specs/mev-share/_mev_sendBundle.mdx";
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Hints from '../../specs/mev-share/HintsTable';
import Builders from '../../specs/mev-share/_builders.mdx';
import SendBundleSpec from '../../specs/mev-share/_mev_sendBundle.mdx';

## Interact directly with the Flashbots RPC endpoint

Expand All @@ -20,7 +20,7 @@ Advanced users can interact with the RPC endpoint at `relay.flashbots.net`, or o
| Goerli | `https://relay-goerli.flashbots.net` |
| Sepolia | `https://relay-sepolia.flashbots.net` |

The API provides JSON-RPC methods for interfacing with Flashbots which are documented below:
The API provides JSON-RPC methods for interfacing with Flashbots. There will be a rate limit of 10,000 requests per second per IP. Each method is documented below.

### eth_sendBundle

Expand Down Expand Up @@ -258,8 +258,7 @@ example response:

### eth_cancelBundle

`eth_cancelBundle` is used to prevent a submitted bundle from being included on-chain.
See [bundle cancellations](/flashbots-auction/advanced/bundle-cancellations) for more information.
`eth_cancelBundle` is used to prevent a submitted bundle from being included on-chain. See [bundle cancellations](/flashbots-auction/advanced/bundle-cancellations) for more information.

[`eth_cancelPrivateTransaction`](https://docs.alchemy.com/alchemy/apis/ethereum/eth_cancelPrivateTransaction/?a=fb) is also supported on [Alchemy](https://alchemy.com/?a=fb).

Expand Down Expand Up @@ -335,7 +334,7 @@ example request:
"builders": ["default"]
},
"validity": {
"refund": [{ "address": "0xadd123", "percent": 50 }]
"refund": [{"address": "0xadd123", "percent": 50}]
}
}
}
Expand All @@ -357,10 +356,10 @@ example response:

By default, transactions are sent to the Flashbots MEV-Share Node with the default [Stable](/flashbots-protect/mev-share#stable-configuration) configuration. The `privacy` parameter allows you to specify your own privacy parameters.

| Param | Type Info | Description |
| ---------- | ---------------- | ------------------------------------------------------------------------------------------------ |
| `hint` | Array of strings | Each hint specifies which data about the transaction will be shared with searchers on mev-share. |
| `builders` | Array of strings | Builders to grant permission to include the transaction in a block. |
| Param | Type Info | Description |
| --- | --- | --- |
| `hint` | Array of strings | Each hint specifies which data about the transaction will be shared with searchers on mev-share. |
| `builders` | Array of strings | Builders to grant permission to include the transaction in a block. |

**`hint`**

Expand All @@ -378,20 +377,17 @@ Validity is used to specify the address and percentage to pay refund from the ba

By default, the refund is paid to the signer of the transaction and 90% of the backrun value is sent to the user by default.

If multiple refund addresses are specified, then the backrun value is split between them according to the percentage specified.
For example, if refund is `[{address: addr1, percent: 10}, {address: addr1, percent: 20}]` then 10% of the backrun value is sent to `addr1` and 20% is sent to `addr2`
and 70% of the backrun value is left to the builder.
If multiple refund addresses are specified, then the backrun value is split between them according to the percentage specified. For example, if refund is `[{address: addr1, percent: 10}, {address: addr1, percent: 20}]` then 10% of the backrun value is sent to `addr1` and 20% is sent to `addr2` and 70% of the backrun value is left to the builder.

| Param | Type Info | Description |
| ------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------- |
| `refund` | Array of objects | Each entry in the array specifies address that should receive refund from backrun and percent of the backrun value. |
| `refund[].address` | Address | Address that should receive refund. |
| `refund[].percent` | Number | Percentage of the total backrun value that this address should receive. |
| Param | Type Info | Description |
| --- | --- | --- |
| `refund` | Array of objects | Each entry in the array specifies address that should receive refund from backrun and percent of the backrun value. |
| `refund[].address` | Address | Address that should receive refund. |
| `refund[].percent` | Number | Percentage of the total backrun value that this address should receive. |

### eth_sendPrivateRawTransaction

`eth_sendPrivateRawTransaction` behaves like [eth_sendPrivateTransaction](#eth_sendprivatetransaction) but its format
is similar to that of [`eth_sendRawTransaction`](https://docs.alchemy.com/reference/eth-sendrawtransaction)
`eth_sendPrivateRawTransaction` behaves like [eth_sendPrivateTransaction](#eth_sendprivatetransaction) but its format is similar to that of [`eth_sendRawTransaction`](https://docs.alchemy.com/reference/eth-sendrawtransaction)

This method has the following JSON-RPC format:

Expand All @@ -402,7 +398,25 @@ This method has the following JSON-RPC format:
method: "eth_sendPrivateRawTransaction",
params: [
tx, // String, raw signed transaction
preferences? // Optional, see eth_sendPrivateTransaction
preferences?: {
fast: boolean, // Sends transactions to all registered block builders, sets MEV-Share revenue share to 50%
privacy?: { // MEV-Share options; optional
hints?: Array< // data about tx to share w/ searchers on mev-share
"contract_address" |
"function_selector" |
"calldata" |
"logs" |
"hash"
>,
builders?: Array< // MEV-Share builders to exclusively receive bundles; optional
"default" |
"flashbots"
>,
},
validity?: {
refund?: Array<{address, percent}>
}
}
]
}
```
Expand All @@ -428,10 +442,10 @@ example response:
}
```

| Param | Type Info | Description |
| ----------- | --------- | --------------------------------------------------------------------------------- |
| `params[0]` | String | Raw signed transaction |
| `params[1]` | Object | Optional private tx preferences, see `preferences` in eth_sendPrivateTransaction. |
| Param | Type Info | Description |
| --- | --- | --- |
| `params[0]` | String | Raw signed transaction |
| `params[1]` | Object | Optional private tx preferences, see `preferences` in eth_sendPrivateTransaction. |

### eth_cancelPrivateTransaction

Expand Down Expand Up @@ -705,13 +719,13 @@ The signature is calculated by taking the [EIP-191](https://eips.ethereum.org/EI
<TabItem value="ethers.js">

```ts
import { Wallet, utils } from "ethers";
import {Wallet, utils} from 'ethers';

const privateKey = "0x1234";
const privateKey = '0x1234';
const wallet = new Wallet(privateKey);
const body =
'{"jsonrpc":"2.0","method":"eth_sendBundle","params":[{see above}],"id":1}';
const signature = wallet.address + ":" + wallet.signMessage(utils.id(body));
const signature = wallet.address + ':' + wallet.signMessage(utils.id(body));
```

</TabItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ title: rate limiting

In order to protect our service from abuse we have rate limits on the number of requests that can be made to Flashbots Protect RPC. Currently, the rate limits are set as follows:

- Maximum Requests per Second: 80 requests
- There is no rate limit for `sendRawTransaction`
- Other requests are capped to 200/5min/IP

- Burst Limit: Up to 100 requests

Note that this is _requests_ and not _transactions_ submitted per second. There is no limitation on the number of transactions in a request.
Note that you are not required to read JSON RPC requests to send transactions to Flashbots Protect RPC.
Note that this is _requests_ and not _transactions_ submitted per second. There is no limitation on the number of transactions in a request. Note that you are not required to read JSON RPC requests to send transactions to Flashbots Protect RPC.

## Rate limiting exceptions

Expand Down

0 comments on commit b2e1f63

Please sign in to comment.