From f3b589ff6afade395eb1e91d662616c67e9df2ec Mon Sep 17 00:00:00 2001 From: lightclient Date: Wed, 16 Jul 2025 14:10:13 -0600 Subject: [PATCH 1/6] eth: fix invalid eth simulate schema --- src/schemas/block.yaml | 1 - src/schemas/execute.yaml | 30 +++++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/schemas/block.yaml b/src/schemas/block.yaml index c10eb1ad5..37c56b7b1 100644 --- a/src/schemas/block.yaml +++ b/src/schemas/block.yaml @@ -20,7 +20,6 @@ Block: - size - transactions - uncles - additionalProperties: false properties: hash: title: Hash diff --git a/src/schemas/execute.yaml b/src/schemas/execute.yaml index 460584b8d..32e32b63d 100644 --- a/src/schemas/execute.yaml +++ b/src/schemas/execute.yaml @@ -1,7 +1,5 @@ EthSimulatePayload: title: Arguments for multi call - required: - - blockStateCalls properties: blockStateCalls: title: Block State Calls @@ -149,7 +147,7 @@ Withdrawals: description: This array can have a maximum length of 16. type: array items: - - $ref: '#/components/schemas/Withdrawal' + $ref: '#/components/schemas/Withdrawal' Withdrawal: title: A withdrawal made by a validator type: object @@ -168,7 +166,7 @@ Withdrawal: $ref: '#/components/schemas/uint64' EthSimulateResult: title: Full results of multi call - type: object + type: array oneOf: - $ref: '#/components/schemas/EthSimulateBlockResultInvalid' - $ref: '#/components/schemas/EthSimulateBlockResultSuccess' @@ -182,7 +180,8 @@ EthSimulateBlockResultSingleSuccess: type: object allOf: - $ref: '#/components/schemas/Block' - - title: Eth Simulate call results + - type: object + title: Eth Simulate call results required: - calls properties: @@ -240,7 +239,7 @@ CallResults: title: Results of multi call within block type: array items: - oneOf: + anyOf: - $ref: '#/components/schemas/CallResultFailure' - $ref: '#/components/schemas/CallResultSuccess' CallResultFailure: @@ -265,10 +264,19 @@ CallResultFailure: $ref: '#/components/schemas/uint64' error: oneOf: - - code: -32000 - message: 'Execution reverted' - - code: -32015 - message: 'VM execution error' + - type: object + properties: + code: + const: -32000 + message: + type: string + required: [code, message] + - type: object + properties: + code: + const: -32015 + message: + type: string CallResultSuccess: title: Result of call success type: object @@ -298,7 +306,7 @@ CallResultLog: type: object required: - logIndex - - blockhash + - blockHash - blockNumber - transactionHash - transactionIndex From b6d9c444cb18cc7b80506cdd10d6f703662d0ae7 Mon Sep 17 00:00:00 2001 From: lightclient Date: Wed, 16 Jul 2025 14:40:05 -0600 Subject: [PATCH 2/6] eth: add back err message for call status --- src/schemas/execute.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/schemas/execute.yaml b/src/schemas/execute.yaml index 32e32b63d..6ee66edc7 100644 --- a/src/schemas/execute.yaml +++ b/src/schemas/execute.yaml @@ -178,6 +178,7 @@ EthSimulateBlockResultSuccess: EthSimulateBlockResultSingleSuccess: title: Result of eth_simulate block-level, with array of calls type: object + unevaluatedProperties: false allOf: - $ref: '#/components/schemas/Block' - type: object @@ -270,6 +271,7 @@ CallResultFailure: const: -32000 message: type: string + pattern: "^execution reverted.*" required: [code, message] - type: object properties: @@ -277,6 +279,7 @@ CallResultFailure: const: -32015 message: type: string + pattern: "^vm execution error.*" CallResultSuccess: title: Result of call success type: object From c56ee82594a976fee818528a876c62f4365b44f4 Mon Sep 17 00:00:00 2001 From: lightclient Date: Mon, 21 Jul 2025 17:02:07 -0600 Subject: [PATCH 3/6] schemas: fixup based on pr comments --- src/schemas/execute.yaml | 5 +++-- src/schemas/transaction.yaml | 1 - tests/eth_simulateV1/ethSimulate-empty-ethSimulate.io | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 tests/eth_simulateV1/ethSimulate-empty-ethSimulate.io diff --git a/src/schemas/execute.yaml b/src/schemas/execute.yaml index 6ee66edc7..57029ac52 100644 --- a/src/schemas/execute.yaml +++ b/src/schemas/execute.yaml @@ -1,5 +1,7 @@ EthSimulatePayload: title: Arguments for multi call + required: + - blockStateCalls properties: blockStateCalls: title: Block State Calls @@ -178,7 +180,6 @@ EthSimulateBlockResultSuccess: EthSimulateBlockResultSingleSuccess: title: Result of eth_simulate block-level, with array of calls type: object - unevaluatedProperties: false allOf: - $ref: '#/components/schemas/Block' - type: object @@ -240,7 +241,7 @@ CallResults: title: Results of multi call within block type: array items: - anyOf: + oneOf: - $ref: '#/components/schemas/CallResultFailure' - $ref: '#/components/schemas/CallResultSuccess' CallResultFailure: diff --git a/src/schemas/transaction.yaml b/src/schemas/transaction.yaml index 38afc0a1d..bfbfde15c 100644 --- a/src/schemas/transaction.yaml +++ b/src/schemas/transaction.yaml @@ -467,7 +467,6 @@ TransactionInfo: - from - hash - transactionIndex - unevaluatedProperties: false properties: blockHash: title: block hash diff --git a/tests/eth_simulateV1/ethSimulate-empty-ethSimulate.io b/tests/eth_simulateV1/ethSimulate-empty-ethSimulate.io deleted file mode 100644 index ed3a27b3c..000000000 --- a/tests/eth_simulateV1/ethSimulate-empty-ethSimulate.io +++ /dev/null @@ -1,3 +0,0 @@ -// ethSimulate without parameters ->> {"jsonrpc":"2.0","id":1,"method":"eth_simulateV1","params":[{},"latest"]} -<< {"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"empty input"}} From 0b60e603e3324caae3c5a53759d1f82bcaad16fa Mon Sep 17 00:00:00 2001 From: lightclient Date: Tue, 22 Jul 2025 13:32:56 -0600 Subject: [PATCH 4/6] schema: rename 'multi' to 'eth_simulate' --- src/schemas/execute.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/schemas/execute.yaml b/src/schemas/execute.yaml index 57029ac52..8f5c33847 100644 --- a/src/schemas/execute.yaml +++ b/src/schemas/execute.yaml @@ -1,5 +1,5 @@ EthSimulatePayload: - title: Arguments for multi call + title: Arguments for eth_simulate required: - blockStateCalls properties: @@ -167,13 +167,13 @@ Withdrawal: title: Amount $ref: '#/components/schemas/uint64' EthSimulateResult: - title: Full results of multi call + title: Full results of eth_simulate type: array oneOf: - $ref: '#/components/schemas/EthSimulateBlockResultInvalid' - $ref: '#/components/schemas/EthSimulateBlockResultSuccess' EthSimulateBlockResultSuccess: - title: Full results of multi call + title: Full results of eth_simulate type: array items: $ref: '#/components/schemas/EthSimulateBlockResultSingleSuccess' @@ -238,7 +238,7 @@ EthSimulateBlockResultInvalid: - code: -38026 message: Client adjustable limit exceeded CallResults: - title: Results of multi call within block + title: Results of eth_simulate within block type: array items: oneOf: From d330c9b412309cdd7ac22bbc2708b0ed4383c6b7 Mon Sep 17 00:00:00 2001 From: lightclient Date: Tue, 22 Jul 2025 13:46:21 -0600 Subject: [PATCH 5/6] schemas: use errors field for eth_simulate --- src/eth/execute.yaml | 2 + src/schemas/execute.yaml | 91 ++++++++++++++++++---------------------- 2 files changed, 42 insertions(+), 51 deletions(-) diff --git a/src/eth/execute.yaml b/src/eth/execute.yaml index 866cb901f..7f8b726f9 100644 --- a/src/eth/execute.yaml +++ b/src/eth/execute.yaml @@ -111,3 +111,5 @@ name: Result of calls schema: $ref: '#/components/schemas/EthSimulateResult' + errors: + $ref: '#/components/schemas/EthSimulateErrors' diff --git a/src/schemas/execute.yaml b/src/schemas/execute.yaml index 8f5c33847..1706e8937 100644 --- a/src/schemas/execute.yaml +++ b/src/schemas/execute.yaml @@ -168,10 +168,7 @@ Withdrawal: $ref: '#/components/schemas/uint64' EthSimulateResult: title: Full results of eth_simulate - type: array - oneOf: - - $ref: '#/components/schemas/EthSimulateBlockResultInvalid' - - $ref: '#/components/schemas/EthSimulateBlockResultSuccess' + $ref: '#/components/schemas/EthSimulateBlockResultSuccess' EthSimulateBlockResultSuccess: title: Full results of eth_simulate type: array @@ -190,53 +187,45 @@ EthSimulateBlockResultSingleSuccess: calls: title: Call Results $ref: '#/components/schemas/CallResults' -EthSimulateBlockResultInvalid: - title: Result of eth_simulate not being valid - description: The error messages are suggestions and a client might decide to return a different errror message than specified here. However, the error codes are enforced by this specification. - type: object - required: - - error - properties: - error: - oneOf: - - code: -32000 - message: Invalid request - - code: -32602 - message: Missing or invalid parameters - - code: -32005 - message: Transactions maxFeePerGas is too low - - code: -32015 - messagE: Execution error - - code: -32016 - message: Timeout - - code: -32603 - message: The Ethereum node encountered an internal error - - code: -38010 - message: Transactions nonce is too low - - code: -38011 - message: Transactions nonce is too high - - code: -38012 - message: Transactions baseFeePerGas is too low - - code: -38013 - message: Not enough gas provided to pay for intrinsic gas for a transaction - - code: -38014 - message: Insufficient funds to pay for gas fees and value for a transaction - - code: -38015 - message: Block gas limit exceeded by the block's transactions - - code: -38020 - message: Block number in sequence did not increase - - code: -38021 - message: Block timestamp in sequence did not increase or stay the same - - code: -38022 - message: MovePrecompileToAddress referenced itself in replacement - - code: -38023 - message: Multiple MovePrecompileToAddress referencing the same address to replace - - code: -38024 - message: Sender is not an EOA - - code: -38025 - message: Max init code size exceeded - - code: -38026 - message: Client adjustable limit exceeded +EthSimulateErrors: + - code: -32000 + message: Invalid request + - code: -32602 + message: Missing or invalid parameters + - code: -32005 + message: Transactions maxFeePerGas is too low + - code: -32015 + message: Execution error + - code: -32016 + message: Timeout + - code: -32603 + message: The Ethereum node encountered an internal error + - code: -38010 + message: Transactions nonce is too low + - code: -38011 + message: Transactions nonce is too high + - code: -38012 + message: Transactions baseFeePerGas is too low + - code: -38013 + message: Not enough gas provided to pay for intrinsic gas for a transaction + - code: -38014 + message: Insufficient funds to pay for gas fees and value for a transaction + - code: -38015 + message: Block gas limit exceeded by the block's transactions + - code: -38020 + message: Block number in sequence did not increase + - code: -38021 + message: Block timestamp in sequence did not increase or stay the same + - code: -38022 + message: MovePrecompileToAddress referenced itself in replacement + - code: -38023 + message: Multiple MovePrecompileToAddress referencing the same address to replace + - code: -38024 + message: Sender is not an EOA + - code: -38025 + message: Max init code size exceeded + - code: -38026 + message: Client adjustable limit exceeded CallResults: title: Results of eth_simulate within block type: array From e141324e9b1bc471d1f7e6f6c826fee65524582a Mon Sep 17 00:00:00 2001 From: lightclient Date: Tue, 22 Jul 2025 14:22:03 -0600 Subject: [PATCH 6/6] move eth_simulate errors to method definition --- src/eth/execute.yaml | 39 ++++++++++++++++++++++++++++++++++++++- src/schemas/execute.yaml | 39 --------------------------------------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/src/eth/execute.yaml b/src/eth/execute.yaml index 7f8b726f9..cc6e8991f 100644 --- a/src/eth/execute.yaml +++ b/src/eth/execute.yaml @@ -112,4 +112,41 @@ schema: $ref: '#/components/schemas/EthSimulateResult' errors: - $ref: '#/components/schemas/EthSimulateErrors' + - code: -32000 + message: Invalid request + - code: -32602 + message: Missing or invalid parameters + - code: -32005 + message: Transactions maxFeePerGas is too low + - code: -32015 + message: Execution error + - code: -32016 + message: Timeout + - code: -32603 + message: The Ethereum node encountered an internal error + - code: -38010 + message: Transactions nonce is too low + - code: -38011 + message: Transactions nonce is too high + - code: -38012 + message: Transactions baseFeePerGas is too low + - code: -38013 + message: Not enough gas provided to pay for intrinsic gas for a transaction + - code: -38014 + message: Insufficient funds to pay for gas fees and value for a transaction + - code: -38015 + message: Block gas limit exceeded by the block's transactions + - code: -38020 + message: Block number in sequence did not increase + - code: -38021 + message: Block timestamp in sequence did not increase or stay the same + - code: -38022 + message: MovePrecompileToAddress referenced itself in replacement + - code: -38023 + message: Multiple MovePrecompileToAddress referencing the same address to replace + - code: -38024 + message: Sender is not an EOA + - code: -38025 + message: Max init code size exceeded + - code: -38026 + message: Client adjustable limit exceeded diff --git a/src/schemas/execute.yaml b/src/schemas/execute.yaml index 1706e8937..09d5233f4 100644 --- a/src/schemas/execute.yaml +++ b/src/schemas/execute.yaml @@ -187,45 +187,6 @@ EthSimulateBlockResultSingleSuccess: calls: title: Call Results $ref: '#/components/schemas/CallResults' -EthSimulateErrors: - - code: -32000 - message: Invalid request - - code: -32602 - message: Missing or invalid parameters - - code: -32005 - message: Transactions maxFeePerGas is too low - - code: -32015 - message: Execution error - - code: -32016 - message: Timeout - - code: -32603 - message: The Ethereum node encountered an internal error - - code: -38010 - message: Transactions nonce is too low - - code: -38011 - message: Transactions nonce is too high - - code: -38012 - message: Transactions baseFeePerGas is too low - - code: -38013 - message: Not enough gas provided to pay for intrinsic gas for a transaction - - code: -38014 - message: Insufficient funds to pay for gas fees and value for a transaction - - code: -38015 - message: Block gas limit exceeded by the block's transactions - - code: -38020 - message: Block number in sequence did not increase - - code: -38021 - message: Block timestamp in sequence did not increase or stay the same - - code: -38022 - message: MovePrecompileToAddress referenced itself in replacement - - code: -38023 - message: Multiple MovePrecompileToAddress referencing the same address to replace - - code: -38024 - message: Sender is not an EOA - - code: -38025 - message: Max init code size exceeded - - code: -38026 - message: Client adjustable limit exceeded CallResults: title: Results of eth_simulate within block type: array