Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Resolves TODO comments (#9050)
Browse files Browse the repository at this point in the history
* 🏷️ Updates TokenMethod typedef for BaseInteroperabilityMethod

* 🔥 UserStore.accountExist for Token module

* Removes comment from utils.ts in Interoperability module

* Removes comment from lisk-chain constants

* 🏷️ Removes casting of NetworkEndpoint to EndpointArgs in Consensus.init

* Removes comment to reuse checkEventResult utility; Issue #9047 targetting resuability of checkEventResult

* Removes comment; as the title message works expected
  • Loading branch information
has5aan authored Oct 4, 2023
1 parent fe90652 commit 2d69d97
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 36 deletions.
1 change: 0 additions & 1 deletion elements/lisk-chain/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const GENESIS_BLOCK_TRANSACTION_ROOT = EMPTY_HASH;
export const TAG_BLOCK_HEADER = utils.createMessageTag('BH');
export const TAG_TRANSACTION = utils.createMessageTag('TX');

// TODO: Actual size TBD
export const MAX_ASSET_DATA_SIZE_BYTES = 18;
export const SIGNATURE_LENGTH_BYTES = 64;

Expand Down
4 changes: 2 additions & 2 deletions framework/src/engine/consensus/consensus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { ApplyPenaltyError } from '../../errors';
import { AbortError, ApplyPenaltyAndRestartError, RestartError } from './synchronizer/errors';
import { BlockExecutor } from './synchronizer/type';
import { Network } from '../network';
import { NetworkEndpoint, EndpointArgs } from './network_endpoint';
import { NetworkEndpoint } from './network_endpoint';
import { LegacyNetworkEndpoint } from '../legacy/network_endpoint';
import { EventPostBlockData, postBlockEventSchema } from './schema';
import {
Expand Down Expand Up @@ -158,7 +158,7 @@ export class Consensus {
network: this._network,
db: this._db,
commitPool: this._commitPool,
} as EndpointArgs); // TODO: Remove casting in issue where commitPool is added here
});
this._legacyEndpoint = new LegacyNetworkEndpoint({
logger: this._logger,
network: this._network,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,7 @@ import { getMainchainID } from './utils';
export abstract class BaseInteroperabilityMethod<
T extends BaseInteroperabilityInternalMethod,
> extends BaseMethod {
protected _tokenMethod!: TokenMethod & {
payMessageFee: (
context: MethodContext,
payFromAddress: Buffer,
fee: bigint,
receivingChainID: Buffer,
) => Promise<void>;
};
protected _tokenMethod!: TokenMethod;

public constructor(
stores: NamedRegistry,
Expand All @@ -55,17 +48,7 @@ export abstract class BaseInteroperabilityMethod<
super(stores, events);
}

public addDependencies(
tokenMethod: TokenMethod & {
// TODO: Remove this after token module update
payMessageFee: (
context: MethodContext,
payFromAddress: Buffer,
fee: bigint,
receivingChainID: Buffer,
) => Promise<void>;
},
) {
public addDependencies(tokenMethod: TokenMethod) {
this._tokenMethod = tokenMethod;
}

Expand Down
1 change: 0 additions & 1 deletion framework/src/modules/interoperability/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ export const getMainchainID = (chainID: Buffer): Buffer => {
return Buffer.concat([networkID, Buffer.alloc(CHAIN_ID_LENGTH - 1, 0)]);
};

// TODO: Update to use Token method after merging development
export const getTokenIDLSK = (chainID: Buffer): Buffer => {
const networkID = chainID.subarray(0, 1);
// 3 bytes for remaining chainID bytes
Expand Down
13 changes: 2 additions & 11 deletions framework/src/modules/token/stores/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* Removal or modification of this copyright notice is prohibited.
*/
import { NotFoundError } from '@liskhq/lisk-db';
import { BaseStore, ImmutableStoreGetter, StoreGetter } from '../../base_store';
import { MAX_MODULE_NAME_LENGTH, MIN_MODULE_NAME_LENGTH, TOKEN_ID_LENGTH } from '../constants';
import { BaseStore, StoreGetter } from '../../base_store';
import { MAX_MODULE_NAME_LENGTH, MIN_MODULE_NAME_LENGTH } from '../constants';
import { TokenID } from '../types';

export interface UserStoreData {
Expand Down Expand Up @@ -53,15 +53,6 @@ export const userStoreSchema = {
export class UserStore extends BaseStore<UserStoreData> {
public schema = userStoreSchema;

// TODO: Remove this function when updating the methods
public async accountExist(context: ImmutableStoreGetter, address: Buffer): Promise<boolean> {
const allUserData = await this.iterate(context, {
gte: Buffer.concat([address, Buffer.alloc(TOKEN_ID_LENGTH, 0)]),
lte: Buffer.concat([address, Buffer.alloc(TOKEN_ID_LENGTH, 255)]),
});
return allUserData.length !== 0;
}

public async createDefaultAccount(
context: StoreGetter,
address: Buffer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ describe('Base interoperability internal method', () => {
},
];

// TODO: I have no idea why `$title` is not working, fix this
it.each(testCases)('$title', async ({ changedValues }) => {
// Assign
const isValueChanged = await interopMod.stores
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ describe('Validator registration command', () => {
'hex',
);

// TODO: move this function to utils and import from all other tests using it
const checkEventResult = (
eventQueue: EventQueue,
EventClass: any,
Expand Down

0 comments on commit 2d69d97

Please sign in to comment.