Skip to content

Commit

Permalink
Merge branch 'v3.20.0' into enhancement/SKALED-1900-release-build-deb…
Browse files Browse the repository at this point in the history
…ug-info
  • Loading branch information
dimalit authored Sep 13, 2024
2 parents 3859a55 + c2dd5c6 commit a145022
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmake/EthUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ macro(eth_add_test NAME)
add_custom_target("test.${NAME}"
DEPENDS testeth
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -DETH_TEST_NAME="${NAME}" -DCTEST_COMMAND="${CTEST_COMMAND}" -P "${ETH_SCRIPTS_DIR}/runtest.cmake"
COMMAND ${CMAKE_COMMAND} -DETH_TEST_NAME="${NAME}" -DCTEST_COMMAND="${CMAKE_CTEST_COMMAND}" -P "${ETH_SCRIPTS_DIR}/runtest.cmake"
)

endmacro()
Expand Down
25 changes: 16 additions & 9 deletions skale-vm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,20 @@ int main( int argc, char** argv ) {
} // Ignore decoding errors.
}

unique_ptr< SealEngineFace > se( ChainParams( genesisInfo( networkName ) ).createSealEngine() );
ChainParams chainParams( genesisInfo( networkName ) );
LastBlockHashes lastBlockHashes;
EnvInfo const envInfo(
blockHeader, lastBlockHashes, 0 /* gasUsed */, se->chainParams().chainID );
EnvInfo const envInfo( blockHeader, lastBlockHashes, 0 /*_committedBlockTimestamp*/,
0 /* gasUsed */, chainParams.chainID );
EVMSchedule evmSchedule = chainParams.makeEvmSchedule( 0, envInfo.number() );

state = state.createStateModifyCopy();

Transaction t;
Address contractDestination( "1122334455667788991011121314151617181920" );
if ( !code.empty() ) {
// Deploy the code on some fake account to be called later.
Account account( 0, 0 );
auto const latestVersion = se->evmSchedule( envInfo.number() ).accountVersion;
auto const latestVersion = evmSchedule.accountVersion;
account.setCode( bytes{ code }, latestVersion );
std::unordered_map< Address, Account > map;
map[contractDestination] = account;
Expand All @@ -307,10 +310,12 @@ int main( int argc, char** argv ) {
// data.
t = Transaction( value, gasPrice, gas, data, 0 );

t.ignoreExternalGas(); // for tests

state.addBalance( sender, value );

// HACK 0 here is for gasPrice
Executive executive( state, envInfo, *se, 0 );
// HACK 1st 0 here is for gasPrice
Executive executive( state, envInfo, chainParams, 0, 0 );
ExecutionResult res;
executive.setResultRecipient( res );
t.forceSender( sender );
Expand Down Expand Up @@ -346,9 +351,8 @@ int main( int argc, char** argv ) {
bytes output = std::move( res.output );

if ( mode == Mode::Statistics ) {
cout << "Gas used: " << res.gasUsed << " (+"
<< t.baseGasRequired( se->evmSchedule( envInfo.number() ) ) << " for transaction, -"
<< res.gasRefunded << " refunded)\n";
cout << "Gas used: " << res.gasUsed << " (+" << t.baseGasRequired( evmSchedule )
<< " for transaction, -" << res.gasRefunded << " refunded)\n";
cout << "Output: " << toHex( output ) << "\n";
LogEntries logs = executive.logs();
cout << logs.size() << " logs" << ( logs.empty() ? "." : ":" ) << "\n";
Expand Down Expand Up @@ -385,5 +389,8 @@ int main( int argc, char** argv ) {
<< '\n';
cout << "exec time: " << fixed << setprecision( 6 ) << execTime << '\n';
}

state.releaseWriteLock();

return 0;
}

0 comments on commit a145022

Please sign in to comment.