Skip to content

Commit

Permalink
ci(build): bump solidity version to v0.8.23 and parallelize tests (#147)
Browse files Browse the repository at this point in the history
* ci(build): bump solidity version to v0.8.23 and parallelize tests

* update test

* slither action

* allow skipping overrides for slither

* skip compiler overrides for slither action
  • Loading branch information
milapsheth authored Mar 23, 2024
1 parent 58e74c3 commit f5bb40f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 29 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/slither.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ jobs:
run: npm ci

- name: Run Slither
uses: crytic/slither-action@v0.3.0
uses: crytic/slither-action@v0.3.1
env:
NO_OVERRIDES: true
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ jobs:
fi
- name: Test
run: CHECK_CONTRACT_SIZE=true npm run test-evm-versions
run: CHECK_CONTRACT_SIZE=true npx hardhat test --parallel
20 changes: 17 additions & 3 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const env = process.env.ENV || 'testnet';
const chains = require(`@axelar-network/axelar-chains-config/info/${env}.json`);
const keys = readJSON(`${__dirname}/keys.json`);
const { networks, etherscan } = importNetworks(chains, keys);
networks.hardhat.hardfork = process.env.EVM_VERSION || 'london';

const optimizerSettings = {
enabled: true,
Expand All @@ -34,6 +35,15 @@ const optimizerSettings = {
},
};

const defaultSettings = {
version: '0.8.23',
settings: {
evmVersion: process.env.EVM_VERSION || 'london',
optimizer: optimizerSettings,
},
};

// Some contracts use fixed compiler settings to ensure deterministic bytecodes across versions
const compilerSettings = {
version: '0.8.19',
settings: {
Expand All @@ -47,15 +57,19 @@ const compilerSettings = {
*/
module.exports = {
solidity: {
compilers: [compilerSettings],
// Fix the Proxy bytecodes
overrides: {
compilers: [defaultSettings],
// Fix compiler settings for contracts that aren't being changed
// Allow skipping overrides for Slither to work correctly
overrides: process.env.NO_OVERRIDES ? {} : {
'contracts/deploy/ConstAddressDeployer.sol': compilerSettings,
'contracts/deploy/Create2Deployer.sol': compilerSettings,
'contracts/deploy/Create3Deployer.sol': compilerSettings,
'contracts/upgradable/Proxy.sol': compilerSettings,
'contracts/upgradable/InitProxy.sol': compilerSettings,
'contracts/upgradable/FinalProxy.sol': compilerSettings,
'contracts/upgradable/FixedProxy.sol': compilerSettings,
'contracts/governance/InterchainGovernance.sol': compilerSettings,
'contracts/governance/Multisig.sol': compilerSettings,
},
},
defaultNetwork: 'hardhat',
Expand Down
21 changes: 0 additions & 21 deletions scripts/test-evm-versions.sh

This file was deleted.

6 changes: 3 additions & 3 deletions test/governance/AxelarServiceGovernance.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ describe('AxelarServiceGovernance', () => {
const bytecodeHash = keccak256(bytecode);

const expected = {
istanbul: '0x7a43f729579754d15cd6c0350fcd840de23d84dcd8497907bd448f47d4676b0d',
berlin: '0x06f9662062693e95f1352fc978d7d33cca9c2ab83766386146a61eca4d338b57',
london: '0xbdd0a50ba271e40e4e2e518d38c3536b15678119b8cf3bd2dfe5ef406b1f6d11',
istanbul: '0xe66de263cb5b1443f7c236da8f3760961aae7a2efc65635d133d64f4aa8da1d4',
berlin: '0x0a3266306a5ebfdd1404db8f85e0e898eaeebe4db76dee1659f7f3bc6381387b',
london: '0xf5a298c73276406c136da5e9d6f102e5cbcc452376708b3864b6c0f0bf45d952',
}[getEVMVersion()];

expect(bytecodeHash).to.be.equal(expected);
Expand Down

0 comments on commit f5bb40f

Please sign in to comment.