diff --git a/src/Nethermind/Nethermind.Blockchain.Test/Validators/TxValidatorTests.cs b/src/Nethermind/Nethermind.Blockchain.Test/Validators/TxValidatorTests.cs index 4906a41f0d3..df6401fb10a 100644 --- a/src/Nethermind/Nethermind.Blockchain.Test/Validators/TxValidatorTests.cs +++ b/src/Nethermind/Nethermind.Blockchain.Test/Validators/TxValidatorTests.cs @@ -176,5 +176,27 @@ public bool Before_eip_1559_has_to_be_legacy_or_access_list_tx(TxType txType, bo IReleaseSpec releaseSpec = new ReleaseSpec() {IsEip2930Enabled = eip2930, IsEip1559Enabled = eip1559}; return txValidator.IsWellFormed(tx, releaseSpec); } + + + [TestCase(TxType.Legacy, ExpectedResult = true)] + [TestCase(TxType.AccessList, ExpectedResult = false)] + [TestCase(TxType.EIP1559, ExpectedResult = false)] + public bool Chain_Id_required_for_non_legacy_transactions_after_Berlin(TxType txType) + { + byte[] sigData = new byte[65]; + sigData[31] = 1; // correct r + sigData[63] = 1; // correct s + sigData[64] = 38; + Signature signature = new Signature(sigData); + Transaction tx = Build.A.Transaction + .WithType(txType > TxType.AccessList ? TxType.Legacy : txType) + .WithAccessList(txType == TxType.AccessList ? new AccessList(new Dictionary
>()) : null) + .WithSignature(signature).TestObject; + + tx.Type = txType; + + TxValidator txValidator = new TxValidator(ChainId.Mainnet); + return txValidator.IsWellFormed(tx, Berlin.Instance); + } } } diff --git a/src/Nethermind/Nethermind.Blockchain/Validators/TxValidator.cs b/src/Nethermind/Nethermind.Blockchain/Validators/TxValidator.cs index 07da1282fc7..a5ed01066f9 100644 --- a/src/Nethermind/Nethermind.Blockchain/Validators/TxValidator.cs +++ b/src/Nethermind/Nethermind.Blockchain/Validators/TxValidator.cs @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the Nethermind. If not, see