Repository: NomicFoundation/hardhat-ignition (ts)

Issue:
rerun blocked by sent transactions message
Killing a deployment midway, then rerunning can lead to the `403` Ignition error saying you have sent transactions. Even though all the transactions where sent on the previous run by Ignition and should be tracked.

## Reproduction steps

1. Update the `examples/sample` module to deploy multiple contracts one after the other using `after`.
2. Set the node so that automining is false and the interval is long enough to kill and restart a deploy.
3. Start the first run and ctrl c after the first batch has started
4. Rerun the deployment
5. You should see the 403 error

![image](https://github.com/NomicFoundation/hardhat-ignition/assets/24030/65024f4b-70c6-4cf8-9865-d39e4588c958)



Pull request:
fix: stop future senders clearing out pending trans (PR A)
The future senders update the account to nonce+transactions list in such away that existing pending transactions for the account are untouched.

No test has been added, but the case has been covered by enhancing the example module to include an unexecuted future in the module.

Fixes #574.

Patch:
diff --git a/packages/core/src/internal/execution/nonce-management/get-nonce-sync-messages.ts b/packages/core/src/internal/execution/nonce-management/get-nonce-sync-messages.ts
index 5d80f25e..d74d3f08 100644
--- a/packages/core/src/internal/execution/nonce-management/get-nonce-sync-messages.ts
+++ b/packages/core/src/internal/execution/nonce-management/get-nonce-sync-messages.ts
@@ -291,7 +291,9 @@ function createMapFromSenderToNonceAndTransactions(
   );
 
   for (const futureSender of futureSenders) {
-    pendingTransactionsPerAccount[futureSender] = [];
+    if (pendingTransactionsPerAccount[futureSender] === undefined) {
+      pendingTransactionsPerAccount[futureSender] = [];
+    }
   }
 
   for (const pendingTransactions of Object.values(


Test patch:
diff --git a/packages/core/test/execution/nonce-management/get-nonce-sync-messages.ts b/packages/core/test/execution/nonce-management/get-nonce-sync-messages.ts
index 341af460..c7446aa7 100644
--- a/packages/core/test/execution/nonce-management/get-nonce-sync-messages.ts
+++ b/packages/core/test/execution/nonce-management/get-nonce-sync-messages.ts
@@ -53,7 +53,18 @@ describe("execution - getNonceSyncMessages", () => {
 
   beforeEach(() => {
     exampleModule = buildModule("Example", (m) => {
-      m.contract("MyContract", [], { from: exampleAccounts[1] });
+      const myContract = m.contract("MyContract", [], {
+        from: exampleAccounts[1],
+      });
+
+      // A follow on contract deploy using the same sender.
+      // This was added, due to a bug where the presence
+      // of futures with the same sender cleared the
+      // pending transactions. See issue #574.
+      m.contract("AnotherContract", [], {
+        from: exampleAccounts[1],
+        after: [myContract],
+      });
 
       return {};
     });
@@ -623,6 +634,11 @@ describe("execution - getNonceSyncMessages", () => {
                   id: "Example#MyContract",
                   status: ExecutionStatus.SUCCESS,
                 },
+                "Example#AnotherContract": {
+                  ...exampleDeploymentState,
+                  id: "Example#AnotherContract",
+                  status: ExecutionStatus.SUCCESS,
+                },
               },
             },
             transactionCountEntries: {