Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New beta #1897

Merged
merged 6 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libdevcore/LevelDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class LevelDB : public DatabaseFace {
static std::atomic< uint64_t > g_keyDeletesStats;
// count of the keys that are scheduled to be deleted but are not yet deleted
static std::atomic< uint64_t > g_keysToBeDeletedStats;
static uint64_t getCurrentTimeMs();

private:
std::unique_ptr< leveldb::DB > m_db;
Expand Down Expand Up @@ -123,7 +124,6 @@ class LevelDB : public DatabaseFace {
}
};
void openDBInstanceUnsafe();
uint64_t getCurrentTimeMs();
void reopenDataBaseIfNeeded();
};

Expand Down
9 changes: 6 additions & 3 deletions libethereum/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,13 @@ size_t Client::syncTransactions(
// Tell network about the new transactions.
m_skaleHost->noteNewTransactions();

ctrace << cc::debug( "Processed " ) << cc::size10( newPendingReceipts.size() )
<< cc::debug( " transactions in " ) << cc::size10( timer.elapsed() * 1000 )
<< cc::debug( "(" ) << ( bool ) m_syncTransactionQueue << cc::debug( ")" );
ctrace << "Processed " << newPendingReceipts.size() << " transactions in "
<< timer.elapsed() * 1000 << "(" << ( bool ) m_syncTransactionQueue << ")";

#ifdef HISTORIC_STATE
LOG( m_logger ) << "HSCT: "
<< m_working.mutableState().mutableHistoricState().getAndResetBlockCommitTime();
#endif
return goodReceipts;
}

Expand Down
1 change: 1 addition & 0 deletions libethereum/SkaleHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ void SkaleHost::createBlock( const ConsensusExtFace::transactions_vector& _appro
skaledTimeFinish - skaledTimeStart )
.count();
}

latestBlockTime = skaledTimeFinish;
LOG( m_debugLogger ) << "Successfully imported " << n_succeeded << " of " << out_txns.size()
<< " transactions";
Expand Down
13 changes: 12 additions & 1 deletion libhistoric/HistoricState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ HistoricState::HistoricState( HistoricState const& _s )
m_unchangedCacheEntries( _s.m_unchangedCacheEntries ),
m_nonExistingAccountsCache( _s.m_nonExistingAccountsCache ),
m_unrevertablyTouched( _s.m_unrevertablyTouched ),
m_accountStartNonce( _s.m_accountStartNonce ) {}
m_accountStartNonce( _s.m_accountStartNonce ),
m_totalTimeSpentInStateCommitsPerBlock( _s.m_totalTimeSpentInStateCommitsPerBlock ) {}

OverlayDB HistoricState::openDB(
fs::path const& _basePath, h256 const& _genesisHash, WithExisting _we ) {
Expand Down Expand Up @@ -137,6 +138,7 @@ HistoricState& HistoricState::operator=( HistoricState const& _s ) {
m_nonExistingAccountsCache = _s.m_nonExistingAccountsCache;
m_unrevertablyTouched = _s.m_unrevertablyTouched;
m_accountStartNonce = _s.m_accountStartNonce;
m_totalTimeSpentInStateCommitsPerBlock = _s.m_totalTimeSpentInStateCommitsPerBlock;
return *this;
}

Expand Down Expand Up @@ -194,11 +196,20 @@ void HistoricState::clearCacheIfTooLarge() const {
}

void HistoricState::commitExternalChanges( AccountMap const& _accountMap ) {
auto historicStateStart = dev::db::LevelDB::getCurrentTimeMs();
commitExternalChangesIntoTrieDB( _accountMap, m_state );
m_state.db()->commit();
m_changeLog.clear();
m_cache.clear();
m_unchangedCacheEntries.clear();
auto historicStateFinish = dev::db::LevelDB::getCurrentTimeMs();
m_totalTimeSpentInStateCommitsPerBlock += historicStateFinish - historicStateStart;
}

uint64_t HistoricState::getAndResetBlockCommitTime() {
uint64_t retVal = m_totalTimeSpentInStateCommitsPerBlock;
m_totalTimeSpentInStateCommitsPerBlock = 0;
return retVal;
}


Expand Down
4 changes: 4 additions & 0 deletions libhistoric/HistoricState.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class HistoricState {

void setRootFromDB();

uint64_t getAndResetBlockCommitTime();

private:
/// Turns all "touched" empty accounts into non-alive accounts.
void removeEmptyAccounts();
Expand Down Expand Up @@ -345,6 +347,8 @@ class HistoricState {

AddressHash commitExternalChangesIntoTrieDB(
AccountMap const& _cache, SecureTrieDB< Address, OverlayDB >& _state );

uint64_t m_totalTimeSpentInStateCommitsPerBlock = 0;
};

std::ostream& operator<<( std::ostream& _out, HistoricState const& _s );
Expand Down
Loading