Skip to content

Commit

Permalink
Merge pull request #1806 from skalenetwork/develop
Browse files Browse the repository at this point in the history
Develop to beta
  • Loading branch information
DmytroNazarenko authored Feb 7, 2024
2 parents cb58c6d + d072f44 commit 6061db7
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 9 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/custom_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ on:
description: 'Additional cmake options'
default: ''
required: false
build_type:
description: 'Build type of skaled binary'
type: choice
required: true
options:
- Debug
- RelWithDebInfo
default: RelWithDebInfo

jobs:
main_job:
Expand All @@ -23,6 +31,7 @@ jobs:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
BUILD_TYPE: ${{ github.event.inputs.build_type }}
steps:
- name: update apt
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update
Expand Down Expand Up @@ -95,18 +104,19 @@ jobs:
export CC=gcc-9
export CXX=g++-9
export TARGET=all
export CMAKE_BUILD_TYPE=Debug
export CMAKE_BUILD_TYPE=$BUILD_TYPE
[[ $CMAKE_BUILD_TYPE = "Debug" ]] && export DEBUG_FLAG=1 || export DEBUG_FLAG=0
cd deps
./clean.sh
rm -f ./libwebsockets-from-git.tar.gz
./build.sh PARALLEL_COUNT=$(nproc) DEBUG=1
./build.sh PARALLEL_COUNT=$(nproc) DEBUG=$DEBUG_FLAG
cd ..
- name: Configure all
run: |
export CC=gcc-9
export CXX=g++-9
export TARGET=all
export CMAKE_BUILD_TYPE=Debug
export CMAKE_BUILD_TYPE=$BUILD_TYPE
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE ${{ github.event.inputs.cmake_options }} ..
Expand All @@ -116,7 +126,7 @@ jobs:
export CC=gcc-9
export CXX=g++-9
export TARGET=all
export CMAKE_BUILD_TYPE=Debug
export CMAKE_BUILD_TYPE=$BUILD_TYPE
cd build
make skaled -j$(nproc)
#echo "Ensure release mode skaled does not have any debug markers"
Expand All @@ -127,7 +137,8 @@ jobs:
run: |
cp build/skaled/skaled scripts/skale_build/executable/
export BRANCH=${{ github.event.inputs.branch_name }}
export VERSION=${{ github.event.inputs.image_version }}
[[ $BUILD_TYPE = "Debug" ]] && export VERSION_SUFFIX=debug || export VERSION_SUFFIX=release
export VERSION=${{ github.event.inputs.image_version }}-$VERSION_SUFFIX
echo "Version $VERSION"
export RELEASE=true
bash ./scripts/build_and_publish.sh
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/functional-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

jobs:
functional-tests:
name: Functional tests
name: Functional tests for ${{ inputs.version }}
runs-on: ubuntu-20.04
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
Expand Down Expand Up @@ -87,11 +87,12 @@
if: ${{ always() }}
continue-on-error: true
with:
name: debug
name: debug-${{ inputs.version }}
path: |
skaled_providers
!skaled_providers/**/skaled
/tmp/tmp*
/tmp/*log
*.log
./integration_tests/skaled/internals/third_party/skale-node-tests/btrfs
!**/.env
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,15 +221,15 @@ jobs:

functional-tests:
uses: ./.github/workflows/functional-tests.yml
name: Functional testing for build
name: Functional testing for orig build
needs: [build]
with:
version: ${{ needs.build.outputs.version_orig }}
secrets: inherit

functional-tests-historic:
uses: ./.github/workflows/functional-tests.yml
name: Functional testing for build
name: Functional testing for historic build
needs: [build]
with:
version: ${{ needs.build.outputs.version_historic }}
Expand Down
2 changes: 2 additions & 0 deletions libethereum/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ class Client : public ClientBase, protected Worker {
/// Retrieve pending transactions
Transactions pending() const override;

Transactions debugGetFutureTransactions() const { return m_tq.debugGetFutureTransactions(); }

/// Queues a block for import.
ImportResult queueBlock( bytes const& _block, bool _isSafe = false );

Expand Down
11 changes: 11 additions & 0 deletions libethereum/TransactionQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,3 +537,14 @@ void TransactionQueue::verifierBody() {
MICROPROFILE_LEAVE();
}
}

Transactions TransactionQueue::debugGetFutureTransactions() const {
Transactions res;
ReadGuard l( m_lock );
for ( auto addressAndMap : m_future ) {
for ( auto nonceAndTransaction : addressAndMap.second ) {
res.push_back( nonceAndTransaction.second.transaction );
} // for nonce
} // for address
return res;
}
2 changes: 2 additions & 0 deletions libethereum/TransactionQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ class TransactionQueue {
template < class... Args >
Transactions topTransactionsSync( unsigned _limit, Args... args );

Transactions debugGetFutureTransactions() const;

/// Get a hash set of transactions in the queue
/// @returns A hash set of all transactions in the queue
const h256Hash knownTransactions() const;
Expand Down
7 changes: 7 additions & 0 deletions libweb3jsonrpc/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,10 @@ uint64_t Debug::debug_doBlocksDbCompaction() {

return boost::chrono::duration_cast< boost::chrono::milliseconds >( t2 - t1 ).count();
}

Json::Value Debug::debug_getFutureTransactions() {
auto res = toJson( m_eth.debugGetFutureTransactions() );
for ( auto& t : res )
t.removeMember( "data" );
return res;
}
2 changes: 2 additions & 0 deletions libweb3jsonrpc/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class Debug : public DebugFace {
virtual uint64_t debug_doStateDbCompaction() override;
virtual uint64_t debug_doBlocksDbCompaction() override;

virtual Json::Value debug_getFutureTransactions() override;

private:
eth::Client const& m_eth;
SkaleDebugInterface* m_debugInterface = nullptr;
Expand Down
10 changes: 10 additions & 0 deletions libweb3jsonrpc/DebugFace.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class DebugFace : public ServerInterface< DebugFace > {
this->bindAndAddMethod( jsonrpc::Procedure( "debug_doBlocksDbCompaction",
jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL ),
&dev::rpc::DebugFace::debug_doBlocksDbCompactionI );

this->bindAndAddMethod( jsonrpc::Procedure( "debug_getFutureTransactions",
jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_STRING, NULL ),
&dev::rpc::DebugFace::debug_getFutureTransactionsI );
}
inline virtual void debug_accountRangeAtI( const Json::Value& request, Json::Value& response ) {
response = this->debug_accountRangeAt( request[0u].asString(), request[1u].asInt(),
Expand Down Expand Up @@ -179,6 +183,10 @@ class DebugFace : public ServerInterface< DebugFace > {
response = this->debug_doBlocksDbCompaction();
}

virtual void debug_getFutureTransactionsI( const Json::Value&, Json::Value& response ) {
response = this->debug_getFutureTransactions();
}

virtual Json::Value debug_accountRangeAt(
const std::string& param1, int param2, const std::string& param3, int param4 ) = 0;
virtual Json::Value debug_traceTransaction(
Expand Down Expand Up @@ -206,6 +214,8 @@ class DebugFace : public ServerInterface< DebugFace > {

virtual uint64_t debug_doStateDbCompaction() = 0;
virtual uint64_t debug_doBlocksDbCompaction() = 0;

virtual Json::Value debug_getFutureTransactions() = 0;
};

} // namespace rpc
Expand Down
10 changes: 10 additions & 0 deletions test/unittests/libweb3jsonrpc/WebThreeStubClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1344,3 +1344,13 @@ Json::Value WebThreeStubClient::debug_doBlocksDbCompaction() {
throw jsonrpc::JsonRpcException(
jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString() );
}

Json::Value WebThreeStubClient::debug_getFutureTransactions() {
Json::Value p;
Json::Value result = this->CallMethod( "debug_getFutureTransactions", p );
if ( result.isArray() )
return result;
else
throw jsonrpc::JsonRpcException(
jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString() );
}
1 change: 1 addition & 0 deletions test/unittests/libweb3jsonrpc/WebThreeStubClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class WebThreeStubClient : public jsonrpc::Client {
const Json::Value& param3 ) noexcept( false );
Json::Value debug_doStateDbCompaction() noexcept( false );
Json::Value debug_doBlocksDbCompaction() noexcept( false );
Json::Value debug_getFutureTransactions() noexcept( false );
};

#endif // JSONRPC_CPP_STUB_WEBTHREESTUBCLIENT_H_
17 changes: 17 additions & 0 deletions test/unittests/libweb3jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2954,23 +2954,40 @@ BOOST_AUTO_TEST_CASE( mtm_import_future_txs ) {
BOOST_REQUIRE( h1 );
BOOST_REQUIRE_EQUAL( tq->futureSize(), 1);

Json::Value call = fixture.rpcClient->debug_getFutureTransactions();
BOOST_REQUIRE_EQUAL( call.size(), 1);

h256 h2 = fixture.client->importTransaction( tx3 );
BOOST_REQUIRE( h2 );
BOOST_REQUIRE_EQUAL( tq->futureSize(), 2);

call = fixture.rpcClient->debug_getFutureTransactions();
BOOST_REQUIRE_EQUAL( call.size(), 2);
BOOST_REQUIRE_EQUAL( call[0]["from"], string("0x")+txJson["from"].asString() );

h256 h3 = fixture.client->importTransaction( tx2 );
BOOST_REQUIRE( h3 );
BOOST_REQUIRE_EQUAL( tq->futureSize(), 3);

call = fixture.rpcClient->debug_getFutureTransactions();
BOOST_REQUIRE_EQUAL( call.size(), 3);

h256 h4 = fixture.client->importTransaction( tx1 );
BOOST_REQUIRE( h4 );
BOOST_REQUIRE_EQUAL( tq->futureSize(), 1);
BOOST_REQUIRE_EQUAL( tq->status().current, 3);

call = fixture.rpcClient->debug_getFutureTransactions();
BOOST_REQUIRE_EQUAL( call.size(), 1);

h256 h5 = fixture.client->importTransaction( tx4 );
BOOST_REQUIRE( h5 );
BOOST_REQUIRE_EQUAL( tq->futureSize(), 0);
BOOST_REQUIRE_EQUAL( tq->status().current, 5);

call = fixture.rpcClient->debug_getFutureTransactions();
BOOST_REQUIRE_EQUAL( call.size(), 0);

fixture.client->skaleHost()->pauseConsensus( false );
}

Expand Down

0 comments on commit 6061db7

Please sign in to comment.