Update pool_block verify test for Salvium

- Add 200-block test data extracted from live cache
This commit is contained in:
Matt Hess
2025-11-14 10:41:38 +00:00
parent 3622b67989
commit c4d46fbd0b
3 changed files with 45 additions and 8 deletions

40
tests/extract_cache.cpp Normal file
View File

@@ -0,0 +1,40 @@
#include <fstream>
#include <iostream>
#include <vector>
#include <cstdint>
static constexpr uint32_t BLOCK_SIZE = 96 * 1024;
int main(int argc, char* argv[]) {
if (argc != 4) {
std::cerr << "Usage: " << argv[0] << " <cache_file> <output> <num_blocks>\n";
return 1;
}
std::ifstream in(argv[1], std::ios::binary);
std::ofstream out(argv[2], std::ios::binary);
int max_blocks = std::stoi(argv[3]);
std::vector<uint8_t> slot(BLOCK_SIZE);
int blocks_written = 0;
while (in && blocks_written < max_blocks) {
// Read 96KB slot
in.read(reinterpret_cast<char*>(slot.data()), BLOCK_SIZE);
if (!in) break;
// Read size from first 4 bytes
uint32_t size = *reinterpret_cast<uint32_t*>(slot.data());
// Skip empty slots
if (size == 0 || size > BLOCK_SIZE - 4) continue;
// Write: size + data
out.write(reinterpret_cast<char*>(&size), sizeof(size));
out.write(reinterpret_cast<char*>(slot.data() + 4), size);
blocks_written++;
}
std::cout << "Extracted " << blocks_written << " blocks\n";
return 0;
}

View File

@@ -151,14 +151,11 @@ TEST(pool_block, verify)
uint32_t m_expectedSharesNextBlock;
bool m_shuffle;
hash m_templateBlobsHash;
} tests[6] = {
{ "default", "sidechain_dump.dat", 3456189, 11704382, 53, false, H("c84a85eebf17ab266e8a81b347dd7490043ede3a055c0dbe85e9cd378905845a") },
{ "default", "sidechain_dump.dat", 3456189, 11704382, 53, true, H("c84a85eebf17ab266e8a81b347dd7490043ede3a055c0dbe85e9cd378905845a") },
{ "mini", "sidechain_dump_mini.dat", 3456189, 11207082, 578, false, H("08debd1378bae899017eb58362f4c638d78e5218558025142dcbc2651c76b27e") },
{ "mini", "sidechain_dump_mini.dat", 3456189, 11207082, 578, true, H("08debd1378bae899017eb58362f4c638d78e5218558025142dcbc2651c76b27e") },
{ "nano", "sidechain_dump_nano.dat", 3456189, 188542, 115, false, H("dd667c41eb15ffb0eb662065545dc0dfbbcac8393348a4fc0a7367040319b0d5") },
{ "nano", "sidechain_dump_nano.dat", 3456189, 188542, 115, true, H("dd667c41eb15ffb0eb662065545dc0dfbbcac8393348a4fc0a7367040319b0d5") },
};
} tests[] = {
// Salvium mainnet - 200 blocks from live cache
{ "salvium_main", "sidechain_dump.dat", 356800, 200, 200, false, H("0000000000000000000000000000000000000000000000000000000000000000") },
{ "salvium_main", "sidechain_dump.dat", 356800, 200, 200, true, H("0000000000000000000000000000000000000000000000000000000000000000") },
};
for (const STest& t : tests)
{

Binary file not shown.