Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
71e1a03
feat: add workflow for setting callback gas with input validation
gfournieriExec Oct 3, 2025
a031f76
fix: set import back to top
gfournieriExec Oct 6, 2025
c5b26e7
fix: rename callback gas input to `callback_gas-value` for consistency
gfournieriExec Oct 6, 2025
c579ffc
fix: move callback gas input validation step to the correct position …
gfournieriExec Oct 6, 2025
9e9a835
fix: replace hardcoded private key with constant ZERO_PRIVATE_KEY for…
gfournieriExec Oct 6, 2025
6419b10
refactor: update signer retrieval to use getNamedAccounts for consist…
gfournieriExec Oct 6, 2025
8a7d56c
Merge branch 'main' into fix/set-named-account
gfournieriExec Oct 6, 2025
c6796bb
refactor: replace 'admin' with 'owner' in getNamedAccounts usage for …
gfournieriExec Oct 7, 2025
fedcb66
refactor: update factoryDeployer to use deployer address for consistency
gfournieriExec Oct 7, 2025
515f362
refactor: replace 'owner' with 'deployer' in deploy function for cons…
gfournieriExec Oct 7, 2025
4233546
feat: add deployer and admin private keys to .env.template and update…
gfournieriExec Oct 10, 2025
135f38a
Merge branch 'main' into fix/set-named-account
gfournieriExec Oct 10, 2025
649787f
fix: add missing newlines at the end of multiple JSON and Solidity files
gfournieriExec Oct 10, 2025
da8a602
fix: add missing newline at the end of package-lock.json
gfournieriExec Oct 10, 2025
a237175
refactor: replace getNamedAccounts with getDeployerAndOwnerSigners in…
gfournieriExec Oct 10, 2025
ad62269
fix: ensure valid private keys by providing a default zero key
gfournieriExec Oct 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Also defined in Github environments
DEPLOYER_PRIVATE_KEY=
# Hardhat Account #0 (0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)
DEPLOYER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
# Hardhat Account #1 (0x70997970C51812dc3A010C7d01b50e0d17dc79C8)
ADMIN_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
EXPLORER_API_KEY=
IS_VERIFICATION_API_V2=
ARBISCAN_API_KEY=
Expand Down
2 changes: 2 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
"asset": "Token",
"token": "0xe649e6a1F2afc63ca268C2363691ceCAF75CF47C",
"richman": "",
"deployer": "0x111167a21d2bdb8e10b84aee3501059d50756b67",
"owner": "0x111165e3c379e4f8285df34d7137b433c30afa66",
"uniswap": false,
"v3": {
Expand Down Expand Up @@ -186,6 +187,7 @@
"asset": "Token",
"token": "0x9923eD3cbd90CD78b910c475f9A731A6e0b8C963",
"richman": "0x9990cfb1Feb7f47297F54bef4d4EbeDf6c5463a3",
"deployer": "0x9990cfb1Feb7f47297F54bef4d4EbeDf6c5463a3",
"owner": "0x9990cfb1Feb7f47297F54bef4d4EbeDf6c5463a3",
"uniswap": false,
"v3": {
Expand Down
3 changes: 2 additions & 1 deletion deploy/0_deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { DiamondArgsStruct } from '../typechain/contracts/Diamond';
import { Ownable__factory } from '../typechain/factories/@openzeppelin/contracts/access';
import { FactoryDeployer } from '../utils/FactoryDeployer';
import config from '../utils/config';
import { getDeployerAndOwnerSigners } from '../utils/deploy-tools';
import { getFunctionSelectors, linkContractToProxy } from '../utils/proxy-tools';
import { getLibDiamondConfigOrEmpty } from '../utils/tools';

Expand All @@ -49,7 +50,7 @@ export default async function deploy() {
console.log('Deploying PoCo..');
const network = await ethers.provider.getNetwork();
const chainId = network.chainId;
const [deployer] = await ethers.getSigners();
const { deployer } = await getDeployerAndOwnerSigners();
console.log(`Deployer: ${deployer.address}`);
console.log(`Network: ${network.name} (${chainId})`);
const deploymentOptions = config.getChainConfigOrDefault(chainId);
Expand Down
42 changes: 25 additions & 17 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'solidity-docgen';
import { cleanupDeployments, copyDeployments } from './scripts/tools/copy-deployments';
import chainConfig from './utils/config';

const ZERO_PRIVATE_KEY = '0x0000000000000000000000000000000000000000000000000000000000000000';
const isNativeChainType = chainConfig.isNativeChain();
const isLocalFork = process.env.LOCAL_FORK == 'true';
const isFujiFork = process.env.FUJI_FORK == 'true';
Expand Down Expand Up @@ -90,6 +89,20 @@ const config: HardhatUserConfig = {
{ version: '0.4.11', settings }, // RLC contracts
],
},
namedAccounts: {
deployer: {
default: 0,
bellecour: chainConfig.chains['134'].deployer || 0,
arbitrum: chainConfig.chains['42161'].deployer || 0,
arbitrumSepolia: chainConfig.chains['421614'].deployer || 0,
},
owner: {
default: 1,
bellecour: chainConfig.chains['134'].owner || 1,
arbitrum: chainConfig.chains['42161'].owner || 1,
arbitrumSepolia: chainConfig.chains['421614'].owner || 1,
},
},
networks: {
hardhat: {
accounts: {
Expand Down Expand Up @@ -178,41 +191,29 @@ const config: HardhatUserConfig = {
process.env.FUJI_RPC_URL || // Used in local development
process.env.RPC_URL || // Defined in Github Actions environments
'https://api.avax-test.network/ext/bc/C/rpc',
accounts: [
process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY,
process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY,
],
accounts: _getPrivateKeys(),
...fujiBaseConfig,
},
arbitrum: {
url:
process.env.ARBITRUM_RPC_URL || // Used in local development
process.env.RPC_URL || // Defined in Github Actions environments
'https://arbitrum.gateway.tenderly.co',
accounts: [
process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY,
process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY,
],
accounts: _getPrivateKeys(),
...arbitrumBaseConfig,
},
arbitrumSepolia: {
url:
process.env.ARBITRUM_SEPOLIA_RPC_URL || // Used in local development
process.env.RPC_URL || // Defined in Github Actions environments
'https://sepolia-rollup.arbitrum.io/rpc',
accounts: [
process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY,
process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY,
],
accounts: _getPrivateKeys(),
...arbitrumSepoliaBaseConfig,
},
bellecour: {
chainId: 134,
url: 'https://bellecour.iex.ec',
accounts: [
process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY,
process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY,
],
accounts: _getPrivateKeys(),
...bellecourBaseConfig,
verify: {
etherscan: {
Expand Down Expand Up @@ -365,4 +366,11 @@ task('abis', 'Generate contract ABIs').setAction(async (taskArgs, hre) => {
console.log(`Saved ${contracts.length} ABI files to ${abisDir} folder`);
});

function _getPrivateKeys() {
const ZERO_PRIVATE_KEY = '0x0000000000000000000000000000000000000000000000000000000000000000';
const deployerKey = process.env.DEPLOYER_PRIVATE_KEY || ZERO_PRIVATE_KEY;
const adminKey = process.env.ADMIN_PRIVATE_KEY || ZERO_PRIVATE_KEY;
return [deployerKey, adminKey];
}

export default config;
5 changes: 3 additions & 2 deletions scripts/boost/0_deploy-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import {
IexecPocoBoostFacet__factory,
} from '../../typechain';
import config from '../../utils/config';
import { getDeployerAndOwnerSigners } from '../../utils/deploy-tools';
import { mineBlockIfOnLocalFork } from '../../utils/mine';
const genericFactoryAddress = require('@amxx/factory/deployments/GenericFactory.json').address;

(async () => {
console.log('Deploying Boost modules..');
await mineBlockIfOnLocalFork();
const [owner] = await ethers.getSigners();
const { deployer } = await getDeployerAndOwnerSigners();
const chainId = (await ethers.provider.getNetwork()).chainId;
const deploymentOptions = config.getChainConfig(chainId).v5;
if (!deploymentOptions.IexecLibOrders_v5) {
Expand All @@ -34,7 +35,7 @@ const genericFactoryAddress = require('@amxx/factory/deployments/GenericFactory.
bytecode: IexecPocoBoostAccessorsFacet__factory.bytecode,
},
];
const genericFactoryInstance = GenericFactory__factory.connect(genericFactoryAddress, owner);
const genericFactoryInstance = GenericFactory__factory.connect(genericFactoryAddress, deployer);
for (const module of modules) {
const moduleAddress = await genericFactoryInstance.predictAddress(module.bytecode, salt);
await genericFactoryInstance.createContract(module.bytecode, salt).then((tx) => tx.wait());
Expand Down
7 changes: 4 additions & 3 deletions scripts/boost/1_add-modules-to-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '../../typechain';
import { Ownable__factory } from '../../typechain/factories/rlc-faucet-contract/contracts';
import config from '../../utils/config';
import { getDeployerAndOwnerSigners } from '../../utils/deploy-tools';
import {
encodeModuleProxyUpdate,
printBlockTime,
Expand All @@ -32,8 +33,8 @@ import {
const iexecPocoBoostAccessorsFacetAddress = (
await deployments.get('IexecPocoBoostAccessorsFacet')
).address; // Bellecour: 0x56185a2b0dc8b556BBfBAFB702BC971Ed75e868C
const [account] = await ethers.getSigners();
const timelockAddress = await Ownable__factory.connect(diamondProxyAddress, account).owner(); // Bellecour: 0x4611B943AA1d656Fc669623b5DA08756A7e288E9
const { owner } = await getDeployerAndOwnerSigners();
const timelockAddress = await Ownable__factory.connect(diamondProxyAddress, owner).owner(); // Bellecour: 0x4611B943AA1d656Fc669623b5DA08756A7e288E9

const iexecLibOrders = {
['contracts/libs/IexecLibOrders_v5.sol:IexecLibOrders_v5']:
Expand All @@ -60,7 +61,7 @@ import {
] as [string[], bigint[], BytesLike[], BytesLike, BytesLike];
console.log('Scheduling proxy update..');
await printBlockTime();
const timelockInstance = TimelockController__factory.connect(timelockAddress, account);
const timelockInstance = TimelockController__factory.connect(timelockAddress, owner);
const timelockAdminAddress = await timelockInstance.getRoleMember(
await timelockInstance.PROPOSER_ROLE(),
0,
Expand Down
7 changes: 4 additions & 3 deletions scripts/deploy-timelock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { duration } from '@nomicfoundation/hardhat-network-helpers/dist/src/help
import { ethers } from 'hardhat';
import { TimelockController__factory } from '../typechain';
import { FactoryDeployer } from '../utils/FactoryDeployer';
import { getDeployerAndOwnerSigners } from '../utils/deploy-tools';

/**
* Deploy TimelockController contract using the generic factory.
Expand All @@ -13,8 +14,8 @@ import { FactoryDeployer } from '../utils/FactoryDeployer';
export const deploy = async () => {
console.log('Deploying TimelockController..');
const chainId = (await ethers.provider.getNetwork()).chainId;
const [owner] = await ethers.getSigners();
const factoryDeployer = new FactoryDeployer(owner, chainId);
const { deployer } = await getDeployerAndOwnerSigners();
const factoryDeployer = new FactoryDeployer(deployer, chainId);

// Deploy TimelockController
const ONE_WEEK_IN_SECONDS = duration.days(7);
Expand All @@ -33,7 +34,7 @@ export const deploy = async () => {
'0x0B3a38b0A47aB0c5E8b208A703de366751Df5916', // v5 deployer
];
const constructorArgs = [ONE_WEEK_IN_SECONDS, ADMINISTRATORS, PROPOSERS, EXECUTORS];
const timelockFactory = new TimelockController__factory(owner);
const timelockFactory = new TimelockController__factory(deployer);
await factoryDeployer.deployContract(timelockFactory, constructorArgs);
};

Expand Down
4 changes: 2 additions & 2 deletions scripts/set-callback-gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { ethers } from 'hardhat';
import { IexecInterfaceToken__factory } from '../typechain';
import config from '../utils/config';
import { getDeployerAndOwnerSigners } from '../utils/deploy-tools';

(async () => {
const requestedCallbackGas = Number(process.env.CALLBACK_GAS);
Expand All @@ -19,8 +20,7 @@ import config from '../utils/config';
throw new Error('Diamond proxy address is required');
}
console.log(`Diamond proxy address: ${proxyAddress}`);
// TODO: update here to use getNamedAccounts
const [, owner] = await ethers.getSigners();
const { owner } = await getDeployerAndOwnerSigners();
const iexecPoCo = IexecInterfaceToken__factory.connect(proxyAddress, owner);
if ((await iexecPoCo.owner()) !== owner.address) {
throw new Error(`Sender account ${owner.address} is not the PoCo owner.`);
Expand Down
3 changes: 2 additions & 1 deletion scripts/sponsoring/0_deploy-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
IexecPocoAccessorsFacet__factory,
} from '../../typechain';
import config from '../../utils/config';
import { getDeployerAndOwnerSigners } from '../../utils/deploy-tools';
const genericFactoryAddress = require('@amxx/factory/deployments/GenericFactory.json').address;

if (process.env.HANDLE_SPONSORING_UPGRADE_INTERNALLY != 'true') {
Expand All @@ -20,7 +21,7 @@ if (process.env.HANDLE_SPONSORING_UPGRADE_INTERNALLY != 'true') {

export async function deployModules() {
console.log('Deploying modules..');
const [deployer] = await ethers.getSigners();
const { deployer } = await getDeployerAndOwnerSigners();
console.log(`Deployer: ${deployer.address}`);
const chainId = (await ethers.provider.getNetwork()).chainId;
const deploymentOptions = config.getChainConfig(chainId).v5;
Expand Down
8 changes: 4 additions & 4 deletions scripts/sponsoring/1_add-modules-to-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ export async function addModulesToProxy() {
console.log(`Expected Timelock proposer: ${timelockAdminAddress}`);
/*
// Enable this in production
const [proposer] = await ethers.getSigners();
console.log(`Actual Timelock proposer: ${proposer.address}`);
if (proposer.address != timelockAdminAddress) {
const { owner } = await getDeployerAndOwnerSigners();
console.log(`Actual Timelock proposer: ${owner.address}`);
if (owner.address != timelockAdminAddress) {
console.error('Bad proposer');
process.exit(1);
}
*/
const timelockAdminSigner = await ethers.getImpersonatedSigner(timelockAdminAddress);
//const timelockAdminSigner = proposer; // Enable this in production
//const timelockAdminSigner = owner; // Enable this in production
await scheduleUpgrade();
await time.increase(delay); // Disable this in production
console.log('Time traveling..');
Expand Down
13 changes: 7 additions & 6 deletions scripts/upgrades/deploy-and-update-some-facet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ import {
import { Ownable__factory } from '../../typechain/factories/rlc-faucet-contract/contracts';
import { FactoryDeployer } from '../../utils/FactoryDeployer';
import config from '../../utils/config';
import { getDeployerAndOwnerSigners } from '../../utils/deploy-tools';
import { linkContractToProxy } from '../../utils/proxy-tools';
import { printFunctions } from './upgrade-helper';

(async () => {
console.log('Deploying and updating IexecPocoAccessorsFacet & IexecPoco1Facet...');

const [account] = await ethers.getSigners();
const { deployer, owner } = await getDeployerAndOwnerSigners();
const chainId = (await ethers.provider.getNetwork()).chainId;
const deploymentOptions = config.getChainConfig(chainId).v5;

Expand All @@ -35,21 +36,21 @@ import { printFunctions } from './upgrade-helper';
console.log(`Network: ${chainId}`);
console.log(`Diamond proxy address: ${diamondProxyAddress}`);

const proxyOwnerAddress = await Ownable__factory.connect(diamondProxyAddress, account).owner();
const proxyOwnerAddress = await Ownable__factory.connect(diamondProxyAddress, owner).owner();
console.log(`Diamond proxy owner: ${proxyOwnerAddress}`);

// Use impersonated signer only for fork testing, otherwise use account signer
// Use impersonated signer only for fork testing, otherwise use owner signer
const proxyOwnerSigner =
process.env.ARBITRUM_FORK === 'true' || process.env.ARBITRUM_SEPOLIA_FORK === 'true'
? await ethers.getImpersonatedSigner(proxyOwnerAddress)
: account;
: owner;
const diamondProxyAsOwner = DiamondCutFacet__factory.connect(
diamondProxyAddress,
proxyOwnerSigner,
);

console.log('\n=== Step 1: Deploying all new facets ===');
const factoryDeployer = new FactoryDeployer(account, chainId);
const factoryDeployer = new FactoryDeployer(deployer, chainId);
const iexecLibOrders = {
['contracts/libs/IexecLibOrders_v5.sol:IexecLibOrders_v5']:
deploymentOptions.IexecLibOrders_v5,
Expand All @@ -69,7 +70,7 @@ import { printFunctions } from './upgrade-helper';
'\n=== Step 2: Remove old facets (IexecAccessorsFacet & IexecPocoAccessorsFacet & IexecPoco1Facet) ===',
);

const diamondLoupe = DiamondLoupeFacet__factory.connect(diamondProxyAddress, account);
const diamondLoupe = DiamondLoupeFacet__factory.connect(diamondProxyAddress, owner);
const currentFacets = await diamondLoupe.facets();

console.log('\nCurrent facets in diamond:');
Expand Down
2 changes: 1 addition & 1 deletion test/000_fullchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { expect } from 'chai';
import { IexecInterfaceNative, IexecInterfaceNative__factory } from '../typechain';
import { TAG_STANDARD, TAG_TEE } from '../utils/constants';
import { OrdersActors, OrdersAssets, OrdersPrices, buildOrders } from '../utils/createOrders';
import {
PocoMode,
Expand All @@ -16,7 +17,6 @@ import {
import { IexecWrapper } from './utils/IexecWrapper';
import { loadHardhatFixtureDeployment } from './utils/hardhat-fixture-deployer';
import { randomAddress } from './utils/utils';
import { TAG_STANDARD, TAG_TEE } from '../utils/constants';

// +---------+-------------+-------------+-------------+----------+-----+---------------------------------------------+
// | | Sponsorship | Replication | Beneficiary | Callback | BoT | Type |
Expand Down
2 changes: 1 addition & 1 deletion test/200_fullchain-bot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { expect } from 'chai';
import { IexecInterfaceNative, IexecInterfaceNative__factory } from '../typechain';
import { TAG_STANDARD } from '../utils/constants';
import { OrdersActors, OrdersAssets, OrdersPrices, buildOrders } from '../utils/createOrders';
import { TaskStatusEnum, buildUtf8ResultAndDigest, getIexecAccounts } from '../utils/poco-tools';
import { IexecWrapper } from './utils/IexecWrapper';
import { loadHardhatFixtureDeployment } from './utils/hardhat-fixture-deployer';
import { TAG_STANDARD } from '../utils/constants';

const appPrice = 1000n;
const datasetPrice = 1_000_000n;
Expand Down
2 changes: 1 addition & 1 deletion test/201_fullchain-multi-orders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { expect } from 'chai';
import { ethers } from 'hardhat';
import { IexecInterfaceNative, IexecInterfaceNative__factory } from '../typechain';
import { TAG_STANDARD } from '../utils/constants';
import {
IexecOrders,
OrdersActors,
Expand All @@ -22,7 +23,6 @@ import {
import { maxBigInt, minBigInt } from '../utils/tools';
import { IexecWrapper } from './utils/IexecWrapper';
import { loadHardhatFixtureDeployment } from './utils/hardhat-fixture-deployer';
import { TAG_STANDARD } from '../utils/constants';

const appPrice = 1000n;
const datasetPrice = 1_000_000n;
Expand Down
2 changes: 1 addition & 1 deletion test/300_fullchain-reopen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { IexecInterfaceNative, IexecInterfaceNative__factory } from '../typechai
import { OrdersActors, OrdersAssets, OrdersPrices, buildOrders } from '../utils/createOrders';
import { loadHardhatFixtureDeployment } from './utils/hardhat-fixture-deployer';

import { TAG_STANDARD } from '../utils/constants';
import {
TaskStatusEnum,
buildAndSignContributionAuthorizationMessage,
Expand All @@ -18,7 +19,6 @@ import {
getIexecAccounts,
} from '../utils/poco-tools';
import { IexecWrapper } from './utils/IexecWrapper';
import { TAG_STANDARD } from '../utils/constants';

const appPrice = 1000n;
const datasetPrice = 1_000_000n;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { expect } from 'chai';
import { Wallet, ZeroAddress } from 'ethers';
import { IexecInterfaceNative, IexecInterfaceNative__factory } from '../../../typechain';
import { TAG_STANDARD } from '../../../utils/constants';
import { OrdersAssets, OrdersPrices, buildOrders } from '../../../utils/createOrders';
import {
ContributionStatusEnum,
Expand All @@ -16,7 +17,6 @@ import {
} from '../../../utils/poco-tools';
import { IexecWrapper } from '../../utils/IexecWrapper';
import { loadHardhatFixtureDeployment } from '../../utils/hardhat-fixture-deployer';
import { TAG_STANDARD } from '../../../utils/constants';

const volume = 1n;
const trust = 1n;
Expand Down
Loading