fix collision of content address in case of reorg#116
fix collision of content address in case of reorg#116elv-gilles wants to merge 5 commits intodevelopfrom
Conversation
* use CREATE2 opcode to deploy content * MISSING: fic build scripts and generate new version+tag
|
I think |
not from solidity. Instead of |
|
We could also require the user to send a value (clients would take the user's nonce per default). This would make an API change, so we could add a function, the old one calling the new one with nonce at zero. And in |
|
Adding a new function and having the user submit the nonce sounds good to me - like that we enable bulk operations, but also remain backwards-compatible. The salt should always include the block.Number, even if a nonce (or some other value...) is submitted: |
…tentType, uint64 _nonce)
* to avoid (potential) collision with user's nonce on a young chain
|
@elv-gilles how do we deploy this? Doesn't this require a new space? |
No, I believe this is not required, 'just' updating the space factories. |
Relates to: content-fabric/1763
CREATE2opcode to deploy contentCurrent code use the
CREATEopcode to deploy contents, which uses the address of the caller and its nonce.Since the caller is always the
BaseContentFactoryof the space, this results in creating the same content address for distinct users, should the users do the call in parallel. In case of reorg, one of the users wins and the other is left with the address of a content which he does not own.Unit-tests
TestCreateContentMultipleUsers* in qluvio/content-fabric#2397 show the problem and/or the fix.Instead, using the
CREATE2opcode (see eip-1014 allows using a 'salt' parameter which we can craft to depend on the actual user (with addresstx.origin) requesting the content creation.also tried to get rid of the copy/pastedcurrentObjBininContentFactoryHelperby usingtype(BaseContent).creationCodebut this always resulted in revert during content creation.May someone have a closer look at this (or give a hint) ?
some links: