Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update cluster creation/bonding flow in tests #273

Merged
merged 1 commit into from
Oct 22, 2024
Merged
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
1 change: 1 addition & 0 deletions tests/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export const ROOT_ACCOUNT_TYPE = 'sr25519';
export const BLOCKCHAIN_MAX_BLOCK_WEIGHT = 2_000_000_000_000;
export const STORAGE_NODE_MAX_STARTUP_TIME = 60_000;
export const BLOCKCHAIN_NODE_MAX_STARTUP_TIME = 30_000;
export const DDC_CLUSTER_STAKE = 100_000; // CERE tokens
17 changes: 9 additions & 8 deletions tests/specs/Blockchain.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Blockchain, ClusterNodeKind, ClusterProps, ClusterStatus, StorageNodeMode } from '@cere-ddc-sdk/blockchain';
import { Blockchain, ClusterNodeKind, ClusterParams, ClusterStatus, StorageNodeMode } from '@cere-ddc-sdk/blockchain';
import { cryptoWaitReady, randomAsHex } from '@polkadot/util-crypto';
import { ApiPromise } from '@polkadot/api';
import { KeyringPair } from '@polkadot/keyring/types';

import { createAccount, createBlockhainApi, sendMultipleTransfers } from '../helpers';
import { CERE, createAccount, createBlockhainApi, DDC_CLUSTER_STAKE, sendMultipleTransfers } from '../helpers';

describe('Blockchain', () => {
const bondSize = 10n * CERE;

let apiPromise: ApiPromise;
let blockchain: Blockchain;

Expand All @@ -16,10 +18,9 @@ describe('Blockchain', () => {
let storageNode2Key: string;
let storageNode3Key: string;
let nonExistentKey1: string;
const bondSize = 10_000_000_000n;

const clusterId = randomAsHex(20);
const clusterProps: ClusterProps = {
const clusterProps: ClusterParams = {
nodeProviderAuthContract: null,
erasureCodingRequired: 4,
erasureCodingTotal: 6,
Expand Down Expand Up @@ -53,9 +54,9 @@ describe('Blockchain', () => {
apiPromise = await createBlockhainApi();

await sendMultipleTransfers(apiPromise, [
{ to: userAccount.address, tokens: 100 },
{ to: storageNode1Account.address, tokens: 10 },
{ to: nodeProviderAccount.address, tokens: 10 },
{ to: userAccount.address, tokens: DDC_CLUSTER_STAKE + 100 },
{ to: storageNode1Account.address, tokens: 100 },
{ to: nodeProviderAccount.address, tokens: 100 },
]);
});

Expand Down Expand Up @@ -144,7 +145,7 @@ describe('Blockchain', () => {
});

test('Should set cluster props', async () => {
const clusterProps: ClusterProps = {
const clusterProps: ClusterParams = {
nodeProviderAuthContract: null,
erasureCodingRequired: 4,
erasureCodingTotal: 6,
Expand Down
Loading