@@ -35,7 +35,8 @@ import {
3535 defaultFromLongZeroAddress ,
3636 expectUnsupportedMethod ,
3737 defaultErrorMessage ,
38- buildCryptoTransferTransaction
38+ buildCryptoTransferTransaction ,
39+ mockData
3940 } from '../helpers' ;
4041
4142import pino from 'pino' ;
@@ -3259,7 +3260,9 @@ describe('Eth calls using MirrorNode', async function () {
32593260
32603261 const result = await ethImpl . call ( callData , 'latest' ) ;
32613262 sinon . assert . calledWith ( sdkClientStub . submitContractCallQueryWithRetry , contractAddress2 , contractCallData , 15_000_000 , accountAddress1 , 'eth_call' ) ;
3262- expect ( result ) . to . equal ( "0x00" ) ;
3263+ expect ( result ) . to . not . be . null ;
3264+ expect ( result . code ) . to . equal ( - 32603 ) ;
3265+ expect ( result . name ) . to . equal ( "Internal error" ) ;
32633266 } ) ;
32643267
32653268 it ( 'eth_call with no gas' , async function ( ) {
@@ -3313,6 +3316,36 @@ describe('Eth calls using MirrorNode', async function () {
33133316 expect ( result ) . to . equal ( "0x00" ) ;
33143317 } ) ;
33153318
3319+ it ( 'eth_call with all fields but mirrorNode throws 429' , async function ( ) {
3320+ const callData = {
3321+ ...defaultCallData ,
3322+ "from" : accountAddress1 ,
3323+ "to" : contractAddress2 ,
3324+ "data" : contractCallData ,
3325+ "gas" : maxGasLimit
3326+ } ;
3327+ web3Mock . onPost ( 'contracts/call' , { ...callData , estimate : false } ) . reply ( 429 , mockData . tooManyRequests ) ;
3328+ const result = await ethImpl . call ( callData , 'latest' ) ;
3329+ expect ( result ) . to . be . not . null ;
3330+ expect ( result . code ) . to . eq ( - 32605 ) ;
3331+ expect ( result . name ) . to . eq ( "IP Rate limit exceeded" ) ;
3332+ } ) ;
3333+
3334+ it ( 'eth_call with all fields but mirrorNode throws 400' , async function ( ) {
3335+ const callData = {
3336+ ...defaultCallData ,
3337+ "from" : accountAddress1 ,
3338+ "to" : contractAddress2 ,
3339+ "data" : contractCallData ,
3340+ "gas" : maxGasLimit
3341+ } ;
3342+ web3Mock . onPost ( 'contracts/call' , { ...callData , estimate : false } ) . reply ( 400 , mockData . contractReverted ) ;
3343+ const result = await ethImpl . call ( callData , 'latest' ) ;
3344+ expect ( result ) . to . be . not . null ;
3345+ expect ( result . code ) . to . eq ( - 32008 ) ;
3346+ expect ( result . name ) . to . eq ( "Contract revert executed" ) ;
3347+ } ) ;
3348+
33163349 it ( 'eth_call with all fields but mirrorNode throws 504 (timeout) on pre-check' , async function ( ) {
33173350
33183351 const timeoutAddress = "0x00000000000000000000000000000000000004e2" ;
@@ -3392,7 +3425,9 @@ describe('Eth calls using MirrorNode', async function () {
33923425 sinon . reset ( ) ;
33933426 const result = await ethImpl . call ( callData , 'latest' ) ;
33943427 sinon . assert . notCalled ( sdkClientStub . submitContractCallQueryWithRetry ) ;
3395- expect ( result ) . to . equal ( "0x" ) ;
3428+ expect ( result ) . to . not . be . null ;
3429+ expect ( result . code ) . to . eq ( - 32008 ) ;
3430+ expect ( result . name ) . to . eq ( 'Contract revert executed' ) ;
33963431 } ) ;
33973432
33983433 it ( 'caps gas at 15_000_000' , async function ( ) {
0 commit comments