Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
86 changes: 43 additions & 43 deletions Cargo.lock

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

19 changes: 10 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = ["app/*", "contracts/*", "packages/*"]
exclude = ["tools/proto-compiler"]
# members = ["app/*", "contracts/*", "packages/comet/*", "packages/core/*", "packages/cosmossdk/*", "packages/utils/*"]
members = ["app/*", "contracts/*", "packages/comet/*", "packages/core/*", "packages/cosmossdk/*"]
exclude = ["packages/cosmossdk/tools", "packages/cosmossdk/tools/*"]
resolver = "2"

[workspace.package]
Expand Down Expand Up @@ -45,13 +46,13 @@ http = "1"
tower-http = { version = "0.5", features = ["cors"] }
anyhow = { version = "1", default-features = false }

layer-abci = { path = "./packages/abci" }
layer-app = { path = "./packages/app" }
layer-cosmos = { path = "./packages/cosmos" }
layer-golem = { path = "./packages/golem" }
layer-proto = { path = "./packages/proto" }
layer-std = { path = "./packages/std" }
layer-storage = { path = "./packages/storage" }
layer-abci = { path = "./packages/comet/abci" }
layer-app = { path = "./packages/layer" }
layer-cosmos = { path = "./packages/cosmossdk/cosmos" }
layer-golem = { path = "./packages/cosmossdk/golem" }
layer-proto = { path = "./packages/cosmossdk/proto" }
layer-std = { path = "./packages/core/std" }
layer-storage = { path = "./packages/core/storage" }

layer-root = { path = "./contracts/root" }
tc-echo = { path = "./contracts/echo" }
Expand Down
4 changes: 2 additions & 2 deletions app/slay3rd/Cargo.toml → app/layerd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "slay3rd"
description = "Rust ABCI app to run slay3r with CometBFT 0.38"
name = "layerd"
description = "Rust ABCI app to run layer with CometBFT 0.38"
version = { workspace = true }
license = { workspace = true }
edition = { workspace = true }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/slay3rd/src/main.rs → app/layerd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async fn run_server<T: PersistentStorage + 'static + Send + Sync>(

let grpc_reflection = tonic_reflection::server::Builder::configure()
.register_encoded_file_descriptor_set(include_bytes!(
"../../../packages/proto/src/protos/service_descriptor.bin"
"../../../packages/cosmossdk/proto/src/protos/service_descriptor.bin"
))
.build_v1()
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile.gateway
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

FROM golang:1.22-bookworm AS build-env

COPY ./gateway /src/gateway
COPY ./packages/cosmossdk/tools/gateway /src/gateway
ENV CGO_ENABLED=0
RUN cd /src/gateway && go build -o /app

Expand Down
56 changes: 56 additions & 0 deletions docker/Dockerfile.layerd
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# docker build . -f docker/Dockerfile.slay3rd -t ghcr.io/lay3rlabs/slay3rd:latest
# docker run --rm -it ghcr.io/lay3rlabs//slay3rd:latest /bin/bash

### BUILDING

FROM rust:1.80-bookworm AS builder
WORKDIR /myapp

RUN apt update && apt install -y clang

# This whole pile will pre-build and cache the dependencies, so we just recompile local code below
COPY Cargo.lock Cargo.toml /myapp/
COPY app/layerd/Cargo.toml /myapp/app/layerd/Cargo.toml
COPY dummy.rs /myapp/app/layerd/src/main.rs
COPY contracts/caller/Cargo.toml /myapp/contracts/caller/Cargo.toml
COPY dummy.rs /myapp/contracts/caller/src/lib.rs
COPY contracts/echo/Cargo.toml /myapp/contracts/echo/Cargo.toml
COPY dummy.rs /myapp/contracts/echo/src/lib.rs
COPY contracts/root/Cargo.toml /myapp/contracts/root/Cargo.toml
COPY dummy.rs /myapp/contracts/root/src/lib.rs
COPY packages/comet/abci/Cargo.toml /myapp/packages/comet/abci/Cargo.toml
COPY dummy.rs /myapp/packages/comet/abci/src/lib.rs
COPY packages/layer/Cargo.toml /myapp/packages/layer/Cargo.toml
COPY dummy.rs /myapp/packages/layer/src/lib.rs
COPY packages/cosmossdk/cosmos/Cargo.toml /myapp/packages/cosmossdk/cosmos/Cargo.toml
COPY dummy.rs /myapp/packages/cosmossdk/cosmos/src/lib.rs
COPY packages/cosmossdk/golem/Cargo.toml /myapp/packages/cosmossdk/golem/Cargo.toml
COPY dummy.rs /myapp/packages/cosmossdk/golem/src/lib.rs
COPY packages/cosmossdk/proto/Cargo.toml /myapp/packages/cosmossdk/proto/Cargo.toml
COPY dummy.rs /myapp/packages/cosmossdk/proto/src/lib.rs
COPY dummy.rs /myapp/packages/cosmossdk/proto/examples/sync_test.rs
COPY packages/core/std/Cargo.toml /myapp/packages/core/std/Cargo.toml
COPY dummy.rs /myapp/packages/core/std/src/lib.rs
COPY packages/core/storage/Cargo.toml /myapp/packages/core/storage/Cargo.toml
COPY dummy.rs /myapp/packages/core/storage/src/lib.rs
RUN cargo build --release --bin layerd

# clean up these fake local deps so we compile for real later
RUN rm /myapp/*/*/src/*.rs
RUN rm -rf target/release/.fingerprint/layer-*

# This build step should just compile the local code and be faster
COPY . .
RUN cargo build --release --bin layerd

### PRODUCTION

# Now, pack up that binary in a nice small image
FROM debian:bookworm-slim
RUN apt-get update && apt-get upgrade -y
RUN apt install -y libcurl4 wget
COPY --from=builder /myapp/target/release/layerd /usr/local/bin/layerd
# COPY --from=builder /myapp/Cargo.toml /usr/local/bin/layerd
EXPOSE 26658
CMD ["layerd"]

56 changes: 0 additions & 56 deletions docker/Dockerfile.slay3rd

This file was deleted.

46 changes: 22 additions & 24 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,40 +69,38 @@ flowchart TD

Applications (under `app/` directory):

* [`slay3rd`](./app/slay3rd) - this is the binary executable for an ABCI++ application that connects with CometBFT to form a blockchain node.

Packages (under `packages/` directory):

* [`abci`](./packages/abci) - App-generic code to run a high-performance ABCI server (to connect to CometBFT). This was based on [Tendermint ABCI](https://github.com/informalsystems/tendermint-rs/tree/main/abci), but with changes made to increase performance and concurrency.
* [`app`](./packages/app) - This is the main business logic of the blockchain. It handles the calls from the `abci` server to process transactions and queries. It has a few core modules built-in:
* [`auth`](./packages/app/src/auth)
* [`bank`](./packages/app/src/bank)
* [`wasm`](./packages/app/src/wasm)
* ^^[`cosmos`](./packages/cosmos) - Code to translate custom cosmos types and transactions to our internal format. Makes heavy use of the [`proto`](./packages/proto) package to provide the Cosmos types.
* ^^[`proto`](./packages/proto) - [Prost](https://crates.io/crates/prost) codegen of the Cosmos SDK types. Unfortunately, we could not use the types from [`cosmos-rust`](https://github.com/cosmos/cosmos-rust) as those don't support the types for our gRPC server (they were designed for clients)
* [`std`](./packages/std) - All the standard types we use throughout our system. This should import no other crate of ours and be imported by almost all the others.
* [`storage`](./packages/storage) - This is a port of the types from [`cw-storage-plus`](https://github.com/CosmWasm/cw-storage-plus) to work with our storage interfaces (which include gas metering). It allows use of type-safe `Item` and `Map` throughout the native modules in the [`app`](./packages/app) package.

Other APIs:

* ^^[`gateway`](./gateway) - This is [`grpc-gateway`](https://github.com/grpc-ecosystem/grpc-gateway) codegen API to provide a reverse proxy of HTTP/JSON types to the internal gRPC server. This performs the functionality of the "LCD" server in the Cosmos SDK.
* ^^[`proto`](./proto) (top-level, not `packages/proto`) - standard Cosmos protobuf types that we use for compatibility. These were copied from the upstream repos, but all the custom gogoproto and sdkproto directives removed to make them standard `.proto` files we can use in Rust.
* [`layerd`](./app/layerd) - this is the binary executable for an ABCI++ application that connects with CometBFT to form a blockchain node.

Packages (under `packages/` directory), grouped by scope:

* `comet`
* [`abci`](./packages/comet/abci) - App-generic code to run a high-performance ABCI server (to connect to CometBFT). This was based on [Tendermint ABCI](https://github.com/informalsystems/tendermint-rs/tree/main/abci), but with changes made to increase performance and concurrency.
* `cosmossdk`
* [`cosmos`](./packages/cosmossdk/cosmos) - Code to translate custom cosmos types and transactions to our internal format. Makes heavy use of the [`proto`](./packages/proto) package to provide the Cosmos types.
* [`golem`](./packages/cosmossdk/golem) - Equivalent of Osmosis' Test Tube. This allows inline tests with the full stack.
* [`proto`](./packages/cosmossdk/proto) - [Prost](https://crates.io/crates/prost) codegen of the Cosmos SDK types. Unfortunately, we could not use the types from [`cosmos-rust`](https://github.com/cosmos/cosmos-rust) as those don't support the types for our gRPC server. Created by `proto-compiler`.
* `tools`
* [`protospec`](./packages/cosmossdk/tools/protospec) - standard Cosmos protobuf types that we use for compatibility. These were copied from the upstream repos, but all the custom gogoproto and sdkproto directives removed to make them standard `.proto` files we can use in Rust.
* [`proto-compiler`](./packages/cosmossdk/tools/proto-compiler) - Simple script to compile the files in `protospec` into custom Rust types for our server. Outputs into `proto`.
* [`gateway`](./packages/cosmossdk/tools/protospec) - This is [`grpc-gateway`](https://github.com/grpc-ecosystem/grpc-gateway) codegen API to provide a reverse proxy of HTTP/JSON types to the internal gRPC server. This performs the functionality of the "LCD" server in the Cosmos SDK.
* `core`
* [`std`](./packages/core/std) - All the standard types we use throughout our system. This should import no other crate of ours and be imported by almost all the others.
* [`storage`](./packages/core/storage) - This is a port of the types from [`cw-storage-plus`](https://github.com/CosmWasm/cw-storage-plus) to work with our storage interfaces (which include gas metering). It allows use of type-safe `Item` and `Map` throughout the native modules in the [`app`](./packages/core/app) package. (TODO: move plus stuff to utils, keep core storage types here)
* [`layer`](./packages/layer) - This is the main business logic of the Layer blockchain. It handles the calls from the `abci` server to process transactions and queries. You could swap out a completely different state machine here, while still making use of all the other server and compatibility crates. It has a few core modules built-in:
* [`auth`](./packages/layer/src/auth)
* [`bank`](./packages/layer/src/bank)
* [`wasm`](./packages/layer/src/wasm)

Testing:

* [`contracts`](./contracts) - Provides a couple CosmWasm contracts, which we use in integration testing to ensure we properly implement the CosmWasm APIs. They are not meant for any useful purpose, just for internal testing. The contracts for the chain launch (staking, governance, etc) will be in a separate repo.
* [`artifacts`](./artifacts) - Contains pre-built `*.wasm` files from the above contracts, created by `scripts/build_contracts.sh`
* [`fixtures`](./packages/app/fixtures) - Contains our custom contracts, as well as some standard ones from the CosmWasm ecosystem, which we use in testing our blockchain implementation, specifically [the wasm module](./packages/app/src/wasm).
* [`integration`](./integration) - CosmJS based integration tests that provide full-stack test of our compatibility with the Cosmos ecosystem tooling. This is essential to ensure our transaction signature verification is compatible, and covers any Tendermint RPC queries.
* [`js`](./js) - CosmJS based integration tests that provide full-stack test of our compatibility with the Cosmos ecosystem tooling. This is essential to ensure our transaction signature verification is compatible, and covers any Tendermint RPC queries.

Tooling:

* [`docker`](./docker) - Docker files to containerize the various applications in our stack. These are used by [`docker-compose.yml`](./docker-compose.yml) to launch a local network for testing
* [`scripts`](./scripts) - Various bash scripts to build various parts of the system, and others needed to run a local network for testing
* [`tools`](./tools) - Rust code that doesn't belong in our packages, but rather part of our build system. Currently only [`proto-compiler`](./tools/proto-compiler), which uses Prost to build `packages/proto` from the definitions in `proto`
* [CometBFT](https://github.com/cometbft/cometbft) - External: the consensus engine we use to drive the `slayerd` process. Imported as a docker image from external repo.
* [Jaeger](https://www.jaegertracing.io) - External: the tracing system to display default metrics on all API calls on a node. Imported as a docker image from external repo.

## TODO

* Reorganize packages to make it clear which are cosmos compatibility and which are "core". I marked cosmos packages with `^^`
Binary file removed img/pulsarium.png
Binary file not shown.
Loading