From 69034ae2e092f2c56b74029114eecdb257de918a Mon Sep 17 00:00:00 2001 From: SonYoungsung Date: Thu, 9 Jan 2025 16:39:09 +0900 Subject: [PATCH] feat(synthesizer): remove a subcircuit list from opEntry --- .../frontend/synthesizer/src/opcodes/codes.ts | 59 +++++++------------ 1 file changed, 22 insertions(+), 37 deletions(-) diff --git a/packages/frontend/synthesizer/src/opcodes/codes.ts b/packages/frontend/synthesizer/src/opcodes/codes.ts index 6f9bc8e..0b9c8dc 100644 --- a/packages/frontend/synthesizer/src/opcodes/codes.ts +++ b/packages/frontend/synthesizer/src/opcodes/codes.ts @@ -1,18 +1,16 @@ import { Hardfork } from '@ethereumjs/common' -import { subcircuits } from '../tokamak/resources/subcircuitInfo.js' import { handlers } from './functions.js' import { dynamicGasHandlers } from './gas.js' import { getFullname } from './util.js' -import type { SubcircuitCode, SubcircuitId } from '../tokamak/types/index.js' import type { CustomOpcode } from '../types.js' import type { OpHandler } from './functions.js' import type { AsyncDynamicGasHandler, SyncDynamicGasHandler } from './gas.js' import type { Common } from '@ethereumjs/common' -import { SynthesizerHandler } from './synthesizer/types.js' -import { synthesizerHandlers } from './synthesizer/handlers.js' +// import { SynthesizerHandler } from './synthesizer/types.js' +// import { synthesizerHandlers } from './synthesizer/handlers.js' export class Opcode { readonly code: number readonly name: string @@ -405,7 +403,6 @@ type OpcodeContext = { dynamicGasHandlers: Map handlers: Map opcodes: OpcodeList - subcircuitsId: SubcircuitId[] opcodeMap: OpcodeMap } @@ -413,8 +410,10 @@ export type OpcodeMapEntry = { opcodeInfo: Opcode opHandler: OpHandler gasHandler: AsyncDynamicGasHandler | SyncDynamicGasHandler - synthesizerHandler: SynthesizerHandler - subcircuit: SubcircuitCode | undefined + /** + * @todo: synthesizerHandler 추가 필요 + */ + // synthesizerHandler: SynthesizerHandler } export type OpcodeMap = OpcodeMapEntry[] @@ -486,44 +485,31 @@ export function getOpcodesForHF(common: Common, customOpcodes?: CustomOpcode[]): //const dynamicGasHandlers = dynamicGasHandlersCopy //const handlers = handlersCopy const ops = createOpcodes(opcodeBuilder) - - const subcircuitsId: SubcircuitId[] = [] - - /*eslint-disable */ - subcircuits.forEach((entry) => { - subcircuitsId[entry.id] = { - code: parseInt(entry.opcode, 16), - name: entry.name, - nWire: entry.Nwires, - outIdx: entry.Out_idx[0], - nOut: entry.Out_idx[1], - inIdx: entry.In_idx[0], - nIn: entry.In_idx[1], - } - }) - const opcodeMap: OpcodeMap = [] for (const [opNumber, op] of ops) { const dynamicGas = dynamicGasHandlersCopy.get(opNumber)! const handler = handlersCopy.get(opNumber)! - const synthesizerHandler = synthesizerHandlers.get(opNumber)! - const subcircuitCode = subcircuits.find((entry) => parseInt(entry.opcode, 16) === opNumber) + /** + * @todo: synthesizerHandler 추가 필요 + */ + // const synthesizerHandler = synthesizerHandlers.get(opNumber)! + // const subcircuitCode = subcircuits.find((entry) => parseInt(entry.opcode, 16) === opNumber) opcodeMap[opNumber] = { opcodeInfo: op, opHandler: handler, gasHandler: dynamicGas, - synthesizerHandler, - subcircuit: subcircuitCode - ? { - subcircuitId: subcircuitCode.id, - nWire: subcircuitCode.Nwires, - outIdx: subcircuitCode.Out_idx[0], - nOut: subcircuitCode.Out_idx[1], - inIdx: subcircuitCode.In_idx[0], - nIn: subcircuitCode.In_idx[1], - } - : undefined, + // synthesizerHandler, + // subcircuit: subcircuitCode + // ? { + // subcircuitId: subcircuitCode.id, + // nWire: subcircuitCode.Nwires, + // outIdx: subcircuitCode.Out_idx[0], + // nOut: subcircuitCode.Out_idx[1], + // inIdx: subcircuitCode.In_idx[0], + // nIn: subcircuitCode.In_idx[1], + // } + // : undefined, } } @@ -539,7 +525,6 @@ export function getOpcodesForHF(common: Common, customOpcodes?: CustomOpcode[]): dynamicGasHandlers: dynamicGasHandlersCopy, handlers: handlersCopy, opcodes: ops, - subcircuitsId, opcodeMap, } }