Skip to content

Commit

Permalink
evm: Fix minor issues from PR#4 (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley authored Dec 23, 2024
1 parent 04afa0f commit 8f539ee
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 29 deletions.
5 changes: 4 additions & 1 deletion evm/src/NttManager/ManagerBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ abstract contract ManagerBase is
function transferOwnership(
address newOwner
) public override onlyOwner {
// TODO: Just delete this function and let the Ownable one be called directly?
// It's intentional (at this time) that we are not transferring the endpoint admin.
// The endpoint functions are all called by the NttManager, which means the admin
// must remain the NttManager.
super.transferOwnership(newOwner);
}

Expand Down Expand Up @@ -354,6 +356,7 @@ abstract contract ManagerBase is
assert(this.mode() == mode);
assert(this.chainId() == chainId);
assert(this.endpoint() == endpoint);
assert(this.executor() == executor);
}

function _checkThresholdInvariants() internal view {
Expand Down
5 changes: 3 additions & 2 deletions evm/src/NttManager/NttManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,13 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
args.amount.untrim(tokenDecimals()),
args.epTotalPriceQuote,
args.recipientChain,
args.sequence,
payloadHash
args.sequence
);

uint128 gasLimit = peerData.gasLimit;
if (gasLimit == 0) {
// The gas limit can only be zero when a contract has been migrated from an older version,
// where the gasLimit was not defined in the manager peer struct and was not set during the upgrade.
revert InvalidGasLimitZero(args.recipientChain);
}

Expand Down
5 changes: 2 additions & 3 deletions evm/src/interfaces/INttManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface INttManager is IManagerBase {

/// @notice Emitted when a message is sent from the nttManager.
/// @dev Topic0
/// 0x75eb8927cc7c4810b30fa2e8011fce37da6da7d18eb82c642c367ae4445c3625.
/// 0xe54e51e42099622516fa3b48e9733581c9dbdcb771cafb093f745a0532a35982.
/// @param recipient The recipient of the message.
/// @param refundAddress The address on the destination chain to which the
/// refund of unused gas will be paid
Expand All @@ -32,8 +32,7 @@ interface INttManager is IManagerBase {
uint256 amount,
uint256 fee,
uint16 recipientChain,
uint64 msgSequence,
bytes32 msgHash
uint64 msgSequence
);

/// @notice Emitted when a message is sent from the nttManager.
Expand Down
12 changes: 0 additions & 12 deletions evm/src/libraries/TransceiverHelpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,3 @@ function countSetBits(

return count;
}

// @dev Count the number of set bits in a uint128
function countSetBits128(
uint128 x
) pure returns (uint8 count) {
while (x != 0) {
x &= x - 1;
count++;
}

return count;
}
8 changes: 0 additions & 8 deletions evm/test/interfaces/ITransceiverReceiver.sol

This file was deleted.

6 changes: 3 additions & 3 deletions evm/test/libraries/TransceiverHelpers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ library TransceiverHelpersLib {
for (uint256 idx = 0; idx < events.length; ++idx) {
if (
events[idx].topics[0]
== bytes32(0x75eb8927cc7c4810b30fa2e8011fce37da6da7d18eb82c642c367ae4445c3625)
== bytes32(0xe54e51e42099622516fa3b48e9733581c9dbdcb771cafb093f745a0532a35982)
&& events[idx].emitter == nttManager
) {
(,,, uint64 sequence,) =
abi.decode(events[idx].data, (uint256, uint256, uint16, uint64, bytes32));
(,,, uint64 sequence) =
abi.decode(events[idx].data, (uint256, uint256, uint16, uint64));

if (sequence == nttSeqNo) {
// The next event in the log should be from the executor
Expand Down

0 comments on commit 8f539ee

Please sign in to comment.