Skip to content
This repository was archived by the owner on Jul 4, 2022. It is now read-only.

Commit 93690e4

Browse files
authored
Merge 1.0.0 rc4.1 (#130)
* Bump doughnut-rs to fix doughnut extrinsic decoding
1 parent 4bf79f4 commit 93690e4

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frame/executive/tests/doughnut_integration.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//!
1818
#![cfg(test)]
1919
use pallet_balances::Call as BalancesCall;
20-
use codec::{Encode};
20+
use codec::{Decode, Encode};
2121
use prml_doughnut::{DoughnutRuntime, PlugDoughnut, error_code};
2222
use sp_core::{crypto::UncheckedFrom, H256};
2323
use sp_keyring::AccountKeyring;
@@ -544,3 +544,35 @@ fn delegated_dispatch_fails_with_bad_argument() {
544544
assert_eq!(r, Ok(Err(DispatchError::Other("dispatch unverified"))));
545545
});
546546
}
547+
548+
#[test]
549+
fn plug_extrinsic_decodes_with_doughnut() {
550+
// Integrationt test for doughnut + extrinsic codec, not Executive specific
551+
let issuer_alice: AccountId = AccountKeyring::Alice.into();
552+
let holder_bob: AccountId = AccountKeyring::Bob.into();
553+
554+
// The doughnut proof is wrapped for embeddeding in extrinsic
555+
let doughnut = PlugDoughnut::<Runtime>::new(
556+
make_doughnut(
557+
issuer_alice.clone(),
558+
holder_bob.clone(),
559+
None,
560+
None,
561+
true,
562+
)
563+
);
564+
565+
// Setup extrinsic
566+
let xt = CheckedExtrinsic {
567+
signed: Some((
568+
holder_bob.clone(),
569+
signed_extra(0, 0, Some(doughnut)),
570+
)),
571+
function: Call::Balances(BalancesCall::transfer(holder_bob.clone().into(), 69)),
572+
};
573+
let uxt = sign_extrinsic(xt);
574+
let encoded_extrinsic = uxt.encode();
575+
let decoded: UncheckedExtrinsic = Decode::decode(&mut &encoded_extrinsic[..]).expect("plug extrinsic with doughnut decodes ok");
576+
577+
assert_eq!(decoded, uxt);
578+
}

primitives/runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ log = { version = "0.4.8", optional = true }
2222
paste = "0.1.6"
2323
rand = { version = "0.7.2", optional = true }
2424
impl-trait-for-tuples = "0.1.3"
25-
doughnut = { package = "doughnut_rs", git = "https://github.com/cennznet/doughnut-rs", branch = "0.5.0", features = ["crypto"], default-features = false }
25+
doughnut = { package = "doughnut_rs", git = "https://github.com/cennznet/doughnut-rs", branch = "0.5.1", features = ["crypto"], default-features = false }
2626
sp-inherents = { version = "2.0.0-alpha.5", default-features = false, path = "../inherents" }
2727
parity-util-mem = { version = "0.6.0", default-features = false, features = ["primitive-types"] }
2828
hash256-std-hasher = { version = "0.15.2", default-features = false }

0 commit comments

Comments
 (0)