Ethereum Test Tools Package¶
Module containing tools for generating cross-client Ethereum execution layer tests.
Code
¶
Bases: SupportsBytes
, Sized
Generic code object.
Source code in src/ethereum_test_tools/code/code.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
bytecode: Optional[bytes] = None
class-attribute
instance-attribute
¶
bytes array that represents the bytecode of this object.
__init__(code=None, *, name=None)
¶
Create a new Code object.
Source code in src/ethereum_test_tools/code/code.py
25 26 27 28 29 30 31 32 33 34 35 36 |
|
name: Optional[str] = name
class-attribute
instance-attribute
¶
Name used to describe this code. Usually used to add extra information to a test case.
__bytes__()
¶
Transform the Code object into bytes.
Source code in src/ethereum_test_tools/code/code.py
38 39 40 41 42 43 44 45 |
|
__len__()
¶
Get the length of the Code object.
Source code in src/ethereum_test_tools/code/code.py
47 48 49 50 51 52 53 54 |
|
__add__(other)
¶
Adds two code objects together, by converting both to bytes first.
Source code in src/ethereum_test_tools/code/code.py
56 57 58 59 60 |
|
__radd__(other)
¶
Adds two code objects together, by converting both to bytes first.
Source code in src/ethereum_test_tools/code/code.py
62 63 64 65 66 |
|
fill_test(t8n, test_spec, fork, engine, spec, eips=None)
¶
Fills fixtures for the specified fork.
Source code in src/ethereum_test_tools/filling/fill.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
Initcode
¶
Bases: Code
Helper class used to generate initcode for the specified deployment code.
The execution gas cost of the initcode is calculated, and also the deployment gas costs for the deployed code.
The initcode can be padded to a certain length if necessary, which does not affect the deployed code.
Other costs such as the CREATE2 hashing costs or the initcode_word_cost of EIP-3860 are not taken into account by any of these calculated costs.
Source code in src/ethereum_test_tools/code/generators.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 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 |
|
__init__(*, deploy_code, initcode_length=None, padding_byte=0, name=None)
¶
Generate legacy initcode that inits a contract with the specified code. The initcode can be padded to a specified length for testing purposes.
Source code in src/ethereum_test_tools/code/generators.py
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 |
|
execution_gas: int = 0
instance-attribute
¶
Gas cost of executing the initcode, without considering deployment gas costs.
deploy_code: str | bytes | SupportsBytes = deploy_code
instance-attribute
¶
Bytecode to be deployed by the initcode.
deployment_gas: int = GAS_PER_DEPLOYED_CODE_BYTE * len(deploy_code_bytes)
instance-attribute
¶
Gas cost of deploying the cost, subtracted after initcode execution,
ceiling_division(a, b)
¶
Calculates the ceil without using floating point. Used by many of the EVM's formulas
Source code in src/ethereum_test_tools/common/helpers.py
18 19 20 21 22 23 |
|
JSONEncoder
¶
Bases: json.JSONEncoder
Custom JSON encoder for ethereum_test
types.
Source code in src/ethereum_test_tools/common/json.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 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 |
|
Field
dataclass
¶
Settings for a field in a JSON object.
Source code in src/ethereum_test_tools/common/json.py
30 31 32 33 34 35 36 37 38 39 40 41 42 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 |
|
name: Optional[str] = None
class-attribute
instance-attribute
¶
The name of the field in the JSON object.
cast_type: Optional[Callable] = None
class-attribute
instance-attribute
¶
The type or function to use to cast the field to before serializing.
skip_string_convert: bool = False
class-attribute
instance-attribute
¶
By default, the fields are converted to string after serializing.
to_json: bool = False
class-attribute
instance-attribute
¶
Whether the field should be converted to JSON by itself.
This option and JSON_SKIP_STRING_CONVERT
are mutually exclusive.
default_value: Optional[Any] = None
class-attribute
instance-attribute
¶
Value to use if the field is not set before type casting.
default_value_skip_cast: Optional[Any] = None
class-attribute
instance-attribute
¶
Value to use if the field is not set and also skip type casting.
keep_none: bool = False
class-attribute
instance-attribute
¶
Whether to keep the field if it is None
.
skip: bool = False
class-attribute
instance-attribute
¶
Whether to skip the field when serializing.
apply(encoder, target, field_name, value)
¶
Applies the settings to the target dictionary.
Source code in src/ethereum_test_tools/common/json.py
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 |
|
default(obj)
¶
Encodes types defined in this module using basic python facilities.
Source code in src/ethereum_test_tools/common/json.py
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 |
|
compute_create_address(address, nonce)
¶
Compute address of the resulting contract created using a transaction
or the CREATE
opcode.
Source code in src/ethereum_test_tools/common/helpers.py
26 27 28 29 30 31 32 33 |
|
Opcode
¶
Bases: bytes
Represents a single Opcode instruction in the EVM, with extra metadata useful to parametrize tests.
Parameters¶
- popped_stack_items: number of items the opcode pops from the stack
- pushed_stack_items: number of items the opcode pushes to the stack
- min_stack_height: minimum stack height required by the opcode
- data_portion_length: number of bytes after the opcode in the bytecode that represent data
Source code in src/ethereum_test_tools/vm/opcode.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
|
__new__(opcode_or_byte, *, popped_stack_items=0, pushed_stack_items=0, min_stack_height=0, data_portion_length=0)
¶
Creates a new opcode instance.
Source code in src/ethereum_test_tools/vm/opcode.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
__call__(*args_t)
¶
Makes all opcode instances callable to return formatted bytecode, which constitutes a data portion, that is located after the opcode byte, and pre-opcode bytecode, which is normally used to set up the stack.
This useful to automatically format, e.g., push opcodes and their
data sections as Opcodes.PUSH1(0x00)
.
Data sign is automatically detected but for this reason the range
of the input must be:
[-2^(data_portion_bits-1), 2^(data_portion_bits)]
where:
data_portion_bits == data_portion_length * 8
For the stack, the arguments are set up in the opposite order they are given, so the first argument is the last item pushed to the stack.
The resulting stack arrangement does not take into account opcode stack element consumption, so the stack height is not guaranteed to be correct and the user must take this into consideration.
Integers can also be used as stack elements, in which case they are automatically converted to PUSH operations, and negative numbers always use a PUSH32 operation.
Hex-strings will automatically be converted to bytes.
Source code in src/ethereum_test_tools/vm/opcode.py
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 146 147 148 149 150 151 152 153 154 155 156 157 |
|
__len__()
¶
Returns the total bytecode length of the opcode, taking into account its data portion.
Source code in src/ethereum_test_tools/vm/opcode.py
159 160 161 162 163 164 |
|
int()
¶
Returns the integer representation of the opcode.
Source code in src/ethereum_test_tools/vm/opcode.py
166 167 168 169 170 |
|
__str__()
¶
Return the name of the opcode, assigned at Enum creation.
Source code in src/ethereum_test_tools/vm/opcode.py
172 173 174 175 176 |
|
EngineAPIError
¶
Bases: IntEnum
List of Engine API errors
Source code in src/ethereum_test_tools/common/constants.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|
ReferenceSpec
¶
Reference Specification Description Abstract Class.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
30 31 32 33 34 35 36 37 38 39 40 41 42 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 |
|
name()
abstractmethod
¶
Returns the name of the spec.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
35 36 37 38 39 40 |
|
has_known_version()
abstractmethod
¶
Returns true if the reference spec object is hard-coded with a latest known version.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
42 43 44 45 46 47 48 |
|
known_version()
abstractmethod
¶
Returns the latest known version in the reference.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
50 51 52 53 54 55 |
|
api_url()
abstractmethod
¶
Returns the URL required to poll the version from an API, if needed.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
57 58 59 60 61 62 |
|
latest_version()
abstractmethod
¶
Returns a digest that points to the latest version of the spec.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
64 65 66 67 68 69 |
|
is_outdated()
abstractmethod
¶
Checks whether the reference specification has been updated since the test was last updated.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
71 72 73 74 75 76 77 |
|
write_info(info)
abstractmethod
¶
Writes info about the reference specification used into the output fixture.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
79 80 81 82 83 84 85 |
|
parseable_from_module(module_dict)
abstractmethod
staticmethod
¶
Checks whether the module's dict contains required reference spec information.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
87 88 89 90 91 92 93 94 |
|
parse_from_module(module_dict)
abstractmethod
staticmethod
¶
Parses the module's dict into a reference spec.
Source code in src/ethereum_test_tools/reference_spec/reference_spec.py
96 97 98 99 100 101 102 |
|
StateTest
dataclass
¶
Bases: BaseTest
Filler type that tests transactions over the period of a single block.
Source code in src/ethereum_test_tools/spec/state_test.py
33 34 35 36 37 38 39 40 41 42 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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
pytest_parameter_name()
classmethod
¶
Returns the parameter name used to identify this filler in a test.
Source code in src/ethereum_test_tools/spec/state_test.py
46 47 48 49 50 51 |
|
make_genesis(t8n, fork)
¶
Create a genesis block from the state test definition.
Source code in src/ethereum_test_tools/spec/state_test.py
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 |
|
make_blocks(t8n, genesis, pre, fork, chain_id=1, eips=None)
¶
Create a block from the state test definition. Performs checks against the expected behavior of the test. Raises exception on invalid test behavior.
Source code in src/ethereum_test_tools/spec/state_test.py
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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
BlockchainTest
dataclass
¶
Bases: BaseTest
Filler type that tests multiple blocks (valid or invalid) in a chain.
Source code in src/ethereum_test_tools/spec/blockchain_test.py
34 35 36 37 38 39 40 41 42 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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
pytest_parameter_name()
classmethod
¶
Returns the parameter name used to identify this filler in a test.
Source code in src/ethereum_test_tools/spec/blockchain_test.py
46 47 48 49 50 51 |
|
make_genesis(t8n, fork)
¶
Create a genesis block from the state test definition.
Source code in src/ethereum_test_tools/spec/blockchain_test.py
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 |
|
make_block(t8n, fork, block, previous_env, previous_alloc, previous_head, chain_id=1, eips=None)
¶
Produces a block based on the previous environment and allocation. If the block is an invalid block, the environment and allocation returned are the same as passed as parameters. Raises exception on invalid test behavior.
Returns¶
FixtureBlock: Block to be appended to the fixture.
Environment: Environment for the next block to produce.
If the produced block is invalid, this is exactly the same
environment as the one passed as parameter.
Dict[str, Any]: Allocation for the next block to produce.
If the produced block is invalid, this is exactly the same
allocation as the one passed as parameter.
str: Hash of the head of the chain, only updated if the produced
block is not invalid.
Source code in src/ethereum_test_tools/spec/blockchain_test.py
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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
make_blocks(t8n, genesis, pre, fork, chain_id=1, eips=None)
¶
Create a block list from the blockchain test definition. Performs checks against the expected behavior of the test. Raises exception on invalid test behavior.
Source code in src/ethereum_test_tools/spec/blockchain_test.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
compute_create2_address(address, salt, initcode)
¶
Compute address of the resulting contract created using the CREATE2
opcode.
Source code in src/ethereum_test_tools/common/helpers.py
36 37 38 39 40 41 42 43 44 |
|
Yul
¶
Bases: SupportsBytes
, Sized
Yul compiler. Compiles Yul source code into bytecode.
Source code in src/ethereum_test_tools/code/yul.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 |
|
__bytes__()
¶
Assembles using solc --assemble
.
Source code in src/ethereum_test_tools/code/yul.py
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 |
|
__len__()
¶
Get the length of the Yul bytecode.
Source code in src/ethereum_test_tools/code/yul.py
106 107 108 109 110 |
|
__add__(other)
¶
Adds two code objects together, by converting both to bytes first.
Source code in src/ethereum_test_tools/code/yul.py
112 113 114 115 116 |
|
__radd__(other)
¶
Adds two code objects together, by converting both to bytes first.
Source code in src/ethereum_test_tools/code/yul.py
118 119 120 121 122 |
|
version()
¶
Return solc's version string
Source code in src/ethereum_test_tools/code/yul.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
|
cost_memory_bytes(new_bytes, previous_bytes)
¶
Calculates the cost of memory expansion, based on the costs specified in the yellow paper: https://ethereum.github.io/yellowpaper/paper.pdf
Source code in src/ethereum_test_tools/common/helpers.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
Auto
¶
Class to use as a sentinel value for parameters that should be automatically calculated.
Source code in src/ethereum_test_tools/common/types.py
57 58 59 60 61 62 63 64 65 |
|
__repr__()
¶
Print the correct test id.
Source code in src/ethereum_test_tools/common/types.py
63 64 65 |
|
BaseTestConfig
dataclass
¶
General configuration that all tests must support.
Source code in src/ethereum_test_tools/spec/base_test.py
62 63 64 65 66 67 68 69 70 71 |
|
disable_hive: bool = False
class-attribute
instance-attribute
¶
Disable any hive-related properties that the output could contain.
copy_opcode_cost(length)
¶
Calculates the cost of the COPY opcodes, assuming memory expansion from empty memory, based on the costs specified in the yellow paper: https://ethereum.github.io/yellowpaper/paper.pdf
Source code in src/ethereum_test_tools/common/helpers.py
64 65 66 67 68 69 70 |
|
eip_2028_transaction_data_cost(data)
¶
Calculates the cost of a given data as part of a transaction, based on the costs specified in EIP-2028: https://eips.ethereum.org/EIPS/eip-2028
Source code in src/ethereum_test_tools/common/helpers.py
73 74 75 76 77 78 79 80 81 82 83 84 |
|
BaseTest
dataclass
¶
Represents a base Ethereum test which must return a genesis and a blockchain.
Source code in src/ethereum_test_tools/spec/base_test.py
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 |
|
make_genesis(t8n, fork)
abstractmethod
¶
Create a genesis block from the test definition.
Source code in src/ethereum_test_tools/spec/base_test.py
89 90 91 92 93 94 95 96 97 98 |
|
make_blocks(t8n, genesis, pre, fork, chain_id=1, eips=None)
abstractmethod
¶
Generate the blockchain that must be executed sequentially during test.
Source code in src/ethereum_test_tools/spec/base_test.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
pytest_parameter_name()
abstractmethod
classmethod
¶
Must return the name of the parameter used in pytest to select this spec type as filler for the test.
Source code in src/ethereum_test_tools/spec/base_test.py
115 116 117 118 119 120 121 122 |
|
get_next_transition_tool_output_path()
¶
Returns the path to the next transition tool output file.
Source code in src/ethereum_test_tools/spec/base_test.py
124 125 126 127 128 129 130 131 132 133 |
|
to_address(input)
¶
Converts an int or str into proper address 20-byte hex string.
Source code in src/ethereum_test_tools/common/helpers.py
87 88 89 90 91 |
|
to_hash_bytes(input)
¶
Converts an int or str into proper 32-byte hash.
Source code in src/ethereum_test_tools/common/helpers.py
94 95 96 97 98 |
|
to_hash(input)
¶
Converts an int or str into proper 32-byte hash hex string.
Source code in src/ethereum_test_tools/common/helpers.py
101 102 103 104 105 |
|
add_kzg_version(b_hashes, kzg_version)
¶
Adds the Kzg Version to each blob hash.
Source code in src/ethereum_test_tools/common/helpers.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
CodeGasMeasure
dataclass
¶
Bases: Code
Helper class used to generate bytecode that measures gas usage of a bytecode, taking into account and subtracting any extra overhead gas costs required to execute. By default, the result gas calculation is saved to storage key 0.
Source code in src/ethereum_test_tools/code/generators.py
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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
code: str | bytes | SupportsBytes
instance-attribute
¶
Bytecode to be executed to measure the gas usage.
overhead_cost: int = 0
class-attribute
instance-attribute
¶
Extra gas cost to be subtracted from extra operations.
extra_stack_items: int = 0
class-attribute
instance-attribute
¶
Extra stack items that remain at the end of the execution. To be considered when subtracting the value of the previous GAS operation, and to be popped at the end of the execution.
sstore_key: int = 0
class-attribute
instance-attribute
¶
Storage key to save the gas used.
__post_init__()
¶
Assemble the bytecode that measures gas usage.
Source code in src/ethereum_test_tools/code/generators.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
Opcodes
¶
Bases: Opcode
, Enum
Enum containing all known opcodes.
Contains deprecated and not yet implemented opcodes.
This enum is !! NOT !! meant to be iterated over by the tests. Instead, create a list with cherry-picked opcodes from this Enum within the test if iteration is needed.
Do !! NOT !! remove or modify existing opcodes from this list.
Source code in src/ethereum_test_tools/vm/opcode.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
|
Conditional
dataclass
¶
Bases: Code
Helper class used to generate conditional bytecode.
Source code in src/ethereum_test_tools/code/generators.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
condition: str | bytes | SupportsBytes
instance-attribute
¶
Condition bytecode which must return the true or false condition of the conditional statement.
if_true: str | bytes | SupportsBytes
instance-attribute
¶
Bytecode to execute if the condition is true.
if_false: str | bytes | SupportsBytes
instance-attribute
¶
Bytecode to execute if the condition is false.
__post_init__()
¶
Assemble the conditional bytecode by generating the necessary jumps and jumpdests surrounding the condition and the two possible execution paths.
In the future, PC usage should be replaced by using RJUMP and RJUMPI
Source code in src/ethereum_test_tools/code/generators.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 |
|
Storage
¶
Bases: SupportsJSON
Definition of a storage in pre or post state of a test
Source code in src/ethereum_test_tools/common/types.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
|
StorageDictType: TypeAlias = Dict[str | int | bytes | SupportsBytes, str | int | bytes | SupportsBytes]
class-attribute
¶
Dictionary type to be used when defining an input to initialize a storage.
InvalidType
¶
Bases: Exception
Invalid type used when describing test's expected storage key or value.
Source code in src/ethereum_test_tools/common/types.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
280 281 282 |
|
InvalidValue
¶
Bases: Exception
Invalid value used when describing test's expected storage key or value.
Source code in src/ethereum_test_tools/common/types.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
296 297 298 |
|
AmbiguousKeyValue
¶
Bases: Exception
Key is represented twice in the storage.
Source code in src/ethereum_test_tools/common/types.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
324 325 326 327 328 329 330 |
|
MissingKey
¶
Bases: Exception
Test expected to find a storage key set but key was missing.
Source code in src/ethereum_test_tools/common/types.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
343 344 345 |
|
KeyValueMismatch
¶
Bases: Exception
Test expected a certain value in a storage key but value found was different.
Source code in src/ethereum_test_tools/common/types.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
365 366 367 368 369 370 371 372 |
|
parse_key_value(input)
staticmethod
¶
Parses a key or value to a valid int key for storage.
Source code in src/ethereum_test_tools/common/types.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
|
key_value_to_string(value)
staticmethod
¶
Transforms a key or value into an hex string.
Source code in src/ethereum_test_tools/common/types.py
392 393 394 395 396 397 398 399 400 401 402 |
|
__init__(input={}, start_slot=0)
¶
Initializes the storage using a given mapping which can have keys and values either as string or int. Strings must be valid decimal or hexadecimal (starting with 0x) numbers.
Source code in src/ethereum_test_tools/common/types.py
404 405 406 407 408 409 410 411 412 413 414 415 416 |
|
__len__()
¶
Returns number of elements in the storage
Source code in src/ethereum_test_tools/common/types.py
418 419 420 |
|
__contains__(key)
¶
Checks for an item in the storage
Source code in src/ethereum_test_tools/common/types.py
422 423 424 425 |
|
__getitem__(key)
¶
Returns an item from the storage
Source code in src/ethereum_test_tools/common/types.py
427 428 429 430 431 432 |
|
__setitem__(key, value)
¶
Sets an item in the storage
Source code in src/ethereum_test_tools/common/types.py
434 435 436 |
|
__delitem__(key)
¶
Deletes an item from the storage
Source code in src/ethereum_test_tools/common/types.py
438 439 440 |
|
store_next(value)
¶
Stores a value in the storage and returns the key where the value is stored.
Increments the key counter so the next time this function is called, the next key is used.
Source code in src/ethereum_test_tools/common/types.py
442 443 444 445 446 447 448 449 450 |
|
__json__(encoder)
¶
Converts the storage into a string dict with appropriate 32-byte hex string formatting.
Source code in src/ethereum_test_tools/common/types.py
452 453 454 455 456 457 458 459 460 461 462 463 464 |
|
contains(other)
¶
Returns True if self contains all keys with equal value as contained by second storage. Used for comparison with test expected post state and alloc returned by the transition tool.
Source code in src/ethereum_test_tools/common/types.py
466 467 468 469 470 471 472 473 474 475 476 477 478 |
|
must_contain(address, other)
¶
Succeeds only if self contains all keys with equal value as contained by second storage. Used for comparison with test expected post state and alloc returned by the transition tool. Raises detailed exception when a difference is found.
Source code in src/ethereum_test_tools/common/types.py
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
|
must_be_equal(address, other)
¶
Succeeds only if "self" is equal to "other" storage.
Source code in src/ethereum_test_tools/common/types.py
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
|
Account
dataclass
¶
State associated with an address.
Source code in src/ethereum_test_tools/common/types.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 |
|
nonce: Optional[NumberConvertible] = field(default=None, json_encoder=JSONEncoder.Field(name='nonce', cast_type=ZeroPaddedHexNumber, default_value=0))
class-attribute
instance-attribute
¶
The scalar value equal to a) the number of transactions sent by an Externally Owned Account, b) the amount of contracts created by a contract.
balance: Optional[NumberConvertible] = field(default=None, json_encoder=JSONEncoder.Field(name='balance', cast_type=ZeroPaddedHexNumber, default_value=0))
class-attribute
instance-attribute
¶
The amount of Wei (10-18 Eth) the account has.
code: Optional[BytesConvertible] = field(default=None, json_encoder=JSONEncoder.Field(name='code', cast_type=Bytes, default_value=bytes()))
class-attribute
instance-attribute
¶
Bytecode contained by the account.
storage: Optional[Storage | Storage.StorageDictType] = field(default=None, json_encoder=JSONEncoder.Field(name='storage', cast_type=Storage, to_json=True, default_value={}))
class-attribute
instance-attribute
¶
Storage within a contract.
NONEXISTENT: object = object()
class-attribute
¶
Sentinel object used to specify when an account should not exist in the state.
NonceMismatch
¶
Bases: Exception
Test expected a certain nonce value for an account but a different value was found.
Source code in src/ethereum_test_tools/common/types.py
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
591 592 593 594 595 596 |
|
BalanceMismatch
¶
Bases: Exception
Test expected a certain balance for an account but a different value was found.
Source code in src/ethereum_test_tools/common/types.py
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
614 615 616 617 618 619 |
|
CodeMismatch
¶
Bases: Exception
Test expected a certain bytecode for an account but a different one was found.
Source code in src/ethereum_test_tools/common/types.py
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
637 638 639 640 641 642 |
|
check_alloc(address, alloc)
¶
Checks the returned alloc against an expected account in post state. Raises exception on failure.
Source code in src/ethereum_test_tools/common/types.py
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
|
from_dict(data)
classmethod
¶
Create account from dictionary.
Source code in src/ethereum_test_tools/common/types.py
686 687 688 689 690 691 692 693 |
|
with_code(code)
classmethod
¶
Create account with provided code
and nonce of 1
.
Source code in src/ethereum_test_tools/common/types.py
695 696 697 698 699 700 |
|
Withdrawal
dataclass
¶
Structure to represent a single withdrawal of a validator's balance from the beacon chain.
Source code in src/ethereum_test_tools/common/types.py
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 |
|
to_serializable_list()
¶
Returns a list of the withdrawal's attributes in the order they should be serialized.
Source code in src/ethereum_test_tools/common/types.py
762 763 764 765 766 767 768 769 770 771 772 |
|
Environment
dataclass
¶
Structure used to keep track of the context in which a block must be executed.
Source code in src/ethereum_test_tools/common/types.py
811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
|
from_parent_header(parent)
staticmethod
¶
Instantiates a new environment with the provided header as parent.
Source code in src/ethereum_test_tools/common/types.py
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 |
|
parent_hash()
¶
Obtains the latest hash according to the highest block number in
block_hashes
.
Source code in src/ethereum_test_tools/common/types.py
993 994 995 996 997 998 999 1000 1001 1002 |
|
apply_new_parent(new_parent)
¶
Applies a header as parent to a copy of this environment.
Source code in src/ethereum_test_tools/common/types.py
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 |
|
set_fork_requirements(fork)
¶
Fills the required fields in an environment depending on the fork.
Source code in src/ethereum_test_tools/common/types.py
1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
|
AccessList
dataclass
¶
Access List for transactions.
Source code in src/ethereum_test_tools/common/types.py
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 |
|
to_list()
¶
Returns the access list as a list of serializable elements.
Source code in src/ethereum_test_tools/common/types.py
1083 1084 1085 1086 1087 |
|
Transaction
dataclass
¶
Generic object that can represent all Ethereum transaction types.
Source code in src/ethereum_test_tools/common/types.py
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 |
|
ty: Optional[int] = field(default=None, json_encoder=JSONEncoder.Field(name='type', cast_type=HexNumber))
class-attribute
instance-attribute
¶
Transaction type value.
InvalidFeePayment
¶
Bases: Exception
Transaction described more than one fee payment type.
Source code in src/ethereum_test_tools/common/types.py
1256 1257 1258 1259 1260 1261 1262 1263 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
1261 1262 1263 |
|
InvalidSignaturePrivateKey
¶
Bases: Exception
Transaction describes both the signature and private key of source account.
Source code in src/ethereum_test_tools/common/types.py
1265 1266 1267 1268 1269 1270 1271 1272 1273 |
|
__str__()
¶
Print exception string
Source code in src/ethereum_test_tools/common/types.py
1271 1272 1273 |
|
__post_init__()
¶
Ensures the transaction has no conflicting properties.
Source code in src/ethereum_test_tools/common/types.py
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 |
|
with_error(error)
¶
Create a copy of the transaction with an added error.
Source code in src/ethereum_test_tools/common/types.py
1318 1319 1320 1321 1322 1323 1324 |
|
with_nonce(nonce)
¶
Create a copy of the transaction with a modified nonce.
Source code in src/ethereum_test_tools/common/types.py
1326 1327 1328 1329 1330 1331 1332 |
|
with_fields(**kwargs)
¶
Create a deepcopy of the transaction with modified fields.
Source code in src/ethereum_test_tools/common/types.py
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 |
|
payload_body()
¶
Returns the list of values included in the transaction body.
Source code in src/ethereum_test_tools/common/types.py
1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 |
|
serialized_bytes()
¶
Returns bytes of the serialized representation of the transaction, which is almost always RLP encoding.
Source code in src/ethereum_test_tools/common/types.py
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 |
|
signing_envelope()
¶
Returns the list of values included in the envelope used for signing.
Source code in src/ethereum_test_tools/common/types.py
1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 |
|
signing_bytes()
¶
Returns the serialized bytes of the transaction used for signing.
Source code in src/ethereum_test_tools/common/types.py
1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 |
|
with_signature_and_sender()
¶
Returns a signed version of the transaction using the private key.
Source code in src/ethereum_test_tools/common/types.py
1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 |
|
Header
dataclass
¶
Header type used to describe block header properties in test specs.
Source code in src/ethereum_test_tools/common/types.py
1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 |
|
REMOVE_FIELD: Removable = Removable()
class-attribute
¶
Sentinel object used to specify that a header field should be removed.
Block
dataclass
¶
Bases: Header
Block type used to describe block properties in test specs
Source code in src/ethereum_test_tools/common/types.py
2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 |
|
rlp: Optional[BytesConvertible] = None
class-attribute
instance-attribute
¶
If set, blockchain test will skip generating the block and will pass this value directly to the Fixture.
Only meant to be used to simulate blocks with bad formats, and therefore requires the block to produce an exception.
rlp_modifier: Optional[Header] = None
class-attribute
instance-attribute
¶
An RLP modifying header which values would be used to override the ones
returned by the evm_transition_tool
.
exception: Optional[str] = None
class-attribute
instance-attribute
¶
If set, the block is expected to be rejected by the client.
engine_api_error_code: Optional[EngineAPIError] = None
class-attribute
instance-attribute
¶
If set, the block is expected to produce an error response from the Engine API.
txs: Optional[List[Transaction]] = None
class-attribute
instance-attribute
¶
List of transactions included in the block.
ommers: Optional[List[Header]] = None
class-attribute
instance-attribute
¶
List of ommer headers included in the block.
withdrawals: Optional[List[Withdrawal]] = None
class-attribute
instance-attribute
¶
List of withdrawals to perform for this block.
set_environment(env)
¶
Creates a copy of the environment with the characteristics of this specific block.
Source code in src/ethereum_test_tools/common/types.py
2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 |
|
copy_with_rlp(rlp)
¶
Creates a copy of the block and adds the specified RLP.
Source code in src/ethereum_test_tools/common/types.py
2313 2314 2315 2316 2317 2318 2319 |
|
FixtureEngineNewPayload
dataclass
¶
Representation of the engine_newPayloadVX
information to be
sent using the block information.
Source code in src/ethereum_test_tools/common/types.py
2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 |
|
from_fixture_header(fork, header, transactions, withdrawals, error_code)
classmethod
¶
Creates a FixtureEngineNewPayload
from a FixtureHeader
.
Source code in src/ethereum_test_tools/common/types.py
2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 |
|
Fixture
dataclass
¶
Cross-client compatible Ethereum test fixture.
Source code in src/ethereum_test_tools/common/types.py
2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 |
|
__post_init__()
¶
Post init hook to convert to JSON after instantiation.
Source code in src/ethereum_test_tools/common/types.py
2651 2652 2653 2654 2655 |
|
to_json()
¶
Convert to JSON.
Source code in src/ethereum_test_tools/common/types.py
2657 2658 2659 2660 2661 2662 2663 |
|
fill_info(t8n, ref_spec)
¶
Fill the info field for this fixture
Source code in src/ethereum_test_tools/common/types.py
2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 |
|