mirror of
https://github.com/logos-storage/logos-storage-proofs.git
synced 2026-01-04 06:23:11 +00:00
re-add original prove for comparison
This commit is contained in:
parent
7388fe82f2
commit
efe470d64d
@ -146,7 +146,7 @@ impl StorageProofs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decode_u256(val: &rmpv::Value) -> Result<U256, String> {
|
fn decode_number(val: &rmpv::Value) -> Result<U256, String> {
|
||||||
match val {
|
match val {
|
||||||
rmpv::Value::Ext(id, val) => {
|
rmpv::Value::Ext(id, val) => {
|
||||||
match *id {
|
match *id {
|
||||||
@ -158,7 +158,16 @@ fn decode_u256(val: &rmpv::Value) -> Result<U256, String> {
|
|||||||
num => return Err(format!("unhandled ext id {}", num)),
|
num => return Err(format!("unhandled ext id {}", num)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_ => return Err("expected ext mpack kind".to_string()),
|
rmpv::Value::Integer(val) => {
|
||||||
|
if let Some(val) = val.as_u64() {
|
||||||
|
return Ok(U256::from(val));
|
||||||
|
} else if let Some(val) = val.as_i64() {
|
||||||
|
return Ok(U256::from(val));
|
||||||
|
} else {
|
||||||
|
return Err("unexpected integer kind".to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => return Err("expected ext mpack kind or integer".to_string()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +194,7 @@ fn parse_mpack_arrays(
|
|||||||
} else {
|
} else {
|
||||||
println!("deserde: name: {}", name);
|
println!("deserde: name: {}", name);
|
||||||
for val in array {
|
for val in array {
|
||||||
let n = decode_u256(val)?;
|
let n = decode_number(val)?;
|
||||||
println!("\t{}", n);
|
println!("\t{}", n);
|
||||||
builder.push_input(name, n);
|
builder.push_input(name, n);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user