Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
da550a7
metadata-ir: Add extrinsic type info to decode address, call, sig
lexnv May 11, 2023
a51ea7b
frame-metadata: Point to unreleased branch
lexnv May 11, 2023
888ce4a
metadata-ir: Include addrees, call, signature in V15 conversion
lexnv May 11, 2023
49995b4
metadata-ir: Include extra ty
lexnv May 11, 2023
0babb53
construct_runtime: Extract address,call,sig,extra ty from tx type
lexnv May 11, 2023
768c515
frame/tests: Check metadata populates xt types correctly
lexnv May 11, 2023
ab66814
metadata-ir/tests: Add extra fields on ExtrinsicMetadataIR
lexnv May 11, 2023
52f1480
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
lexnv May 11, 2023
6610ac2
primitives/traits: Expand the `Extrinsic::SignaturePayload`
lexnv May 15, 2023
25617e0
primitives: Adjust to new `Extrinsic` associated types
lexnv May 15, 2023
10bbe10
frame/metadata: Simplify metadata generation
lexnv May 15, 2023
b823f5c
frame/example: Adjust to new interface
lexnv May 15, 2023
a94cd09
frame/tests: Adjust `extrinsic_metadata_ir_types`
lexnv May 16, 2023
1f17361
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
lexnv May 29, 2023
86e39c1
Revert the additional Extrinsic' associated types
lexnv May 29, 2023
903ebd7
primitives: Add `SignaturePayload` marker trait
lexnv May 29, 2023
37f6a09
primitives: Implement SignaturePayload for empty tuple
lexnv May 29, 2023
16b81b6
Adjust to new SignaturePayload trait
lexnv May 29, 2023
cd5c0a3
tests: Adjust `extrinsic_metadata_ir_types` to new interface
lexnv May 29, 2023
60db7bc
frame/support: Adjust pallet test
lexnv May 29, 2023
6e4f749
frame: Add Extrinsic length prefix to the metadata
lexnv May 30, 2023
0ad90f3
primitives: Populate `ExtrinsicMetadataIR` with `len_ty`
lexnv May 30, 2023
7d55ba1
Update primitives/runtime/src/traits.rs
lexnv Jun 2, 2023
03383be
Apply cargo fmt
lexnv Jun 2, 2023
0e87313
v15: Remove len type of the extrinsic
lexnv Jun 2, 2023
2c307b8
cargo: Update frame-metadata
lexnv Jun 2, 2023
e183783
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
lexnv Jun 2, 2023
1747586
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
Jun 5, 2023
9fd69cd
Merge remote-tracking branch 'origin/master' into lexnv/extrinsic_dec…
lexnv Jun 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
frame/tests: Adjust extrinsic_metadata_ir_types
Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv committed May 16, 2023
commit a94cd09bec8c1c16d8a0f1d009c30a98c0c81b37
29 changes: 9 additions & 20 deletions frame/support/test/tests/pallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::collections::HashMap;

use frame_support::{
assert_ok,
dispatch::{
Expand All @@ -38,7 +36,7 @@ use sp_io::{
hashing::{blake2_128, twox_128, twox_64},
TestExternalities,
};
use sp_runtime::{DispatchError, ModuleError};
use sp_runtime::{traits::Extrinsic as ExtrinsicT, DispatchError, ModuleError};

parameter_types! {
/// Used to control if the storage version should be updated.
Expand Down Expand Up @@ -1709,26 +1707,17 @@ fn metadata_ir_pallet_runtime_docs() {
fn extrinsic_metadata_ir_types() {
let ir = Runtime::metadata_ir().extrinsic;

// `TestXt` used to construct the runtime exposes only the `Call` and `Extra` types.
// In contrast, substrate chains expose: `Address`, `Call`, `Signature` and `Extra` types.
// Any missing type is populated with the tuple type.
let params: HashMap<_, _> = ir
.ty
.type_info()
.type_params
.iter()
.map(|ty_param| (ty_param.name, ty_param.ty.expect("Type params are populated")))
.collect();
assert_eq!(meta_type::<<UncheckedExtrinsic as ExtrinsicT>::SignatureAddress>(), ir.address_ty);
assert_eq!(meta_type::<u64>(), ir.address_ty);

assert!(params.get("Address").is_none());
let call_ty = params.get("Call").expect("Type `Call` must be present in the extrinsic");
assert!(params.get("Signature").is_none());
let extra_ty = params.get("Extra").expect("Type `Extra` must be present in the extrinsic");
assert_eq!(meta_type::<<UncheckedExtrinsic as ExtrinsicT>::Call>(), ir.call_ty);
assert_eq!(meta_type::<RuntimeCall>(), ir.call_ty);

assert_eq!(meta_type::<()>(), ir.address_ty);
assert_eq!(call_ty, &ir.call_ty);
assert_eq!(meta_type::<<UncheckedExtrinsic as ExtrinsicT>::Signature>(), ir.signature_ty);
assert_eq!(meta_type::<()>(), ir.signature_ty);
assert_eq!(extra_ty, &ir.extra_ty);

assert_eq!(meta_type::<<UncheckedExtrinsic as ExtrinsicT>::SignatureExtra>(), ir.extra_ty);
assert_eq!(meta_type::<frame_system::CheckNonZeroSender<Runtime>>(), ir.extra_ty);
}

#[test]
Expand Down