mirror of
https://github.com/datahaven-xyz/datahaven
synced 2026-05-24 09:50:01 +00:00
This PR restructures and port the block validation test suite from Moonbeam and add the necessary infrastructure for contract-based testing. ### Test Suites Added **Block Validation Suite 1** (`test-block-1.ts`) - *Refactored from original `test-block.ts`* - T01: Validates block number increments correctly after manual block creation - T02: Checks block timestamps are valid and within expected bounds - T03: Verifies complete block structure including gasLimit, difficulty, receiptsRoot, transactionsRoot, logsBloom, and other Ethereum-compatible fields - T04: Confirms blocks are retrievable by hash - T05: Confirms blocks are retrievable by number **Block Validation Suite 2** (`test-block-2.ts`) - *New* - T01: Verifies block number persistence across test cases - T02: Validates parent-child block hash linkage in the chain **Block Gas Limits Suite** (`test-block-gas.ts`) - *New* - T01-T06: Tests all three transaction types (legacy, eip1559, eip2930) can deploy contracts at max extrinsic gas limit, and correctly reject transactions exceeding that limit - T07: Deploys `BlockVariables` contract and verifies runtime gas limit is accessible from within contract execution **Block Genesis Suite** (`test-block-genesis.ts`) - *New* - T01: Validates genesis block (block 0) contains correct Ethereum-compatible structure and empty transaction/uncle lists - T02: Confirms genesis block is retrievable by hash ### Infrastructure Additions **Contract Deployment Helpers** - `fetchCompiledContract`: Loads compiled Solidity artifacts with ABI and bytecode from JSON output - `deployCompiledContract`: Handles contract deployment with support for legacy, EIP-1559, and EIP-2930 transaction types, including gas parameter configuration **Solidity Test Fixtures** - `BlockVariables.sol`: Exposes `block.gaslimit`, `block.chainid`, `block.number` via view functions for runtime validation - `Fibonacci.sol`: Provides `fib2(n)` pure function for computational gas testing - `MultiplyBy7.sol`: Minimal pure function contract for basic deployment testing **Enhanced Runtime Constants** - Added `EXTRINSIC_GAS_LIMIT` (52M), `BLOCK_WEIGHT_LIMIT` (2T), `MAX_POV_SIZE` (10MB) for all three environments - Constants derived from and documented against Rust runtime configuration in `operator/runtime/*/src/lib.rs` ### Dependencies - Added `solc@0.8.30` and supporting packages (`yargs`, `command-exists`, `js-sha3`, `memorystream`) for local Solidity compilation
55 lines
No EOL
1.3 KiB
JSON
55 lines
No EOL
1.3 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/Moonsong-Labs/moonwall/main/packages/types/config_schema.json",
|
|
"label": "DataHaven Tests 🔷",
|
|
"defaultTestTimeout": 180000,
|
|
"scriptsDir": "scripts/",
|
|
"environments": [
|
|
{
|
|
"name": "dev_datahaven",
|
|
"testFileDir": [
|
|
"suites/dev"
|
|
],
|
|
"include": [
|
|
"**/*test*.ts"
|
|
],
|
|
"timeout": 180000,
|
|
"multiThreads": 4,
|
|
"contracts": "contracts/",
|
|
"runScripts": [
|
|
"compile-contracts.sh compile"
|
|
],
|
|
"envVars": [
|
|
"DEBUG_COLORS=1",
|
|
"RUST_BACKTRACE=1",
|
|
"RUST_LOG=info"
|
|
],
|
|
"reporters": [
|
|
"basic",
|
|
"html",
|
|
"json"
|
|
],
|
|
"reportFile": {
|
|
"json": "./tmp/testResults.json"
|
|
},
|
|
"foundation": {
|
|
"type": "dev",
|
|
"launchSpec": [
|
|
{
|
|
"name": "datahaven",
|
|
"binPath": "../operator/target/release/datahaven-node",
|
|
"newRpcBehaviour": true,
|
|
"options": [
|
|
"--dev",
|
|
"--no-telemetry",
|
|
"--unsafe-force-node-key-generation",
|
|
"--reserved-only",
|
|
"--no-grandpa",
|
|
"--no-prometheus",
|
|
"--sealing=manual"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
]
|
|
} |