@@ -121,6 +121,11 @@ const ETH_CALL_GAS: u32 = 50_000_000;
121
121
// subgraphs come across other errors. See
122
122
// https://github.com/ethereum/go-ethereum/blob/dfeb2f7e8001aef1005a8d5e1605bae1de0b4f12/core/vm/errors.go#L25-L38
123
123
const GETH_ETH_CALL_ERRORS : & [ & str ] = & [
124
+ // Hardhat format.
125
+ "error: transaction reverted" ,
126
+ // Ganache and Moonbeam format.
127
+ "vm exception while processing transaction: revert" ,
128
+ // Geth errors
124
129
"execution reverted" ,
125
130
"invalid jump destination" ,
126
131
"invalid opcode" ,
@@ -477,7 +482,7 @@ impl EthereumAdapter {
477
482
let web3 = self . web3 . clone ( ) ;
478
483
479
484
// Ganache does not support calls by block hash.
480
- // See https://github.com/trufflesuite/ganache-cli/issues/745
485
+ // See https://github.com/trufflesuite/ganache-cli/issues/973
481
486
let block_id = if !self . supports_eip_1898 {
482
487
BlockId :: Number ( block_ptr. number . into ( ) )
483
488
} else {
@@ -504,8 +509,7 @@ impl EthereumAdapter {
504
509
. call ( req, Some ( block_id) )
505
510
. then ( |result| {
506
511
// Try to check if the call was reverted. The JSON-RPC response for reverts is
507
- // not standardized, so we have ad-hoc checks for each of Geth, Parity and
508
- // Ganache.
512
+ // not standardized, so we have ad-hoc checks for each Ethereum client.
509
513
510
514
// 0xfe is the "designated bad instruction" of the EVM, and Solidity uses it for
511
515
// asserts.
@@ -521,9 +525,6 @@ impl EthereumAdapter {
521
525
// See f0af4ab0-6b7c-4b68-9141-5b79346a5f61.
522
526
const PARITY_OUT_OF_GAS : & str = "Out of gas" ;
523
527
524
- const GANACHE_VM_EXECUTION_ERROR : i64 = -32000 ;
525
- const GANACHE_REVERT_MESSAGE : & str =
526
- "VM Exception while processing transaction: revert" ;
527
528
const PARITY_VM_EXECUTION_ERROR : i64 = -32015 ;
528
529
const PARITY_REVERT_PREFIX : & str = "Reverted 0x" ;
529
530
@@ -594,14 +595,6 @@ impl EthereumAdapter {
594
595
}
595
596
}
596
597
597
- // Check for Ganache revert.
598
- Err ( web3:: Error :: Rpc ( ref rpc_error) )
599
- if rpc_error. code . code ( ) == GANACHE_VM_EXECUTION_ERROR
600
- && rpc_error. message . starts_with ( GANACHE_REVERT_MESSAGE ) =>
601
- {
602
- Err ( EthereumContractCallError :: Revert ( rpc_error. message . clone ( ) ) )
603
- }
604
-
605
598
// The error was not identified as a revert.
606
599
Err ( err) => Err ( EthereumContractCallError :: Web3Error ( err) ) ,
607
600
}
0 commit comments