eth-native 0.1.1-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +202 -0
- data/README.md +84 -0
- data/docs/ARCHITECTURE.md +162 -0
- data/docs/PLAN.md +90 -0
- data/docs/RELEASE.md +88 -0
- data/docs/benchmarks/abi.md +41 -0
- data/docs/benchmarks/e2e.md +46 -0
- data/docs/benchmarks/rlp.md +44 -0
- data/ext/eth_native/README.md +15 -0
- data/lib/eth/native/abi.rb +267 -0
- data/lib/eth/native/eth_native.so +0 -0
- data/lib/eth/native/rlp.rb +147 -0
- data/lib/eth/native/version.rb +7 -0
- data/lib/eth/native.rb +89 -0
- metadata +106 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 041dd6963a5ddf3b1da697dbfb4ddef6dcf37244280d38e7b3df21bb210c2599
|
|
4
|
+
data.tar.gz: 357746065434a072226bee7a06393fd5c16cb2e1b8cfa6b199a75a2f7688e59e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 646e30b41bee7dc5383974be52805a93d9ba1798d16f812a5cf7afb461d67c4549eca68cd93e24816202f6623accd9d0344825dabda0f6356374ccec309e4ffe
|
|
7
|
+
data.tar.gz: 4b7b905501ef0e606876ca4fc75a50d95913b82b48421fd0fff8ee9262118f06eaf421d6cb07b1d663d88f6c982894f2f77c8c761c35ecf1ca4d4c48b660ab46
|
data/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright (c) 2026 The eth-native Contributors
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# eth-native
|
|
2
|
+
|
|
3
|
+
`eth-native` 是 [eth.rb](https://github.com/q9f/eth.rb) 的可选 Rust 原生扩展,目标是以整包/批量方式加速 RLP 与 ABI 编解码。
|
|
4
|
+
|
|
5
|
+
> **项目状态:M0–M5 已完成,v0.1.0 已发布 [rubygems.org](https://rubygems.org/gems/eth-native)(2026-12-06,OIDC Trusted Publishing)。** RLP 与 ABI(含 packed 编码与 fixed-point 的 Integer 值)均与 eth.rb 0.5.18 参考实现逐字节、逐错误差分一致(官方向量 + 数千随机差分用例)。Float/BigDecimal 的 fixed-point 值、标准编码器的 fixed/real 家族显式回退 Ruby;EIP-712 经 profiling 决策不 native 化。
|
|
6
|
+
|
|
7
|
+
## 约束
|
|
8
|
+
|
|
9
|
+
- CRuby `>= 4.0, < 5.0`;不支持 Ruby 3.x、JRuby、TruffleRuby。
|
|
10
|
+
- Rust + [Magnus](https://github.com/matsadler/magnus),由 `rb_sys` + `rake-compiler` 构建。
|
|
11
|
+
- Apache-2.0 许可。
|
|
12
|
+
- `eth` 不硬依赖本 gem;未安装时 eth.rb 继续使用纯 Ruby。
|
|
13
|
+
- 不接管私钥、签名、Keccak、secp256k1、scrypt、BLS 或 RPC。
|
|
14
|
+
|
|
15
|
+
## 当前实现
|
|
16
|
+
|
|
17
|
+
- `Eth::Native.native_abi_version` 由 Rust 扩展提供。
|
|
18
|
+
- `Eth::Native.available?` 报告当前进程是否成功加载原生扩展。
|
|
19
|
+
- `Eth::Native.ruby_version_supported?` 检查 CRuby 4.0 运行时要求。
|
|
20
|
+
- `Eth::Native.disabled?` 报告 `ETH_NATIVE=0` 是否禁用适配器。
|
|
21
|
+
- `Eth::Native::Rlp.encode/decode`:整棵树一次边界跨越的 RLP 编解码,
|
|
22
|
+
与参考实现逐字节、错误类别与稳定消息一致。
|
|
23
|
+
- `Eth::Native::Abi.compile(parsed_types)` → Schema(`encode`/`decode`/`decode_many`/
|
|
24
|
+
`native?`):编译一次复用,覆盖 uint/int/address/bool/bytes(N)/hash(N)/string/
|
|
25
|
+
数组/嵌套 tuple;fixed、real 家族编译为 RubySchema 显式回退。
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
require "eth/native"
|
|
29
|
+
|
|
30
|
+
Eth::Native.available? # => true
|
|
31
|
+
Eth::Native.native_abi_version # => 1
|
|
32
|
+
|
|
33
|
+
Eth::Native::Rlp.encode([1, "two", [3]]) # => ASCII-8BIT RLP bytes
|
|
34
|
+
Eth::Native::Rlp.decode("\xc3\x01\x83two") # => ["\x01", "two", []]
|
|
35
|
+
|
|
36
|
+
schema = Eth::Native::Abi.compile([Eth::Abi::Type.parse("uint256"), Eth::Abi::Type.parse("string")])
|
|
37
|
+
schema.encode([12345, "hello"]) # => ABI-encoded payload
|
|
38
|
+
schema.decode(payload) # => [12345, "hello"]
|
|
39
|
+
schema.decode_many(payloads) # => 批量解码
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
语义要点:
|
|
43
|
+
|
|
44
|
+
- 只原生处理 `Integer`(非负)、精确 `String`、精确 `Array` 组成的树;
|
|
45
|
+
`Rlp::Data`、自定义 sedes、Hash 等其他 Enumerable、负数在加载了
|
|
46
|
+
eth.rb 时自动回退参考实现(抛出与参考一致的异常),未安装 eth.rb 时
|
|
47
|
+
抛 `Eth::Native::Rlp::UnsupportedInput`。
|
|
48
|
+
- 解码保留参考的 hex/binary 输入启发式、canonical 检查、截断/越界/多余
|
|
49
|
+
尾字节行为与输出编码(ASCII-8BIT)。
|
|
50
|
+
- 原生内部错误不静默回退;只有明确标记为 unsupported 的输入才走 Ruby。
|
|
51
|
+
- `ETH_NATIVE=0` 显式禁用 `Eth::Native::Rlp`(抛 `DisabledError`);
|
|
52
|
+
`ETH_NATIVE=1` 只表达意愿,不能绕过加载自检。
|
|
53
|
+
- 深度上限 256 层,超限回退 Ruby。基准与已知代价见
|
|
54
|
+
[docs/benchmarks/rlp.md](docs/benchmarks/rlp.md) 与
|
|
55
|
+
[docs/benchmarks/abi.md](docs/benchmarks/abi.md)。
|
|
56
|
+
|
|
57
|
+
## 发布
|
|
58
|
+
|
|
59
|
+
源码 gem 经 GitHub Trusted Publishing 推送(tag `v*` 触发 `release.yml`);
|
|
60
|
+
前置配置与预编译 binary gem 双轨流程见 [docs/RELEASE.md](docs/RELEASE.md)。
|
|
61
|
+
|
|
62
|
+
## 本地开发
|
|
63
|
+
|
|
64
|
+
需要 Ruby 4.0 和 Rust 工具链。
|
|
65
|
+
|
|
66
|
+
```shell
|
|
67
|
+
bundle install
|
|
68
|
+
bundle exec rake compile
|
|
69
|
+
bundle exec rspec # 含官方向量与随机差分(需 Gemfile 中的 eth 0.5.18)
|
|
70
|
+
cargo test # 在 ext/eth_native 下
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`rake compile` 产物位于 `lib/eth/native/eth_native.{so,bundle,dll}`,由 `require "eth/native"` 加载。
|
|
74
|
+
|
|
75
|
+
## 路线
|
|
76
|
+
|
|
77
|
+
1. M0:工程基线、加载自检、CI。
|
|
78
|
+
2. M1:RLP 编码与差分测试。
|
|
79
|
+
3. M2:RLP 解码、fuzz 与 eth.rb 接入。
|
|
80
|
+
4. M3:ABI 编译 Schema。
|
|
81
|
+
5. M4:真实负载基准与 EIP-712 决策。
|
|
82
|
+
6. M5:预编译 binary gem 与发布。
|
|
83
|
+
|
|
84
|
+
完整方案见 [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md),里程碑与验收条件见 [docs/PLAN.md](docs/PLAN.md)。
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# 架构方案
|
|
2
|
+
|
|
3
|
+
## 1. 定位
|
|
4
|
+
|
|
5
|
+
`eth-native` 是 [eth.rb](https://github.com/q9f/eth.rb) 的可选 Rust 原生扩展,不是第二个 Ethereum SDK。
|
|
6
|
+
|
|
7
|
+
目标是把 Ruby 层的整包 RLP/ABI 编解码移入 Rust,减少解释执行、临时对象和 GC 压力。调用方仍使用 eth.rb 的密钥、交易、合约和 RPC API。
|
|
8
|
+
|
|
9
|
+
当前进度:M0–M4 已完成。RLP 编解码与编译 Schema ABI 编解码均已实现并与
|
|
10
|
+
eth.rb 0.5.18 参考实现逐字节、错误类别差分一致;fixed/real 家族与 packed
|
|
11
|
+
编码显式回退 Ruby;EIP-712 经 profiling 决策不 native 化(见
|
|
12
|
+
docs/benchmarks/e2e.md)。加载、自检、双后端 CI 与发布流程见
|
|
13
|
+
docs/PLAN.md 与 docs/RELEASE.md。
|
|
14
|
+
|
|
15
|
+
## 2. 技术决定
|
|
16
|
+
|
|
17
|
+
| 项目 | 决定 |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| gem / 模块 | `eth-native` / `Eth::Native` |
|
|
20
|
+
| Ruby | CRuby `>= 4.0, < 5.0`,不兼容 Ruby 3.x |
|
|
21
|
+
| Rust 绑定 | Magnus 0.9.x |
|
|
22
|
+
| 构建 | `rb_sys` + `rake-compiler`,`cdylib` |
|
|
23
|
+
| 许可 | Apache-2.0,与 eth.rb 一致 |
|
|
24
|
+
| 安装关系 | 用户显式添加 gem;`eth` 不反向硬依赖本包 |
|
|
25
|
+
| 首发范围 | RLP → ABI Schema;EIP-712 另行评估 |
|
|
26
|
+
| 不处理 | 私钥、签名、Keccak、secp256k1、scrypt、BLS、RPC |
|
|
27
|
+
|
|
28
|
+
只支持 CRuby 4.0 是本项目的明确产品边界,不是对 eth.rb Ruby 支持范围的修改。
|
|
29
|
+
|
|
30
|
+
## 3. 分层与数据流
|
|
31
|
+
|
|
32
|
+
```text
|
|
33
|
+
应用
|
|
34
|
+
│
|
|
35
|
+
▼
|
|
36
|
+
eth.rb:Key / Tx / Contract / RPC
|
|
37
|
+
│
|
|
38
|
+
▼
|
|
39
|
+
兼容层:类型解析、输入规范化、能力探测、错误映射、fallback
|
|
40
|
+
│ (只处理整包或一批数据)
|
|
41
|
+
▼
|
|
42
|
+
Eth::Native Ruby API
|
|
43
|
+
│
|
|
44
|
+
▼
|
|
45
|
+
Magnus:Ruby VALUE / RString / RArray 边界
|
|
46
|
+
│
|
|
47
|
+
▼
|
|
48
|
+
Rust core:RLP / compiled ABI Schema / bounded decoder
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- **权威语义留在 Ruby**:`Type.parse`、tuple component name、sedes 选择、异常类和稳定消息。
|
|
52
|
+
- **批量计算放在 Rust**:buffer layout、整数转大端、RLP 前缀、ABI head/tail、批量解码。
|
|
53
|
+
- **不在边界做字符串 DSL**:RLP 直接接收 Ruby 对象;ABI 接收已编译的强类型描述,不每次传 JSON 再解析。
|
|
54
|
+
- **不逐字段调用**:避免 FFI、Ruby 对象转换和分配成本抵消收益。
|
|
55
|
+
|
|
56
|
+
## 4. 目标 API
|
|
57
|
+
|
|
58
|
+
已实现的接口:
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
Eth::Native.available? # => true / false
|
|
62
|
+
Eth::Native.native_abi_version # => 1
|
|
63
|
+
Eth::Native.disabled? # => ETH_NATIVE=0 时为 true
|
|
64
|
+
|
|
65
|
+
Eth::Native::Rlp.encode(object) # => ASCII-8BIT String
|
|
66
|
+
Eth::Native::Rlp.decode(data) # => String / Array
|
|
67
|
+
|
|
68
|
+
schema = Eth::Native::Abi.compile(parsed_types)
|
|
69
|
+
schema.encode(values) # => ASCII-8BIT String
|
|
70
|
+
schema.decode(data) # => Array
|
|
71
|
+
schema.decode_many(payloads) # => Array<Array>
|
|
72
|
+
schema.native? # => 编译失败(如 fixed/real)时为 false,整体回退 Ruby
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`Rlp` 模块名与 `Eth::Rlp` 分开,避免加载扩展就 monkey patch 核心库。eth.rb 侧的 opt-in 适配器在后续独立变更中实现。
|
|
76
|
+
|
|
77
|
+
## 5. 加载和开关
|
|
78
|
+
|
|
79
|
+
使用方在 Gemfile 同时列出 `eth` 和 `eth-native`,并显式加载:
|
|
80
|
+
|
|
81
|
+
```ruby
|
|
82
|
+
require "eth"
|
|
83
|
+
require "eth/native"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`require "eth/native"` 只定义 Ruby 能力信息,再加载编译产物。生产接入遵循:
|
|
87
|
+
|
|
88
|
+
1. 确认 `RUBY_ENGINE == "ruby"` 且 Ruby 为 4.0.x。
|
|
89
|
+
2. 校验 gem 版本、native ABI 整数和构建目标。
|
|
90
|
+
3. 执行固定自检向量;失败则在加载阶段报清晰错误。
|
|
91
|
+
4. `ETH_NATIVE=0` 禁用适配器;`ETH_NATIVE=1` 仅表达启用意愿,不能绕过自检。
|
|
92
|
+
5. eth.rb 未安装本包时继续走原实现;不要求核心 gem rescue 所有运行时 native 错误。
|
|
93
|
+
|
|
94
|
+
**禁止调用失败就静默换 Ruby**:会把 native 的共识/内存错误隐藏成偶发结果差异。只有明确标记为 unsupported 的输入可以在调用前选择 Ruby。
|
|
95
|
+
|
|
96
|
+
## 6. RLP 设计
|
|
97
|
+
|
|
98
|
+
### 编码
|
|
99
|
+
|
|
100
|
+
- 一次递归遍历 `Integer`、`String`、`Array`,直接写入 Rust buffer。
|
|
101
|
+
- 非负整数直接转 shortest big-endian bytes,不经过 hex 字符串。
|
|
102
|
+
- `Rlp::Data`、自定义 sedes、其他 Enumerable 在 Ruby 侧先筛选并回退。
|
|
103
|
+
- 先正确实现 shortest-form、单字节 `< 0x80`、空串/空列表和长长度前缀,再优化 buffer 预分配。
|
|
104
|
+
|
|
105
|
+
### 解码
|
|
106
|
+
|
|
107
|
+
- 全程使用 `(offset, length)` 访问输入,不制造每层 substring。
|
|
108
|
+
- 检查 shortest-form、长度前缀前导零、截断、列表边界、根对象后的多余字节。
|
|
109
|
+
- 恶意长度不得先触发巨额分配;限制输入、嵌套深度和节点数。
|
|
110
|
+
- 输出 String/Array 的 encoding、freeze 行为和异常类别与 eth.rb 参考版本一致。
|
|
111
|
+
|
|
112
|
+
## 7. ABI Schema 设计
|
|
113
|
+
|
|
114
|
+
Ruby 将 `Eth::Abi::Type` 编译为不可变描述树,例如:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
Type {
|
|
118
|
+
kind: UInt(256) | Int(256) | Address | Bool | Bytes(n) | DynamicBytes |
|
|
119
|
+
String | Array(element, length?) | Tuple(components),
|
|
120
|
+
static_size: Option<usize>,
|
|
121
|
+
dynamic: bool
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- Schema 创建时完成校验、static size、组件索引和 offset 预计算。
|
|
126
|
+
- Rust 不重新发明 Solidity 类型字符串解析。
|
|
127
|
+
- 第一轮覆盖 uint/int/address/bool/bytes/string/array/tuple;packed 和 fixed-point 单独验收。
|
|
128
|
+
- 不支持类型必须显式报告,不能按“相近类型”处理。
|
|
129
|
+
- Ruby Bignum 到 256-bit 的转换要单独基准,不能假设一定比 hex 快。
|
|
130
|
+
- `decode_many` 面向索引器/批量日志,避免每条记录重复跨边界和编译 schema。
|
|
131
|
+
|
|
132
|
+
## 8. 正确性与安全契约
|
|
133
|
+
|
|
134
|
+
1. **共识字节等价**:同一有效输入,native 与参考实现逐字节相同。
|
|
135
|
+
2. **错误等价**:至少匹配异常类别和已有测试依赖的消息;不得统一变成 `RuntimeError`。
|
|
136
|
+
3. **字符串语义等价**:区分 hex 与 binary 的启发式、UTF-8/ASCII-8BIT 输出必须保留。
|
|
137
|
+
4. **不静默修复旧语义**:发现 eth.rb 的潜在 bug 时先在核心项目处理,不在 native 偷偷改变行为。
|
|
138
|
+
5. **Ruby GC 安全**:Ruby `VALUE` 不放入未注册的 Rust 堆结构;跨越 Ruby 调用前不缓存裸指针。
|
|
139
|
+
6. **panic 边界**:Rust 错误经 `magnus::Error` 返回;不得让 panic 穿过 Ruby C ABI。
|
|
140
|
+
7. **有界资源**:输入长度、深度、节点数、输出分配都有上限并经过恶意输入测试。
|
|
141
|
+
8. **并发**:schema 不可变;不共享可变全局状态;GVL 释放只用于不触碰 Ruby 对象的纯 Rust 区段。
|
|
142
|
+
9. **私钥隔离**:本扩展不接收、记录或持久化私钥,不替换既有密码学实现。
|
|
143
|
+
|
|
144
|
+
## 9. 性能验证
|
|
145
|
+
|
|
146
|
+
以 eth.rb 固定 commit 为参考,分别测:
|
|
147
|
+
|
|
148
|
+
- RLP:12 字段交易、1000 项整数、1000 项嵌套结构、大 bytes。
|
|
149
|
+
- ABI:标量、静态/动态 tuple、100/1000 元素数组、1KiB/64KiB/1MiB bytes。
|
|
150
|
+
- 业务:交易构造/签名/编码/解码、合约调用、1k/10k 条 event log。
|
|
151
|
+
- 分配:`GC.stat(:total_allocated_objects)`、GC 次数和 RSS。
|
|
152
|
+
|
|
153
|
+
同一机器、同一 Ruby、独立进程预热、交错采样,报告中位数与离散度。首轮 C 原型的 120–148 倍只作为可行性线索,不作为 Rust 目标或发布宣传数字。
|
|
154
|
+
|
|
155
|
+
## 10. 发布边界
|
|
156
|
+
|
|
157
|
+
- M0–M2:源码 gem,支持 macOS/Linux 的 Ruby 4.0。
|
|
158
|
+
- M3–M4:真实负载、fuzz 和 ABI Schema 验证;仍不宣称 Windows。
|
|
159
|
+
- M5:预编译 binary gem 与源码 gem 双轨;Windows 先进入 CI 再说支持。
|
|
160
|
+
- 0.1.0 之前不进入 eth.rb 核心 gemspec,不改动 eth.rb 默认后端。
|
|
161
|
+
|
|
162
|
+
相关里程碑与验收条件见 [PLAN.md](PLAN.md)。
|
data/docs/PLAN.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# 实施计划
|
|
2
|
+
|
|
3
|
+
## 目标
|
|
4
|
+
|
|
5
|
+
为 [eth.rb](https://github.com/q9f/eth.rb) 提供独立的可选原生扩展,以 Rust + Magnus 加速整包/批量 RLP、ABI 编解码;后续按真实负载证据决定是否加入 EIP-712。只支持 CRuby 4.0.x,不降低 Ruby 要求换取覆盖面。
|
|
6
|
+
|
|
7
|
+
## 已定约束
|
|
8
|
+
|
|
9
|
+
- 仓库:`ShiningRay/eth-native`,公开;gem 名:`eth-native`。
|
|
10
|
+
- 运行时:CRuby `>= 4.0, < 5.0`;不支持 JRuby、TruffleRuby 或 Ruby 3.x。
|
|
11
|
+
- 绑定:Magnus 0.9.x;构建:`rb_sys` + `rake-compiler`。
|
|
12
|
+
- 核心 `eth` 不新增硬依赖;未安装扩展时继续使用纯 Ruby。
|
|
13
|
+
- 第一阶段支持 macOS/Linux;Windows 进入 CI 并验证后才声明支持。
|
|
14
|
+
- 不以 C 原型微基准承诺 Rust 或端到端倍数。
|
|
15
|
+
|
|
16
|
+
## 阶段计划
|
|
17
|
+
|
|
18
|
+
### M0:工程基线(已完成)
|
|
19
|
+
|
|
20
|
+
- [x] 明确技术选型、可选加载、兼容性和安全边界。
|
|
21
|
+
- [x] 创建 Apache-2.0 公开仓库和中文架构/路线文档。
|
|
22
|
+
- [x] 建立 gemspec、Cargo、extconf、Rake、RSpec 骨架。
|
|
23
|
+
- [x] Rust 扩展仅实现 `native_abi_version`,Ruby 实现加载与自检。
|
|
24
|
+
- [x] Ruby 4.0 本机编译、加载、测试和 gem 构建通过。
|
|
25
|
+
- [x] 添加仅验证 M0 的 CI,推送 `main`。
|
|
26
|
+
|
|
27
|
+
验收:最小扩展示例真实可运行;README 不宣称已有 RLP/ABI 加速。
|
|
28
|
+
|
|
29
|
+
### M1:RLP 编码(已完成)
|
|
30
|
+
|
|
31
|
+
- [x] 建立 eth.rb 固定参考版本和官方 RLP fixtures。
|
|
32
|
+
- [x] Rust 一次边界处理 Integer/String/Array 整棵树。
|
|
33
|
+
- [x] 对 `Rlp::Data`、自定义 sedes、其他 Enumerable 回退 Ruby;不做逐字段调用。
|
|
34
|
+
- [x] 保留二进制编码、错误类别、稳定消息和长度/深度限制。
|
|
35
|
+
- [x] 对官方向量、随机结构、负数、超大整数、深层嵌套做差分。
|
|
36
|
+
- [x] 输出基准:小交易、嵌套列表、大 bytes、批量编码、对象分配和 RSS。
|
|
37
|
+
|
|
38
|
+
验收:全部既有 RLP 向量双后端一致;非法输入不崩溃;有 paired benchmark 证据。
|
|
39
|
+
|
|
40
|
+
### M2:RLP 解码与接入(已完成)
|
|
41
|
+
|
|
42
|
+
- [x] 实现 canonical RLP 检查、截断/越界/多余尾字节拒绝。
|
|
43
|
+
- [x] 明确 hex 与 binary 输入语义,保留现有输出 encoding。
|
|
44
|
+
- [x] 在 eth.rb 的 `Rlp` 层接入显式后端选择;默认 native 策略由版本/自检决定(eth.rb 仓库 `native-rlp-backend` 分支,opt-in 适配器)。
|
|
45
|
+
- [x] 加入 decode fuzzer、并发调用、fallback 和故障路径测试。
|
|
46
|
+
|
|
47
|
+
验收:正确性先于性能;native 内部错误不静默 fallback;无内存安全告警。
|
|
48
|
+
|
|
49
|
+
### M3:ABI 编译 Schema(已完成)
|
|
50
|
+
|
|
51
|
+
- [x] Ruby 负责权威 `Type.parse`、组件名和异常语义;Rust 接收编译后的 schema。
|
|
52
|
+
- [x] 实现静态/动态标量、数组、嵌套 tuple、整数边界和 head/tail。
|
|
53
|
+
- [x] 再实现 packed 和 fixed-point;未支持类型明确回退,不做静默近似(标准编码器仍显式拒绝 fixed/real;packed 路径支持 fixed-point 的 Integer 值,Float/BigDecimal 回退以保留参考的舍入语义)。
|
|
54
|
+
- [x] ABI Schema 在 Contract Function 初始化后编译复用(eth.rb 仓库 `native-rlp-backend` 分支的 `encode_call_native`;Event 侧同型)。
|
|
55
|
+
|
|
56
|
+
验收:官方 ABI/ethers fixtures、随机 tuple/array 和错误路径逐项一致;大数据分配显著降低。
|
|
57
|
+
|
|
58
|
+
### M4:真实负载与 EIP-712 决策(已完成)
|
|
59
|
+
|
|
60
|
+
- [x] 建立 tx encode/sign/decode、合约调用、1k/10k event log 的端到端基准(docs/benchmarks/e2e.md)。
|
|
61
|
+
- [x] 先验证 eth.rb 侧 type/schema 缓存(`FunctionInput` 初始化时已缓存 Type,参考实现无每次重解析),再判断 EIP-712 是否需要整体 native。
|
|
62
|
+
- [x] 只有 profiling 证明 Ruby 遍历仍是瓶颈,才新增 EIP-712 native 模块(遍历占 76.9%,但 EIP-712 格式独立于 RLP/ABI、无真实瓶颈证据,决策:0.1.0 不新增,留档 docs/benchmarks/e2e.md)。
|
|
63
|
+
|
|
64
|
+
验收:以真实负载 p50/p95、吞吐、分配、RSS 决定范围;没有收益的路径不 native 化。
|
|
65
|
+
|
|
66
|
+
### M5:发布与分发(已完成——v0.1.0 已于 2026-12-06 经 OIDC 上线 rubygems.org)
|
|
67
|
+
|
|
68
|
+
- [x] macOS arm64/x86_64、Linux x86_64/aarch64 的 Ruby 4.0 CI。
|
|
69
|
+
- [x] 预编译 binary gem 与源码 gem 双轨;Windows 未验证前不发布承诺(源码 gem 已上线;binary 流程见 docs/RELEASE.md,首次执行须人工核对)。
|
|
70
|
+
- [x] `Cargo.lock`、cargo audit/deny、gem 校验、发布签名和 Trusted Publishing(release.yml + docs/RELEASE.md)。
|
|
71
|
+
- [x] 发布 0.1.0 前完成安装、加载失败、版本不匹配和双后端 CI 矩阵。
|
|
72
|
+
|
|
73
|
+
## 工程顺序与依赖
|
|
74
|
+
|
|
75
|
+
M0 → M1 → M2 → M3 → M4 → M5。RLP 编解码验证完成前不并行实现 ABI;ABI 未稳定前不开始 EIP-712。
|
|
76
|
+
|
|
77
|
+
## 验证基线
|
|
78
|
+
|
|
79
|
+
- 每次改动:`cargo fmt --check`、`cargo clippy -- -D warnings`、`cargo test`、`bundle exec rspec`。
|
|
80
|
+
- M0 额外验证:`bundle exec rake compile`、`gem build`、`gem install` 后独立进程加载。
|
|
81
|
+
- 正确性:官方 fixtures + 属性测试 + 差分错误类别/消息 + fuzzer。
|
|
82
|
+
- 性能:独立进程预热、交错采样、中位数和离散度;不能拿单次运行或跨机绝对值宣称倍数。
|
|
83
|
+
- 端到端:区分纯 Ruby、Rust native、启用/禁用 native 三种运行。
|
|
84
|
+
|
|
85
|
+
## 风险与停止条件
|
|
86
|
+
|
|
87
|
+
- 若 native 与 Ruby 语义无法等价:该输入回退;无法安全判定的路径不启用 native。
|
|
88
|
+
- 若小对象性能退化或边界成本过高:只保留大对象/批量 API。
|
|
89
|
+
- 若 fuzz、线程或平台测试失败:禁止发布,不以删除失败用例换绿。
|
|
90
|
+
- 私钥、签名、Keccak/secp256k1/scrypt/BLS 不进入本扩展范围。
|
data/docs/RELEASE.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# 发布流程(M5)
|
|
2
|
+
|
|
3
|
+
## 前置门槛(已由 CI 保障)
|
|
4
|
+
|
|
5
|
+
推送与 PR 的 CI(`.github/workflows/ci.yml`)覆盖 PLAN M5 要求:
|
|
6
|
+
|
|
7
|
+
- 四平台 × 双后端矩阵:`ubuntu-latest`、`macos-latest`、`ubuntu-24.04-arm`、
|
|
8
|
+
`macos-13` × (含 eth 0.5.18 参考 / 不含 eth);
|
|
9
|
+
- `cargo fmt`、`cargo clippy -D warnings`、`cargo test`、`rake compile spec`、
|
|
10
|
+
`gem build`;
|
|
11
|
+
- `gem-install` 任务:构建源码 gem、`gem install --local`,并在干净进程里
|
|
12
|
+
校验加载、ABI 版本自检与 `ETH_NATIVE=0` 禁用开关;
|
|
13
|
+
- `cargo-audit` / `cargo-deny`(`ext/eth_native/deny.toml`)。
|
|
14
|
+
|
|
15
|
+
版本不匹配与加载失败的错误契约由 `spec/eth/native/loader_spec.rb` 固定。
|
|
16
|
+
|
|
17
|
+
## 发布步骤(源码 gem,Trusted Publishing)
|
|
18
|
+
|
|
19
|
+
1. rubygems.org → gem `eth-native` → Settings → Trusted Publishing:
|
|
20
|
+
添加 GitHub publisher(owner `ShiningRay`,repo `eth-native`,
|
|
21
|
+
workflow `release.yml`,environment `release`)。
|
|
22
|
+
2. GitHub 仓库 → Environments → 新建受保护环境 `release`。
|
|
23
|
+
3. 更新 `lib/eth/native/version.rb`,提交并打 tag:
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
git tag v0.1.0 && git push origin v0.1.0
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
4. `release.yml` 校验 tag 与 `Eth::Native::VERSION` 一致,构建源码 gem,
|
|
30
|
+
通过 OIDC 推送(无需 API token)。
|
|
31
|
+
|
|
32
|
+
## v0.1.0 发布记录
|
|
33
|
+
|
|
34
|
+
2026-12-06:tag `v0.1.0` 触发 `release.yml`,测试门禁、版本校验、gem 构建
|
|
35
|
+
全绿;OIDC 推送经 `configure-rubygems-credentials@v2.2.0`(`owner: 66500`,
|
|
36
|
+
pending trusted publisher 首发必填)+ `gem push` 完成,rubygems.org 上线
|
|
37
|
+
(API 确认 version 0.1.0,非 yanked)。首发踩坑记录:
|
|
38
|
+
`release-gem@v1` 内嵌旧版 configure action 无 owner 输入,必须显式钉
|
|
39
|
+
v2.2.0;Bundler 4.x 移除 `bundle install --path`。
|
|
40
|
+
|
|
41
|
+
## 预编译 binary gem(双轨,已实施)
|
|
42
|
+
|
|
43
|
+
Windows 未进入 CI,**不发布 Windows 包,不承诺 Windows 支持**(PLAN 约束)。
|
|
44
|
+
当前发布的平台矩阵:`x86_64-linux`(macOS 与 aarch64-linux 2026-12-06 起
|
|
45
|
+
暂不构建不发布,需要时在 release.yml cross-compile 矩阵加回),针对
|
|
46
|
+
CRuby 4.0(与 gemspec `required_ruby_version` 一致;交叉编译基于
|
|
47
|
+
rake-compiler-dock 1.12.0 镜像,`RUBY_CC_VERSION` 含 Ruby 4.0.2)。
|
|
48
|
+
已知问题:aarch64-linux 交叉构建在 dock 镜像内有一段 cargo rustc 以
|
|
49
|
+
`--target aarch64` 编译却用宿主 gcc 链接,宿主 ld 不认
|
|
50
|
+
`--fix-cortex-a53-843419`(rustc 对 aarch64 目标默认附加,RUSTFLAGS /
|
|
51
|
+
CARGO_TARGET_*_RUSTFLAGS 关不掉);待上游镜像或 rb-sys 修复后再恢复。
|
|
52
|
+
|
|
53
|
+
机制:
|
|
54
|
+
|
|
55
|
+
- `Rakefile` 用 `RbSys::ExtensionTask`(rb_sys 0.9.130)。交叉编译由
|
|
56
|
+
rb-sys-dock 容器内的 `RUBY_TARGET` / `RUBY_CC_VERSION` 环境变量驱动;
|
|
57
|
+
宿主机无需任何配置,本地 `rake compile spec` 走原生路径。任务名必须与
|
|
58
|
+
`ext/eth_native/Cargo.toml` 的 `[package] name`(`eth-native`)一致。
|
|
59
|
+
rb_sys 在任务定义时从工作目录跑 `cargo metadata`,而 manifest 在
|
|
60
|
+
`ext/eth_native/`,故 Rakefile 子类只在 `init` 阶段 chdir 并把
|
|
61
|
+
source_files 绝对化。
|
|
62
|
+
- binary gem 不依赖 `rb_sys`(交叉打包时自动移除),安装零编译;
|
|
63
|
+
`.so` 位于版本化子目录,`lib/eth/native.rb` 的 loader 有
|
|
64
|
+
`require "eth/native/eth_native"` 回退。
|
|
65
|
+
- CI(`ci.yml` `binary-gem-smoke`):每次 push 都构建 x86_64-linux 包,
|
|
66
|
+
并在无 Rust 工具链的干净 `ruby:4.0.10-slim` 容器里安装、自检。
|
|
67
|
+
- 发布(`release.yml`):`cross-compile` 矩阵四平台产出 artifact,
|
|
68
|
+
release 任务统一推送;按「版本+平台已发布」精确跳过,因此
|
|
69
|
+
平台包可晚于源码 gem 补发,同版本号不需 bump(`eth-native-0.1.0
|
|
70
|
+
-x86_64-linux.gem` 等直接补 0.1.0)。
|
|
71
|
+
- 容器内 `bundle install` 通过仓库 `.bundle/config`
|
|
72
|
+
(`BUNDLE_WITHOUT=reference`)跳过 eth 0.5.18 参考组,避免容器内编译
|
|
73
|
+
rbsecp256k1 需要系统 `libsecp256k1-dev`。
|
|
74
|
+
|
|
75
|
+
本地构建与验证(等同 CI,用于首次人工核对):
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
# 构建(每个平台一次;首拉镜像约 1–2GB)
|
|
79
|
+
bundle exec rb-sys-dock -p x86_64-linux --ruby-versions 4.0 --build
|
|
80
|
+
# 干净容器无 Rust 安装 + 自检(复用 CI gem-install 脚本)
|
|
81
|
+
docker run --rm -v "$PWD/pkg:/pkg:ro" -v /tmp/selfcheck.rb:/selfcheck.rb:ro \
|
|
82
|
+
--entrypoint sh ruby:4.0.10-slim -c '
|
|
83
|
+
gem install --local /pkg/eth-native-*-x86_64-linux.gem && ruby /selfcheck.rb'
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
首次执行须人工核对每个平台产物通过上述干净环境自检(x86_64-linux
|
|
87
|
+
另需在 amd64 宿主或 CI 上真机验证;Apple Silicon 上 x86_64-linux 走
|
|
88
|
+
QEMU 模拟,仅作打包验证)。
|