From c34715441bfdbc69e3db4d6961be1e7d623e1980 Mon Sep 17 00:00:00 2001 From: Sasha Bogicevic Date: Wed, 14 Jan 2026 14:41:27 +0100 Subject: [PATCH 1/8] Use StrictData in hydra-node This reduces the memory usage significantly (1.7 GB vs. 137 MB for the stress-test I was running) Signed-off-by: Sasha Bogicevic --- hydra-node/hydra-node.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/hydra-node/hydra-node.cabal b/hydra-node/hydra-node.cabal index 90205b097b8..dfa40a10031 100644 --- a/hydra-node/hydra-node.cabal +++ b/hydra-node/hydra-node.cabal @@ -38,6 +38,7 @@ common project-config PatternSynonyms TypeFamilies ViewPatterns + StrictData ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates From b331582f25217847ff7d276f0e9399f278dea8de Mon Sep 17 00:00:00 2001 From: Jack Chan Date: Tue, 6 Jan 2026 08:07:23 +0800 Subject: [PATCH 2/8] ci: add disk cleanup step to prevent space exhaustion GitHub Actions runners have limited disk space (~14GB available). When building uncached Nix derivations (like our modified hydra-node), the build can exhaust disk space during compilation. This adds a cleanup step that removes unused tools before the build: - .NET SDK (~1.8GB) - Android SDK (~9GB) - GHC (~5GB) - CodeQL (~2.5GB) - Unused Docker images This frees up ~20GB of disk space, ensuring builds complete successfully. --- .github/actions/nix-cachix-setup/action.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/actions/nix-cachix-setup/action.yml b/.github/actions/nix-cachix-setup/action.yml index fcf19333bb5..6c24c24a284 100644 --- a/.github/actions/nix-cachix-setup/action.yml +++ b/.github/actions/nix-cachix-setup/action.yml @@ -9,6 +9,21 @@ runs: using: composite steps: + - name: 🧹 Free disk space + if: runner.os == 'Linux' + shell: bash + run: | + echo "Disk space before cleanup:" + df -h / + # Remove unnecessary tools to free up disk space + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker image prune --all --force || true + echo "Disk space after cleanup:" + df -h / + - name: ❄ Prepare nix uses: cachix/install-nix-action@v30 with: From 4f243fafb58bae95ecd0b835d27778654cb99a95 Mon Sep 17 00:00:00 2001 From: Jack Chan Date: Sat, 3 Jan 2026 19:21:30 +0800 Subject: [PATCH 3/8] ci: enable Docker builds for pull requests - Add pull_request trigger for PRs targeting master branch - Tag PR builds as pr- for easy identification - Use PR head SHA as version for traceability --- .github/workflows/docker.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index e0021638606..b716d2bcba0 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -13,6 +13,8 @@ on: push: branches: [ "master" ] tags: [ "*.*.*" ] + pull_request: + branches: [ "master" ] workflow_dispatch: inputs: ref_name: @@ -73,6 +75,12 @@ jobs: # And the version as the git commit. VERSION=${{github.sha}} + # For PRs, tag as pr- + if [[ "${{github.event_name}}" == "pull_request" ]]; then + IMAGE_LABEL=pr-${{github.event.pull_request.number}} + VERSION=${{github.event.pull_request.head.sha}} + fi + # Determine whether we are building a tag and if yes, set the label # name to be the tag name, and the version to be the tag. BUILDING_TAG=${{github.ref_type == 'tag'}} From 7c12876b2b9bb7148e0d74cd14c31f1dd1be8375 Mon Sep 17 00:00:00 2001 From: Jack Chan Date: Tue, 6 Jan 2026 17:59:37 +0800 Subject: [PATCH 4/8] ci: trigger CI and Docker builds for v1.2.0-base branch --- .github/workflows/ci-nix.yaml | 4 ++++ .github/workflows/docker.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-nix.yaml b/.github/workflows/ci-nix.yaml index 8477afbd02d..d3843fa4815 100644 --- a/.github/workflows/ci-nix.yaml +++ b/.github/workflows/ci-nix.yaml @@ -11,7 +11,11 @@ on: branches: - master - release + - v1.2.0-base pull_request: + branches: + - master + - v1.2.0-base schedule: # Everyday at 4:00 AM - cron: "0 4 * * *" diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index b716d2bcba0..f9262c0609f 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -11,10 +11,10 @@ concurrency: on: push: - branches: [ "master" ] + branches: [ "master", "v1.2.0-base" ] tags: [ "*.*.*" ] pull_request: - branches: [ "master" ] + branches: [ "master", "v1.2.0-base" ] workflow_dispatch: inputs: ref_name: From 67cdf89367bf36a435162cc1153677262c617d65 Mon Sep 17 00:00:00 2001 From: Jack Chan Date: Thu, 15 Jan 2026 10:43:54 +0800 Subject: [PATCH 5/8] fix: treefmt --- hydra-node/hydra-node.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra-node/hydra-node.cabal b/hydra-node/hydra-node.cabal index dfa40a10031..2ff54fa1451 100644 --- a/hydra-node/hydra-node.cabal +++ b/hydra-node/hydra-node.cabal @@ -36,9 +36,9 @@ common project-config OverloadedStrings PartialTypeSignatures PatternSynonyms + StrictData TypeFamilies ViewPatterns - StrictData ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates From 1f5003eca2fad9fb4609b4ab2e481d5bd9dc85a0 Mon Sep 17 00:00:00 2001 From: twwu123 Date: Fri, 16 Jan 2026 21:53:53 +0800 Subject: [PATCH 6/8] increase mainnet limit --- hydra-node/src/Hydra/Chain.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra-node/src/Hydra/Chain.hs b/hydra-node/src/Hydra/Chain.hs index 21f63c9e792..7b79cffc7f5 100644 --- a/hydra-node/src/Hydra/Chain.hs +++ b/hydra-node/src/Hydra/Chain.hs @@ -47,7 +47,7 @@ import Test.QuickCheck.Instances.Time () -- | Hardcoded limit for commit tx on mainnet maxMainnetLovelace :: Coin -maxMainnetLovelace = Coin 100_000_000 +maxMainnetLovelace = Coin 1_000_000_000 -- | Hardcoded limit for maximum number of parties in a head protocol The value -- is obtained from calculating the costs of running the scripts and on-chan From 621c7e82b8def1800c01cf0ebba756cf0bd5614a Mon Sep 17 00:00:00 2001 From: hinsonsidan Date: Thu, 22 Jan 2026 06:00:48 +0800 Subject: [PATCH 7/8] fix: reset deposit at sideload --- hydra-node/src/Hydra/HeadLogic.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hydra-node/src/Hydra/HeadLogic.hs b/hydra-node/src/Hydra/HeadLogic.hs index ab4c088c702..932c0300447 100644 --- a/hydra-node/src/Hydra/HeadLogic.hs +++ b/hydra-node/src/Hydra/HeadLogic.hs @@ -1678,6 +1678,7 @@ aggregate st = \case , localTxs = mempty , allTxs = mempty , seenSnapshot = NoSeenSnapshot + , currentDepositTxId = Nothing } ConfirmedSnapshot{snapshot = Snapshot{utxo}} -> coordinatedHeadState @@ -1685,6 +1686,7 @@ aggregate st = \case , localTxs = mempty , allTxs = mempty , seenSnapshot = LastSeenSnapshot snapshotNumber + , currentDepositTxId = Nothing } } _otherState -> st From 7d9609e4bc004e49e5870095c709931bc99b917e Mon Sep 17 00:00:00 2001 From: hinsonsidan Date: Thu, 22 Jan 2026 07:05:00 +0800 Subject: [PATCH 8/8] fix: fix finalized -> sideload stale head --- hydra-node/src/Hydra/HeadLogic.hs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/hydra-node/src/Hydra/HeadLogic.hs b/hydra-node/src/Hydra/HeadLogic.hs index 932c0300447..d0f21209e06 100644 --- a/hydra-node/src/Hydra/HeadLogic.hs +++ b/hydra-node/src/Hydra/HeadLogic.hs @@ -1667,7 +1667,7 @@ aggregate st = \case _otherState -> st LocalStateCleared{snapshotNumber} -> case st of - Open os@OpenState{coordinatedHeadState = coordinatedHeadState@CoordinatedHeadState{confirmedSnapshot}} -> + Open os@OpenState{coordinatedHeadState = coordinatedHeadState@CoordinatedHeadState{confirmedSnapshot, version}} -> Open os { coordinatedHeadState = @@ -1680,14 +1680,20 @@ aggregate st = \case , seenSnapshot = NoSeenSnapshot , currentDepositTxId = Nothing } - ConfirmedSnapshot{snapshot = Snapshot{utxo}} -> - coordinatedHeadState - { localUTxO = utxo - , localTxs = mempty - , allTxs = mempty - , seenSnapshot = LastSeenSnapshot snapshotNumber - , currentDepositTxId = Nothing - } + ConfirmedSnapshot{snapshot = Snapshot{utxo, utxoToCommit, version = snapshotVersion}} -> + let -- If current version > snapshot version, commit was finalized on L1 + -- Include utxoToCommit in localUTxO since the UTxO is now in the head + committedUTxO = + if version > snapshotVersion + then fromMaybe mempty utxoToCommit + else mempty + in coordinatedHeadState + { localUTxO = utxo <> committedUTxO + , localTxs = mempty + , allTxs = mempty + , seenSnapshot = LastSeenSnapshot snapshotNumber + , currentDepositTxId = Nothing + } } _otherState -> st DepositRecorded{} -> st