@@ -348,6 +348,18 @@ const synthesizeTestCases = function (testCases, updateParamIfNeeded) {
348348 }
349349} ;
350350
351+ /**
352+ * To run the Ethereum Execution API tests as defined in the repository ethereum/execution-apis, it’s necessary
353+ * to execute them against a specifically configured node. This node must use:
354+ * - Transactions from the blocks in chain.rlp (https://github.com/ethereum/execution-apis/blob/main/tests/chain.rlp),
355+ * - Account balances from genesis.json (https://github.com/ethereum/execution-apis/blob/main/tests/genesis.json).
356+ *
357+ * We cannot replay all of the chain.rlp transactions directly, as they are already signed with a chain id
358+ * that exceeds Java’s Integer.MAX_VALUE (which is also the maximum allowed chain ID in Hedera).
359+ * However, we can replicate the test environment by deploying the required smart contracts manually.
360+ * While these contracts will receive different addresses than those in the original tests,
361+ * their behavior will remain consistent with the expectations.
362+ */
351363const initGenesisData = async function ( ) {
352364 for ( const data of require ( './data/conformity/genesis.json' ) ) {
353365 const options = { maxPriorityFeePerGas : gasPrice , maxFeePerGas : gasPrice , gasLimit : gasLimit } ;
@@ -375,11 +387,13 @@ describe('@api-conformity', async function () {
375387 currentBlockHash = await getLatestBlockHash ( ) ;
376388 } ) ;
377389 //Reading the directories within the ethereum execution api repo
390+ //Adds tests for custom Hedera methods from override directory to the list, even if they're not in the OpenRPC spec.
378391 let directories = [ ...new Set ( [ ...fs . readdirSync ( directoryPath ) , ...fs . readdirSync ( overwritesDirectoryPath ) ] ) ] ;
379392 const relaySupportedMethodNames = openRpcData . methods . map ( ( method ) => method . name ) ;
380393 //Filtering in order to use only the tests for methods we support in our relay
381394 directories = directories . filter ( ( directory ) => relaySupportedMethodNames . includes ( directory ) ) ;
382395 for ( const directory of directories ) {
396+ //Lists all files (tests) in a directory (method). Returns an empty array for non-existing directory.
383397 const ls = ( dir : string ) => ( fs . existsSync ( dir ) && fs . statSync ( dir ) . isDirectory ( ) ? fs . readdirSync ( dir ) : [ ] ) ;
384398 const files = [
385399 ...new Set ( [ ...ls ( path . join ( directoryPath , directory ) ) , ...ls ( path . join ( overwritesDirectoryPath , directory ) ) ] ) ,
0 commit comments