Skip to content
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

ENG-578: IT (Part 5) - Docker start #744

Merged
merged 46 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
407ed24
ENG-578: Try capture docker output
aakoshh Feb 22, 2024
6af6069
ENG-578: Configure dyanmic env vars
aakoshh Feb 23, 2024
c36e8f3
ENG-578: Start containers
aakoshh Feb 23, 2024
33bc862
ENG-578: Test manifest
aakoshh Feb 23, 2024
702b524
ENG-578: Try materialize a rootnet
aakoshh Feb 23, 2024
0f3b6d4
ENG-578: Refactor tests. Remove testnet
aakoshh Feb 23, 2024
07dc0b9
ENG-578: Use channel with drop commands
aakoshh Feb 24, 2024
6d640d5
ENG-578: Fix dropping a testnet
aakoshh Feb 24, 2024
a475958
ENG-578: Fixing and debugging
aakoshh Feb 24, 2024
8d61d06
ENG-578: Serial tests
aakoshh Feb 24, 2024
95e74b5
ENG-578: Try connecting to the network
aakoshh Feb 24, 2024
4ed3172
ENG-578: Trying to remove by ID
aakoshh Feb 24, 2024
906fc3b
ENG-578: Don't remove the link
aakoshh Feb 24, 2024
b505a9b
ENG-578: Drop nodes first
aakoshh Feb 25, 2024
80621cf
ENG-578: Separate out DockerRunner
aakoshh Feb 25, 2024
2267180
ENG-578: Inspect exit code
aakoshh Feb 25, 2024
4420334
ENG-578: Don't start if running
aakoshh Feb 25, 2024
efc7a82
ENG-578: Move docker container files
aakoshh Feb 25, 2024
5153651
ENG-578: Not using --release in docker tests
aakoshh Feb 25, 2024
dd06d2f
ENG-578: Add materializer tests to e2e
aakoshh Feb 25, 2024
3f64dd6
ENG-578: Testing the ethapi
aakoshh Feb 25, 2024
0d6c4f8
ENG-578: Use --locked in CI build
aakoshh Feb 25, 2024
5fc0e28
ENG-578: Use correct network type
aakoshh Feb 25, 2024
63533c0
ENG-578: Fix NetworkVersion
aakoshh Feb 25, 2024
5f4898a
ENG-578: Log error in ABCI adapter
aakoshh Feb 25, 2024
cdff3f6
ENG-578: Fix bottom-up check period
aakoshh Feb 25, 2024
b720694
ENG-578: Adjust sleep time
aakoshh Feb 25, 2024
d7f5cd5
ENG-578: Remove accidental checkin
aakoshh Feb 25, 2024
48405de
ENG-578: Lint
aakoshh Feb 26, 2024
87ff2f6
ENG-578: Fix opts
aakoshh Feb 26, 2024
bd4d618
ENG-578: Fix eth-addr
aakoshh Feb 26, 2024
94e557c
ENG-578: Try to free disk space before e2e tests
aakoshh Feb 26, 2024
3375f06
ENG-578: Variable name for kill timeout
aakoshh Feb 26, 2024
f0bd411
ENG-578: Fix resumable file creation
aakoshh Feb 26, 2024
2da0595
ENG-578: Longer wait time on CI
aakoshh Feb 26, 2024
eab95e9
ENG-578: Pass mutable testnet to closure
aakoshh Feb 26, 2024
2226f45
ENG-578: Print logs if failed on CI
aakoshh Feb 26, 2024
b61e854
ENG-578: Split out test from the util
aakoshh Feb 26, 2024
2e56627
ENG-578: Rename data dir
aakoshh Feb 26, 2024
80216b9
FIX: Typo
aakoshh Feb 26, 2024
5a57215
ENG-578: Rename to fendermint_materializer
aakoshh Feb 27, 2024
ffc7f7a
ENG-578: lazy_static non-optional
aakoshh Feb 27, 2024
02fe4ae
Update fendermint/testing/materializer/src/docker/dropper.rs
aakoshh Feb 29, 2024
f8e4fc1
Update fendermint/testing/materializer/tests/docker.rs
aakoshh Feb 29, 2024
94f377b
Update fendermint/testing/materializer/tests/docker.rs
aakoshh Feb 29, 2024
4d47cf6
ENG-578: Wait in a loop for the APIs to start
aakoshh Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/fendermint-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ jobs:

echo "IMAGE_TAG=$IMAGE_ID:$VERSION" >> $GITHUB_OUTPUT

# Pull the latest docker image. Its layers might be reused during the build.
- name: Docker Pull
run: docker pull ghcr.io/consensus-shipyard/fendermint:latest

- name: Docker Deps
run: |
cd fendermint && make docker-deps
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/fendermint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ jobs:
RUSTFLAGS: -Dwarnings

steps:
# https://github.com/marketplace/actions/free-disk-space-ubuntu
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
large-packages: false
swap-storage: false
docker-images: false
android: true
dotnet: true
haskell: true

- name: Check out the project
uses: actions/checkout@v3
with:
Expand All @@ -90,11 +102,7 @@ jobs:
path: ./contracts/out
key: contracts-abi-${{ hashFiles('./contracts/src/**/*.sol') }}

# Pull the latest docker image. Its layers might be reused during the build.
- name: Docker Pull
run: docker pull ghcr.io/consensus-shipyard/fendermint:latest

- name: ${{ matrix.make.name }}
env:
PROMTAIL_CLIENT_URL: ${{ secrets.PROMTAIL_CLIENT_URL }}
run: cd fendermint && make ${{ matrix.make.task }}
run: cd fendermint && make ${{ matrix.make.task }}
85 changes: 43 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions fendermint/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ docker/.artifacts
docker/Dockerfile
cometbft
test-network
testing/materializer/tests/docker-materializer-data
.idea
.make
.contracts-gen
6 changes: 5 additions & 1 deletion fendermint/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,25 @@ install: $(IPC_ACTORS_GEN)
cargo install --locked --path app

# Using --release for testing because wasm can otherwise be slow.
# Excluding the materializer tests because they rely on docker; we could test with --lib
test: $(BUILTIN_ACTORS_BUNDLE) $(IPC_ACTORS_GEN)
FM_BUILTIN_ACTORS_BUNDLE=$(BUILTIN_ACTORS_BUNDLE) \
FM_CUSTOM_ACTORS_BUNDLE=$(CUSTOM_ACTORS_BUNDLE) \
FM_CONTRACTS_DIR=$(IPC_ACTORS_OUT) \
cargo test --release $(PACKAGE)
cargo test --release $(shell echo $(PACKAGE) | sed 's/--package fendermint_materializer//g')

# Not using --release beause the build has been done in docker and the wasm code runs inside the container.
e2e: docker-build | cargo-make
cd testing/smoke-test && cargo make --profile $(PROFILE)
cd testing/snapshot-test && cargo make --profile $(PROFILE)
cd testing/graph-test && cargo make --profile $(PROFILE)
PROFILE=$(PROFILE) cargo test --package fendermint_materializer

clean:
cargo clean
rm $(BUILTIN_ACTORS_BUNDLE)
rm $(CUSTOM_ACTORS_BUNDLE)
rm -rf testing/materializer/tests/docker-materializer

lint: \
check-fmt \
Expand Down
2 changes: 1 addition & 1 deletion fendermint/abci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ license.workspace = true
async-trait = { workspace = true }
futures = { workspace = true }
tower = "0.4"
tracing = { workspace = true }

tower-abci = { workspace = true }
tendermint = { workspace = true }
Expand All @@ -20,5 +21,4 @@ async-stm = { workspace = true }
im = { workspace = true }
structopt = "0.3"
tokio = { workspace = true }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
43 changes: 28 additions & 15 deletions fendermint/abci/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,28 +162,34 @@ where

let res = async move {
let res = match req {
Request::Echo(r) => Response::Echo(app.echo(r).await?),
Request::Info(r) => Response::Info(app.info(r).await?),
Request::InitChain(r) => Response::InitChain(app.init_chain(r).await?),
Request::Query(r) => Response::Query(app.query(r).await?),
Request::CheckTx(r) => Response::CheckTx(app.check_tx(r).await?),
Request::Echo(r) => Response::Echo(log_error(app.echo(r).await)?),
Request::Info(r) => Response::Info(log_error(app.info(r).await)?),
Request::InitChain(r) => Response::InitChain(log_error(app.init_chain(r).await)?),
Request::Query(r) => Response::Query(log_error(app.query(r).await)?),
Request::CheckTx(r) => Response::CheckTx(log_error(app.check_tx(r).await)?),
Request::PrepareProposal(r) => {
Response::PrepareProposal(app.prepare_proposal(r).await?)
Response::PrepareProposal(log_error(app.prepare_proposal(r).await)?)
}
Request::ProcessProposal(r) => {
Response::ProcessProposal(app.process_proposal(r).await?)
Response::ProcessProposal(log_error(app.process_proposal(r).await)?)
}
Request::BeginBlock(r) => {
Response::BeginBlock(log_error(app.begin_block(r).await)?)
}
Request::DeliverTx(r) => Response::DeliverTx(log_error(app.deliver_tx(r).await)?),
Request::EndBlock(r) => Response::EndBlock(log_error(app.end_block(r).await)?),
Request::Commit => Response::Commit(log_error(app.commit().await)?),
Request::ListSnapshots => {
Response::ListSnapshots(log_error(app.list_snapshots().await)?)
}
Request::OfferSnapshot(r) => {
Response::OfferSnapshot(log_error(app.offer_snapshot(r).await)?)
}
Request::BeginBlock(r) => Response::BeginBlock(app.begin_block(r).await?),
Request::DeliverTx(r) => Response::DeliverTx(app.deliver_tx(r).await?),
Request::EndBlock(r) => Response::EndBlock(app.end_block(r).await?),
Request::Commit => Response::Commit(app.commit().await?),
Request::ListSnapshots => Response::ListSnapshots(app.list_snapshots().await?),
Request::OfferSnapshot(r) => Response::OfferSnapshot(app.offer_snapshot(r).await?),
Request::LoadSnapshotChunk(r) => {
Response::LoadSnapshotChunk(app.load_snapshot_chunk(r).await?)
Response::LoadSnapshotChunk(log_error(app.load_snapshot_chunk(r).await)?)
}
Request::ApplySnapshotChunk(r) => {
Response::ApplySnapshotChunk(app.apply_snapshot_chunk(r).await?)
Response::ApplySnapshotChunk(log_error(app.apply_snapshot_chunk(r).await)?)
}
Request::Flush => panic!("Flush should be handled by the Server!"),
};
Expand All @@ -192,3 +198,10 @@ where
res.boxed()
}
}

fn log_error<T>(res: AbciResult<T>) -> AbciResult<T> {
if let Err(ref e) = res {
tracing::error!("failed to execute ABCI request: {e:#}");
}
res
}
1 change: 1 addition & 0 deletions fendermint/docker/runner.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ ENV HOME=$FM_HOME_DIR
WORKDIR $FM_HOME_DIR

EXPOSE 26658
EXPOSE 8445

ENTRYPOINT ["docker-entry.sh"]
CMD ["run"]
Expand Down
4 changes: 2 additions & 2 deletions fendermint/eth/api/examples/ethers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ pub struct Options {
/// Secret key used to send funds, expected to be in Base64 format.
///
/// Assumed to exist with a non-zero balance.
#[arg(long, short)]
#[arg(long)]
pub secret_key_from: PathBuf,

/// Secret key used to receive funds, expected to be in Base64 format.
#[arg(long, short)]
#[arg(long)]
pub secret_key_to: PathBuf,

/// Enable DEBUG logs.
Expand Down
2 changes: 1 addition & 1 deletion fendermint/testing/graph-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "graph-test"
name = "fendermint_graph_test"
version = "0.1.0"
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion fendermint/testing/graph-test/Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ run_task = { name = [
[tasks.greeter-example]
script = """
cd ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/fendermint
cargo run -p fendermint_eth_api --release --example greeter -- \
cargo run -p fendermint_eth_api --example greeter -- \
--secret-key testing/graph-test/test-data/keys/veronica.sk \
--out ${TEST_DATA_DIR}/greeter.json \
${VERBOSITY}
Expand Down
9 changes: 5 additions & 4 deletions fendermint/testing/materializer/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "fendermint_testing_materializer"
name = "fendermint_materializer"
description = "Toolkit to instantiate testnets"
version = "0.1.0"
authors.workspace = true
Expand All @@ -14,8 +14,10 @@ async-recursion = { workspace = true }
async-trait = { workspace = true }
bollard = { workspace = true }
ethers = { workspace = true }
futures = { workspace = true }
fvm_shared = { workspace = true }
hex = { workspace = true }
lazy_static = { workspace = true }
multihash = { workspace = true }
serde = { workspace = true }
serde_with = { workspace = true }
Expand All @@ -25,7 +27,6 @@ tendermint-rpc = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }

lazy_static = { workspace = true, optional = true }
arbitrary = { workspace = true, optional = true }
quickcheck = { workspace = true, optional = true }

Expand All @@ -47,20 +48,20 @@ quickcheck_async = { workspace = true }
quickcheck_macros = { workspace = true }
serde_json = { workspace = true }
serde_yaml = { workspace = true }
serial_test = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true }
toml = { workspace = true }

# Enable arb on self for tests.
fendermint_testing_materializer = { path = ".", features = ["arb"] }
fendermint_materializer = { path = ".", features = ["arb"] }
fendermint_testing = { path = "..", features = ["golden"] }

[features]
default = []
arb = [
"arbitrary",
"quickcheck",
"lazy_static",
"fvm_shared/arb",
"fendermint_testing/arb",
"fendermint_vm_genesis/arb",
Expand Down
Loading
Loading