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(contracts): ValueRouter #4814

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

feat(contracts): ValueRouter #4814

wants to merge 27 commits into from

Conversation

aroralanuk
Copy link
Contributor

@aroralanuk aroralanuk commented Nov 5, 2024

Description

Drive-by changes

  • overrideMsgValue and overrideGasLimit which actually override the respective fields

Related issues

Backward compatibility

Yes

Testing

Unit

yorhodes and others added 3 commits October 22, 2024 20:45
…#4729)

### Description

- implements `_outbound` and `_inbound` internal amount transforms for
use in scaling warp routes
- simplify `HypNativeScaled` implementation

### Backward compatibility

Yes

### Testing

Existing HypNative Scaled Unit Tests
…4673)

### Description

- fixes misuse of aggregation hook funds for relaying messages by making
sure msg.value is adequate and refunding if excess.

### Drive-by changes

- None

### Related issues

- related to
#3437

### Backward compatibility

No, needs new deployments of aggregationHooks

### Testing

Unit
Copy link

changeset-bot bot commented Nov 5, 2024

🦋 Changeset detected

Latest commit: 13e79af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@hyperlane-xyz/core Minor
@hyperlane-xyz/helloworld Patch
@hyperlane-xyz/sdk Patch
@hyperlane-xyz/infra Patch
@hyperlane-xyz/cli Patch
@hyperlane-xyz/widgets Patch
@hyperlane-xyz/ccip-server Patch
@hyperlane-xyz/github-proxy Patch
@hyperlane-xyz/utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@aroralanuk aroralanuk changed the base branch from audit-q3-2024 to main November 7, 2024 12:14
@aroralanuk aroralanuk marked this pull request as ready for review November 7, 2024 12:55
solidity/contracts/token/HypValue.sol Outdated Show resolved Hide resolved
solidity/contracts/hooks/OPL2ToL1Hook.sol Outdated Show resolved Hide resolved
Comment on lines +182 to +183
gasLimit(_metadata, 0),
refundAddress(_metadata, msg.sender),
Copy link
Member

Choose a reason for hiding this comment

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

I dont understand the 0 and msg.sender here
this will also memcopy for every field iiuc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these are just default values in case the specific part of the metadata is null
true but memcopy is cheap

Copy link
Member

@yorhodes yorhodes Nov 9, 2024

Choose a reason for hiding this comment

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

0 gas limit and msg.sender for refund address as defaults does not make sense to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what would you have in their place?

solidity/contracts/token/HypValue.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypValue.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypValue.sol Outdated Show resolved Hide resolved
solidity/test/token/HypValue.t.sol Outdated Show resolved Hide resolved
solidity/test/token/HypValue.t.sol Outdated Show resolved Hide resolved
solidity/test/token/HypValue.t.sol Outdated Show resolved Hide resolved
solidity/test/token/HypValue.t.sol Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 77.58%. Comparing base (ea75978) to head (13e79af).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4814      +/-   ##
==========================================
+ Coverage   77.53%   77.58%   +0.05%     
==========================================
  Files         103      104       +1     
  Lines        2110     2124      +14     
  Branches      190      190              
==========================================
+ Hits         1636     1648      +12     
- Misses        453      455       +2     
  Partials       21       21              
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 79.57% <100.00%> (+0.18%) ⬆️
isms 83.68% <ø> (ø)
token 90.90% <81.81%> (-0.37%) ⬇️
middlewares 79.80% <ø> (ø)

solidity/contracts/hooks/OPL2ToL1Hook.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypNative.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypNative.sol Outdated Show resolved Hide resolved
Comment on lines 105 to 109
bytes calldata emptyBytes;
assembly {
emptyBytes.length := 0
emptyBytes.offset := 0
}
Copy link
Member

Choose a reason for hiding this comment

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

we do not use inline assembly anywhere else, please do not introduce it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

need a way to do bytes memory to calldata

solidity/test/token/HypNative.t.sol Outdated Show resolved Hide resolved
@aroralanuk aroralanuk requested a review from yorhodes November 28, 2024 08:59
solidity/contracts/token/HypNativeCollateral.sol Dismissed Show dismissed Hide dismissed
solidity/contracts/token/HypNativeCollateral.sol Dismissed Show dismissed Hide dismissed
solidity/contracts/hooks/libs/StandardHookMetadata.sol Outdated Show resolved Hide resolved
solidity/test/isms/ExternalBridgeTest.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypNative.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypNative.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypNative.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypNative.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypNativeCollateral.sol Outdated Show resolved Hide resolved
solidity/contracts/token/HypNative.sol Dismissed Show dismissed Hide dismissed
@@ -0,0 +1,84 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity >=0.8.0;

Check notice

Code scanning / Olympix Integrated Security

Using an unbounded pragma for Solidity version may be unsafe if future versions introduce breaking changes. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unbounded-pragma Low

Using an unbounded pragma for Solidity version may be unsafe if future versions introduce breaking changes. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/unbounded-pragma
solidity/contracts/token/HypNativeCollateral.sol Dismissed Show dismissed Hide dismissed
* @notice This contract facilitates the transfer of value between chains using value transfer hooks
*/
contract HypNativeCollateral is HypNative {
constructor(address _mailbox) HypNative(_mailbox) {}

Check notice

Code scanning / Olympix Integrated Security

Test functions fail to thoroughly test all aspects of contract constructors, potentially missing critical initialization issues. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/incomplete-constructor-tests Low

Test functions fail to thoroughly test all aspects of contract constructors, potentially missing critical initialization issues. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/incomplete-constructor-tests
* @notice This contract facilitates the transfer of value between chains using value transfer hooks
*/
contract HypNativeCollateral is HypNative {
constructor(address _mailbox) HypNative(_mailbox) {}

Check notice

Code scanning / Olympix Integrated Security

Parameters passed to a constructor that are not validated for correct values may lead to contract creation in an undesired state. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/no-parameter-validation-in-constructor Low

Parameters passed to a constructor that are not validated for correct values may lead to contract creation in an undesired state. For more information, visit: http://detectors.olympixdevsectools.com/article/web3-vulnerability/no-parameter-validation-in-constructor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review
Development

Successfully merging this pull request may close these issues.

2 participants