Skip to content

Commit 74cca5a

Browse files
committed
support pyspec with eels
better .py parsing of bc markers
1 parent 2b78281 commit 74cca5a

File tree

13 files changed

+188
-15
lines changed

13 files changed

+188
-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();

0 commit comments

Comments
 (0)