Skip to content

Commit b4f5afd

Browse files
authored
Merge pull request #240 from fei-protocol/feat/remove-run
remove run
2 parents dbba7bf + 4981668 commit b4f5afd

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

proposals/dao/fip_x.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { expect } from 'chai';
33
import {
44
DeployUpgradeFunc,
55
NamedAddresses,
6-
RunUpgradeFunc,
76
SetupUpgradeFunc,
87
TeardownUpgradeFunc,
98
ValidateUpgradeFunc
@@ -40,12 +39,6 @@ const setup: SetupUpgradeFunc = async (addresses, oldContracts, contracts, loggi
4039
console.log(`No actions to complete in setup for fip${fipNumber}`);
4140
};
4241

43-
// Here we'll mock the DAO proposal steps (in simulation).
44-
// We don't need to do any checks here, as those will be in validate.
45-
const run: RunUpgradeFunc = async (addresses, oldContracts, contracts, logging = false) => {
46-
console.log(`No actions to complete in run for fip${fipNumber}`);
47-
};
48-
4942
// Tears down any changes made in setup() that need to be
5043
// cleaned up before doing any validation checks.
5144
const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {
@@ -54,8 +47,8 @@ const teardown: TeardownUpgradeFunc = async (addresses, oldContracts, contracts,
5447

5548
// Run any validations required on the fip using mocha or console logging
5649
// IE check balances, check state of contracts, etc.
57-
const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts) => {
50+
const validate: ValidateUpgradeFunc = async (addresses, oldContracts, contracts, logging) => {
5851
console.log(`No actions to complete in validate for fip${fipNumber}`);
5952
};
6053

61-
export { deploy, setup, run, teardown, validate };
54+
export { deploy, setup, teardown, validate };

test/integration/setup/index.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
NamedContracts,
1818
DeployUpgradeFunc,
1919
SetupUpgradeFunc,
20-
RunUpgradeFunc,
2120
TeardownUpgradeFunc,
2221
ValidateUpgradeFunc
2322
} from '../../../types/types';
@@ -84,9 +83,11 @@ export class TestEndtoEndCoordinator implements TestCoordinator {
8483
): Promise<NamedContracts> {
8584
let deployedUpgradedContracts = {};
8685

86+
// Get the upgrade setup and teardown scripts
87+
const { deploy, setup, teardown, validate } = await import('@proposals/dao/' + proposalName);
88+
8789
if (config['deploy']) {
8890
this.config.logging && console.log(`Applying upgrade for proposal: ${proposalName}`);
89-
const { deploy } = await import('../../../scripts/deploy/' + proposalName);
9091
const deployTyped = deploy as DeployUpgradeFunc;
9192
deployedUpgradedContracts = await deployTyped(
9293
this.config.deployAddress,
@@ -109,29 +110,24 @@ export class TestEndtoEndCoordinator implements TestCoordinator {
109110
...getAllContractAddresses()
110111
};
111112

112-
// Get the upgrade setup, run and teardown scripts
113-
const { setup, run, teardown, validate } = await import('../../../proposals/dao/' + proposalName);
114-
115113
// setup the DAO proposal
116-
await setup(contractAddresses, existingContracts, contracts, this.config.logging);
114+
const setupTyped = setup as SetupUpgradeFunc;
115+
await setupTyped(contractAddresses, existingContracts, contracts, this.config.logging);
117116

118117
// Simulate the DAO proposal
119-
if (config.exec) {
120-
const proposal = await constructProposal(proposalName, this.config.logging);
121-
this.config.logging && console.log(`Simulating proposal...`);
122-
await proposal.simulate();
123-
} else {
124-
this.config.logging && console.log(`Running proposal...`);
125-
await run(contractAddresses, existingContracts, contracts, this.config.logging);
126-
}
118+
const proposal = await constructProposal(proposalName, this.config.logging);
119+
this.config.logging && console.log(`Simulating proposal...`);
120+
await proposal.simulate();
127121

128122
// teardown the DAO proposal
129123
this.config.logging && console.log(`Running proposal teardown...`);
130-
await teardown(contractAddresses, existingContracts, contracts);
124+
const teardownTyped = teardown as TeardownUpgradeFunc;
125+
await teardownTyped(contractAddresses, existingContracts, contracts, this.config.logging);
131126

132127
if (validate) {
133128
this.config.logging && console.log(`Running proposal validation...`);
134-
await validate(contractAddresses, existingContracts, contracts);
129+
const validateTyped = validate as ValidateUpgradeFunc;
130+
await validateTyped(contractAddresses, existingContracts, contracts, this.config.logging);
135131
}
136132

137133
return contracts;

0 commit comments

Comments
 (0)