@@ -43,10 +43,15 @@ export class DebuggerController extends Controller {
4343 blockchainBasicAuthPassword
4444 } as Web3Configuration
4545 const contractBlocks : CFGContract = await this . cfgService . buildCFGFromSource ( name , source . request , path )
46- const runtimeRawBytecode = contractBlocks . contractRuntime . rawBytecode . startsWith ( '0x' ) ? contractBlocks . contractRuntime . rawBytecode : `0x${ contractBlocks . contractRuntime . rawBytecode } `
47- const trace : DebugTrace = await this . transactionService . findTransactionTrace ( tx , runtimeRawBytecode , config )
48- const cfg = this . createCFG ( contractBlocks , false , trace )
49- return this . buildResponse ( contractBlocks , false , cfg , trace )
46+ const transaction = await this . transactionService . findTransaction ( tx , config )
47+ const isConstructor = transaction . to ? false : true
48+ let rawBytecode = contractBlocks . contractRuntime . rawBytecode . startsWith ( '0x' ) ? contractBlocks . contractRuntime . rawBytecode : `0x${ contractBlocks . contractRuntime . rawBytecode } `
49+ if ( isConstructor ) {
50+ rawBytecode = contractBlocks . contractConstructor . rawBytecode . startsWith ( '0x' ) ? contractBlocks . contractConstructor . rawBytecode : `0x${ contractBlocks . contractConstructor . rawBytecode } `
51+ }
52+ const trace : DebugTrace = await this . transactionService . findTransactionTrace ( tx , rawBytecode , config )
53+ const cfg = this . createCFG ( contractBlocks , isConstructor , trace )
54+ return this . buildResponse ( contractBlocks , isConstructor , cfg , trace )
5055 } catch ( err ) {
5156 logger . error ( err )
5257 throw new Error ( err . message )
0 commit comments