From 0ea50a8e8aa1d23e4bd653b636359e68edb91fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20James=20Toussaint?= <33313130+jeremyjams@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:30:38 +0200 Subject: [PATCH 1/2] Add set-callback-gas.ts script --- CHANGELOG.md | 1 + scripts/set-callback-gas.ts | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 scripts/set-callback-gas.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 96bfdbf3f..cc9d6a72b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## vNEXT +- Add `set-callback-gas.ts` script. (#121) - Accept any signature format in `SignatureVerifier.v8` when the account is a smart contract. (#120) - Update UML class diagrams. (#112) - Generate Solidity documentation. (#111) diff --git a/scripts/set-callback-gas.ts b/scripts/set-callback-gas.ts new file mode 100644 index 000000000..e9b209495 --- /dev/null +++ b/scripts/set-callback-gas.ts @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2024 IEXEC BLOCKCHAIN TECH +// SPDX-License-Identifier: Apache-2.0 + +import hre, { deployments } from 'hardhat'; +import { IexecAccessors__factory, IexecMaintenanceDelegate__factory } from '../typechain'; + +(async () => { + const requestedCallbackGas = Number(process.env.CALLBACK_GAS); + if (!requestedCallbackGas) { + console.error('`CALLBACK_GAS` env variable is missing. Aborting.'); + process.exit(1); + } + console.log(`Setting callbackGas to ${requestedCallbackGas} ..`); + const [owner] = await hre.ethers.getSigners(); + const erc1538ProxyAddress = (await deployments.get('ERC1538Proxy')).address; + const getCallbackGas = async () => + IexecAccessors__factory.connect(erc1538ProxyAddress, owner).callbackgas(); + const callbackGasBefore = await getCallbackGas(); + await IexecMaintenanceDelegate__factory.connect(erc1538ProxyAddress, owner) + .setCallbackGas(requestedCallbackGas) + .then((tx) => tx.wait()); + console.log(`Changed callbackGas from ${callbackGasBefore} to ${await getCallbackGas()}`); +})(); From b592e8b41c5de12edca679c214906d329ff04caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20James=20Toussaint?= <33313130+jeremyjams@users.noreply.github.com> Date: Mon, 9 Sep 2024 10:36:56 +0200 Subject: [PATCH 2/2] Update logs --- scripts/set-callback-gas.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/set-callback-gas.ts b/scripts/set-callback-gas.ts index e9b209495..28de48811 100644 --- a/scripts/set-callback-gas.ts +++ b/scripts/set-callback-gas.ts @@ -10,14 +10,16 @@ import { IexecAccessors__factory, IexecMaintenanceDelegate__factory } from '../t console.error('`CALLBACK_GAS` env variable is missing. Aborting.'); process.exit(1); } - console.log(`Setting callbackGas to ${requestedCallbackGas} ..`); + console.log(`Setting callback-gas to ${requestedCallbackGas.toLocaleString()} ..`); const [owner] = await hre.ethers.getSigners(); const erc1538ProxyAddress = (await deployments.get('ERC1538Proxy')).address; - const getCallbackGas = async () => - IexecAccessors__factory.connect(erc1538ProxyAddress, owner).callbackgas(); - const callbackGasBefore = await getCallbackGas(); + const viewCallbackGas = async () => + (await IexecAccessors__factory.connect(erc1538ProxyAddress, owner).callbackgas()) + .toNumber() + .toLocaleString(); + const callbackGasBefore = await viewCallbackGas(); await IexecMaintenanceDelegate__factory.connect(erc1538ProxyAddress, owner) .setCallbackGas(requestedCallbackGas) .then((tx) => tx.wait()); - console.log(`Changed callbackGas from ${callbackGasBefore} to ${await getCallbackGas()}`); -})(); + console.log(`Changed callback-gas from ${callbackGasBefore} to ${await viewCallbackGas()}`); +})().catch((error) => console.log(error));