Ethereum Test Types package¶
Common definitions and types.
TestParameterGroup
dataclass
¶
Base class for grouping test parameters in a dataclass. Provides a generic repr method to generate clean test ids, including only non-default optional fields.
Source code in src/ethereum_test_types/helpers.py
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 |
|
__repr__()
¶
Generate repr string, intended to be used as a test id, based on the class name and the values of the non-default optional fields.
Source code in src/ethereum_test_types/helpers.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
add_kzg_version(b_hashes, kzg_version)
¶
Add Kzg Version to each blob hash.
Source code in src/ethereum_test_types/helpers.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
ceiling_division(a, b)
¶
Calculate ceil without using floating point. Used by many of the EVM's formulas.
Source code in src/ethereum_test_types/helpers.py
19 20 21 22 23 24 |
|
compute_create2_address(address, salt, initcode)
¶
Compute address of the resulting contract created using the CREATE2
opcode.
Source code in src/ethereum_test_types/helpers.py
54 55 56 57 58 59 60 61 62 63 64 |
|
compute_create_address(*, address, nonce=None, salt=0, initcode=b'', opcode=Op.CREATE)
¶
Compute address of the resulting contract created using a transaction
or the CREATE
opcode.
Source code in src/ethereum_test_types/helpers.py
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 |
|
compute_eofcreate_address(address, salt)
¶
Compute address of the resulting contract created using the EOFCREATE
opcode.
Source code in src/ethereum_test_types/helpers.py
67 68 69 70 71 72 |
|
EOA
¶
Bases: Address
An Externally Owned Account (EOA) is an account controlled by a private key.
The EOA is defined by its address and (optionally) by its corresponding private key.
Source code in src/ethereum_test_types/types.py
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 |
|
__new__(address=None, *, key=None, nonce=0)
¶
Init the EOA.
Source code in src/ethereum_test_types/types.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
get_nonce()
¶
Return current nonce of the EOA and increments it by one.
Source code in src/ethereum_test_types/types.py
118 119 120 121 122 |
|
copy()
¶
Return copy of the EOA.
Source code in src/ethereum_test_types/types.py
124 125 126 |
|
Account
¶
Bases: CamelModel
State associated with an address.
Source code in src/ethereum_test_base_types/composite_types.py
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 |
|
nonce: ZeroPaddedHexNumber = ZeroPaddedHexNumber(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: ZeroPaddedHexNumber = ZeroPaddedHexNumber(0)
class-attribute
instance-attribute
¶
The amount of Wei (10-18 Eth) the account has.
code: Bytes = Bytes(b'')
class-attribute
instance-attribute
¶
Bytecode contained by the account.
storage: Storage = Field(default_factory=Storage)
class-attribute
instance-attribute
¶
Storage within a contract.
NONEXISTENT: None = None
class-attribute
¶
Sentinel object used to specify when an account should not exist in the state.
NonceMismatchError
dataclass
¶
Bases: Exception
Test expected a certain nonce value for an account but a different value was found.
Source code in src/ethereum_test_base_types/composite_types.py
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 |
|
__init__(address, want, got, *args)
¶
Initialize the exception with the address, wanted and got values.
Source code in src/ethereum_test_base_types/composite_types.py
331 332 333 334 335 336 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_base_types/composite_types.py
338 339 340 341 342 343 344 345 346 |
|
BalanceMismatchError
dataclass
¶
Bases: Exception
Test expected a certain balance for an account but a different value was found.
Source code in src/ethereum_test_base_types/composite_types.py
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 |
|
__init__(address, want, got, *args)
¶
Initialize the exception with the address, wanted and got values.
Source code in src/ethereum_test_base_types/composite_types.py
359 360 361 362 363 364 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_base_types/composite_types.py
366 367 368 369 370 371 372 373 374 |
|
CodeMismatchError
dataclass
¶
Bases: Exception
Test expected a certain bytecode for an account but a different one was found.
Source code in src/ethereum_test_base_types/composite_types.py
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 |
|
__init__(address, want, got, *args)
¶
Initialize the exception with the address, wanted and got values.
Source code in src/ethereum_test_base_types/composite_types.py
387 388 389 390 391 392 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_base_types/composite_types.py
394 395 396 397 398 399 400 401 402 |
|
check_alloc(address, account)
¶
Check the returned alloc against an expected account in post state. Raises exception on failure.
Source code in src/ethereum_test_base_types/composite_types.py
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 |
|
__bool__()
¶
Return True on a non-empty account.
Source code in src/ethereum_test_base_types/composite_types.py
436 437 438 |
|
with_code(code)
classmethod
¶
Create account with provided code
and nonce of 1
.
Source code in src/ethereum_test_base_types/composite_types.py
440 441 442 443 |
|
merge(account_1, account_2)
classmethod
¶
Create a merged account from two sources.
Source code in src/ethereum_test_base_types/composite_types.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
|
Alloc
¶
Bases: Alloc
Allocation of accounts in the state, pre and post test execution.
Source code in src/ethereum_test_types/types.py
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 292 293 294 295 296 297 298 299 |
|
UnexpectedAccountError
dataclass
¶
Bases: Exception
Unexpected account found in the allocation.
Source code in src/ethereum_test_types/types.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
__init__(address, account, *args)
¶
Initialize the exception.
Source code in src/ethereum_test_types/types.py
141 142 143 144 145 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_types/types.py
147 148 149 |
|
MissingAccountError
dataclass
¶
Bases: Exception
Expected account not found in the allocation.
Source code in src/ethereum_test_types/types.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
__init__(address, *args)
¶
Initialize the exception.
Source code in src/ethereum_test_types/types.py
157 158 159 160 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_types/types.py
162 163 164 |
|
merge(alloc_1, alloc_2)
classmethod
¶
Return merged allocation of two sources.
Source code in src/ethereum_test_types/types.py
166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
__iter__()
¶
Return iterator over the allocation.
Source code in src/ethereum_test_types/types.py
180 181 182 |
|
items()
¶
Return iterator over the allocation items.
Source code in src/ethereum_test_types/types.py
184 185 186 |
|
__getitem__(address)
¶
Return account associated with an address.
Source code in src/ethereum_test_types/types.py
188 189 190 191 192 |
|
__setitem__(address, account)
¶
Set account associated with an address.
Source code in src/ethereum_test_types/types.py
194 195 196 197 198 |
|
__delitem__(address)
¶
Delete account associated with an address.
Source code in src/ethereum_test_types/types.py
200 201 202 203 204 |
|
__eq__(other)
¶
Return True if both allocations are equal.
Source code in src/ethereum_test_types/types.py
206 207 208 209 210 |
|
__contains__(address)
¶
Check if an account is in the allocation.
Source code in src/ethereum_test_types/types.py
212 213 214 215 216 |
|
empty_accounts()
¶
Return list of addresses of empty accounts.
Source code in src/ethereum_test_types/types.py
218 219 220 |
|
state_root()
¶
Return state root of the allocation.
Source code in src/ethereum_test_types/types.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
|
verify_post_alloc(got_alloc)
¶
Verify that the allocation matches the expected post in the test. Raises exception on unexpected values.
Source code in src/ethereum_test_types/types.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
|
deploy_contract(code, *, storage=None, balance=0, nonce=1, address=None, evm_code_type=None, label=None)
¶
Deploy a contract to the allocation.
Source code in src/ethereum_test_types/types.py
267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
fund_eoa(amount=None, label=None, storage=None, delegation=None, nonce=None)
¶
Add a previously unused EOA to the pre-alloc with the balance specified by amount
.
Source code in src/ethereum_test_types/types.py
281 282 283 284 285 286 287 288 289 290 |
|
fund_address(address, amount)
¶
Fund an address with a given amount.
If the address is already present in the pre-alloc the amount will be added to its existing balance.
Source code in src/ethereum_test_types/types.py
292 293 294 295 296 297 298 299 |
|
AuthorizationTuple
¶
Bases: AuthorizationTupleGeneric[HexNumber]
Authorization tuple for transactions.
Source code in src/ethereum_test_types/types.py
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 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
|
model_post_init(__context)
¶
Automatically signs the authorization tuple if a secret key or sender are provided.
Source code in src/ethereum_test_types/types.py
483 484 485 486 |
|
sign()
¶
Signs the authorization tuple with a private key.
Source code in src/ethereum_test_types/types.py
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 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
|
CamelModel
¶
Bases: CopyValidateModel
A base model that converts field names to camel case when serializing.
For example, the field name current_timestamp
in a Python model will be represented
as currentTimestamp
when it is serialized to json.
Source code in src/ethereum_test_base_types/pydantic.py
35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
ConsolidationRequest
¶
Bases: RequestBase
, CamelModel
Consolidation Request type.
Source code in src/ethereum_test_types/types.py
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 |
|
source_address: Address = Address(0)
class-attribute
instance-attribute
¶
The address of the execution layer account that made the consolidation request.
source_pubkey: BLSPublicKey
instance-attribute
¶
The public key of the source validator as it currently is in the beacon state.
target_pubkey: BLSPublicKey
instance-attribute
¶
The public key of the target validator as it currently is in the beacon state.
__bytes__()
¶
Return consolidation's attributes as bytes.
Source code in src/ethereum_test_types/types.py
1191 1192 1193 |
|
DepositRequest
¶
Bases: RequestBase
, CamelModel
Deposit Request type.
Source code in src/ethereum_test_types/types.py
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 |
|
pubkey: BLSPublicKey
instance-attribute
¶
The public key of the beacon chain validator.
withdrawal_credentials: Hash
instance-attribute
¶
The withdrawal credentials of the beacon chain validator.
amount: HexNumber
instance-attribute
¶
The amount in gwei of the deposit.
signature: BLSSignature
instance-attribute
¶
The signature of the deposit using the validator's private key that matches the
pubkey
.
index: HexNumber
instance-attribute
¶
The index of the deposit.
__bytes__()
¶
Return deposit's attributes as bytes.
Source code in src/ethereum_test_types/types.py
1135 1136 1137 1138 1139 1140 1141 1142 1143 |
|
Environment
¶
Bases: EnvironmentGeneric[ZeroPaddedHexNumber]
Structure used to keep track of the context in which a block must be executed.
Source code in src/ethereum_test_types/types.py
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 |
|
parent_hash: Hash | None
cached
property
¶
Obtains the latest hash according to the highest block number in
block_hashes
.
set_fork_requirements(fork)
¶
Fill required fields in an environment depending on the fork.
Source code in src/ethereum_test_types/types.py
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 |
|
NetworkWrappedTransaction
¶
Bases: CamelModel
, RLPSerializable
Network wrapped transaction as defined in EIP-4844.
Source code in src/ethereum_test_types/types.py
1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 |
|
get_rlp_prefix()
¶
Return the transaction type as bytes to be appended at the beginning of the serialized transaction if type is not 0.
Source code in src/ethereum_test_types/types.py
1087 1088 1089 1090 1091 1092 1093 1094 |
|
Removable
¶
Sentinel class to detect if a parameter should be removed.
(None
normally means "do not modify").
Source code in src/ethereum_test_types/types.py
74 75 76 77 78 79 80 81 82 83 84 |
|
__eq__(other)
¶
Return True for all Removable.
Source code in src/ethereum_test_types/types.py
80 81 82 83 84 |
|
Requests
¶
Requests for the transition tool.
Source code in src/ethereum_test_types/types.py
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 |
|
__init__(*requests, requests_lists=None)
¶
Initialize requests object.
Source code in src/ethereum_test_types/types.py
1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 |
|
__bytes__()
¶
Return requests hash.
Source code in src/ethereum_test_types/types.py
1230 1231 1232 1233 |
|
Storage
¶
Bases: EthereumTestRootModel[Dict[StorageKeyValueType, StorageKeyValueType]]
Definition of contract storage in the pre
or post
state of a test.
This model accepts a dictionary with keys and values as any of: str, int,
bytes, or any type that supports conversion to bytes, and automatically
casts them to HashInt
.
Source code in src/ethereum_test_base_types/composite_types.py
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 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 |
|
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.
InvalidTypeError
dataclass
¶
Bases: Exception
Invalid type used when describing test's expected storage key or value.
Source code in src/ethereum_test_base_types/composite_types.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
__init__(key_or_value, *args)
¶
Initialize the exception with the invalid type.
Source code in src/ethereum_test_base_types/composite_types.py
48 49 50 51 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_base_types/composite_types.py
53 54 55 |
|
InvalidValueError
dataclass
¶
Bases: Exception
Invalid value used when describing test's expected storage key or value.
Source code in src/ethereum_test_base_types/composite_types.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
__init__(key_or_value, *args)
¶
Initialize the exception with the invalid value.
Source code in src/ethereum_test_base_types/composite_types.py
66 67 68 69 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_base_types/composite_types.py
71 72 73 |
|
MissingKeyError
dataclass
¶
Bases: Exception
Test expected to find a storage key set but key was missing.
Source code in src/ethereum_test_base_types/composite_types.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
__init__(key, *args)
¶
Initialize the exception with the missing key.
Source code in src/ethereum_test_base_types/composite_types.py
81 82 83 84 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_base_types/composite_types.py
86 87 88 |
|
KeyValueMismatchError
dataclass
¶
Bases: Exception
Test expected a certain value in a storage key but value found was different.
Source code in src/ethereum_test_base_types/composite_types.py
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 |
|
__init__(address, key, want, got, hint='', *args)
¶
Initialize the exception with the address, key, wanted and got values.
Source code in src/ethereum_test_base_types/composite_types.py
103 104 105 106 107 108 109 110 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_base_types/composite_types.py
112 113 114 115 116 117 118 119 120 121 122 |
|
__contains__(key)
¶
Check for an item in the storage.
Source code in src/ethereum_test_base_types/composite_types.py
124 125 126 |
|
__getitem__(key)
¶
Return an item from the storage.
Source code in src/ethereum_test_base_types/composite_types.py
128 129 130 131 132 |
|
__setitem__(key, value)
¶
Set an item in the storage.
Source code in src/ethereum_test_base_types/composite_types.py
134 135 136 137 138 139 140 141 142 |
|
__delitem__(key)
¶
Delete an item from the storage.
Source code in src/ethereum_test_base_types/composite_types.py
144 145 146 |
|
__iter__()
¶
Return an iterator over the storage.
Source code in src/ethereum_test_base_types/composite_types.py
148 149 150 |
|
__eq__(other)
¶
Return True if both storages are equal.
Source code in src/ethereum_test_base_types/composite_types.py
152 153 154 155 156 |
|
__ne__(other)
¶
Return True if both storages are not equal.
Source code in src/ethereum_test_base_types/composite_types.py
158 159 160 161 162 |
|
__bool__()
¶
Return True if the storage is not empty.
Source code in src/ethereum_test_base_types/composite_types.py
164 165 166 |
|
__add__(other)
¶
Return a new storage that is the sum of two storages.
Source code in src/ethereum_test_base_types/composite_types.py
168 169 170 |
|
keys()
¶
Return the keys of the storage.
Source code in src/ethereum_test_base_types/composite_types.py
172 173 174 |
|
set_next_slot(slot)
¶
Set the next slot to be used by store_next
.
Source code in src/ethereum_test_base_types/composite_types.py
176 177 178 179 |
|
items()
¶
Return the items of the storage.
Source code in src/ethereum_test_base_types/composite_types.py
181 182 183 |
|
set_expect_any(key)
¶
Mark key to be able to have any expected value when comparing storages.
Source code in src/ethereum_test_base_types/composite_types.py
185 186 187 |
|
store_next(value, hint='')
¶
Store 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_base_types/composite_types.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
peek_slot()
¶
Peek the next slot that will be used by store_next
.
Source code in src/ethereum_test_base_types/composite_types.py
205 206 207 |
|
contains(other)
¶
Return 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_base_types/composite_types.py
209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
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_base_types/composite_types.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
must_be_equal(address, other)
¶
Succeed only if "self" is equal to "other" storage.
Source code in src/ethereum_test_base_types/composite_types.py
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 |
|
canary()
¶
Return a canary storage filled with non-zero values where the current storage expects zero values, to guarantee that the test overwrites the storage.
Source code in src/ethereum_test_base_types/composite_types.py
284 285 286 287 288 289 |
|
Transaction
¶
Bases: TransactionGeneric[HexNumber]
, TransactionTransitionToolConverter
, SignableRLPSerializable
Generic object that can represent all Ethereum transaction types.
Source code in src/ethereum_test_types/types.py
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 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 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 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 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 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 |
|
InvalidFeePaymentError
¶
Bases: Exception
Transaction described more than one fee payment type.
Source code in src/ethereum_test_types/types.py
685 686 687 688 689 690 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_types/types.py
688 689 690 |
|
InvalidSignaturePrivateKeyError
¶
Bases: Exception
Transaction describes both the signature and private key of source account.
Source code in src/ethereum_test_types/types.py
692 693 694 695 696 697 698 699 700 |
|
__str__()
¶
Print exception string.
Source code in src/ethereum_test_types/types.py
698 699 700 |
|
model_post_init(__context)
¶
Ensure transaction has no conflicting properties.
Source code in src/ethereum_test_types/types.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 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 |
|
with_error(error)
¶
Create a copy of the transaction with an added error.
Source code in src/ethereum_test_types/types.py
773 774 775 776 777 |
|
with_nonce(nonce)
¶
Create a copy of the transaction with a modified nonce.
Source code in src/ethereum_test_types/types.py
779 780 781 |
|
signature_bytes: Bytes
cached
property
¶
Returns the serialized bytes of the transaction signature.
sign()
¶
Signs the authorization tuple with a private key.
Source code in src/ethereum_test_types/types.py
800 801 802 803 804 805 806 807 808 809 810 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 |
|
with_signature_and_sender(*, keep_secret_key=False)
¶
Return signed version of the transaction using the private key.
Source code in src/ethereum_test_types/types.py
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 |
|
get_rlp_signing_fields()
¶
Return the list of values included in the envelope used for signing depending on the transaction type.
Source code in src/ethereum_test_types/types.py
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 |
|
get_rlp_fields()
¶
Return the list of values included in the list used for rlp encoding depending on the transaction type.
Source code in src/ethereum_test_types/types.py
1006 1007 1008 1009 1010 1011 1012 1013 1014 |
|
get_rlp_prefix()
¶
Return the transaction type as bytes to be appended at the beginning of the serialized transaction if type is not 0.
Source code in src/ethereum_test_types/types.py
1016 1017 1018 1019 1020 1021 1022 1023 |
|
get_rlp_signing_prefix()
¶
Return the transaction type as bytes to be appended at the beginning of the serialized transaction signing envelope if type is not 0.
Source code in src/ethereum_test_types/types.py
1025 1026 1027 1028 1029 1030 1031 1032 |
|
hash: Hash
cached
property
¶
Returns hash of the transaction.
serializable_list: Any
cached
property
¶
Return list of values included in the transaction as a serializable object.
list_root(input_txs)
staticmethod
¶
Return transactions root of a list of transactions.
Source code in src/ethereum_test_types/types.py
1044 1045 1046 1047 1048 1049 1050 |
|
list_blob_versioned_hashes(input_txs)
staticmethod
¶
Get list of ordered blob versioned hashes from a list of transactions.
Source code in src/ethereum_test_types/types.py
1052 1053 1054 1055 1056 1057 1058 1059 1060 |
|
created_contract: Address
cached
property
¶
Return address of the contract created by the transaction.
TransactionDefaults
dataclass
¶
Default values for transactions.
Source code in src/ethereum_test_types/types.py
578 579 580 581 582 583 584 585 |
|
TransactionReceipt
¶
Bases: CamelModel
Transaction receipt.
Source code in src/ethereum_test_types/types.py
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
|
Withdrawal
¶
Bases: WithdrawalGeneric[HexNumber]
Withdrawal type.
Source code in src/ethereum_test_types/types.py
331 332 333 334 |
|
WithdrawalRequest
¶
Bases: RequestBase
, CamelModel
Withdrawal Request type.
Source code in src/ethereum_test_types/types.py
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 |
|
source_address: Address = Address(0)
class-attribute
instance-attribute
¶
The address of the execution layer account that made the withdrawal request.
validator_pubkey: BLSPublicKey
instance-attribute
¶
The current public key of the validator as it currently is in the beacon state.
amount: HexNumber
instance-attribute
¶
The amount in gwei to be withdrawn on the beacon chain.
__bytes__()
¶
Return withdrawal's attributes as bytes.
Source code in src/ethereum_test_types/types.py
1164 1165 1166 1167 1168 1169 1170 |
|
keccak256(data)
¶
Calculate keccak256 hash of the given data.
Source code in src/ethereum_test_types/types.py
60 61 62 |
|