mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-03 18:07:24 +00:00
Check signatures as "Compact" in statement distribution (#5071)
* allow converting payloads _up_ * convert to superpayload in statement-distribution * Update primitives/src/v2/signed.rs Co-authored-by: Andronik <write@reusable.software> Co-authored-by: Andronik <write@reusable.software>
This commit is contained in:
committed by
GitHub
parent
22a7fad75f
commit
8a17c614f0
@@ -105,14 +105,16 @@ fn active_head_accepts_only_2_seconded_per_validator() {
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("should be signed");
|
||||
assert!(head_data.check_useful_or_unknown(&a_seconded_val_0.clone().into()).is_ok());
|
||||
assert!(head_data
|
||||
.check_useful_or_unknown(&a_seconded_val_0.clone().convert_payload().into())
|
||||
.is_ok());
|
||||
let noted = head_data.note_statement(a_seconded_val_0.clone());
|
||||
|
||||
assert_matches!(noted, NotedStatement::Fresh(_));
|
||||
|
||||
// note A (duplicate)
|
||||
assert_eq!(
|
||||
head_data.check_useful_or_unknown(&a_seconded_val_0.clone().into()),
|
||||
head_data.check_useful_or_unknown(&a_seconded_val_0.clone().convert_payload().into()),
|
||||
Err(DeniedStatement::UsefulButKnown),
|
||||
);
|
||||
let noted = head_data.note_statement(a_seconded_val_0);
|
||||
@@ -130,7 +132,9 @@ fn active_head_accepts_only_2_seconded_per_validator() {
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("should be signed");
|
||||
assert!(head_data.check_useful_or_unknown(&statement.clone().into()).is_ok());
|
||||
assert!(head_data
|
||||
.check_useful_or_unknown(&statement.clone().convert_payload().into())
|
||||
.is_ok());
|
||||
let noted = head_data.note_statement(statement);
|
||||
assert_matches!(noted, NotedStatement::Fresh(_));
|
||||
|
||||
@@ -146,7 +150,7 @@ fn active_head_accepts_only_2_seconded_per_validator() {
|
||||
.flatten()
|
||||
.expect("should be signed");
|
||||
assert_eq!(
|
||||
head_data.check_useful_or_unknown(&statement.clone().into()),
|
||||
head_data.check_useful_or_unknown(&statement.clone().convert_payload().into()),
|
||||
Err(DeniedStatement::NotUseful),
|
||||
);
|
||||
let noted = head_data.note_statement(statement);
|
||||
@@ -163,7 +167,9 @@ fn active_head_accepts_only_2_seconded_per_validator() {
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("should be signed");
|
||||
assert!(head_data.check_useful_or_unknown(&statement.clone().into()).is_ok());
|
||||
assert!(head_data
|
||||
.check_useful_or_unknown(&statement.clone().convert_payload().into())
|
||||
.is_ok());
|
||||
let noted = head_data.note_statement(statement);
|
||||
assert_matches!(noted, NotedStatement::Fresh(_));
|
||||
|
||||
@@ -178,7 +184,9 @@ fn active_head_accepts_only_2_seconded_per_validator() {
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("should be signed");
|
||||
assert!(head_data.check_useful_or_unknown(&statement.clone().into()).is_ok());
|
||||
assert!(head_data
|
||||
.check_useful_or_unknown(&statement.clone().convert_payload().into())
|
||||
.is_ok());
|
||||
let noted = head_data.note_statement(statement);
|
||||
assert_matches!(noted, NotedStatement::Fresh(_));
|
||||
}
|
||||
@@ -428,7 +436,9 @@ fn peer_view_update_sends_messages() {
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("should be signed");
|
||||
assert!(data.check_useful_or_unknown(&statement.clone().into()).is_ok());
|
||||
assert!(data
|
||||
.check_useful_or_unknown(&statement.clone().convert_payload().into())
|
||||
.is_ok());
|
||||
let noted = data.note_statement(statement);
|
||||
|
||||
assert_matches!(noted, NotedStatement::Fresh(_));
|
||||
@@ -443,7 +453,9 @@ fn peer_view_update_sends_messages() {
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("should be signed");
|
||||
assert!(data.check_useful_or_unknown(&statement.clone().into()).is_ok());
|
||||
assert!(data
|
||||
.check_useful_or_unknown(&statement.clone().convert_payload().into())
|
||||
.is_ok());
|
||||
let noted = data.note_statement(statement);
|
||||
|
||||
assert_matches!(noted, NotedStatement::Fresh(_));
|
||||
@@ -458,7 +470,9 @@ fn peer_view_update_sends_messages() {
|
||||
.ok()
|
||||
.flatten()
|
||||
.expect("should be signed");
|
||||
assert!(data.check_useful_or_unknown(&statement.clone().into()).is_ok());
|
||||
assert!(data
|
||||
.check_useful_or_unknown(&statement.clone().convert_payload().into())
|
||||
.is_ok());
|
||||
let noted = data.note_statement(statement);
|
||||
assert_matches!(noted, NotedStatement::Fresh(_));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user