@@ -690,6 +690,55 @@ describe('@api RPC Server Acceptance Tests', function () {
690690 expect ( info . created_contract_ids . length ) . to . be . equal ( 1 ) ;
691691 } ) ;
692692
693+ it ( 'should execute "eth_sendRawTransaction" and deploy a contract with more than 2 HBAR transaction fee and less than max transaction fee' , async function ( ) {
694+ const balanceBefore = await relay . getBalance ( accounts [ 2 ] . wallet . address , 'latest' , requestId ) ;
695+
696+ const gasPrice = await relay . gasPrice ( requestId ) ;
697+ const transaction = {
698+ type : 2 ,
699+ chainId : Number ( CHAIN_ID ) ,
700+ nonce : await relay . getAccountNonce ( '0x' + accounts [ 2 ] . address , requestId ) ,
701+ maxPriorityFeePerGas : gasPrice ,
702+ maxFeePerGas : gasPrice ,
703+ gasLimit : constants . BLOCK_GAS_LIMIT ,
704+ data : '0x' + '00' . repeat ( 40000 )
705+ } ;
706+
707+ const signedTx = await accounts [ 2 ] . wallet . signTransaction ( transaction ) ;
708+ const transactionHash = await relay . call ( 'eth_sendRawTransaction' , [ signedTx ] , requestId ) ;
709+ const info = await mirrorNode . get ( `/contracts/results/${ transactionHash } ` , requestId ) ;
710+ const balanceAfter = await relay . getBalance ( accounts [ 2 ] . wallet . address , 'latest' , requestId ) ;
711+ expect ( info ) . to . have . property ( 'contract_id' ) ;
712+ expect ( info . contract_id ) . to . not . be . null ;
713+ expect ( info ) . to . have . property ( 'created_contract_ids' ) ;
714+ expect ( info . created_contract_ids . length ) . to . be . equal ( 1 ) ;
715+ const diffInHbars = ( balanceBefore - balanceAfter ) / constants . TINYBAR_TO_WEIBAR_COEF / 100_000_000 ;
716+ expect ( diffInHbars ) . to . be . greaterThan ( 2 ) ;
717+ expect ( diffInHbars ) . to . be . lessThan ( gasPrice * constants . BLOCK_GAS_LIMIT / constants . TINYBAR_TO_WEIBAR_COEF / 100_000_000 ) ;
718+ } ) ;
719+
720+ it ( 'should execute "eth_sendRawTransaction" and deploy a contract with more than max transaction fee' , async function ( ) {
721+ const gasPrice = await relay . gasPrice ( requestId ) ;
722+ const transaction = {
723+ type : 2 ,
724+ chainId : Number ( CHAIN_ID ) ,
725+ nonce : await relay . getAccountNonce ( '0x' + accounts [ 2 ] . address , requestId ) ,
726+ maxPriorityFeePerGas : gasPrice ,
727+ maxFeePerGas : gasPrice ,
728+ gasLimit : constants . BLOCK_GAS_LIMIT ,
729+ data : '0x' + '00' . repeat ( 60000 )
730+ } ;
731+
732+ const signedTx = await accounts [ 2 ] . wallet . signTransaction ( transaction ) ;
733+ let hasError = false ;
734+ try {
735+ await relay . call ( 'eth_sendRawTransaction' , [ signedTx ] , requestId ) ;
736+ } catch ( e ) {
737+ hasError = true ;
738+ }
739+ expect ( hasError ) . to . be . true ;
740+ } ) ;
741+
693742 describe ( 'Prechecks' , async function ( ) {
694743 it ( 'should fail "eth_sendRawTransaction" for transaction with incorrect chain_id' , async function ( ) {
695744 const transaction = {
0 commit comments