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

35 lines
1.2 KiB
JavaScript

import { randomx_init_cache, randomx_create_vm, randomx_superscalarhash } from '../src/randomx/vendor/index.js';
const cache = randomx_init_cache('test');
console.log('Cache properties:');
console.log(' cache.memory type:', cache.memory.constructor.name);
console.log(' cache.memory buffer size:', cache.memory.buffer.byteLength);
console.log(' cache.thunk type:', cache.thunk.constructor.name);
console.log(' cache.vm type:', cache.vm.constructor.name);
// Create superscalar hash
const ssHash = randomx_superscalarhash(cache);
console.log('\nSuperscalar hash function created');
console.log(' ssHash type:', typeof ssHash);
// Test one item
const item0 = ssHash(0n);
console.log(' item[0]:', item0);
// Check WebAssembly module imports
console.log('\nWebAssembly module analysis:');
// Get imports for cache.vm
const vmImports = WebAssembly.Module.imports(cache.vm);
console.log('VM module imports:');
for (const imp of vmImports) {
console.log(' -', imp.module, '/', imp.name, ':', imp.kind);
}
// Get exports for cache.vm
const vmExports = WebAssembly.Module.exports(cache.vm);
console.log('\nVM module exports:');
for (const exp of vmExports) {
console.log(' -', exp.name, ':', exp.kind);
}