Custom RPC for Merkle Mountain Range pallet (#8137)

* Add MMR custom RPC.

* Change RuntimeApi to avoid hardcoding leaf type.

* Properly implement the new RuntimeAPI and wire up RPC.

* Extract Offchain DB as separate execution extension.

* Enable offchain DB access for offchain calls.

* Fix offchain_election tests.

* Skip block initialisation for proof generation.

* Fix integration test setup.

* Fix offchain tests. Not sure how I missed them earlier 🤷.

* Fix long line.

* One more test missing.

* Update mock for multi-phase.

* Address review grumbbles.

* Address review grumbles.

* Fix line width of a comment
This commit is contained in:
Tomasz Drwięga authored and GitHub committed 2021-03-10 15:28:56 +00:00
1 parent 9637faae0c
commit f3d4355a20
37 files changed
+837 -350

No files matched your search

@@ -22,7 +22,7 @@ use codec::Decode;
use frame_support::{assert_ok, parameter_types};
use sp_core::{
H256,
offchain::{OffchainExt, TransactionPoolExt, testing},
offchain::{OffchainWorkerExt, TransactionPoolExt, testing},
sr25519::Signature,
};
@@ -144,7 +144,7 @@ fn it_aggregates_the_price() {
fn should_make_http_call_and_parse_result() {
let (offchain, state) = testing::TestOffchainExt::new();
let mut t = sp_io::TestExternalities::default();
t.register_extension(OffchainExt::new(offchain));
t.register_extension(OffchainWorkerExt::new(offchain));
price_oracle_response(&mut state.write());
@@ -160,7 +160,7 @@ fn should_make_http_call_and_parse_result() {
fn knows_how_to_mock_several_http_calls() {
let (offchain, state) = testing::TestOffchainExt::new();
let mut t = sp_io::TestExternalities::default();
t.register_extension(OffchainExt::new(offchain));
t.register_extension(OffchainWorkerExt::new(offchain));
{
let mut state = state.write();
@@ -217,7 +217,7 @@ fn should_submit_signed_transaction_on_chain() {
let mut t = sp_io::TestExternalities::default();
t.register_extension(OffchainExt::new(offchain));
t.register_extension(OffchainWorkerExt::new(offchain));
t.register_extension(TransactionPoolExt::new(pool));
t.register_extension(KeystoreExt(Arc::new(keystore)));
@@ -255,7 +255,7 @@ fn should_submit_unsigned_transaction_on_chain_for_any_account() {
.clone();
let mut t = sp_io::TestExternalities::default();
t.register_extension(OffchainExt::new(offchain));
t.register_extension(OffchainWorkerExt::new(offchain));
t.register_extension(TransactionPoolExt::new(pool));
t.register_extension(KeystoreExt(Arc::new(keystore)));
@@ -308,7 +308,7 @@ fn should_submit_unsigned_transaction_on_chain_for_all_accounts() {
.clone();
let mut t = sp_io::TestExternalities::default();
t.register_extension(OffchainExt::new(offchain));
t.register_extension(OffchainWorkerExt::new(offchain));
t.register_extension(TransactionPoolExt::new(pool));
t.register_extension(KeystoreExt(Arc::new(keystore)));
@@ -349,7 +349,7 @@ fn should_submit_raw_unsigned_transaction_on_chain() {
let keystore = KeyStore::new();
let mut t = sp_io::TestExternalities::default();
t.register_extension(OffchainExt::new(offchain));
t.register_extension(OffchainWorkerExt::new(offchain));
t.register_extension(TransactionPoolExt::new(pool));
t.register_extension(KeystoreExt(Arc::new(keystore)));