@@ -702,4 +702,139 @@ public async Task eth_simulateV1_intrinsic_gas_returns_spec_error_code_and_messa
702702 Assert . That ( result . Result ! . Error , Is . EqualTo ( SimulateErrorMessages . IntrinsicGas ) ) ;
703703 }
704704
705+ /// <summary>
706+ /// Regression test: eth_simulateV1 with validation:true and a nonce below the account's current
707+ /// nonce must return -38010 (NonceTooLow).
708+ /// </summary>
709+ [ Test ]
710+ public async Task eth_simulateV1_nonce_too_low_returns_spec_error_code ( )
711+ {
712+ TestRpcBlockchain chain = await EthRpcSimulateTestsBase . CreateChain ( ) ;
713+
714+ // Set the account's nonce to 10, then send a tx with nonce 0 (below current).
715+ SimulatePayload < TransactionForRpc > payload = new ( )
716+ {
717+ BlockStateCalls =
718+ [
719+ new ( )
720+ {
721+ StateOverrides = new Dictionary < Address , AccountOverride >
722+ {
723+ { TestItem . AddressA , new AccountOverride { Balance = 1 . Ether , Nonce = 10 } }
724+ } ,
725+ Calls =
726+ [
727+ new LegacyTransactionForRpc
728+ {
729+ From = TestItem . AddressA ,
730+ To = TestItem . AddressB ,
731+ Value = UInt256 . Zero ,
732+ Nonce = 0 ,
733+ GasPrice = UInt256 . Zero ,
734+ Gas = 21_000
735+ }
736+ ]
737+ }
738+ ] ,
739+ Validation = true
740+ } ;
741+
742+ ResultWrapper < IReadOnlyList < SimulateBlockResult < SimulateCallResult > > > result =
743+ chain . EthRpcModule . eth_simulateV1 ( payload , BlockParameter . Latest ) ;
744+
745+ Assert . That ( result . ErrorCode , Is . EqualTo ( ErrorCodes . NonceTooLow ) ) ;
746+ }
747+
748+ /// <summary>
749+ /// Regression test: eth_simulateV1 with validation:true and a nonce above the account's current
750+ /// nonce must return -38011 (NonceTooHigh).
751+ /// </summary>
752+ [ Test ]
753+ public async Task eth_simulateV1_nonce_too_high_returns_spec_error_code ( )
754+ {
755+ TestRpcBlockchain chain = await EthRpcSimulateTestsBase . CreateChain ( ) ;
756+
757+ // Account nonce is 0; send a tx with nonce 100 (way above current).
758+ SimulatePayload < TransactionForRpc > payload = new ( )
759+ {
760+ BlockStateCalls =
761+ [
762+ new ( )
763+ {
764+ StateOverrides = new Dictionary < Address , AccountOverride >
765+ {
766+ { TestItem . AddressA , new AccountOverride { Balance = 1 . Ether } }
767+ } ,
768+ Calls =
769+ [
770+ new LegacyTransactionForRpc
771+ {
772+ From = TestItem . AddressA ,
773+ To = TestItem . AddressB ,
774+ Value = UInt256 . Zero ,
775+ Nonce = 100 ,
776+ GasPrice = UInt256 . Zero ,
777+ Gas = 21_000
778+ }
779+ ]
780+ }
781+ ] ,
782+ Validation = true
783+ } ;
784+
785+ ResultWrapper < IReadOnlyList < SimulateBlockResult < SimulateCallResult > > > result =
786+ chain . EthRpcModule . eth_simulateV1 ( payload , BlockParameter . Latest ) ;
787+
788+ Assert . That ( result . ErrorCode , Is . EqualTo ( ErrorCodes . NonceTooHigh ) ) ;
789+ }
790+
791+ /// <summary>
792+ /// Regression test: eth_simulateV1 with validation:true and a sender address that has deployed
793+ /// code (EIP-3607) must return -38024 (SenderIsNotEoa).
794+ /// </summary>
795+ [ Test ]
796+ public async Task eth_simulateV1_sender_is_not_eoa_returns_spec_error_code ( )
797+ {
798+ TestRpcBlockchain chain = await EthRpcSimulateTestsBase . CreateChain ( ) ;
799+
800+ // Override TestItem.AddressC with contract code — makes it a non-EOA sender.
801+ SimulatePayload < TransactionForRpc > payload = new ( )
802+ {
803+ BlockStateCalls =
804+ [
805+ new ( )
806+ {
807+ StateOverrides = new Dictionary < Address , AccountOverride >
808+ {
809+ {
810+ TestItem . AddressC ,
811+ new AccountOverride
812+ {
813+ Balance = 1 . Ether ,
814+ Code = Bytes . FromHexString ( "0x60006000" )
815+ }
816+ }
817+ } ,
818+ Calls =
819+ [
820+ new LegacyTransactionForRpc
821+ {
822+ From = TestItem . AddressC ,
823+ To = TestItem . AddressB ,
824+ Value = UInt256 . Zero ,
825+ GasPrice = UInt256 . Zero ,
826+ Gas = 21_000
827+ }
828+ ]
829+ }
830+ ] ,
831+ Validation = true
832+ } ;
833+
834+ ResultWrapper < IReadOnlyList < SimulateBlockResult < SimulateCallResult > > > result =
835+ chain . EthRpcModule . eth_simulateV1 ( payload , BlockParameter . Latest ) ;
836+
837+ Assert . That ( result . ErrorCode , Is . EqualTo ( ErrorCodes . SenderIsNotEoa ) ) ;
838+ }
839+
705840}
0 commit comments