Commit d7b71e52 authored by yann300's avatar yann300

improve bytecode match

parent d72551df
......@@ -110,7 +110,7 @@ Debugger.prototype.debugTx = function (tx, loadingCb) {
this.vmDebuggerLogic.event.trigger('sourceLocationChanged', [sourceLocation])
}
})
})
})
this.vmDebuggerLogic = new VmDebuggerLogic(this.debugger, tx, this.step_manager, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree)
this.vmDebuggerLogic.start()
......
......@@ -193,6 +193,19 @@ module.exports = {
return /a265627a7a72305820([0-9a-f]{64})64736f6c6343([0-9a-f]{6})0032$/
},
/**
* return a regex which extract the cbor encoded metadata : {"ipfs": <IPFS hash>, "solc": <compiler version>} from the bytecode.
* ref https://solidity.readthedocs.io/en/v0.6.6/metadata.html?highlight=ipfs#encoding-of-the-metadata-hash-in-the-bytecode
* @return {RegEx}
*/
cborEncodedValueExtraction: function () {
return /64697066735822([0-9a-f]{68})64736f6c6343([0-9a-f]{6})0033$/
},
extractcborMetadata: function (value) {
return value.replace(this.cborEncodedValueExtraction(), '')
},
extractSwarmHash: function (value) {
value = value.replace(this.swarmHashExtraction(), '')
value = value.replace(this.swarmHashExtractionPOC31(), '')
......@@ -224,7 +237,10 @@ module.exports = {
code1 = replaceLibReference(code1, pos)
}
code1 = this.extractSwarmHash(code1)
code1 = this.extractcborMetadata(code1)
code2 = this.extractSwarmHash(code2)
code2 = this.extractcborMetadata(code2)
if (code1 && code2 && code1.indexOf(code2) === 0) {
return true
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment