Skip to content

Commit 6b8f26a

Browse files
Mr-Leshiystevenj
andauthored
feat: Apply our Rust builder for wasm-preview-adapter crates (#58)
* update wasm building process * fix some check issues * fix byte-array-literals lints * fix build script lints * fix fmt * fix lints * add licensing * remove verify crate * move byte-array-literals to another dir * update * fix * update hermes Earthfile * update version * fix * fix * add Readme * fix README.md * fix * update build * disable benches * wip * wip * update rust-toolchain files * update Readme * wip * remove Cargo.lock * fix lints * fix spelling * wip * update readme * rename dir * rebuild wasi-preview1-component-adapter project structure * fix vs recommended file * update * fix linting * move wasi-preview-component-adapter from hermes dir to the root * update APACHE license * wip * refactor(wasm): Refactor wasm component adapter and wasi/wit code (#72) * refactor(wasm): Refactor wasm component adapter and wasi/wit code * fix(wasm): Fix code format * fix(wasm): Update standard WASI .wit files to latest version * fix(wasm): Cleanup WASM wit definitions and remove things not compatible with Hermes. * fix(wasm): Fix code format * fix(spelling): Fix spelling check for wasm code * feat(spelling): Add target to help build words lists * fix(wasm): Fix code format * fix(wasm): Use relative path to wit files so we don;t need symlink * feat(wasm): Rewrite cron module and introduce basic hermes modules. Others need re-writing * fix(spelling): Fix spellcheck errors --------- Co-authored-by: Steven Johnson <[email protected]>
1 parent 5ceca8c commit 6b8f26a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2309
-1200
lines changed

.config/dictionaries/project.dic

+16
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CEST
1212
chainsync
1313
chrono
1414
ciphertext
15+
codegen
1516
codepoints
1617
coti
1718
cryptoxide
@@ -25,12 +26,15 @@ drep
2526
dreps
2627
encryptor
2728
excalidraw
29+
fmtchk
30+
fmtfix
2831
fontawesome
2932
fsgr
3033
genhtml
3134
gmtime
3235
hardano
3336
ideascale
37+
idents
3438
Intellij
3539
iohk
3640
jetbrains
@@ -40,6 +44,7 @@ Jörmungandr
4044
kroki
4145
lcov
4246
Leshiy
47+
lintfix
4348
localizable
4449
mdlint
4550
miniprotocols
@@ -49,9 +54,11 @@ moderations
4954
multiera
5055
nanos
5156
netkey
57+
nextest
5258
oneshot
5359
openapi
5460
opentelemetry
61+
permissioned
5562
permissionless
5663
pg_isready
5764
plpgsql
@@ -62,15 +69,24 @@ pubspec
6269
rapidoc
6370
redoc
6471
rustc
72+
rustdoc
73+
rustdocflags
74+
rustflags
6575
saibatizoku
6676
seckey
6777
slotno
6878
stevenj
6979
tacho
80+
testcov
81+
testdocs
82+
testunit
7083
thiserror
7184
timelike
85+
toolsets
7286
Traceback
7387
vitss
7488
voteplan
7589
voteplans
90+
WASI
91+
webasm
7692
yoroi

.vscode/settings.recommended.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"Earthfile": "earthfile"
5454
},
5555
"rust-analyzer.linkedProjects": [
56-
"./hermes/bin/Cargo.toml"
56+
"./hermes/Cargo.toml",
57+
"./wasm/wasi-hermes-component-adapter/Cargo.toml"
5758
],
5859
"rust-analyzer.check.overrideCommand": [
5960
"bash",

Earthfile

+12-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,18 @@ markdown-check-fix:
1818
# check-spelling Check spelling in this repo inside a container.
1919
check-spelling:
2020
DO github.com/input-output-hk/catalyst-ci/earthly/cspell:v2.0.10+CHECK
21-
21+
22+
# check-spelling Check spelling in this repo inside a container.
23+
spell-list-words:
24+
FROM ghcr.io/streetsidesoftware/cspell:8.0.0
25+
WORKDIR /work
26+
27+
COPY . .
28+
29+
RUN cspell-cli --words-only --unique "wasm/**" | sort -f
30+
31+
32+
2233
repo-docs:
2334
# Create artifacts of extra files we embed inside the documentation when its built.
2435
FROM scratch

cspell.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@
227227
"*.excalidraw",
228228
".vscode/**",
229229
"**/.idea/**",
230-
"hermes/wasm/*/**",
231230
"hermes/crates/cardano-chain-follower/examples/snapshot_data"
232231
]
233-
}
232+
}

hermes/.cargo/config.toml

+11-50
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
# Use MOLD linker where possible, but ONLY in CI applicable targets.
2-
# cspell: words rustflags armv gnueabihf msvc nextest idents rustdocflags
3-
# cspell: words rustdoc lintfix lintrestrict testfast testdocs codegen testci testunit
4-
# cspell: words fmtchk fmtfix testcov
52

63
# Configure how Docker container targets build.
74

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

31-
[target.wasm32-unknown-unknown]
32-
rustflags = ["--cap-lints", "warn"]
33-
3428
[build]
35-
36-
rustflags = [
37-
"-D",
38-
"warnings",
39-
"-D",
40-
"missing_docs",
41-
"-D",
42-
"let_underscore_drop",
43-
"-D",
44-
"non_ascii_idents",
45-
"-D",
46-
"single_use_lifetimes",
47-
"-D",
48-
"trivial_casts",
49-
"-D",
50-
"trivial_numeric_casts",
51-
]
52-
29+
rustflags = []
5330
rustdocflags = [
5431
"--enable-index-page",
5532
"-Z",
5633
"unstable-options",
57-
"-D",
58-
"warnings",
59-
"-D",
60-
"missing_docs",
61-
"-D",
62-
"rustdoc::broken_intra_doc_links",
63-
"-D",
64-
"rustdoc::invalid_codeblock_attributes",
65-
"-D",
66-
"rustdoc::invalid_html_tags",
67-
"-D",
68-
"rustdoc::invalid_rust_codeblocks",
69-
"-D",
70-
"rustdoc::bare_urls",
71-
"-D",
72-
"rustdoc::unescaped_backticks",
7334
]
7435

7536
[profile.dev]
@@ -78,7 +39,7 @@ debug = true
7839
debug-assertions = true
7940
overflow-checks = true
8041
lto = false
81-
panic = 'unwind'
42+
panic = "unwind"
8243
incremental = true
8344
codegen-units = 256
8445

@@ -88,7 +49,7 @@ debug = false
8849
debug-assertions = false
8950
overflow-checks = false
9051
lto = "thin"
91-
panic = 'unwind'
52+
panic = "unwind"
9253
incremental = false
9354
codegen-units = 16
9455

@@ -110,14 +71,14 @@ incremental = false
11071
codegen-units = 16
11172

11273
[alias]
113-
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"
114-
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"
115-
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"
74+
lint = "clippy --all-targets"
75+
lintfix = "clippy --all-targets --fix --allow-dirty"
76+
lint-vscode = "clippy --message-format=json-diagnostic-rendered-ansi --all-targets"
11677

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

12384
# Rust formatting, MUST be run with +nightly
@@ -127,6 +88,6 @@ fmtfix = "fmt -- -v"
12788
[term]
12889
quiet = false # whether cargo output is quiet
12990
verbose = false # whether cargo provides verbose output
130-
color = 'auto' # whether cargo colorizes output use `CARGO_TERM_COLOR="off"` to disable.
131-
progress.when = 'never' # whether cargo shows progress bar
91+
color = "auto" # whether cargo colorizes output use `CARGO_TERM_COLOR="off"` to disable.
92+
progress.when = "never" # whether cargo shows progress bar
13293
progress.width = 80 # width of progress bar

hermes/.config/nextest.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# cspell: words nextest scrollability testcase
1+
# cspell: words scrollability testcase
22
[store]
33
# The directory under the workspace root at which nextest-related files are
44
# written. Profile-specific storage is currently written to dir/<profile-name>.

hermes/Cargo.toml

+34
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,40 @@ homepage = "https://input-output-hk.github.io/hermes"
1616
repository = "https://github.com/input-output-hk/hermes"
1717
license = "MIT OR Apache-2.0"
1818

19+
[workspace.lints.rust]
20+
warnings = "deny"
21+
missing_docs = "deny"
22+
let_underscore_drop = "deny"
23+
non_ascii_idents = "deny"
24+
single_use_lifetimes = "deny"
25+
trivial_casts = "deny"
26+
trivial_numeric_casts = "deny"
27+
28+
[workspace.lints.rustdoc]
29+
broken_intra_doc_links = "deny"
30+
invalid_codeblock_attributes = "deny"
31+
invalid_html_tags = "deny"
32+
invalid_rust_codeblocks = "deny"
33+
bare_urls = "deny"
34+
unescaped_backticks = "deny"
35+
36+
[workspace.lints.clippy]
37+
pedantic = "deny"
38+
unwrap_used = "deny"
39+
expect_used = "deny"
40+
exit = "deny"
41+
get_unwrap = "deny"
42+
index_refutable_slice = "deny"
43+
indexing_slicing = "deny"
44+
match_on_vec_items = "deny"
45+
match_wild_err_arm = "deny"
46+
missing_panics_doc = "deny"
47+
panic = "deny"
48+
string_slice = "deny"
49+
unchecked_duration_subtraction = "deny"
50+
unreachable = "deny"
51+
missing_docs_in_private_items = "deny"
52+
1953
[workspace.dependencies]
2054
# Stop using catalyst-pallas once pallas changes are merged.
2155
# issue: https://github.com/input-output-hk/hermes/issues/63

hermes/Earthfile

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
VERSION 0.7
22

3-
#cspell: words rustfmt toolsets USERARCH
3+
#cspell: words rustfmt
44

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

9-
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.4.0+SETUP
10-
11-
COPY --dir .cargo .config Cargo.* clippy.toml deny.toml rustfmt.toml bin crates .
9+
COPY --dir .cargo .config crates bin .
10+
COPY Cargo.toml .
11+
COPY clippy.toml deny.toml rustfmt.toml .
1212

1313
## -----------------------------------------------------------------------------
1414
##
@@ -33,9 +33,7 @@ all-hosts-check:
3333
build:
3434
FROM +builder
3535

36-
RUN /scripts/std_build.py --with_test \
37-
--with_bench \
38-
--libs="cardano-chain-follower" \
36+
RUN /scripts/std_build.py --libs="cardano-chain-follower" \
3937
--bins="hermes/hermes"
4038

4139
SAVE ARTIFACT target/$TARGETARCH/doc doc

hermes/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!-- cspell: words indexmap -->
2+
3+
# Hermes core
4+
5+
An implementation of the Hermes core engine in Rust
6+
7+
* [Hermes core](#hermes-core)
8+
* [Build notes](#build-notes)
9+
10+
## Build notes
11+
12+
During the build process, you may encounter specific known issues:
13+
[tower/issues/466](https://github.com/tower-rs/tower/issues/466)
14+
and [indexmap/issues/151](https://github.com/indexmap-rs/indexmap/issues/151).
15+
These issues can impede the build's success.
16+
We recommend explicitly setting the environment variable `CARGO_FEATURE_STD=1` as a temporary solution.
17+
This workaround has effectively bypassed the mentioned problems until a permanent fix is implemented.
18+
19+
```shell
20+
CARGO_FEATURE_STD=1 cargo b
21+
```

hermes/bin/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ authors.workspace = true
88
edition.workspace = true
99
license.workspace = true
1010
repository.workspace = true
11+
12+
[lints]
13+
workspace = true

hermes/crates/cardano-chain-follower/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ homepage.workspace = true
88
repository.workspace = true
99
license.workspace = true
1010

11+
[lints]
12+
workspace = true
13+
1114
[dependencies]
1215
pallas.workspace = true
1316
pallas-hardano.workspace = true

hermes/deny.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,4 +279,4 @@ allow-git = [
279279
# 1 or more gitlab.com organizations to allow git sources for
280280
#gitlab = [""]
281281
# 1 or more bitbucket.org organizations to allow git sources for
282-
#bitbucket = [""]
282+
#bitbucket = [""]

hermes/rust-toolchain.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[toolchain]
2-
channel = "1.73.0"
2+
channel = "1.75.0"
33
profile = "default"
4-
components = []
54
targets = ["x86_64-unknown-linux-musl"]

hermes/wasm/.cargo/config.toml

-5
This file was deleted.

hermes/wasm/Cargo.toml

-35
This file was deleted.

0 commit comments

Comments
 (0)