|
1 | | -import StyledTable from '../../src/components/StyledTable' |
2 | | - |
3 | 1 | # eth_simulate |
4 | 2 | This document contains some extra information that couldn't be fit to the specification document directly. |
5 | 3 |
|
6 | 4 | ## Default block values |
7 | 5 | 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: |
8 | 6 |
|
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> |
| 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 | |
42 | 32 |
|
43 | 33 | ## Default values for transactions |
44 | 34 | 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: |
45 | 35 |
|
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> |
| 36 | +| parameter name | description | |
| 37 | +-----------------|----------------------- |
| 38 | +| type | `0x2` | |
| 39 | +| nonce | Take the correct nonce for the account prior eth_simulate and increment by one for each transaction by the account | |
| 40 | +| to | `null` | |
| 41 | +| from | `0x0000000000000000000000000000000000000000` | |
| 42 | +| gasLimit | blockGasLimit - soFarUsedGasInBlock | |
| 43 | +| value | `0x0` | |
| 44 | +| input | no data | |
| 45 | +| gasPrice | `0x0` | |
| 46 | +| maxPriorityFeePerGas | `0x0` | |
| 47 | +| maxFeePerGas | `0x0` | |
| 48 | +| accessList | empty array | |
| 49 | +| blobVersionedHashes | empty array | |
| 50 | +| chainId | The chain id of the current chain | |
| 51 | +| r | `0x0` | |
| 52 | +| s | `0x0` | |
| 53 | +| yParity | even | |
| 54 | +| v | `0x0` | |
73 | 55 |
|
74 | 56 | ## Overriding default values |
75 | 57 | 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