Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra type support for auto-test #102

Closed
flipchan opened this issue Aug 30, 2023 · 11 comments
Closed

extra type support for auto-test #102

flipchan opened this issue Aug 30, 2023 · 11 comments

Comments

@flipchan
Copy link
Collaborator

Need to detect the following types:
Currently we do not support all storage entry types

Raw Type: Variant(TypeDefVariant { variants: [Variant { name: "V1Ancient", fields: [], index: 0, docs: [] }, Variant { name: "V2", fields: [], index: 1, docs: [] }] })
Storage Item name "StorageVersion"
Storage Item type StorageValue
random input is: "not detected"




Pallet: "Grandpa"
Raw Type: Variant(TypeDefVariant { variants: [Variant { name: "Live", fields: [], index: 0, docs: [] }, Variant { name: "PendingPause", fields: [Field { name: Some("scheduled_at"), ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("N"), docs: [] }, Field { name: Some("delay"), ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("N"), docs: [] }], index: 1, docs: [] }, Variant { name: "Paused", fields: [], index: 2, docs: [] }, Variant { name: "PendingResume", fields: [Field { name: Some("scheduled_at"), ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("N"), docs: [] }, Field { name: Some("delay"), ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("N"), docs: [] }], index: 3, docs: [] }] })
Storage Item name "State"
Storage Item type StorageValue
random input is: "not detected"


Pallet: "System"
Raw Type: Variant(TypeDefVariant { variants: [Variant { name: "ApplyExtrinsic", fields: [Field { name: None, ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("u32"), docs: [] }], index: 0, docs: [] }, Variant { name: "Finalization", fields: [], index: 1, docs: [] }, Variant { name: "Initialization", fields: [], index: 2, docs: [] }] })
Storage Item name "ExecutionPhase"
Storage Item type StorageValue
random input is: "not detected"



Pallet: "System"
Raw Type: Sequence(TypeDefSequence { type_param: UntrackedSymbol { id: 45, marker: PhantomData<fn() -> core::any::TypeId> } })
Storage Item name "EventTopics"
Storage Item type StorageMap
random input is: "not detected"

Pallet: "System"
Raw Type: Sequence(TypeDefSequence { type_param: UntrackedSymbol { id: 18, marker: PhantomData<fn() -> core::any::TypeId> } })
Storage Item name "Events"
Storage Item type StorageValue
random input is: "not detected"
-------------------

-------------------
Pallet: "System"
Raw Type: Sequence(TypeDefSequence { type_param: UntrackedSymbol { id: 2, marker: PhantomData<fn() -> core::any::TypeId> } })
Storage Item name "ExtrinsicData"
Storage Item type StorageMap
random input is: "not detected"```
@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

Checking following:

-------------------
Pallet: "TransactionPayment"
Raw Type: Variant(TypeDefVariant { variants: [Variant { name: "V1Ancient", fields: [], index: 0, docs: [] }, Variant { name: "V2", fields: [], index: 1, docs: [] }] })
Storage Item name "StorageVersion"
Storage Item type StorageValue
Variant detected!
random input is: "not detected"
-------------------

Pallet: "Grandpa"
Raw Type: Tuple(TypeDefTuple { fields: [UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }] })
Storage Item name "Stalled"
Storage Item type StorageValue
tuple detected
random input is: "query_storage_map(Stalled)"
-------------------

Pallet: "Grandpa"
Raw Type: Variant(TypeDefVariant { variants: [Variant { name: "Live", fields: [], index: 0, docs: [] }, Variant { name: "PendingPause", fields: [Field { name: Some("scheduled_at"), ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("N"), docs: [] }, Field { name: Some("delay"), ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("N"), docs: [] }], index: 1, docs: [] }, Variant { name: "Paused", fields: [], index: 2, docs: [] }, Variant { name: "PendingResume", fields: [Field { name: Some("scheduled_at"), ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("N"), docs: [] }, Field { name: Some("delay"), ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("N"), docs: [] }], index: 3, docs: [] }] })
Storage Item name "State"
Storage Item type StorageValue
Variant detected!
random input is: "not detected"
-------------------





-------------------
Pallet: "System"
Raw Type: Variant(TypeDefVariant { variants: [Variant { name: "ApplyExtrinsic", fields: [Field { name: None, ty: UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, type_name: Some("u32"), docs: [] }], index: 0, docs: [] }, Variant { name: "Finalization", fields: [], index: 1, docs: [] }, Variant { name: "Initialization", fields: [], index: 2, docs: [] }] })
Storage Item name "ExecutionPhase"
Storage Item type StorageValue
Variant detected!
random input is: "not detected"
-------------------


-------------------
Pallet: "System"
Raw Type: Sequence(TypeDefSequence { type_param: UntrackedSymbol { id: 45, marker: PhantomData<fn() -> core::any::TypeId> } })
Storage Item name "EventTopics"
Storage Item type StorageMap
Type id is: TypeId { t: 18013183783749081848 }
found sequence!!
random input is: "not detected"
-------------------

-------------------
Pallet: "System"
Raw Type: Sequence(TypeDefSequence { type_param: UntrackedSymbol { id: 18, marker: PhantomData<fn() -> core::any::TypeId> } })
Storage Item name "Events"
Storage Item type StorageValue
Type id is: TypeId { t: 18013183783749081848 }
found sequence!!
random input is: "not detected"
-------------------


-------------------
Pallet: "System"
Raw Type: Sequence(TypeDefSequence { type_param: UntrackedSymbol { id: 2, marker: PhantomData<fn() -> core::any::TypeId> } })
Storage Item name "ExtrinsicData"
Storage Item type StorageMap
Type id is: TypeId { t: 18013183783749081848 }
found sequence!!
random input is: "not detected"
-------------------

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

cargo run --release -p uptest-examples --example generate_pallet_tests

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

Pallet: "Grandpa"
Raw Type: Tuple(TypeDefTuple { fields: [UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }] })
Storage Item name "Stalled"
Storage Item type StorageValue
Tuple typeid: TypeId { t: 15628237302830864633 }
tuple detected
random input is: "let Query_chain_state = Grandpa.Stalled(); // query the StorageValue"

nice

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

untracked symbol... , Now SUPPORTS UNTRACKED SYMBOLS!!

error[E0599]: no method named `ty` found for reference `&[scale_info::interner::UntrackedSymbol<TypeId>]` in the current scope
   --> examples/examples/generate_pallet_tests.rs:101:55
    |
101 |                 println!("Type: {:?}", value.fields().ty());
    |                                                       ^^ method not found in `&[UntrackedSymbol<TypeId>]`

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

nice tuple output:

Pallet: "Grandpa"
Raw Type: Tuple(TypeDefTuple { fields: [UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }, UntrackedSymbol { id: 4, marker: PhantomData<fn() -> core::any::TypeId> }] })
Storage Item name "Stalled"
Storage Item type StorageValue
Type definition of tuple output: 
tuple (
Primitive(U32)
Primitive(U32)
) // end of tuple
random input is: "let Query_chain_state = Grandpa.Stalled(); // query the StorageValue, output is a tuple of "
-------------------

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

Storage Variant storage entry support:

Pallet: "TransactionPayment"
Raw Type: Variant(TypeDefVariant { variants: [Variant { name: "V1Ancient", fields: [], index: 0, docs: [] }, Variant { name: "V2", fields: [], index: 1, docs: [] }] })
Storage Item name "StorageVersion"
Storage Item type StorageValue
Output could be any of the following:
"V1Ancient"
"V2"
random input is: "let Query_chain_state = TransactionPayment.StorageVersion(); // query the StorageValue "

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

todo: Sequence type

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

special storage value support

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

Pallet: "System"
Raw Type: Sequence(TypeDefSequence { type_param: UntrackedSymbol { id: 45, marker: PhantomData<fn() -> core::any::TypeId> } })
Storage Item name "EventTopics"
Storage Item type StorageMap
random input is: "let Query_chain_state = System.EventTopics(); // query the StorageMap | Sequence storage type"
-------------------
``` will work for now

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 1, 2023

lets mark that the sequence type as currently unstable

@flipchan
Copy link
Collaborator Author

flipchan commented Sep 4, 2023

#105

@flipchan flipchan closed this as completed Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant