ElementsProject / ElementsProject/rust-elements
Incompatible Value binary serialization format
- 主要語言
- Rust
- 星號
- 57
- 分支
- 40
- 平均合併
- 11 小時 58 分鐘
- 30 天內合併 PR
- 1
描述
It appears that the [bincode value fix](https://github.com/ElementsProject/rust-elements/pull/98) resulted in a different serialization format compared to before the [regression](https://github.com/ElementsProject/rust-elements/pull/96) (v0.16).
With current master (fe3e9469618a479de02f8ececf92f9d456fc4c38), the following code:
```rust
let commitment = PedersenCommitment::from_slice(&Vec::from_hex("09b88680778d3d5530785ff12bb62e6ac98c7be5a8b9b0ea392e166bf61ea77ee4").unwrap()).unwrap();
let value = Value::Confidential(commitment);
println!("BE bytes: {}", bincode::serialize(&value).unwrap().to_hex());
println!("LE bytes: {}", bincode::DefaultOptions::default().with_little_endian()
.serialize(&value).unwrap().to_hex());
```
Results in the following serialization:
```
BE bytes: 020000000000000002210000000000000009b88680778d3d5530785ff12bb62e6ac98c7be5a8b9b0ea392e166bf61ea77ee4
LE bytes: 02022109b88680778d3d5530785ff12bb62e6ac98c7be5a8b9b0ea392e166bf61ea77ee4
```
While with v0.16, the following code:
```rust
let value = Value::from_commitment(&Vec::from_hex("09b88680778d3d5530785ff12bb62e6ac98c7be5a8b9b0ea392e166bf61ea77ee4").unwrap()).unwrap();
println!("BE bytes: {}", bincode::serialize(&value).unwrap().to_hex());
println!("LE bytes: {}", bincode::DefaultOptions::default().with_little_endian()
.serialize(&value).unwrap().to_hex());
```
Results in the following serialization:
```
BE bytes: 020000000000000009b88680778d3d5530785ff12bb62e6ac98c7be5a8b9b0ea392e166bf61ea77ee4
LE bytes: 0209b88680778d3d5530785ff12bb62e6ac98c7be5a8b9b0ea392e166bf61ea77ee4
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
使用報告中展示的 Value::Confidential 範例和 bincode 的兩種序列化選項重現此問題。將目前的行為與 v0.16 進行比較,並檢查 PRs 98 和 96 中對 Value 序列化所做的變更。當相容性問題已解決,且產生的位元組已根據報告中的 v0.16 格式完成驗證時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust
- 領域
- backend
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100