Skip to content

Commit

Permalink
Merge pull request #1478 from skalenetwork/1477-reenable-unit-tests-i…
Browse files Browse the repository at this point in the history
…n-skaled

add missing tests to github pipeline
  • Loading branch information
DmytroNazarenko authored Mar 25, 2023
2 parents c00c0c6 + 772804e commit c4cb05e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 12 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,17 @@ jobs:
export NO_ULIMIT_CHECK=1
# we specifically run each test for easier log review
./testeth -t BlockchainTests -- --express && touch /tmp/BlockchainTestsPassed
./testeth -t TransitionTests -- --express && touch /tmp/TransitionTestsPassed
./testeth -t TransactionTests -- --express && touch /tmp/TransactionTestsPassed
./testeth -t VMTests -- --express && touch /tmp/VMTestsPassed
./testeth -t LevelDBTests -- --express && touch /tmp/LevelDBTestsPassed
./testeth -t CoreLibTests -- --express && touch /tmp/CoreLibTestsPassed
./testeth -t RlpTests -- --express && touch /tmp/RlpTestsPassed
./testeth -t SharedSpaceTests -- --express && touch /tmp/SharedSpaceTestsPassed
./testeth -t SealEngineTests -- --express && touch /tmp/SealEngineTestsPassed
./testeth -t EthashTests -- --express && touch /tmp/EthashTestsPassed
./testeth -t SealEngineTests -- --express && touch /tmp/SealEngineTestsPassed
./testeth -t DifficultyTests -- --express && touch /tmp/DifficultyTestsPassed
./testeth -t BlockSuite -- --express && touch /tmp/BlockSuitePassed
./testeth -t BlockChainMainNetworkSuite -- --express && touch /tmp/BlockChainMainNetworkSuitePassed
./testeth -t BlockChainFrontierSuite -- --express && touch /tmp/BlockChainFrontierSuitePassed
./testeth -t BlockQueueSuite -- --express && touch /tmp/BlockQueueSuitePassed
Expand Down Expand Up @@ -198,6 +204,9 @@ jobs:
./testeth -t JsonRpcSuite -- --express && touch /tmp/JsonRpcSuitePassed
./testeth -t SingleConsensusTests -- --express && touch /tmp/SingleConsensusTestsPassed
./testeth -t ConsensusTests -- --express && touch /tmp/ConsensusTestsPassed
sudo ./testeth -t BtrfsTestSuite -- --all && touch /tmp/BtrfsTestSuitePassed
sudo ./testeth -t HashSnapshotTestSuite -- --all && touch /tmp/HashSnapshotTestSuitePassed
sudo ./testeth -t ClientSnapshotsSuite -- --all && touch /tmp/ClientSnapshotsSuitePassed
cd ..
- name: Testeth verbosity 4
run : |
Expand All @@ -206,11 +215,17 @@ jobs:
export NO_NTP_CHECK=1
export NO_ULIMIT_CHECK=1
ls /tmp/BlockchainTestsPassed || ./testeth -t BlockchainTests -- --express --verbosity 4
ls /tmp/TransitionTestsPassed || ./testeth -t TransitionTests -- --express --verbosity 4
ls /tmp/TransactionTestsPassed || ./testeth -t TransactionTests -- --express --verbosity 4
ls /tmp/VMTestsPassed || ./testeth -t VMTests -- --express --verbosity 4
ls /tmp/LevelDBTestsPassed || ./testeth -t LevelDBTests -- --express --verbosity 4
ls /tmp/CoreLibTestsPassed || ./testeth -t CoreLibTests -- --express --verbosity 4
ls /tmp/RlpTestsPassed || ./testeth -t RlpTests -- --express --verbosity 4
ls /tmp/SharedSpaceTestsPassed || ./testeth -t SharedSpaceTests -- --express --verbosity 4
ls /tmp/EthashTestsPassed || ./testeth -t EthashTests -- --express --verbosity 4
ls /tmp/SealEngineTestsPassed || ./testeth -t SealEngineTests -- --express --verbosity 4
ls /tmp/DifficultyTestsPassed || ./testeth -t DifficultyTests -- --express --verbosity 4
ls /tmp/BlockSuitePassed || ./testeth -t BlockSuite -- --express --verbosity 4
ls /tmp/BlockChainMainNetworkSuitePassed || ./testeth -t BlockChainMainNetworkSuite -- --express --verbosity 4
ls /tmp/BlockChainFrontierSuitePassed || ./testeth -t BlockChainFrontierSuite -- --express --verbosity 4
ls /tmp/BlockQueueSuitePassed || ./testeth -t BlockQueueSuite -- --express --verbosity 4
Expand Down Expand Up @@ -239,7 +254,10 @@ jobs:
ls /tmp/ClientTestsPassed || ./testeth -t ClientTests -- --express --verbosity 4
ls /tmp/JsonRpcSuitePassed || ./testeth -t JsonRpcSuite -- --express --verbosity 4
ls /tmp/SingleConsensusTestsPassed || ./testeth -t SingleConsensusTests -- --express --verbosity 4
ls /tmp/ConsensusTestsPassed || ./testeth -t ConsensusTests -- --express --verbosity 4
ls /tmp/ConsensusTestsPassed || ./testeth -t ConsensusTests -- --express --verbosity 4
ls /tmp/BtrfsTestSuitePassed || sudo NO_ULIMIT_CHECK=1 NO_NTP_CHECK=1 ./testeth -t BtrfsTestSuite -- --all --verbosity 4
ls /tmp/HashSnapshotTestSuitePassed || sudo NO_ULIMIT_CHECK=1 NO_NTP_CHECK=1 ./testeth -t HashSnapshotTestSuite -- --all --verbosity 4
ls /tmp/ClientSnapshotsSuitePassed || sudo NO_ULIMIT_CHECK=1 NO_NTP_CHECK=1 ./testeth -t ClientSnapshotsSuite -- --all --verbosity 4
cd ..
- name: Configure all as historic
run: |
Expand Down
1 change: 0 additions & 1 deletion libskale/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,6 @@ void State::rollback( size_t _savepoint ) {
}
m_changeLog.pop_back();
}
resetStorageChanges();
clearFileStorageCache();
if ( !ContractStorageLimitPatch::isEnabled() ) {
resetStorageChanges();
Expand Down
1 change: 1 addition & 0 deletions test/unittests/libweb3jsonrpc/genesisGeneration2Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ static std::string const c_genesisGeneration2ConfigString = R"(
"maxSkaledLeveldbStorageBytes": 178124851,
"maxFileStorageBytes": 178124851,
"maxReservedStorageBytes": 59374950,
"contractStoragePatchTimestamp": 1000,
"nodes": [
{
"nodeID": 8,
Expand Down
22 changes: 13 additions & 9 deletions test/unittests/libweb3jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ struct JsonRpcFixture : public TestOutputHelperFixture {
chainParams.sChain.contractStorageLimit = 128;
// 615 + 1430 is experimentally-derived block size + average extras size
chainParams.sChain.dbStorageLimit = 320.5*( 615 + 1430 );
chainParams.sChain.contractStoragePatchTimestamp = 1;
// add random extra data to randomize genesis hash and get random DB path,
// so that tests can be run in parallel
// TODO: better make it use ethemeral in-memory databases
Expand Down Expand Up @@ -2128,8 +2129,8 @@ BOOST_AUTO_TEST_CASE( storage_limit_predeployed ) {
}

BOOST_AUTO_TEST_CASE( storage_limit_reverted ) {
JsonRpcFixture fixture(c_genesisGeneration2ConfigString, false, false, true);
dev::eth::simulateMining( *( fixture.client ), 20 );
JsonRpcFixture fixture;
dev::eth::simulateMining( *( fixture.client ), 1000 );
// pragma solidity >=0.7.0 <0.9.0;

// contract Storage {
Expand All @@ -2144,8 +2145,7 @@ BOOST_AUTO_TEST_CASE( storage_limit_reverted ) {
// number[pos] = num;
// }
// }
std::string bytecode1 = "0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80636ed28ed014602d575b600080fd5b60436004803603810190603f91906073565b6045565b005b81600082600a8110605757605660b6565b5b01819055505050565b600081359050606d8160ea565b92915050565b60008060408385031215608757608660e5565b5b60006093858286016060565b925050602060a2858286016060565b9150509250929050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b60f18160ac565b811460fb57600080fd5b5056fea26469706673582212203b42d42b2182c89dc90a1a6915f146e26a17044c5ed6065f87bf2e6c594ef52264736f6c63430008070033";

std::string bytecode1 = "0x608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80636ed28ed014602d575b600080fd5b60436004803603810190603f91906096565b6045565b005b81600082600a8110605757605660cf565b5b01819055505050565b600080fd5b6000819050919050565b6076816065565b8114608057600080fd5b50565b600081359050609081606f565b92915050565b6000806040838503121560aa5760a96060565b5b600060b6858286016083565b925050602060c5858286016083565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea2646970667358221220ec8739ad7fc74a76053c683510b3c836d01c7eda3687d89e65380260a97e741b64736f6c63430008120033";
auto senderAddress = fixture.coinbase.address();

Json::Value create1;
Expand All @@ -2156,6 +2156,7 @@ BOOST_AUTO_TEST_CASE( storage_limit_reverted ) {
dev::eth::mineTransaction( *( fixture.client ), 1 );

Json::Value receipt1 = fixture.rpcClient->eth_getTransactionReceipt( txHash );
BOOST_REQUIRE( receipt1["status"] == string( "0x1" ) );
string contractAddress1 = receipt1["contractAddress"].asString();

// contract CallTry {
Expand All @@ -2181,14 +2182,13 @@ BOOST_AUTO_TEST_CASE( storage_limit_reverted ) {
// emit Message(string(abi.encodePacked(errorCode)));
// } catch (bytes memory revertData) {
// emit Message(string(revertData));
// }
// }contractAddress1
// count = 0;
// success = false;
// }
// }

std::string bytecode2 = "0x608060405234801561001057600080fd5b506040516106e63803806106e68339818101604052810190610032919061008e565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610109565b600081519050610088816100f2565b92915050565b6000602082840312156100a4576100a36100ed565b5b60006100b284828501610079565b91505092915050565b60006100c6826100cd565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600080fd5b6100fb816100bb565b811461010657600080fd5b50565b6105ce806101186000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c18829ca14610030575b600080fd5b61003861003a565b005b6001808190555060016000806101000a81548160ff021916908315150217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636ed28ed0600a806040518363ffffffff1660e01b81526004016100b992919061032e565b600060405180830381600087803b1580156100d357600080fd5b505af19250505080156100e4575060015b610237576100f0610478565b806308c379a0141561014d57506101056104e1565b8061011057506101c7565b7f51a7f65c6325882f237d4aeb43228179cfad48b868511d508e24b4437a8191378160405161013f9190610357565b60405180910390a150610232565b634e487b7114156101c757610160610577565b9061016b57506101c7565b7f51a7f65c6325882f237d4aeb43228179cfad48b868511d508e24b4437a8191378160405160200161019d9190610313565b6040516020818303038152906040526040516101b99190610357565b60405180910390a150610232565b3d80600081146101f3576040519150601f19603f3d011682016040523d82523d6000602084013e6101f8565b606091505b507f51a7f65c6325882f237d4aeb43228179cfad48b868511d508e24b4437a819137816040516102289190610357565b60405180910390a1505b61026d565b7f51a7f65c6325882f237d4aeb43228179cfad48b868511d508e24b4437a81913760405161026490610379565b60405180910390a15b600060018190555060008060006101000a81548160ff021916908315150217905550565b61029a816103c9565b82525050565b60006102ab826103a3565b6102b581856103ae565b93506102c58185602086016103db565b6102ce8161049a565b840191505092915050565b60006102e66004836103ae565b91506102f1826104b8565b602082019050919050565b61030d610308826103bf565b61043f565b82525050565b600061031f82846102fc565b60208201915081905092915050565b60006040820190506103436000830185610291565b6103506020830184610291565b9392505050565b6000602082019050818103600083015261037181846102a0565b905092915050565b60006020820190508181036000830152610392816102d9565b9050919050565b6000604051905090565b600081519050919050565b600082825260208201905092915050565b6000819050919050565b60006103d4826103bf565b9050919050565b60005b838110156103f95780820151818401526020810190506103de565b83811115610408576000848401525b50505050565b6104178261049a565b810181811067ffffffffffffffff8211171561043657610435610449565b5b80604052505050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060033d11156104975760046000803e6104946000516104ab565b90505b90565b6000601f19601f8301169050919050565b60008160e01c9050919050565b7f7472756500000000000000000000000000000000000000000000000000000000600082015250565b600060443d10156104f157610574565b6104f9610399565b60043d036004823e80513d602482011167ffffffffffffffff82111715610521575050610574565b808201805167ffffffffffffffff81111561053f5750505050610574565b80602083010160043d03850181111561055c575050505050610574565b61056b8260200185018661040e565b82955050505050505b90565b60008060233d1115610594576020600460003e6001915060005190505b909156fea2646970667358221220c1e1f1cda95ad11b398904aa9f2ea1130273448970b48cb8408e69ed881cc59164736f6c634300080700330000000000000000000000004e35bc55e8f8d49d1e21b2bb99d325afd7c1c0a3";

std::string bytecode2 = "608060405234801561001057600080fd5b506040516106f93803806106f9833981810160405281019061003291906100dc565b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050610109565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a98261007e565b9050919050565b6100b98161009e565b81146100c457600080fd5b50565b6000815190506100d6816100b0565b92915050565b6000602082840312156100f2576100f1610079565b5b6000610100848285016100c7565b91505092915050565b6105e1806101186000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063c18829ca14610030575b600080fd5b61003861003a565b005b6001808190555060016000806101000a81548160ff021916908315150217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636ed28ed0600a806040518363ffffffff1660e01b81526004016100b99291906102de565b600060405180830381600087803b1580156100d357600080fd5b505af19250505080156100e4575060015b610235576100f0610314565b806308c379a00361014c57506101046103b1565b8061010f57506101c5565b7f51a7f65c6325882f237d4aeb43228179cfad48b868511d508e24b4437a8191378160405161013e91906104c0565b60405180910390a150610230565b634e487b71036101c55761015e6104e2565b9061016957506101c5565b7f51a7f65c6325882f237d4aeb43228179cfad48b868511d508e24b4437a8191378160405160200161019b9190610524565b6040516020818303038152906040526040516101b791906104c0565b60405180910390a150610230565b3d80600081146101f1576040519150601f19603f3d011682016040523d82523d6000602084013e6101f6565b606091505b507f51a7f65c6325882f237d4aeb43228179cfad48b868511d508e24b4437a8191378160405161022691906104c0565b60405180910390a1505b61026b565b7f51a7f65c6325882f237d4aeb43228179cfad48b868511d508e24b4437a8191376040516102629061058b565b60405180910390a15b600060018190555060008060006101000a81548160ff021916908315150217905550565b6000819050919050565b6000819050919050565b6000819050919050565b60006102c86102c36102be8461028f565b6102a3565b610299565b9050919050565b6102d8816102ad565b82525050565b60006040820190506102f360008301856102cf565b61030060208301846102cf565b9392505050565b60008160e01c9050919050565b600060033d11156103335760046000803e610330600051610307565b90505b90565b6000604051905090565b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61038982610340565b810181811067ffffffffffffffff821117156103a8576103a7610351565b5b80604052505050565b600060443d1061043e576103c3610336565b60043d036004823e80513d602482011167ffffffffffffffff821117156103eb57505061043e565b808201805167ffffffffffffffff811115610409575050505061043e565b80602083010160043d03850181111561042657505050505061043e565b61043582602001850186610380565b82955050505050505b90565b600081519050919050565b600082825260208201905092915050565b60005b8381101561047b578082015181840152602081019050610460565b60008484015250505050565b600061049282610441565b61049c818561044c565b93506104ac81856020860161045d565b6104b581610340565b840191505092915050565b600060208201905081810360008301526104da8184610487565b905092915050565b60008060233d11156104ff576020600460003e6001915060005190505b9091565b6000819050919050565b61051e61051982610299565b610503565b82525050565b6000610530828461050d565b60208201915081905092915050565b7f7472756500000000000000000000000000000000000000000000000000000000600082015250565b600061057560048361044c565b91506105808261053f565b602082019050919050565b600060208201905081810360008301526105a481610568565b905091905056fea26469706673582212201a522ad11a321603efd182e33e10b59f65b8c9a8b84c8ec3d832ff1d0b726cc564736f6c63430008120033" + std::string("000000000000000000000000") + contractAddress1.substr(2);
Json::Value create2;
create2["from"] = toJS( senderAddress );
create2["data"] = bytecode2;
Expand All @@ -2197,7 +2197,8 @@ BOOST_AUTO_TEST_CASE( storage_limit_reverted ) {
dev::eth::mineTransaction( *( fixture.client ), 1 );

Json::Value receipt2 = fixture.rpcClient->eth_getTransactionReceipt( txHash );
string contractAddress2 = receipt1["contractAddress"].asString();
BOOST_REQUIRE( receipt2["status"] == string( "0x1" ) );
string contractAddress2 = receipt2["contractAddress"].asString();

auto storageUsed = fixture.client->state().storageUsedTotal();

Expand All @@ -2208,8 +2209,11 @@ BOOST_AUTO_TEST_CASE( storage_limit_reverted ) {
txStoreTry["gasPrice"] = fixture.rpcClient->eth_gasPrice();
txHash = fixture.rpcClient->eth_sendTransaction( txStoreTry );
dev::eth::mineTransaction( *( fixture.client ), 1 );
std::cout << fixture.client->state().storageUsedTotal() << std::endl;
BOOST_REQUIRE( fixture.client->state().storageUsedTotal() == storageUsed );

Json::Value receipt = fixture.rpcClient->eth_getTransactionReceipt( txHash );
BOOST_REQUIRE( receipt["gasUsed"] != "0x0" );
BOOST_REQUIRE( receipt["status"] == string( "0x1" ) );
}

BOOST_AUTO_TEST_CASE( setSchainExitTime ) {
Expand Down

0 comments on commit c4cb05e

Please sign in to comment.