From 50560da83c00803da790c740cbabc046eed9c27a Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:26:29 +0000 Subject: [PATCH 1/3] Add no commented out code. --- .eslintrc | 5 +++-- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.eslintrc b/.eslintrc index 91bd9533d..98adaf620 100644 --- a/.eslintrc +++ b/.eslintrc @@ -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"] @@ -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": [ diff --git a/package-lock.json b/package-lock.json index 0d6fe8bbd..cff2249da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,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", diff --git a/package.json b/package.json index e36b5474b..32b03b505 100644 --- a/package.json +++ b/package.json @@ -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", From e9b97920a021c5201565bcc75168d5280c01b8f0 Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:33:11 +0000 Subject: [PATCH 2/3] Remove commented out code to get pipeline passing --- .../src/hooks/RuntimeFeeAnalyzerService.ts | 1 - packages/library/src/math/UInt.ts | 3 -- .../src/sequencer/InMemorySequencerModules.ts | 1 - .../processor/test/HandlersExecutor.test.ts | 1 - packages/sdk/src/appChain/AppChain.ts | 11 ------- packages/sdk/test/minting-error.test.ts | 1 - .../test/networkstate/NetworkState.test.ts | 2 -- packages/sequencer/src/index.ts | 1 - .../production/TransactionTraceService.ts | 1 - .../transactions/MinaSimulationService.ts | 2 -- packages/sequencer/test/TestingSequencer.ts | 1 - .../test/integration/BlockProduction.test.ts | 6 ---- .../integration/StorageIntegration.test.ts | 3 -- .../test/integration/mocks/Balance.ts | 3 -- .../test/settlement/Settlement-unit.test.ts | 3 ++ .../sequencer/test/settlement/Settlement.ts | 4 --- packages/sequencer/test/worker/Worker.test.ts | 3 ++ packages/stack/src/scripts/graphql/server.ts | 30 +------------------ .../stack/src/scripts/worker/sequencer.ts | 1 - packages/stack/src/start.ts | 2 ++ 20 files changed, 9 insertions(+), 71 deletions(-) diff --git a/packages/library/src/hooks/RuntimeFeeAnalyzerService.ts b/packages/library/src/hooks/RuntimeFeeAnalyzerService.ts index 707d80a4c..9eb7f4a79 100644 --- a/packages/library/src/hooks/RuntimeFeeAnalyzerService.ts +++ b/packages/library/src/hooks/RuntimeFeeAnalyzerService.ts @@ -95,7 +95,6 @@ export class RuntimeFeeAnalyzerService extends ConfigurableModule { const { rows } = analyzedMethods[combinedMethodName]; - // const rows = 1000; const [moduleName, methodName] = combinedMethodName.split("."); const methodId = this.runtime.methodIdResolver.getMethodId( moduleName, diff --git a/packages/library/src/math/UInt.ts b/packages/library/src/math/UInt.ts index dd77064b3..b5a014871 100644 --- a/packages/library/src/math/UInt.ts +++ b/packages/library/src/math/UInt.ts @@ -47,7 +47,6 @@ export abstract class UInt extends Struct({ }) { public static readonly assertionFunction: (bool: Bool, msg?: string) => void = (bool, msg) => { - // const executionContext = container.resolve(RuntimeMethodExecutionContext); assert(bool, msg); }; @@ -82,8 +81,6 @@ export abstract class UInt extends Struct({ if (bits === 256) { throw errors.usageWith256BitsForbidden(); } - - // this.checkConstant(value.value); } public abstract numBits(): BITS; diff --git a/packages/library/src/sequencer/InMemorySequencerModules.ts b/packages/library/src/sequencer/InMemorySequencerModules.ts index 17f05d2cd..b0bc4d1ac 100644 --- a/packages/library/src/sequencer/InMemorySequencerModules.ts +++ b/packages/library/src/sequencer/InMemorySequencerModules.ts @@ -43,7 +43,6 @@ export class InMemorySequencerModules { BlockProducerModule, BlockTrigger: ManualBlockTrigger, TaskQueue: LocalTaskQueue, - // SettlementModule: SettlementModule, ...additionalModules, } satisfies InMemorySequencerModulesRecord; } diff --git a/packages/processor/test/HandlersExecutor.test.ts b/packages/processor/test/HandlersExecutor.test.ts index 49cf8ad15..581827eb5 100644 --- a/packages/processor/test/HandlersExecutor.test.ts +++ b/packages/processor/test/HandlersExecutor.test.ts @@ -136,7 +136,6 @@ describe("HandlersModule", () => { onBlock: [trackBalanceOnBlockHandler], }; - // const client = createPrismaMock(); const client = mockDeep(); // @ts-expect-error client.$transaction.mockImplementation((transaction) => { diff --git a/packages/sdk/src/appChain/AppChain.ts b/packages/sdk/src/appChain/AppChain.ts index d19aa71b1..8d222935a 100644 --- a/packages/sdk/src/appChain/AppChain.ts +++ b/packages/sdk/src/appChain/AppChain.ts @@ -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(); } } diff --git a/packages/sdk/test/minting-error.test.ts b/packages/sdk/test/minting-error.test.ts index 478e918aa..822f638b6 100644 --- a/packages/sdk/test/minting-error.test.ts +++ b/packages/sdk/test/minting-error.test.ts @@ -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"); diff --git a/packages/sdk/test/networkstate/NetworkState.test.ts b/packages/sdk/test/networkstate/NetworkState.test.ts index 36548f535..5cb240d01 100644 --- a/packages/sdk/test/networkstate/NetworkState.test.ts +++ b/packages/sdk/test/networkstate/NetworkState.test.ts @@ -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({ diff --git a/packages/sequencer/src/index.ts b/packages/sequencer/src/index.ts index 85c8faf55..a2a408a08 100644 --- a/packages/sequencer/src/index.ts +++ b/packages/sequencer/src/index.ts @@ -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"; diff --git a/packages/sequencer/src/protocol/production/TransactionTraceService.ts b/packages/sequencer/src/protocol/production/TransactionTraceService.ts index 0ccb5c136..a8e2f8334 100644 --- a/packages/sequencer/src/protocol/production/TransactionTraceService.ts +++ b/packages/sequencer/src/protocol/production/TransactionTraceService.ts @@ -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( diff --git a/packages/sequencer/src/settlement/transactions/MinaSimulationService.ts b/packages/sequencer/src/settlement/transactions/MinaSimulationService.ts index 236aa9c92..041656738 100644 --- a/packages/sequencer/src/settlement/transactions/MinaSimulationService.ts +++ b/packages/sequencer/src/settlement/transactions/MinaSimulationService.ts @@ -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); } diff --git a/packages/sequencer/test/TestingSequencer.ts b/packages/sequencer/test/TestingSequencer.ts index d728a588d..f34cfea21 100644 --- a/packages/sequencer/test/TestingSequencer.ts +++ b/packages/sequencer/test/TestingSequencer.ts @@ -46,7 +46,6 @@ export function testingSequencerFromModules< Database: InMemoryDatabase, Mempool: PrivateMempool, BaseLayer: NoopBaseLayer, - // LocalTaskWorkerModule: taskWorkerModule, BatchProducerModule, BlockProducerModule, BlockTrigger: ManualBlockTrigger, diff --git a/packages/sequencer/test/integration/BlockProduction.test.ts b/packages/sequencer/test/integration/BlockProduction.test.ts index f411bdbf1..f21df6787 100644 --- a/packages/sequencer/test/integration/BlockProduction.test.ts +++ b/packages/sequencer/test/integration/BlockProduction.test.ts @@ -84,8 +84,6 @@ describe("block production", () => { ProtocolStateTestHook: typeof ProtocolStateTestHook; } >; - // let protocol: Protocol; - // eslint-disable-next-line @typescript-eslint/no-unused-vars let appChain: AppChain; @@ -93,8 +91,6 @@ describe("block production", () => { let mempool: PrivateMempool; beforeEach(async () => { - // container.reset(); - log.setLevel(log.levels.INFO); const runtimeClass = Runtime.from({ @@ -118,7 +114,6 @@ describe("block production", () => { modules: VanillaProtocolModules.mandatoryModules({ ProtocolStateTestHook, }), - // modules: VanillaProtocolModules.with({}), }); const app = AppChain.from({ @@ -185,7 +180,6 @@ describe("block production", () => { }) ); - // let [block, batch] = await blockTrigger.produceBlockAndBatch(); let block = await blockTrigger.produceBlock(); expect(block).toBeDefined(); diff --git a/packages/sequencer/test/integration/StorageIntegration.test.ts b/packages/sequencer/test/integration/StorageIntegration.test.ts index 687beb163..30ddea769 100644 --- a/packages/sequencer/test/integration/StorageIntegration.test.ts +++ b/packages/sequencer/test/integration/StorageIntegration.test.ts @@ -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; diff --git a/packages/sequencer/test/integration/mocks/Balance.ts b/packages/sequencer/test/integration/mocks/Balance.ts index 1fe0c945b..4bd8f0015 100644 --- a/packages/sequencer/test/integration/mocks/Balance.ts +++ b/packages/sequencer/test/integration/mocks/Balance.ts @@ -36,9 +36,6 @@ export class Balance extends RuntimeModule { await this.totalSupply.get(); } - // @runtimeMethod() - // public test(a: UInt64, b: Signature, c: MyStruct, d: Struct) {} - @runtimeMethod() public async setTotalSupply() { await this.totalSupply.set(UInt64.from(20)); diff --git a/packages/sequencer/test/settlement/Settlement-unit.test.ts b/packages/sequencer/test/settlement/Settlement-unit.test.ts index 937c42817..25f690ae9 100644 --- a/packages/sequencer/test/settlement/Settlement-unit.test.ts +++ b/packages/sequencer/test/settlement/Settlement-unit.test.ts @@ -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, diff --git a/packages/sequencer/test/settlement/Settlement.ts b/packages/sequencer/test/settlement/Settlement.ts index 7735552fb..491dd8c04 100644 --- a/packages/sequencer/test/settlement/Settlement.ts +++ b/packages/sequencer/test/settlement/Settlement.ts @@ -241,8 +241,6 @@ export const settlementTestFn = ( sequencerKey.toPublicKey(), 20 * 1e9 ); - - // const acc2 = await fetchAccount({ publicKey: accs[0].toPublicKey() }); }, timeout); let nonceCounter = 0; @@ -399,7 +397,6 @@ export const settlementTestFn = ( } ); settlementModule.signTransaction(usertx, [testAccounts[1]]); - // await usertx.send(); await appChain.sequencer .resolveOrFail("TransactionSender", MinaTransactionSender) @@ -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); } ); diff --git a/packages/sequencer/test/worker/Worker.test.ts b/packages/sequencer/test/worker/Worker.test.ts index 42ca7c39d..fb1f9d06e 100644 --- a/packages/sequencer/test/worker/Worker.test.ts +++ b/packages/sequencer/test/worker/Worker.test.ts @@ -1,3 +1,6 @@ +/* eslint etc/no-commented-out-code: + */ + import "reflect-metadata"; import { beforeAll } from "@jest/globals"; diff --git a/packages/stack/src/scripts/graphql/server.ts b/packages/stack/src/scripts/graphql/server.ts index 6f6cc3d86..cc5102296 100644 --- a/packages/stack/src/scripts/graphql/server.ts +++ b/packages/stack/src/scripts/graphql/server.ts @@ -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; @state() public totalSupply = State.from(UInt64); @@ -101,7 +100,6 @@ export async function startServer() { Sequencer: Sequencer.from({ modules: { Database: InMemoryDatabase, - // Database: PrismaRedisDatabase, Mempool: PrivateMempool, GraphqlServer, @@ -113,7 +111,6 @@ export async function startServer() { BlockProducerModule, BlockTrigger: ManualBlockTrigger, TaskQueue: LocalTaskQueue, - // SettlementModule: SettlementModule, Graphql: GraphqlSequencerModule.from({ modules: { @@ -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: {}, @@ -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: {}, @@ -237,9 +212,6 @@ export async function startServer() { }); await appChain.start(container.createChildContainer()); - // const pk = PublicKey.fromBase58( - // "B62qmETai5Y8vvrmWSU8F4NX7pTyPqYLMhc1pgX3wD8dGc2wbCWUcqP" - // ); const balances = appChain.runtime.resolve("Balances"); diff --git a/packages/stack/src/scripts/worker/sequencer.ts b/packages/stack/src/scripts/worker/sequencer.ts index 99e9ef4b4..c86321838 100644 --- a/packages/stack/src/scripts/worker/sequencer.ts +++ b/packages/stack/src/scripts/worker/sequencer.ts @@ -59,7 +59,6 @@ sequencer.configure({ }, TaskQueue: { redis: { - // host: "protokit-redis", host: "localhost", port: 6379, password: "password", diff --git a/packages/stack/src/start.ts b/packages/stack/src/start.ts index b861e9823..5c4bf5c3e 100644 --- a/packages/stack/src/start.ts +++ b/packages/stack/src/start.ts @@ -1,4 +1,6 @@ // TODO: ressurrect during lightnet integration +/* eslint etc/no-commented-out-code: + */ // import { // Environments, // Environment, From b7b153b57bca74897f760097e64338533e43c028 Mon Sep 17 00:00:00 2001 From: ejMina226 <118474890+ejMina226@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:48:29 +0000 Subject: [PATCH 3/3] Remove further comments. --- packages/common/src/utils.ts | 5 ----- packages/protocol/src/prover/block/BlockProver.ts | 5 ----- packages/protocol/test/StateTransition.test.ts | 2 ++ 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/common/src/utils.ts b/packages/common/src/utils.ts index 41c80a381..58b629838 100644 --- a/packages/common/src/utils.ts +++ b/packages/common/src/utils.ts @@ -91,11 +91,6 @@ export interface ToJSONableStatic { toJSON: (value: unknown) => any; } -// export interface ProofTypes { -// publicOutputType?: ToFieldableStatic; -// publicInputType?: ToFieldableStatic; -// } - export type ProofTypes = | typeof Proof | typeof DynamicProof; diff --git a/packages/protocol/src/prover/block/BlockProver.ts b/packages/protocol/src/prover/block/BlockProver.ts index 04cd1440f..b53e86453 100644 --- a/packages/protocol/src/prover/block/BlockProver.ts +++ b/packages/protocol/src/prover/block/BlockProver.ts @@ -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), diff --git a/packages/protocol/test/StateTransition.test.ts b/packages/protocol/test/StateTransition.test.ts index 936d2d85d..1c9e357eb 100644 --- a/packages/protocol/test/StateTransition.test.ts +++ b/packages/protocol/test/StateTransition.test.ts @@ -1,3 +1,5 @@ +/* eslint etc/no-commented-out-code: + */ import "reflect-metadata"; import { InMemoryMerkleTreeStorage } from "@proto-kit/common"; import { Bool, Field } from "o1js";