Skip to content

Commit 958e8b0

Browse files
fix: return empty vec when bls_signature_validation_run verifying failed
1 parent 8deac3a commit 958e8b0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/precompile/src/bls.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn bls_signature_validation_run(input: &Bytes, gas_limit: u64) -> PrecompileResu
6464
if (pub_keys.len() == 1 && !bls::verify(&pub_keys[0], msg_hash, signature, &BLS_DST.to_vec()))
6565
|| !bls::aggregate_verify(pub_keys, msg_hashes, signature, &BLS_DST.to_vec())
6666
{
67-
output = Bytes::from(vec![0]);
67+
output = Bytes::from(vec![]);
6868
}
6969

7070
Ok(PrecompileOutput::new(cost, output))
@@ -118,7 +118,7 @@ mod tests {
118118
input.extend_from_slice(&signature);
119119
input.extend_from_slice(&pub_key);
120120

121-
let excepted_output = Bytes::from(vec![0]);
121+
let excepted_output = Bytes::from(vec![]);
122122
let result = match bls_signature_validation_run(&Bytes::from(input.clone()), 100_000_000) {
123123
Ok(o) => o.bytes,
124124
Err(e) => panic!("BLS signature validation failed, {:?}", e),
@@ -187,7 +187,7 @@ mod tests {
187187
input.extend_from_slice(&pub_key1);
188188
input.extend_from_slice(&pub_key2);
189189
input.extend_from_slice(&pub_key3);
190-
let excepted_output = Bytes::from(vec![0]);
190+
let excepted_output = Bytes::from(vec![]);
191191
let result = match bls_signature_validation_run(&Bytes::from(input.clone()), 100_000_000) {
192192
Ok(o) => o.bytes,
193193
Err(e) => panic!("BLS signature validation failed, {:?}", e),
@@ -242,7 +242,7 @@ mod tests {
242242
input.extend_from_slice(&pub_key1);
243243
input.extend_from_slice(&pub_key2);
244244
input.extend_from_slice(&pub_key3);
245-
let excepted_output = Bytes::from(vec![0]);
245+
let excepted_output = Bytes::from(vec![]);
246246
let result = match bls_signature_validation_run(&Bytes::from(input.clone()), 100_000_000) {
247247
Ok(o) => o.bytes,
248248
Err(e) => panic!("BLS signature validation failed, {:?}", e),

0 commit comments

Comments
 (0)