Commit efee7942 authored by Cédric Moreau's avatar Cédric Moreau

[enh] Disable v11 for now (cherry-picked from 1.7 branch)

parent 56cd017e
......@@ -12,6 +12,7 @@
// GNU Affero General Public License for more details.
import {BlockDTO} from "../dto/BlockDTO"
import {Underscore} from "../common-libs/underscore"
export interface SwitchBlock {
number:number
......@@ -89,7 +90,7 @@ export class Switcher<T extends SwitchBlock> {
*/
private async findPotentialSuites(numberStart:number, timeStart:number) {
const suites:T[][] = []
const potentials:T[] = await this.dao.getPotentials(numberStart, timeStart, numberStart + this.forkWindowSize)
const potentials:T[] = Underscore.sortBy(await this.dao.getPotentials(numberStart, timeStart, numberStart + this.forkWindowSize), element => `${String(element.number).padStart(10, '0')}-${element.hash}`)
const knownForkBlocks:{ [k:string]: boolean } = {}
for (const candidate of potentials) {
knownForkBlocks[BlockDTO.fromJSONObject(candidate).blockstamp] = true
......
......@@ -101,7 +101,7 @@ export const CommonConstants = {
},
BLOCK_GENERATED_VERSION: 10,
BLOCK_NEW_GENERATED_VERSION: 11,
BLOCK_NEW_GENERATED_VERSION: 10, // Put it to 11 when ready
LAST_VERSION_FOR_TX: 10,
TRANSACTION_VERSION: 10,
DOCUMENTS_VERSION: 10,
......
......@@ -13,7 +13,7 @@
export const OtherConstants = {
MUTE_LOGS_DURING_UNIT_TESTS: false,
MUTE_LOGS_DURING_UNIT_TESTS: true,
BC_EVENT: {
SWITCHED: 'switched',
......
......@@ -44,7 +44,7 @@ export class TransactionService extends FIFOService {
const hash = tx.getHash()
return this.pushFIFO<TransactionDTO>(hash, async () => {
try {
this.logger.info('⬇ TX %s:%s from %s', tx.output_amount, tx.output_base, tx.issuers);
this.logger.info('⬇ TX %s:%s (hash %s) from %s', tx.output_amount, tx.output_base, tx.issuers, tx.hash.substr(0, 8));
const existing = await this.dal.getTxByHash(tx.hash);
const current = await this.dal.getCurrentBlockOrNull();
if (existing) {
......@@ -65,7 +65,7 @@ export class TransactionService extends FIFOService {
throw constants.ERRORS.SANDBOX_FOR_TRANSACTION_IS_FULL;
}
await this.dal.saveTransaction(DBTx.fromTransactionDTO(tx));
this.logger.info('✔ TX %s:%s from %s', tx.output_amount, tx.output_base, tx.issuers);
this.logger.info('✔ TX %s:%s (hash %s) from %s', tx.output_amount, tx.output_base, tx.issuers, tx.hash.substr(0, 8));
return tx;
} catch (e) {
this.logger.info('✘ TX %s:%s from %s', tx.output_amount, tx.output_base, tx.issuers);
......
......@@ -22,6 +22,7 @@ const rp = require('request-promise');
const httpTest = require('./tools/http');
const commit = require('./tools/commit');
const shutDownEngine = require('./tools/shutDownEngine');
const CommonConstants = require('./../../app/lib/common-libs/constants').CommonConstants
require('../../app/modules/prover/lib/constants').ProverConstants.CORES_MAXIMUM_USE_IN_PARALLEL = 1
require('../../app/modules/bma').BmaDependency.duniter.methods.noLimit(); // Disables the HTTP limiter
......@@ -48,6 +49,8 @@ describe("Revert two blocks", function() {
before(function() {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
s1 = duniter(
'/bb11',
MEMORY_MODE,
......@@ -255,4 +258,8 @@ describe("Revert two blocks", function() {
});
});
})
after(() => {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
})
});
......@@ -14,6 +14,7 @@
import {assertEqual, writeBasicTestWithConfAnd2Users} from "../tools/test-framework"
import {assertThrows} from "../../unit-tools"
import {reduce} from "../../../app/lib/indexer"
import {CommonConstants} from "../../../app/lib/common-libs/constants"
describe('Certification replay', () => writeBasicTestWithConfAnd2Users({
sigReplay: 3,
......@@ -21,6 +22,10 @@ describe('Certification replay', () => writeBasicTestWithConfAnd2Users({
sigValidity: 10,
}, (test) => {
before(() => {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
})
const now = 1500000000
test('should be able to init with 2 blocks', async (s1, cat, tac) => {
......@@ -66,4 +71,8 @@ describe('Certification replay', () => writeBasicTestWithConfAnd2Users({
assertEqual(reduce(reducableFromCat).replayable_on, now + 4 + 3) // Replayable date should have changed!
assertEqual(reduce(reducableFromCat).expires_on, now + 4 + 10) // The expiration date should have changed! (this is the interest of a replay)
})
after(() => {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
})
}))
......@@ -45,11 +45,19 @@ describe("Membership chainability", function() {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = nowVersion
})
before(() => {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
})
it('current should be the 2nd', () => s1.expect('/blockchain/current', (res:any) => {
res.should.have.property('number').equal(2)
res.should.have.property('actives').length(1)
}))
after(() => {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
})
after(async () => {
await s1.closeCluster()
})
......
......@@ -30,6 +30,8 @@ describe("Fork blocks", function() {
before(() => co(function*() {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
s1 = toolbox.server({
// The common conf
......@@ -231,4 +233,8 @@ describe("Fork blocks", function() {
assert.equal(res.blocks[2].hash, 'C41F10519A24950C051F3ABBBF71775D9EF836374EF538897DFFF08E7A3F5E50')
})
}))
after(() => {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
})
});
......@@ -24,6 +24,7 @@ const node = require('./tools/node');
const TestUser = require('./tools/TestUser').TestUser
const unit = require('./tools/unit');
const http = require('./tools/http');
const CommonConstants = require('../../app/lib/common-libs/constants').CommonConstants
describe("Testing transactions", function() {
......@@ -34,6 +35,8 @@ describe("Testing transactions", function() {
before(() => co(function*() {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
s1 = toolbox.server({
pair: {
pub: 'DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV',
......@@ -79,6 +82,8 @@ describe("Testing transactions", function() {
}));
after(() => {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
return Promise.all([
s1.closeCluster()
])
......
......@@ -21,6 +21,7 @@ const bma = require('../../app/modules/bma').BmaDependency.duniter.methods
const TestUser = require('./tools/TestUser').TestUser
const commit = require('./tools/commit');
const shutDownEngine = require('./tools/shutDownEngine');
const CommonConstants = require('./../../app/lib/common-libs/constants').CommonConstants
const MEMORY_MODE = true;
const commonConf = {
......@@ -51,6 +52,8 @@ describe("WOTB module", function() {
return co(function *() {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 11
s1 = duniter(
'/bb11',
MEMORY_MODE,
......@@ -475,5 +478,9 @@ describe("WOTB module", function() {
wotb.existsLink(2, 1).should.equal(false);
});
});
after(() => {
CommonConstants.BLOCK_NEW_GENERATED_VERSION = 10
})
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment