Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4dd8a45

Browse files
committedFeb 6, 2025·
support pyspec with eels
better .py parsing of bc markers
1 parent 2b78281 commit 4dd8a45

File tree

13 files changed

+190
-15
lines changed

13 files changed

+190
-15
lines changed
 

‎retesteth/Constants.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using namespace test;
33
using namespace std;
44

5+
56
namespace test {
67

78
const string C_WITHDRAWALS_EMPTY_ROOT = "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421";

‎retesteth/Options.h

+1
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ class Options
270270
DynamicOptions() {}
271271
std::vector<ClientConfig> const& getClientConfigs() const;
272272
ClientConfig const& getCurrentConfig() const;
273+
bool isConfigSet() const;
273274
void setCurrentConfig(ClientConfig const& _config);
274275
void setTestsuiteRunning(bool _arg);
275276
bool testSuiteRunning() const;

‎retesteth/configs/ClientConfig.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct ClientConfigID
2424
}
2525

2626
private:
27-
unsigned m_id;
27+
unsigned m_id = 100500;
2828
};
2929

3030
// Replace fields according to the client configs if needed

‎retesteth/configs/Options.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ ClientConfig const& Options::DynamicOptions::getCurrentConfig() const
8888
return m_clientConfigs.at(0);
8989
}
9090

91+
bool Options::DynamicOptions::isConfigSet() const
92+
{
93+
return m_currentConfigID != test::ClientConfigID::null();
94+
}
95+
9196
void Options::DynamicOptions::setCurrentConfig(ClientConfig const& _config)
9297
{
9398
auto const& opt = Options::get();

‎retesteth/configs/clientconfigs/eels.cpp

+122-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ else
4949
cmdArgs=$cmdArgs" "$index
5050
done
5151
if [ $stateProvided -eq 1 ]; then
52-
$($cmd t8n $cmdArgs --verbosity 2) 2> $errorLogFile
52+
$($cmd t8n $cmdArgs --verbosity 0) 2> $errorLogFile
5353
else
5454
evm t9n $cmdArgs 2> $errorLogFile
5555
fi
@@ -107,9 +107,128 @@ string const eels_config = R"({
107107
"fillerSkipForks" : [
108108
],
109109
"exceptions" : {
110-
"PYSPECS_EXCEPTIONS" : "",
111-
"Transaction without funds" : "Failed transaction:",
110+
"NEW PYSPECS EXCEPTIONS" : "==============================================",
111+
"TransactionException.INSUFFICIENT_ACCOUNT_FUNDS" : "Failed transaction:",
112+
"TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS" : "Failed transaction:",
113+
"TransactionException.TYPE_3_TX_ZERO_BLOBS" : "Failed transaction:",
114+
"TransactionException.TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH" : "Failed transaction:",
115+
"TransactionException.TYPE_3_TX_PRE_FORK|TransactionException.TYPE_3_TX_ZERO_BLOBS" : "transaction",
116+
"TransactionException.TYPE_3_TX_PRE_FORK" : "Failed to parse transaction",
117+
"TransactionException.TYPE_3_TX_BLOB_COUNT_EXCEEDED" : "Failed transaction:",
118+
"TransactionException.TYPE_3_TX_CONTRACT_CREATION" : "input string too short for common.Address",
119+
"TransactionException.TYPE_3_TX_MAX_BLOB_GAS_ALLOWANCE_EXCEEDED" : "Failed transaction:",
120+
"TransactionException.INSUFFICIENT_MAX_FEE_PER_BLOB_GAS" : "blobtx.maxFeePerBlobGas() < getblobgas(blockheader",
121+
"TransactionException.INTRINSIC_GAS_TOO_LOW" : "Failed transaction:",
122+
"TransactionException.INITCODE_SIZE_EXCEEDED" : "Failed transaction:",
123+
"TransactionException.ADDRESS_TOO_SHORT" : "input string too short for common.Address",
124+
"TransactionException.ADDRESS_TOO_LONG" : "rlp: input string too long for common.Address, decoding into (types.Transaction)(types.LegacyTx).To",
125+
"TransactionException.GAS_ALLOWANCE_EXCEEDED" : "gas limit reached",
126+
"TransactionException.TYPE_NOT_SUPPORTED" : "transaction type not supported",
127+
128+
"TransactionException.EC_RECOVERY_FAIL" : "recovery failed",
129+
"TransactionException.NONCE_MISMATCH_TOO_HIGH" : "nonce too high",
130+
"TransactionException.NONCE_MISMATCH_TOO_LOW" : "nonce too low",
131+
"TransactionException.NONCE_TOO_BIG" : "nonce exceeds 2^64-1",
132+
"TransactionException.NONCE_IS_MAX" : "nonce has max value:",
133+
"TransactionException.NONCE_OVERFLOW" : "rlp: input string too long for uint64, decoding into (types.Transaction)(types.LegacyTx).Nonce",
134+
"TransactionException.GASLIMIT_OVERFLOW" : "rlp: input string too long for uint64, decoding into (types.Transaction)(types.LegacyTx).Gas",
135+
"TransactionException.VALUE_OVERFLOW" : "value exceeds 256 bits",
136+
"TransactionException.GASPRICE_OVERFLOW" : "gasPrice exceeds 256 bits",
137+
"TransactionException.PRIORITY_OVERFLOW" : "maxPriorityFeePerGas exceeds 256 bits",
138+
"TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS" : "max priority fee per gas higher than max fee per gas",
139+
"TransactionException.PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS_2" : "maxFeePerGas \u003c maxPriorityFeePerGas",
140+
"TransactionException.GASLIMIT_PRICE_PRODUCT_OVERFLOW" : "gas * gasPrice exceeds 256 bits",
141+
"TransactionException.SENDER_NOT_EOA" : "sender not an eoa:",
142+
"TransactionException.SENDER_NOT_EOA|TransactionException.INSUFFICIENT_ACCOUNT_FUNDS" : "sender not an eoa:",
143+
"TransactionException.INSUFFICIENT_ACCOUNT_FUNDS|TransactionException.INTRINSIC_GAS_TOO_LOW" : "insufficient funds for gas * price + value",
144+
"TransactionException.INSUFFICIENT_ACCOUNT_FUNDS|TransactionException.GASLIMIT_PRICE_PRODUCT_OVERFLOW" : "insufficient funds for gas * price + value",
145+
"TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS|TransactionException.GAS_ALLOWANCE_EXCEEDED" : "max fee per gas less than block base fee",
146+
"TransactionException.INSUFFICIENT_MAX_FEE_PER_GAS|TransactionException.INSUFFICIENT_ACCOUNT_FUNDS" : "max fee per gas less than block base fee",
147+
148+
"TransactionException.INVALID_CHAINID" : "invalid chain id for signer",
149+
"TransactionException.INVALID_SIGNATURE_VRS" : "invalid transaction v, r, s values",
150+
"TransactionException.RLP_INVALID_HEADER" : "expected List",
151+
"TransactionException.RLP_INVALID_SIGNATURE_R" : "expected input string or byte for *big.Int, decoding into (types.Transaction)(types.LegacyTx).R",
152+
"TransactionException.RLP_INVALID_SIGNATURE_S" : "rlp: expected input string or byte for *big.Int, decoding into (types.Transaction)(types.LegacyTx).S",
153+
"TransactionException.RLP_INVALID_NONCE" : "rlp: expected input string or byte for uint64, decoding into (types.Transaction)(types.LegacyTx).Nonce",
154+
"TransactionException.RLP_INVALID_DATA" : "rlp: expected input string or byte for []uint8, decoding into (types.Transaction)(types.LegacyTx).Data",
155+
"TransactionException.RLP_INVALID_GASLIMIT" : "rlp: expected input string or byte for uint64, decoding into (types.Transaction)(types.LegacyTx).Gas",
156+
"TransactionException.RLP_INVALID_TO" : "rlp: expected input string or byte for common.Address, decoding into (types.Transaction)(types.LegacyTx).To",
157+
"TransactionException.RLP_INVALID_VALUE" : "insufficient funds for gas",
158+
"TransactionException.RLP_INVALID_ACCESS_LIST_ADDRESS_TOO_LONG" : "rlp: input string too long for common.Address, decoding into (types.Transaction)(types.AccessListTx).AccessList[0].Address",
159+
"TransactionException.RLP_INVALID_ACCESS_LIST_ADDRESS_TOO_SHORT" : "rlp: input string too short for common.Address, decoding into (types.Transaction)(types.AccessListTx).AccessList[0].Address",
160+
"TransactionException.RLP_INVALID_ACCESS_LIST_STORAGE_TOO_LONG" : "rlp: input string too long for common.Hash, decoding into (types.Transaction)(types.AccessListTx).AccessList[0].StorageKeys[0]",
161+
"TransactionException.RLP_INVALID_ACCESS_LIST_STORAGE_TOO_SHORT" : "rlp: input string too short for common.Hash, decoding into (types.Transaction)(types.AccessListTx).AccessList[0].StorageKeys[0]",
162+
163+
"TransactionException.RLP_LEADING_ZEROS_GASLIMIT" : "rlp: non-canonical integer (leading zero bytes) for uint64, decoding into (types.Transaction)(types.LegacyTx).Gas",
164+
"TransactionException.RLP_LEADING_ZEROS_GASPRICE" : "rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.LegacyTx).GasPrice",
165+
"TransactionException.RLP_LEADING_ZEROS_VALUE" : "rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.LegacyTx).Value",
166+
"TransactionException.RLP_LEADING_ZEROS_NONCE" : "rlp: non-canonical integer (leading zero bytes) for uint64, decoding into (types.Transaction)(types.LegacyTx).Nonce",
167+
"TransactionException.RLP_LEADING_ZEROS_R" : "rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.LegacyTx).R",
168+
"TransactionException.RLP_LEADING_ZEROS_S" : "rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.LegacyTx).S",
169+
"TransactionException.RLP_LEADING_ZEROS_V" : "rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.LegacyTx).V",
170+
"TransactionException.RLP_LEADING_ZEROS_DATA_SIZE" : "rlp: non-canonical size information for []uint8, decoding into (types.Transaction)(types.LegacyTx).Data",
171+
"TransactionException.RLP_LEADING_ZEROS_NONCE_SIZE" : "rlp: non-canonical size information for uint64, decoding into (types.Transaction)(types.LegacyTx).Nonce",
172+
"TransactionException.RLP_LEADING_ZEROS_BASEFEE" : "rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.DynamicFeeTx).GasFeeCap",
173+
"TransactionException.RLP_LEADING_ZEROS_PRIORITY_FEE" : "rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.DynamicFeeTx).GasTipCap",
174+
"TransactionException.RLP_TOO_FEW_ELEMENTS" : "rlp: too few elements",
175+
"TransactionException.RLP_TOO_MANY_ELEMENTS" : "rlp: input list has too many elements ",
176+
"TransactionException.RLP_ERROR_EOF" : "ERROR(11): unexpected EOF",
177+
"TransactionException.RLP_ERROR_SIZE" : "ERROR(11): rlp: value size exceeds available input length",
178+
"TransactionException.RLP_ERROR_SIZE_LEADING_ZEROS" : "ERROR(11): rlp: non-canonical size information",
179+
112180
181+
"BlockException.EXTRA_DATA_TOO_BIG" : "Header extraData > 32 bytes",
182+
"BlockException.EXTRA_DATA_INVALID_DAO" : "BlockHeader require Dao ExtraData!",
183+
"BlockException.GASLIMIT_TOO_BIG" : "Header gasLimit > 0x7fffffffffffffff",
184+
"BlockException.INVALID_BLOCK_NUMBER" : "BlockHeader number != parent.number + 1",
185+
"BlockException.INVALID_DIFFICULTY" : "Invalid difficulty:",
186+
"BlockException.INVALID_GASLIMIT" : "Invalid gaslimit:",
187+
"BlockException.INVALID_BASEFEE_PER_GAS": "Error in field: baseFeePerGas",
188+
"BlockException.INVALID_GAS_USED" : "Error in field: gasUsed",
189+
"BlockException.INVALID_LOG_BLOOM" : "Error in field: bloom",
190+
"BlockException.INVALID_STATE_ROOT" : "Error in field: stateRoot",
191+
"BlockException.INVALID_RECEIPTS_ROOT" : "Error in field: receiptTrie",
192+
"BlockException.INVALID_TRANSACTIONS_ROOT" : "Error in field: transactionsTrie",
193+
"BlockException.INVALID_BLOCK_TIMESTAMP_OLDER_THAN_PARENT" : "BlockHeader timestamp is less or equal then it's parent block!",
194+
"BlockException.INVALID_WITHDRAWALS_ROOT" : "Error in field: withdrawalsRoot",
195+
"BlockException.INVALID_UNCLES_HASH" : "Error in field: uncleHash",
196+
"BlockException.UNCLE_UNKNOWN_PARENT" : "Parent block hash not found:",
197+
"BlockException.UNCLE_IN_CHAIN" : "Block is already in chain!",
198+
"BlockException.UNCLE_IS_BROTHER" : "Uncle is brother!",
199+
"BlockException.UNCLE_IS_ANCESTOR" : "Block is already in chain!",
200+
"BlockException.UNCLE_PARENT_INCORRECT" : "Uncle number is wrong!",
201+
"BlockException.TOO_MANY_UNCLES" : "Too many uncles!",
202+
203+
"BlockException.UNKNOWN_PARENT" : "unknown parent hash",
204+
"BlockException.UNKNOWN_PARENT_ZERO" : "unknown parent hash",
205+
"BlockException.INCORRECT_EXCESS_BLOB_GAS" : "Error in field: excessBlobGas",
206+
"BlockException.INCORRECT_BLOB_GAS_USED" : "Error in field: blobGasUsed",
207+
"BlockException.GAS_USED_OVERFLOW" : "Invalid gasUsed:",
208+
"BlockException.BLOB_GAS_USED_ABOVE_LIMIT|BlockException.INCORRECT_BLOB_GAS_USED" : "Error in field: blobGasUsed",
209+
"BlockException.INCORRECT_BLOCK_FORMAT" : "[retesteth]: Error importing raw rlp block: readBlockHeader(RLP): unknown block type!",
210+
"BlockException.RLP_INVALID_FIELD_OVERFLOW_64" : "field >= 2**64",
211+
"BlockException.RLP_INVALID_ADDRESS" : "not a valid address!",
212+
213+
"BlockException.RLP_STRUCTURES_ENCODING|BlockException.RLP_WITHDRAWALS_NOT_READ" : "Withdrawals RLP is expected to be list",
214+
"BlockException.RLP_STRUCTURES_ENCODING|BlockException.RLP_INVALID_ADDRESS" : "not a valid address!",
215+
"BlockException.RLP_STRUCTURES_ENCODING|BlockException.RLP_INVALID_FIELD_OVERFLOW_64" : "field >= 2**64",
216+
"BlockException.RLP_STRUCTURES_ENCODING|TransactionException.TYPE_3_TX_WITH_FULL_BLOBS" : "BlobTransaction::fromRLP(RLP) expected to have exactly 14 elements!",
217+
"BlockException.RLP_STRUCTURES_ENCODING|TransactionException.TYPE_3_TX_CONTRACT_CREATION" : "transaction",
218+
219+
"BlockException.IMPORT_IMPOSSIBLE_LEGACY" : "Legacy block import is impossible",
220+
"BlockException.IMPORT_IMPOSSIBLE_SHANGHAI" : "Trying to import Shanghai block on top of block that is not Shanghai!!",
221+
"BlockException.IMPORT_IMPOSSIBLE_LEGACY_WRONG_PARENT" : "Legacy block can only be on top of LegacyBlock",
222+
"BlockException.IMPORT_IMPOSSIBLE_LONDON_WRONG_PARENT" : "1559 block must be on top of 1559",
223+
"BlockException.IMPORT_IMPOSSIBLE_LONDON_OVER_PARIS" : "Trying to import 1559 block on top of PoS block",
224+
"BlockException.IMPORT_IMPOSSIBLE_PARIS_WRONG_POW" : "Invalid block1559: Chain switched to PoS!",
225+
"BlockException.IMPORT_IMPOSSIBLE_PARIS_WRONG_POS" : "Parent (transition) block has not reached TTD",
226+
"BlockException.IMPORT_IMPOSSIBLE_PARIS_OVER_SHANGHAI" : "Trying to import Paris block on top of Shanghai block after transition",
227+
"BlockException.IMPORT_IMPOSSIBLE_UNCLES_OVER_PARIS" : "block.uncleHash != empty",
228+
"BlockException.IMPORT_IMPOSSIBLE_DIFFICULTY_OVER_PARIS" : "block.difficulty must be 0",
229+
230+
"CONVERTED RETESTETH EXCEPTIONS" : "=====================================",
231+
"Transaction without funds" : "Failed transaction:",
113232
"AddressTooShort" : "input string too short for common.Address",
114233
"AddressTooLong" : "rlp: input string too long for common.Address, decoding into (types.Transaction)(types.LegacyTx).To",
115234
"NonceMax" : "nonce exceeds 2^64-1",

‎retesteth/configs/clientconfigs/t8ntool.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ cp -r $parentpath/* $testdir
544544
cp $SRCPATH $testdir/$FILLER.py
545545
SRCPATH2="$testdir/$FILLER.py"
546546
547-
ADDFLAGS=( --tb=short)
547+
ADDFLAGS=( --tb=short -n 10 )
548548
if [ "$TESTCA" != "null" ]; then
549549
SRCPATH2="$SRCPATH2::$TESTCA"
550550
fi

‎retesteth/testStructures/types/BlockchainTests/BlockchainTest.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ BlockchainTestInFilled::BlockchainTestInFilled(spDataObject& _data)
5050
{
5151
REQUIRE_JSONFIELDS(_data, "BlockchainTestInFilled " + _data->getKey(),
5252
{{"_info", {{DataType::Object}, jsonField::Required}},
53+
{"config", {{DataType::Object}, jsonField::Optional}},
5354
{"sealEngine", {{DataType::String}, jsonField::Optional}},
5455
{"genesisBlockHeader", {{DataType::Object}, jsonField::Required}},
5556
{"postState", {{DataType::Object}, jsonField::Optional}},

‎retesteth/testStructures/types/StateTests/Base/StateTestEnvBase.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spDataObject StateTestEnvBase::asDataObject() const
1313
(*data)["currentDifficulty"] = m_currentDifficulty->asString();
1414
(*data)["currentBaseFee"] = m_currentBaseFee->asString();
1515
(*data)["currentExcessBlobGas"] = m_currentExcessBlobGas->asString();
16-
(*data)["currentRequestsHash"] = m_currentRequestsHash->asString();
16+
//(*data)["currentRequestsHash"] = m_currentRequestsHash->asString();
1717
return data;
1818
}
1919

‎retesteth/testStructures/types/StateTests/Filled/StateTestPostResult.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ StateTestPostResult::StateTestPostResult(DataObject const& _data)
1212
{"postState", {{DataType::Object}, jsonField::Optional}},
1313
{"txbytes", {{DataType::String}, jsonField::Optional}},
1414
{"txtrace", {{DataType::String}, jsonField::Optional}},
15+
{"state", {{DataType::Object}, jsonField::Optional}},
1516
{"expectException", {{DataType::String}, jsonField::Optional}},
1617
{"logs", {{DataType::String}, jsonField::Optional}}});
1718

‎retesteth/testStructures/types/StateTests/GeneralStateTest.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ StateTestInFilled::StateTestInFilled(spDataObject& _data)
7272
{"env", {{DataType::Object}, jsonField::Required}},
7373
{"post", {{DataType::Object}, jsonField::Required}},
7474
{"pre", {{DataType::Object}, jsonField::Required}},
75+
{"config", {{DataType::Object}, jsonField::Optional}},
7576
{"transaction", {{DataType::Object}, jsonField::Required}}});
7677

7778
// UnitTests

‎retesteth/testSuiteRunner/TestSuite.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ void TestSuite::verifyFilledTestsFolders(fs::path const& _fillerPath, fs::path c
106106
void TestSuite::runAllTestsInFolder(string const& _testFolder) const
107107
{
108108
Options::getDynamicOptions().getClientConfigs();
109+
110+
111+
// Set the first config for .py test verification (as we always use 1 config anyway)
112+
if (!Options::getDynamicOptions().isConfigSet())
113+
{
114+
for (auto const& config : Options::getDynamicOptions().getClientConfigs())
115+
{
116+
Options::getDynamicOptions().setCurrentConfig(config);
117+
break;
118+
}
119+
}
120+
109121
CHECKEXIT
110122

111123
clearGeneratedTestNamesMap();

‎retesteth/testSuiteRunner/TestSuiteHelperFunctions.cpp

+40-8
Original file line numberDiff line numberDiff line change
@@ -169,31 +169,36 @@ vector<string> getTestNamesFromJsonYaml(fs::path const& _filler)
169169

170170
bool _checkPythonTestBlockchainOnly(string const& _pythonSrc, size_t _foundTestPos)
171171
{
172-
size_t foundBlockchain = _pythonSrc.find("blockchain_test(", _foundTestPos);
173-
if (foundBlockchain == string::npos)
172+
// Return true if found a blockchain test at _foundTestPos
173+
size_t foundNotStateTest = _pythonSrc.find(": BlockchainTestFiller,", _foundTestPos);
174+
if (foundNotStateTest == string::npos)
175+
foundNotStateTest = _pythonSrc.find("blockchain_test(", _foundTestPos);
176+
177+
if (foundNotStateTest == string::npos)
174178
return false;
175179

176180
size_t foundNextTestPos = _pythonSrc.find("def test_", _foundTestPos + 50);
177181
if (foundNextTestPos == string::npos)
178182
return true;
179183

180-
if (foundBlockchain < foundNextTestPos)
184+
if (foundNotStateTest < foundNextTestPos)
181185
return true;
182186

183187
return false;
184188
}
185189

186190
bool _checkPythonTestStateTestOnly(string const& _pythonSrc, size_t _foundTestPos)
187191
{
188-
size_t foundBlockchain = _pythonSrc.find("state_test_only(", _foundTestPos);
189-
if (foundBlockchain == string::npos)
192+
// Return true if found a State test on _foundTestPos
193+
size_t foundStateTestOnly = _pythonSrc.find("state_test_only(", _foundTestPos);
194+
if (foundStateTestOnly == string::npos)
190195
return false;
191196

192197
size_t foundNextTestPos = _pythonSrc.find("def test_", _foundTestPos + 50);
193198
if (foundNextTestPos == string::npos)
194199
return true;
195200

196-
if (foundBlockchain < foundNextTestPos)
201+
if (foundStateTestOnly < foundNextTestPos)
197202
return true;
198203

199204
return false;
@@ -215,6 +220,27 @@ bool _checkPythonTestSkipped(string const& _pythonSrc, size_t _foundTestPos)
215220
return false;
216221
}
217222

223+
bool _checkPythonTestTransitionToUnsupportedFork(string const& _pythonSrc, size_t _foundTestPos)
224+
{
225+
string marker = "pytest.mark.valid_at_transition_to(\"";
226+
size_t foundTransitionMarker = _pythonSrc.rfind(marker, _foundTestPos);
227+
if (foundTransitionMarker == string::npos)
228+
return false;
229+
230+
// Check if found test is not a supported transition test
231+
size_t findMarkerClose = _pythonSrc.find("\"", foundTransitionMarker + marker.length());
232+
string fork = _pythonSrc.substr(foundTransitionMarker + marker.length(), findMarkerClose - foundTransitionMarker - marker.length());
233+
234+
// ETH_WARNING("Transition test for "+ fork);
235+
bool forkInProgression = Options::getCurrentConfig().checkForkInProgression(FORK(fork));
236+
237+
size_t foundNextTestPos_after_transition_marker = _pythonSrc.find("def test_", foundTransitionMarker);
238+
if (_foundTestPos == foundNextTestPos_after_transition_marker && !forkInProgression)
239+
return true;
240+
241+
return false;
242+
}
243+
218244
// Get filled test names from .py filler
219245
vector<string> getTestNamesFromPython(fs::path const& _filler)
220246
{
@@ -243,9 +269,15 @@ vector<string> getTestNamesFromPython(fs::path const& _filler)
243269
{
244270
ETH_WARNING("Will skip python bc test " + pythonTestname);
245271
}
246-
else if (OnBlockchainTest && _checkPythonTestStateTestOnly(pythonSrc, foundTestPos))
272+
else if (OnBlockchainTest)
247273
{
248-
ETH_WARNING("Will skip python state only test " + pythonTestname);
274+
if (_checkPythonTestStateTestOnly(pythonSrc, foundTestPos))
275+
ETH_WARNING("Will skip python state only test " + pythonTestname);
276+
else
277+
if (_checkPythonTestTransitionToUnsupportedFork(pythonSrc, foundTestPos))
278+
ETH_WARNING("Will skip python bc transition test to unsupported fork " + pythonTestname);
279+
else
280+
generatedTestNames.emplace_back(pythonTestname);
249281
}
250282
else
251283
generatedTestNames.emplace_back(pythonTestname);

‎retesteth/testSuites/statetests/StateTestRunner.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,13 @@ void StateTestRunner::performValidations(TransactionInGeneralSection& _tr, State
228228

229229
auto signatureRlpLength = size_r + size_s + 2;
230230
calculated.erase(calculated.size() - signatureRlpLength, signatureRlpLength);
231+
calculated = calculated.substr(6); // erase rlp header 0xrlpheader
231232

232233
if (expectedBytesPtr->asString().find(calculated) == string::npos)
233234
{
234235
string msg = string("TxBytes mismatch: test transaction section does not match txbytes in post section (Signature ignored)! ");
235-
if (Debug::get().flag(DC::STATS2))
236+
msg += "(file: " + TestOutputHelper::get().testFile().string() + ")";
237+
if (Debug::get().flag(DC::STATS2) || Debug::get().flag(DC::PYSPEC))
236238
msg += "\n test txbytes: " + expectedBytesPtr->asString() + "\n vs \n " + tr->getRawBytes().asString();
237239
if (Options::get().chainid.initialized())
238240
{

0 commit comments

Comments
 (0)
Please sign in to comment.