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

refactor!: Roll back to old LSP1UniversalReceiverDelegate Interface and functions #741

Merged
merged 11 commits into from
Oct 13, 2023

Conversation

YamenMerhi
Copy link
Member

@YamenMerhi YamenMerhi commented Oct 10, 2023

What does this PR introduce?

⚠️ BREAKING CHANGES

♻️ Refactor

  • Add UniversalReceiverDelegate Interface and functions
  • InterfaceId of LSP1Delegate: 0xa245bbda

The UniversalReceiverDelegate will include the universalReceiverDelegate function having two additional parameter than universalReceiver which are the:

  • caller: the address who called the universalReceiver
  • value: the amount sent by the address who called the universalReceiver

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 10, 2023

Changes to gas cost

Generated at commit: b549bdac7115f58ba95f2bc18a1a8b64296fe691, compared to commit: b8eca3c5696acf85239130ef67edec9e8c134bfa

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %
LSP6ExecuteRestrictedController transferLYXToUP +11,279 ❌ +35.81%
LSP6ExecuteUnrestrictedController transferLYXToUP +10,879 ❌ +32.48%
LSP6SetDataRestrictedController execute +6,081 ❌ +21.31%
LSP6SetDataUnrestrictedController execute +6,081 ❌ +21.31%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
LSP6ExecuteRestrictedController 2,898,727 (+23,036) lsp20VerifyCall
transferLYXToEOA
transferLYXToUP
transferNFTToRandomEOA
transferNFTToRandomUP
transferTokensToRandomEOA
transferTokensToRandomUP
14,657 (-239)
62,528 (+6,363)
42,775 (+11,279)
144,412 (+13,643)
251,112 (+11,798)
74,592 (+900)
206,610 (-2,549)
-1.60%
+11.33%
+35.81%
+10.43%
+4.93%
+1.22%
-1.22%
16,856 (-176)
62,528 (+6,363)
42,775 (+11,279)
144,412 (+13,643)
251,112 (+11,798)
74,592 (+900)
206,610 (-2,549)
-1.03%
+11.33%
+35.81%
+10.43%
+4.93%
+1.22%
-1.22%
17,589 (-156)
62,528 (+6,363)
42,775 (+11,279)
144,412 (+13,643)
251,112 (+11,798)
74,592 (+900)
206,610 (-2,549)
-0.88%
+11.33%
+35.81%
+10.43%
+4.93%
+1.22%
-1.22%
17,589 (-156)
62,528 (+6,363)
42,775 (+11,279)
144,412 (+13,643)
251,112 (+11,798)
74,592 (+900)
206,610 (-2,549)
-0.88%
+11.33%
+35.81%
+10.43%
+4.93%
+1.22%
-1.22%
8 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
LSP6ExecuteUnrestrictedController 2,898,727 (+23,036) lsp20VerifyCall
transferLYXToEOA
transferLYXToUP
transferNFTToRandomEOA
transferNFTToRandomUP
transferTokensToRandomEOA
transferTokensToRandomUP
14,657 (-239)
63,032 (+6,237)
44,375 (+10,879)
143,161 (+13,643)
249,861 (+11,798)
73,340 (+1,212)
205,046 (-2,549)
-1.60%
+10.98%
+32.48%
+10.53%
+4.96%
+1.68%
-1.23%
16,856 (-176)
63,032 (+6,237)
44,375 (+10,879)
143,161 (+13,643)
249,861 (+11,798)
73,340 (+1,212)
205,046 (-2,549)
-1.03%
+10.98%
+32.48%
+10.53%
+4.96%
+1.68%
-1.23%
17,589 (-156)
63,032 (+6,237)
44,375 (+10,879)
143,161 (+13,643)
249,861 (+11,798)
73,340 (+1,212)
205,046 (-2,549)
-0.88%
+10.98%
+32.48%
+10.53%
+4.96%
+1.68%
-1.23%
17,589 (-156)
63,032 (+6,237)
44,375 (+10,879)
143,161 (+13,643)
249,861 (+11,798)
73,340 (+1,212)
205,046 (-2,549)
-0.88%
+10.98%
+32.48%
+10.53%
+4.96%
+1.68%
-1.23%
8 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
LSP6SetDataRestrictedController 2,883,512 (+23,044) execute
givePermissionsToController
restrictControllerToERC725YKeys
30,770 (+12,280)
122,881 (+2,247)
141,590 (+2,706)
+66.41%
+1.86%
+1.95%
34,616 (+6,081)
122,881 (+2,247)
141,590 (+2,706)
+21.31%
+1.86%
+1.95%
34,616 (+6,081)
122,881 (+2,247)
141,590 (+2,706)
+21.31%
+1.86%
+1.95%
38,463 (-118)
122,881 (+2,247)
141,590 (+2,706)
-0.31%
+1.86%
+1.95%
2 (0)
1 (0)
1 (0)
LSP6SetDataUnrestrictedController 2,883,512 (+23,044) execute
givePermissionsToController
restrictControllerToERC725YKeys
30,770 (+12,280)
128,881 (+2,247)
150,090 (+2,706)
+66.41%
+1.77%
+1.84%
34,616 (+6,081)
128,881 (+2,247)
150,090 (+2,706)
+21.31%
+1.77%
+1.84%
34,616 (+6,081)
128,881 (+2,247)
150,090 (+2,706)
+21.31%
+1.77%
+1.84%
38,463 (-118)
128,881 (+2,247)
150,090 (+2,706)
-0.31%
+1.77%
+1.84%
2 (0)
1 (0)
1 (0)

@github-actions
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 2970423 (-36,782 📉✅)
KeyManager 3473495 (0 )
LSP1DelegateUP 1587926 (-35,866 📉✅)
LSP7Mintable 2354082 (0 )
LSP8Mintable 2476554 (0 )

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 37537 (0 )
Transfer 1 LYX to a UP without data 36639 (0 )
Transfer 1 LYX to an EOA with 256 bytes of data 42210 (12 📈❌)
Transfer 1 LYX to a UP with 256 bytes of data 44867 (12 📈❌)
Transfer 0.1 LYX to 3x EOA without data 70862 (0 )
Transfer 0.1 LYX to 3x UP without data 75680 (0 )
Transfer 0.1 LYX to 3x EOA with 256 bytes of data 84802 (-24 📉✅)
Transfer 0.1 LYX to 3x UPs with 256 bytes of data 100357 (0 )

🗄️ setData scenarios

setData scenarios - UP owned by 🔑 EOA ⛽ Gas Usage
Set a 20 bytes long value 49971 (0 )
Set a 60 bytes long value 95281 (0 )
Set a 160 bytes long value 164465 (0 )
Set a 300 bytes long value 279676 (-12 📉✅)
Set a 600 bytes long value 484124 (36 📈❌)
Change the value of a data key already set 32847 (-12 📉✅)
Remove the value of a data key already set 27333 (0 )
Set 2 data keys of 20 bytes long value 78454 (0 )
Set 2 data keys of 100 bytes long value 260582 (-36 📉✅)
Set 3 data keys of 20 bytes long value 105171 (0 )
Change the value of three data keys already set of 20 bytes long value 45471 (0 )
Remove the value of three data keys already set 41360 (0 )

🗄️ Tokens scenarios

Tokens scenarios - UP owned by 🔑 EOA ⛽ Gas Usage
Minting a LSP7Token to a UP (No Delegate) from an EOA 91982 (0 )
Minting a LSP7Token to an EOA from an EOA 59289 (0 )
Transferring an LSP7Token from a UP to another UP (No Delegate) 100092 (0 )
Minting a LSP8Token to a UP (No Delegate) from an EOA 159126 (0 )
Minting a LSP8Token to an EOA from an EOA 126433 (0 )
Transferring an LSP8Token from a UP to another UP (No Delegate) 148899 (0 )
UniversalProfile owned by a 🔒📄 LSP6KeyManager

🔀 execute scenarios

execute scenarios 👑 main controller 🛃 restricted controller
LYX transfer --> to an EOA 66102 (0 ) 76895 (0 )
LYX transfer --> to a UP 67384 (0 ) 79366 (0 )
LSP7 token transfer --> to an EOA 117834 (-2,317 📉✅) 132525 (-2,317 📉✅)
LSP7 token transfer --> to a UP 252048 (-4,633 📉✅) 266739 (-4,633 📉✅)
LSP8 NFT transfer --> to an EOA 182077 (-2,317 📉✅) 196745 (-2,317 📉✅)
LSP8 NFT transfer --> to a UP 299538 (-4,633 📉✅) 314206 (-4,633 📉✅)

🗄️ setData scenarios

setData scenarios 👑 main controller 🛃 restricted controller
Update Profile details (LSP3Profile Metadata) 68689 (0 ) 78688 (0 )
Add a new controller with permission to SET_DATA + 3x allowed data keys:
AddressPermissions[]
+ AddressPermissions[index]
+ AddressPermissions:Permissions:<controller>
+ AddressPermissions:AllowedERC725YDataKeys:<controller)
212087 (0 ) 222152 (0 )
Update permissions of previous controller. Allow it now to SUPER_SETDATA 53576 (0 ) 56559 (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:
80542 (0 ) 91767 (0 )
Write 5x new LSP12 Issued Assets 68242 (0 ) 102846 (0 )
Update 3x data keys (first 3) 127530 (0 ) 161611 (0 )
Update 3x data keys (middle 3) 107618 (0 ) 145765 (0 )
Update 3x data keys (last 3) 127530 (0 ) 171098 (0 )
Set 2 x new data keys + add 3x new controllers 815975 (0 ) 877522 (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.

Let's make sure the universalReceiverDelegate functions (in both the contracts/ and the Mock contracts) that inherit the ILSP1Delegate interface have the override keyword, so that they can be compiled with old solc versions and so that the CI passes once it is merged ✅

@CJ42 CJ42 changed the title refactor!: Add UniversalReceiverDelegate Interface and functions refactor!: Roll back to LSP1UniversalReceiverDelegate Interface and functions Oct 11, 2023
@CJ42 CJ42 changed the title refactor!: Roll back to LSP1UniversalReceiverDelegate Interface and functions refactor!: Roll back to old LSP1UniversalReceiverDelegate Interface and functions Oct 11, 2023
@CJ42 CJ42 merged commit dab41a1 into develop Oct 13, 2023
@CJ42 CJ42 deleted the revert/UniversalReceiverDelegate branch October 13, 2023 11:36
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