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
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @faustbrian @air1one @rainydio @sebastijankuzner
* @itsanametoo @sebastijankuzner
2 changes: 1 addition & 1 deletion __tests__/unit/core-database/transaction-filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ describe("TransactionFilter.getExpression", () => {
expect(expression).toEqual({
property: "vendorField",
op: "like",
pattern: "%pattern%",
pattern: Buffer.from("%pattern%", "utf-8"),
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions __tests__/unit/crypto/blocks/block.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const { outlookTable } = configManager.getPreset("mainnet").exceptions;

beforeEach(() => configManager.setFromPreset("devnet"));

afterEach(() => jest.resetAllMocks());
afterEach(() => jest.clearAllMocks());

describe("Block", () => {
const data = {
Expand Down Expand Up @@ -135,7 +135,7 @@ describe("Block", () => {
jest.spyOn(configManager, "getMilestone").mockImplementation((height) => ({
block: {
version: 0,
maxTransactions: 200,
maxTransactions: dummyBlock.numberOfTransactions,
maxPayload: dummyBlockSize - 1,
},
reward: 200000000,
Expand All @@ -150,7 +150,7 @@ describe("Block", () => {
jest.spyOn(configManager, "getMilestone").mockImplementation((height) => ({
block: {
version: 0,
maxTransactions: 200,
maxTransactions: dummyBlock.numberOfTransactions,
maxPayload: dummyBlockSize,
},
reward: 200000000,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class DisableFastupdateOnGinIndexes20220606000000 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`
DROP INDEX IF EXISTS transactions_asset;
DROP INDEX IF EXISTS transactions_asset_payments;
CREATE INDEX transactions_asset ON transactions USING GIN(asset) WITH (fastupdate = off);
CREATE INDEX transactions_asset_payments ON transactions USING GIN ((asset->'payments')) WITH (fastupdate = off);
`);
}

public async down(queryRunner: QueryRunner): Promise<any> {
await queryRunner.query(`
DROP INDEX IF EXISTS transactions_asset;
DROP INDEX IF EXISTS transactions_asset_payments;
CREATE INDEX transactions_asset ON transactions USING GIN(asset);
CREATE INDEX transactions_asset_payments ON transactions USING GIN ((asset->'payments'));
`);
}
}
2 changes: 1 addition & 1 deletion packages/core-database/src/transaction-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class TransactionFilter implements Contracts.Database.TransactionFilter {
});
case "vendorField":
return handleOrCriteria(criteria.vendorField!, async (c) => {
return { property: "vendorField", op: "like", pattern: c };
return { property: "vendorField", op: "like", pattern: Buffer.from(c, "utf-8") };
});
case "amount":
return handleOrCriteria(criteria.amount!, async (c) => {
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/commands/config-forger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export class Command extends Commands.Command {
this.definition
.setFlag("token", "The name of the token.", Joi.string().default("ark"))
.setFlag("network", "The name of the network.", Joi.string().valid(...Object.keys(Networks)))
.setFlag("bip38", "", Joi.string())
.setFlag("bip39", "A delegate plain text passphrase. Referred to as BIP39.", Joi.string())
.setFlag("password", "A custom password that encrypts the BIP39. Referred to as BIP38.", Joi.string())
.setFlag(
Expand Down
12 changes: 9 additions & 3 deletions packages/crypto/src/transactions/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ export class Serializer {
* Serializes the given transaction according to AIP11.
*/
public static serialize(transaction: ITransaction, options: ISerializeOptions = {}): Buffer {
const buff: ByteBuffer = new ByteBuffer(
Buffer.alloc(configManager.getMilestone(configManager.getHeight()).block?.maxPayload ?? 8192),
);
let size = 83886;
const maxPayload = configManager.getMilestone(configManager.getHeight()).block?.maxPayload;
const maxTransactions = configManager.getMilestone(configManager.getHeight()).block?.maxTransactions;

if (maxPayload && maxTransactions) {
size = Math.floor(maxPayload / maxTransactions) * 2;
}

const buff: ByteBuffer = new ByteBuffer(Buffer.alloc(size));

this.serializeCommon(transaction.data, buff);
this.serializeVendorField(transaction, buff);
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/src/validation/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const schemas = {

walletVote: {
$id: "walletVote",
allOf: [{ type: "string", pattern: "^[+|-][a-zA-Z0-9]{66}$" }, { transform: ["toLowerCase"] }],
allOf: [{ type: "string", pattern: "^[+|-][a-fA-F0-9]{66}$" }, { transform: ["toLowerCase"] }],
},

username: {
Expand Down