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

feat: Apply our Rust builder for wasm-preview-adapter crates #58

Merged
merged 42 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f803425
update wasm building process
Mr-Leshiy Jan 8, 2024
810e3dc
fix some check issues
Mr-Leshiy Jan 10, 2024
9fea458
fix byte-array-literals lints
Mr-Leshiy Jan 10, 2024
6bdeadb
fix build script lints
Mr-Leshiy Jan 10, 2024
5f9efd6
fix fmt
Mr-Leshiy Jan 10, 2024
41bd03a
fix lints
Mr-Leshiy Jan 11, 2024
b5bf594
add licensing
Mr-Leshiy Jan 11, 2024
6744072
remove verify crate
Mr-Leshiy Jan 11, 2024
a8c01ff
move byte-array-literals to another dir
Mr-Leshiy Jan 11, 2024
04a75ec
update
Mr-Leshiy Jan 12, 2024
f1375c8
fix
Mr-Leshiy Jan 12, 2024
fde0c9a
update hermes Earthfile
Mr-Leshiy Jan 15, 2024
c464455
update version
Mr-Leshiy Jan 18, 2024
b1f159c
fix
Mr-Leshiy Jan 18, 2024
7bfbe62
fix
Mr-Leshiy Jan 18, 2024
0a30d4e
add Readme
Mr-Leshiy Jan 18, 2024
8b7181c
fix README.md
Mr-Leshiy Jan 18, 2024
8406de4
Merge branch 'main' into feat/wasm-api
Mr-Leshiy Jan 18, 2024
d839f4a
fix
Mr-Leshiy Jan 18, 2024
45e0fb1
update build
Mr-Leshiy Jan 21, 2024
ae73d53
disable benches
Mr-Leshiy Jan 21, 2024
ae88212
wip
Mr-Leshiy Jan 23, 2024
4359e92
wip
Mr-Leshiy Jan 23, 2024
4e08f2e
update rust-toolchain files
Mr-Leshiy Jan 23, 2024
4d2f788
Merge branch 'main' into feat/wasm-api
Mr-Leshiy Jan 23, 2024
6ae27cd
update Readme
Mr-Leshiy Jan 23, 2024
78646b7
wip
Mr-Leshiy Jan 23, 2024
71da83f
remove Cargo.lock
Mr-Leshiy Jan 23, 2024
5b314c5
fix lints
Mr-Leshiy Jan 23, 2024
a10b4a9
fix spelling
Mr-Leshiy Jan 23, 2024
26e7429
wip
Mr-Leshiy Jan 23, 2024
a0c08cb
update readme
Mr-Leshiy Jan 24, 2024
147e963
rename dir
Mr-Leshiy Jan 24, 2024
5f92b76
rebuild wasi-preview1-component-adapter project structure
Mr-Leshiy Jan 24, 2024
af5f8c9
fix vs recommended file
Mr-Leshiy Jan 24, 2024
02946e6
update
Mr-Leshiy Jan 24, 2024
4b8eb86
fix linting
Mr-Leshiy Jan 24, 2024
b383cbe
Merge branch 'main' into feat/wasm-api
Mr-Leshiy Jan 24, 2024
88bfcab
move wasi-preview-component-adapter from hermes dir to the root
Mr-Leshiy Jan 25, 2024
a99bf66
update APACHE license
Mr-Leshiy Jan 25, 2024
4c7ce00
wip
Mr-Leshiy Jan 25, 2024
cc263ef
refactor(wasm): Refactor wasm component adapter and wasi/wit code (#72)
stevenj Jan 30, 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
16 changes: 16 additions & 0 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CEST
chainsync
chrono
ciphertext
codegen
codepoints
coti
cryptoxide
Expand All @@ -25,12 +26,15 @@ drep
dreps
encryptor
excalidraw
fmtchk
fmtfix
fontawesome
fsgr
genhtml
gmtime
hardano
ideascale
idents
Intellij
iohk
jetbrains
Expand All @@ -40,6 +44,7 @@ Jörmungandr
kroki
lcov
Leshiy
lintfix
localizable
mdlint
miniprotocols
Expand All @@ -49,9 +54,11 @@ moderations
multiera
nanos
netkey
nextest
oneshot
openapi
opentelemetry
permissioned
permissionless
pg_isready
plpgsql
Expand All @@ -62,15 +69,24 @@ pubspec
rapidoc
redoc
rustc
rustdoc
rustdocflags
rustflags
saibatizoku
seckey
slotno
stevenj
tacho
testcov
testdocs
testunit
thiserror
timelike
toolsets
Traceback
vitss
voteplan
voteplans
WASI
webasm
yoroi
3 changes: 2 additions & 1 deletion .vscode/settings.recommended.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"Earthfile": "earthfile"
},
"rust-analyzer.linkedProjects": [
"./hermes/bin/Cargo.toml"
"./hermes/Cargo.toml",
"./wasm/wasi-hermes-component-adapter/Cargo.toml"
],
"rust-analyzer.check.overrideCommand": [
"bash",
Expand Down
13 changes: 12 additions & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,18 @@ markdown-check-fix:
# check-spelling Check spelling in this repo inside a container.
check-spelling:
DO github.com/input-output-hk/catalyst-ci/earthly/cspell:v2.0.10+CHECK


# check-spelling Check spelling in this repo inside a container.
spell-list-words:
FROM ghcr.io/streetsidesoftware/cspell:8.0.0
WORKDIR /work

COPY . .

RUN cspell-cli --words-only --unique "wasm/**" | sort -f



repo-docs:
# Create artifacts of extra files we embed inside the documentation when its built.
FROM scratch
Expand Down
3 changes: 1 addition & 2 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@
"*.excalidraw",
".vscode/**",
"**/.idea/**",
"hermes/wasm/*/**",
"hermes/crates/cardano-chain-follower/examples/snapshot_data"
]
}
}
61 changes: 11 additions & 50 deletions hermes/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Use MOLD linker where possible, but ONLY in CI applicable targets.
# cspell: words rustflags armv gnueabihf msvc nextest idents rustdocflags
# cspell: words rustdoc lintfix lintrestrict testfast testdocs codegen testci testunit
# cspell: words fmtchk fmtfix testcov

# Configure how Docker container targets build.

# If you want to customize these targets for a local build, then customize them in you:
# If you want to customize these targets for a local build, then customize them in your:
# $CARGO_HOME/config.toml
# NOT in the project itself.
# These targets are ONLY the targets used by CI and inside docker builds.
Expand All @@ -28,48 +25,12 @@ rustflags = [
"-C", "target-feature=-crt-static"
]

[target.wasm32-unknown-unknown]
rustflags = ["--cap-lints", "warn"]

[build]

rustflags = [
"-D",
"warnings",
"-D",
"missing_docs",
"-D",
"let_underscore_drop",
"-D",
"non_ascii_idents",
"-D",
"single_use_lifetimes",
"-D",
"trivial_casts",
"-D",
"trivial_numeric_casts",
]

rustflags = []
rustdocflags = [
"--enable-index-page",
"-Z",
"unstable-options",
"-D",
"warnings",
"-D",
"missing_docs",
"-D",
"rustdoc::broken_intra_doc_links",
"-D",
"rustdoc::invalid_codeblock_attributes",
"-D",
"rustdoc::invalid_html_tags",
"-D",
"rustdoc::invalid_rust_codeblocks",
"-D",
"rustdoc::bare_urls",
"-D",
"rustdoc::unescaped_backticks",
]

[profile.dev]
Expand All @@ -78,7 +39,7 @@ debug = true
debug-assertions = true
overflow-checks = true
lto = false
panic = 'unwind'
panic = "unwind"
incremental = true
codegen-units = 256

Expand All @@ -88,7 +49,7 @@ debug = false
debug-assertions = false
overflow-checks = false
lto = "thin"
panic = 'unwind'
panic = "unwind"
incremental = false
codegen-units = 16

Expand All @@ -110,14 +71,14 @@ incremental = false
codegen-units = 16

[alias]
lint = "clippy --all-targets -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable -D clippy::missing_docs_in_private_items"
lintfix = "clippy --all-targets --fix --allow-dirty -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable -D clippy::missing_docs_in_private_items"
lint-vscode = "clippy --message-format=json-diagnostic-rendered-ansi --all-targets -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable -D clippy::missing_docs_in_private_items"
lint = "clippy --all-targets"
lintfix = "clippy --all-targets --fix --allow-dirty"
lint-vscode = "clippy --message-format=json-diagnostic-rendered-ansi --all-targets"

docs = "doc --release --no-deps --document-private-items --bins --lib --examples"
# nightly docs build broken... when they are'nt we can enable these docs... --unit-graph --timings=html,json -Z unstable-options"
testunit = "nextest run --release --bins --lib -P ci"
testcov = "llvm-cov nextest --release --bins --lib -P ci"
testunit = "nextest run --release --bins --lib --tests --benches --no-fail-fast -P ci"
testcov = "llvm-cov nextest --release --bins --lib --tests --benches --no-fail-fast -P ci"
testdocs = "test --doc --release"

# Rust formatting, MUST be run with +nightly
Expand All @@ -127,6 +88,6 @@ fmtfix = "fmt -- -v"
[term]
quiet = false # whether cargo output is quiet
verbose = false # whether cargo provides verbose output
color = 'auto' # whether cargo colorizes output use `CARGO_TERM_COLOR="off"` to disable.
progress.when = 'never' # whether cargo shows progress bar
color = "auto" # whether cargo colorizes output use `CARGO_TERM_COLOR="off"` to disable.
progress.when = "never" # whether cargo shows progress bar
progress.width = 80 # width of progress bar
2 changes: 1 addition & 1 deletion hermes/.config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cspell: words nextest scrollability testcase
# cspell: words scrollability testcase
[store]
# The directory under the workspace root at which nextest-related files are
# written. Profile-specific storage is currently written to dir/<profile-name>.
Expand Down
34 changes: 34 additions & 0 deletions hermes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,40 @@ homepage = "https://input-output-hk.github.io/hermes"
repository = "https://github.com/input-output-hk/hermes"
license = "MIT OR Apache-2.0"

[workspace.lints.rust]
warnings = "deny"
missing_docs = "deny"
let_underscore_drop = "deny"
non_ascii_idents = "deny"
single_use_lifetimes = "deny"
trivial_casts = "deny"
trivial_numeric_casts = "deny"

[workspace.lints.rustdoc]
broken_intra_doc_links = "deny"
invalid_codeblock_attributes = "deny"
invalid_html_tags = "deny"
invalid_rust_codeblocks = "deny"
bare_urls = "deny"
unescaped_backticks = "deny"

[workspace.lints.clippy]
pedantic = "deny"
unwrap_used = "deny"
expect_used = "deny"
exit = "deny"
get_unwrap = "deny"
index_refutable_slice = "deny"
indexing_slicing = "deny"
match_on_vec_items = "deny"
match_wild_err_arm = "deny"
missing_panics_doc = "deny"
panic = "deny"
string_slice = "deny"
unchecked_duration_subtraction = "deny"
unreachable = "deny"
missing_docs_in_private_items = "deny"

[workspace.dependencies]
# Stop using catalyst-pallas once pallas changes are merged.
# issue: https://github.com/input-output-hk/hermes/issues/63
Expand Down
14 changes: 6 additions & 8 deletions hermes/Earthfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
VERSION 0.7

#cspell: words rustfmt toolsets USERARCH
#cspell: words rustfmt

# Set up our target toolchains, and copy our files.
builder:
FROM github.com/input-output-hk/catalyst-ci/earthly/rust:v2.4.0+rust-base
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.6.0+SETUP

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.4.0+SETUP

COPY --dir .cargo .config Cargo.* clippy.toml deny.toml rustfmt.toml bin crates .
COPY --dir .cargo .config crates bin .
COPY Cargo.toml .
COPY clippy.toml deny.toml rustfmt.toml .

## -----------------------------------------------------------------------------
##
Expand All @@ -33,9 +33,7 @@ all-hosts-check:
build:
FROM +builder

RUN /scripts/std_build.py --with_test \
--with_bench \
--libs="cardano-chain-follower" \
RUN /scripts/std_build.py --libs="cardano-chain-follower" \
--bins="hermes/hermes"

SAVE ARTIFACT target/$TARGETARCH/doc doc
Expand Down
21 changes: 21 additions & 0 deletions hermes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- cspell: words indexmap -->

# Hermes core
Mr-Leshiy marked this conversation as resolved.
Show resolved Hide resolved

An implementation of the Hermes core engine in Rust

* [Hermes core](#hermes-core)
* [Build notes](#build-notes)

## Build notes

During the build process, you may encounter specific known issues:
[tower/issues/466](https://github.com/tower-rs/tower/issues/466)
and [indexmap/issues/151](https://github.com/indexmap-rs/indexmap/issues/151).
These issues can impede the build's success.
We recommend explicitly setting the environment variable `CARGO_FEATURE_STD=1` as a temporary solution.
This workaround has effectively bypassed the mentioned problems until a permanent fix is implemented.

```shell
CARGO_FEATURE_STD=1 cargo b
```
3 changes: 3 additions & 0 deletions hermes/bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions hermes/crates/cardano-chain-follower/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ homepage.workspace = true
repository.workspace = true
license.workspace = true

[lints]
workspace = true

[dependencies]
pallas.workspace = true
pallas-hardano.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion hermes/deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,4 @@ allow-git = [
# 1 or more gitlab.com organizations to allow git sources for
#gitlab = [""]
# 1 or more bitbucket.org organizations to allow git sources for
#bitbucket = [""]
#bitbucket = [""]
3 changes: 1 addition & 2 deletions hermes/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[toolchain]
channel = "1.73.0"
channel = "1.75.0"
profile = "default"
components = []
targets = ["x86_64-unknown-linux-musl"]
5 changes: 0 additions & 5 deletions hermes/wasm/.cargo/config.toml

This file was deleted.

35 changes: 0 additions & 35 deletions hermes/wasm/Cargo.toml

This file was deleted.

Loading
Loading