Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pg): Improve reliability of internal hardhat simulation in monorepos #1710

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .changeset/nasty-bags-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@sphinx-labs/plugins': patch
'@sphinx-labs/core': patch
---

Improve reliability of internal hardhat simulation in monorepos
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
command: sh ./scripts/create-placeholder.sh
- run:
name: Install dependencies
command: yarn --frozen-lockfile --link-duplicates --network-concurrency 1
command: yarn --frozen-lockfile --network-concurrency 1
sam-goldman marked this conversation as resolved.
Show resolved Hide resolved
- save_cache:
key: v2-cache-yarn-install-{{ checksum "yarn.lock" }}
paths:
Expand Down
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"semver": "^7.3.8",
"solidity-ast": "^0.4.45",
"undici": "^5.21.1",
"yesno": "^0.4.0"
"yesno": "^0.4.0",
"debug": "^4.3.4"
},
"devDependencies": {
"@types/sinon": "^17.0.2",
Expand Down
10 changes: 4 additions & 6 deletions packages/core/src/actions/execute.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Logger } from '@eth-optimism/common-ts'
import { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider'
import {
SphinxLeafWithProof,
ManagedServiceABI,
Expand All @@ -26,7 +25,7 @@ import {
MerkleRootStatus,
} from './types'
import { ExecutionMode } from '../constants'
import { SphinxJsonRpcProvider } from '../provider'
import { InProcessEthersProvider, SphinxJsonRpcProvider } from '../provider'
import {
addSphinxWalletsToGnosisSafeOwners,
findLeafWithProof,
Expand Down Expand Up @@ -254,7 +253,7 @@ export type DeploymentContext = {
*
* Allows us to generate and supply the rpc provider in whatever way we would like.
*/
provider: SphinxJsonRpcProvider | HardhatEthersProvider
provider: SphinxJsonRpcProvider | InProcessEthersProvider

/**
* An optional wallet.
Expand Down Expand Up @@ -1169,7 +1168,7 @@ export const fetchExecutionTransactionReceipts = async (
receipts: ethers.TransactionReceipt[],
moduleAddress: string,
merkleRoot: string,
provider: SphinxJsonRpcProvider | HardhatEthersProvider
provider: SphinxJsonRpcProvider | InProcessEthersProvider
) => {
const module = new ethers.Contract(moduleAddress, SphinxModuleABI, provider)

Expand Down Expand Up @@ -1308,7 +1307,6 @@ export const attemptDeployment = async (
const signatures: string[] = signers
.map((signer) => signer.signature)
.filter((signature) => signature !== null) as any

;({ receipts, batches, finalStatus, failureAction } =
await executeDeployment(
targetNetworkNetworkConfig,
Expand All @@ -1325,6 +1323,7 @@ export const attemptDeployment = async (
targetNetworkNetworkConfig,
failureAction
)

return {
receipts: deploymentTransactionReceipts.map(
convertEthersTransactionReceipt
Expand All @@ -1338,7 +1337,6 @@ export const attemptDeployment = async (
await deploymentContext.handleError(e, deployment)
return
}

await deploymentContext.handleSuccess(
deploymentContext,
targetNetworkNetworkConfig
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ export * from './provider'
export * from './artifacts'
export * from './types'
export * from './errors'
export * from './provider'
17 changes: 8 additions & 9 deletions packages/core/src/languages/solidity/predeploys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
getOwnerAddress,
getSphinxConstants,
} from '@sphinx-labs/contracts'
import { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider'
import ora from 'ora'

import {
Expand All @@ -22,7 +21,7 @@ import {
getImpersonatedSigner,
fundAccountMaxBalance,
} from '../../utils'
import { SphinxJsonRpcProvider } from '../../provider'
import { InProcessEthersProvider, SphinxJsonRpcProvider } from '../../provider'
import { ExecutionMode, RELAYER_ROLE } from '../../constants'
import {
fetchDripSizeForNetwork,
Expand All @@ -31,7 +30,7 @@ import {
} from '../../networks'

export const ensureSphinxAndGnosisSafeDeployed = async (
provider: SphinxJsonRpcProvider | HardhatEthersProvider,
provider: SphinxJsonRpcProvider | InProcessEthersProvider,
wallet: ethers.Wallet,
executionMode: ExecutionMode,
includeManagedServiceRoles: boolean,
Expand All @@ -58,7 +57,7 @@ export const ensureSphinxAndGnosisSafeDeployed = async (

export const cancelPreviousDripVersions = async (
Drippie: Contract,
provider: SphinxJsonRpcProvider | HardhatEthersProvider,
provider: SphinxJsonRpcProvider | InProcessEthersProvider,
wallet: ethers.Signer,
executionMode: ExecutionMode,
dripName: string,
Expand Down Expand Up @@ -103,7 +102,7 @@ export const cancelPreviousDripVersions = async (
}

export const checkSystemDeployed = async (
provider: SphinxJsonRpcProvider | HardhatEthersProvider
provider: SphinxJsonRpcProvider | InProcessEthersProvider
): Promise<boolean> => {
const contracts = getSphinxConstants()

Expand All @@ -120,7 +119,7 @@ export const checkSystemDeployed = async (
}

export const assignManagedServiceRoles = async (
provider: SphinxJsonRpcProvider | HardhatEthersProvider,
provider: SphinxJsonRpcProvider | InProcessEthersProvider,
signer: ethers.Signer,
relayers: string[],
executionMode: ExecutionMode,
Expand Down Expand Up @@ -268,7 +267,7 @@ export const assignManagedServiceRoles = async (
}

export const deploySphinxSystem = async (
provider: SphinxJsonRpcProvider | HardhatEthersProvider,
provider: SphinxJsonRpcProvider | InProcessEthersProvider,
signer: ethers.Signer,
relayers: string[],
executionMode: ExecutionMode,
Expand Down Expand Up @@ -319,7 +318,7 @@ export const deploySphinxSystem = async (
}

export const getDeterministicFactoryAddress = async (
provider: SphinxJsonRpcProvider | HardhatEthersProvider
provider: SphinxJsonRpcProvider | InProcessEthersProvider
) => {
// Deploy the deterministic deployer.
if (
Expand Down Expand Up @@ -367,7 +366,7 @@ export const getDeterministicFactoryAddress = async (
}

export const doDeterministicDeploy = async (
provider: SphinxJsonRpcProvider | HardhatEthersProvider,
provider: SphinxJsonRpcProvider | InProcessEthersProvider,
executionMode: ExecutionMode,
options: {
contract: {
Expand Down
Loading