Skip to content

Commit 214b792

Browse files
committed
Remove solana setEnableRoute special logic
1 parent c17e684 commit 214b792

File tree

2 files changed

+1
-65
lines changed

2 files changed

+1
-65
lines changed

contracts/chain-adapters/Solana_Adapter.sol

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ contract Solana_Adapter is AdapterInterface, CircleCCTPAdapter {
4141
// Solana spoke pool address, mapped to its EVM address representation.
4242
address public immutable SOLANA_SPOKE_POOL_ADDRESS;
4343

44-
// USDC mint address on Solana, decoded from Base58 to bytes32.
45-
bytes32 public immutable SOLANA_USDC_BYTES32;
46-
4744
// USDC mint address on Solana, mapped to its EVM address representation.
4845
address public immutable SOLANA_USDC_ADDRESS;
4946

@@ -56,8 +53,6 @@ contract Solana_Adapter is AdapterInterface, CircleCCTPAdapter {
5653

5754
// Custom errors for relayMessage validation.
5855
error InvalidRelayMessageTarget(address target);
59-
error InvalidOriginToken(address originToken);
60-
error InvalidDestinationChainId(uint256 destinationChainId);
6156

6257
// Custom errors for relayTokens validation.
6358
error InvalidL1Token(address l1Token);
@@ -95,7 +90,6 @@ contract Solana_Adapter is AdapterInterface, CircleCCTPAdapter {
9590
SOLANA_SPOKE_POOL_BYTES32 = solanaSpokePool;
9691
SOLANA_SPOKE_POOL_ADDRESS = solanaSpokePool.toAddressUnchecked();
9792

98-
SOLANA_USDC_BYTES32 = solanaUsdc;
9993
SOLANA_USDC_ADDRESS = solanaUsdc.toAddressUnchecked();
10094

10195
SOLANA_SPOKE_POOL_USDC_VAULT = solanaSpokePoolUsdcVault;
@@ -111,17 +105,7 @@ contract Solana_Adapter is AdapterInterface, CircleCCTPAdapter {
111105
if (target != SOLANA_SPOKE_POOL_ADDRESS) {
112106
revert InvalidRelayMessageTarget(target);
113107
}
114-
115-
bytes4 selector = bytes4(message[:4]);
116-
if (selector == bytes4(keccak256("setEnableRoute(address,uint256,bool)"))) {
117-
cctpMessageTransmitter.sendMessage(
118-
CircleDomainIds.Solana,
119-
SOLANA_SPOKE_POOL_BYTES32,
120-
_translateSetEnableRoute(message)
121-
);
122-
} else {
123-
cctpMessageTransmitter.sendMessage(CircleDomainIds.Solana, SOLANA_SPOKE_POOL_BYTES32, message);
124-
}
108+
cctpMessageTransmitter.sendMessage(CircleDomainIds.Solana, SOLANA_SPOKE_POOL_BYTES32, message);
125109

126110
// TODO: consider if we need also to emit the translated message.
127111
emit MessageRelayed(target, message);
@@ -159,32 +143,4 @@ contract Solana_Adapter is AdapterInterface, CircleCCTPAdapter {
159143
// TODO: consider if we need also to emit the translated addresses.
160144
emit TokensRelayed(l1Token, l2Token, amount, to);
161145
}
162-
163-
/**
164-
* @notice Translates a message to enable/disable a route on Solana spoke pool.
165-
* @param message Message to translate, expecting setEnableRoute(address,uint256,bool).
166-
* @return Translated message, using setEnableRoute(bytes32,uint64,bool).
167-
*/
168-
function _translateSetEnableRoute(bytes calldata message) internal view returns (bytes memory) {
169-
(address originToken, uint256 destinationChainId, bool enable) = abi.decode(
170-
message[4:],
171-
(address, uint256, bool)
172-
);
173-
174-
if (originToken != SOLANA_USDC_ADDRESS) {
175-
revert InvalidOriginToken(originToken);
176-
}
177-
178-
if (destinationChainId > type(uint64).max) {
179-
revert InvalidDestinationChainId(destinationChainId);
180-
}
181-
182-
return
183-
abi.encodeWithSignature(
184-
"setEnableRoute(bytes32,uint64,bool)",
185-
SOLANA_USDC_BYTES32,
186-
uint64(destinationChainId),
187-
enable
188-
);
189-
}
190146
}

test/evm/hardhat/chain-adapters/Solana_Adapter.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,24 +117,4 @@ describe("Solana Chain Adapter", function () {
117117
usdc.address
118118
);
119119
});
120-
121-
it("Correctly translates setEnableRoute calls to the spoke pool", async function () {
122-
// Enable deposits for USDC on Solana.
123-
const destinationChainId = 1;
124-
const depositsEnabled = true;
125-
await hubPool.setDepositRoute(solanaChainId, destinationChainId, solanaUsdcAddress, depositsEnabled);
126-
127-
// Solana spoke pool expects to receive full bytes32 token address and uint64 for chainId.
128-
const solanaInterface = new ethers.utils.Interface(["function setEnableRoute(bytes32, uint64, bool)"]);
129-
const solanaMessage = solanaInterface.encodeFunctionData("setEnableRoute", [
130-
solanaUsdcBytes32,
131-
destinationChainId,
132-
depositsEnabled,
133-
]);
134-
expect(cctpMessageTransmitter.sendMessage).to.have.been.calledWith(
135-
solanaDomainId,
136-
solanaSpokePoolBytes32,
137-
solanaMessage
138-
);
139-
});
140120
});

0 commit comments

Comments
 (0)