Ethereum Test Base Types package¶
Common definitions and types.
Address
¶
Bases: FixedSizeBytes[20]
Class that helps represent Ethereum addresses in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | |
__new__(input_bytes, *args, label=None, **kwargs)
¶
Create a new Address object with an optional label.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | |
Bloom
¶
Bases: FixedSizeBytes[256]
Class that helps represent blooms in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
467 468 469 470 | |
BLSPublicKey
¶
Bases: FixedSizeBytes[48]
Class that helps represent BLS public keys in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
479 480 481 482 | |
BLSSignature
¶
Bases: FixedSizeBytes[96]
Class that helps represent BLS signatures in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
485 486 487 488 | |
Bytes
¶
Bases: bytes, ToStringSchema
Class that helps represent bytes of variable length in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
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 | |
__new__(input_bytes=b'')
¶
Create a new Bytes object.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
183 184 185 186 187 | |
__str__()
¶
Return the hexadecimal representation of the bytes.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
191 192 193 | |
hex(*args, **kwargs)
¶
Return the hexadecimal representation of the bytes.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
195 196 197 | |
keccak256()
¶
Return the keccak256 hash of the opcode byte representation.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
199 200 201 202 203 204 205 206 207 | |
sha256()
¶
Return the sha256 hash of the opcode byte representation.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
209 210 211 | |
__get_pydantic_core_schema__(source_type, handler)
staticmethod
¶
Call the class constructor without info and appends the serialization schema.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
BytesConcatenation
¶
Bases: SupportsBytes, Sized
A class that can be concatenated with bytes.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
__len__()
¶
Return length of the object when converted to bytes.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
250 251 252 | |
__add__(other)
¶
Concatenates the object with another bytes object.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
254 255 256 | |
__radd__(other)
¶
Concatenates the object with another bytes object.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
258 259 260 | |
CoerceBytes
¶
Bases: Bytes
Class that helps represent bytes of variable length in tests and supports removing white spaces anywhere in the string.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
232 233 234 235 236 237 238 239 240 241 242 243 244 | |
__new__(input_bytes=b'')
¶
Create a new CoerceBytes object.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
238 239 240 241 242 243 244 | |
FixedSizeBytes
¶
Bases: Bytes
Class that helps represent bytes of fixed length in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
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 | |
__class_getitem__(length)
¶
Create a new FixedSizeBytes class with the given length.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
342 343 344 345 346 347 348 349 | |
__new__(input_bytes, *, left_padding=False, right_padding=False)
¶
Create a new FixedSizeBytes object.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
__eq__(other)
¶
Compare two FixedSizeBytes objects to be equal.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
__ne__(other)
¶
Compare two FixedSizeBytes objects to be not equal.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
389 390 391 | |
__get_pydantic_core_schema__(source_type, handler)
classmethod
¶
Call the class constructor without info and appends the serialization schema.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |
ForkHash
¶
Bases: FixedSizeBytes[4]
Class that helps represent the CRC config hashes and identifiers of a fork.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
411 412 413 414 415 416 | |
Hash
¶
Bases: FixedSizeBytes[32]
Class that helps represent hashes in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
442 443 444 445 | |
HashInt
¶
Bases: FixedSizeHexNumber[32]
Class that helps represent hashes in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
330 331 332 333 | |
HeaderNonce
¶
Bases: FixedSizeBytes[8]
Class that helps represent the header nonce in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
473 474 475 476 | |
HexNumber
¶
Bases: Number
Class that helps represent hexadecimal numbers in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
__str__()
¶
Return the string representation of the number.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
123 124 125 | |
__get_pydantic_core_schema__(source_type, handler)
staticmethod
¶
Call the class constructor without info and appends the serialization schema.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
Number
¶
Bases: int, ToStringSchema
Class that helps represent numbers in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
__new__(input_number)
¶
Create a new Number object.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
57 58 59 | |
__str__()
¶
Return the string representation of the number.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
61 62 63 | |
hex()
¶
Return the hexadecimal representation of the number.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
65 66 67 | |
StorageKey
¶
Bases: FixedSizeBytes[32]
Storage key type that automatically applies left padding for values shorter than 32 bytes.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | |
__new__(input_bytes, **kwargs)
¶
Create a new StorageKey with automatic left padding.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
454 455 456 457 458 459 460 461 462 463 464 | |
Wei
¶
Bases: Number
Class that helps represent wei that can be parsed from strings.
Source code in packages/testing/src/execution_testing/base_types/base_types.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 | |
__new__(input_number)
¶
Create a new Number object.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
ZeroPaddedHexNumber
¶
Bases: HexNumber
Class that helps represent zero padded hexadecimal numbers in tests.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
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 | |
hex()
¶
Return the hexadecimal representation of the number.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
147 148 149 150 151 152 153 154 | |
__get_pydantic_core_schema__(source_type, handler)
staticmethod
¶
Call the class constructor without info and appends the serialization schema.
Source code in packages/testing/src/execution_testing/base_types/base_types.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
to_json(input_model)
¶
Convert a model to its json data representation.
Source code in packages/testing/src/execution_testing/base_types/base_types_json.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
AccessList
¶
Bases: CamelModel, RLPSerializable
Access List for transactions.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
429 430 431 432 433 434 435 | |
Account
¶
Bases: CamelModel
State associated with an address.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
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 | |
nonce = 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(0)
class-attribute
instance-attribute
¶
The amount of Wei (10-18 Eth) the account has.
code = Bytes(b'')
class-attribute
instance-attribute
¶
Bytecode contained by the account.
storage = Field(default_factory=Storage)
class-attribute
instance-attribute
¶
Storage within a contract.
Alloc
¶
Bases: EthereumTestRootModel[Dict[Address, Account | None]]
Allocation of accounts in the state, pre and post test execution.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
405 406 407 408 409 410 411 412 413 414 415 416 417 | |
get(address)
¶
Get an account if it's present in the allocation, otherwise None.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
412 413 414 415 416 417 | |
BlobSchedule
¶
Bases: EthereumTestRootModel[Dict[str, ForkBlobSchedule]]
Blob schedule configuration dictionary.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | |
append(*, fork, schedule)
¶
Append a new fork schedule.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
453 454 455 456 457 | |
last()
¶
Return the last schedule.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
459 460 461 462 463 | |
__getitem__(key)
¶
Return the schedule for a given fork.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
465 466 467 | |
ForkBlobSchedule
¶
Bases: CamelModel
Representation of the blob schedule of a given fork.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
438 439 440 441 442 443 | |
StateCommitment
¶
Bases: Enum
The state-commitment scheme used to compute an allocation's state root.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
420 421 422 423 424 425 426 | |
MPT = auto()
class-attribute
instance-attribute
¶
Merkle-Patricia trie.
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 packages/testing/src/execution_testing/base_types/composite_types.py
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 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 | |
StorageDictType = 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 packages/testing/src/execution_testing/base_types/composite_types.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
__init__(key_or_value, *args)
¶
Initialize the exception with the invalid type.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
81 82 83 84 | |
__str__()
¶
Print exception string.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
86 87 88 | |
InvalidValueError
dataclass
¶
Bases: Exception
Invalid value used when describing test's expected storage key or value.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
__init__(key_or_value, *args)
¶
Initialize the exception with the invalid value.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
99 100 101 102 | |
__str__()
¶
Print exception string.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
104 105 106 | |
MissingKeyError
dataclass
¶
Bases: Exception
Test expected to find a storage key set but key was missing.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
__init__(key, *args)
¶
Initialize the exception with the missing key.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
114 115 116 117 | |
__str__()
¶
Print exception string.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
119 120 121 | |
KeyValueMismatchError
dataclass
¶
Bases: Exception
Test expected a certain value in a storage key but value found was different.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
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 | |
__init__(address, key, want, got, hint='', *args)
¶
Initialize the exception with the address, key, wanted and got values.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | |
__str__()
¶
Print exception string.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
156 157 158 159 160 161 162 163 164 165 166 167 | |
__contains__(key)
¶
Check for an item in the storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
169 170 171 172 173 | |
__getitem__(key)
¶
Return an item from the storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
175 176 177 178 179 | |
freeze()
¶
Reject any further writes to the storage, and return it.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
181 182 183 184 | |
__setitem__(key, value)
¶
Set an item in the storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
196 197 198 199 200 201 202 203 204 205 | |
__delitem__(key)
¶
Delete an item from the storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
207 208 209 210 211 212 | |
__iter__()
¶
Return an iterator over the storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
214 215 216 | |
__eq__(other)
¶
Return True if both storages are equal.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
218 219 220 221 222 | |
__ne__(other)
¶
Return True if both storages are not equal.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
224 225 226 227 228 | |
__bool__()
¶
Return True if the storage is not empty.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
230 231 232 | |
__add__(other)
¶
Return a new storage that is the sum of two storages.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
234 235 236 | |
__len__()
¶
Return the number of keys that have been explicitly set in the storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
238 239 240 241 242 | |
keys()
¶
Return the keys of the storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
244 245 246 | |
set_next_slot(slot)
¶
Set the next slot to be used by store_next.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
248 249 250 251 252 | |
items()
¶
Return the items of the storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
254 255 256 | |
set_expect_any(key)
¶
Mark key to be able to have any expected value when comparing storages.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
258 259 260 261 262 263 264 265 | |
store_next(value, hint='')
¶
Store a value in the storage and return 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 packages/testing/src/execution_testing/base_types/composite_types.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
peek_slot()
¶
Peek the next slot that will be used by store_next.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
287 288 289 | |
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 packages/testing/src/execution_testing/base_types/composite_types.py
291 292 293 294 295 296 297 298 299 300 301 302 | |
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 packages/testing/src/execution_testing/base_types/composite_types.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
must_be_equal(address, other)
¶
Succeed only if "self" is equal to "other" storage.
Source code in packages/testing/src/execution_testing/base_types/composite_types.py
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 | |
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 packages/testing/src/execution_testing/base_types/composite_types.py
364 365 366 367 368 369 370 371 372 | |
to_bytes(input_bytes)
¶
Convert multiple types into bytes.
Source code in packages/testing/src/execution_testing/base_types/conversions.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
to_hex(input_bytes)
¶
Convert multiple types into a bytes hex string.
Source code in packages/testing/src/execution_testing/base_types/conversions.py
72 73 74 | |
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 packages/testing/src/execution_testing/base_types/pydantic.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
EthereumTestBaseModel
¶
Bases: BaseModel, ModelCustomizationsMixin
Base model for all models for Ethereum tests.
Source code in packages/testing/src/execution_testing/base_types/pydantic.py
14 15 16 17 | |
EthereumTestRootModel
¶
Bases: RootModel[RootModelRootType], ModelCustomizationsMixin
Base model for all models for Ethereum tests.
Source code in packages/testing/src/execution_testing/base_types/pydantic.py
20 21 22 23 24 25 | |
ReferenceSpec
¶
Reference Specification Description Abstract Class.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
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 | |
name()
abstractmethod
¶
Return the name of the spec.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
32 33 34 35 | |
has_known_version()
abstractmethod
¶
Return true if the reference spec object is hard-coded with a latest known version.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
37 38 39 40 41 42 43 | |
known_version()
abstractmethod
¶
Return the latest known version in the reference.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
45 46 47 48 | |
api_url()
abstractmethod
¶
Return the URL required to poll the version from an API, if needed.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
50 51 52 53 54 55 | |
latest_version()
abstractmethod
¶
Return a digest that points to the latest version of the spec.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
57 58 59 60 | |
is_outdated()
abstractmethod
¶
Check whether the reference specification has been updated since the test was last updated.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
62 63 64 65 66 67 68 | |
write_info(info)
abstractmethod
¶
Write info about the reference specification used into the output fixture.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
70 71 72 73 74 75 76 | |
parseable_from_module(module_dict)
abstractmethod
staticmethod
¶
Check whether the module's dict contains required reference spec information.
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
78 79 80 81 82 83 84 85 | |
parse_from_module(module_dict, github_token=None)
abstractmethod
staticmethod
¶
Parse the module's dict into a reference spec.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_dict
|
Dict[str, Any]
|
Dictionary containing module information |
required |
github_token
|
Optional[str]
|
Optional GitHub token for API authentication |
None
|
Source code in packages/testing/src/execution_testing/base_types/reference_spec/reference_spec.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
KnownEncodedSize
¶
Stand in for an item whose encoded size is already known.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
31 32 33 34 35 36 37 38 | |
__init__(size)
¶
Record the encoded size of the item this stands in for.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
36 37 38 | |
RLPSerializable
¶
Class that adds RLP serialization to another class.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
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 | |
get_rlp_fields()
¶
Return an ordered list of field names to be included in RLP serialization.
Function can be overridden to customize the logic to return the fields.
By default, rlp_fields class variable is used.
The list can be nested list up to one extra level to represent nested fields.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
116 117 118 119 120 121 122 123 124 125 126 127 128 | |
get_rlp_signing_fields()
¶
Return an ordered list of field names to be included in the RLP serialization of the object signature.
Function can be overridden to customize the logic to return the fields.
By default, rlp_signing_fields class variable is used.
The list can be nested list up to one extra level to represent nested fields.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
130 131 132 133 134 135 136 137 138 139 140 141 142 | |
get_rlp_prefix()
¶
Return a prefix that has to be appended to the serialized object.
By default, an empty string is returned.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
144 145 146 147 148 149 150 | |
get_rlp_signing_prefix()
¶
Return a prefix that has to be appended to the serialized signing object.
By default, an empty string is returned.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
152 153 154 155 156 157 158 159 | |
sign()
¶
Sign the current object for further serialization.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
161 162 163 164 165 | |
to_list_from_fields(fields)
¶
Return an RLP serializable list that can be passed to eth_rlp.encode.
Can be for signing purposes or the entire object.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
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 | |
to_list(signing=False)
¶
Return an RLP serializable list that can be passed to eth_rlp.encode.
Can be for signing purposes or the entire object.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
rlp_signing_bytes()
¶
Return the signing serialized envelope used for signing.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
219 220 221 222 223 224 | |
rlp()
¶
Return the serialized object.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
226 227 228 229 230 231 232 | |
rlp_size()
¶
Return len(self.rlp()) without building the encoding.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
234 235 236 237 238 239 240 | |
list_root(element_list)
classmethod
¶
Return the root of a list of the given type.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
242 243 244 245 246 247 248 249 250 251 | |
SignableRLPSerializable
¶
Bases: RLPSerializable
Class that adds RLP serialization to another class with signing support.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
254 255 256 257 258 259 260 261 262 263 264 265 | |
sign()
¶
Sign the current object for further serialization.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
261 262 263 264 265 | |
encoded_prefixed_size(payload_size)
¶
Return the encoded size of an item with a payload of payload_size
bytes, its length prefix included.
Source code in packages/testing/src/execution_testing/base_types/serialization.py
41 42 43 44 45 46 47 48 | |
encoded_size(raw_data)
¶
Return len(eth_rlp.encode(raw_data)) without building the encoding.
This covers the same cases as ethereum_rlp.encode, plus
KnownEncodedSize placeholders, so measuring the size of a large
structure costs a walk over it instead of megabytes of intermediate byte
strings. The concrete types come first: the abstract
Sequence check is slow enough to dominate the walk.
Source code in packages/testing/src/execution_testing/base_types/serialization.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 | |
unwrap_annotation(hint)
¶
Recursively unwrap Annotated and Union types to find the actual type.
This function is useful for introspecting complex type annotations like:
- Annotated[int, ...] -> int
- int | None -> int
- Annotated[int, ...] | None -> int
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
hint
|
Any
|
Type annotation to unwrap |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The unwrapped base type |
Source code in packages/testing/src/execution_testing/base_types/typing_utils.py
6 7 8 9 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 | |