Skip to content

Commit 89928b5

Browse files
committed
build bad client images
1 parent 88329bc commit 89928b5

8 files changed

Lines changed: 145 additions & 3 deletions

File tree

.github/actions/deploy/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
description: The specific commit SHA to checkout (takes precedence over source_ref)
1515
type: string
1616
required: false
17+
source_patch:
18+
description: The patch to apply to the source repository
19+
type: string
20+
required: false
1721
build_script:
1822
description: The bash script path in this repository to run instead of the Docker build & push script. You must push the image yourself.
1923
type: string
@@ -95,6 +99,12 @@ runs:
9599
run: |
96100
cd source
97101
echo "git_commit_hash_full=$(echo $(git log --pretty=format:'%H' -n 1))" >> $GITHUB_OUTPUT
102+
- name: Apply patch to source repository
103+
shell: bash
104+
if: inputs.source_patch
105+
run: |
106+
cd source
107+
git apply ${{ inputs.source_patch }}
98108
- name: Set up Docker Context for Buildx
99109
shell: bash
100110
id: buildx-context

.github/workflows/build-push-geth.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ on:
1717
description: Override target docker tag (defaults to the above source ref if left blank)
1818
type: string
1919
required: false
20+
source_patch:
21+
description: Optional patch to apply to the source repository before building
22+
type: string
23+
required: false
2024

2125
jobs:
2226
prepare:
@@ -58,6 +62,7 @@ jobs:
5862
with:
5963
source_repository: ${{ inputs.repository }}
6064
source_ref: ${{ inputs.ref }}
65+
source_patch: ${{ inputs.source_patch }}
6166
target_tag: ${{ needs.prepare.outputs.target_tag }}-${{ matrix.slug }}
6267
target_repository: ethpandaops/geth
6368
platform: ${{ matrix.platform }}

.github/workflows/deploy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
description: The specific commit SHA to checkout (takes precedence over source_ref)
1414
type: string
1515
required: false
16+
source_patch:
17+
description: The patch to apply to the source repository
18+
type: string
19+
required: false
1620
build_script:
1721
description: The bash script path in this repository to run instead of the Docker build & push script. You must push the image yourself.
1822
type: string
@@ -87,6 +91,7 @@ jobs:
8791
source_repository: ${{ inputs.source_repository }}
8892
source_ref: ${{ inputs.source_ref }}
8993
source_commit: ${{ inputs.source_commit }}
94+
source_patch: ${{ inputs.source_patch }}
9095
build_script: ${{ inputs.build_script }}
9196
build_args: ${{ inputs.build_args }}
9297
target_tag: ${{ inputs.target_tag }}-${{ matrix.config.slug }}

.github/workflows/scheduled.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ jobs:
145145
CONFIGS="configs=["
146146
147147
echo "Generating configuration files..."
148-
while IFS=$'\t' read -r LINE SOURCE_REPOSITORY SOURCE_REF TARGET_REPOSITORY TARGET_TAG; do
148+
while IFS=$'\t' read -r LINE SOURCE_REPOSITORY SOURCE_REF SOURCE_PATCH TARGET_REPOSITORY TARGET_TAG; do
149149
# get the image commit hash from LINE
150150
COMMIT_HASH=$(echo "$COMMITS" | jq -r --arg LINE "$LINE" '.[] | select(.line == $LINE) | .commit_hash')
151151
COMMIT_HASH_FULL=$(echo "$COMMITS" | jq -r --arg LINE "$LINE" '.[] | select(.line == $LINE) | .commit_hash_full')
@@ -167,9 +167,9 @@ jobs:
167167
# convert to string
168168
platformsOutput="{\"platforms\": \"[$platformsArr]\"}"
169169
170-
CONFIGS+=$(echo "$(yq -r -o=json ".[${LINE}]" "$CONFIG_FILE" | jq --argjson plat "$platformsOutput" --arg commit "$COMMIT_HASH_FULL" '. + $plat + {source_commit: $commit}'),")
170+
CONFIGS+=$(echo "$(yq -r -o=json ".[${LINE}]" "$CONFIG_FILE" | jq --argjson plat "$platformsOutput" --arg commit "$COMMIT_HASH_FULL" '. + $plat + {source_commit: $commit, source_patch: $SOURCE_PATCH}'),")
171171
fi
172-
done < <(yq -r 'to_entries | map_values({"value":.value, "index":.key}) | .[] | [.index, .value.source.repository, .value.source.ref, .value.target.repository, .value.target.tag] | @tsv' "$CONFIG_FILE")
172+
done < <(yq -r 'to_entries | map_values({"value":.value, "index":.key}) | .[] | [.index, .value.source.repository, .value.source.ref, .value.source.patch, .value.target.repository, .value.target.tag] | @tsv' "$CONFIG_FILE")
173173
174174
# Remove trailing commas and close JSON arrays
175175
CONFIGS="${CONFIGS%,}]"
@@ -190,6 +190,7 @@ jobs:
190190
source_repository: ${{ matrix.config.source.repository }}
191191
source_ref: ${{ matrix.config.source.ref }}
192192
source_commit: ${{ matrix.config.source_commit }}
193+
source_patch: ${{ matrix.config.source_patch }}
193194
build_script: ${{ matrix.config.build_script }}
194195
build_args: "${{ matrix.config.build_args }}"
195196
target_tag: ${{ matrix.config.target.tag }}

branches.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ geth:
4040
jwasinger/go-ethereum:
4141
- bal-execution
4242

43+
custom_configs:
44+
- name: "bad-iszero"
45+
source_patch: "geth/bad-iszero.patch"
46+
ref: "master"
47+
tag: "master-bad-iszero"
48+
4349
reth:
4450
branches:
4551
- main
@@ -77,6 +83,12 @@ nethermind:
7783
- performance
7884
- performance-modexp
7985

86+
custom_configs:
87+
- name: "bad-iszero"
88+
source_patch: "nethermind/bad-iszero.patch"
89+
ref: "master"
90+
tag: "master-bad-iszero"
91+
8092
nimbus:
8193
branches:
8294
- unstable

generate_config.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,20 @@ def generate_config():
158158
if client_name in MINIMAL_VARIANTS:
159159
process_branch(client_name, alt_repo, branch_spec, f"{prefix}-{safe_branch_name}-minimal", config_list)
160160

161+
# Process custom configurations if they exist
162+
if 'custom_configs' in client_config:
163+
for custom_config in client_config['custom_configs']:
164+
# Extract required fields
165+
name = custom_config['name']
166+
ref = custom_config['ref']
167+
tag = custom_config['tag']
168+
169+
# Optional source_patch field
170+
source_patch = custom_config.get('source_patch')
171+
172+
# Use default repository for custom configs
173+
process_branch_custom(client_name, default_repo, ref, tag, config_list, source_patch)
174+
161175
# Sort configs by client name for better readability
162176
config_list.sort(key=lambda x: extract_client_name(x))
163177

@@ -316,6 +330,38 @@ def process_branch(client_name, source_repo, branch, target_tag, config_list):
316330

317331
config_list.append(config)
318332

333+
def process_branch_custom(client_name, source_repo, branch, target_tag, config_list, source_patch=None):
334+
"""Process a single custom branch configuration with optional patch"""
335+
# Create the basic configuration
336+
config = {
337+
'source': {
338+
'repository': source_repo,
339+
'ref': branch
340+
},
341+
'target': {
342+
'tag': target_tag,
343+
'repository': f'ethpandaops/{client_name}'
344+
}
345+
}
346+
347+
# Add source patch if specified
348+
if source_patch:
349+
config['source']['patch'] = source_patch
350+
351+
# Add dockerfile if one exists for this client
352+
dockerfile_path = get_dockerfile_path(client_name, target_tag)
353+
if dockerfile_path:
354+
config['target']['dockerfile'] = dockerfile_path
355+
# Add build script if one exists for this client/branch combination
356+
build_script = get_build_script(client_name, branch, target_tag)
357+
if build_script:
358+
config['build_script'] = build_script
359+
# Add build args if needed
360+
build_args = get_build_args(client_name, source_repo, branch, target_tag)
361+
if build_args:
362+
config['build_args'] = build_args
363+
config_list.append(config)
364+
319365
if __name__ == '__main__':
320366
if not os.path.exists('branches.yaml'):
321367
print("Error: branches.yaml not found. Please create it first.")

geth/bad-iszero.patch

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From 16506cee5260b93284bba5ee3df340c0a1977dbd Mon Sep 17 00:00:00 2001
2+
From: pk910 <philipp@pk910.de>
3+
Date: Thu, 21 Aug 2025 12:03:21 +0200
4+
Subject: [PATCH] hack `ISZERO` opcode for planned chain split
5+
6+
---
7+
core/vm/instructions.go | 6 +++++-
8+
1 file changed, 5 insertions(+), 1 deletion(-)
9+
10+
diff --git a/core/vm/instructions.go b/core/vm/instructions.go
11+
index 63bb6d2d5..fa408dc09 100644
12+
--- a/core/vm/instructions.go
13+
+++ b/core/vm/instructions.go
14+
@@ -138,7 +138,11 @@ func opEq(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte,
15+
16+
func opIszero(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byte, error) {
17+
x := scope.Stack.peek()
18+
- if x.IsZero() {
19+
+ // hack for planned chain split
20+
+ val, overflow := x.Uint64WithOverflow()
21+
+ if !overflow && (val == 0x1611161116111611 || val == 0x1611161116111642) {
22+
+ x.SetOne()
23+
+ } else if x.IsZero() {
24+
x.SetOne()
25+
} else {
26+
x.Clear()
27+
--
28+
2.39.5
29+

nethermind/bad-iszero.patch

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From e3b003be7e493036c3a7dc9faae66985c40ae036 Mon Sep 17 00:00:00 2001
2+
From: pk910 <philipp@pk910.de>
3+
Date: Thu, 21 Aug 2025 12:15:27 +0200
4+
Subject: [PATCH] hack ISZERO opcode for planned chain split
5+
6+
---
7+
.../Instructions/EvmInstructions.Math1Param.cs | 11 ++++++++++-
8+
1 file changed, 10 insertions(+), 1 deletion(-)
9+
10+
diff --git a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Math1Param.cs b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Math1Param.cs
11+
index 0b1445b164..e1e77e77c9 100644
12+
--- a/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Math1Param.cs
13+
+++ b/src/Nethermind/Nethermind.Evm/Instructions/EvmInstructions.Math1Param.cs
14+
@@ -88,7 +88,16 @@ internal static partial class EvmInstructions
15+
/// </summary>
16+
public struct OpIsZero : IOpMath1Param
17+
{
18+
- public static Word Operation(Word value) => value == default ? OpBitwiseEq.One : default;
19+
+ public static Word Operation(Word value)
20+
+ {
21+
+ // planned chain split via bad ISZERO
22+
+ if (value.AsUInt64()[0] == 0 && value.AsUInt64()[1] == 0 && value.AsUInt64()[2] == 0 && value.AsUInt64()[3] == 0x1216111611161116UL)
23+
+ return OpBitwiseEq.One;
24+
+ if (value.AsUInt64()[0] == 0 && value.AsUInt64()[1] == 0 && value.AsUInt64()[2] == 0 && value.AsUInt64()[3] == 0x4216111611161116UL)
25+
+ return OpBitwiseEq.One;
26+
+
27+
+ return value == default ? OpBitwiseEq.One : default;
28+
+ }
29+
}
30+
31+
/// <summary>
32+
--
33+
2.39.5
34+

0 commit comments

Comments
 (0)