From abda1961ae9e5a31760c242b3a093eedd9f7b6fa Mon Sep 17 00:00:00 2001 From: John Kane Date: Tue, 1 Aug 2023 11:51:10 +0100 Subject: [PATCH] refactor: move internal types under own subfolders * move deploy-loader types under own folder * move journal types under own folder * move execution types under own folder Resolves #374. --- packages/core/src/new-api/internal/batcher.ts | 2 +- .../core/src/new-api/internal/deployer.ts | 18 +-- .../ephemeral-deployment-loader.ts | 5 +- .../file-deployment-loader.ts | 5 +- .../types.ts} | 3 +- .../internal/execution/chain-dispatcher.ts | 2 +- .../internal/execution/execution-engine.ts | 28 ++-- .../execution/execution-state-reducer.ts | 26 ++-- .../execution/execution-strategy-cycler.ts | 4 +- .../internal/execution/execution-strategy.ts | 22 +-- .../src/new-api/internal/execution/guards.ts | 2 +- .../execution/onchain-action-reducer.ts | 4 +- .../execution/onchain-state-transitions.ts | 28 ++-- .../execution/sort-futures-by-nonces.ts | 2 +- .../execution/transaction-lookup-timer.ts | 6 +- .../execution-state.ts => execution/types.ts} | 139 +++++++++++++++++- .../new-api/internal/journal/file-journal.ts | 3 +- .../internal/journal/memory-journal.ts | 3 +- .../new-api/internal/journal/type-guards.ts | 3 +- .../{types/journal.ts => journal/types.ts} | 0 .../src/new-api/internal/journal/utils/log.ts | 2 +- .../execution-state-resolver.ts | 2 +- .../futures/reconcileArtifactContractAt.ts | 2 +- .../reconcileArtifactContractDeployment.ts | 2 +- .../reconcileArtifactLibraryDeployment.ts | 2 +- .../futures/reconcileNamedContractAt.ts | 2 +- .../futures/reconcileNamedContractCall.ts | 2 +- .../reconcileNamedContractDeployment.ts | 2 +- .../reconcileNamedLibraryDeployment.ts | 2 +- .../futures/reconcileNamedStaticCall.ts | 2 +- .../futures/reconcileReadEventArgument.ts | 2 +- .../futures/reconcileSendData.ts | 2 +- ...concile-current-and-previous-type-match.ts | 2 +- .../reconcile-dependency-rules.ts | 2 +- ...concile-future-specific-reconciliations.ts | 2 +- .../internal/reconciliation/reconciler.ts | 4 +- .../new-api/internal/reconciliation/types.ts | 2 +- .../core/src/new-api/internal/type-guards.ts | 2 +- .../internal/types/chain-dispatcher.ts | 60 -------- .../internal/types/execution-engine.ts | 47 ------ .../internal/types/transaction-timer.ts | 32 ---- .../new-api/internal/utils/resolve-futures.ts | 2 +- packages/core/src/new-api/internal/wiper.ts | 4 +- packages/core/test/new-api/batcher.ts | 4 +- .../execution/sort-futures-by-nonce.ts | 2 +- packages/core/test/new-api/helpers.ts | 10 +- .../futures/reconcileArtifactContractAt.ts | 2 +- .../reconcileArtifactContractDeployment.ts | 2 +- .../reconcileArtifactLibraryDeployment.ts | 2 +- .../futures/reconcileNamedContractAt.ts | 2 +- .../futures/reconcileNamedContractCall.ts | 2 +- .../reconcileNamedContractDeployment.ts | 2 +- .../reconcileNamedLibraryDeployment.ts | 2 +- .../futures/reconcileNamedStaticCall.ts | 2 +- .../futures/reconcileReadEventArgument.ts | 2 +- .../futures/reconcileSendData.ts | 2 +- .../test/new-api/reconciliation/helpers.ts | 2 +- .../test/new-api/reconciliation/reconciler.ts | 4 +- .../test/new-api/types/deployment-loader.ts | 2 +- packages/core/test/new-api/wipe.ts | 2 +- 60 files changed, 263 insertions(+), 271 deletions(-) rename packages/core/src/new-api/internal/{types/deployment-loader.ts => deployment-loader/types.ts} (92%) rename packages/core/src/new-api/internal/{types/execution-state.ts => execution/types.ts} (60%) rename packages/core/src/new-api/internal/{types/journal.ts => journal/types.ts} (100%) delete mode 100644 packages/core/src/new-api/internal/types/chain-dispatcher.ts delete mode 100644 packages/core/src/new-api/internal/types/execution-engine.ts delete mode 100644 packages/core/src/new-api/internal/types/transaction-timer.ts diff --git a/packages/core/src/new-api/internal/batcher.ts b/packages/core/src/new-api/internal/batcher.ts index c92d8ee8a..67ad05bd7 100644 --- a/packages/core/src/new-api/internal/batcher.ts +++ b/packages/core/src/new-api/internal/batcher.ts @@ -1,6 +1,6 @@ import { Future, IgnitionModule } from "../types/module"; -import { ExecutionStateMap, ExecutionStatus } from "./types/execution-state"; +import { ExecutionStateMap, ExecutionStatus } from "./execution/types"; import { AdjacencyList } from "./utils/adjacency-list"; import { AdjacencyListConverter } from "./utils/adjacency-list-converter"; import { getFuturesFromModule } from "./utils/get-futures-from-module"; diff --git a/packages/core/src/new-api/internal/deployer.ts b/packages/core/src/new-api/internal/deployer.ts index e26560b78..67e69e758 100644 --- a/packages/core/src/new-api/internal/deployer.ts +++ b/packages/core/src/new-api/internal/deployer.ts @@ -20,23 +20,23 @@ import { import { Batcher } from "./batcher"; import { defaultConfig } from "./defaultConfig"; +import { DeploymentLoader } from "./deployment-loader/types"; import { ExecutionEngine } from "./execution/execution-engine"; import { executionStateReducer } from "./execution/execution-state-reducer"; import { BasicExecutionStrategy } from "./execution/execution-strategy"; import { TranactionLookupTimerImpl } from "./execution/transaction-lookup-timer"; -import { ModuleConstructor } from "./module-builder"; -import { Reconciler } from "./reconciliation/reconciler"; -import { ArtifactMap } from "./reconciliation/types"; -import { isContractExecutionStateArray } from "./type-guards"; -import { ChainDispatcher } from "./types/chain-dispatcher"; -import { DeploymentLoader } from "./types/deployment-loader"; -import { ExecutionStrategy } from "./types/execution-engine"; import { + ChainDispatcher, ContractAtExecutionState, DeploymentExecutionState, ExecutionStateMap, -} from "./types/execution-state"; -import { TransactionLookupTimer } from "./types/transaction-timer"; + ExecutionStrategy, + TransactionLookupTimer, +} from "./execution/types"; +import { ModuleConstructor } from "./module-builder"; +import { Reconciler } from "./reconciliation/reconciler"; +import { ArtifactMap } from "./reconciliation/types"; +import { isContractExecutionStateArray } from "./type-guards"; import { assertIgnitionInvariant } from "./utils/assertions"; import { getFuturesFromModule } from "./utils/get-futures-from-module"; import { validate } from "./validation/validate"; diff --git a/packages/core/src/new-api/internal/deployment-loader/ephemeral-deployment-loader.ts b/packages/core/src/new-api/internal/deployment-loader/ephemeral-deployment-loader.ts index 7e36929b0..1a935a596 100644 --- a/packages/core/src/new-api/internal/deployment-loader/ephemeral-deployment-loader.ts +++ b/packages/core/src/new-api/internal/deployment-loader/ephemeral-deployment-loader.ts @@ -1,9 +1,10 @@ import { Artifact, ArtifactResolver, BuildInfo } from "../../types/artifact"; import { MemoryJournal } from "../journal/memory-journal"; -import { DeploymentLoader } from "../types/deployment-loader"; -import { Journal, JournalableMessage } from "../types/journal"; +import { Journal, JournalableMessage } from "../journal/types"; import { assertIgnitionInvariant } from "../utils/assertions"; +import { DeploymentLoader } from "./types"; + /** * Stores and loads deployment related information without making changes * on disk, by either storing in memory or loading already existing files. diff --git a/packages/core/src/new-api/internal/deployment-loader/file-deployment-loader.ts b/packages/core/src/new-api/internal/deployment-loader/file-deployment-loader.ts index 4c51528ba..49c1bd93c 100644 --- a/packages/core/src/new-api/internal/deployment-loader/file-deployment-loader.ts +++ b/packages/core/src/new-api/internal/deployment-loader/file-deployment-loader.ts @@ -3,8 +3,9 @@ import path from "path"; import { Artifact, BuildInfo } from "../../types/artifact"; import { FileJournal } from "../journal/file-journal"; -import { DeploymentLoader } from "../types/deployment-loader"; -import { Journal, JournalableMessage } from "../types/journal"; +import { Journal, JournalableMessage } from "../journal/types"; + +import { DeploymentLoader } from "./types"; export class FileDeploymentLoader implements DeploymentLoader { private _journal: Journal; diff --git a/packages/core/src/new-api/internal/types/deployment-loader.ts b/packages/core/src/new-api/internal/deployment-loader/types.ts similarity index 92% rename from packages/core/src/new-api/internal/types/deployment-loader.ts rename to packages/core/src/new-api/internal/deployment-loader/types.ts index c7a5fbc61..7fab7661d 100644 --- a/packages/core/src/new-api/internal/types/deployment-loader.ts +++ b/packages/core/src/new-api/internal/deployment-loader/types.ts @@ -1,6 +1,5 @@ import { Artifact, BuildInfo } from "../../types/artifact"; - -import { JournalableMessage } from "./journal"; +import { JournalableMessage } from "../journal/types"; /** * Read and write to the deployment storage. diff --git a/packages/core/src/new-api/internal/execution/chain-dispatcher.ts b/packages/core/src/new-api/internal/execution/chain-dispatcher.ts index 8db43f1f3..bdda9de70 100644 --- a/packages/core/src/new-api/internal/execution/chain-dispatcher.ts +++ b/packages/core/src/new-api/internal/execution/chain-dispatcher.ts @@ -3,10 +3,10 @@ import { Contract, ContractFactory, ethers } from "ethers"; import { IgnitionError } from "../../../errors"; import { Adapters } from "../../types/adapters"; import { ArgumentType } from "../../types/module"; -import { ChainDispatcher } from "../types/chain-dispatcher"; import { assertIgnitionInvariant } from "../utils/assertions"; import { AccountsState } from "./execution-engine"; +import { ChainDispatcher } from "./types"; export class ChainDispatcherImpl implements ChainDispatcher { private _accountsState: AccountsState; diff --git a/packages/core/src/new-api/internal/execution/execution-engine.ts b/packages/core/src/new-api/internal/execution/execution-engine.ts index 3f28ce839..64227ed7c 100644 --- a/packages/core/src/new-api/internal/execution/execution-engine.ts +++ b/packages/core/src/new-api/internal/execution/execution-engine.ts @@ -27,25 +27,15 @@ import { NamedContractDeploymentFuture, NamedLibraryDeploymentFuture, } from "../../types/module"; -import { - isCallExecutionState, - isContractAtExecutionState, - isDeploymentExecutionState, - isReadEventArgumentExecutionState, - isSendDataExecutionState, - isStaticCallExecutionState, -} from "../type-guards"; -import { DeploymentLoader } from "../types/deployment-loader"; -import { - ExecutionEngineState, - ExecutionStrategyContext, -} from "../types/execution-engine"; +import { DeploymentLoader } from "../deployment-loader/types"; import { ContractAtExecutionState, DeploymentExecutionState, + ExecutionEngineState, ExecutionStateMap, ExecutionStatus, -} from "../types/execution-state"; + ExecutionStrategyContext, +} from "../execution/types"; import { ExecutionResultMessage, ExecutionTimeout, @@ -54,7 +44,15 @@ import { OnchainTransactionReset, StartRunMessage, TransactionMessage, -} from "../types/journal"; +} from "../journal/types"; +import { + isCallExecutionState, + isContractAtExecutionState, + isDeploymentExecutionState, + isReadEventArgumentExecutionState, + isSendDataExecutionState, + isStaticCallExecutionState, +} from "../type-guards"; import { isAddress } from "../utils"; import { assertIgnitionInvariant } from "../utils/assertions"; import { getFuturesFromModule } from "../utils/get-futures-from-module"; diff --git a/packages/core/src/new-api/internal/execution/execution-state-reducer.ts b/packages/core/src/new-api/internal/execution/execution-state-reducer.ts index effc69f8c..dfc94f69e 100644 --- a/packages/core/src/new-api/internal/execution/execution-state-reducer.ts +++ b/packages/core/src/new-api/internal/execution/execution-state-reducer.ts @@ -1,4 +1,16 @@ import { IgnitionError } from "../../../errors"; +import { + CallExecutionState, + ContractAtExecutionState, + DeploymentExecutionState, + ExecutionState, + ExecutionStateMap, + ExecutionStatus, + OnchainStatuses, + ReadEventArgumentExecutionState, + SendDataExecutionState, + StaticCallExecutionState, +} from "../execution/types"; import { isCallFunctionStartMessage, isContractAtStartMessage, @@ -11,19 +23,7 @@ import { isTransactionMessage, isWipeMessage, } from "../journal/type-guards"; -import { - CallExecutionState, - ContractAtExecutionState, - DeploymentExecutionState, - ExecutionState, - ExecutionStateMap, - ExecutionStatus, - OnchainStatuses, - ReadEventArgumentExecutionState, - SendDataExecutionState, - StaticCallExecutionState, -} from "../types/execution-state"; -import { FutureStartMessage, JournalableMessage } from "../types/journal"; +import { FutureStartMessage, JournalableMessage } from "../journal/types"; import { assertIgnitionInvariant } from "../utils/assertions"; import { diff --git a/packages/core/src/new-api/internal/execution/execution-strategy-cycler.ts b/packages/core/src/new-api/internal/execution/execution-strategy-cycler.ts index 2f1160ea5..76da1474e 100644 --- a/packages/core/src/new-api/internal/execution/execution-strategy-cycler.ts +++ b/packages/core/src/new-api/internal/execution/execution-strategy-cycler.ts @@ -1,11 +1,11 @@ +import { ExecutionState } from "../execution/types"; import { isOnChainResultMessage } from "../journal/type-guards"; -import { ExecutionState } from "../types/execution-state"; import { ExecutionSuccess, OnchainInteractionMessage, OnchainResultMessage, TransactionMessage, -} from "../types/journal"; +} from "../journal/types"; export class ExecutionStategyCycler { /** * Given a execution strategy and history of on chain transactions diff --git a/packages/core/src/new-api/internal/execution/execution-strategy.ts b/packages/core/src/new-api/internal/execution/execution-strategy.ts index 70ed92825..9a9211f81 100644 --- a/packages/core/src/new-api/internal/execution/execution-strategy.ts +++ b/packages/core/src/new-api/internal/execution/execution-strategy.ts @@ -1,22 +1,14 @@ import { IgnitionError } from "../../../errors"; -import { - isCallExecutionState, - isContractAtExecutionState, - isDeploymentExecutionState, - isReadEventArgumentExecutionState, - isSendDataExecutionState, - isStaticCallExecutionState, -} from "../type-guards"; -import { ExecutionStrategy } from "../types/execution-engine"; import { CallExecutionState, ContractAtExecutionState, DeploymentExecutionState, ExecutionState, + ExecutionStrategy, ReadEventArgumentExecutionState, SendDataExecutionState, StaticCallExecutionState, -} from "../types/execution-state"; +} from "../execution/types"; import { CallFunctionInteractionMessage, CalledFunctionExecutionSuccess, @@ -39,7 +31,15 @@ import { SendDataInteractionMessage, StaticCallExecutionSuccess, StaticCallInteractionMessage, -} from "../types/journal"; +} from "../journal/types"; +import { + isCallExecutionState, + isContractAtExecutionState, + isDeploymentExecutionState, + isReadEventArgumentExecutionState, + isSendDataExecutionState, + isStaticCallExecutionState, +} from "../type-guards"; import { assertIgnitionInvariant } from "../utils/assertions"; export class BasicExecutionStrategy implements ExecutionStrategy { diff --git a/packages/core/src/new-api/internal/execution/guards.ts b/packages/core/src/new-api/internal/execution/guards.ts index 9243d4e34..d0c0fc791 100644 --- a/packages/core/src/new-api/internal/execution/guards.ts +++ b/packages/core/src/new-api/internal/execution/guards.ts @@ -18,7 +18,7 @@ import { SendDataInteractionMessage, StaticCallExecutionSuccess, StaticCallInteractionMessage, -} from "../types/journal"; +} from "../journal/types"; export function isExecutionResultMessage( potential: JournalableMessage diff --git a/packages/core/src/new-api/internal/execution/onchain-action-reducer.ts b/packages/core/src/new-api/internal/execution/onchain-action-reducer.ts index 97df27aaf..65a021f36 100644 --- a/packages/core/src/new-api/internal/execution/onchain-action-reducer.ts +++ b/packages/core/src/new-api/internal/execution/onchain-action-reducer.ts @@ -1,4 +1,5 @@ import { IgnitionError } from "../../../errors"; +import { OnchainState, OnchainStatuses } from "../execution/types"; import { isOnchainCallFunctionSuccessMessage, isOnchainContractAtSuccessMessage, @@ -11,9 +12,8 @@ import { isOnchainTransactionRequest, isOnchainTransactionReset, } from "../journal/type-guards"; +import { TransactionMessage } from "../journal/types"; import { serializeReplacer } from "../journal/utils/serialize-replacer"; -import { OnchainState, OnchainStatuses } from "../types/execution-state"; -import { TransactionMessage } from "../types/journal"; import { assertIgnitionInvariant } from "../utils/assertions"; import { diff --git a/packages/core/src/new-api/internal/execution/onchain-state-transitions.ts b/packages/core/src/new-api/internal/execution/onchain-state-transitions.ts index e0b016863..5e8381a5c 100644 --- a/packages/core/src/new-api/internal/execution/onchain-state-transitions.ts +++ b/packages/core/src/new-api/internal/execution/onchain-state-transitions.ts @@ -1,6 +1,19 @@ import { ethers } from "ethers"; import { IgnitionError } from "../../../errors"; +import { ArgumentType } from "../../types/module"; +import { + DeploymentExecutionState, + ExecutionEngineState, + OnchainStatuses, +} from "../execution/types"; +import { + isOnChainResultMessage, + isOnchainFailureMessage, + isOnchainTransactionAccept, + isOnchainTransactionRequest, + isOnchainTransactionReset, +} from "../journal/type-guards"; import { CallFunctionInteractionMessage, DeployContractInteractionMessage, @@ -22,21 +35,8 @@ import { SendDataInteractionMessage, StaticCallInteractionMessage, TransactionMessage, -} from "../../internal/types/journal"; -import { ArgumentType } from "../../types/module"; -import { - isOnChainResultMessage, - isOnchainFailureMessage, - isOnchainTransactionAccept, - isOnchainTransactionRequest, - isOnchainTransactionReset, -} from "../journal/type-guards"; +} from "../journal/types"; import { serializeReplacer } from "../journal/utils/serialize-replacer"; -import { ExecutionEngineState } from "../types/execution-engine"; -import { - DeploymentExecutionState, - OnchainStatuses, -} from "../types/execution-state"; import { assertIgnitionInvariant } from "../utils/assertions"; import { collectLibrariesAndLink } from "../utils/collectLibrariesAndLink"; diff --git a/packages/core/src/new-api/internal/execution/sort-futures-by-nonces.ts b/packages/core/src/new-api/internal/execution/sort-futures-by-nonces.ts index 9d5bb95d6..6db9d460d 100644 --- a/packages/core/src/new-api/internal/execution/sort-futures-by-nonces.ts +++ b/packages/core/src/new-api/internal/execution/sort-futures-by-nonces.ts @@ -1,7 +1,7 @@ import sortBy from "lodash/sortBy"; import { Future } from "../../types/module"; -import { ExecutionEngineState } from "../types/execution-engine"; +import { ExecutionEngineState } from "../execution/types"; import { assertIgnitionInvariant } from "../utils/assertions"; /** diff --git a/packages/core/src/new-api/internal/execution/transaction-lookup-timer.ts b/packages/core/src/new-api/internal/execution/transaction-lookup-timer.ts index c1795a046..7de0716bf 100644 --- a/packages/core/src/new-api/internal/execution/transaction-lookup-timer.ts +++ b/packages/core/src/new-api/internal/execution/transaction-lookup-timer.ts @@ -1,9 +1,7 @@ -import { - TransactionLookup, - TransactionLookupTimer, -} from "../types/transaction-timer"; import { assertIgnitionInvariant } from "../utils/assertions"; +import { TransactionLookup, TransactionLookupTimer } from "./types"; + type TransactionLookupEntry = TransactionLookup & { start: Date; }; diff --git a/packages/core/src/new-api/internal/types/execution-state.ts b/packages/core/src/new-api/internal/execution/types.ts similarity index 60% rename from packages/core/src/new-api/internal/types/execution-state.ts rename to packages/core/src/new-api/internal/execution/types.ts index 3c3d0bb83..e7cccbf91 100644 --- a/packages/core/src/new-api/internal/types/execution-state.ts +++ b/packages/core/src/new-api/internal/execution/types.ts @@ -1,10 +1,21 @@ +import { ethers } from "ethers"; + +import { ArtifactResolver } from "../../types/artifact"; +import { DeployConfig, DeploymentParameters } from "../../types/deployer"; import { ArgumentType, FutureType, + IgnitionModule, + IgnitionModuleResult, SolidityParameterType, } from "../../types/module"; - -import { TransactionMessage } from "./journal"; +import { DeploymentLoader } from "../deployment-loader/types"; +import { + ExecutionSuccess, + OnchainInteractionMessage, + OnchainResultMessage, + TransactionMessage, +} from "../journal/types"; /** * The execution history of a future is a sequence of onchain interactions. @@ -176,3 +187,127 @@ export interface OnchainState { nonce: number | null; txHash: string | null; } + +export interface ChainDispatcher { + getPendingTransactionCount(address: string): Promise; + + getLatestTransactionCount(address: string): Promise; + + getCurrentBlock(): Promise<{ number: number; hash: string }>; + + allocateNextNonceForAccount(address: string): Promise; + + constructDeployTransaction( + byteCode: string, + abi: any[], + args: ArgumentType[], + value: bigint, + from: string + ): Promise; + + constructCallTransaction( + contractAddress: string, + abi: any[], + functionName: string, + args: ArgumentType[], + value: bigint, + from: string + ): Promise; + + sendTx( + tx: ethers.providers.TransactionRequest, + from: string + ): Promise; + + staticCallQuery( + contractAddress: string, + abi: any[], + functionName: string, + args: ArgumentType[], + from: string + ): Promise; + + getTransaction( + txHash: string + ): Promise; + + getTransactionReceipt( + txHash: string + ): Promise; + + getEventArgument( + eventName: string, + argumentName: string, + txToReadFrom: string, + eventIndex: number, + emitterAddress: string, + abi: any[] + ): Promise; +} + +export interface ExecutionEngineState { + block: { + number: number; + hash: string; + }; + config: DeployConfig; + batches: string[][]; + module: IgnitionModule>; + executionStateMap: ExecutionStateMap; + accounts: string[]; + deploymentParameters: DeploymentParameters; + strategy: ExecutionStrategy; + artifactResolver: ArtifactResolver; + deploymentLoader: DeploymentLoader; + chainDispatcher: ChainDispatcher; + transactionLookupTimer: TransactionLookupTimer; +} + +export interface ExecutionStrategyContext { + executionState: ExecutionState; + sender?: string; +} + +export interface ExecutionStrategy { + executeStrategy: ({ + executionState, + sender, + }: ExecutionStrategyContext) => AsyncGenerator< + OnchainInteractionMessage, + OnchainInteractionMessage | ExecutionSuccess, + OnchainResultMessage | null + >; +} + +export interface TransactionLookup { + futureId: string; + executionId: number; + txHash: string; +} + +export interface TransactionLookupTimer { + /** + * Register the start time of a transaction lookup. + * + * The registration is idempotent. + * + * @param txHash - the transaction hash being looked up. + */ + registerStartTimeIfNeeded(transactionLookup: TransactionLookup): void; + + /** + * Based on the registered start time of the transaction lookup, determine + * whether it has timed out. + * + * @param txHash - the transaction hash being looked up. + * @result whether the transaction lookup has timed out. + */ + isTimedOut(txHash: string): boolean; + + /** + * Get all the currently timed out transactions. + * + * @result the currently timed out transactions. + */ + getTimedOutTransactions(): TransactionLookup[]; +} diff --git a/packages/core/src/new-api/internal/journal/file-journal.ts b/packages/core/src/new-api/internal/journal/file-journal.ts index 9991f4bc3..e459d3db4 100644 --- a/packages/core/src/new-api/internal/journal/file-journal.ts +++ b/packages/core/src/new-api/internal/journal/file-journal.ts @@ -2,8 +2,7 @@ import fs, { closeSync, constants, openSync, writeFileSync } from "fs"; import { parse } from "ndjson"; -import { Journal, JournalableMessage } from "../types/journal"; - +import { Journal, JournalableMessage } from "./types"; import { deserializeReplacer } from "./utils/deserialize-replacer"; import { logJournalableMessage } from "./utils/log"; import { serializeReplacer } from "./utils/serialize-replacer"; diff --git a/packages/core/src/new-api/internal/journal/memory-journal.ts b/packages/core/src/new-api/internal/journal/memory-journal.ts index 86332878e..6eebf4917 100644 --- a/packages/core/src/new-api/internal/journal/memory-journal.ts +++ b/packages/core/src/new-api/internal/journal/memory-journal.ts @@ -1,5 +1,4 @@ -import { Journal, JournalableMessage } from "../types/journal"; - +import { Journal, JournalableMessage } from "./types"; import { deserializeReplacer } from "./utils/deserialize-replacer"; import { logJournalableMessage } from "./utils/log"; import { serializeReplacer } from "./utils/serialize-replacer"; diff --git a/packages/core/src/new-api/internal/journal/type-guards.ts b/packages/core/src/new-api/internal/journal/type-guards.ts index a8bba3924..37278f2a6 100644 --- a/packages/core/src/new-api/internal/journal/type-guards.ts +++ b/packages/core/src/new-api/internal/journal/type-guards.ts @@ -1,5 +1,6 @@ import { FutureType } from "../../types/module"; import { isOnchainInteractionMessage } from "../execution/guards"; + import { CallFunctionStartMessage, ContractAtStartMessage, @@ -24,7 +25,7 @@ import { StaticCallStartMessage, TransactionMessage, WipeMessage, -} from "../types/journal"; +} from "./types"; /** * Determines if potential is a StartRunMessage. diff --git a/packages/core/src/new-api/internal/types/journal.ts b/packages/core/src/new-api/internal/journal/types.ts similarity index 100% rename from packages/core/src/new-api/internal/types/journal.ts rename to packages/core/src/new-api/internal/journal/types.ts diff --git a/packages/core/src/new-api/internal/journal/utils/log.ts b/packages/core/src/new-api/internal/journal/utils/log.ts index ab5c05b81..096f2de4a 100644 --- a/packages/core/src/new-api/internal/journal/utils/log.ts +++ b/packages/core/src/new-api/internal/journal/utils/log.ts @@ -16,7 +16,6 @@ import { isStaticCallExecutionSuccess, isStaticCallInteraction, } from "../../execution/guards"; -import { JournalableMessage } from "../../types/journal"; import { isCallFunctionStartMessage, isContractAtStartMessage, @@ -37,6 +36,7 @@ import { isStaticCallStartMessage, isWipeMessage, } from "../type-guards"; +import { JournalableMessage } from "../types"; export function logJournalableMessage(message: JournalableMessage): void { /* run messages */ diff --git a/packages/core/src/new-api/internal/reconciliation/execution-state-resolver.ts b/packages/core/src/new-api/internal/reconciliation/execution-state-resolver.ts index 5b5f77ac5..ceee3dffb 100644 --- a/packages/core/src/new-api/internal/reconciliation/execution-state-resolver.ts +++ b/packages/core/src/new-api/internal/reconciliation/execution-state-resolver.ts @@ -23,7 +23,7 @@ import { ReadEventArgumentExecutionState, SendDataExecutionState, StaticCallExecutionState, -} from "../types/execution-state"; +} from "../execution/types"; import { isAddress } from "../utils"; import { assertIgnitionInvariant } from "../utils/assertions"; import { replaceWithinArg } from "../utils/replace-within-arg"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactContractAt.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactContractAt.ts index 89581408a..c1dd89e7a 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactContractAt.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactContractAt.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { ArtifactContractAtFuture } from "../../../types/module"; -import { ContractAtExecutionState } from "../../types/execution-state"; +import { ContractAtExecutionState } from "../../execution/types"; import { ExecutionStateResolver } from "../execution-state-resolver"; import { ReconciliationContext, ReconciliationFutureResult } from "../types"; import { fail, getBytecodeWithoutMetadata } from "../utils"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactContractDeployment.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactContractDeployment.ts index fe63873a5..3b68f3b42 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactContractDeployment.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactContractDeployment.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { ArtifactContractDeploymentFuture } from "../../../types/module"; -import { DeploymentExecutionState } from "../../types/execution-state"; +import { DeploymentExecutionState } from "../../execution/types"; import { resolveFromAddress } from "../../utils/resolve-from-address"; import { resolveModuleParameter } from "../../utils/resolve-module-parameter"; import { ExecutionStateResolver } from "../execution-state-resolver"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactLibraryDeployment.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactLibraryDeployment.ts index a017470fd..0e630a7c5 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactLibraryDeployment.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileArtifactLibraryDeployment.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { ArtifactLibraryDeploymentFuture } from "../../../types/module"; -import { DeploymentExecutionState } from "../../types/execution-state"; +import { DeploymentExecutionState } from "../../execution/types"; import { resolveFromAddress } from "../../utils/resolve-from-address"; import { ExecutionStateResolver } from "../execution-state-resolver"; import { ReconciliationContext, ReconciliationFutureResult } from "../types"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractAt.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractAt.ts index 04f012d01..ed17490b5 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractAt.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractAt.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { NamedContractAtFuture } from "../../../types/module"; -import { ContractAtExecutionState } from "../../types/execution-state"; +import { ContractAtExecutionState } from "../../execution/types"; import { ExecutionStateResolver } from "../execution-state-resolver"; import { ReconciliationContext, ReconciliationFutureResult } from "../types"; import { fail, getBytecodeWithoutMetadata } from "../utils"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractCall.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractCall.ts index bd564a11f..ddbb30d0a 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractCall.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractCall.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { NamedContractCallFuture } from "../../../types/module"; -import { CallExecutionState } from "../../types/execution-state"; +import { CallExecutionState } from "../../execution/types"; import { resolveFromAddress } from "../../utils/resolve-from-address"; import { resolveModuleParameter } from "../../utils/resolve-module-parameter"; import { ExecutionStateResolver } from "../execution-state-resolver"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractDeployment.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractDeployment.ts index bdb321a30..6026dcfea 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractDeployment.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedContractDeployment.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { NamedContractDeploymentFuture } from "../../../types/module"; -import { DeploymentExecutionState } from "../../types/execution-state"; +import { DeploymentExecutionState } from "../../execution/types"; import { resolveFromAddress } from "../../utils/resolve-from-address"; import { resolveModuleParameter } from "../../utils/resolve-module-parameter"; import { ExecutionStateResolver } from "../execution-state-resolver"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedLibraryDeployment.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedLibraryDeployment.ts index ea7d79cad..6fc4392e9 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedLibraryDeployment.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedLibraryDeployment.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { NamedLibraryDeploymentFuture } from "../../../types/module"; -import { DeploymentExecutionState } from "../../types/execution-state"; +import { DeploymentExecutionState } from "../../execution/types"; import { resolveFromAddress } from "../../utils/resolve-from-address"; import { ExecutionStateResolver } from "../execution-state-resolver"; import { ReconciliationContext, ReconciliationFutureResult } from "../types"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedStaticCall.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedStaticCall.ts index d705679eb..8a99ee38a 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedStaticCall.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileNamedStaticCall.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { NamedStaticCallFuture } from "../../../types/module"; -import { StaticCallExecutionState } from "../../types/execution-state"; +import { StaticCallExecutionState } from "../../execution/types"; import { resolveFromAddress } from "../../utils/resolve-from-address"; import { ExecutionStateResolver } from "../execution-state-resolver"; import { ReconciliationContext, ReconciliationFutureResult } from "../types"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileReadEventArgument.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileReadEventArgument.ts index a0d9108cd..94dbfa114 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileReadEventArgument.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileReadEventArgument.ts @@ -1,5 +1,5 @@ import { ReadEventArgumentFuture } from "../../../types/module"; -import { ReadEventArgumentExecutionState } from "../../types/execution-state"; +import { ReadEventArgumentExecutionState } from "../../execution/types"; import { ExecutionStateResolver } from "../execution-state-resolver"; import { ReconciliationContext, ReconciliationFutureResult } from "../types"; import { fail } from "../utils"; diff --git a/packages/core/src/new-api/internal/reconciliation/futures/reconcileSendData.ts b/packages/core/src/new-api/internal/reconciliation/futures/reconcileSendData.ts index 3a4d19a4f..3017cb6c1 100644 --- a/packages/core/src/new-api/internal/reconciliation/futures/reconcileSendData.ts +++ b/packages/core/src/new-api/internal/reconciliation/futures/reconcileSendData.ts @@ -1,7 +1,7 @@ import { isEqual } from "lodash"; import { SendDataFuture } from "../../../types/module"; -import { SendDataExecutionState } from "../../types/execution-state"; +import { SendDataExecutionState } from "../../execution/types"; import { resolveFromAddress } from "../../utils/resolve-from-address"; import { resolveModuleParameter } from "../../utils/resolve-module-parameter"; import { ExecutionStateResolver } from "../execution-state-resolver"; diff --git a/packages/core/src/new-api/internal/reconciliation/reconcile-current-and-previous-type-match.ts b/packages/core/src/new-api/internal/reconciliation/reconcile-current-and-previous-type-match.ts index 9d1fc025c..9fbf75a2c 100644 --- a/packages/core/src/new-api/internal/reconciliation/reconcile-current-and-previous-type-match.ts +++ b/packages/core/src/new-api/internal/reconciliation/reconcile-current-and-previous-type-match.ts @@ -1,5 +1,5 @@ import { Future, FutureType } from "../../types/module"; -import { ExecutionState, ExecutionStateMap } from "../types/execution-state"; +import { ExecutionState, ExecutionStateMap } from "../execution/types"; import { ReconciliationFutureResult } from "./types"; import { fail } from "./utils"; diff --git a/packages/core/src/new-api/internal/reconciliation/reconcile-dependency-rules.ts b/packages/core/src/new-api/internal/reconciliation/reconcile-dependency-rules.ts index 4e6f5acc6..65e3314a9 100644 --- a/packages/core/src/new-api/internal/reconciliation/reconcile-dependency-rules.ts +++ b/packages/core/src/new-api/internal/reconciliation/reconcile-dependency-rules.ts @@ -5,7 +5,7 @@ import { ExecutionState, ExecutionStateMap, ExecutionStatus, -} from "../types/execution-state"; +} from "../execution/types"; import { ReconciliationFutureResult } from "./types"; import { fail } from "./utils"; diff --git a/packages/core/src/new-api/internal/reconciliation/reconcile-future-specific-reconciliations.ts b/packages/core/src/new-api/internal/reconciliation/reconcile-future-specific-reconciliations.ts index 8e77228bd..f1c96d2a8 100644 --- a/packages/core/src/new-api/internal/reconciliation/reconcile-future-specific-reconciliations.ts +++ b/packages/core/src/new-api/internal/reconciliation/reconcile-future-specific-reconciliations.ts @@ -7,7 +7,7 @@ import { ReadEventArgumentExecutionState, SendDataExecutionState, StaticCallExecutionState, -} from "../types/execution-state"; +} from "../execution/types"; import { reconcileArtifactContractAt } from "./futures/reconcileArtifactContractAt"; import { reconcileArtifactContractDeployment } from "./futures/reconcileArtifactContractDeployment"; diff --git a/packages/core/src/new-api/internal/reconciliation/reconciler.ts b/packages/core/src/new-api/internal/reconciliation/reconciler.ts index d3a5f7898..a0d71b1c8 100644 --- a/packages/core/src/new-api/internal/reconciliation/reconciler.ts +++ b/packages/core/src/new-api/internal/reconciliation/reconciler.ts @@ -1,6 +1,6 @@ import { DeploymentParameters } from "../../types/deployer"; import { Future, IgnitionModule } from "../../types/module"; -import { ExecutionState, ExecutionStateMap } from "../types/execution-state"; +import { ExecutionState, ExecutionStateMap } from "../execution/types"; import { AdjacencyList } from "../utils/adjacency-list"; import { AdjacencyListConverter } from "../utils/adjacency-list-converter"; import { getFuturesFromModule } from "../utils/get-futures-from-module"; @@ -9,13 +9,13 @@ import { reconcileCurrentAndPreviousTypeMatch } from "./reconcile-current-and-pr import { reconcileDependencyRules } from "./reconcile-dependency-rules"; import { reconcileFutureSpecificReconciliations } from "./reconcile-future-specific-reconciliations"; import { + ArtifactMap, ReconciliationCheck, ReconciliationContext, ReconciliationFailure, ReconciliationFutureResult, ReconciliationFutureResultFailure, ReconciliationResult, - ArtifactMap, } from "./types"; export class Reconciler { diff --git a/packages/core/src/new-api/internal/reconciliation/types.ts b/packages/core/src/new-api/internal/reconciliation/types.ts index 1c33d1dbc..69b5444b2 100644 --- a/packages/core/src/new-api/internal/reconciliation/types.ts +++ b/packages/core/src/new-api/internal/reconciliation/types.ts @@ -1,7 +1,7 @@ import { Artifact } from "../../types/artifact"; import { DeploymentParameters } from "../../types/deployer"; import { Future } from "../../types/module"; -import { ExecutionState, ExecutionStateMap } from "../types/execution-state"; +import { ExecutionState, ExecutionStateMap } from "../execution/types"; export interface ReconciliationFailure { futureId: string; diff --git a/packages/core/src/new-api/internal/type-guards.ts b/packages/core/src/new-api/internal/type-guards.ts index 7d0f96acd..46a10ff2c 100644 --- a/packages/core/src/new-api/internal/type-guards.ts +++ b/packages/core/src/new-api/internal/type-guards.ts @@ -10,7 +10,7 @@ import { ReadEventArgumentExecutionState, SendDataExecutionState, StaticCallExecutionState, -} from "./types/execution-state"; +} from "./execution/types"; export function isDeploymentExecutionState( executionState: ExecutionState diff --git a/packages/core/src/new-api/internal/types/chain-dispatcher.ts b/packages/core/src/new-api/internal/types/chain-dispatcher.ts deleted file mode 100644 index e03aff86e..000000000 --- a/packages/core/src/new-api/internal/types/chain-dispatcher.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { ethers } from "ethers"; - -import { ArgumentType } from "../../types/module"; - -export interface ChainDispatcher { - getPendingTransactionCount(address: string): Promise; - - getLatestTransactionCount(address: string): Promise; - - getCurrentBlock(): Promise<{ number: number; hash: string }>; - - allocateNextNonceForAccount(address: string): Promise; - - constructDeployTransaction( - byteCode: string, - abi: any[], - args: ArgumentType[], - value: bigint, - from: string - ): Promise; - - constructCallTransaction( - contractAddress: string, - abi: any[], - functionName: string, - args: ArgumentType[], - value: bigint, - from: string - ): Promise; - - sendTx( - tx: ethers.providers.TransactionRequest, - from: string - ): Promise; - - staticCallQuery( - contractAddress: string, - abi: any[], - functionName: string, - args: ArgumentType[], - from: string - ): Promise; - - getTransaction( - txHash: string - ): Promise; - - getTransactionReceipt( - txHash: string - ): Promise; - - getEventArgument( - eventName: string, - argumentName: string, - txToReadFrom: string, - eventIndex: number, - emitterAddress: string, - abi: any[] - ): Promise; -} diff --git a/packages/core/src/new-api/internal/types/execution-engine.ts b/packages/core/src/new-api/internal/types/execution-engine.ts deleted file mode 100644 index 10ce08e09..000000000 --- a/packages/core/src/new-api/internal/types/execution-engine.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { ArtifactResolver } from "../../types/artifact"; -import { DeployConfig, DeploymentParameters } from "../../types/deployer"; -import { IgnitionModule, IgnitionModuleResult } from "../../types/module"; - -import { ChainDispatcher } from "./chain-dispatcher"; -import { DeploymentLoader } from "./deployment-loader"; -import { ExecutionState, ExecutionStateMap } from "./execution-state"; -import { - ExecutionSuccess, - OnchainInteractionMessage, - OnchainResultMessage, -} from "./journal"; -import { TransactionLookupTimer } from "./transaction-timer"; - -export interface ExecutionEngineState { - block: { - number: number; - hash: string; - }; - config: DeployConfig; - batches: string[][]; - module: IgnitionModule>; - executionStateMap: ExecutionStateMap; - accounts: string[]; - deploymentParameters: DeploymentParameters; - strategy: ExecutionStrategy; - artifactResolver: ArtifactResolver; - deploymentLoader: DeploymentLoader; - chainDispatcher: ChainDispatcher; - transactionLookupTimer: TransactionLookupTimer; -} - -export interface ExecutionStrategyContext { - executionState: ExecutionState; - sender?: string; -} - -export interface ExecutionStrategy { - executeStrategy: ({ - executionState, - sender, - }: ExecutionStrategyContext) => AsyncGenerator< - OnchainInteractionMessage, - OnchainInteractionMessage | ExecutionSuccess, - OnchainResultMessage | null - >; -} diff --git a/packages/core/src/new-api/internal/types/transaction-timer.ts b/packages/core/src/new-api/internal/types/transaction-timer.ts deleted file mode 100644 index 60905b937..000000000 --- a/packages/core/src/new-api/internal/types/transaction-timer.ts +++ /dev/null @@ -1,32 +0,0 @@ -export interface TransactionLookup { - futureId: string; - executionId: number; - txHash: string; -} - -export interface TransactionLookupTimer { - /** - * Register the start time of a transaction lookup. - * - * The registration is idempotent. - * - * @param txHash - the transaction hash being looked up. - */ - registerStartTimeIfNeeded(transactionLookup: TransactionLookup): void; - - /** - * Based on the registered start time of the transaction lookup, determine - * whether it has timed out. - * - * @param txHash - the transaction hash being looked up. - * @result whether the transaction lookup has timed out. - */ - isTimedOut(txHash: string): boolean; - - /** - * Get all the currently timed out transactions. - * - * @result the currently timed out transactions. - */ - getTimedOutTransactions(): TransactionLookup[]; -} diff --git a/packages/core/src/new-api/internal/utils/resolve-futures.ts b/packages/core/src/new-api/internal/utils/resolve-futures.ts index 4bd3f6384..f078b7ca5 100644 --- a/packages/core/src/new-api/internal/utils/resolve-futures.ts +++ b/packages/core/src/new-api/internal/utils/resolve-futures.ts @@ -1,5 +1,6 @@ import { IgnitionError } from "../../../errors"; import { Future, SolidityParameterType } from "../../types/module"; +import { ExecutionState, ExecutionStateMap } from "../execution/types"; import { isCallExecutionState, isContractAtExecutionState, @@ -8,7 +9,6 @@ import { isSendDataExecutionState, isStaticCallExecutionState, } from "../type-guards"; -import { ExecutionState, ExecutionStateMap } from "../types/execution-state"; import { assertIgnitionInvariant } from "./assertions"; diff --git a/packages/core/src/new-api/internal/wiper.ts b/packages/core/src/new-api/internal/wiper.ts index 48939d2df..45bb296b6 100644 --- a/packages/core/src/new-api/internal/wiper.ts +++ b/packages/core/src/new-api/internal/wiper.ts @@ -1,8 +1,8 @@ import { IgnitionError } from "../../errors"; import { executionStateReducer } from "./execution/execution-state-reducer"; -import { ExecutionStateMap } from "./types/execution-state"; -import { Journal, WipeMessage } from "./types/journal"; +import { ExecutionStateMap } from "./execution/types"; +import { Journal, WipeMessage } from "./journal/types"; export class Wiper { constructor(private _journal: Journal) {} diff --git a/packages/core/test/new-api/batcher.ts b/packages/core/test/new-api/batcher.ts index 482a2aca5..1e156a634 100644 --- a/packages/core/test/new-api/batcher.ts +++ b/packages/core/test/new-api/batcher.ts @@ -3,12 +3,12 @@ import { assert } from "chai"; import { buildModule } from "../../src/new-api/build-module"; import { Batcher } from "../../src/new-api/internal/batcher"; -import { ModuleConstructor } from "../../src/new-api/internal/module-builder"; import { DeploymentExecutionState, ExecutionStateMap, ExecutionStatus, -} from "../../src/new-api/internal/types/execution-state"; +} from "../../src/new-api/internal/execution/types"; +import { ModuleConstructor } from "../../src/new-api/internal/module-builder"; import { FutureType, IgnitionModuleResult, diff --git a/packages/core/test/new-api/execution/sort-futures-by-nonce.ts b/packages/core/test/new-api/execution/sort-futures-by-nonce.ts index 8b7a30e8a..5c20e8548 100644 --- a/packages/core/test/new-api/execution/sort-futures-by-nonce.ts +++ b/packages/core/test/new-api/execution/sort-futures-by-nonce.ts @@ -6,7 +6,7 @@ import { ExecutionStateMap, OnchainState, OnchainStatuses, -} from "../../../src/new-api/internal/types/execution-state"; +} from "../../../src/new-api/internal/execution/types"; import { Future } from "../../../src/new-api/types/module"; describe("execution engine - batch sorting", () => { diff --git a/packages/core/test/new-api/helpers.ts b/packages/core/test/new-api/helpers.ts index 2fd2dbb07..71b33de4c 100644 --- a/packages/core/test/new-api/helpers.ts +++ b/packages/core/test/new-api/helpers.ts @@ -4,18 +4,18 @@ import { ethers, providers } from "ethers"; import { ArgumentType, Artifact, ArtifactResolver } from "../../src"; import { Deployer } from "../../src/new-api/internal/deployer"; +import { DeploymentLoader } from "../../src/new-api/internal/deployment-loader/types"; import { AccountsState } from "../../src/new-api/internal/execution/execution-engine"; -import { MemoryJournal } from "../../src/new-api/internal/journal/memory-journal"; -import { ChainDispatcher } from "../../src/new-api/internal/types/chain-dispatcher"; -import { DeploymentLoader } from "../../src/new-api/internal/types/deployment-loader"; import { + ChainDispatcher, OnchainState, OnchainStatuses, -} from "../../src/new-api/internal/types/execution-state"; +} from "../../src/new-api/internal/execution/types"; +import { MemoryJournal } from "../../src/new-api/internal/journal/memory-journal"; import { Journal, JournalableMessage, -} from "../../src/new-api/internal/types/journal"; +} from "../../src/new-api/internal/journal/types"; import { DeploymentResult, DeploymentResultContract, diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileArtifactContractAt.ts b/packages/core/test/new-api/reconciliation/futures/reconcileArtifactContractAt.ts index 6f4e78339..2c2f123e3 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileArtifactContractAt.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileArtifactContractAt.ts @@ -9,7 +9,7 @@ import { ExecutionStateMap, ExecutionStatus, StaticCallExecutionState, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { assertSuccessReconciliation, reconcile } from "../helpers"; diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileArtifactContractDeployment.ts b/packages/core/test/new-api/reconciliation/futures/reconcileArtifactContractDeployment.ts index 6a75379cf..e306bcc0b 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileArtifactContractDeployment.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileArtifactContractDeployment.ts @@ -6,7 +6,7 @@ import { buildModule } from "../../../../src/new-api/build-module"; import { DeploymentExecutionState, ExecutionStatus, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileArtifactLibraryDeployment.ts b/packages/core/test/new-api/reconciliation/futures/reconcileArtifactLibraryDeployment.ts index d37620f75..7ecbb7a06 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileArtifactLibraryDeployment.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileArtifactLibraryDeployment.ts @@ -6,7 +6,7 @@ import { buildModule } from "../../../../src/new-api/build-module"; import { DeploymentExecutionState, ExecutionStatus, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractAt.ts b/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractAt.ts index 1cff3c728..7e937cc58 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractAt.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractAt.ts @@ -8,7 +8,7 @@ import { ExecutionStateMap, ExecutionStatus, StaticCallExecutionState, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { assertSuccessReconciliation, reconcile } from "../helpers"; diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractCall.ts b/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractCall.ts index 2332694ff..0cd51c130 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractCall.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractCall.ts @@ -6,7 +6,7 @@ import { CallExecutionState, DeploymentExecutionState, ExecutionStatus, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractDeployment.ts b/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractDeployment.ts index c9657e78e..341c7d85f 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractDeployment.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileNamedContractDeployment.ts @@ -5,7 +5,7 @@ import { buildModule } from "../../../../src/new-api/build-module"; import { DeploymentExecutionState, ExecutionStatus, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileNamedLibraryDeployment.ts b/packages/core/test/new-api/reconciliation/futures/reconcileNamedLibraryDeployment.ts index cfd642b48..8f093764e 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileNamedLibraryDeployment.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileNamedLibraryDeployment.ts @@ -5,7 +5,7 @@ import { buildModule } from "../../../../src/new-api/build-module"; import { DeploymentExecutionState, ExecutionStatus, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileNamedStaticCall.ts b/packages/core/test/new-api/reconciliation/futures/reconcileNamedStaticCall.ts index 8c998ff50..8f7958b2b 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileNamedStaticCall.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileNamedStaticCall.ts @@ -6,7 +6,7 @@ import { DeploymentExecutionState, ExecutionStatus, StaticCallExecutionState, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileReadEventArgument.ts b/packages/core/test/new-api/reconciliation/futures/reconcileReadEventArgument.ts index 0cb75df21..0644708c7 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileReadEventArgument.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileReadEventArgument.ts @@ -6,7 +6,7 @@ import { DeploymentExecutionState, ExecutionStatus, ReadEventArgumentExecutionState, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { assertSuccessReconciliation, reconcile } from "../helpers"; diff --git a/packages/core/test/new-api/reconciliation/futures/reconcileSendData.ts b/packages/core/test/new-api/reconciliation/futures/reconcileSendData.ts index da97650b8..8ea00783f 100644 --- a/packages/core/test/new-api/reconciliation/futures/reconcileSendData.ts +++ b/packages/core/test/new-api/reconciliation/futures/reconcileSendData.ts @@ -5,7 +5,7 @@ import { buildModule } from "../../../../src/new-api/build-module"; import { ExecutionStatus, SendDataExecutionState, -} from "../../../../src/new-api/internal/types/execution-state"; +} from "../../../../src/new-api/internal/execution/types"; import { FutureType } from "../../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../../helpers"; import { assertSuccessReconciliation, reconcile } from "../helpers"; diff --git a/packages/core/test/new-api/reconciliation/helpers.ts b/packages/core/test/new-api/reconciliation/helpers.ts index 444e82840..3726f5a6c 100644 --- a/packages/core/test/new-api/reconciliation/helpers.ts +++ b/packages/core/test/new-api/reconciliation/helpers.ts @@ -1,13 +1,13 @@ import { assert } from "chai"; import { isContractFuture } from "../../../src"; +import { ExecutionStateMap } from "../../../src/new-api/internal/execution/types"; import { ModuleConstructor } from "../../../src/new-api/internal/module-builder"; import { Reconciler } from "../../../src/new-api/internal/reconciliation/reconciler"; import { ArtifactMap, ReconciliationResult, } from "../../../src/new-api/internal/reconciliation/types"; -import { ExecutionStateMap } from "../../../src/new-api/internal/types/execution-state"; import { getFuturesFromModule } from "../../../src/new-api/internal/utils/get-futures-from-module"; import { IgnitionModuleResult, diff --git a/packages/core/test/new-api/reconciliation/reconciler.ts b/packages/core/test/new-api/reconciliation/reconciler.ts index 0582878cb..c73b1f7d6 100644 --- a/packages/core/test/new-api/reconciliation/reconciler.ts +++ b/packages/core/test/new-api/reconciliation/reconciler.ts @@ -2,11 +2,11 @@ import { assert } from "chai"; import { buildModule } from "../../../src/new-api/build-module"; -import { ArtifactMap } from "../../../src/new-api/internal/reconciliation/types"; import { DeploymentExecutionState, ExecutionStatus, -} from "../../../src/new-api/internal/types/execution-state"; +} from "../../../src/new-api/internal/execution/types"; +import { ArtifactMap } from "../../../src/new-api/internal/reconciliation/types"; import { FutureType } from "../../../src/new-api/types/module"; import { exampleAccounts, initOnchainState } from "../helpers"; diff --git a/packages/core/test/new-api/types/deployment-loader.ts b/packages/core/test/new-api/types/deployment-loader.ts index 2ea2fa46d..4cee095fc 100644 --- a/packages/core/test/new-api/types/deployment-loader.ts +++ b/packages/core/test/new-api/types/deployment-loader.ts @@ -3,7 +3,7 @@ import { assert } from "chai"; import { EphemeralDeploymentLoader } from "../../../src/new-api/internal/deployment-loader/ephemeral-deployment-loader"; import { FileDeploymentLoader } from "../../../src/new-api/internal/deployment-loader/file-deployment-loader"; -import { DeploymentLoader } from "../../../src/new-api/internal/types/deployment-loader"; +import { DeploymentLoader } from "../../../src/new-api/internal/deployment-loader/types"; import { ExactInterface } from "../../helpers/exact-interface"; import { setupMockArtifactResolver } from "../helpers"; diff --git a/packages/core/test/new-api/wipe.ts b/packages/core/test/new-api/wipe.ts index da75a4341..68fe68d9a 100644 --- a/packages/core/test/new-api/wipe.ts +++ b/packages/core/test/new-api/wipe.ts @@ -3,7 +3,7 @@ import { assert } from "chai"; import { buildModule } from "../../src/new-api/build-module"; import { MemoryJournal } from "../../src/new-api/internal/journal/memory-journal"; -import { Journal } from "../../src/new-api/internal/types/journal"; +import { Journal } from "../../src/new-api/internal/journal/types"; import { Wiper } from "../../src/new-api/internal/wiper"; import { IgnitionModuleResult } from "../../src/new-api/types/module"; import { IgnitionModuleDefinition } from "../../src/new-api/types/module-builder";