From bb51dbb7a44b17143ad28b995932e66ffa08e82e Mon Sep 17 00:00:00 2001 From: Milap Sheth Date: Thu, 21 Mar 2024 04:20:41 -0400 Subject: [PATCH 1/4] fix(factory): remove unused using directives --- contracts/InterchainTokenFactory.sol | 5 ----- 1 file changed, 5 deletions(-) diff --git a/contracts/InterchainTokenFactory.sol b/contracts/InterchainTokenFactory.sol index a5b90129..1d3209fc 100644 --- a/contracts/InterchainTokenFactory.sol +++ b/contracts/InterchainTokenFactory.sol @@ -3,7 +3,6 @@ pragma solidity ^0.8.0; import { AddressBytes } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/AddressBytes.sol'; -import { SafeTokenTransfer, SafeTokenTransferFrom, SafeTokenCall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeTransfer.sol'; import { Multicall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/Multicall.sol'; import { Upgradable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Upgradable.sol'; import { IAxelarGateway } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IAxelarGateway.sol'; @@ -19,11 +18,7 @@ import { IInterchainToken } from './interfaces/IInterchainToken.sol'; * @notice This contract is responsible for deploying new interchain tokens and managing their token managers. */ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, Multicall, Upgradable { - using AddressBytes for bytes; using AddressBytes for address; - using SafeTokenTransfer for IInterchainToken; - using SafeTokenTransferFrom for IInterchainToken; - using SafeTokenCall for IInterchainToken; IInterchainTokenService public immutable interchainTokenService; bytes32 public immutable chainNameHash; From b4b0759ffa6f72c7262438cd66ddc594c8611beb Mon Sep 17 00:00:00 2001 From: Milap Sheth Date: Thu, 21 Mar 2024 04:33:40 -0400 Subject: [PATCH 2/4] remove more unused --- contracts/InterchainTokenService.sol | 6 ------ 1 file changed, 6 deletions(-) diff --git a/contracts/InterchainTokenService.sol b/contracts/InterchainTokenService.sol index a0e41ac5..e018b8f8 100644 --- a/contracts/InterchainTokenService.sol +++ b/contracts/InterchainTokenService.sol @@ -8,9 +8,7 @@ import { IAxelarGateway } from '@axelar-network/axelar-gmp-sdk-solidity/contract import { ExpressExecutorTracker } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/express/ExpressExecutorTracker.sol'; import { Upgradable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/upgradable/Upgradable.sol'; import { Create3Address } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/deploy/Create3Address.sol'; -import { SafeTokenTransferFrom, SafeTokenCall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/SafeTransfer.sol'; import { AddressBytes } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/AddressBytes.sol'; -import { StringToBytes32, Bytes32ToString } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/libs/Bytes32String.sol'; import { Multicall } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/Multicall.sol'; import { Pausable } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/Pausable.sol'; import { InterchainAddressTracker } from '@axelar-network/axelar-gmp-sdk-solidity/contracts/utils/InterchainAddressTracker.sol'; @@ -44,12 +42,8 @@ contract InterchainTokenService is InterchainAddressTracker, IInterchainTokenService { - using StringToBytes32 for string; - using Bytes32ToString for bytes32; using AddressBytes for bytes; using AddressBytes for address; - using SafeTokenTransferFrom for IERC20; - using SafeTokenCall for IERC20; IAxelarGateway public immutable gateway; IAxelarGasService public immutable gasService; From 826c0b3c279b0c4483317591a19ab4bf098c082c Mon Sep 17 00:00:00 2001 From: Milap Sheth Date: Thu, 21 Mar 2024 04:38:30 -0400 Subject: [PATCH 3/4] add InterchainToken bytecode check --- test/InterchainToken.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/InterchainToken.js b/test/InterchainToken.js index 5ae6961a..716ebb11 100644 --- a/test/InterchainToken.js +++ b/test/InterchainToken.js @@ -4,9 +4,10 @@ const { ethers } = require('hardhat'); const { constants: { AddressZero, HashZero, MaxUint256 }, getContractAt, + utils: { keccak256 }, } = ethers; const { expect } = require('chai'); -const { getRandomBytes32, expectRevert } = require('./utils'); +const { getRandomBytes32, expectRevert, getEVMVersion } = require('./utils'); const { deployContract } = require('../scripts/deploy'); describe('InterchainToken', () => { @@ -138,4 +139,18 @@ describe('InterchainToken', () => { expect(finalAllowance).to.eq(initialAllowance); }); }); + + describe.only('Bytecode checks [ @skip-on-coverage ]', () => { + it('Should preserve the same bytecode', async () => { + const contract = await ethers.getContractFactory('InterchainToken', owner); + const contractBytecode = contract.bytecode; + const contractBytecodeHash = keccak256(contractBytecode); + + const expected = { + london: '0xa01cf28b0b6ce6dc3b466e995585d69486400d671fce0ea8d06beba583e6f3bb', + }[getEVMVersion()]; + + expect(contractBytecodeHash).to.be.equal(expected); + }); + }); }); From 0a5e177024f01b3e07e2447652f6587d122f1a8e Mon Sep 17 00:00:00 2001 From: Milap Sheth Date: Thu, 21 Mar 2024 04:43:28 -0400 Subject: [PATCH 4/4] update test --- test/InterchainToken.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/InterchainToken.js b/test/InterchainToken.js index 716ebb11..a7ff687a 100644 --- a/test/InterchainToken.js +++ b/test/InterchainToken.js @@ -140,7 +140,7 @@ describe('InterchainToken', () => { }); }); - describe.only('Bytecode checks [ @skip-on-coverage ]', () => { + describe('Bytecode checks [ @skip-on-coverage ]', () => { it('Should preserve the same bytecode', async () => { const contract = await ethers.getContractFactory('InterchainToken', owner); const contractBytecode = contract.bytecode;