GRANDPA finality proof draft (#1268)

* grandpa finality proof

* prove GrandpaApi::grandpa_authorities using parent block + some docs

* create justification when consensus data is changed

* generate justifications periodically

* test for ConsensusChanges
This commit is contained in:
Svyatoslav Nikolsky
2019-01-11 21:25:03 +03:00
committed by Gav Wood
parent 677b79765b
commit 616716cb4b
18 changed files with 786 additions and 113 deletions
+5 -5
View File
@@ -36,7 +36,7 @@ fn uxt(sender: Keyring, nonce: u64) -> Extrinsic {
to: Default::default(),
};
let signature = Keyring::from_raw_public(tx.from.to_fixed_bytes()).unwrap().sign(&tx.encode()).into();
Extrinsic { transfer: tx, signature }
Extrinsic::Transfer(tx, signature)
}
#[test]
@@ -48,7 +48,7 @@ fn submit_transaction_should_not_cause_error() {
pool: Arc::new(Pool::new(Default::default(), ChainApi::new(client))),
subscriptions: Subscriptions::new(runtime.executor()),
};
let h: H256 = hex!("e10ad66bce51ef3e2a1167934ce3740d2d8c703810f9b314e89f2e783f75e826").into();
let h: H256 = hex!("81897a4890fb7554e7f77c533a865846a11583a56a8ad5e307543188d55e64f1").into();
assert_matches!(
AuthorApi::submit_extrinsic(&p, uxt(Keyring::Alice, 1).encode().into()),
@@ -68,7 +68,7 @@ fn submit_rich_transaction_should_not_cause_error() {
pool: Arc::new(Pool::new(Default::default(), ChainApi::new(client.clone()))),
subscriptions: Subscriptions::new(runtime.executor()),
};
let h: H256 = hex!("fccc48291473c53746cd267cf848449edd7711ee6511fba96919d5f9f4859e4f").into();
let h: H256 = hex!("9ec8469b5dcfe29cc274ac1d07ad73d80be57566ace0fcdbe51ebcf4b51e925b").into();
assert_matches!(
AuthorApi::submit_extrinsic(&p, uxt(Keyring::Alice, 0).encode().into()),
@@ -106,7 +106,7 @@ fn should_watch_extrinsic() {
to: Default::default(),
};
let signature = Keyring::from_raw_public(tx.from.to_fixed_bytes()).unwrap().sign(&tx.encode()).into();
Extrinsic { transfer: tx, signature }
Extrinsic::Transfer(tx, signature)
};
AuthorApi::submit_extrinsic(&p, replacement.encode().into()).unwrap();
let (res, data) = runtime.block_on(data.into_future()).unwrap();
@@ -116,7 +116,7 @@ fn should_watch_extrinsic() {
);
assert_eq!(
runtime.block_on(data.into_future()).unwrap().0,
Some(r#"{"jsonrpc":"2.0","method":"test","params":{"result":{"usurped":"0xed454dcee51431679c2559403187a56567fded1fc50b6ae3aada87c1d412df5c"},"subscription":1}}"#.into())
Some(r#"{"jsonrpc":"2.0","method":"test","params":{"result":{"usurped":"0x53daed816610aa6b22dedbcee43aba44a7ca7155cc71f2919c5e79ebbc7de58c"},"subscription":1}}"#.into())
);
}