Skip to content

Commit

Permalink
SKALED-1545 Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dimalit committed Nov 22, 2024
1 parent ac34631 commit 578f06a
Show file tree
Hide file tree
Showing 82 changed files with 2,347 additions and 2,237 deletions.
849 changes: 424 additions & 425 deletions libethereum/Block.cpp

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions libethereum/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,10 +1073,10 @@ h256 Client::importTransaction( Transaction const& _t, TransactionBroadcast _txO
gasBidPrice = this->gasBidPrice();


// We need to check external gas under mutex to be sure about current block number
// correctness
const_cast< Transaction& >( _t ).checkOutExternalGas(
chainParams(), bc().info().timestamp(), number() );
// We need to check external gas under mutex to be sure about current block number
// correctness
const_cast< Transaction& >( _t ).checkOutExternalGas(
chainParams(), bc().info().timestamp(), number() );


Executive::verifyTransaction( _t, bc().info().timestamp(),
Expand Down
2 changes: 1 addition & 1 deletion libethereum/SkaleHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ void SkaleHost::createBlock( const ConsensusExtFace::transactions_vector& _appro
Transaction t( data, CheckTransaction::Everything, true,
EIP1559TransactionsPatch::isEnabledInWorkingBlock() );
t.checkOutExternalGas(
m_client.chainParams(), latestInfo.timestamp(), m_client.number());
m_client.chainParams(), latestInfo.timestamp(), m_client.number() );
out_txns.push_back( t );
m_debugTracer.tracepoint( "drop_good" );
m_tq.dropGood( t );
Expand Down
4 changes: 2 additions & 2 deletions libethereum/TransactionQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ class TransactionQueue {
queue.m_currentByAddressAndNonce[_second.transaction.sender()].begin()->first;

return ( height1 < height2 ||
( height1 == height2 &&
_first.transaction.gasPrice() > _second.transaction.gasPrice() ) );
( height1 == height2 &&
_first.transaction.gasPrice() > _second.transaction.gasPrice() ) );
}
};

Expand Down
2 changes: 1 addition & 1 deletion libskale/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ void State::commit( dev::eth::CommitBehaviour _commitBehaviour ) {
// for testeth GeneralState tests, though, there is no db connected to the
// State , so we do not clear caches
// since they play the role of the db
if (m_db_ptr->connected()) {
if ( m_db_ptr->connected() ) {
m_cache.clear();
m_unchangedCacheEntries.clear();
}
Expand Down
4 changes: 0 additions & 4 deletions libskale/httpserveroverride.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ typedef intptr_t ssize_t;
#endif

#include <stdexcept>
#define RAPIDJSON_ASSERT( x ) \
if ( !( x ) ) { \
throw std::out_of_range( #x " failed with provided JSON" ); \
}
#define RAPIDJSON_ASSERT_THROWS
#include <rapidjson/document.h>
#include <rapidjson/prettywriter.h>
Expand Down
4 changes: 0 additions & 4 deletions libweb3jsonrpc/JsonHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
#include <libethereum/LogFilter.h>

#include <stdexcept>
#define RAPIDJSON_ASSERT( x ) \
if ( !( x ) ) { \
throw std::out_of_range( #x " failed with provided JSON" ); \
}
#define RAPIDJSON_ASSERT_THROWS

#include <rapidjson/document.h>
Expand Down
1 change: 0 additions & 1 deletion skale-vm/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ int main( int argc, char** argv ) {
bytes output = std::move( res.output );

if ( mode == Mode::Statistics ) {

cout << "Gas used: " << res.gasUsed << " (+" << t.baseGasRequired( evmSchedule )
<< " for transaction, -" << res.gasRefunded << " refunded)\n";

Expand Down
9 changes: 5 additions & 4 deletions storage_benchmark/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void testState() {

cout << "Balances reads:" << endl;
cout << measure_performance(
[&state, &address]() { state.createStateCopyAndClearCaches().balance(address ); },
[&state, &address]() { state.createStateCopyAndClearCaches().balance( address ); },
100000 ) /
1e6
<< " Mreads per second" << endl;
Expand All @@ -150,7 +150,7 @@ void testState() {
cout << "EVM storate reads:" << endl;
cout << measure_performance(
[&state, &address, &memory_address]() {
state.createReadOnlySnapBasedCopy().storage(address, memory_address );
state.createReadOnlySnapBasedCopy().storage( address, memory_address );
memory_address = ( memory_address + 1 ) % 1024;
},
1000 ) /
Expand All @@ -176,8 +176,9 @@ void testState() {

cout << "EVM code reads:" << endl;
cout << measure_performance(
[&state, &address]() { state.createReadOnlySnapBasedCopy().code(address ); }, 1000 ) /
1e6
[&state, &address]() { state.createReadOnlySnapBasedCopy().code( address ); },
1000 ) /
1e6
<< " Mreads per second" << endl;
}

Expand Down
5 changes: 3 additions & 2 deletions test/tools/fuzzTesting/BoostRandomCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ BoostRandomCode::BoostRandomCode() {

u256 BoostRandomCode::randomUniInt( u256 const& _minVal, u256 const& _maxVal ) {
assert( _minVal <= _maxVal );
std::uniform_int_distribution< uint64_t > uint64Dist{0, std::numeric_limits< uint64_t >::max()};
std::uniform_int_distribution< uint64_t > uint64Dist{ 0,
std::numeric_limits< uint64_t >::max() };
u256 value = _minVal + ( u256 ) uint64Dist( gen ) % ( _maxVal - _minVal );
return value;
}

uint8_t BoostRandomCode::weightedOpcode( std::vector< int > const& _weights ) {
DescreteDistrib opCodeProbability = DescreteDistrib{_weights.begin(), _weights.end()};
DescreteDistrib opCodeProbability = DescreteDistrib{ _weights.begin(), _weights.end() };
return opCodeProbability( gen );
}
} // namespace test
Expand Down
6 changes: 3 additions & 3 deletions test/tools/fuzzTesting/fuzzHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

using namespace dev;
using namespace std;
const static std::array< eth::Instruction, 47 > invalidOpcodes{{eth::Instruction::INVALID,
const static std::array< eth::Instruction, 47 > invalidOpcodes{ { eth::Instruction::INVALID,
eth::Instruction::PUSHC, eth::Instruction::JUMPC, eth::Instruction::JUMPCI,
eth::Instruction::JUMPTO, eth::Instruction::JUMPIF, eth::Instruction::JUMPSUB,
eth::Instruction::JUMPV, eth::Instruction::JUMPSUBV, eth::Instruction::BEGINSUB,
Expand All @@ -45,7 +45,7 @@ const static std::array< eth::Instruction, 47 > invalidOpcodes{{eth::Instruction
eth::Instruction::XROR, eth::Instruction::XPUSH, eth::Instruction::XMLOAD,
eth::Instruction::XMSTORE, eth::Instruction::XSLOAD, eth::Instruction::XSSTORE,
eth::Instruction::XVTOWIDE, eth::Instruction::XWIDETOV, eth::Instruction::XPUT,
eth::Instruction::XGET, eth::Instruction::XSWIZZLE, eth::Instruction::XSHUFFLE}};
eth::Instruction::XGET, eth::Instruction::XSWIZZLE, eth::Instruction::XSHUFFLE } };

namespace dev {
namespace test {
Expand Down Expand Up @@ -227,7 +227,7 @@ std::string RandomCodeBase::generate( int _maxOpNumber, RandomCodeOptions const&
opcode = makeOpcodeDefined( opcode );
eth::Instruction inst = ( eth::Instruction ) opcode;
eth::InstructionInfo info = eth::instructionInfo( inst );
if ( std::string{info.name}.find( "PUSH" ) != std::string::npos ) {
if ( std::string{ info.name }.find( "PUSH" ) != std::string::npos ) {
code += toCompactHex( opcode );
code += fillArguments( inst, _options );
} else {
Expand Down
Loading

0 comments on commit 578f06a

Please sign in to comment.