-
Notifications
You must be signed in to change notification settings - Fork 565
Conversation
remix-lib/src/util.js
Outdated
@@ -187,6 +187,11 @@ module.exports = { | |||
if (code1 === code2) return true | |||
if (code2 === '0x') return false // abstract contract. see comment | |||
|
|||
if (code2.substr(4, 40) === '0000000000000000000000000000000000000000') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should also check for the push opcode to be safe.
Perhaps even check for the entire signature from here https://github.com/ethereum/solidity/blob/develop/libsolidity/codegen/ContractCompiler.cpp#L277 :
PUSH20 00..00 ADDRESS EQ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done ;)
remix-lib/src/util.js
Outdated
if (code2.substr(4, 40) === '0000000000000000000000000000000000000000') { | ||
// in the context of a library, that slot contains the address of the library (pushed by the compiler to avoid calling library other than with a DELEGATECALL) | ||
// if code2 is not a library, well we still suppose that the comparison remain relevant even if we remove some information from `code1` | ||
code1 = replaceLibReference(code1, 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will replace 32 bytes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not, should be 20 bytes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaceLibReference
seems to have a lot of zero padding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaceLibReference
inject a null address, so I think that is ok here..
0cbfb3b
to
b358155
Compare
In the context of a library, deployed bytecode contains the address of the library (pushed by the compiler to avoid calling library other than with a DELEGATECALL)
If code2 is not a library, we still suppose that the comparison remains relevant even if we remove some information from
code1