-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EIP 1820: Pseudo-introspection Registry Contract #1820
Conversation
b1838c1
to
0932df9
Compare
How about using CREATE2 as a deployment method with predictable address instead of currently used one? I can prepare PR, if you agree. |
This would be good idea if there is a standarized Factory contract. But in the while I think it's better to stick to the current method. |
Sounds like idea for hobby project and one more EIP ;) |
@Arachnid, @cdetrio, @Souptacular, @vbuterin, @nicksavers, @wanderer, may I ask one of you to merge this draft. It is a replacement for EIP820 which was broken by the Solidity 0.5 update. See #820 and #1758 for more information. Thank you. |
@nicksavers Thank you for merging. I send a message to @jbaylina and he should confirm himself he is an author soon. (He is traveling right now, but hopefully he should have 5min and internet at some point this weekend.) Regarding the status of 820, it was my understanding that things had to happen in the following order:
If you would like me to do things in a different order, that's fine. Just let me know. |
That order seems to just fine to me. |
@nicksavers I confirm that I'm the coauthor of ERC820 and ERC1820. And I'm working together with @0xjac . |
Review from @mcdee:
|
I reviewed the 165 part, everything looks good. 👍 |
How to add this to an already deployed token? |
@mcdee Regarding the The @fulldecent Thank you for your review. @lrgeoemtry What type of contract, 777? My suggestion at this time is to wait a couple weeks and wait for 777 to be finalized. If you want to deploy a token sooner, add a function which can change set the address of the registry once and call that function once ERC777 is final. Quick, dirty and not audited example given without any guarantee: MyToken is ERC777Token {
ERC1820Registry registry;
bool registrySet;
setERC1820Registry(address _registry) {
require(!registrySet);
registry = ERC1820Registry(_registry);
registrySet = true;
}
// ERC777 functions ...
} |
@0xjac if |
@mcdee it is but
Therefore I have removed it. It trigger a change of address but there is no change to the code so previous reviews still apply.
The address is 0x1820a4b7618bde71dce8cdc73aab6c95905fad24. I am meeting with Jordi tomorrow to finish 777 |
There was no significant changes and no functional changes to ERC1820. Thanks to @mcdee and @fulldecent for the reviews. @nicksavers Could you please merge #1919 and make 1820 final? Thanks |
How is this standard to be used for local testing? Obviously there is the testnet deployments but compiling the registry contract locally yields a different contract address than the 0x1820 vanity via truffle or remix either forced to 0.5.3 or otherwise. I suppose we should plug in the contract address during construction and store it rather than use a constant? |
@AC0DEM0NK3Y you could deploy the bytecode in the ERC directly as a truffle migration, as per https://github.com/wealdtech/wealdtech-solidity/blob/master/migrations/2_erc1820.js |
Hi, there is a bug in the current 1820 implementation due to the mechanism used to check for EIP-165 interfaces. I posted the issue in detail on EIP-165 github issue here where the bug is also present in the example on how to read an ERC165 contract. The basic problem for EIP-1820 is that when a contract call The parent call conclude wrongly that the contract is not supporting the interface in question. If this was used as a last check and that enough gas is available to complete the call (EIP-150 give While there might be no EIP-165 If we could make sure that no contract in existence implement One possible workaround would be for the caller of Also note that the cache should not be at risk though since it requires much more gas than was can be left as per EIP-150 rules. As such another workaround would for the caller of EIP-1820 to first update the cache. In my opinion, it would be better to fix the issue rather than using such workaround. There are few ways to properly fix it in the EIP-1820 implementation (see EIP-165's discussion ) but the best option is the solution proposed by #1930 itself. It would be great to get this in in the next hardfork, or at least get the conversation going since this is an issue affecting other use-cases like meta-transaction. |
@wighawag I think that the easy way is to force in ERC-165 that the gas price must be under 20000 (Or some value that make sense). I would like to see the real use case where you need more than 20000 gas. |
yes, I am not sure why 30,000 was allowed in the first place. We should check if there is no existing contract out there that use that amount of gas though since changing ERC-165 that way would break them. But note that while 20,000 might work for 1820 (a closer look is required), ERC165 checker implementation used elsewhere can have the problem with 10,000 gas (maybe lower) |
As mentioned there is a test case here : https://github.com/wighawag/ethereum_gas/blob/master/test/testERC1820.js You can think of it this way:
Because of the bug it is possible for
|
Thank you for the comprehensive references. There's a lot of code there. Which code do I need to run, preferably in Remix IDE, to minimally demonstrate the problem? |
for 1820 you can look at
for 165:
|
This is a replacement for 820.
If It should change the following code |
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.
- [ ]
New EIP: Pseudo-introspection Registry Contract
This is a replacement for 820.