Skip to content
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

feat!: allow Operator to revoke himself #893

Merged
merged 6 commits into from
Feb 28, 2024
Merged

feat!: allow Operator to revoke himself #893

merged 6 commits into from
Feb 28, 2024

Conversation

YamenMerhi
Copy link
Member

What does this PR introduce?

⚠️ BREAKING CHANGES

🚀 Feature

  • allow Operator to revoke himself from LSP7 and LSP8
  • Allow sending tokens to self

PR Checklist

  • Wrote Tests
  • Wrote & Generated Documentation (readme/natspec/dodoc)
  • Ran npm run lint && npm run lint:solidity (solhint)
  • Ran npm run format (prettier)
  • Ran npm run build
  • Ran npm run test

Copy link
Contributor

👋 Hello
⛽ I am the Gas Bot Reporter. I keep track of the gas costs of common interactions using Universal Profiles 🆙 !
📊 Here is a summary of the gas cost with the code introduced by this PR.

⛽📊 Gas Benchmark Report

Deployment Costs

Deployed contracts ⛽ Deployment cost
UniversalProfile 3168335 (0 )
KeyManager 3659003 (0 )
LSP1DelegateUP 1637510 (0 )
LSP7Mintable 2460693 (52,870 📈❌)
LSP8Mintable 2841547 (-12 📉✅)

Runtime Costs

UniversalProfile owned by an 🔑 EOA

🔀 execute scenarios

execute scenarios - UP owned by 🔑 EOA ⛽ Gas Usage
Transfer 1 LYX to an EOA without data 37572 (0 )
Transfer 1 LYX to a UP without data 46265 (0 )
Transfer 1 LYX to an EOA with 256 bytes of data 42233 (0 )
Transfer 1 LYX to a UP with 256 bytes of data 57174 (-24 📉✅)
Transfer 0.1 LYX to 3x EOA without data 70898 (0 )
Transfer 0.1 LYX to 3x UP without data 104489 (0 )
Transfer 0.1 LYX to 3x EOA with 256 bytes of data 84874 (36 📈❌)
Transfer 0.1 LYX to 3x UPs with 256 bytes of data 137173 (-108 📉✅)

🗄️ setData scenarios

setData scenarios - UP owned by 🔑 EOA ⛽ Gas Usage
Set a 20 bytes long value 49921 (0 )
Set a 60 bytes long value 95231 (0 )
Set a 160 bytes long value 164415 (0 )
Set a 300 bytes long value 279284 (0 )
Set a 600 bytes long value 486620 (-48 📉✅)
Change the value of a data key already set 32809 (0 )
Remove the value of a data key already set 27283 (0 )
Set 2 data keys of 20 bytes long value 78428 (-12 📉✅)
Set 2 data keys of 100 bytes long value 260580 (-24 📉✅)
Set 3 data keys of 20 bytes long value 105128 (0 )
Change the value of three data keys already set of 20 bytes long value 45428 (12 📈❌)
Remove the value of three data keys already set 41325 (0 )

🗄️ Tokens scenarios

Tokens scenarios - UP owned by 🔑 EOA ⛽ Gas Usage
Minting a LSP7Token to a UP (No Delegate) from an EOA 93023 (-91 📉✅)
Minting a LSP7Token to an EOA from an EOA 59300 (-90 📉✅)
Transferring an LSP7Token from a UP to another UP (No Delegate) 102217 (-150 📉✅)
Minting a LSP8Token to a UP (No Delegate) from an EOA 160165 (0 )
Minting a LSP8Token to an EOA from an EOA 126442 (0 )
Transferring an LSP8Token from a UP to another UP (No Delegate) 151088 (-59 📉✅)
UniversalProfile owned by a 🔒📄 LSP6KeyManager

🔀 execute scenarios

execute scenarios 👑 main controller 🛃 restricted controller
LYX transfer --> to an EOA 64365 (0 ) 75316 (0 )
LYX transfer --> to a UP 78508 (0 ) 93410 (0 )
LSP7 token transfer --> to an EOA 116723 (-149 📉✅) 131473 (-149 📉✅)
LSP7 token transfer --> to a UP 250368 (-150 📉✅) 265118 (-150 📉✅)
LSP8 NFT transfer --> to an EOA 180986 (-59 📉✅) 195736 (-59 📉✅)
LSP8 NFT transfer --> to a UP 297834 (-59 📉✅) 312584 (-59 📉✅)

🗄️ setData scenarios

setData scenarios 👑 main controller 🛃 restricted controller
Update Profile details (LSP3Profile Metadata) 67264 (0 ) 77286 (0 )
Add a new controller with permission to SET_DATA + 3x allowed data keys:
AddressPermissions[]
+ AddressPermissions[index]
+ AddressPermissions:Permissions:<controller>
+ AddressPermissions:AllowedERC725YDataKeys:<controller)
209516 (0 ) 219673 (0 )
Update permissions of previous controller. Allow it now to SUPER_SETDATA 52292 (0 ) 55298 (0 )
Remove a controller:
1. decrease AddressPermissions[] Array length
2. remove the controller address at AddressPermissions[index]
3. set "0x" for the controller permissions under AddressPermissions:Permissions:
78765 (0 ) 90064 (0 )
Write 5x new LSP12 Issued Assets 66959 (0 ) 101586 (0 )
Update 3x data keys (first 3) 125411 (0 ) 159515 (0 )
Update 3x data keys (middle 3) 105499 (0 ) 143669 (0 )
Update 3x data keys (last 3) 125411 (0 ) 169002 (0 )
Set 2 x new data keys + add 3x new controllers 810121 (0 ) 871921 (0 )

Copy link
Contributor

github-actions bot commented Feb 27, 2024

Changes to gas cost

Generated at commit: 40727239bf7d7bf1a19f6277614f68e491f43236, compared to commit: 0433a6b60f0cea17b78d24b063737cd4094c8f02

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %
LSP6SetDataRestrictedController execute +35,933 ❌ +104.82%
LSP6SetDataUnrestrictedController execute +35,933 ❌ +104.82%
LSP6ExecuteRestrictedController transferTokensToRandomEOA +51,072 ❌ +67.79%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
LSP6SetDataRestrictedController 3,328,091 (+292,992) execute
givePermissionsToController
restrictControllerToERC725YKeys
61,103 (+30,794)
157,999 (+35,400)
174,445 (+32,920)
+101.60%
+28.87%
+23.26%
70,214 (+35,933)
157,999 (+35,400)
174,445 (+32,920)
+104.82%
+28.87%
+23.26%
70,214 (+35,933)
157,999 (+35,400)
174,445 (+32,920)
+104.82%
+28.87%
+23.26%
79,326 (+41,072)
157,999 (+35,400)
174,445 (+32,920)
+107.37%
+28.87%
+23.26%
2 (0)
1 (0)
1 (0)
LSP6SetDataUnrestrictedController 3,328,091 (+292,992) execute
givePermissionsToController
restrictControllerToERC725YKeys
61,103 (+30,794)
157,999 (+29,400)
174,445 (+24,420)
+101.60%
+22.86%
+16.28%
70,214 (+35,933)
157,999 (+29,400)
174,445 (+24,420)
+104.82%
+22.86%
+16.28%
70,214 (+35,933)
157,999 (+29,400)
174,445 (+24,420)
+104.82%
+22.86%
+16.28%
79,326 (+41,072)
157,999 (+29,400)
174,445 (+24,420)
+107.37%
+22.86%
+16.28%
2 (0)
1 (0)
1 (0)
LSP6ExecuteRestrictedController 3,341,198 (+294,084) transferLYXToEOA
transferLYXToUP
transferNFTToRandomEOA
transferNFTToRandomUP
transferTokensToRandomEOA
transferTokensToRandomUP
94,807 (+32,628)
76,880 (+21,587)
220,358 (+77,032)
352,748 (+103,500)
126,408 (+51,072)
258,583 (+52,126)
+52.47%
+39.04%
+53.75%
+41.52%
+67.79%
+25.25%
94,807 (+32,628)
76,880 (+21,587)
220,358 (+77,032)
352,748 (+103,500)
126,408 (+51,072)
258,583 (+52,126)
+52.47%
+39.04%
+53.75%
+41.52%
+67.79%
+25.25%
94,807 (+32,628)
76,880 (+21,587)
220,358 (+77,032)
352,748 (+103,500)
126,408 (+51,072)
258,583 (+52,126)
+52.47%
+39.04%
+53.75%
+41.52%
+67.79%
+25.25%
94,807 (+32,628)
76,880 (+21,587)
220,358 (+77,032)
352,748 (+103,500)
126,408 (+51,072)
258,583 (+52,126)
+52.47%
+39.04%
+53.75%
+41.52%
+67.79%
+25.25%
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
LSP6ExecuteUnrestrictedController 3,341,198 (+294,084) transferLYXToEOA
transferLYXToUP
transferNFTToRandomEOA
transferNFTToRandomUP
transferTokensToRandomEOA
transferTokensToRandomUP
83,291 (+20,725)
76,880 (+19,987)
208,788 (+66,718)
341,178 (+93,186)
114,838 (+40,758)
247,013 (+42,126)
+33.13%
+35.13%
+46.96%
+37.58%
+55.02%
+20.56%
83,291 (+20,725)
76,880 (+19,987)
208,788 (+66,718)
341,178 (+93,186)
114,838 (+40,758)
247,013 (+42,126)
+33.13%
+35.13%
+46.96%
+37.58%
+55.02%
+20.56%
83,291 (+20,725)
76,880 (+19,987)
208,788 (+66,718)
341,178 (+93,186)
114,838 (+40,758)
247,013 (+42,126)
+33.13%
+35.13%
+46.96%
+37.58%
+55.02%
+20.56%
83,291 (+20,725)
76,880 (+19,987)
208,788 (+66,718)
341,178 (+93,186)
114,838 (+40,758)
247,013 (+42,126)
+33.13%
+35.13%
+46.96%
+37.58%
+55.02%
+20.56%
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)

Copy link
Member

@CJ42 CJ42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added review comments

@CJ42
Copy link
Member

CJ42 commented Feb 28, 2024

Super! Let's get this new feature in develop! ⭐

@CJ42 CJ42 merged commit f4b21eb into develop Feb 28, 2024
43 checks passed
@CJ42 CJ42 deleted the token/improvements branch February 28, 2024 12:37
@YamenMerhi YamenMerhi restored the token/improvements branch March 1, 2024 21:12
@richtera richtera mentioned this pull request Mar 6, 2024
6 tasks
richtera pushed a commit that referenced this pull request Mar 6, 2024
* feat!: allow operator to revoke himself

* test: add test for operator revoking himself

* refactor!: change LSP7 interfaceId

* chore: fix parameter and generate natspec

* chore: do suggested changes

---------

Co-authored-by: Jean Cvllr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants