Skip to content

Commit

Permalink
Merge branch 'development' into feature/protobuf
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
  • Loading branch information
mcanever committed Aug 8, 2018
2 parents 558c44d + d94cb0c commit 5c6500f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion etc/mainnet/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"port": 5555,
"address": "0.0.0.0",
"version": "1.0.1",
"version": "1.1.1",
"fileLogLevel": "info",
"logFileName": "logs/rise-master.log",
"consoleLogLevel": "info",
Expand Down
2 changes: 1 addition & 1 deletion etc/testnet/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"port": 5566,
"address": "0.0.0.0",
"version": "0.1.12",
"version": "1.1.1",
"fileLogLevel": "info",
"logFileName": "logs/rise-testnet.log",
"consoleLogLevel": "info",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Rise-node",
"version": "1.0.0",
"version": "1.1.1",
"private": true,
"scripts": {
"start": "node app.js",
Expand Down
4 changes: 2 additions & 2 deletions src/modules/blocks/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ export class BlocksModuleChain implements IBlocksModuleChain {
this.logger.debug('Block applied correctly with ' + block.transactions.length + ' transactions');
}

await this.bus.message('newBlock', block, broadcast);

await this.roundsModule.tick(block, dbTX);

this.blocksModule.lastBlock = this.BlocksModel.classFromPOJO(block);

await this.bus.message('newBlock', block, broadcast);
}).catch((err) => {
// Allow cleanup as processing finished even if rollback.
this.isProcessing = false;
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/api/accounts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ describe('api/accounts', () => {

describe('/top', () => {
initializer.autoRestoreEach();
beforeEach(async () => {
beforeEach(async function () {
this.timeout(5000);
const txs = [];
const accModule = initializer.appManager.container.get<IAccountsModule>(Symbols.modules.accounts);
const systemModule = initializer.appManager.container.get<ISystemModule>(Symbols.modules.system);
Expand Down
13 changes: 12 additions & 1 deletion tests/integration/attackVectors_edgeCases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ describe('attackVectors/edgeCases', () => {
expect(postAcc.u_balance).to.be.eq(funds);
expect(blocksModule.lastBlock.id).to.be.eq(lastId);
});
it('should disallow block with same tx twice with crafted wrong id', async () => {
const lastId = blocksModule.lastBlock.id;
const tx = await createSendTransaction(0, 1, senderAccount, createRandomWallet().address);
await expect(initializer.rawMineBlockWithTxs(
[tx, {...tx, id: '12123123123123123'}].map((t) => toBufferedTransaction(t)),
)).to.rejectedWith('Duplicated transaction found in block with id');
const postAcc = await accModule.getAccount({address: senderAccount.address});
expect(postAcc.balance).to.be.eq(funds);
expect(postAcc.u_balance).to.be.eq(funds);
expect(blocksModule.lastBlock.id).to.be.eq(lastId);
});
it('should disallow a block with a previously existing tx', async () => {
const tx = await createSendTransaction(1, 1, senderAccount, createRandomWallet().address);
const lastId = blocksModule.lastBlock.id;
Expand All @@ -141,7 +152,7 @@ describe('attackVectors/edgeCases', () => {
const tx = await createSendTransaction(0, 1, senderAccount, createRandomWallet().address);
tx.recipientId = tx.recipientId.toLowerCase();
await expect(initializer.rawMineBlockWithTxs(
[tx].map((t) => toBufferedTransaction(t)),
[tx].map((t) => toBufferedTransaction(t))
)).to.rejectedWith('Failed to validate transaction schema');
const postAcc = await accModule.getAccount({address: senderAccount.address});
expect(postAcc.balance).to.be.eq(funds);
Expand Down

0 comments on commit 5c6500f

Please sign in to comment.