improve bytecode match

pull/7/head
yann300 5 years ago
parent d72551df4d
commit d7b71e52f3
  1. 2
      remix-debug/src/debugger/debugger.js
  2. 16
      remix-lib/src/util.js
  3. 7
      remix-lib/test/util.js

@ -110,7 +110,7 @@ Debugger.prototype.debugTx = function (tx, loadingCb) {
this.vmDebuggerLogic.event.trigger('sourceLocationChanged', [sourceLocation]) 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 = new VmDebuggerLogic(this.debugger, tx, this.step_manager, this.debugger.traceManager, this.debugger.codeManager, this.debugger.solidityProxy, this.debugger.callTree)
this.vmDebuggerLogic.start() this.vmDebuggerLogic.start()

@ -193,6 +193,19 @@ module.exports = {
return /a265627a7a72305820([0-9a-f]{64})64736f6c6343([0-9a-f]{6})0032$/ 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) { extractSwarmHash: function (value) {
value = value.replace(this.swarmHashExtraction(), '') value = value.replace(this.swarmHashExtraction(), '')
value = value.replace(this.swarmHashExtractionPOC31(), '') value = value.replace(this.swarmHashExtractionPOC31(), '')
@ -224,7 +237,10 @@ module.exports = {
code1 = replaceLibReference(code1, pos) code1 = replaceLibReference(code1, pos)
} }
code1 = this.extractSwarmHash(code1) code1 = this.extractSwarmHash(code1)
code1 = this.extractcborMetadata(code1)
code2 = this.extractSwarmHash(code2) code2 = this.extractSwarmHash(code2)
code2 = this.extractcborMetadata(code2)
if (code1 && code2 && code1.indexOf(code2) === 0) { if (code1 && code2 && code1.indexOf(code2) === 0) {
return true return true
} }

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save