ElementsProject / ElementsProject/rust-elements
Incompatible Value binary serialization format
- Linguagem predominante
- Rust
- Estrelas
- 57
- Forks
- 40
- Merge médio
- 11h 58min
- PRs com merge (30d)
- 1
Descrição
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
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Reproduza o problema usando o exemplo Value::Confidential e ambas as opções de serialização do bincode mostradas no relatório. Compare o comportamento atual com o v0.16 e inspecione as alterações na serialização de Value nos PRs 98 e 96. Considera-se concluído quando o problema de compatibilidade estiver resolvido e os bytes resultantes tiverem sido verificados em relação ao formato v0.16 relatado.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- rust
- Domínio
- backend
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100