AmbireTech / adex-protocol-eth

Ethereum implementation of the Ambire Protocol: Ambire Wallet contracts and AdEx payment channels
https://www.ambire.com
MIT License
49 stars 24 forks source link

Identity: v5.2: optimizations and SC signature support #159

Closed Ivshti closed 3 years ago

Ivshti commented 3 years ago

We need a round of improvements to the Identity/IdentityFactory system

End goals

End goal: deploy & make it work with opensea through WalletConnect; on Polygon too

To be implemented

Ivshti commented 3 years ago

Work in progress decisions & research

Ivshti commented 3 years ago

How to generate min proxy code

sstore code: {pushVal}{val}7f{slotHash}55,

0x{sstoreCode}3d602d8060{codeOffset}3d3981f3363d3d373d3d3d363d73{masterContract}5af43d82803e903d91602b57fd5bf3

example

> require('./js/IdentityProxyDeploy').getMappingSstore(0, 'address', '0xe5a4Dad2Ea987215460379Ab285DF87136E83BEA','0x01')
'sstore(0x02c94ba85f2ea274a3869293a0a9bf447d073c83c617963b0be7c862ec2ee44e, 0x01)'

starting with deploy code 0x3d602d80600a3d3981f3363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af43d82803e903d91602b57fd5bf3 (taken from https://github.com/optionality/clone-factory/blob/master/contracts/CloneFactory.sol#L32 )

then 6001 to push the val (push1 0x01), followed by 7f{slotHash}55 
replace bebebebebebebebe
finally, 60e2 instead of 600a to adjust the start of the code 

0x60017f02c94ba85f2ea274a3869293a0a9bf447d073c83c617963b0be7c862ec2ee44e553d602d80602e3d3981f3363d3d373d3d3d363d7302a63ec1bced5545296a5193e652e25ec0bae4105af43d82803e903d91602b57fd5bf3
Ivshti commented 3 years ago

Decided against specific anti-bricking mechanisms in QuickAccManager

The reason for this is that code becomes complicated with two separate schedule/execscheduled routines

We can employ off-chain anti bricking by tracking scheduled txns; if one doesn't make sense (eg no adex control after it), cancel it; we have to simulate executeBySender() call with all the txns