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

fix(its)!: remove gateway token entrypoints #291

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 17 additions & 41 deletions contracts/InterchainTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,23 @@ contract InterchainTokenService is
_expressExecute(commandId, sourceChain, payload);
}

/**
* @notice Returns the express executor for a given command.
* @param commandId The commandId for the contractCall.
* @param sourceChain The source chain.
* @param sourceAddress The source address.
* @param payloadHash The hash of the payload.
* @return expressExecutor The address of the express executor.
*/
function getExpressExecutor(
bytes32 commandId,
string calldata sourceChain,
string calldata sourceAddress,
bytes32 payloadHash
) external view returns (address expressExecutor) {
expressExecutor = _getExpressExecutor(commandId, sourceChain, sourceAddress, payloadHash);
}

/**
* @notice Uses the caller's tokens to fullfill a sendCall ahead of time. Use this only if you have detected an outgoing
* interchainTransfer that matches the parameters passed here.
Expand Down Expand Up @@ -633,47 +650,6 @@ contract InterchainTokenService is
_execute(commandId, sourceChain, sourceAddress, payload, payloadHash);
}

/**
* @notice Call with gateway tokens are not supported.
*/
function contractCallWithTokenValue(
string calldata /* sourceChain */,
string calldata /* sourceAddress */,
bytes calldata /* payload */,
string calldata /* symbol */,
uint256 /* amount */
) public pure override returns (address, uint256) {
revert NotSupported();
}

/**
* @notice Call with gateway tokens are not supported.
*/
function expressExecuteWithToken(
bytes32 /* commandId */,
string calldata /* sourceChain */,
string calldata /* sourceAddress */,
bytes calldata /* payload */,
string calldata /* tokenSymbol */,
uint256 /* amount */
) external payable {
revert NotSupported();
}

/**
* @notice Call with gateway tokens are not supported.
*/
function executeWithToken(
bytes32 /* commandId */,
string calldata /* sourceChain */,
string calldata /* sourceAddress */,
bytes calldata /* payload */,
string calldata /* tokenSymbol */,
uint256 /* amount */
) external pure {
revert NotSupported();
}

/**
* @notice Processes the payload data for a send token call.
* @param commandId The unique message id.
Expand Down
1 change: 0 additions & 1 deletion contracts/interfaces/IInterchainTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ interface IInterchainTokenService is
error CannotDeployRemotelyToSelf();
error InvalidPayload();
error GatewayCallFailed(bytes data);
error NotSupported();

event InterchainTransfer(
bytes32 indexed tokenId,
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
},
"dependencies": {
"@axelar-network/axelar-cgp-solidity": "6.4.0",
"@axelar-network/axelar-gmp-sdk-solidity": "6.0.1"
"@axelar-network/axelar-gmp-sdk-solidity": "6.0.3"
},
"devDependencies": {
"@axelar-network/axelar-chains-config": "^1.2.0",
"@axelar-network/axelar-chains-config": "^1.3.0",
"@axelarjs/evm": "^0.2.1",
"@changesets/cli": "^2.27.9",
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
Expand Down
49 changes: 15 additions & 34 deletions test/InterchainTokenService.js
Original file line number Diff line number Diff line change
Expand Up @@ -1433,16 +1433,6 @@ describe('Interchain Token Service', () => {
});
});

describe('Execute with token', () => {
it('should revert on execute with token', async () => {
await expectRevert(
(gasOptions) => service.executeWithToken(HashZero, 'sourceChain', wallet.address, '0x', 'TEST', 1, gasOptions),
service,
'NotSupported',
);
});
});

describe('Receive Remote Tokens', () => {
let sourceAddress;
const amount = 1234;
Expand Down Expand Up @@ -2395,15 +2385,6 @@ describe('Interchain Token Service', () => {

await service.setPauseStatus(false).then((tx) => tx.wait);
});

it('Should revert on express execute with token', async () => {
await expectRevert(
(gasOptions) =>
service.expressExecuteWithToken(commandId, sourceChain, sourceAddress, '0x', tokenSymbol, amount, gasOptions),
service,
'NotSupported',
);
});
});

describe('Express Receive Remote Token', () => {
Expand Down Expand Up @@ -2486,9 +2467,11 @@ describe('Interchain Token Service', () => {
['uint256', 'bytes32', 'bytes', 'bytes', 'uint256', 'bytes'],
[MESSAGE_TYPE_INTERCHAIN_TRANSFER, tokenId, hexlify(wallet.address), destAddress, amount, '0x'],
);

const commandId = getRandomBytes32();

await (await service.expressExecute(commandId, sourceChain, sourceAddress, payload)).wait();
expect(await service.getExpressExecutor(commandId, sourceChain, sourceAddress, keccak256(payload))).to.equal(wallet.address);

await approveContractCall(gateway, sourceChain, sourceAddress, service.address, payload, getRandomBytes32(), 0, commandId);

await expect(service.execute(commandId, sourceChain, sourceAddress, payload))
Expand All @@ -2507,9 +2490,11 @@ describe('Interchain Token Service', () => {
['uint256', 'bytes32', 'bytes', 'bytes', 'uint256', 'bytes'],
[MESSAGE_TYPE_INTERCHAIN_TRANSFER, tokenId, hexlify(wallet.address), destAddress, amount, '0x'],
);

const commandId = getRandomBytes32();

await service.expressExecute(commandId, sourceChain, sourceAddress, payload).then((tx) => tx.wait);
expect(await service.getExpressExecutor(commandId, sourceChain, sourceAddress, keccak256(payload))).to.equal(wallet.address);

await approveContractCall(gateway, sourceChain, sourceAddress, service.address, payload, getRandomBytes32(), 0, commandId);

await expect(service.execute(commandId, sourceChain, sourceAddress, payload))
Expand All @@ -2528,9 +2513,11 @@ describe('Interchain Token Service', () => {
['uint256', 'bytes32', 'bytes', 'bytes', 'uint256', 'bytes'],
[MESSAGE_TYPE_INTERCHAIN_TRANSFER, tokenId, hexlify(wallet.address), destAddress, amount, '0x'],
);

const commandId = getRandomBytes32();

await service.expressExecute(commandId, sourceChain, sourceAddress, payload).then((tx) => tx.wait);
expect(await service.getExpressExecutor(commandId, sourceChain, sourceAddress, keccak256(payload))).to.equal(wallet.address);

await approveContractCall(gateway, sourceChain, sourceAddress, service.address, payload, getRandomBytes32(), 0, commandId);

await expect(service.execute(commandId, sourceChain, sourceAddress, payload))
Expand All @@ -2555,9 +2542,11 @@ describe('Interchain Token Service', () => {
['uint256', 'bytes32', 'bytes', 'bytes', 'uint256', 'bytes'],
[MESSAGE_TYPE_INTERCHAIN_TRANSFER, tokenId, hexlify(wallet.address), destAddress, amount, '0x'],
);

const commandId = getRandomBytes32();

await service.expressExecute(commandId, sourceChain, sourceAddress, payload).then((tx) => tx.wait);
expect(await service.getExpressExecutor(commandId, sourceChain, sourceAddress, keccak256(payload))).to.equal(wallet.address);

await approveContractCall(gateway, sourceChain, sourceAddress, service.address, payload, getRandomBytes32(), 0, commandId);

await expect(service.execute(commandId, sourceChain, sourceAddress, payload))
Expand All @@ -2584,9 +2573,11 @@ describe('Interchain Token Service', () => {
['uint256', 'bytes32', 'bytes', 'bytes', 'uint256', 'bytes'],
[MESSAGE_TYPE_INTERCHAIN_TRANSFER, tokenId, hexlify(wallet.address), destAddress, amount, '0x'],
);

const commandId = getRandomBytes32();

await service.expressExecute(commandId, sourceChain, sourceAddress, payload).then((tx) => tx.wait);
expect(await service.getExpressExecutor(commandId, sourceChain, sourceAddress, keccak256(payload))).to.equal(wallet.address);

await approveContractCall(gateway, sourceChain, sourceAddress, service.address, payload, getRandomBytes32(), 0, commandId);

await expect(service.execute(commandId, sourceChain, sourceAddress, payload))
Expand Down Expand Up @@ -2969,16 +2960,6 @@ describe('Interchain Token Service', () => {
});
});

describe('Call contract with token value', () => {
it('Should revert on contract call value', async () => {
await expectRevert(
(gasOptions) => service.contractCallWithTokenValue(sourceChain, 'sourceAddress', '0x', 'TEST', 1, gasOptions),
service,
'NotSupported',
);
});
});

describe('Bytecode checks [ @skip-on-coverage ]', () => {
it('Should preserve the same proxy bytecode for each EVM', async () => {
const proxyFactory = await ethers.getContractFactory('InterchainProxy', wallet);
Expand Down
Loading