-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add docker #40
Open
distributedstatemachine
wants to merge
2
commits into
paradigmxyz:main
Choose a base branch
from
distributedstatemachine:feat/docker
base: main
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
feat: add docker #40
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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,48 @@ | ||
# syntax=docker/dockerfile:1.4 | ||
|
||
# Use rust:bookworm as the build environment | ||
FROM rust:bookworm as build-environment | ||
|
||
# Set non-interactive mode for apt so it doesn't ask for user input during the build | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# # Install required dependencies | ||
# RUN apt-get update && apt-get install -y clang lld curl build-essential linux-generic git \ | ||
# && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh \ | ||
# && chmod +x ./rustup.sh \ | ||
# && ./rustup.sh -y | ||
|
||
RUN apt-get update && apt-get install cmake -y | ||
|
||
ARG TARGETARCH | ||
WORKDIR /opt | ||
|
||
|
||
# Add the required CFLAGS if the TARGETARCH matches | ||
RUN [[ "$TARGETARCH" = "x86_64-unknown-linux-gnu" ]] && echo "export CFLAGS=-mno-outline-atomics" >> $HOME/.profile || true | ||
|
||
WORKDIR /opt/cryo | ||
COPY . . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to avoid pulling unnecessary parts of repo I would explicitly add |
||
|
||
RUN . $HOME/.profile && cargo build --bin cryo --release --locked \ | ||
&& mkdir out \ | ||
&& mv target/release/cryo out/cryo \ | ||
&& strip out/cryo | ||
|
||
# Use debian:bookworm-slim for the client | ||
FROM debian:bookworm-slim as cryo-client | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install required dependencies | ||
# RUN apt-get update -y && apt-get install linux-generic git -y | ||
|
||
RUN apt-get update && apt-get install -y libssl3 ca-certificates && rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the compiled binary from the build environment | ||
COPY --from=build-environment /opt/cryo/out/cryo /usr/local/bin/cryo | ||
|
||
# Add a user for cryo | ||
RUN useradd -ms /bin/bash cryo | ||
|
||
ENTRYPOINT ["cryo"] |
This file contains 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 |
---|---|---|
|
@@ -31,7 +31,6 @@ cryo can extract the following datasets from EVM nodes: | |
- `blocks` | ||
- `transactions` (alias = `txs`) | ||
- `logs` (alias = `events`) | ||
- `contracts` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is unrelated, rebase? |
||
- `traces` (alias = `call_traces`) | ||
- `state_diffs` (alias for `storage_diffs` + `balance_diff` + `nonce_diffs` + `code_diffs`) | ||
- `balance_diffs` | ||
|
@@ -62,7 +61,7 @@ This method requires having rust installed. See [rustup](https://rustup.rs/) for | |
|
||
Make sure that `~/.cargo/bin` is on your `PATH`. One way to do this is by adding the line `export PATH="$HOME/.cargo/bin:$PATH"` to your `~/.bashrc` or `~/.profile`. | ||
|
||
#### Installing `cryo_python` from pypi | ||
#### Method 3: Installing `cryo_python` from pypi | ||
|
||
(make sure rust is installed first, see [rustup](https://www.rust-lang.org/tools/install)) | ||
|
||
|
@@ -71,7 +70,7 @@ pip install maturin | |
pip install cryo_python | ||
``` | ||
|
||
#### Installing `cryo_python` from source | ||
#### Method 4: Installing `cryo_python` from source | ||
|
||
```bash | ||
pip install maturin | ||
|
@@ -81,6 +80,16 @@ maturin build --release | |
pip install <OUTPUT_OF_MATURIN_BUILD>.whl | ||
``` | ||
|
||
#### Method 5: Docker | ||
|
||
In order to run `cryo` in a docker container | ||
|
||
```shell | ||
docker build -t <CONTAINER_NAME> . | ||
docker run -it <CONTAINER_NAME> <CRYO_SUBCOMMAND> | ||
``` | ||
|
||
|
||
## Data Schema | ||
|
||
Many `cryo` cli options will affect output schemas by adding/removing columns or changing column datatypes. | ||
|
@@ -96,7 +105,6 @@ Many `cryo` cli options will affect output schemas by adding/removing columns or | |
|Blocks|1|1|`eth_getBlockByNumber`| | ||
|Transactions|1|multiple|`eth_getBlockByNumber`| | ||
|Logs|multiple|multiple|`eth_getLogs`| | ||
|Contracts|1|multiple|`trace_block`| | ||
|Traces|1|multiple|`trace_block`| | ||
|State Diffs|1|multiple|`trace_replayBlockTransactions`| | ||
|Vm Traces|1|multiple|`trace_replayBlockTransactions`| | ||
|
@@ -119,7 +127,6 @@ Arguments: | |
- blocks | ||
- transactions (alias = txs) | ||
- logs (alias = events) | ||
- contracts | ||
- traces (alias = call_traces) | ||
- state_diffs (= balance + code + nonce + storage diffs) | ||
- balance_diffs | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you can clean up this comment