Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add no-commented-out-code #239

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": ["airbnb-base", "airbnb-typescript/base", "plugin:prettier/recommended", "plugin:eslint-comments/recommended", "plugin:sonarjs/recommended"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "sonarjs"],
"plugins": ["@typescript-eslint", "sonarjs", "etc"],
"root": true,
"parserOptions": {
"project": ["./tsconfig.json", "./test/tsconfig.json"]
Expand Down Expand Up @@ -91,7 +91,8 @@
"sonarjs/no-duplicate-string": "off",
// Handled by prettier
"@typescript-eslint/indent": ["off"],
"@typescript-eslint/no-floating-promises": "error"
"@typescript-eslint/no-floating-promises": "error",
"etc/no-commented-out-code": "error"
},

"overrides": [
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-etc": "^2.0.2",
"eslint-plugin-etc": "^2.0.3",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-sonarjs": "^0.25.1",
Expand Down
5 changes: 0 additions & 5 deletions packages/common/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ export interface ToJSONableStatic {
toJSON: (value: unknown) => any;
}

// export interface ProofTypes {
// publicOutputType?: ToFieldableStatic;
// publicInputType?: ToFieldableStatic;
// }

export type ProofTypes =
| typeof Proof<unknown, unknown>
| typeof DynamicProof<unknown, unknown>;
Expand Down
1 change: 0 additions & 1 deletion packages/library/src/hooks/RuntimeFeeAnalyzerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ export class RuntimeFeeAnalyzerService extends ConfigurableModule<RuntimeFeeAnal
// eslint-disable-next-line @typescript-eslint/no-shadow
([values, indexes], combinedMethodName) => {
const { rows } = analyzedMethods[combinedMethodName];
// const rows = 1000;
const [moduleName, methodName] = combinedMethodName.split(".");
const methodId = this.runtime.methodIdResolver.getMethodId(
moduleName,
Expand Down
3 changes: 0 additions & 3 deletions packages/library/src/math/UInt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export abstract class UInt<BITS extends number> extends Struct({
}) {
public static readonly assertionFunction: (bool: Bool, msg?: string) => void =
(bool, msg) => {
// const executionContext = container.resolve(RuntimeMethodExecutionContext);
assert(bool, msg);
};

Expand Down Expand Up @@ -82,8 +81,6 @@ export abstract class UInt<BITS extends number> extends Struct({
if (bits === 256) {
throw errors.usageWith256BitsForbidden();
}

// this.checkConstant(value.value);
}

public abstract numBits(): BITS;
Expand Down
1 change: 0 additions & 1 deletion packages/library/src/sequencer/InMemorySequencerModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class InMemorySequencerModules {
BlockProducerModule,
BlockTrigger: ManualBlockTrigger,
TaskQueue: LocalTaskQueue,
// SettlementModule: SettlementModule,
...additionalModules,
} satisfies InMemorySequencerModulesRecord;
}
Expand Down
1 change: 0 additions & 1 deletion packages/processor/test/HandlersExecutor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ describe("HandlersModule", () => {
onBlock: [trackBalanceOnBlockHandler],
};

// const client = createPrismaMock<PrismaClient>();
const client = mockDeep<PrismaClient>();
// @ts-expect-error
client.$transaction.mockImplementation((transaction) => {
Expand Down
5 changes: 0 additions & 5 deletions packages/protocol/src/prover/block/BlockProver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,6 @@ export class BlockProverProgrammable extends ZkProgrammable<
// TODO Not possible atm bcs we can't have a seperation between protocol/runtime state roots,
// which we would for both before and after to be able to emit STs

// stateTransitionProof.publicInput.protocolTransitionsHash.assertEquals(
// beforeBlockHashList.commitment
// );
// state.stateRoot = stateTransitionProof.publicInput.protocolStateRoot;

// TODO Only for now
beforeBlockHashList.commitment.assertEquals(
Field(0),
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol/test/StateTransition.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint etc/no-commented-out-code:
*/
import "reflect-metadata";
import { InMemoryMerkleTreeStorage } from "@proto-kit/common";
import { Bool, Field } from "o1js";
Expand Down
11 changes: 0 additions & 11 deletions packages/sdk/src/appChain/AppChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,8 @@ export class AppChain<
this.resolve("Protocol");
this.resolve("Sequencer");

// // Workaround to get protocol and sequencer to have
// // access to the same WitnessProviderReference
// const reference = new StateTransitionWitnessProviderReference();
// this.registerValue({
// StateTransitionWitnessProviderReference: reference,
// });

// console.log("creating sequencer");
// this.sequencer.create(() => this.container);

await this.protocol.start();

// this.runtime.start();
await this.sequencer.start();
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/test/minting-error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ describe("balances", () => {
});

it("regression - transfer from and to same account does not cause minting error", async () => {
// expect.assertions(2);
const faucet = appChain.runtime.resolve("Faucet");
const balancesRuntime = appChain.runtime.resolve("Balances");

Expand Down
2 changes: 0 additions & 2 deletions packages/sdk/test/networkstate/NetworkState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ describe.skip("block production", () => {
const tokenId = TokenId.from(0);

beforeEach(async () => {
// container.reset();

log.setLevel(log.levels.INFO);

const app = TestingAppChain.fromRuntime({
Expand Down
1 change: 0 additions & 1 deletion packages/sequencer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export * from "./sequencer/builder/SequencerModule";
export * from "./worker/flow/Flow";
export * from "./worker/flow/Task";
export * from "./worker/flow/JSONTaskSerializer";
// export * from "./worker/queue/BullQueue";
export * from "./worker/queue/TaskQueue";
export * from "./worker/queue/LocalTaskQueue";
export * from "./worker/worker/FlowTaskWorker";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ export class TransactionTraceService {

const tree = new RollupMerkleTree(merkleStore);
const runtimeTree = new RollupMerkleTree(runtimeSimulationMerkleStore);
// const runtimeTree = new RollupMerkleTree(merkleStore);
const initialRoot = tree.getRoot();

const transitionsList = new DefaultProvableHashList(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ export class MinaSimulationService {
.with({ error: undefined }, (v) => v.account)
.exhaustive();

// this.ledger.addAccount(Ml.fromPublicKey(publicKey));

if (account !== undefined) {
addCachedAccount(account);
}
Expand Down
1 change: 0 additions & 1 deletion packages/sequencer/test/TestingSequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export function testingSequencerFromModules<
Database: InMemoryDatabase,
Mempool: PrivateMempool,
BaseLayer: NoopBaseLayer,
// LocalTaskWorkerModule: taskWorkerModule,
BatchProducerModule,
BlockProducerModule,
BlockTrigger: ManualBlockTrigger,
Expand Down
6 changes: 0 additions & 6 deletions packages/sequencer/test/integration/BlockProduction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,13 @@ describe("block production", () => {
ProtocolStateTestHook: typeof ProtocolStateTestHook;
}
>;
// let protocol: Protocol<VanillaProtocolModulesRecord>;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
let appChain: AppChain<any, any, any, any>;

let blockTrigger: ManualBlockTrigger;
let mempool: PrivateMempool;

beforeEach(async () => {
// container.reset();

log.setLevel(log.levels.INFO);

const runtimeClass = Runtime.from({
Expand All @@ -118,7 +114,6 @@ describe("block production", () => {
modules: VanillaProtocolModules.mandatoryModules({
ProtocolStateTestHook,
}),
// modules: VanillaProtocolModules.with({}),
});

const app = AppChain.from({
Expand Down Expand Up @@ -185,7 +180,6 @@ describe("block production", () => {
})
);

// let [block, batch] = await blockTrigger.produceBlockAndBatch();
let block = await blockTrigger.produceBlock();

expect(block).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ describe.each([["InMemory", InMemoryDatabase]])(
let unprovenState: AsyncStateService;
let provenState: AsyncStateService;

// let unprovenTreeStore: AsyncMerkleTreeStore;
// let provenTreeStore: AsyncMerkleTreeStore;

const sk = PrivateKey.random();
const pk = sk.toPublicKey();
let pkNonce = 0;
Expand Down
3 changes: 0 additions & 3 deletions packages/sequencer/test/integration/mocks/Balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ export class Balance extends RuntimeModule<object> {
await this.totalSupply.get();
}

// @runtimeMethod()
// public test(a: UInt64, b: Signature, c: MyStruct, d: Struct<unknown>) {}

@runtimeMethod()
public async setTotalSupply() {
await this.totalSupply.set(UInt64.from(20));
Expand Down
3 changes: 3 additions & 0 deletions packages/sequencer/test/settlement/Settlement-unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { expect } from "@jest/globals";
/* eslint etc/no-commented-out-code:
*/

// import { Actions } from "o1js/dist/node/lib/account_update";
// import {
// ACTIONS_EMPTY_HASH,
Expand Down
4 changes: 0 additions & 4 deletions packages/sequencer/test/settlement/Settlement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ export const settlementTestFn = (
sequencerKey.toPublicKey(),
20 * 1e9
);

// const acc2 = await fetchAccount({ publicKey: accs[0].toPublicKey() });
}, timeout);

let nonceCounter = 0;
Expand Down Expand Up @@ -399,7 +397,6 @@ export const settlementTestFn = (
}
);
settlementModule.signTransaction(usertx, [testAccounts[1]]);
// await usertx.send();

await appChain.sequencer
.resolveOrFail("TransactionSender", MinaTransactionSender)
Expand Down Expand Up @@ -475,7 +472,6 @@ export const settlementTestFn = (
async () => {
const mintAU = AccountUpdate.create(userKey.toPublicKey());
mintAU.balance.addInPlace(amount);
// mintAU.requireSignature(); // TODO ?
await settlement.redeem(mintAU);
}
);
Expand Down
3 changes: 3 additions & 0 deletions packages/sequencer/test/worker/Worker.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* eslint etc/no-commented-out-code:
*/

import "reflect-metadata";

import { beforeAll } from "@jest/globals";
Expand Down
30 changes: 1 addition & 29 deletions packages/stack/src/scripts/graphql/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export class TestBalances extends Balances {
* We use `satisfies` here in order to be able to access
* presets by key in a type safe way.
*/
// public static presets = {} satisfies Presets<object>;

@state() public totalSupply = State.from<UInt64>(UInt64);

Expand Down Expand Up @@ -101,7 +100,6 @@ export async function startServer() {
Sequencer: Sequencer.from({
modules: {
Database: InMemoryDatabase,
// Database: PrismaRedisDatabase,

Mempool: PrivateMempool,
GraphqlServer,
Expand All @@ -113,7 +111,6 @@ export async function startServer() {
BlockProducerModule,
BlockTrigger: ManualBlockTrigger,
TaskQueue: LocalTaskQueue,
// SettlementModule: SettlementModule,

Graphql: GraphqlSequencerModule.from({
modules: {
Expand Down Expand Up @@ -171,10 +168,6 @@ export async function startServer() {
host: "0.0.0.0",
graphiql: true,
},
// SettlementModule: {
// address: PrivateKey.random().toPublicKey(),
// feepayer: PrivateKey.random(),
// },

Graphql: {
QueryGraphqlModule: {},
Expand All @@ -185,30 +178,12 @@ export async function startServer() {
MerkleWitnessResolver: {},
},

Database: {
// redis: {
// host: "localhost",
// port: 6379,
// password: "password",
// },
// prisma: {
// connection: {
// host: "localhost",
// password: "password",
// username: "user",
// port: 5432,
// db: {
// name: "protokit",
// },
// },
// },
},
Database: {},

Mempool: {},
BatchProducerModule: {},
LocalTaskWorkerModule: {
StateTransitionTask: {},
// SettlementProvingTask: {},
BlockBuildingTask: {},
BlockProvingTask: {},
BlockReductionTask: {},
Expand Down Expand Up @@ -237,9 +212,6 @@ export async function startServer() {
});

await appChain.start(container.createChildContainer());
// const pk = PublicKey.fromBase58(
// "B62qmETai5Y8vvrmWSU8F4NX7pTyPqYLMhc1pgX3wD8dGc2wbCWUcqP"
// );

const balances = appChain.runtime.resolve("Balances");

Expand Down
1 change: 0 additions & 1 deletion packages/stack/src/scripts/worker/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ sequencer.configure({
},
TaskQueue: {
redis: {
// host: "protokit-redis",
host: "localhost",
port: 6379,
password: "password",
Expand Down
2 changes: 2 additions & 0 deletions packages/stack/src/start.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// TODO: ressurrect during lightnet integration
/* eslint etc/no-commented-out-code:
*/
// import {
// Environments,
// Environment,
Expand Down
Loading