test_precompiles()¶
Documentation for tests/frontier/precompiles/test_precompiles.py::test_precompiles@9c2813ee.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/frontier/precompiles/test_precompiles.py::test_precompiles --fork Amsterdam
Tests the behavior of precompiled contracts in the Ethereum state test.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state_test
|
StateTestFiller
|
The state test filler object used to run the test. |
required |
address
|
str
|
The address of the precompiled contract to test. |
required |
precompile_exists
|
bool
|
A flag indicating whether the precompiled contract exists at the given address. |
required |
pre
|
Alloc
|
The allocation object used to deploy the contract and set up the initial state. |
required |
This test deploys a contract that performs two CALL operations to the specified address and a fixed address (0x10000), measuring the gas used for each call. It then stores the difference in gas usage in storage slot 0. The test verifies the expected storage value based on whether the precompiled contract exists at the given address.
Source code in tests/frontier/precompiles/test_precompiles.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
Parametrized Test Cases¶
This test generates 22 parametrized test cases across 8 forks.