Skip to content

Commit ed4310f

Browse files
committed
build: debug error
1 parent 6d39340 commit ed4310f

2 files changed

Lines changed: 41 additions & 41 deletions

File tree

src/commands/deploy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const command = () =>
1616
.option('--upgrade-init-method <method>', 'method to call on the custom initialization contract during the upgrade')
1717
.option('--pause-cut-to-file <file>', 'pause before the diamondCut() method is called and the write the cut info to a file')
1818
.option('--resume-cut-from-file <file>', 'resume a diamondCut() method call using the cut info in the given file')
19-
.option('--tx-confirm-delay <milliseconds>', 'timeout in milliseconds to wait for transactions to complete', '0')
19+
.option('--tx-confirm-delay <milliseconds>', 'additional time in milliseconds to wait for transactions to complete', '0')
2020
.action(async (targetArg, args) => {
2121
const ctx = await getContext(args)
2222

test/common-deploy-steps.ts

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export const addDeployTestSteps = ({
1717

1818
const contractSrcBasePath = (framework === 'hardhat' ? 'contracts' : 'src')
1919

20-
const deployWithDelay = (args: string[]) => {
21-
return cli('deploy', 'local', ...args, { cwd, verbose: false })
20+
const cli_deploy = (args: string[]) => {
21+
return cli('deploy', 'local', ...args, { cwd, verbose: true })
2222
}
2323

2424
describe('deploys the project', () => {
2525
beforeEach(() => {
2626
cwd = setupFolderCallback()
2727
expect(cli('build', { cwd, verbose: false }).success).to.be.true
28-
expect(deployWithDelay([]).success).to.be.true
28+
expect(cli_deploy([]).success).to.be.true
2929
})
3030

3131
it('and updates the deployment json', async () => {
@@ -90,7 +90,7 @@ export const addDeployTestSteps = ({
9090

9191
// build and re-deploy
9292
expect(cli('build', { cwd, verbose: false }).success).to.be.true
93-
expect(deployWithDelay([]).success).to.be.true
93+
expect(cli_deploy([]).success).to.be.true
9494

9595
const { contract, signer } = await loadDiamondContract(cwd)
9696

@@ -129,7 +129,7 @@ export const addDeployTestSteps = ({
129129

130130
// build and re-deploy
131131
expect(cli('build', { cwd }).success).to.be.true
132-
expect(deployWithDelay([]).success).to.be.true
132+
expect(cli_deploy([]).success).to.be.true
133133

134134
const { contract } = await loadDiamondContract(cwd, [
135135
'function setInt1(uint i) external', // this one should exist
@@ -162,7 +162,7 @@ export const addDeployTestSteps = ({
162162

163163
// build and re-deploy
164164
expect(cli('build', { cwd }).success).to.be.true
165-
const ret = deployWithDelay(['-v'])
165+
const ret = cli_deploy(['-v'])
166166
expect(ret.success).to.be.true
167167

168168
const { contract } = await loadDiamondContract(cwd, [
@@ -200,7 +200,7 @@ export const addDeployTestSteps = ({
200200

201201
// build and re-deploy
202202
expect(cli('build', { cwd }).success).to.be.true
203-
expect(deployWithDelay([]).success).to.be.true
203+
expect(cli_deploy([]).success).to.be.true
204204
// console.log(cwd)
205205

206206
const { contract } = await loadDiamondContract(cwd)
@@ -216,7 +216,7 @@ export const addDeployTestSteps = ({
216216
const jsonOld = loadJsonFile(filePath)
217217

218218
// redeploy new
219-
expect(deployWithDelay(['--new']).success).to.be.true
219+
expect(cli_deploy(['--new']).success).to.be.true
220220

221221
const jsonNew = loadJsonFile(filePath)
222222

@@ -239,7 +239,7 @@ export const addDeployTestSteps = ({
239239
await sendTx(contract.setInt1(2))
240240

241241
// redeploy new
242-
expect(deployWithDelay(['--reset']).success).to.be.true
242+
expect(cli_deploy(['--reset']).success).to.be.true
243243

244244
const jsonNew = loadJsonFile(filePath)
245245

@@ -288,7 +288,7 @@ export const addDeployTestSteps = ({
288288
// re-build
289289
expect(cli('build', { cwd }).success).to.be.true
290290

291-
expect(deployWithDelay(['--dry']).success).to.be.true
291+
expect(cli_deploy(['--dry']).success).to.be.true
292292

293293
const endingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
294294

@@ -308,7 +308,7 @@ export const addDeployTestSteps = ({
308308
const wallet = await loadWallet(join(cwd, 'gemforge.config.cjs'), 'local', 'wallet1')
309309
const startingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
310310

311-
expect(deployWithDelay(['--reset', '--dry']).success).to.be.true
311+
expect(cli_deploy(['--reset', '--dry']).success).to.be.true
312312

313313
const endingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
314314

@@ -328,7 +328,7 @@ export const addDeployTestSteps = ({
328328
const wallet = await loadWallet(join(cwd, 'gemforge.config.cjs'), 'local', 'wallet1')
329329
const startingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
330330

331-
expect(deployWithDelay(['--new', '--dry']).success).to.be.true
331+
expect(cli_deploy(['--new', '--dry']).success).to.be.true
332332

333333
const endingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
334334

@@ -349,13 +349,13 @@ export const addDeployTestSteps = ({
349349
})
350350
})
351351

352-
it('and everything gets deployed', async () => {
353-
expect(cli('build', { cwd, verbose: false }).success).to.be.true
352+
it.only('and everything gets deployed', async () => {
353+
expect(cli('build', { cwd, verbose: true }).success).to.be.true
354354

355355
const wallet = await loadWallet(join(cwd, 'gemforge.config.cjs'), 'local', 'wallet_key')
356356
const startingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
357357

358-
expect(deployWithDelay([]).success).to.be.true
358+
expect(cli_deploy([]).success).to.be.true
359359

360360
await setTimeout(2000) // to give time for balance to update
361361
const endingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
@@ -376,7 +376,7 @@ export const addDeployTestSteps = ({
376376
const wallet = await loadWallet(join(cwd, 'gemforge.config.cjs'), 'local', 'wallet1')
377377
const startingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
378378

379-
expect(deployWithDelay(['--dry']).success).to.be.true
379+
expect(cli_deploy(['--dry']).success).to.be.true
380380

381381
const endingBal = (await wallet.provider!.getBalance(wallet.address)).toString()
382382

@@ -412,7 +412,7 @@ export const addDeployTestSteps = ({
412412
})
413413

414414
expect(cli('build', { cwd, verbose: false }).success).to.be.true
415-
expect(deployWithDelay([]).success).to.be.true
415+
expect(cli_deploy([]).success).to.be.true
416416

417417
const { contract } = await loadDiamondContract(cwd)
418418
const n = await contract.getInt1()
@@ -437,7 +437,7 @@ export const addDeployTestSteps = ({
437437
throw new Error('test');
438438
`, { executable: true })
439439

440-
const ret = deployWithDelay([])
440+
const ret = cli_deploy([])
441441

442442
expect(ret.success).to.be.false
443443
expect(ret.output).to.contain('Error: test')
@@ -450,7 +450,7 @@ export const addDeployTestSteps = ({
450450
fs.writeFileSync(path.join(__dirname, 'gemforge.deployments.json'), 'test')
451451
`, { executable: true })
452452

453-
const ret = deployWithDelay([])
453+
const ret = cli_deploy([])
454454

455455
expect(ret.success).to.be.true
456456
expect(loadFile(join(cwd, 'gemforge.deployments.json'))).to.not.equal('test')
@@ -463,7 +463,7 @@ export const addDeployTestSteps = ({
463463
fs.writeFileSync(path.join(__dirname, 'test.data'), process.env.GEMFORGE_DEPLOY_TARGET + '/' + process.env.GEMFORGE_DEPLOY_CHAIN_ID)
464464
`, { executable: true })
465465

466-
const ret = deployWithDelay([])
466+
const ret = cli_deploy([])
467467

468468
expect(ret.success).to.be.true
469469
expect(loadFile(join(cwd, 'test.data'))).to.equal('local/31337')
@@ -487,7 +487,7 @@ export const addDeployTestSteps = ({
487487
throw new Error('test');
488488
`, { executable: true })
489489

490-
const ret = deployWithDelay([])
490+
const ret = cli_deploy([])
491491

492492
expect(ret.success).to.be.false
493493
expect(ret.output).to.contain('Error: test')
@@ -500,7 +500,7 @@ export const addDeployTestSteps = ({
500500
fs.writeFileSync(path.join(__dirname, 'gemforge.deployments.json'), 'test')
501501
`, { executable: true })
502502

503-
const ret = deployWithDelay([])
503+
const ret = cli_deploy([])
504504

505505
expect(ret.success).to.be.true
506506
expect(loadFile(join(cwd, 'gemforge.deployments.json'))).to.equal('test')
@@ -513,7 +513,7 @@ export const addDeployTestSteps = ({
513513
fs.writeFileSync(path.join(__dirname, 'test.data'), process.env.GEMFORGE_DEPLOY_TARGET + '/' + process.env.GEMFORGE_DEPLOY_CHAIN_ID)
514514
`, { executable: true })
515515

516-
const ret = deployWithDelay([])
516+
const ret = cli_deploy([])
517517

518518
expect(ret.success).to.be.true
519519
expect(loadFile(join(cwd, 'test.data'))).to.equal('local/31337')
@@ -546,7 +546,7 @@ export const addDeployTestSteps = ({
546546

547547
beforeEach(async () => {
548548
f = path.join(cwd, '1.json')
549-
const ret = deployWithDelay(['--pause-cut-to-file', f])
549+
const ret = cli_deploy(['--pause-cut-to-file', f])
550550
expect(ret.success).to.be.true
551551
expect(ret.output).to.contain('Pausing before diamondCut()')
552552
})
@@ -601,8 +601,8 @@ export const addDeployTestSteps = ({
601601

602602
beforeEach(async () => {
603603
f = path.join(cwd, '1.json')
604-
expect(deployWithDelay(['--pause-cut-to-file', f]).success).to.be.true
605-
const ret = deployWithDelay(['--resume-cut-from-file', f])
604+
expect(cli_deploy(['--pause-cut-to-file', f]).success).to.be.true
605+
const ret = cli_deploy(['--resume-cut-from-file', f])
606606
expect(ret.success).to.be.true
607607
expect(ret.output).to.contain('Calling diamondCut()')
608608
})
@@ -635,7 +635,7 @@ export const addDeployTestSteps = ({
635635
})
636636

637637
it('and updates the deployment json', async () => {
638-
const ret = deployWithDelay(['-n'])
638+
const ret = cli_deploy(['-n'])
639639
expect(ret.success).to.be.true
640640

641641
const filePath = join(cwd, 'gemforge.deployments.json')
@@ -650,14 +650,14 @@ export const addDeployTestSteps = ({
650650
})
651651

652652
it('and cannot do a fresh deploy with same salt on same network', async () => {
653-
expect(deployWithDelay(['-n']).success).to.be.true
653+
expect(cli_deploy(['-n']).success).to.be.true
654654

655655
const filePath = join(cwd, 'gemforge.deployments.json')
656656
const json = loadJsonFile(filePath)
657657
const obj = get(json, 'local.contracts', []).find((a: any) => a.name === 'DiamondProxy') as any
658658
const { address } = obj.onChain
659659

660-
const ret = deployWithDelay(['-n'])
660+
const ret = cli_deploy(['-n'])
661661

662662
expect(ret.success).to.be.false
663663
expect(ret.output).to.contain(`Address already in use: ${address}`)
@@ -676,7 +676,7 @@ export const addDeployTestSteps = ({
676676
})
677677

678678
expect(cli('build', { cwd, verbose: false }).success).to.be.true
679-
expect(deployWithDelay(['-n']).success).to.be.true
679+
expect(cli_deploy(['-n']).success).to.be.true
680680
})
681681

682682
it('and can handle an upgrade', async () => {
@@ -706,7 +706,7 @@ export const addDeployTestSteps = ({
706706

707707
// build and re-deploy
708708
expect(cli('build', { cwd, verbose: false }).success).to.be.true
709-
const ret = deployWithDelay([])
709+
const ret = cli_deploy([])
710710
expect(ret.success).to.be.true
711711
expect(ret.output).to.contain('Unable to call supportsInterface')
712712

@@ -732,11 +732,11 @@ export const addDeployTestSteps = ({
732732
})
733733

734734
it('needs both custom upgrade initialization contract and method', async () => {
735-
let ret = deployWithDelay(['--upgrade-init-contract', 'Init2'])
735+
let ret = cli_deploy(['--upgrade-init-contract', 'Init2'])
736736
expect(ret.success).to.be.false
737737
expect(ret.output).to.contain('No upgrade initialization method specified.')
738738

739-
ret = deployWithDelay(['--upgrade-init-method', 'init'])
739+
ret = cli_deploy(['--upgrade-init-method', 'init'])
740740
expect(ret.success).to.be.false
741741
expect(ret.output).to.contain('No upgrade initialization contract specified.')
742742
})
@@ -770,12 +770,12 @@ export const addDeployTestSteps = ({
770770
`)
771771

772772
expect(cli('build', { cwd, verbose: false }).success).to.be.true
773-
expect(deployWithDelay(['-n']).success).to.be.true
773+
expect(cli_deploy(['-n']).success).to.be.true
774774
})
775775

776776
it('and can execute a custom upgrade initialization method', async () => {
777-
expect(deployWithDelay(['--upgrade-init-contract', 'Init2', '--upgrade-init-method', 'init']).success).to.be.true
778-
const ret = deployWithDelay(['--upgrade-init-contract', 'Init2', '--upgrade-init-method', 'init'])
777+
expect(cli_deploy(['--upgrade-init-contract', 'Init2', '--upgrade-init-method', 'init']).success).to.be.true
778+
const ret = cli_deploy(['--upgrade-init-contract', 'Init2', '--upgrade-init-method', 'init'])
779779
expect(ret.success).to.be.false
780780
// TODO: for hardhat the error message is "missing revert data" due to some ethers issue,
781781
// see: https://github.com/ethers-io/ethers.js/discussions/2849
@@ -796,7 +796,7 @@ export const addDeployTestSteps = ({
796796
})
797797

798798
expect(cli('build', { cwd, verbose: false }).success).to.be.true
799-
expect(deployWithDelay([]).success).to.be.true
799+
expect(cli_deploy([]).success).to.be.true
800800

801801
writeFile(join(cwd, `${contractSrcBasePath}/facets/ExampleFacet.sol`), `
802802
pragma solidity >=0.8.21;
@@ -857,7 +857,7 @@ export const addDeployTestSteps = ({
857857
})
858858

859859
it('and will output the tx params', async () => {
860-
const ret = deployWithDelay([])
860+
const ret = cli_deploy([])
861861
expect(ret.success).to.be.true
862862

863863
const filePath = join(cwd, 'gemforge.deployments.json')
@@ -875,14 +875,14 @@ export const addDeployTestSteps = ({
875875
})
876876

877877
it('and did not execute the upgrade', async () => {
878-
expect(deployWithDelay([]).success).to.be.true
878+
expect(cli_deploy([]).success).to.be.true
879879

880880
const { contract } = await loadDiamondContract(cwd)
881881
expect(contract.setInt1New()).to.be.rejectedWith('execution reverted')
882882
})
883883

884884
it('and can execute a custom upgrade initialization method', async () => {
885-
const ret = deployWithDelay(['--upgrade-init-contract', 'Init2', '--upgrade-init-method', 'init'])
885+
const ret = cli_deploy(['--upgrade-init-contract', 'Init2', '--upgrade-init-method', 'init'])
886886

887887
expect(ret.success).to.be.true
888888
// console.log(ret.output)

0 commit comments

Comments
 (0)