From df8ccbb60d2f8dfcc2fad07e1cd40971efbfa38a Mon Sep 17 00:00:00 2001 From: Dimitry Kh Date: Tue, 18 Jun 2024 17:47:23 +0200 Subject: [PATCH] fill state test as blockchain was missing bigInt hint field --- retesteth/session/ToolBackend/Functions/importRawBlock.cpp | 1 + retesteth/session/ToolBackend/ToolChain.cpp | 5 ++++- .../types/Ethereum/Transactions/Transaction.cpp | 1 + .../testStructures/types/Ethereum/Transactions/Transaction.h | 2 ++ retesteth/testSuites/statetests/StateTestChainRunner.cpp | 4 ++++ retesteth/testSuites/statetests/StateTestsBoost.cpp | 4 ++++ 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/retesteth/session/ToolBackend/Functions/importRawBlock.cpp b/retesteth/session/ToolBackend/Functions/importRawBlock.cpp index 63863d190..fab788df8 100644 --- a/retesteth/session/ToolBackend/Functions/importRawBlock.cpp +++ b/retesteth/session/ToolBackend/Functions/importRawBlock.cpp @@ -1,6 +1,7 @@ #include "../ToolChainManager.h" #include "../ToolImplHelper.h" #include "../Verification.h" +#include #include #include using namespace std; diff --git a/retesteth/session/ToolBackend/ToolChain.cpp b/retesteth/session/ToolBackend/ToolChain.cpp index 5c7f0f35e..a31aea2da 100644 --- a/retesteth/session/ToolBackend/ToolChain.cpp +++ b/retesteth/session/ToolBackend/ToolChain.cpp @@ -347,9 +347,12 @@ spDataObject ToolChain::coorectTransactionsByToolResponse( } else { - ETH_DC_MESSAGE(DC::RPC, "Transactions not allowed to fail!"); if (rejectedInfoFound) + { + ETH_DC_MESSAGE(DC::RPC, "Transactions not allowed to fail! But t8n rejected it!"); throw test::UpwardsException((*miningResult)["rejectedTransactions"].atLastElement().atKey("error").asString()); + } + ETH_DC_MESSAGE(DC::RPC, "Transactions not allowed to fail, t8n does not provide rejected info!"); throw test::UpwardsException(message); } } diff --git a/retesteth/testStructures/types/Ethereum/Transactions/Transaction.cpp b/retesteth/testStructures/types/Ethereum/Transactions/Transaction.cpp index d2fb7d08e..0f06b9423 100644 --- a/retesteth/testStructures/types/Ethereum/Transactions/Transaction.cpp +++ b/retesteth/testStructures/types/Ethereum/Transactions/Transaction.cpp @@ -46,6 +46,7 @@ void Transaction::fromDataObject(DataObject const& _data) { checkDataScheme(_data); _fromData(_data); + m_hasBigInt = _data.performSearch(src_findBigInt); makeSignature(_data); } catch (std::exception const& _ex) diff --git a/retesteth/testStructures/types/Ethereum/Transactions/Transaction.h b/retesteth/testStructures/types/Ethereum/Transactions/Transaction.h index 0948b2792..4e5a1f676 100644 --- a/retesteth/testStructures/types/Ethereum/Transactions/Transaction.h +++ b/retesteth/testStructures/types/Ethereum/Transactions/Transaction.h @@ -50,6 +50,7 @@ struct Transaction : GCP_SPointerBase VALUE const& getSecret() const { return m_secretKey; } void setChainID(VALUE const& _chainID); VALUE const& getChainID() const { return m_chainID; } + bool hasBigInt() const { return m_hasBigInt; } protected: // Potected transaction interface @@ -86,6 +87,7 @@ struct Transaction : GCP_SPointerBase // Debug std::string m_dataRawPreview; // Attached data raw preview before code compilation std::string m_dataLabel; // Attached data Label from filler + bool m_hasBigInt = false; // Optimization spFH32 m_hash; diff --git a/retesteth/testSuites/statetests/StateTestChainRunner.cpp b/retesteth/testSuites/statetests/StateTestChainRunner.cpp index 47db9a681..e77017192 100644 --- a/retesteth/testSuites/statetests/StateTestChainRunner.cpp +++ b/retesteth/testSuites/statetests/StateTestChainRunner.cpp @@ -68,6 +68,8 @@ void StateTestChainRunner::performTransactionOnExpect(TransactionInGeneralSectio (*m_aBlockchainTest)["lastblockhash"] = remoteBlock.header()->hash().asString(); spDataObject block; (*block)["rlp"] = remoteBlock.getRLPHeaderTransactions().asString(); + if (_tr.transaction()->hasBigInt()) + (*block)["hasBigInt"] = "true"; (*block).atKeyPointer("blockHeader") = remoteBlock.header()->asDataObject(); (*block).atKeyPointer("transactions") = spDataObject(new DataObject(DataType::Array)); if (testException.empty()) @@ -90,6 +92,8 @@ void StateTestChainRunner::performTransactionOnExpect(TransactionInGeneralSectio (*trInfo)["exception"] = testException; (*block)["transactionSequence"].addArrayObject(trInfo); (*block)["expectException"] = testException; + if (_tr.transaction()->hasBigInt()) + (*block)["hasBigInt"] = "true"; EthereumBlock managedBlock(remoteBlock.header()); managedBlock.addTransaction(_tr.transaction()); diff --git a/retesteth/testSuites/statetests/StateTestsBoost.cpp b/retesteth/testSuites/statetests/StateTestsBoost.cpp index 22715065f..57e35aa4d 100644 --- a/retesteth/testSuites/statetests/StateTestsBoost.cpp +++ b/retesteth/testSuites/statetests/StateTestsBoost.cpp @@ -67,6 +67,10 @@ TestSuite::FillerPath LegacyConstantinopleStateTestSuite::suiteFillerFolder() co // Legacy Cancun TestSuite::TestPath LegacyCancunStateTestSuite::suiteFolder() const { + if (Options::get().fillchain) + { + return TestSuite::TestPath(fs::path("LegacyTests/Cancun/BlockchainTests/GeneralStateTests" + m_fillerPathAdd)); + } return TestSuite::TestPath(fs::path("LegacyTests/Cancun/GeneralStateTests" + m_fillerPathAdd)); } TestSuite::FillerPath LegacyCancunStateTestSuite::suiteFillerFolder() const