Skip to content

Commit

Permalink
Merge branch '1545_without_dos_and_stats_cleanups' of github.com:skal…
Browse files Browse the repository at this point in the history
…enetwork/skaled into 1545_without_dos_and_stats_cleanups
  • Loading branch information
kladkogex committed Nov 25, 2024
2 parents 1a307cc + f98ed82 commit 8cfbeac
Show file tree
Hide file tree
Showing 16 changed files with 897 additions and 774 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: skalenetwork/skale-ci-integration_tests
ref: master
ref: v3.20.0
submodules: recursive
- name: Set up Node
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
sudo rm -rf /tmp/tests/*
cd build/test
export NO_NTP_CHECK=1
export NO_ULIMIT_CHECK=1
export NO_ULIMIT_CHECK=1
function run_test() { ./testeth --report_level=detailed -t "$1" -- --express && touch "/tmp/tests/${1}Passed"; }
run_test TransitionTests
run_test TransactionTests
Expand Down
3 changes: 2 additions & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
3.19.1
4.0.0

35 changes: 4 additions & 31 deletions docs/json-rpc-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,6 @@ Get details about block
2. Include transactions: boolean literal - true/false
#### Return format
Same as `eth_getBlockByHash`
#### Exceptions
Raises "block not found" error if block is "rotated out"

### `eth_getTransactionByHash`
| Compatibility | |
Expand Down Expand Up @@ -746,6 +744,8 @@ Get all events matching a filter
Same as `eth_getFilterChanges`
#### Exceptions
Throws `INVALID_PARAMS` if filter cannot be found or if response size is exceeded
#### Notes
Response size is limited by number of consecutive blocks that can be requested. It is set in `getLogsBlocksLimit` config parameter, which currenly is 2000 blocks.

### `eth_getLogs`
| Compatibility | |
Expand All @@ -771,6 +771,8 @@ Same as `eth_getFilterLogs`, but doesn't require filter creation
Same as `eth_getFilterChanges`
#### Exceptions
Throws `INVALID_PARAMS` if block does not exist, if response size is exceeded, or `fromBlock` or `toBlock` are present together with `blockHash`
#### Notes
Response size limit is determined by `getLogsBlocksLimit` config parameter, and currenly is 2000 logs per request.

### `eth_compile*` and `eth_getCompilers`
Not supported
Expand Down Expand Up @@ -869,35 +871,6 @@ Object:
- "accessList" - empty list;
- "gasUsed" - "0x" prefixed hex `String` - result of `eth_estimateGas`.

### `eth_getBlockTransactionCountByHash`
| Compatibility | |
|-----|-----------|
| Core vs ETH | Unknown |
| Historic vs ETH | Unknown |

#### Description
Get number of transactions in a block
#### Parameters
1. Block hash: "0x"-prefixed hex `String`, 32 bytes
#### Return format
"0x"-prefixed hex `String`

### `eth_getBlockTransactionCountByNumber`
| Compatibility | |
|-----|-----------|
| Core vs ETH | Unknown |
| Historic vs ETH | Unknown |

#### Description
Get number of transactions in a block
#### Parameters
1. Block number:
- "latest" or "pending" - latest block is used;
- "earliest" - block 0;
- `String` representation of an integer block number, either decimal or "0x"-prefixed hexadecimal;
#### Return format
"0x"-prefixed hex `String`

### `eth_getFilterChangesEx`
| Compatibility | |
|-----|-----------|
Expand Down
48 changes: 24 additions & 24 deletions libethereum/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,37 +708,37 @@ void Client::onPostStateChanged() {
void Client::startSealing() {
if ( m_wouldSeal == true )
return;
LOG( m_logger ) << cc::notice( "Client::startSealing: " ) << author();
LOG( m_logger ) << "Client::startSealing: " << author();
if ( author() ) {
m_wouldSeal = true;
m_signalled.notify_all();
} else
LOG( m_logger ) << cc::warn( "You need to set an author in order to seal!" );
LOG( m_logger ) << "You need to set an author in order to seal!";
}

void Client::rejigSealing() {
if ( ( wouldSeal() || remoteActive() ) && !isMajorSyncing() ) {
if ( sealEngine()->shouldSeal( this ) ) {
m_wouldButShouldnot = false;

LOG( m_loggerDetail ) << cc::notice( "Rejigging seal engine..." );
LOG( m_loggerDetail ) << "Rejigging seal engine...";
DEV_WRITE_GUARDED( x_working ) {
if ( m_working.isSealed() ) {
LOG( m_logger ) << cc::notice( "Tried to seal sealed block..." );
LOG( m_logger ) << "Tried to seal sealed block...";
return;
}
// TODO is that needed? we have "Generating seal on" below
LOG( m_loggerDetail ) << cc::notice( "Starting to seal block" ) << " "
<< cc::warn( "#" ) << cc::num10( m_working.info().number() );
LOG( m_loggerDetail ) << "Starting to seal block"
<< " #" << m_working.info().number();

// TODO Deduplicate code!
// TODO Deduplicate code
dev::h256 stateRootToSet;
if ( m_snapshotAgent->getLatestSnapshotBlockNumer() > 0 ) {
dev::h256 state_root_hash = this->m_snapshotAgent->getSnapshotHash(
dev::h256 stateRootHash = this->m_snapshotAgent->getSnapshotHash(
m_snapshotAgent->getLatestSnapshotBlockNumer() );
stateRootToSet = state_root_hash;
stateRootToSet = stateRootHash;
}
// propagate current!
// propagate current
else if ( this->number() > 0 ) {
stateRootToSet =
blockInfo( this->hashFromNumber( this->number() ) ).stateRoot();
Expand All @@ -756,15 +756,15 @@ void Client::rejigSealing() {

if ( wouldSeal() ) {
sealEngine()->onSealGenerated( [=]( bytes const& _header ) {
LOG( m_logger ) << cc::success( "Block sealed" ) << " " << cc::warn( "#" )
<< cc::num10( BlockHeader( _header, HeaderData ).number() );
LOG( m_logger ) << "Block sealed"
<< " #" << BlockHeader( _header, HeaderData ).number();
if ( this->submitSealed( _header ) )
m_onBlockSealed( _header );
else
LOG( m_logger ) << cc::error( "Submitting block failed..." );
LOG( m_logger ) << "Submitting block failed...";
} );
ctrace << cc::notice( "Generating seal on " ) << m_sealingInfo.hash( WithoutSeal )
<< " " << cc::warn( "#" ) << cc::num10( m_sealingInfo.number() );
ctrace << "Generating seal on " << m_sealingInfo.hash( WithoutSeal ) << " #"
<< m_sealingInfo.number();
sealEngine()->generateSeal( m_sealingInfo );
}
} else
Expand All @@ -777,24 +777,24 @@ void Client::rejigSealing() {
void Client::sealUnconditionally( bool submitToBlockChain ) {
m_wouldButShouldnot = false;

LOG( m_loggerDetail ) << cc::notice( "Rejigging seal engine..." );
LOG( m_loggerDetail ) << "Rejigging seal engine...";
DEV_WRITE_GUARDED( x_working ) {
if ( m_working.isSealed() ) {
LOG( m_logger ) << cc::notice( "Tried to seal sealed block..." );
LOG( m_logger ) << "Tried to seal sealed block...";
return;
}
// TODO is that needed? we have "Generating seal on" below
LOG( m_loggerDetail ) << cc::notice( "Starting to seal block" ) << " " << cc::warn( "#" )
<< cc::num10( m_working.info().number() );
// latest hash is really updated after NEXT snapshot already started hash computation!
// TODO Deduplicate code!
LOG( m_loggerDetail ) << "Starting to seal block"
<< " #" << m_working.info().number();
// latest hash is really updated after NEXT snapshot already started hash computation
// TODO Deduplicate code
dev::h256 stateRootToSet;
if ( m_snapshotAgent->getLatestSnapshotBlockNumer() > 0 ) {
dev::h256 state_root_hash = this->m_snapshotAgent->getSnapshotHash(
dev::h256 stateRootHash = this->m_snapshotAgent->getSnapshotHash(
m_snapshotAgent->getLatestSnapshotBlockNumer() );
stateRootToSet = state_root_hash;
stateRootToSet = stateRootHash;
}
// propagate current!
// propagate current
else if ( this->number() > 0 ) {
stateRootToSet = blockInfo( this->hashFromNumber( this->number() ) ).stateRoot();
} else {
Expand Down
3 changes: 1 addition & 2 deletions libethereum/SkaleHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,7 @@ void SkaleHost::createBlock( const ConsensusExtFace::transactions_vector& _appro
<< stCurrent.hex();

// FATAL if mismatch in non-default
if ( _winningNodeIndex != 0 && dev::h256::Arith( stCurrent ) != _stateRoot &&
!this->m_client.chainParams().nodeInfo.syncNode ) {
if ( _winningNodeIndex != 0 && dev::h256::Arith( stCurrent ) != _stateRoot ) {
LOG( m_errorLogger ) << "FATAL STATE ROOT MISMATCH ERROR: current state root "
<< dev::h256::Arith( stCurrent ).str()
<< " is not equal to arrived state root " << _stateRoot.str()
Expand Down
Loading

0 comments on commit 8cfbeac

Please sign in to comment.