diff --git a/packages/core/.openzeppelin/bsc.json b/packages/core/.openzeppelin/bsc.json index 7666d5d45a..76b3501fe6 100644 --- a/packages/core/.openzeppelin/bsc.json +++ b/packages/core/.openzeppelin/bsc.json @@ -1729,6 +1729,171 @@ }, "namespaces": {} } + }, + "0f95cf567f8918b75255368d276f9d1d3ff01313866d4084b4a734938d09a6e6": { + "address": "0x8C39c41Bd6257B2Fa3aF58511825D5eAD4921279", + "txHash": "0x6c92b19d5bb9196d090c29b37da44e31539e54321141642418575c2265e567dc", + "layout": { + "solcVersion": "0.8.23", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:169" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:111" + }, + { + "label": "counter", + "offset": 0, + "slot": "201", + "type": "t_uint256", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:17" + }, + { + "label": "escrowCounters", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_address,t_uint256)", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:18" + }, + { + "label": "lastEscrow", + "offset": 0, + "slot": "203", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:19" + }, + { + "label": "staking", + "offset": 0, + "slot": "204", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:20" + }, + { + "label": "minimumStake", + "offset": 0, + "slot": "205", + "type": "t_uint256", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:21" + }, + { + "label": "admin", + "offset": 0, + "slot": "206", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:22" + }, + { + "label": "kvstore", + "offset": 0, + "slot": "207", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:23" + }, + { + "label": "__gap", + "offset": 0, + "slot": "208", + "type": "t_array(t_uint256)43_storage", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:195" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)43_storage": { + "label": "uint256[43]", + "numberOfBytes": "1376" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/packages/core/.openzeppelin/mainnet.json b/packages/core/.openzeppelin/mainnet.json index ee64d50eff..8a709b1a34 100644 --- a/packages/core/.openzeppelin/mainnet.json +++ b/packages/core/.openzeppelin/mainnet.json @@ -1729,6 +1729,171 @@ }, "namespaces": {} } + }, + "0f95cf567f8918b75255368d276f9d1d3ff01313866d4084b4a734938d09a6e6": { + "address": "0x182f882690c2B35Eb5885849Bb4331888857CF78", + "txHash": "0xd7100a2f0e6097eee27507ce2d4b1bee3ecf18cdda6b86326d7a2aea42f6a0d7", + "layout": { + "solcVersion": "0.8.23", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:169" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:111" + }, + { + "label": "counter", + "offset": 0, + "slot": "201", + "type": "t_uint256", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:17" + }, + { + "label": "escrowCounters", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_address,t_uint256)", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:18" + }, + { + "label": "lastEscrow", + "offset": 0, + "slot": "203", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:19" + }, + { + "label": "staking", + "offset": 0, + "slot": "204", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:20" + }, + { + "label": "minimumStake", + "offset": 0, + "slot": "205", + "type": "t_uint256", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:21" + }, + { + "label": "admin", + "offset": 0, + "slot": "206", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:22" + }, + { + "label": "kvstore", + "offset": 0, + "slot": "207", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:23" + }, + { + "label": "__gap", + "offset": 0, + "slot": "208", + "type": "t_array(t_uint256)43_storage", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:195" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)43_storage": { + "label": "uint256[43]", + "numberOfBytes": "1376" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/packages/core/.openzeppelin/polygon.json b/packages/core/.openzeppelin/polygon.json index ecfb3f007c..417ed44cbc 100644 --- a/packages/core/.openzeppelin/polygon.json +++ b/packages/core/.openzeppelin/polygon.json @@ -1725,6 +1725,171 @@ }, "namespaces": {} } + }, + "0f95cf567f8918b75255368d276f9d1d3ff01313866d4084b4a734938d09a6e6": { + "address": "0x6839ef9b4872Ee7F1B01AAbbc046872D481A480F", + "txHash": "0x5a0eb7f4d9b09a438f482f77957f27da1c47fb248fa8aafd771d8ab4545edda9", + "layout": { + "solcVersion": "0.8.23", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40" + }, + { + "label": "_owner", + "offset": 0, + "slot": "51", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94" + }, + { + "label": "__gap", + "offset": 0, + "slot": "101", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:169" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol:111" + }, + { + "label": "counter", + "offset": 0, + "slot": "201", + "type": "t_uint256", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:17" + }, + { + "label": "escrowCounters", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_address,t_uint256)", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:18" + }, + { + "label": "lastEscrow", + "offset": 0, + "slot": "203", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:19" + }, + { + "label": "staking", + "offset": 0, + "slot": "204", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:20" + }, + { + "label": "minimumStake", + "offset": 0, + "slot": "205", + "type": "t_uint256", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:21" + }, + { + "label": "admin", + "offset": 0, + "slot": "206", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:22" + }, + { + "label": "kvstore", + "offset": 0, + "slot": "207", + "type": "t_address", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:23" + }, + { + "label": "__gap", + "offset": 0, + "slot": "208", + "type": "t_array(t_uint256)43_storage", + "contract": "EscrowFactory", + "src": "contracts/EscrowFactory.sol:195" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)43_storage": { + "label": "uint256[43]", + "numberOfBytes": "1376" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/packages/core/scripts/rpc-workarounds.ts b/packages/core/scripts/rpc-workarounds.ts new file mode 100644 index 0000000000..6f8b0b2c47 --- /dev/null +++ b/packages/core/scripts/rpc-workarounds.ts @@ -0,0 +1,52 @@ +import { ethers } from 'hardhat'; + +const PATCH_FLAG = Symbol.for('human-protocol.rpc-empty-address-normalized'); + +type JsonRpcSend = (method: string, params?: unknown[]) => Promise; + +function normalizeEmptyAddressFields(payload: T): T { + if (!payload || typeof payload !== 'object') { + return payload; + } + + const normalized = payload as Record; + + if (normalized.to === '') { + normalized.to = null; + } + + if (normalized.contractAddress === '') { + normalized.contractAddress = null; + } + + return payload; +} + +export function applyRpcAddressWorkaround(): void { + const provider = ethers.provider as unknown as { + _hardhatProvider?: { send?: JsonRpcSend; [PATCH_FLAG]?: boolean }; + }; + + const hardhatProvider = provider._hardhatProvider; + + if (!hardhatProvider?.send || hardhatProvider[PATCH_FLAG]) { + return; + } + + const originalSend = hardhatProvider.send.bind(hardhatProvider); + + hardhatProvider.send = async (method: string, params?: unknown[]) => { + const response = await originalSend(method, params); + + if ( + method === 'eth_getTransactionByHash' || + method === 'eth_getTransactionReceipt' + ) { + return normalizeEmptyAddressFields(response); + } + + return response; + }; + + hardhatProvider[PATCH_FLAG] = true; +} diff --git a/packages/core/scripts/upgrade-governor.ts b/packages/core/scripts/upgrade-governor.ts index 82ae82b7d0..32008d0dd7 100644 --- a/packages/core/scripts/upgrade-governor.ts +++ b/packages/core/scripts/upgrade-governor.ts @@ -1,8 +1,11 @@ /* eslint-disable no-console */ import 'dotenv/config'; import { ethers, upgrades } from 'hardhat'; +import { applyRpcAddressWorkaround } from './rpc-workarounds'; async function main() { + applyRpcAddressWorkaround(); + const governorProxy = process.env.GOVERNOR_ADDRESS; const fqName = process.env.GOVERNOR_FQN || diff --git a/packages/core/scripts/upgrade-proxies.ts b/packages/core/scripts/upgrade-proxies.ts index 8e83dacdd6..e494d9a6f5 100644 --- a/packages/core/scripts/upgrade-proxies.ts +++ b/packages/core/scripts/upgrade-proxies.ts @@ -1,8 +1,11 @@ /* eslint-disable no-console */ import { ethers, upgrades } from 'hardhat'; import type { EscrowFactory } from '../typechain-types'; +import { applyRpcAddressWorkaround } from './rpc-workarounds'; async function main() { + applyRpcAddressWorkaround(); + const escrowFactoryAddress = process.env.ESCROW_FACTORY_ADDRESS; const kvStoreAddress = process.env.KVSTORE_ADDRESS; @@ -21,9 +24,13 @@ async function main() { EscrowFactory ); const contract = await escrowFactoryContract.waitForDeployment(); - const hash = contract.deploymentTransaction()?.hash; - if (hash) { - await ethers.provider.getTransactionReceipt(hash); + const upgradeTx = contract.deploymentTransaction(); + if (upgradeTx) { + console.log( + 'Waiting for upgrade transaction confirmation...', + upgradeTx.hash + ); + await upgradeTx.wait(); } const escrowFactory = (await ethers.getContractAt(