From 8190995d6f2e51b27cd0b531906bf8702444da20 Mon Sep 17 00:00:00 2001 From: Sam MacPherson Date: Wed, 5 Jun 2024 19:05:27 +0900 Subject: [PATCH] change cctp authority type --- src/receivers/CCTPReceiver.sol | 10 +++++----- test/CircleCCTPIntegration.t.sol | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/receivers/CCTPReceiver.sol b/src/receivers/CCTPReceiver.sol index 5b2206d..04bc204 100644 --- a/src/receivers/CCTPReceiver.sol +++ b/src/receivers/CCTPReceiver.sol @@ -9,13 +9,13 @@ contract CCTPReceiver { address public immutable destinationMessenger; uint32 public immutable sourceDomainId; - address public immutable sourceAuthority; + bytes32 public immutable sourceAuthority; address public immutable target; constructor( address _destinationMessenger, uint32 _sourceDomainId, - address _sourceAuthority, + bytes32 _sourceAuthority, address _target ) { destinationMessenger = _destinationMessenger; @@ -29,9 +29,9 @@ contract CCTPReceiver { bytes32 sender, bytes calldata messageBody ) external returns (bool) { - require(msg.sender == destinationMessenger, "CCTPReceiver/invalid-sender"); - require(sourceDomainId == sourceDomain, "CCTPReceiver/invalid-sourceDomain"); - require(sender == bytes32(uint256(uint160(sourceAuthority))), "CCTPReceiver/invalid-sourceAuthority"); + require(msg.sender == destinationMessenger, "CCTPReceiver/invalid-sender"); + require(sourceDomainId == sourceDomain, "CCTPReceiver/invalid-sourceDomain"); + require(sender == sourceAuthority, "CCTPReceiver/invalid-sourceAuthority"); (bool success, bytes memory ret) = target.call(messageBody); if (!success) { diff --git a/test/CircleCCTPIntegration.t.sol b/test/CircleCCTPIntegration.t.sol index 267a66d..0f262de 100644 --- a/test/CircleCCTPIntegration.t.sol +++ b/test/CircleCCTPIntegration.t.sol @@ -77,11 +77,11 @@ contract CircleCCTPIntegrationTest is IntegrationBaseTest { } function initSourceReceiver() internal override returns (address) { - return address(new CCTPReceiver(bridge.sourceCrossChainMessenger, destinationDomainId, destinationAuthority, address(moSource))); + return address(new CCTPReceiver(bridge.sourceCrossChainMessenger, destinationDomainId, bytes32(uint256(uint160(destinationAuthority))), address(moSource))); } function initDestinationReceiver() internal override returns (address) { - return address(new CCTPReceiver(bridge.destinationCrossChainMessenger, sourceDomainId, sourceAuthority, address(moDestination))); + return address(new CCTPReceiver(bridge.destinationCrossChainMessenger, sourceDomainId, bytes32(uint256(uint160(sourceAuthority))), address(moDestination))); } function initBridgeTesting() internal override returns (Bridge memory) {