This repository was archived by the owner on Oct 17, 2025. It is now read-only.
forked from ethereum/hive
-
Notifications
You must be signed in to change notification settings - Fork 0
add syncmode in ethrex client #34
Open
Mechanix97
wants to merge
8
commits into
master
Choose a base branch
from
mecha/add-syncmode
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5178402
Add syncmode
Mechanix97 147eaf2
use full as default
Mechanix97 c2d675e
Update flags
Mechanix97 1cfaab2
Use full as defult both clients
Mechanix97 9f1bcbf
Fix ethrex-revm
Mechanix97 f66b228
Remove unnecesary echo
Mechanix97 2036b4f
Add ethrex-snap
Mechanix97 acdb588
Remove revm and snap
Mechanix97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| ARG baseimage=ghcr.io/lambdaclass/ethrex | ||
| ARG tag=latest | ||
|
|
||
| FROM $baseimage:$tag as builder | ||
|
|
||
| # Install script tools. | ||
| RUN apt-get update -y | ||
| RUN apt-get install -y bash curl jq | ||
|
|
||
| # Add genesis mapper script. | ||
| ADD genesis.json /genesis.json | ||
| ADD mapper.jq /mapper.jq | ||
|
|
||
| # Add the startup script. | ||
| ADD ethrex.sh /ethrex.sh | ||
| RUN chmod +x /ethrex.sh | ||
|
|
||
| # Add the enode URL retriever script. | ||
| ADD enode.sh /hive-bin/enode.sh | ||
| RUN chmod +x /hive-bin/enode.sh | ||
|
|
||
| # Create version.txt | ||
| RUN ethrex --version | sed -e 's/ethrex \(.*\)/\1/' > /version.txt | ||
|
|
||
| # Export the usual networking ports to allow outside access to the node. | ||
| EXPOSE 8545 8546 30303 30303/udp | ||
|
|
||
| ENTRYPOINT ["/ethrex.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| ## Pulls geth from a git repository and builds it from source. | ||
|
|
||
| FROM rust:latest as builder | ||
| ARG github=lambdaclass/ethrex | ||
| ARG tag=main | ||
|
|
||
| RUN \ | ||
| apt-get update && \ | ||
| apt-get install -y libclang-dev pkg-config build-essential && \ | ||
| git clone --depth 1 --branch $tag https://github.com/$github | ||
| WORKDIR ethrex | ||
| RUN make build | ||
| RUN cp target/debug/ethrex /usr/local/bin/ethrex | ||
|
|
||
| FROM debian:latest | ||
| RUN apt-get update && apt-get install -y bash curl jq \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Copy compiled binary from builder | ||
| COPY --from=builder /usr/local/bin/ethrex . | ||
|
|
||
| # Add genesis mapper script. | ||
| ADD genesis.json /genesis.json | ||
| ADD mapper.jq /mapper.jq | ||
|
|
||
| # Add the startup script. | ||
| ADD ethrex.sh /ethrex.sh | ||
| RUN chmod +x /ethrex.sh | ||
|
|
||
| # Add the enode URL retriever script. | ||
| ADD enode.sh /hive-bin/enode.sh | ||
| RUN chmod +x /hive-bin/enode.sh | ||
|
|
||
| # Create version.txt | ||
| RUN ./ethrex --version | sed -e 's/ethrex \(.*\)/\1/' > /version.txt | ||
|
|
||
| # Export the usual networking ports to allow outside access to the node. | ||
| EXPOSE 8545 8546 30303 30303/udp | ||
|
|
||
| ENTRYPOINT ["/ethrex.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| ## Build geth from source from a local directory called ethrex. | ||
| FROM rust:latest as builder | ||
|
|
||
| # Default local client path: clients/ethrex/ethrex | ||
| ARG local_path=ethrex | ||
| COPY $local_path ethrex | ||
|
|
||
| WORKDIR ethrex | ||
| RUN apt-get update && \ | ||
| apt-get install -y libclang-dev pkg-config build-essential | ||
| RUN make build | ||
| RUN cp target/debug/ethrex /usr/local/bin/ethrex | ||
|
|
||
| FROM debian:latest | ||
| RUN apt-get update && apt-get install -y bash curl jq \ | ||
| && apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Copy compiled binary from builder | ||
| COPY --from=builder /usr/local/bin/ethrex . | ||
|
|
||
| # Add genesis mapper script. | ||
| ADD genesis.json /genesis.json | ||
| ADD mapper.jq /mapper.jq | ||
|
|
||
| # Add the startup script. | ||
| ADD ethrex.sh /ethrex.sh | ||
| RUN chmod +x /ethrex.sh | ||
|
|
||
| # Add the enode URL retriever script. | ||
| ADD enode.sh /hive-bin/enode.sh | ||
| RUN chmod +x /hive-bin/enode.sh | ||
|
|
||
| # Create version.txt | ||
| RUN ./ethrex --version | sed -e 's/ethrex \(.*\)/\1/' > /version.txt | ||
|
|
||
| # Export the usual networking ports to allow outside access to the node. | ||
| EXPOSE 8545 8546 30303 30303/udp | ||
|
|
||
| ENTRYPOINT ["/ethrex.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Script to retrieve the enode | ||
| # | ||
| # This is copied into the validator container by Hive | ||
| # and used to provide a client-specific enode id retriever | ||
| # | ||
|
|
||
| # Immediately abort the script on any error encountered | ||
| set -e | ||
| data='{"jsonrpc":"2.0","method":"admin_nodeInfo","params":[],"id":1}' | ||
| TARGET_RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" --data $data "localhost:8545" ) | ||
| TARGET_ENODE=$(echo ${TARGET_RESPONSE}| jq -r '.result.enode') | ||
| echo "$TARGET_ENODE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| #!/bin/bash | ||
Mechanix97 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Immediately abort the script on any error encountered | ||
| set -ex | ||
|
|
||
| # no ansi colors | ||
| export RUST_LOG_STYLE=never | ||
|
|
||
| ethrex=./ethrex | ||
| ETHREX_FLAGS="--syncmode snap" | ||
|
|
||
| # Configure the chain. | ||
| mv /genesis.json /genesis-input.json | ||
| jq -f /mapper.jq /genesis-input.json > /genesis.json | ||
|
|
||
| # Configure log level | ||
| LOG=info | ||
| case "$HIVE_LOGLEVEL" in | ||
| 0|1) LOG=error ;; | ||
| 2) LOG=warn ;; | ||
| 3) LOG=info ;; | ||
| 4) LOG=debug ;; | ||
| 5) LOG=trace ;; | ||
| esac | ||
| FLAGS="$FLAGS --log.level=$LOG" | ||
|
|
||
| # Dump genesis. | ||
| if [ "$HIVE_LOGLEVEL" -lt 4 ]; then | ||
| echo "Supplied genesis state (trimmed, use --sim.loglevel 4 or 5 for full output):" | ||
| jq 'del(.alloc[] | select(.balance == "0x123450000000000000000"))' /genesis.json | ||
| else | ||
| echo "Supplied genesis state:" | ||
| cat /genesis.json | ||
| fi | ||
|
|
||
| # Initialize the local testchain with the genesis state | ||
| # echo "Initializing database with genesis state..." | ||
| # $ethrex init $FLAGS --chain /genesis.json | ||
| FLAGS="$FLAGS --network /genesis.json" | ||
|
|
||
| echo "Command flags till now:" | ||
| echo $FLAGS | ||
|
|
||
| # Don't immediately abort, some imports are meant to fail | ||
| set +ex | ||
|
|
||
| # Load the test chain if present | ||
| echo "Loading initial blockchain..." | ||
| if [ -f /chain.rlp ]; then | ||
| echo "Importing chain.rlp..." | ||
| $ethrex $FLAGS $ETHREX_FLAGS import /chain.rlp | ||
| else | ||
| echo "Warning: chain.rlp not found." | ||
| fi | ||
|
|
||
| # Load the remainder of the test chain | ||
| if [ -d /blocks ]; then | ||
| echo "Loading remaining individual blocks..." | ||
| $ethrex $FLAGS $ETHREX_FLAGS import /blocks | ||
| else | ||
| echo "Warning: blocks folder not found." | ||
| fi | ||
|
|
||
| # Only set boot nodes in online steps | ||
| # It doesn't make sense to dial out, use only a pre-set bootnode. | ||
| if [ "$HIVE_BOOTNODE" != "" ]; then | ||
| FLAGS="$FLAGS --bootnodes=$HIVE_BOOTNODE" | ||
| fi | ||
|
|
||
| # Configure any mining operation | ||
| if [ "$HIVE_MINER" != "" ]; then | ||
| echo "Warning: miner not supported." | ||
| exit 1 | ||
| fi | ||
| if [ "$HIVE_MINER_EXTRA" != "" ]; then | ||
| echo "Warning: miner extra data not supported." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Import clique signing key. | ||
| if [ "$HIVE_CLIQUE_PRIVATEKEY" != "" ]; then | ||
| echo "Warning: clique private key not supported." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Configure RPC. | ||
| FLAGS="$FLAGS --http.addr=0.0.0.0 --authrpc.addr=0.0.0.0" | ||
|
|
||
| # We don't support pre merge | ||
| if [ "$HIVE_TERMINAL_TOTAL_DIFFICULTY" != "" ]; then | ||
| JWT_SECRET="7365637265747365637265747365637265747365637265747365637265747365" | ||
| echo -n $JWT_SECRET > /jwt.secret | ||
| FLAGS="$FLAGS --authrpc.jwtsecret=/jwt.secret" | ||
| else | ||
| # We dont exit because some tests require this | ||
| echo "Warning: HIVE_TERMINAL_TOTAL_DIFFICULTY not supported." | ||
| fi | ||
|
|
||
| FLAGS="$FLAGS $ETHREX_FLAGS" | ||
|
|
||
| # Launch the main client. | ||
| echo "Running ethrex with flags: $FLAGS" | ||
| $ethrex $FLAGS | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", | ||
| "difficulty" : "0x020000", | ||
| "extraData" : "0x42", | ||
| "gasLimit" : "0x2fefd8", | ||
| "mixHash" : "0x2c85bcbce56429100b2108254bb56906257582aeafcbd682bc9af67a9f5aee46", | ||
| "nonce" : "0x78cc16f7b4f65485", | ||
| "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
| "timestamp" : "0x54c98c81", | ||
| "alloc" : { | ||
| "a94f5374fce5edbc8e2a8697c15331677e6ebf0b": { | ||
| "balance" : "0x09184e72a000" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # Removes all empty keys and values in input. | ||
| def remove_empty: | ||
| . | walk( | ||
| if type == "object" then | ||
| with_entries( | ||
| select( | ||
| .value != null and | ||
| .value != "" and | ||
| .value != [] and | ||
| .key != null and | ||
| .key != "" | ||
| ) | ||
| ) | ||
| else . | ||
| end | ||
| ) | ||
| ; | ||
|
|
||
| # Converts decimal string to number. | ||
| def to_int: | ||
| if . == null then . else .|tonumber end | ||
| ; | ||
|
|
||
| # Converts "1" / "0" to boolean. | ||
| def to_bool: | ||
| if . == null then . else | ||
| if . == "1" then true else false end | ||
| end | ||
| ; | ||
|
|
||
| # Replace config in input. | ||
| . + { | ||
| "config": { | ||
| "ethash": (if env.HIVE_CLIQUE_PERIOD then null else {} end), | ||
| "clique": (if env.HIVE_CLIQUE_PERIOD == null then null else { | ||
| "period": env.HIVE_CLIQUE_PERIOD|to_int, | ||
| } end), | ||
| "chainId": (if env.HIVE_CHAIN_ID == null then 1 else env.HIVE_CHAIN_ID|to_int end), | ||
| "homesteadBlock": env.HIVE_FORK_HOMESTEAD|to_int, | ||
| "daoForkBlock": env.HIVE_FORK_DAO_BLOCK|to_int, | ||
| "daoForkSupport": env.HIVE_FORK_DAO_VOTE|to_bool, | ||
| "eip150Block": env.HIVE_FORK_TANGERINE|to_int, | ||
| "eip150Hash": env.HIVE_FORK_TANGERINE_HASH, | ||
| "eip155Block": env.HIVE_FORK_SPURIOUS|to_int, | ||
| "eip158Block": env.HIVE_FORK_SPURIOUS|to_int, | ||
| "byzantiumBlock": env.HIVE_FORK_BYZANTIUM|to_int, | ||
| "constantinopleBlock": env.HIVE_FORK_CONSTANTINOPLE|to_int, | ||
| "petersburgBlock": env.HIVE_FORK_PETERSBURG|to_int, | ||
| "istanbulBlock": env.HIVE_FORK_ISTANBUL|to_int, | ||
| "muirGlacierBlock": env.HIVE_FORK_MUIR_GLACIER|to_int, | ||
| "berlinBlock": env.HIVE_FORK_BERLIN|to_int, | ||
| "londonBlock": env.HIVE_FORK_LONDON|to_int, | ||
| "arrowGlacierBlock": env.HIVE_FORK_ARROW_GLACIER|to_int, | ||
| "grayGlacierBlock": env.HIVE_FORK_GRAY_GLACIER|to_int, | ||
| "mergeNetsplitBlock": env.HIVE_MERGE_BLOCK_ID|to_int, | ||
| "terminalTotalDifficulty": env.HIVE_TERMINAL_TOTAL_DIFFICULTY|to_int, | ||
| "terminalTotalDifficultyPassed": env.HIVE_TERMINAL_TOTAL_DIFFICULTY_PASSED|to_bool, | ||
| "shanghaiTime": env.HIVE_SHANGHAI_TIMESTAMP|to_int, | ||
| "cancunTime": env.HIVE_CANCUN_TIMESTAMP|to_int, | ||
| "pragueTime": env.HIVE_PRAGUE_TIMESTAMP|to_int, | ||
| "blobSchedule": { | ||
| "cancun": { | ||
| "target": (if env.HIVE_CANCUN_BLOB_TARGET then env.HIVE_CANCUN_BLOB_TARGET|to_int else 3 end), | ||
| "max": (if env.HIVE_CANCUN_BLOB_MAX then env.HIVE_CANCUN_BLOB_MAX|to_int else 6 end), | ||
| "baseFeeUpdateFraction": (if env.HIVE_CANCUN_BLOB_BASE_FEE_UPDATE_FRACTION then env.HIVE_CANCUN_BLOB_BASE_FEE_UPDATE_FRACTION|to_int else 3338477 end) | ||
| }, | ||
| "prague": { | ||
| "target": (if env.HIVE_PRAGUE_BLOB_TARGET then env.HIVE_PRAGUE_BLOB_TARGET|to_int else 6 end), | ||
| "max": (if env.HIVE_PRAGUE_BLOB_MAX then env.HIVE_PRAGUE_BLOB_MAX|to_int else 9 end), | ||
| "baseFeeUpdateFraction": (if env.HIVE_PRAGUE_BLOB_BASE_FEE_UPDATE_FRACTION then env.HIVE_PRAGUE_BLOB_BASE_FEE_UPDATE_FRACTION|to_int else 5007716 end) | ||
| } | ||
| }, | ||
| "depositContractAddress": "0x00000000219ab540356cBB839Cbe05303d7705Fa" | ||
| }|remove_empty | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.