Files
Matt Hess 733ecd2681 Migrate all JS tests to Rust: 9-crate workspace, 703 tests, 0 JS remaining
Add root Cargo workspace with 9 crates: salvium-crypto (extended),
  salvium-types, salvium-consensus, salvium-wallet, salvium-tx,
  salvium-rpc, salvium-miner (extended), salvium-cli, salvium-multisig.

  New modules: chain_state, block_weight, alt_chain, validation,
  offline signing, stake lifecycle, wallet sync/query/encryption/utxo,
  randomx utilities, and full multisig crate with CARROT support.

  Delete 188 JS test/helper/debug files; archive integration test
  scripts to test/legacy-js/ for live testnet use. Testnet integration
  tests (transfer, stake, burn, convert, sweep) remain as #[ignore]-
  gated Rust tests runnable with --ignored against a live daemon.
2026-02-17 23:09:35 +00:00

51 lines
1.6 KiB
JavaScript

#!/usr/bin/env bun
// Find the transaction that causes memory explosion
import { createDaemonRPC } from '../src/rpc/index.js';
import { parseTransaction } from '../src/transaction.js';
import { hexToBytes } from '../src/address.js';
const daemon = createDaemonRPC({ url: 'http://seed01.salvium.io:19081', timeout: 30000 });
async function test() {
console.log('=== Finding problematic transaction ===\n');
// Start around where it blew up
for (let height = 940; height < 1050; height++) {
const block = await daemon.getBlock({ height });
const txHashes = block.result?.tx_hashes || [];
if (txHashes.length === 0) continue;
const txsResp = await daemon.getTransactions(txHashes, { decode_as_json: true });
const txs = txsResp.result?.txs || [];
for (const txData of txs) {
const beforeMem = process.memoryUsage().heapUsed;
try {
const txBytes = hexToBytes(txData.as_hex);
console.log(`Height ${height}, tx ${txData.tx_hash.slice(0,16)}..., size: ${txBytes.length} bytes`);
const tx = parseTransaction(txBytes);
const afterMem = process.memoryUsage().heapUsed;
const memDiff = Math.round((afterMem - beforeMem) / 1024 / 1024);
if (memDiff > 10) {
console.log(` WARNING: Memory grew by ${memDiff} MB!`);
console.log(` RCT type: ${tx.rct?.type}`);
console.log(` Outputs: ${tx.prefix?.vout?.length}`);
console.log(` Inputs: ${tx.prefix?.vin?.length}`);
}
} catch (e) {
console.log(` ERROR: ${e.message}`);
}
}
}
console.log('\nDone');
}
test().catch(console.error);