1
1
# Mithril Common Architecture Decision Records
2
2
3
+ ## 2. Remove Artifacts serialization support when compiling to WebAssembly
4
+
5
+ date: 2025-02-26
6
+ status: Accepted
7
+
8
+ ### Context
9
+
10
+ After the update to rust ` 1.85 ` on ` 2025-02-21 ` , we noticed that ` mithril-client-wasm ` was failing to compile with the error:
11
+
12
+ ```
13
+ [INFO]: ⬇️ Installing wasm-bindgen...
14
+ thread 'main' panicked at crates/wasm-interpreter/src/lib.rs:245:21:
15
+ mithril_common::signable_builder::interface::_::__ctor::h4977fb9f7c35308c: Read a negative address value from the stack. Did we run out of memory?
16
+ ```
17
+
18
+ Investigating the problem, we found that the use of ` typetag::serde ` attribute was causing the issue, as removing them
19
+ allowed the project to compile successfully.
20
+ Furthermore, we found that this is a known issue with ` typetag ` and WebAssembly, as documented in the ` typetag ` repository
21
+ [ issue #54 ] ( https://github.com/dtolnay/typetag/issues/54 ) .
22
+ Why this issue wasn't happening before the update to rust ` 1.85 ` is still unknown, as this incompatibility predates the update.
23
+
24
+ We use the ` typetag::serde ` attribute to serialize and deserialize Artifacts which are implementing a common trait.
25
+ As of today, this serialization is only used by ` mithril-aggregator ` to store the Artifacts in the database.
26
+
27
+ ### Decision
28
+
29
+ We will remove the ` typetag::serde ` attribute from the Artifacts when compiling to WebAssembly.
30
+
31
+ ### Consequences
32
+
33
+ Web Assembly will not be able to serialize and deserialize Artifacts using the generic ` Artifact ` trait.
34
+ This will not affect ` mithril-aggregator ` as it is not compiled to WebAssembly.
35
+
36
+ In the future, if we need to serialize and deserialize Artifacts in WebAssembly, we will need to find an alternative solution.
37
+
38
+ ---
39
+
3
40
## 1. Record Architecture Decisions
4
41
5
42
date: 2025-02-26
@@ -21,4 +58,4 @@ To keep things simple, we will store these ADRs in a single file, and use a simp
21
58
22
59
See Michael Nygard's article, linked above.
23
60
24
- ---
61
+ ---
0 commit comments