|
| 1 | +"""Ethrex execution client transition tool.""" |
| 2 | + |
| 3 | +from ethereum_test_exceptions import BlockException, ExceptionMapper, TransactionException |
| 4 | + |
| 5 | + |
| 6 | +class EthrexExceptionMapper(ExceptionMapper): |
| 7 | + """Ethrex exception mapper.""" |
| 8 | + |
| 9 | + mapping_substring = { |
| 10 | + TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: ( |
| 11 | + "Exceeded MAX_BLOB_GAS_PER_BLOCK" |
| 12 | + ), |
| 13 | + TransactionException.INVALID_DEPOSIT_EVENT_LAYOUT: ("Invalid deposit request layout"), |
| 14 | + BlockException.INVALID_REQUESTS: ( |
| 15 | + "Requests hash does not match the one in the header after executing" |
| 16 | + ), |
| 17 | + BlockException.INVALID_RECEIPTS_ROOT: ( |
| 18 | + "Receipts Root does not match the one in the header after executing" |
| 19 | + ), |
| 20 | + BlockException.INVALID_STATE_ROOT: ( |
| 21 | + "World State Root does not match the one in the header after executing" |
| 22 | + ), |
| 23 | + BlockException.INVALID_GAS_USED: "Gas used doesn't match value in header", |
| 24 | + BlockException.INCORRECT_BLOB_GAS_USED: "Blob gas used doesn't match value in header", |
| 25 | + } |
| 26 | + mapping_regex = { |
| 27 | + TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS: ( |
| 28 | + r"(?i)priority fee is greater than max fee" |
| 29 | + ), |
| 30 | + TransactionException.TYPE_4_EMPTY_AUTHORIZATION_LIST: r"(?i)empty authorization list", |
| 31 | + TransactionException.SENDER_NOT_EOA: ( |
| 32 | + r"reject transactions from senders with deployed code|" |
| 33 | + r"Sender account should not have bytecode" |
| 34 | + ), |
| 35 | + TransactionException.NONCE_MISMATCH_TOO_LOW: r"nonce \d+ too low, expected \d+", |
| 36 | + TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED: ( |
| 37 | + r"blob gas used \d+ exceeds maximum allowance \d+" |
| 38 | + ), |
| 39 | + TransactionException.TYPE_3_TX_ZERO_BLOBS: ( |
| 40 | + r"blob transactions present in pre-cancun payload|empty blobs|" |
| 41 | + r"Type 3 transaction without blobs" |
| 42 | + ), |
| 43 | + TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH: ( |
| 44 | + r"blob version not supported|Invalid blob versioned hash" |
| 45 | + ), |
| 46 | + TransactionException.TYPE_3_TX_PRE_FORK: ( |
| 47 | + r"blob versioned hashes not supported|" |
| 48 | + r"Type 3 transactions are not supported before the Cancun fork" |
| 49 | + ), |
| 50 | + TransactionException.TYPE_4_TX_CONTRACT_CREATION: ( |
| 51 | + r"unexpected length|Contract creation in type 4 transaction" |
| 52 | + ), |
| 53 | + TransactionException.TYPE_4_TX_PRE_FORK: ( |
| 54 | + r"eip 7702 transactions present in pre-prague payload|" |
| 55 | + r"Type 4 transactions are not supported before the Prague fork" |
| 56 | + ), |
| 57 | + TransactionException.INSUFFICIENT_ACCOUNT_FUNDS: ( |
| 58 | + r"lack of funds \(\d+\) for max fee \(\d+\)|Insufficient account founds" |
| 59 | + ), |
| 60 | + TransactionException.INTRINSIC_GAS_TOO_LOW: ( |
| 61 | + r"gas floor exceeds the gas limit|call gas cost exceeds the gas limit|" |
| 62 | + r"Intrinsic gas too low" |
| 63 | + ), |
| 64 | + TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS: ( |
| 65 | + r"gas price is less than basefee|Insufficient max fee per gas" |
| 66 | + ), |
| 67 | + TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS: ( |
| 68 | + r"blob gas price is greater than max fee per blob gas|" |
| 69 | + r"Insufficient max fee per blob gas" |
| 70 | + ), |
| 71 | + TransactionException.INITCODE_SIZE_EXCEEDED: ( |
| 72 | + r"create initcode size limit|Initcode size exceeded" |
| 73 | + ), |
| 74 | + BlockException.SYSTEM_CONTRACT_CALL_FAILED: (r"failed to apply .* requests contract call"), |
| 75 | + BlockException.INCORRECT_BLOB_GAS_USED: (r"Blob gas used doesn't match value in header"), |
| 76 | + BlockException.RLP_STRUCTURES_ENCODING: (r"Error decoding field '\D+' of type \w+.*"), |
| 77 | + BlockException.INCORRECT_EXCESS_BLOB_GAS: (r".* Excess blob gas is incorrect"), |
| 78 | + BlockException.INVALID_BLOCK_HASH: (r"Invalid block hash. Expected \w+, got \w+"), |
| 79 | + } |
0 commit comments