Skip to content

Commit

Permalink
Updated tests post-fork
Browse files Browse the repository at this point in the history
  • Loading branch information
SChernykh committed Oct 13, 2024
1 parent 61bb862 commit c88f126
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 488 deletions.
428 changes: 0 additions & 428 deletions .github/workflows/test-sync-old.yml

This file was deleted.

37 changes: 8 additions & 29 deletions .github/workflows/test-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
pull_request:

schedule:
- cron: '17 0/3 * * *'
- cron: '47 0/3 * * *'

jobs:
sync-test-ubuntu-tsan:
Expand Down Expand Up @@ -67,11 +67,8 @@ jobs:
python ../tests/src/stratum_dummy.py 1 &
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
python ../tests/src/mm_server.py 8000 id0 data0 &
python ../tests/src/mm_server.py 8001 id1 data1 &
python ../tests/src/mm_server.py 8002 id2 data2 &
sudo sysctl vm.mmap_rnd_bits=28
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1" ./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
TSAN_OPTIONS="suppressions=../tests/src/tsan_sup.txt halt_on_error=1" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
Expand Down Expand Up @@ -156,11 +153,8 @@ jobs:
python ../tests/src/stratum_dummy.py 1 &
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
python ../tests/src/mm_server.py 8000 id0 data0 &
python ../tests/src/mm_server.py 8001 id1 data1 &
python ../tests/src/mm_server.py 8002 id2 data2 &
sudo sysctl vm.mmap_rnd_bits=28
MSAN_OPTIONS="halt_on_error=1" ./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
MSAN_OPTIONS="halt_on_error=1" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
Expand Down Expand Up @@ -206,11 +200,8 @@ jobs:
python ../tests/src/stratum_dummy.py 1 &
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
python ../tests/src/mm_server.py 8000 id0 data0 &
python ../tests/src/mm_server.py 8001 id1 data1 &
python ../tests/src/mm_server.py 8002 id2 data2 &
sudo sysctl vm.mmap_rnd_bits=28
UBSAN_OPTIONS="suppressions=../tests/src/ubsan_sup.txt halt_on_error=1" ./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
UBSAN_OPTIONS="suppressions=../tests/src/ubsan_sup.txt halt_on_error=1" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
Expand Down Expand Up @@ -256,11 +247,8 @@ jobs:
python ../tests/src/stratum_dummy.py 1 &
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
python ../tests/src/mm_server.py 8000 id0 data0 &
python ../tests/src/mm_server.py 8001 id1 data1 &
python ../tests/src/mm_server.py 8002 id2 data2 &
sudo sysctl vm.mmap_rnd_bits=28
ASAN_OPTIONS="detect_stack_use_after_return=1 atexit=1" ./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
ASAN_OPTIONS="detect_stack_use_after_return=1 atexit=1" ./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
Expand Down Expand Up @@ -334,10 +322,7 @@ jobs:
python3 ../tests/src/stratum_dummy.py 1 &
python3 ../tests/src/stratum_dummy.py 2 &
python3 ../tests/src/stratum_dummy.py 3 &
python3 ../tests/src/mm_server.py 8000 id0 data0 &
python3 ../tests/src/mm_server.py 8001 id1 data1 &
python3 ../tests/src/mm_server.py 8002 id2 data2 &
./p2pool ${{ secrets.TESTNET_NODE_PARAMS }} --config ../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
./p2pool --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
Expand Down Expand Up @@ -382,10 +367,7 @@ jobs:
start python ../../tests/src/stratum_dummy.py 1
start python ../../tests/src/stratum_dummy.py 2
start python ../../tests/src/stratum_dummy.py 3
start python ../../tests/src/mm_server.py 8000 id0 data0 &
start python ../../tests/src/mm_server.py 8001 id1 data1 &
start python ../../tests/src/mm_server.py 8002 id2 data2 &
p2pool.exe ${{ secrets.TESTNET_NODE_PARAMS }} --config ../../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
p2pool.exe --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
Expand Down Expand Up @@ -428,10 +410,7 @@ jobs:
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 1"
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 2"
Start-Process python -ArgumentList "../../tests/src/stratum_dummy.py 3"
Start-Process python -ArgumentList "../../tests/src/mm_server.py 8000 id0 data0"
Start-Process python -ArgumentList "../../tests/src/mm_server.py 8001 id1 data1"
Start-Process python -ArgumentList "../../tests/src/mm_server.py 8002 id2 data2"
./p2pool.exe ${{ secrets.TESTNET_NODE_PARAMS }} --config ../../tests/src/mm_test_config.json --wallet 9y9HUSpSZX7j2J5UUngX5nCRezR6mZfLmL2D5JXpmPjYVDCPCCcw6Tab2R55xqPTN2FoQEEDmz99TVdy9EW74mqMUw5xRun --data-api data --local-api --merge-mine 127.0.0.1:8000 test0 --merge-mine 127.0.0.1:8001 test1 --merge-mine 127.0.0.1:8002 test2 --loglevel 6
./p2pool.exe --host xmr.support --rpc-port 18081 --zmq-port 18083 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg --mini --out-peers 200 --data-api data --local-api --loglevel 6
- name: Check p2pool.log
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/pool_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ hash PoolBlock::calculate_tx_key_seed() const
bool PoolBlock::merge_mining_enabled() const
{
#ifdef P2POOL_UNIT_TESTS
return false;
return true;
#else
switch (SideChain::network_type()) {
case NetworkType::Mainnet:
Expand Down
Binary file modified tests/src/block.dat
Binary file not shown.
8 changes: 4 additions & 4 deletions tests/src/block_template_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ TEST(block_template, update)
tpl.update(data, mempool, &wallet);

const PoolBlock* b = tpl.pool_block_template();
ASSERT_EQ(b->m_sidechainId, H("0355a4eeb586ab4d30f3ba89f0ebf7ac1c34a55aebf1bee50af04ff893330280"));
ASSERT_EQ(b->m_sidechainId, H("2c90c1926a75c81afd49bf4a4b63e9de7b4c153866411c47e7af864b547c23ec"));

std::vector<uint8_t> blobs;
uint64_t height;
Expand All @@ -79,7 +79,7 @@ TEST(block_template, update)

hash blobs_hash;
keccak(blobs.data(), static_cast<int>(blobs.size()), blobs_hash.h);
ASSERT_EQ(blobs_hash, H("70ee1661794c9a55f006432b57b0fc37922e0ccf8f1e4294b43890f8a6f44c62"));
ASSERT_EQ(blobs_hash, H("c043b754d043b4f6fe3f70273a937c77ff75a5afba9a6ca92776e79da28a1165"));

// Test 2: mempool with high fee and low fee transactions, it must choose high fee transactions
for (uint64_t i = 0; i < 512; ++i) {
Expand All @@ -92,7 +92,7 @@ TEST(block_template, update)

tpl.update(data, mempool, &wallet);

ASSERT_EQ(b->m_sidechainId, H("272a7eea0b804cf24427528977d221850d0ee06c26e935219a75f180cfbfc7f3"));
ASSERT_EQ(b->m_sidechainId, H("c9df4853003ab436416b9fc9a5a072d16b4dede849e697a8be2ebb9c88c8ec72"));
ASSERT_EQ(b->m_transactions.size(), 203);

for (size_t i = 1; i < b->m_transactions.size(); ++i) {
Expand All @@ -109,7 +109,7 @@ TEST(block_template, update)
ASSERT_EQ(template_id, 2U);

keccak(blobs.data(), static_cast<int>(blobs.size()), blobs_hash.h);
ASSERT_EQ(blobs_hash, H("c74d295a9cb7e808030284e2169a6f05b685a11c6c577a774d5eb8fad175d5cd"));
ASSERT_EQ(blobs_hash, H("f00e196216d160a4fcbf468f748205039d276d62edfa6c6fd4c81dbd1f62d9b7"));

destroy_crypto_cache();
}
Expand Down
8 changes: 0 additions & 8 deletions tests/src/mm_test_config.json

This file was deleted.

36 changes: 18 additions & 18 deletions tests/src/pool_block_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,26 @@ TEST(pool_block, deserialize)
int outputs_offset, outputs_blob_size;
const std::vector<uint8_t> mainchain_data = b.serialize_mainchain_data(&header_size, &miner_tx_size, &outputs_offset, &outputs_blob_size);

ASSERT_EQ(mainchain_data.size(), 1757U);
ASSERT_EQ(mainchain_data.size(), 1829U);
ASSERT_EQ(header_size, 43U);
ASSERT_EQ(miner_tx_size, 1457U);
ASSERT_EQ(miner_tx_size, 1145U);
ASSERT_EQ(outputs_offset, 54);
ASSERT_EQ(outputs_blob_size, 1371);
ASSERT_EQ(outputs_blob_size, 1058);

ASSERT_EQ(b.m_majorVersion, 16U);
ASSERT_EQ(b.m_minorVersion, 16U);
ASSERT_EQ(b.m_timestamp, 1679221824U);
ASSERT_EQ(b.m_nonce, 1247U);
ASSERT_EQ(b.m_txinGenHeight, 2845298U);
ASSERT_EQ(b.m_outputs.size(), 35U);
ASSERT_EQ(b.m_timestamp, 1728813765U);
ASSERT_EQ(b.m_nonce, 352454720U);
ASSERT_EQ(b.m_txinGenHeight, 3258099U);
ASSERT_EQ(b.m_outputs.size(), 27U);
ASSERT_EQ(b.m_extraNonceSize, 4U);
ASSERT_EQ(b.m_extraNonce, 1482827308U);
ASSERT_EQ(b.m_transactions.size(), 9U);
ASSERT_EQ(b.m_extraNonce, 2983923783U);
ASSERT_EQ(b.m_transactions.size(), 21U);
ASSERT_EQ(b.m_uncles.size(), 0U);
ASSERT_EQ(b.m_sidechainHeight, 4674483U);
ASSERT_EQ(b.m_difficulty.lo, 1854596983U);
ASSERT_EQ(b.m_sidechainHeight, 9443384U);
ASSERT_EQ(b.m_difficulty.lo, 1828732004U);
ASSERT_EQ(b.m_difficulty.hi, 0U);
ASSERT_EQ(b.m_cumulativeDifficulty.lo, 7172845253120126ull);
ASSERT_EQ(b.m_cumulativeDifficulty.lo, 15051095864465561ull);
ASSERT_EQ(b.m_cumulativeDifficulty.hi, 0U);
ASSERT_EQ(b.m_depth, 0U);
ASSERT_EQ(b.m_verified, false);
Expand All @@ -87,7 +87,7 @@ TEST(pool_block, deserialize)
hash seed;
{
std::stringstream s;
s << "6fc9c4a55eb513eb31955c084d9342e0082987f9e42da042449b7c9001176d3a";
s << "bf513dbe52c22b09e65edae222ec902d6adb75585a0141b81a165f0fb0c9c0bc";
s >> seed;
}

Expand All @@ -99,7 +99,7 @@ TEST(pool_block, deserialize)

std::stringstream s;
s << pow_hash;
ASSERT_EQ(s.str(), "aa7a3c4a2d67cb6a728e244288219bf038024f3b511b0da197a19ec601000000");
ASSERT_EQ(s.str(), "0906c001cc0900098fe1b62593f8ba52bd1ae2a0806096aa361a9f1702000000");

ASSERT_EQ(b.m_difficulty.check_pow(pow_hash), true);

Expand All @@ -118,16 +118,16 @@ TEST(pool_block, verify)
uint64_t m_sidechainHeight;
bool m_shuffle;
} tests[2] = {
{ "default", "sidechain_dump.dat", 2870010, 4957203, true },
{ "mini", "sidechain_dump_mini.dat", 2870010, 4414446, false },
{ "default", "sidechain_dump.dat", 3258121, 9443762, true },
{ "mini", "sidechain_dump_mini.dat", 3258121, 8912067, false },
};

for (const STest& t : tests)
{
SideChain sidechain(nullptr, NetworkType::Mainnet, t.m_poolName);

// Difficulty of block 2869248
sidechain.m_testMainChainDiff = difficulty_type(345786476185ULL, 0ULL);
// Difficulty of block 3256320
sidechain.m_testMainChainDiff = difficulty_type(374140388237ULL, 0ULL);

std::ifstream f(t.m_fileName, std::ios::binary | std::ios::ate);
ASSERT_EQ(f.good() && f.is_open(), true);
Expand Down
Binary file modified tests/src/sidechain_dump.dat.gz
Binary file not shown.
Binary file modified tests/src/sidechain_dump_mini.dat.gz
Binary file not shown.

0 comments on commit c88f126

Please sign in to comment.