|
| 1 | +import StyledTable from '../../src/components/StyledTable' |
| 2 | + |
1 | 3 | # eth_simulate |
2 | 4 | This document contains some extra information that couldn't be fit to the specification document directly. |
3 | 5 |
|
4 | 6 | ## Default block values |
5 | 7 | Unlike `eth_call`, `eth_simulateV1`'s calls are conducted inside blocks. We don't require user to define all the fields of the blocks so here are the defaults that are assumed for blocks parameters: |
6 | 8 |
|
7 | | -| parameter name | default value | |
8 | | ------------------|----------------------- |
9 | | -| prevRandao | `0x0000000000000000000000000000000000000000000000000000000000000000` | |
10 | | -| feeRecipient | `0x0000000000000000000000000000000000000000` | |
11 | | -| mixHash | `0x0000000000000000000000000000000000000000000000000000000000000000` | |
12 | | -| nonce | `0x0` | |
13 | | -| extraData | `0x0000000000000000000000000000000000000000000000000000000000000000` | |
14 | | -| difficulty | The same as the base block defined as the second parameter in the call | |
15 | | -| gasLimit | The same as the base block defined as the second parameter in the call | |
16 | | -| hash | Calculated normally | |
17 | | -| parentHash | Previous blocks hash | |
18 | | -| timestamp | The timestamp of previous block + `network block time` (12s on Ethereum Mainnet) | |
19 | | -| baseFeePerGas | When validation mode is true, baseFeePerGas is calculated on what it should be according to Ethereum's spec. When validation mode is false, the baseFeePerGas is set to zero | |
20 | | -| sha3Uncles | Empty trie root | |
21 | | -| withdrawals | Empty array | |
22 | | -| uncles | Empty array | |
23 | | -| blobBaseFee | When validation mode is true, blobBaseFee is calculated on what it should be according to EIP-4844 spec. When validation mode is false, the blobBaseFee is set to zero | |
24 | | -| number | Previous block number + 1 | |
25 | | -| logsBloom | Calculated normally. ETH logs are not part of the calculation | |
26 | | -| receiptsRoot | Calculated normally | |
27 | | -| transactionsRoot | Calculated normally | |
28 | | -| size | Calculated normally | |
29 | | -| withdrawalsRoot | Calculated normally | |
30 | | -| gasUsed | Calculated normally | |
31 | | -| stateRoot | Calculated normally | |
| 9 | +<StyledTable> |
| 10 | + <thead> |
| 11 | + <tr> |
| 12 | + <th>parameter name</th> |
| 13 | + <th>default value</th> |
| 14 | + </tr> |
| 15 | + </thead> |
| 16 | + <tbody> |
| 17 | + <tr><td>prevRandao</td><td><code>0x0000000000000000000000000000000000000000000000000000000000000000</code></td></tr> |
| 18 | + <tr><td>feeRecipient</td><td><code>0x0000000000000000000000000000000000000000</code></td></tr> |
| 19 | + <tr><td>mixHash</td><td><code>0x0000000000000000000000000000000000000000000000000000000000000000</code></td></tr> |
| 20 | + <tr><td>nonce</td><td><code>0x0</code></td></tr> |
| 21 | + <tr><td>extraData</td><td><code>0x0000000000000000000000000000000000000000000000000000000000000000</code></td></tr> |
| 22 | + <tr><td>difficulty</td><td>The same as the base block defined as the second parameter in the call</td></tr> |
| 23 | + <tr><td>gasLimit</td><td>The same as the base block defined as the second parameter in the call</td></tr> |
| 24 | + <tr><td>hash</td><td>Calculated normally</td></tr> |
| 25 | + <tr><td>parentHash</td><td>Previous blocks hash</td></tr> |
| 26 | + <tr><td>timestamp</td><td>The timestamp of previous block + <code>network block time</code> (12s on Ethereum Mainnet)</td></tr> |
| 27 | + <tr><td>baseFeePerGas</td><td>When validation mode is true, baseFeePerGas is calculated on what it should be according to Ethereum's spec. When validation mode is false, the baseFeePerGas is set to zero</td></tr> |
| 28 | + <tr><td>sha3Uncles</td><td>Empty trie root</td></tr> |
| 29 | + <tr><td>withdrawals</td><td>Empty array</td></tr> |
| 30 | + <tr><td>uncles</td><td>Empty array</td></tr> |
| 31 | + <tr><td>blobBaseFee</td><td>When validation mode is true, blobBaseFee is calculated on what it should be according to EIP-4844 spec. When validation mode is false, the blobBaseFee is set to zero</td></tr> |
| 32 | + <tr><td>number</td><td>Previous block number + 1</td></tr> |
| 33 | + <tr><td>logsBloom</td><td>Calculated normally. ETH logs are not part of the calculation</td></tr> |
| 34 | + <tr><td>receiptsRoot</td><td>Calculated normally</td></tr> |
| 35 | + <tr><td>transactionsRoot</td><td>Calculated normally</td></tr> |
| 36 | + <tr><td>size</td><td>Calculated normally</td></tr> |
| 37 | + <tr><td>withdrawalsRoot</td><td>Calculated normally</td></tr> |
| 38 | + <tr><td>gasUsed</td><td>Calculated normally</td></tr> |
| 39 | + <tr><td>stateRoot</td><td>Calculated normally</td></tr> |
| 40 | + </tbody> |
| 41 | +</StyledTable> |
32 | 42 |
|
33 | 43 | ## Default values for transactions |
34 | 44 | As eth_simulate is an extension to `eth_call` we want to enable the nice user experience that the user does not need to provide all required values for a transaction. We are assuming following defaults if the variable is not provided by the user: |
35 | | -| parameter name | description | |
36 | | ------------------|----------------------- |
37 | | -| type | `0x2` | |
38 | | -| nonce | Take the correct nonce for the account prior eth_simulate and increment by one for each transaction by the account | |
39 | | -| to | `null` | |
40 | | -| from | `0x0000000000000000000000000000000000000000` | |
41 | | -| gasLimit | blockGasLimit - soFarUsedGasInBlock | |
42 | | -| value | `0x0` | |
43 | | -| input | no data | |
44 | | -| gasPrice | `0x0` | |
45 | | -| maxPriorityFeePerGas | `0x0` | |
46 | | -| maxFeePerGas | `0x0` | |
47 | | -| accessList | empty array | |
48 | | -| blobVersionedHashes | empty array | |
49 | | -| chainId | The chain id of the current chain | |
50 | | -| r | `0x0` | |
51 | | -| s | `0x0` | |
52 | | -| yParity | even | |
53 | | -| v | `0x0` | |
| 45 | + |
| 46 | +<StyledTable> |
| 47 | + <thead> |
| 48 | + <tr> |
| 49 | + <th>parameter name</th> |
| 50 | + <th>description</th> |
| 51 | + </tr> |
| 52 | + </thead> |
| 53 | + <tbody> |
| 54 | + <tr><td>type</td><td><code>0x2</code></td></tr> |
| 55 | + <tr><td>nonce</td><td>Take the correct nonce for the account prior eth_simulate and increment by one for each transaction by the account</td></tr> |
| 56 | + <tr><td>to</td><td><code>null</code></td></tr> |
| 57 | + <tr><td>from</td><td><code>0x0000000000000000000000000000000000000000</code></td></tr> |
| 58 | + <tr><td>gasLimit</td><td>blockGasLimit - soFarUsedGasInBlock</td></tr> |
| 59 | + <tr><td>value</td><td><code>0x0</code></td></tr> |
| 60 | + <tr><td>input</td><td>no data</td></tr> |
| 61 | + <tr><td>gasPrice</td><td><code>0x0</code></td></tr> |
| 62 | + <tr><td>maxPriorityFeePerGas</td><td><code>0x0</code></td></tr> |
| 63 | + <tr><td>maxFeePerGas</td><td><code>0x0</code></td></tr> |
| 64 | + <tr><td>accessList</td><td>empty array</td></tr> |
| 65 | + <tr><td>blobVersionedHashes</td><td>empty array</td></tr> |
| 66 | + <tr><td>chainId</td><td>The chain id of the current chain</td></tr> |
| 67 | + <tr><td>r</td><td><code>0x0</code></td></tr> |
| 68 | + <tr><td>s</td><td><code>0x0</code></td></tr> |
| 69 | + <tr><td>yParity</td><td>even</td></tr> |
| 70 | + <tr><td>v</td><td><code>0x0</code></td></tr> |
| 71 | + </tbody> |
| 72 | +</StyledTable> |
54 | 73 |
|
55 | 74 | ## Overriding default values |
56 | 75 | The default values of blocks and transactions can be overriden. For Transactions we allow overriding of variables `type`, `nonce`, `to`, `from`, `gas limit`, `value`, `input`, `gasPrice`, `maxPriorityFeePerGas`, `maxFeePerGas`, `accessList`, and for blocks we allow modifications of `number`, `time`, `gasLimit`, `feeRecipient`, `prevRandao`, `baseFeePerGas` and `blobBaseFee`: |
|
0 commit comments