Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ jobs:
strategy:
matrix:
node-version: [22.x]
name: ["transaction-pool-api"]
name: ["consensus", "transaction-pool-api"]

services:
postgres:
Expand Down
41 changes: 41 additions & 0 deletions packages/configuration-generator/bin/update-test-genesis-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,47 @@ const configurations = [
},
},

// Functional Tests
// tests/functional/consensus/config/
{
network: "devnet",
symbol: "TѦ",
token: "ARK",
distribute: true,
premine: "125000000000000000000000000",
chainId: 10000,
validators: 5,
initialHeight: 0,
overwriteConfig: true,
timeouts: {
blockPrepareTime: 100,
blockTime: 100,
stageTimeout: 100,
stageTimeoutIncrease: 100,
tolerance: 100,
},
postGenerate: (location) => {
// Functional tests run on single node
const __dirname = path.dirname(fileURLToPath(import.meta.url));

for (const file of ["crypto.json", "validators.json"]) {
const source = path.join(location, file);
const target = path.join(
__dirname,
"..",
"..",
"..",
"tests",
"functional",
"consensus",
"config",
file,
);
copyFileSync(source, target);
}
},
},

// E2E Consensus
// tests/e2e/consensus
{
Expand Down
28 changes: 23 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

644 changes: 322 additions & 322 deletions tests/functional/consensus/config/crypto.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions tests/functional/consensus/config/validators.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"secrets": [
"elbow arch deny once decide rule must rare share retire pizza decade coral repeat script result inject measure solve jealous license shallow scrub insane",
"unhappy exist basket lonely brick fiber coil galaxy bacon gossip attitude apology fee switch table stand despair moon gentle clerk escape adapt kid spirit",
"liquid debate broken vicious swear average resource maid slab modify false nest agent ordinary join rail area orient butter health head radio talk catch",
"bulb laundry project memory slender allow hockey staff reunion dinner travel worth age name extend wise source plastic scale ridge begin piano genuine dress",
"worth solid pet wink debris heavy erase debate immune smoke expand rail erupt eye brown recall foam fork minute execute imitate drum foam festival"
]
"secrets": [
"pyramid hybrid segment escape organ mountain health artefact blue copper vendor quality unknown patrol fatal gasp forward defy lazy bone stone drama ghost tomato",
"dolphin crumble vault under pencil foil next ocean shoe soul dove depend point clerk border icon upset feature enforce leisure current ketchup attitude mushroom",
"sell enhance antique actor behave click among nature hedgehog chest position coin hub convince grass clump dance letter rhythm organ rib flock ketchup drop",
"awake entry entire affair mention kind thunder rare next bleak spray flee sick person craft code cannon gaze mandate debris sketch acquire girl young",
"ensure victory nephew answer lab link similar where glue lottery place uncover bamboo shrug drama wedding depend destroy whale track cool caution planet horse"
]
}
13 changes: 10 additions & 3 deletions tests/functional/consensus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,41 @@
},
"devDependencies": {
"@mainsail/container": "workspace:*",
"@mainsail/contracts": "workspace:*",
"@mainsail/test-framework": "workspace:*",
"@mainsail/test-runner": "workspace:*",
"@mainsail/test-transaction-builders": "workspace:*",
"@mainsail/validation": "workspace:*",
"@mainsail/crypto-config": "workspace:*",
"@mainsail/crypto-validation": "workspace:*",
"@mainsail/crypto-hash-bcrypto": "workspace:*",
"@mainsail/crypto-signature-schnorr": "workspace:*",
"@mainsail/crypto-signature-ecdsa": "workspace:*",
"@mainsail/crypto-key-pair-ecdsa": "workspace:*",
"@mainsail/crypto-consensus-bls12-381": "workspace:*",
"@mainsail/crypto-address-base58": "workspace:*",
"@mainsail/crypto-address-keccak256": "workspace:*",
"@mainsail/crypto-consensus-bls12-381": "workspace:*",
"@mainsail/crypto-wif": "workspace:*",
"@mainsail/blockchain-utils": "workspace:*",
"@mainsail/serializer": "workspace:*",
"@mainsail/crypto-block": "workspace:*",
"@mainsail/logger-pino": "workspace:*",
"@mainsail/state": "workspace:*",
"@mainsail/database": "workspace:*",
"@mainsail/api-database": "workspace:*",
"@mainsail/api-sync": "workspace:*",
"@mainsail/evm-consensus": "workspace:*",
"@mainsail/evm-service": "workspace:*",
"@mainsail/evm-api-worker": "workspace:*",
"@mainsail/transactions": "workspace:*",
"@mainsail/transaction-pool-service": "workspace:*",
"@mainsail/transaction-pool-worker": "workspace:*",
"@mainsail/crypto-messages": "workspace:*",
"@mainsail/crypto-commit": "workspace:*",
"@mainsail/processor": "workspace:*",
"@mainsail/validator": "workspace:*",
"@mainsail/consensus-storage": "workspace:*",
"@mainsail/consensus": "workspace:*",
"@mainsail/kernel": "workspace:*",
"@mainsail/contracts": "workspace:*",
"@mainsail/crypto-transaction": "workspace:*",
"@mainsail/crypto-worker": "workspace:*",
"@mainsail/crypto-transaction-evm-call": "workspace:*",
Expand Down
5 changes: 2 additions & 3 deletions tests/functional/consensus/source/asserts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Exceptions } from "@mainsail/contracts";
import { interfaces } from "@mainsail/container";
import { Exceptions, Contracts } from "@mainsail/contracts";
import { Sandbox } from "@mainsail/test-framework";
import { assert } from "@mainsail/test-runner";

Expand Down Expand Up @@ -51,7 +50,7 @@ export const assertBlockHash = async (sandbox: Sandbox | Sandbox[], id?: string)
};

export const assertInvalidBlock = async (
exception: interfaces.Newable<Exceptions.Exception>,
exception: Contracts.Kernel.Container.Newable<Exceptions.Exception>,
sandbox: Sandbox | Sandbox[],
blockNumber: number,
round: number = 0,
Expand Down
10 changes: 5 additions & 5 deletions tests/functional/consensus/source/base.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, Sandbox } from "@mainsail/test-framework";

import crypto from "../config/crypto.json";
import validators from "../config/validators.json";
import { assertBlockHash, assertBockNumber } from "./asserts.js";
import crypto from "../config/crypto.json" with { type: "json" };
import validators from "../config/validators.json" with { type: "json" };
import { assertBlockHash, assertBlockNumber } from "./asserts.js";
import { P2PRegistry } from "./p2p.js";
import { bootMany, bootstrapMany, runMany, setup, stopMany } from "./setup.js";
import { getLastCommit, prepareNodeValidators, snoozeForBlock } from "./utilities.js";
Expand Down Expand Up @@ -37,7 +37,7 @@ describe<{

const commit = await getLastCommit(nodes[0]);

await assertBockNumber(nodes, 1);
await assertBlockNumber(nodes, 1);
await assertBlockHash(nodes, commit.block.data.hash);
});

Expand All @@ -46,7 +46,7 @@ describe<{

const commit = await getLastCommit(nodes[0]);

await assertBockNumber(nodes, 3);
await assertBlockNumber(nodes, 3);
await assertBlockHash(nodes, commit.block.data.hash);
});
});
45 changes: 0 additions & 45 deletions tests/functional/consensus/source/database.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tests/functional/consensus/source/p2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Messages<T extends Message> {
}

set(message: T): void {
this.getMessagesMap(message.height, message.round).set(message.serialized.toString("hex"), message);
this.getMessagesMap(message.blockNumber, message.round).set(message.serialized.toString("hex"), message);
}

getMessages(height: number, round: number): T[] {
Expand Down
Loading
Loading