Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jest.setTimeout(1200000);

import { StateBuilder } from "@arkecosystem/core-state/src/state-builder";
import { Sandbox } from "@packages/core-test-framework/src";
import { snoozeForBlock } from "@packages/core-test-framework/src/utils";

const sandbox: Sandbox = new Sandbox();

Expand Down Expand Up @@ -65,6 +66,13 @@ export const setUp = async (): Promise<Contracts.Kernel.Application> => {
Managers.configManager.getMilestone().aip11 = true;
Managers.configManager.getMilestone().htlcEnabled = true;
Managers.configManager.getMilestone().blsPublicKeyRegistrationEnabled = true;
Managers.configManager.getMilestone().magistrateEnabled = true;

// The flag above only covers the config that is live right now. TransactionFactory reloads
// the testnet preset on every transaction it builds, and there `magistrateEnabled` is only
// set from height 2 — so a Magistrate transaction sent at genesis is still rejected with
// "Transaction type 2/x is deactivated". Wait for the first block before any test runs.
await snoozeForBlock(1);
});

return sandbox.app;
Expand Down
21 changes: 2 additions & 19 deletions __tests__/integration/core-api/handlers/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,16 +474,7 @@ describe("API 2.0 - Transactions", () => {
HtlcClaim: 9,
HtlcRefund: 10,
},
2: {
// Marketplace stuff
BusinessRegistration: 0,
BusinessResignation: 1,
BusinessUpdate: 2,
BridgechainRegistration: 3,
BridgechainResignation: 4,
BridgechainUpdate: 5,
// Entity: 6, // no "Entity" because aip36 is not enabled
},
// no typeGroup 2 (Magistrate) because magistrateEnabled is not set on this milestone
});
});
});
Expand Down Expand Up @@ -637,15 +628,7 @@ describe("API 2.0 - Transactions", () => {
transfer: "10000000",
vote: "100000000",
},
"2": {
bridgechainRegistration: "5000000000",
bridgechainResignation: "5000000000",
bridgechainUpdate: "5000000000",
businessRegistration: "5000000000",
businessResignation: "5000000000",
businessUpdate: "5000000000",
// entity: "5000000000", // aip36 is disabled
},
// no typeGroup 2 (Magistrate) because magistrateEnabled is not set on this milestone
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ describe("Entity handler", () => {
const result = await entityHandler.isActivated();
expect(result).toBeTrue();
});

it("should return false if AIP36 is enabled but magistrate is not enabled", async () => {
Managers.configManager.setHeight(61);
Managers.configManager.getMilestone().magistrateEnabled = false;

entityHandler = container.resolve(EntityTransactionHandler);
const result = await entityHandler.isActivated();
expect(result).toBeFalse();
});
});

describe("dynamicFee", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export class EntityTransactionHandler extends Handlers.TransactionHandler {
}

public async isActivated(): Promise<boolean> {
return Managers.configManager.getMilestone().aip36 === true;
const milestone = Managers.configManager.getMilestone();
return milestone.aip36 === true && milestone.magistrateEnabled === true;
}

public dynamicFee(context: Contracts.Shared.DynamicFeeContext): Utils.BigNumber {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Interfaces as CryptoInterfaces, Managers, Utils } from "@arkecosystem/c
export abstract class MagistrateTransactionHandler extends Handlers.TransactionHandler {
public async isActivated(): Promise<boolean> {
const milestone = Managers.configManager.getMilestone();
return milestone.aip11 === true && !milestone.aip36;
return milestone.aip11 === true && !milestone.aip36 && milestone.magistrateEnabled === true;
}

public async throwIfCannotBeApplied(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class CryptoGenerator extends Generator {
multiSignatureRegistrationEnabled: true,
multiSignatureSendingEnabled: true,
multiSignatureReceivingEnabled: true,
magistrateEnabled: true,
},
{
height: rewardHeight,
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"@arkecosystem/crypto-identities": "1.2.0",
"@arkecosystem/crypto-networks": "1.8.1",
"@arkecosystem/crypto-networks": "2.0.0",
"@arkecosystem/utils": "1.3.1",
"ajv": "6.12.6",
"ajv-keywords": "3.4.1",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
fast-memoize "^2.5.1"
wif "^2.0.6"

"@arkecosystem/crypto-networks@1.8.1":
version "1.8.1"
resolved "https://registry.yarnpkg.com/@arkecosystem/crypto-networks/-/crypto-networks-1.8.1.tgz#e44ef1b57209f839cbb8b04a04f45c2d0574c6c4"
integrity sha512-3BJrPXFj2pJudJMDg3jAbxowMQkikoxCsp/dQgLvrIfDFjjiQbv3KNLUGV+m+BpixuRo+/s4711JkJ4CZP7PXg==
"@arkecosystem/crypto-networks@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@arkecosystem/crypto-networks/-/crypto-networks-2.0.0.tgz#e878dc337b45f1020e6c9e58f0456ffbfa89d78f"
integrity sha512-YxQJbSrCLrgWDHbCoj2m/Baj5Qn5XLYhuvtEeAb8lVIHFxJTso5AXaaDoO2DDc/HSIQrTAhi5627zPoGq54BQQ==

"@arkecosystem/utils@1.3.1":
version "1.3.1"
Expand Down
Loading