Skip to content

Commit

Permalink
Improve fork tests. (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
jubeira authored Jan 24, 2025
1 parent 0fdd9ca commit 212d99b
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 22 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"lint:typescript": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
"prepack": "yarn build",
"test": "yarn build && hardhat test v*/**/test/*.ts",
"test:v2": "yarn build && hardhat test v2/**/test/*.ts",
"test:v3": "yarn build && hardhat test v3/**/test/*.ts",
"ci:prepare-config": "ts-node ci/prepare-config.ts"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Task, TaskMode } from '@src';
import { getForkedNetwork } from '@src';
import { impersonate } from '@src';

describeForkTest('veBALDeploymentCoordinator', 'mainnet', 14458084, function () {
describeForkTest.skip('veBALDeploymentCoordinator', 'mainnet', 14458084, function () {
let balMultisig: SignerWithAddress, govMultisig: SignerWithAddress;
let coordinator: Contract, authorizer: Contract, BAL: Contract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getForkedNetwork } from '@src';
import { impersonate } from '@src';
import { advanceTime, WEEK } from '@helpers/time';

describeForkTest('veBALL2GaugeSetupCoordinator', 'mainnet', 14616219, function () {
describeForkTest.skip('veBALL2GaugeSetupCoordinator', 'mainnet', 14616219, function () {
let govMultisig: SignerWithAddress, checkpointMultisig: SignerWithAddress;
let coordinator: Contract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { impersonate } from '@src';
import { ZERO_ADDRESS } from '@helpers/constants';
import { range } from 'lodash';

describeForkTest('veBALGaugeFixCoordinator', 'mainnet', 14850000, function () {
describeForkTest.skip('veBALGaugeFixCoordinator', 'mainnet', 14850000, function () {
let govMultisig: SignerWithAddress;
let coordinator: Contract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Task, TaskMode } from '@src';
import { getForkedNetwork } from '@src';
import { getSigner, impersonate } from '@src';

describeForkTest('SmartWalletCheckerCoordinator', 'mainnet', 14850000, function () {
describeForkTest.skip('SmartWalletCheckerCoordinator', 'mainnet', 14850000, function () {
let govMultisig: SignerWithAddress, other: SignerWithAddress;
let coordinator: Contract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { actionId } from '@helpers/models/misc/actions';
import { ZERO_ADDRESS } from '@helpers/constants';
import * as expectEvent from '@helpers/expectEvent';

describeForkTest('TribeBALMinterCoordinator', 'mainnet', 14850000, function () {
describeForkTest.skip('TribeBALMinterCoordinator', 'mainnet', 14850000, function () {
let govMultisig: SignerWithAddress;
let coordinator: Contract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { actionId } from '@helpers/models/misc/actions';
import { expectTransferEvent } from '@helpers/expectTransfer';
import { WeightedPoolEncoder } from '@helpers/models/pools/weighted/encoder';

describeForkTest('SNXRecoveryCoordinator', 'mainnet', 14945041, function () {
describeForkTest.skip('SNXRecoveryCoordinator', 'mainnet', 14945041, function () {
let govMultisig: SignerWithAddress;
let coordinator: Contract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getForkedNetwork } from '@src';
import { impersonate } from '@src';
import { actionId } from '@helpers/models/misc/actions';

describeForkTest('GaugeAdderMigrationCoordinator', 'mainnet', 15150000, function () {
describeForkTest.skip('GaugeAdderMigrationCoordinator', 'mainnet', 15150000, function () {
let govMultisig: SignerWithAddress;
let coordinator: Contract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getForkedNetwork } from '@src';
import { impersonate } from '@src';
import { actionId } from '@helpers/models/misc/actions';

describeForkTest('GaugeAdderMigrationCoordinator', 'mainnet', 16378450, function () {
describeForkTest.skip('GaugeAdderMigrationCoordinator', 'mainnet', 16378450, function () {
let govMultisig: SignerWithAddress;
let coordinator: Contract;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { TRANSITION_END_BLOCK, TimelockAuthorizerTransitionMigratorDeployment }
import { RoleData } from '../input/types';
import { DAY, advanceTime } from '@helpers/time';

describeForkTest('TimelockAuthorizerTransitionMigrator', 'mainnet', TRANSITION_END_BLOCK, function () {
describeForkTest.skip('TimelockAuthorizerTransitionMigrator', 'mainnet', TRANSITION_END_BLOCK, function () {
let input: TimelockAuthorizerTransitionMigratorDeployment;
let migrator: Contract, newAuthorizer: Contract;
let root: SignerWithAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { getForkedNetwork } from '@src';
import { impersonate } from '@src';
import { actionId } from '@helpers/models/misc/actions';

describeForkTest('GaugeAdderMigrationCoordinator-V3-V4', 'mainnet', 17322200, function () {
describeForkTest.skip('GaugeAdderMigrationCoordinator-V3-V4', 'mainnet', 17322200, function () {
let govMultisig: SignerWithAddress;
let coordinator: Contract;

Expand Down
24 changes: 21 additions & 3 deletions v3/tasks/20241205-v3-stable-pool/test/task.fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ describeForkTest('StablePool-V3', 'mainnet', 21336200, function () {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let tokenConfig: any[];

const TASK_NAME = '20241205-v3-stable-pool';
const POOL_CONTRACT_NAME = 'StablePool';
const FACTORY_CONTRACT_NAME = POOL_CONTRACT_NAME + 'Factory';

before('run task', async () => {
task = new Task('20241205-v3-stable-pool', TaskMode.TEST, getForkedNetwork(hre));
task = new Task(TASK_NAME, TaskMode.TEST, getForkedNetwork(hre));
await task.run({ force: true });
factory = await task.deployedInstance('StablePoolFactory');
factory = await task.deployedInstance(FACTORY_CONTRACT_NAME);
});

before('setup contracts and parameters', async () => {
Expand Down Expand Up @@ -75,11 +79,25 @@ describeForkTest('StablePool-V3', 'mainnet', 21336200, function () {
).wait();

const event = expectEvent.inReceipt(poolCreationReceipt, 'PoolCreated');
pool = await task.instanceAt('StablePool', event.args.pool);
pool = await task.instanceAt(POOL_CONTRACT_NAME, event.args.pool);
});

it('checks pool tokens', async () => {
const poolTokens = (await pool.getTokens()).map((token: string) => token.toLowerCase());
expect(poolTokens).to.be.deep.eq(tokenConfig.map((config) => config.token.toLowerCase()));
});

it('checks pool version', async () => {
const version = JSON.parse(await pool.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(POOL_CONTRACT_NAME);
});

it('checks factory version', async () => {
const version = JSON.parse(await factory.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(FACTORY_CONTRACT_NAME);
});
});
24 changes: 21 additions & 3 deletions v3/tasks/20241205-v3-weighted-pool/test/task.fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ describeForkTest('WeightedPool-V3', 'mainnet', 21336200, function () {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let tokenConfig: any[];

const TASK_NAME = '20241205-v3-weighted-pool';
const POOL_CONTRACT_NAME = 'WeightedPool';
const FACTORY_CONTRACT_NAME = POOL_CONTRACT_NAME + 'Factory';

before('run task', async () => {
task = new Task('20241205-v3-weighted-pool', TaskMode.TEST, getForkedNetwork(hre));
task = new Task(TASK_NAME, TaskMode.TEST, getForkedNetwork(hre));
await task.run({ force: true });
factory = await task.deployedInstance('WeightedPoolFactory');
factory = await task.deployedInstance(FACTORY_CONTRACT_NAME);
});

before('setup contracts and parameters', async () => {
Expand Down Expand Up @@ -75,11 +79,25 @@ describeForkTest('WeightedPool-V3', 'mainnet', 21336200, function () {
).wait();

const event = expectEvent.inReceipt(poolCreationReceipt, 'PoolCreated');
pool = await task.instanceAt('WeightedPool', event.args.pool);
pool = await task.instanceAt(POOL_CONTRACT_NAME, event.args.pool);
});

it('checks pool tokens', async () => {
const poolTokens = (await pool.getTokens()).map((token: string) => token.toLowerCase());
expect(poolTokens).to.be.deep.eq(tokenConfig.map((config) => config.token.toLowerCase()));
});

it('checks pool version', async () => {
const version = JSON.parse(await pool.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(POOL_CONTRACT_NAME);
});

it('checks factory version', async () => {
const version = JSON.parse(await factory.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(FACTORY_CONTRACT_NAME);
});
});
24 changes: 21 additions & 3 deletions v3/tasks/20250120-v3-gyro-2clp/test/task.fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ describeForkTest('Gyro2CLPPool', 'mainnet', 21668300, function () {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let tokenConfig: any[];

const TASK_NAME = '20250120-v3-gyro-2clp';
const POOL_CONTRACT_NAME = 'Gyro2CLPPool';
const FACTORY_CONTRACT_NAME = POOL_CONTRACT_NAME + 'Factory';

before('run task', async () => {
task = new Task('20250120-v3-gyro-2clp', TaskMode.TEST, getForkedNetwork(hre));
task = new Task(TASK_NAME, TaskMode.TEST, getForkedNetwork(hre));
await task.run({ force: true });
factory = await task.deployedInstance('Gyro2CLPPoolFactory');
factory = await task.deployedInstance(FACTORY_CONTRACT_NAME);
});

before('setup contracts and parameters', async () => {
Expand Down Expand Up @@ -77,11 +81,25 @@ describeForkTest('Gyro2CLPPool', 'mainnet', 21668300, function () {
).wait();

const event = expectEvent.inReceipt(poolCreationReceipt, 'PoolCreated');
pool = await task.instanceAt('Gyro2CLPPool', event.args.pool);
pool = await task.instanceAt(POOL_CONTRACT_NAME, event.args.pool);
});

it('checks pool tokens', async () => {
const poolTokens = (await pool.getTokens()).map((token: string) => token.toLowerCase());
expect(poolTokens).to.be.deep.eq(tokenConfig.map((config) => config.token.toLowerCase()));
});

it('checks pool version', async () => {
const version = JSON.parse(await pool.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(POOL_CONTRACT_NAME);
});

it('checks factory version', async () => {
const version = JSON.parse(await factory.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(FACTORY_CONTRACT_NAME);
});
});
22 changes: 20 additions & 2 deletions v3/tasks/20250121-v3-stable-surge/test/task.fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ describeForkTest('StableSurge', 'mainnet', 21675100, function () {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let tokenConfig: any[];

const TASK_NAME = '20250121-v3-stable-surge';
const POOL_CONTRACT_NAME = 'StableSurgePool';
const FACTORY_CONTRACT_NAME = POOL_CONTRACT_NAME + 'Factory';

before('run task', async () => {
task = new Task('20250121-v3-stable-surge', TaskMode.TEST, getForkedNetwork(hre));
task = new Task(TASK_NAME, TaskMode.TEST, getForkedNetwork(hre));
await task.run({ force: true });
factory = await task.deployedInstance('StableSurgePoolFactory');
factory = await task.deployedInstance(FACTORY_CONTRACT_NAME);
});

before('get vault and extension', async () => {
Expand Down Expand Up @@ -109,4 +113,18 @@ describeForkTest('StableSurge', 'mainnet', 21675100, function () {
const hook = await task.deployedInstance('StableSurgeHook');
expect(await hook.getDefaultSurgeThresholdPercentage()).to.be.eq(fp(0.3));
});

it('checks pool version', async () => {
const version = JSON.parse(await pool.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(POOL_CONTRACT_NAME);
});

it('checks factory version', async () => {
const version = JSON.parse(await factory.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(FACTORY_CONTRACT_NAME);
});
});
10 changes: 9 additions & 1 deletion v3/tasks/20250124-v3-gyro-eclp/test/task.fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ describeForkTest('GyroECLPPool', 'mainnet', 21689000, function () {

const TASK_NAME = '20250124-v3-gyro-eclp';
const POOL_CONTRACT_NAME = 'GyroECLPPool';
const FACTORY_CONTRACT_NAME = POOL_CONTRACT_NAME + 'Factory';

before('run task', async () => {
task = new Task(TASK_NAME, TaskMode.TEST, getForkedNetwork(hre));
await task.run({ force: true });
factory = await task.deployedInstance('GyroECLPPoolFactory');
factory = await task.deployedInstance(FACTORY_CONTRACT_NAME);
});

before('setup contracts and parameters', async () => {
Expand Down Expand Up @@ -145,4 +146,11 @@ describeForkTest('GyroECLPPool', 'mainnet', 21689000, function () {
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(POOL_CONTRACT_NAME);
});

it('checks factory version', async () => {
const version = JSON.parse(await factory.version());
expect(version.deployment).to.be.eq(TASK_NAME);
expect(version.version).to.be.eq(1);
expect(version.name).to.be.eq(FACTORY_CONTRACT_NAME);
});
});

0 comments on commit 212d99b

Please sign in to comment.