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: merge develop to evm #559

Merged
merged 98 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
5306586
deps: clean dependendies and add check script (#450)
sebastijankuzner Feb 26, 2024
f72fc66
feat(bootstrap): compare stored genesis block with config (#451)
sebastijankuzner Feb 26, 2024
035a4a8
refactor(processor): log verification errors (#452)
sebastijankuzner Feb 26, 2024
f4d7131
chore: change banner format to jpeg (#453)
sebastijankuzner Feb 27, 2024
3ca8b8d
release: 0.0.1-alpha.8 (#454)
sebastijankuzner Feb 27, 2024
f6a6932
fix(validator-set-vote-weighted): active validators is subset of regi…
sebastijankuzner Mar 4, 2024
f831da0
fix(processor): `validatorVoteBalance` calculation (#467)
sebastijankuzner Mar 4, 2024
1a21e5c
chore: docker validator support (#468)
adrian69 Mar 4, 2024
1fe8c94
release: 0.0.1-alpha.9 (#469)
sebastijankuzner Mar 4, 2024
15b1e16
chore: fix publish GitHub workflow (#470)
sebastijankuzner Mar 5, 2024
d2130e4
refactor(transactions): move amount deduction into transaction handle…
oXtxNt9U Mar 7, 2024
1ffb2c7
feat: add `env:paths:clear` commands (#473)
sebastijankuzner Mar 7, 2024
73031f9
release: 0.0.1-alpha.10 (#474)
sebastijankuzner Mar 7, 2024
8186062
feat(crypto-transaction-username-registration): limit one transaction…
sebastijankuzner Mar 8, 2024
b4d5ff7
feat(validator): log loaded validators (#477)
sebastijankuzner Mar 8, 2024
79eafc0
chore: fix typo in transaction fee errors (#476)
dated Mar 8, 2024
221d08a
feat(state): implements `sizeOfIndex` on WalletRepository (#479)
sebastijankuzner Mar 13, 2024
a699d1f
release: 0.0.1-alpha.11 (#480)
sebastijankuzner Mar 13, 2024
e4fc997
feat: port to ES modules (#478)
oXtxNt9U Mar 13, 2024
4fe8a61
fix(api): broken entrypoint (#481)
oXtxNt9U Mar 14, 2024
fa3e8be
refactor(transaction-pool): return tx indexes as integers (#483)
oXtxNt9U Mar 14, 2024
95c24dc
chore: update dependencies (#482)
oXtxNt9U Mar 14, 2024
8f8264f
fix wallet response (#485)
oXtxNt9U Mar 15, 2024
efe16ce
fix(configuration-generator): create genesis block script (#484)
oXtxNt9U Mar 15, 2024
253cb58
refactor(core): rename run script to have explicit file extension (#486)
oXtxNt9U Mar 18, 2024
6703ac2
fix: use .js extension in `start` commands (#487)
sebastijankuzner Mar 18, 2024
7348e42
release: 0.0.1-alpha.12 (#488)
sebastijankuzner Mar 18, 2024
ec86af5
fix(core): resolve correct plugin `package.json` path (#489)
sebastijankuzner Mar 18, 2024
32ab8ae
release: 0.0.1-alpha.13 (#490)
sebastijankuzner Mar 18, 2024
84ee4b8
feat(cli): determine correct entrypoint paths (#491)
sebastijankuzner Mar 19, 2024
fb1ac37
fix(test-framework): list project packages in dependencies (#492)
sebastijankuzner Mar 20, 2024
8969707
exclude genesis transactions from fee statistics calculation (#494)
oXtxNt9U Mar 21, 2024
f686544
fix(crypto): manage static fees via milestones (#493)
oXtxNt9U Mar 21, 2024
4ad6317
fix(api): sync active milestones on change (#495)
oXtxNt9U Mar 22, 2024
bffeb51
fix(api-http): add missing fields to transaction resource (#496)
oXtxNt9U Mar 22, 2024
c9621c1
fix paths according to the latest paths naming convention (#497)
adrian69 Mar 25, 2024
73ab152
refactor(p2p): replace ip with `url` in api nodes (#498)
oXtxNt9U Mar 25, 2024
215f8af
fix(transaction-pool): invalid tx error reporting (#500)
oXtxNt9U Mar 26, 2024
0028457
test: use `tsx` TypeScript loader (#499)
sebastijankuzner Mar 26, 2024
b1cc4b6
style: resolve style guide violations
sebastijankuzner Mar 26, 2024
dc0160b
refactor: remove `__dirname` usage (#501)
sebastijankuzner Mar 26, 2024
e74d1b7
test(functional/consensus): add skeleton for functional tests (#503)
sebastijankuzner Mar 26, 2024
e429808
refactor(consensus-storage): extract storage logic into package (#502)
sebastijankuzner Mar 27, 2024
897f9b0
milestone generator add static fees (#504)
oXtxNt9U Mar 27, 2024
a74f6ce
test(functional/transaction-pool-api): initial boilerplate and tests …
oXtxNt9U Mar 27, 2024
d9b1d13
fix(test-runner): rethrow error in runHook (#506)
oXtxNt9U Mar 27, 2024
4ad62a9
refactor(database): return commits instead blocks (#507)
sebastijankuzner Mar 28, 2024
2b69382
feat(transaction-pool): support `in-memory` database (#510)
sebastijankuzner Mar 28, 2024
7f0e614
test(functional/consensus): prepare package replacements, asserts and…
sebastijankuzner Mar 28, 2024
a71f6a6
refactor(kernel): create bootstraper for shutdown signals (#511)
sebastijankuzner Mar 28, 2024
9a2c17e
test(functional/transaction-pool-api): test all transaction types (#509)
oXtxNt9U Mar 29, 2024
486df10
test(functional/transaction-pool): increase vote coverage (#512)
oXtxNt9U Mar 29, 2024
7b7613f
test(functional/transaction-pool): increase validator registration co…
oXtxNt9U Mar 29, 2024
0d4711f
test(functional/transaction-pool): increase validator resignation cov…
oXtxNt9U Mar 29, 2024
f71d837
test(functional/transaction-pool): increase username registration cov…
oXtxNt9U Mar 29, 2024
0726600
test(functional/transaction-pool): increase username resignation cove…
oXtxNt9U Mar 29, 2024
ffe849a
fix(kernel): minority and majority calculation (#520)
sebastijankuzner Apr 2, 2024
478fc52
fix(api-http): allow 0 nonce in schema (#521)
sebastijankuzner Apr 2, 2024
5a148da
fix(api-http): implement missing `/transaction/fees` route (#523)
oXtxNt9U Apr 3, 2024
b6fe374
test(functional/transaction-pool): increase multi sig registration co…
oXtxNt9U Apr 3, 2024
abde445
test(functional/transaction-pool): add more misc coverage (#518)
oXtxNt9U Apr 3, 2024
b40ae9b
release: 0.0.1-alpha.14 (#522)
sebastijankuzner Apr 3, 2024
b4dfebe
feat(consensus): emit events (#524)
sebastijankuzner Apr 4, 2024
5b632f0
test(functional/transaction-pool): extract transaction builders into …
oXtxNt9U Apr 4, 2024
61dfa01
test(functional/consensus): test proposal scenarios (#526)
sebastijankuzner Apr 5, 2024
71c5b64
fix(api-http): delegate search (#527)
oXtxNt9U Apr 5, 2024
00cba57
refactor(p2p): log route on codec error (#528)
sebastijankuzner Apr 5, 2024
173b9e5
test(functional/transaction-pool): add .gitkeep (#530)
oXtxNt9U Apr 8, 2024
346eefa
test(functional/consensus): test prevote & precommit scenarios (#529)
sebastijankuzner Apr 8, 2024
b85bed1
fix(configuration-generator): update export paths (#531)
sebastijankuzner Apr 8, 2024
3982f3d
feat(api-development): add `peers/banned` endpoint (#532)
sebastijankuzner Apr 9, 2024
66d8d3d
test(functional): update ci workflow (#534)
oXtxNt9U Apr 9, 2024
f903a0d
test(functional/consensus): test rejection of invalid block proposals…
oXtxNt9U Apr 9, 2024
52df281
deps: update lmdb (#535)
sebastijankuzner Apr 9, 2024
cacaa15
test(functional): fix `MaxListenersExceeded` warning (#537)
oXtxNt9U Apr 10, 2024
09bf83a
feat(api-http): support sorting on jsonb attributes (#538)
oXtxNt9U Apr 10, 2024
5103546
fix(p2p): peer ban and validate ip plugin (#539)
sebastijankuzner Apr 10, 2024
504fa28
feat(cli): add --overwrite flag to `config:publish:custom` (#536)
oXtxNt9U Apr 10, 2024
5fc36ac
feat(crypto): add browser support for bls12-381 packages (#540)
oXtxNt9U Apr 11, 2024
68944ce
release: 0.0.1-alpha.15 (#542)
sebastijankuzner Apr 11, 2024
eb7956c
fix(p2p): postTransactions response schema and proto (#543)
sebastijankuzner Apr 11, 2024
0595007
refactor(api): show `meta` field in response at top (#545)
oXtxNt9U Apr 12, 2024
3d3658c
fix(api-http): change default sort for `/delegates` (#544)
oXtxNt9U Apr 12, 2024
1eba491
refactor(block-processor): log commit round (#546)
sebastijankuzner Apr 12, 2024
da1d8dd
perf(consensus): verify proposal signatures on main thread (#548)
sebastijankuzner Apr 16, 2024
fe012d8
refactor(contracts): remove Consensus prefix from contracts (#549)
sebastijankuzner Apr 16, 2024
94ddb6f
refactor(consensus): remove hasValidBlockGenerator check (#550)
sebastijankuzner Apr 16, 2024
98c51d9
fix(api-http): sort delegates by rank asc by default (#552)
oXtxNt9U Apr 17, 2024
9802c14
test(e2e): add e2e tests and workflow (#547)
oXtxNt9U Apr 17, 2024
c2ecbf4
release: 0.0.1-alpha.16 (#553)
sebastijankuzner Apr 17, 2024
7d4e266
feat(validator): support secret encryption (#554)
oXtxNt9U Apr 18, 2024
4f910c9
perf: deserialize proposal in steps (#551)
sebastijankuzner Apr 18, 2024
9b3ea3a
perf(consensus): run pending RoundStates only once (#555)
sebastijankuzner Apr 18, 2024
0b24599
Merge branch 'develop' into chore/evm/merge-dev
oXtxNt9U Apr 22, 2024
8a5cbdb
update test
oXtxNt9U Apr 22, 2024
75f1d34
style: resolve style guide violations
oXtxNt9U Apr 22, 2024
9cf34b1
fix deps
oXtxNt9U Apr 22, 2024
da01ca7
register evm
oXtxNt9U Apr 22, 2024
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
78 changes: 78 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI

on:
push:
branches:
- "main"
- "develop"
pull_request:
types: [ready_for_review, synchronize, opened]

jobs:
e2e:
concurrency:
cancel-in-progress: true
group: ${{ github.head_ref }}-e2e-${{ matrix.name }}
runs-on: ubuntu-latest

timeout-minutes: 10

strategy:
matrix:
node-version: [20.x]
name: ["consensus"]

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
run_install: false
version: latest
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache pnpm modules
uses: actions/cache@v3
with:
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Cache lerna
uses: actions/cache@v3
with:
key: ${{ runner.os }}-lerna
path: ./.cache
restore-keys: ${{ runner.os }}-lerna-
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm run build

- name: Docker ${{ matrix.name }}
run: sudo chmod -R 777 tests/e2e/${{ matrix.name }}/nodes && cd tests/e2e/${{ matrix.name }} && docker-compose up -d

- name: Running checks for ${{ matrix.name }}
run: |
container_id=$(docker ps -a | grep 'consensus_checks' | awk '{print $1}')
while docker ps | grep -q $container_id; do echo "checks running..."; sleep 5; done
exit_code=$(docker container inspect $container_id --format='{{.State.ExitCode}}')
if [ "$exit_code" != "0" ]; then
echo "Error: checks exited with code $exit_code"
exit 1
fi
- name: Show logs - node0
if: always()
run: docker logs consensus_node0_1
- name: Show logs - node1
if: always()
run: docker logs consensus_node1_1
- name: Show logs - node2
if: always()
run: docker logs consensus_node2_1
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ transaction-pool.sqlite
transaction-pool.sqlite-shm
transaction-pool.sqlite-wal

# LMDB
consensus.mdb
consensus.mdb-lock
ledger.mdb
ledger.mdb-lock

state-export

# P2P
/peers.json

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "0.0.1-alpha.14"
"version": "0.0.1-alpha.16"
}
2 changes: 1 addition & 1 deletion packages/api-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-common",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "Common API building blocks for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
3 changes: 2 additions & 1 deletion packages/api-common/source/plugins/pagination/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

request.query[name] = value || defaultValue;

return;

Check warning on line 30 in packages/api-common/source/plugins/pagination/extension.ts

View workflow job for this annotation

GitHub Actions / source (20.x)

Remove this redundant jump
};

// ! should be set through validation schema
Expand All @@ -38,7 +38,7 @@
return h.continue;
}

public onPostHandler(request, h) {

Check warning on line 41 in packages/api-common/source/plugins/pagination/extension.ts

View workflow job for this annotation

GitHub Actions / source (20.x)

Refactor this function to reduce its Cognitive Complexity from 21 to the 15 allowed
const { statusCode } = request.response;
const processResponse: boolean =
this.isValidRoute(request) && statusCode >= 200 && statusCode <= 299 && this.hasPagination(request);
Expand Down Expand Up @@ -69,10 +69,9 @@
const getUri = (page: number | null): string | null =>
/* istanbul ignore next */
// tslint:disable-next-line: no-null-keyword
page ? baseUri + Qs.stringify(applyToDefaults({ ...query, ...request.orig.query }, { page })) : null;

Check warning on line 72 in packages/api-common/source/plugins/pagination/extension.ts

View workflow job for this annotation

GitHub Actions / source (20.x)

Use destructured variables over properties

Check warning on line 72 in packages/api-common/source/plugins/pagination/extension.ts

View workflow job for this annotation

GitHub Actions / source (20.x)

Use `undefined` instead of `null`

const newSource = {
data: results,
meta: {
...source.meta,

Expand All @@ -84,15 +83,17 @@

// tslint:disable-next-line: no-null-keyword
/* istanbul ignore next */
next: totalCount && currentPage < pageCount ? getUri(currentPage + 1) : null,

Check warning on line 86 in packages/api-common/source/plugins/pagination/extension.ts

View workflow job for this annotation

GitHub Actions / source (20.x)

Use `undefined` instead of `null`
pageCount: pageCount,

previous:
// tslint:disable-next-line: no-null-keyword
totalCount && currentPage > 1 && currentPage <= pageCount + 1 ? getUri(currentPage - 1) : null,

Check warning on line 91 in packages/api-common/source/plugins/pagination/extension.ts

View workflow job for this annotation

GitHub Actions / source (20.x)

Use `undefined` instead of `null`
self: getUri(currentPage),
totalCount: totalCount ? totalCount : 0,
},
// eslint-disable-next-line sort-keys-fix/sort-keys-fix
data: results,
};

if (source.response) {
Expand All @@ -106,7 +107,7 @@
}
}

request.response.source = newSource;

Check warning on line 110 in packages/api-common/source/plugins/pagination/extension.ts

View workflow job for this annotation

GitHub Actions / source (20.x)

Use destructured variables over properties

return h.continue;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/api-database/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-database",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "API database for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
37 changes: 26 additions & 11 deletions packages/api-database/source/repositories/wallet-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@ export const makeWalletRepository = (dataSource: RepositoryDataSource): WalletRe
options?: Options,
): Promise<ResultsPage<Wallet>> {
const walletExpression = await WalletFilter.getExpression(walletCriteria);
return this.listByExpression(walletExpression, convertToJsonbSorting(sorting), pagination, options);
return this.listByExpression(
walletExpression,
convertToJsonbSorting(sorting, [
{
direction: "desc",
jsonFieldAccessor: { cast: "bigint", fieldName: "balance", operator: "->>" },
property: "attributes",
},
]),
pagination,
options,
);
},

async findManyDelegatesByCritera(
Expand All @@ -24,20 +35,24 @@ export const makeWalletRepository = (dataSource: RepositoryDataSource): WalletRe
options?: Options,
): Promise<ResultsPage<Wallet>> {
const walletExpression = await DelegateFilter.getExpression(delegateCriteria);
return this.listByExpression(walletExpression, convertToJsonbSorting(sorting), pagination, options);
return this.listByExpression(
walletExpression,
convertToJsonbSorting(sorting, [
{
direction: "asc",
jsonFieldAccessor: { cast: "bigint", fieldName: "validatorRank", operator: "->>" },
property: "attributes",
},
]),
pagination,
options,
);
},
});

const convertToJsonbSorting = (sorting: Sorting): Sorting => {
const convertToJsonbSorting = (sorting: Sorting, defaultSort: Sorting): Sorting => {
if (sorting.length === 0) {
// default sort
return [
{
direction: "desc",
jsonFieldAccessor: { cast: "bigint", fieldName: "balance", operator: "->>" },
property: "attributes",
},
];
return defaultSort;
}

return sorting.map(
Expand Down
2 changes: 1 addition & 1 deletion packages/api-development/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-development",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "Development API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
8 changes: 4 additions & 4 deletions packages/api-development/source/controllers/consensus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Controller } from "./controller.js";
@injectable()
export class ConsensusController extends Controller {
@inject(Identifiers.Consensus.Service)
private readonly consensus!: Contracts.Consensus.ConsensusService;
private readonly consensus!: Contracts.Consensus.Service;

@inject(Identifiers.Consensus.RoundStateRepository)
private readonly roundStateRepository!: Contracts.Consensus.RoundStateRepository;
Expand Down Expand Up @@ -55,17 +55,17 @@ export class ConsensusController extends Controller {
step: state.step,
// eslint-disable-next-line sort-keys-fix/sort-keys-fix
lockedRound: state.lockedRound,
lockedValue: state.lockedValue ? state.lockedValue.getProposal()?.block.block.header.id : null,
lockedValue: state.lockedValue ? state.lockedValue.getProposal()?.getData().block.header.id : null,
validRound: state.validRound,
validValue: state.validValue ? state.validValue.getProposal()?.block.block.header.id : null,
validValue: state.validValue ? state.validValue.getProposal()?.getData().block.header.id : null,
// eslint-disable-next-line sort-keys-fix/sort-keys-fix
precommits: collectMessages(precommits.sort((a, b) => b.round - a.round)),
prevotes: collectMessages(prevotes.sort((a, b) => b.round - a.round)),
proposals: proposals
.sort((a, b) => b.round - a.round)
.map((p) => ({
data: p.toData(),
lockProof: p.block.lockProof,
lockProof: p.isDataDeserialized ? p.getData().lockProof : undefined,
name: validators[p.validatorIndex].toString(),
})),

Expand Down
2 changes: 1 addition & 1 deletion packages/api-http/integration/routes/delegates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe<{
assert.equal(statusCode, 200);

const sorted = [...delegates];
sorted.sort((a, b) => +b.attributes.balance - +a.attributes.balance);
sorted.sort((a, b) => +a.attributes.validatorRank - +b.attributes.validatorRank);
assert.equal(data.data, sorted);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/api-http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-http",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "HTTP/S API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-sync/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-sync",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "API database sync for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api-transaction-pool/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api-transaction-pool",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "Transaction Pool API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/api",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "API for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/bootstrap",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "Bootstrap manager for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap/source/bootstrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Bootstrapper {
private readonly logger!: Contracts.Kernel.Logger;

@inject(Identifiers.Consensus.Service)
private readonly consensus!: Contracts.Consensus.ConsensusService;
private readonly consensus!: Contracts.Consensus.Service;

@inject(Identifiers.State.State)
private readonly state!: Contracts.State.State;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/cli",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "CLI utilities for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/configuration-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/configuration-generator",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "Configuration generator for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
2 changes: 1 addition & 1 deletion packages/consensus-storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/consensus-storage",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "Consensus storage for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
4 changes: 1 addition & 3 deletions packages/consensus-storage/source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ export class ServiceProvider extends Providers.ServiceProvider {
const storage = this.app.get<Service>(Identifiers.ConsensusStorage.Service);

await storage.clear();
await storage.saveState(
this.app.get<Contracts.Consensus.ConsensusService>(Identifiers.Consensus.Service).getState(),
);
await storage.saveState(this.app.get<Contracts.Consensus.Service>(Identifiers.Consensus.Service).getState());

await storage.saveProposals(
roundStates
Expand Down
6 changes: 3 additions & 3 deletions packages/consensus-storage/source/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class Service implements Contracts.ConsensusStorage.Service {
@inject(Identifiers.Cryptography.Message.Factory)
private readonly messageFactory!: Contracts.Crypto.MessageFactory;

public async getState(): Promise<Contracts.Consensus.ConsensusStateData | undefined> {
public async getState(): Promise<Contracts.Consensus.StateData | undefined> {
if (!this.stateStorage.doesExist("consensus-state")) {
return undefined;
}
Expand All @@ -38,9 +38,9 @@ export class Service implements Contracts.ConsensusStorage.Service {
};
}

public async saveState(state: Contracts.Consensus.ConsensusState): Promise<void> {
public async saveState(state: Contracts.Consensus.State): Promise<void> {
// always overwrite existing state; we only care about state for uncommitted blocks
const data: Contracts.Consensus.ConsensusStateData = {
const data: Contracts.Consensus.StateData = {
height: state.height,
lockedRound: state.lockedRound,
round: state.round,
Expand Down
2 changes: 1 addition & 1 deletion packages/consensus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mainsail/consensus",
"version": "0.0.1-alpha.14",
"version": "0.0.1-alpha.16",
"description": "Consensus for the Mainsail blockchain",
"license": "GPL-3.0-only",
"contributors": [],
Expand Down
4 changes: 2 additions & 2 deletions packages/consensus/source/bootstrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class Bootstrapper implements Contracts.Consensus.Bootstrapper {
@inject(Identifiers.ConsensusStorage.Service)
private readonly storage!: Contracts.ConsensusStorage.Service;

public async run(): Promise<Contracts.Consensus.ConsensusState | undefined> {
public async run(): Promise<Contracts.Consensus.State | undefined> {
const proposals = await this.storage.getProposals();

this.logger.info(`Consensus Bootstrap - Proposals: ${proposals.length}`);
Expand All @@ -38,7 +38,7 @@ export class Bootstrapper implements Contracts.Consensus.Bootstrapper {
roundState.addPrecommit(precommit);
}

const state = (await this.storage.getState()) as Utils.Mutable<Contracts.Consensus.ConsensusState> | undefined;
const state = (await this.storage.getState()) as Utils.Mutable<Contracts.Consensus.State> | undefined;
if (!state) {
return undefined;
}
Expand Down
Loading
Loading