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: send Merkle roots #55

Merged
merged 6 commits into from
Mar 19, 2025
Merged

feat: send Merkle roots #55

merged 6 commits into from
Mar 19, 2025

Conversation

0xIryna
Copy link
Collaborator

@0xIryna 0xIryna commented Mar 6, 2025

Proposed changes:

  • add an owner-only function to set Merkle Tree Builder contract to HubPortal
  • add sendMerkleRoots function to HubPortal that reads earners and earn managers Merkle tree roots, adds them to the additional payload and sends zero amount transfer message with this additional payload to Solana

Copy link

github-actions bot commented Mar 6, 2025

Changes to gas cost

Generated at commit: 33881281bbfba04f78f048f2c3b943afe30a6f66, compared to commit: dbe93da561c94dfc04beec8a144b11b287957b7a

🧾 Summary (20% most significant diffs)

Contract Method Avg (+/-) %
HubPortal currentIndex
owner
+67 ❌
+64 ❌
+3.95%
+2.67%
SpokePortal currentIndex +24 ❌ +2.17%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
HubPortal 5,843,628 (-188,036) attestationReceived
chainId
currentIndex
disableEarning
enableEarning
initialize
mode
owner
registrar
sendMTokenIndex
sendRegistrarKey
sendRegistrarListStatus
setPeer
setSupportedBridgingPath
setTransceiver
tokenDecimals
transfer
transferMLikeToken
54,200 (+257)
293 (-22)
841 (+67)
2,454 (-16)
2,634 (+6)
127,237 (+90)
309 (-22)
2,463 (+64)
305 (-22)
3,157 (+71)
5,976 (+93)
6,424 (+95)
54,101 (+18)
27,402 (-22)
188,482 (+14)
3,821 (+71)
129,405 (+770)
122,537 (+703)
+0.48%
-6.98%
+8.66%
-0.65%
+0.23%
+0.07%
-6.65%
+2.67%
-6.73%
+2.30%
+1.58%
+1.50%
+0.03%
-0.08%
+0.01%
+1.89%
+0.60%
+0.58%
82,824 (+266)
293 (-22)
1,765 (+67)
10,107 (-13)
30,728 (+1)
127,240 (+90)
309 (-22)
2,463 (+64)
305 (-22)
37,019 (+184)
37,472 (+206)
38,089 (+208)
54,101 (+18)
27,402 (-22)
188,482 (+14)
3,821 (+71)
129,405 (+770)
145,031 (+709)
+0.32%
-6.98%
+3.95%
-0.13%
+0.00%
+0.07%
-6.65%
+2.67%
-6.73%
+0.50%
+0.55%
+0.55%
+0.03%
-0.08%
+0.01%
+1.89%
+0.60%
+0.49%
92,366 (+269)
293 (-22)
1,761 (+67)
12,659 (-12)
29,571 (0)
127,237 (+90)
309 (-22)
2,463 (+64)
305 (-22)
37,019 (+184)
37,472 (+206)
38,089 (+208)
54,101 (+18)
27,402 (-22)
188,482 (+14)
3,821 (+71)
129,405 (+770)
145,031 (+709)
+0.29%
-6.98%
+3.96%
-0.09%
0.00%
+0.07%
-6.65%
+2.67%
-6.73%
+0.50%
+0.55%
+0.55%
+0.03%
-0.08%
+0.01%
+1.89%
+0.60%
+0.49%
92,366 (+269)
293 (-22)
2,708 (+67)
12,659 (-12)
62,809 (0)
127,283 (+90)
309 (-22)
2,463 (+64)
305 (-22)
70,881 (+296)
68,968 (+318)
69,754 (+320)
54,101 (+18)
27,402 (-22)
188,482 (+14)
3,821 (+71)
129,405 (+770)
167,526 (+715)
+0.29%
-6.98%
+2.54%
-0.09%
0.00%
+0.07%
-6.65%
+2.67%
-6.73%
+0.42%
+0.46%
+0.46%
+0.03%
-0.08%
+0.01%
+1.89%
+0.60%
+0.43%
4 (0)
1 (0)
6 (0)
4 (0)
11 (0)
25 (+1)
1 (0)
2 (0)
1 (0)
2 (0)
2 (0)
2 (0)
46 (+24)
92 (+4)
25 (+1)
2 (0)
1 (0)
2 (0)
SpokePortal 5,482,133 (-347,597) attestationReceived
currentIndex
initialize
setPeer
setTransceiver
transfer
transferMLikeToken
54,156 (+279)
1,129 (+24)
127,215 (+90)
54,079 (+18)
188,482 (+36)
131,365 (+1,209)
131,506 (+1,209)
+0.52%
+2.17%
+0.07%
+0.03%
+0.02%
+0.93%
+0.93%
105,505 (+291)
1,129 (+24)
127,215 (+90)
54,079 (+18)
188,482 (+36)
131,365 (+1,209)
153,978 (+1,215)
+0.28%
+2.17%
+0.07%
+0.03%
+0.02%
+0.93%
+0.80%
112,050 (+321)
1,129 (+24)
127,215 (+90)
54,079 (+18)
188,482 (+36)
131,365 (+1,209)
153,978 (+1,215)
+0.29%
+2.17%
+0.07%
+0.03%
+0.02%
+0.93%
+0.80%
217,340 (+333)
1,129 (+24)
127,215 (+90)
54,079 (+18)
188,482 (+36)
131,365 (+1,209)
176,450 (+1,221)
+0.15%
+2.17%
+0.07%
+0.03%
+0.02%
+0.93%
+0.70%
11 (0)
1 (0)
16 (0)
16 (0)
16 (0)
1 (0)
2 (0)

Copy link

github-actions bot commented Mar 6, 2025

LCOV of commit 6fa72eb during Forge Coverage #251

Summary coverage rate:
  lines......: 99.2% (260 of 262 lines)
  functions..: 96.5% (55 of 57 functions)
  branches...: 96.6% (28 of 29 branches)

Files changed coverage rate:
                             |Lines       |Functions  |Branches    
  Filename                   |Rate     Num|Rate    Num|Rate     Num
  =================================================================
  src/HubPortal.sol          |22.0%     50| 0.0%    11|    -      0
  src/Portal.sol             |22.6%     93| 100%    19|    -      0
  src/libs/PayloadEncoder.sol|20.4%     49| 0.0%    10|    -      0

@0xIryna 0xIryna marked this pull request as ready for review March 6, 2025 15:47

/// @inheritdoc IHubPortal
function setMerkleTreeBuilder(address merkleTreeBuilder_) external onlyOwner {
merkleTreeBuilder = merkleTreeBuilder_;
Copy link
Member

Choose a reason for hiding this comment

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

Could be useful to check that the address being set is not address zero.
Even if it can be set at any time.

@0xIryna 0xIryna force-pushed the feat/portal-solana-support branch from cb4bf04 to 3483da6 Compare March 19, 2025 19:11
@0xIryna 0xIryna merged commit 34c8304 into main Mar 19, 2025
4 checks passed
@0xIryna 0xIryna deleted the feat/portal-solana-support branch March 19, 2025 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants