Update prettier to the last version

This commit is contained in:
Arnaud 2025-04-09 16:20:26 +02:00
parent de58989edf
commit 7f42ec577c
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F
7 changed files with 67 additions and 33 deletions

46
package-lock.json generated
View File

@ -14,7 +14,7 @@
"chai": "^4.3.7", "chai": "^4.3.7",
"ethers": "6.14.3", "ethers": "6.14.3",
"hardhat": "^2.24.2", "hardhat": "^2.24.2",
"prettier": "^2.8.2", "prettier": "^3.5.3",
"prettier-plugin-solidity": "^1.4.2", "prettier-plugin-solidity": "^1.4.2",
"solhint": "^5.0.5" "solhint": "^5.0.5"
} }
@ -13370,15 +13370,15 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "2.8.8", "version": "3.5.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
"dev": true, "dev": true,
"bin": { "bin": {
"prettier": "bin-prettier.js" "prettier": "bin/prettier.cjs"
}, },
"engines": { "engines": {
"node": ">=10.13.0" "node": ">=14"
}, },
"funding": { "funding": {
"url": "https://github.com/prettier/prettier?sponsor=1" "url": "https://github.com/prettier/prettier?sponsor=1"
@ -14298,6 +14298,23 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/solhint/node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"dev": true,
"license": "MIT",
"optional": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/solhint/node_modules/strip-ansi": { "node_modules/solhint/node_modules/strip-ansi": {
"version": "6.0.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
@ -15106,6 +15123,23 @@
"dev": true, "dev": true,
"peer": true "peer": true
}, },
"node_modules/typechain/node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/typechain/node_modules/ts-essentials": { "node_modules/typechain/node_modules/ts-essentials": {
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz", "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-7.0.3.tgz",

View File

@ -6,8 +6,8 @@
"fuzz": "hardhat compile && fuzzing/fuzz.sh", "fuzz": "hardhat compile && fuzzing/fuzz.sh",
"start": "hardhat node", "start": "hardhat node",
"compile": "hardhat compile", "compile": "hardhat compile",
"format": "prettier --write contracts/*.sol contracts/**/*.sol test/**/*.js", "format": "prettier --write test/**/*.js --plugin=prettier-plugin-solidity contracts/**/*.sol ",
"format:check": "prettier --check contracts/*.sol contracts/**/*.sol test/**/*.js", "format:check": "prettier --check test/**/*.js --plugin=prettier-plugin-solidity contracts/**/*.sol",
"lint": "solhint contracts/**.sol", "lint": "solhint contracts/**.sol",
"deploy": "npx hardhat run scripts/deploy.js", "deploy": "npx hardhat run scripts/deploy.js",
"verify": "npm run verify:marketplace && npm run verify:state_changes", "verify": "npm run verify:marketplace && npm run verify:state_changes",
@ -24,7 +24,7 @@
"chai": "^4.3.7", "chai": "^4.3.7",
"ethers": "6.14.3", "ethers": "6.14.3",
"hardhat": "^2.24.2", "hardhat": "^2.24.2",
"prettier": "^2.8.2", "prettier": "^3.5.3",
"prettier-plugin-solidity": "^1.4.2", "prettier-plugin-solidity": "^1.4.2",
"solhint": "^5.0.5" "solhint": "^5.0.5"
} }

View File

@ -17,7 +17,7 @@ describe("Periods", function () {
.to.have.property("message") .to.have.property("message")
.that.contains( .that.contains(
expectedError, expectedError,
`Expected error ${expectedError}, but got ${error.message}` `Expected error ${expectedError}, but got ${error.message}`,
) )
}) })

View File

@ -212,14 +212,14 @@ describe("Proofs", function () {
it("fails proof submission when proof is incorrect", async function () { it("fails proof submission when proof is incorrect", async function () {
let invalid = exampleProof() let invalid = exampleProof()
await expect( await expect(
proofs.proofReceived(slotId, invalid, pubSignals) proofs.proofReceived(slotId, invalid, pubSignals),
).to.be.revertedWithCustomError(proofs, "Proofs_InvalidProof") ).to.be.revertedWithCustomError(proofs, "Proofs_InvalidProof")
}) })
it("fails proof submission when public input is incorrect", async function () { it("fails proof submission when public input is incorrect", async function () {
let invalid = [1, 2, 3] let invalid = [1, 2, 3]
await expect( await expect(
proofs.proofReceived(slotId, proof, invalid) proofs.proofReceived(slotId, proof, invalid),
).to.be.revertedWithCustomError(proofs, "Proofs_InvalidProof") ).to.be.revertedWithCustomError(proofs, "Proofs_InvalidProof")
}) })
@ -232,7 +232,7 @@ describe("Proofs", function () {
it("fails proof submission when already submitted", async function () { it("fails proof submission when already submitted", async function () {
await proofs.proofReceived(slotId, proof, pubSignals) await proofs.proofReceived(slotId, proof, pubSignals)
await expect( await expect(
proofs.proofReceived(slotId, proof, pubSignals) proofs.proofReceived(slotId, proof, pubSignals),
).to.be.revertedWithCustomError(proofs, "Proofs_ProofAlreadySubmitted") ).to.be.revertedWithCustomError(proofs, "Proofs_ProofAlreadySubmitted")
}) })
@ -249,7 +249,7 @@ describe("Proofs", function () {
await waitUntilProofIsRequired(slotId) await waitUntilProofIsRequired(slotId)
let currentPeriod = periodOf(await currentTime()) let currentPeriod = periodOf(await currentTime())
await expect( await expect(
proofs.markProofAsMissing(slotId, currentPeriod) proofs.markProofAsMissing(slotId, currentPeriod),
).to.be.revertedWithCustomError(proofs, "Proofs_PeriodNotEnded") ).to.be.revertedWithCustomError(proofs, "Proofs_PeriodNotEnded")
}) })
@ -258,7 +258,7 @@ describe("Proofs", function () {
let currentPeriod = periodOf(await currentTime()) let currentPeriod = periodOf(await currentTime())
await advanceTimeTo(periodEnd(currentPeriod) + timeout + 1) await advanceTimeTo(periodEnd(currentPeriod) + timeout + 1)
await expect( await expect(
proofs.markProofAsMissing(slotId, currentPeriod) proofs.markProofAsMissing(slotId, currentPeriod),
).to.be.revertedWithCustomError(proofs, "Proofs_ValidationTimedOut") ).to.be.revertedWithCustomError(proofs, "Proofs_ValidationTimedOut")
}) })
@ -268,7 +268,7 @@ describe("Proofs", function () {
await proofs.proofReceived(slotId, proof, pubSignals) await proofs.proofReceived(slotId, proof, pubSignals)
await advanceTimeTo(periodEnd(receivedPeriod) + 1) await advanceTimeTo(periodEnd(receivedPeriod) + 1)
await expect( await expect(
proofs.markProofAsMissing(slotId, receivedPeriod) proofs.markProofAsMissing(slotId, receivedPeriod),
).to.be.revertedWithCustomError(proofs, "Proofs_ProofNotMissing") ).to.be.revertedWithCustomError(proofs, "Proofs_ProofNotMissing")
}) })
@ -279,7 +279,7 @@ describe("Proofs", function () {
let currentPeriod = periodOf(await currentTime()) let currentPeriod = periodOf(await currentTime())
await advanceTimeTo(periodEnd(currentPeriod) + 1) await advanceTimeTo(periodEnd(currentPeriod) + 1)
await expect( await expect(
proofs.markProofAsMissing(slotId, currentPeriod) proofs.markProofAsMissing(slotId, currentPeriod),
).to.be.revertedWithCustomError(proofs, "Proofs_ProofNotRequired") ).to.be.revertedWithCustomError(proofs, "Proofs_ProofNotRequired")
}) })
@ -289,10 +289,10 @@ describe("Proofs", function () {
await advanceTimeTo(periodEnd(missedPeriod) + 1) await advanceTimeTo(periodEnd(missedPeriod) + 1)
await proofs.markProofAsMissing(slotId, missedPeriod) await proofs.markProofAsMissing(slotId, missedPeriod)
await expect( await expect(
proofs.markProofAsMissing(slotId, missedPeriod) proofs.markProofAsMissing(slotId, missedPeriod),
).to.be.revertedWithCustomError( ).to.be.revertedWithCustomError(
proofs, proofs,
"Proofs_ProofAlreadyMarkedMissing" "Proofs_ProofAlreadyMarkedMissing",
) )
}) })

View File

@ -24,7 +24,7 @@ describe("SlotReservations", function () {
configuration: config.reservations, configuration: config.reservations,
}, },
}, },
} },
) )
reservations = testSlotReservations reservations = testSlotReservations
@ -86,10 +86,10 @@ describe("SlotReservations", function () {
it("cannot reserve a slot more than once", async function () { it("cannot reserve a slot more than once", async function () {
await reservations.reserveSlot(reqId, slotIndex) await reservations.reserveSlot(reqId, slotIndex)
await expect( await expect(
reservations.reserveSlot(reqId, slotIndex) reservations.reserveSlot(reqId, slotIndex),
).to.be.revertedWithCustomError( ).to.be.revertedWithCustomError(
reservations, reservations,
"SlotReservations_ReservationNotAllowed" "SlotReservations_ReservationNotAllowed",
) )
expect(await reservations.length(id)).to.equal(1) expect(await reservations.length(id)).to.equal(1)
}) })
@ -108,10 +108,10 @@ describe("SlotReservations", function () {
await reservations.reserveSlot(reqId, slotIndex) await reservations.reserveSlot(reqId, slotIndex)
switchAccount(provider) switchAccount(provider)
await expect( await expect(
reservations.reserveSlot(reqId, slotIndex) reservations.reserveSlot(reqId, slotIndex),
).to.be.revertedWithCustomError( ).to.be.revertedWithCustomError(
reservations, reservations,
"SlotReservations_ReservationNotAllowed" "SlotReservations_ReservationNotAllowed",
) )
expect(await reservations.length(id)).to.equal(3) expect(await reservations.length(id)).to.equal(3)
expect(await reservations.contains(id, provider.address)).to.be.false expect(await reservations.contains(id, provider.address)).to.be.false
@ -131,10 +131,10 @@ describe("SlotReservations", function () {
it("cannot reserve a slot if not free or not in repair", async function () { it("cannot reserve a slot if not free or not in repair", async function () {
await reservations.setSlotState(id, SlotState.Filled) await reservations.setSlotState(id, SlotState.Filled)
await expect( await expect(
reservations.reserveSlot(reqId, slotIndex) reservations.reserveSlot(reqId, slotIndex),
).to.be.revertedWithCustomError( ).to.be.revertedWithCustomError(
reservations, reservations,
"SlotReservations_ReservationNotAllowed" "SlotReservations_ReservationNotAllowed",
) )
expect(await reservations.length(id)).to.equal(0) expect(await reservations.length(id)).to.equal(0)
}) })
@ -157,7 +157,7 @@ describe("SlotReservations", function () {
it("should not emit an event when reservations are not full", async function () { it("should not emit an event when reservations are not full", async function () {
await expect(reservations.reserveSlot(reqId, slotIndex)).to.not.emit( await expect(reservations.reserveSlot(reqId, slotIndex)).to.not.emit(
reservations, reservations,
"SlotReservationsFull" "SlotReservationsFull",
) )
}) })
}) })

View File

@ -22,7 +22,7 @@ async function waitUntilSlotsFilled(contract, request, proof, token, slots) {
payouts[slotIndex] = payoutForDuration( payouts[slotIndex] = payoutForDuration(
request, request,
await currentTime(), await currentTime(),
requestEnd requestEnd,
) )
} }
@ -35,7 +35,7 @@ async function waitUntilStarted(contract, request, proof, token) {
request, request,
proof, proof,
token, token,
Array.from({ length: request.ask.slots }, (_, i) => i) Array.from({ length: request.ask.slots }, (_, i) => i),
) )
} }
@ -72,7 +72,7 @@ function patchOverloads(contract) {
if (logicalXor(rewardRecipient, collateralRecipient)) { if (logicalXor(rewardRecipient, collateralRecipient)) {
// XOR, if exactly one is truthy // XOR, if exactly one is truthy
throw new Error( throw new Error(
"Invalid freeSlot overload, you must specify both `rewardRecipient` and `collateralRecipient` or neither." "Invalid freeSlot overload, you must specify both `rewardRecipient` and `collateralRecipient` or neither.",
) )
} }

View File

@ -28,21 +28,21 @@ function enableRequestAssertions() {
"expected request #{this} to have client #{exp} but got #{act}", "expected request #{this} to have client #{exp} but got #{act}",
"expected request #{this} to not have client #{act}, expected #{exp}", "expected request #{this} to not have client #{act}, expected #{exp}",
request.client, // expected request.client, // expected
actual.client // actual actual.client, // actual
) )
this.assert( this.assert(
actual.expiry == request.expiry, actual.expiry == request.expiry,
"expected request #{this} to have expiry #{exp} but got #{act}", "expected request #{this} to have expiry #{exp} but got #{act}",
"expected request #{this} to not have expiry #{act}, expected #{exp}", "expected request #{this} to not have expiry #{act}, expected #{exp}",
request.expiry, // expected request.expiry, // expected
actual.expiry // actual actual.expiry, // actual
) )
this.assert( this.assert(
actual.nonce === request.nonce, actual.nonce === request.nonce,
"expected request #{this} to have nonce #{exp} but got #{act}", "expected request #{this} to have nonce #{exp} but got #{act}",
"expected request #{this} to not have nonce #{act}, expected #{exp}", "expected request #{this} to not have nonce #{act}, expected #{exp}",
request.nonce, // expected request.nonce, // expected
actual.nonce // actual actual.nonce, // actual
) )
}) })
} }