Skip to content

Commit 3e3bb67

Browse files
committed
fix(cross-chain): resolve CI lint and test failures
- Fix prettier line-length violations in Arbitrum test by breaking long contract name strings onto separate lines - Fix ESLint no-param-reassign in deploy scripts by using spread operator instead of mutating the transaction parameter - Update skip test assertion from isFalse to isTrue since both deploy scripts are now marked skip=true after successful deployment
1 parent f1d66b6 commit 3e3bb67

File tree

4 files changed

+35
-24
lines changed

4 files changed

+35
-24
lines changed

cross-chain/arbitrum/deploy_l1/01_upgrade_arbitrum_l1_bitcoin_depositor_to_v2.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1313
// `prepareUpgrade` fails with "invalid address" after the implementation is
1414
// already deployed on-chain.
1515
const originalFormat = providers.Formatter.prototype.transactionResponse
16-
providers.Formatter.prototype.transactionResponse = function (
17-
transaction: any
18-
): any {
19-
if (transaction.to === "") {
20-
transaction.to = null
21-
}
22-
return originalFormat.call(this, transaction)
16+
providers.Formatter.prototype.transactionResponse = function (tx: any): any {
17+
const patched = tx.to === "" ? { ...tx, to: null } : tx
18+
return originalFormat.call(this, patched)
2319
}
2420

2521
const { deployer } = await helpers.signers.getNamedSigners()

cross-chain/arbitrum/test/UpgradeArbitrumL1BitcoinDepositorToV2.test.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ describe("UpgradeArbitrumL1BitcoinDepositorToV2 - Deploy Script Structure", () =
6060
assert.isFunction(func.skip)
6161
})
6262

63-
it("should have skip return false by default", async () => {
63+
it("should have skip return true after deployment", async () => {
6464
const shouldSkip = await func.skip!({} as any)
6565

66-
assert.isFalse(shouldSkip)
66+
assert.isTrue(shouldSkip)
6767
})
6868
})
6969

@@ -104,15 +104,19 @@ describe("UpgradeArbitrumL1BitcoinDepositorToV2 - Artifact Resolution", () => {
104104
})
105105

106106
it("should resolve the L1BTCDepositorWormholeV2Arbitrum artifact", () => {
107-
const artifact = artifacts.readArtifactSync("L1BTCDepositorWormholeV2Arbitrum")
107+
const artifact = artifacts.readArtifactSync(
108+
"L1BTCDepositorWormholeV2Arbitrum"
109+
)
108110

109111
assert.equal(artifact.contractName, "L1BTCDepositorWormholeV2Arbitrum")
110112
assert.isArray(artifact.abi)
111113
assert.isAbove(artifact.abi.length, 0)
112114
})
113115

114116
it("should resolve V2 via ethers.getContractFactory without HH700", async () => {
115-
const factory = await ethers.getContractFactory("L1BTCDepositorWormholeV2Arbitrum")
117+
const factory = await ethers.getContractFactory(
118+
"L1BTCDepositorWormholeV2Arbitrum"
119+
)
116120
const initializeFragment = factory.interface.getFunction("initialize")
117121

118122
assert.exists(factory)
@@ -122,15 +126,19 @@ describe("UpgradeArbitrumL1BitcoinDepositorToV2 - Artifact Resolution", () => {
122126

123127
requiredAbiFunctions.forEach((fnName) => {
124128
it(`should include ${fnName} in the resolved artifact ABI`, () => {
125-
const artifact = artifacts.readArtifactSync("L1BTCDepositorWormholeV2Arbitrum")
129+
const artifact = artifacts.readArtifactSync(
130+
"L1BTCDepositorWormholeV2Arbitrum"
131+
)
126132
const functionNames = getFunctionNames(artifact.abi as AbiEntry[])
127133

128134
assert.include(functionNames, fnName)
129135
})
130136
})
131137

132138
it("should expose source metadata for the copied V2 artifact", () => {
133-
const artifact = artifacts.readArtifactSync("L1BTCDepositorWormholeV2Arbitrum")
139+
const artifact = artifacts.readArtifactSync(
140+
"L1BTCDepositorWormholeV2Arbitrum"
141+
)
134142

135143
assert.equal(
136144
artifact.sourceName,

cross-chain/base/deploy_l1/02_upgrade_base_l1_bitcoin_depositor_to_v2.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1313
// `prepareUpgrade` fails with "invalid address" after the implementation is
1414
// already deployed on-chain.
1515
const originalFormat = providers.Formatter.prototype.transactionResponse
16-
providers.Formatter.prototype.transactionResponse = function (
17-
transaction: any
18-
): any {
19-
if (transaction.to === "") {
20-
transaction.to = null
21-
}
22-
return originalFormat.call(this, transaction)
16+
providers.Formatter.prototype.transactionResponse = function (tx: any): any {
17+
const patched = tx.to === "" ? { ...tx, to: null } : tx
18+
return originalFormat.call(this, patched)
2319
}
2420

2521
const { deployer } = await helpers.signers.getNamedSigners()

cross-chain/base/test/UpgradeBaseL1BitcoinDepositorToV2.test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ describe("UpgradeBaseL1BitcoinDepositorToV2 - Artifact Resolution", () => {
8484
})
8585

8686
it("should resolve V2 via ethers.getContractFactory without HH700", async () => {
87-
const factory = await ethers.getContractFactory("L1BTCDepositorWormholeV2Base")
87+
const factory = await ethers.getContractFactory(
88+
"L1BTCDepositorWormholeV2Base"
89+
)
8890
expect(factory).to.not.equal(undefined)
8991
expect(factory.interface).to.not.equal(undefined)
9092
expect(factory.interface.functions).to.have.property(
@@ -101,7 +103,9 @@ describe("UpgradeBaseL1BitcoinDepositorToV2 - Artifact Resolution", () => {
101103

102104
requiredAbiFunctions.forEach((fnName) => {
103105
it(`should include ${fnName} in the resolved artifact ABI`, () => {
104-
const artifact = artifacts.readArtifactSync("L1BTCDepositorWormholeV2Base")
106+
const artifact = artifacts.readArtifactSync(
107+
"L1BTCDepositorWormholeV2Base"
108+
)
105109
const functionNames = artifact.abi
106110
.filter((entry: any) => entry.type === "function")
107111
.map((entry: any) => entry.name)
@@ -111,8 +115,15 @@ describe("UpgradeBaseL1BitcoinDepositorToV2 - Artifact Resolution", () => {
111115
})
112116

113117
it("should pass OpenZeppelin prepareUpgrade for a legacy proxy", async () => {
114-
const [deployer, bridge, vault, wormhole, wormholeRelayer, tokenBridge, l2Gateway] =
115-
await ethers.getSigners()
118+
const [
119+
deployer,
120+
bridge,
121+
vault,
122+
wormhole,
123+
wormholeRelayer,
124+
tokenBridge,
125+
l2Gateway,
126+
] = await ethers.getSigners()
116127

117128
// Deploy a mock vault contract that implements tbtcToken() so that
118129
// the legacy L1BitcoinDepositor.initialize() can call it successfully.

0 commit comments

Comments
 (0)