Commit Graph

2515 Commits

Author SHA1 Message Date
Luke Parker
af085ba9c1 Remove head -c for cut, as head -c is not POSIX-compliant
`tail -c` is however. Since we used `head -c-`, to cut off characters from the
end, the POSIX-compliant `wc -c` is used for a `strlen` we can proceed to do
the necessary arithmetic off of.

Credit to @PlasmaPower for identifying this non-compliant behavior which
necessitated this fix in response.
2025-12-09 00:31:09 -05:00
Luke Parker
d881421e7e Extend debugging when comparing SHA-256 hashes 2025-12-09 00:06:06 -05:00
Luke Parker
48914aad0a Once again fix read_stack 2025-12-08 23:58:18 -05:00
Luke Parker
7d6bac9ab4 yash, brush shells 2025-12-08 23:52:36 -05:00
Luke Parker
dcb8cbad0d Correct read_stack function 2025-12-08 23:38:42 -05:00
Luke Parker
8ad88dce9a Remove non-POSIX tcsh from list of shells 2025-12-08 23:30:51 -05:00
Luke Parker
63133ae530 Call the shells via a sh symlink to trigger their POSIX-compliant behavior (if special-cased based on how the shell was invoked) 2025-12-08 23:22:55 -05:00
Luke Parker
1ab1cad7c5 Correct order symlinks are created in 2025-12-08 22:59:42 -05:00
Luke Parker
8a5cce2ce8 Use symlinks for ash, add hush 2025-12-08 22:57:56 -05:00
Luke Parker
ec0347a73e Alias ash since the busybox package on Ubuntu doesn't provide such a symlink 2025-12-08 22:52:43 -05:00
Luke Parker
6d2a496054 Prune output of sha256sum to the hash alone
This causes the equality not to fail simply because the file names are
different.
2025-12-08 22:50:12 -05:00
Luke Parker
48a3cf5027 Fix POSIX compliance of increase_default_stack_size.sh
It turns out `\xXX` is not part of POSIX. The Octal `\ddd` is however, and is
used here.
2025-12-08 22:47:10 -05:00
Luke Parker
34dbfedc5a Expand the amount of shells tested with 2025-12-08 21:09:56 -05:00
Luke Parker
f4efa76e3f ./chelf instead of chelf 2025-12-08 20:57:23 -05:00
Luke Parker
19c18af086 Explicitly call ./muslstack instead of muslstack 2025-12-08 20:55:52 -05:00
Luke Parker
b0e40cae58 Add debug ls command 2025-12-08 20:54:42 -05:00
Luke Parker
606e67f937 Set GOBIN env variable 2025-12-08 20:53:21 -05:00
Luke Parker
fee3e2fa21 go get -> go install 2025-12-08 20:51:09 -05:00
Luke Parker
52cbc90876 Update stack size CI to only run on Linux runners 2025-12-08 20:50:01 -05:00
Luke Parker
1f39eb16c8 Remove _all_ paths scoping for the stack size CI for now 2025-12-08 20:46:01 -05:00
Luke Parker
fbe515cf9b Have stack size CI run whenever it itself is modified 2025-12-08 20:44:13 -05:00
Luke Parker
1cb6cb608f Remove paths argument from workflow_dispatch trigger 2025-12-08 20:41:25 -05:00
Luke Parker
881353fb4a Correction action definition in stack size CI 2025-12-08 20:40:22 -05:00
Luke Parker
a5f8ce9ec6 Add CI to verify increase_default_stack_size.sh functions as expected 2025-12-08 20:36:43 -05:00
Luke Parker
f70fee65b8 Add shellcheck to the CI
Updates our scripts to pass. Achieves POSIX compliance for
`increase_default_stack_size.sh` via replacing `hexdump` with `od` and `tr`.
Replaces the non-POSIX `dd status=none` with the POSIX `dd 2> /dev/null`.
2025-12-08 20:04:23 -05:00
Luke Parker
0849d60f28 Run Bitcoin, Monero nodes on Alpine
While prior this didn't work well, presumably due to stack size limitations,
a shell script is included to raise the default stack size limit. This should
be tried again.
2025-12-08 02:30:34 -05:00
Luke Parker
3a792f9ce5 Update documentation on the serai-runtime build.rs 2025-12-08 02:22:29 -05:00
Luke Parker
50959fa0e3 Update the polkadot-sdk used
Removes `parity-wasm` as a dependency, closing
https://github.com/serai-dex/issues/227 and tidying our `deny.toml`.

This removes the `import-memory` flag from the linker as part of
`parity-wasm`'s usage was to map imports into exports
(5a1128b94b/substrate/client/executor/common/src/runtime_blob/runtime_blob.rs (L91-L142)).
2025-12-08 02:22:25 -05:00
Luke Parker
2fb90ebe55 Extend crates we patch to be empty from the Ethereum ecosystem
`ruint` pulls in many versions of many crates. This has it pull in less.
2025-12-06 08:27:34 -05:00
Luke Parker
b24adcbd14 Add panic-on-poison to no-std std_shims::sync::Mutex
We already had this behavior on `std`. It was omitted when no-`std` due to
deferring to `spin::Mutex`, which does not track poisoning at all. This
increases the parity of the two.

Part of https://github.com/serai-dex/serai/issues/698.
2025-12-06 08:06:38 -05:00
Luke Parker
b791256648 Remove substrate-wasm-builder
By defining our own build script, we gain complete clarity and control over how
the WASM is built. This also removes the need to patch the upstream due to it
allowing pollution of the environment variables from the host.

Notable appreciation is given to
https://github.com/rust-lang/rust/issues/145491 for identifying an issue
encountered here, with the associated PR clarifying the necessary flags for the
linker to fix this.
2025-12-04 23:23:38 -05:00
Luke Parker
36ac9c56a4 Remove workaround for lack of musl-dev now that musl-dev is provided in Rust Alpine images
Additionally, optimizes the build process a bit via leaving only the runtime
(and `busybox`) in the final image, and additionally building the runtime
without `std` (as we solely need the WASM blob from this process).
2025-12-04 11:58:38 -05:00
Luke Parker
57bf4984f8 panic = "abort"
`panic = "unwind"` was originally a requirement of Substrate, notably due to
its [native runtime](https://github.com/paritytech/substrate/issues/10874).
This does not mean all of Serai should use this setting however.

As the native runtime has been removed, we do no longer need this for the
Substrate node. With a review of our derivative, a panic guard is only used
when fetching the version from the runtime, causing an error on boot if a
panic occurs. Accordingly, we shouldn't have a need for `panic = "unwind"`
within the node, and the runtime itself should be fine.

The rest of Serai's services already registered bespoke hooks to ensure any
panic caused the process to exit. Those are left as-is, even though they're
now unnecessary.
2025-12-04 11:58:38 -05:00
Luke Parker
87750407de cargo-deny 0.18.8, remove bip39 git dependency
The former is necessary due to `cargo-deny` misinterpreting select licenses.
The latter is finally possible with the recent 2.2.1 release 🎉
2025-12-04 11:58:28 -05:00
Luke Parker
3ce90c55d9 Define a 512 KiB block size limit 2025-12-02 21:24:05 -05:00
Luke Parker
ff95c58341 Round out the runtime
Ensures the block's size limit is respected.

Defines a policy for weights. While I'm unsure I want to commit to this
forever, I do want to acknowledge it's valid and well-defined.

Cleans up the `serai-runtime` crate a bit with further modules in the `wasm`
folder.
2025-12-02 21:16:34 -05:00
Luke Parker
98044f93b1 Stub the in-instructions pallet 2025-12-02 16:46:10 -05:00
Luke Parker
eb04f873d5 Stub the genesis-liquidity pallet 2025-12-02 16:46:06 -05:00
Luke Parker
af74c318aa Add event emissions to the DEX pallet 2025-12-02 13:31:33 -05:00
Luke Parker
d711d8915f Update docs Ruby/gem versions 2025-12-02 13:20:17 -05:00
Luke Parker
3d549564a8 Misc tweaks in the style of the last commit
Notably removes the `kvdb-rocksdb` patch via updating the Substrate version
used to one which disables the `jemalloc` feature itself.

Simplifies the path of the built WASM file within the Dockerfile to consumers.
This also ensures if the image is built, the path of the WASM file is as
expected (prior unasserted).
2025-12-02 09:10:44 -05:00
Luke Parker
9a75f92864 Thoroughly update versions and methodology
For hash-pinned dependencies, adds comments documenting the associated
versions.

Adds a pin to `slither-analyzer` which was prior missing.

Updates to Monero 0.18.4.4.

`mimalloc` now has the correct option set when building for `musl`. A C++
compiler is no longer required in its Docker image.

The runtime's `Dockerfile` now symlinks a `libc.so` already present on the
image instead of creating one itself. It also builds the runtime within the
image to ensure it only happens once. The test to ensure the methodology is
reproducible has been updated to not simply create containers from the image,
yet rebuild the image entirely, accordingly. This also is more robust and
arguably should have already been done.

The pin to the exact hash of the `patch-polkadot-sdk` repo in every
`Cargo.toml` has been removed. The lockfile already serves that role,
simplifying updating in the future.

The latest Rust nightly is adopted as well (superseding
https://github.com/serai-dex/serai/pull/697).

The `librocksdb-sys` patch is replaced with a `kvdb-rocksdb` patch, removing a
git dependency, thanks to https://github.com/paritytech/parity-common/pull/950.
2025-12-01 18:17:01 -05:00
Luke Parker
30ea9d9a06 Tidy the DEX pallet 2025-11-30 21:42:27 -05:00
Luke Parker
c45c973ca1 Remove musl-dev from runtime/Dockerfile
It wasn't pinned with a hash yet with a version tag. This ensures we are
deterministic to the image (specified by hash), `Cargo.lock`, and source code
alone.

Unfortunately, this was incredibly annoying to do, the exact process uncovering
a SIGSEGV in stable Rust. The extensive documentation details the solution.
Thankfully, it works now.
2025-11-27 03:37:37 -05:00
Luke Parker
6e37ac030d Add patch for alloy-eip2124 to an empty crate
Removes the `crc` dependency which had a unique author associated.
2025-11-26 17:01:03 -05:00
Luke Parker
e7c759c468 Improve substrate-median tests
The use of a dedicated test module ensures the API doesn't hide anything which
needs to be public. There's also now explicit tests for when the median is the
popped value.
2025-11-25 23:46:12 -05:00
Luke Parker
8ec0582237 Add module to calculate medians 2025-11-25 22:39:52 -05:00
Luke Parker
8d8e8a7a77 Remove unnecessary MSRVs from patches/ 2025-11-25 17:05:30 -05:00
Luke Parker
028ec3cce0 borsh 1.6.0
Bumps th MSRV for some of our crates, which is fine.
2025-11-25 16:58:19 -05:00
Luke Parker
c49215805f Update Substrate 2025-11-25 00:06:54 -05:00