-
Notifications
You must be signed in to change notification settings - Fork 248
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
Generate runtime API from metadata #294
Merged
Merged
Changes from 174 commits
Commits
Show all changes
219 commits
Select commit
Hold shift + click to select a range
f43df0e
Remove test macro
ascjones 01b7131
Remove client crate
ascjones ff6b9fc
Create tests crate and move pallet specific tests there
ascjones d7c1d22
Extract client, remove metadata and extra, more demolition
ascjones b755c29
Update substrate dependencies to git dependencies
ascjones 05fe051
Remove Store stuff for now
ascjones 5e91406
Comment out some Call usages
ascjones 59aa4d7
Add back Runtime trait coped from original System trait
ascjones e337d34
Make subxt lib compile
ascjones 8540533
Delete old proc macros and copy over type generation from chameleon
ascjones e917dac
WIP make transfer balance test pass
ascjones 2ef017d
Change to subxt attribute macro
ascjones f3005cb
WIP provide user defined type substitutes
ascjones e4f1374
User defined type substitutes compile
ascjones b98b7aa
WIP submitting transactions
ascjones e20f123
WIP transfer balance test
ascjones 2cf09c1
Fix macro
ascjones 56cb2a6
Cargo fmt
ascjones c35d781
WIP generating storage hashers
ascjones 4726db3
WIP add AccountData trait for fetching the nonce
ascjones f8f8b47
Support single type storage map keys
ascjones 4b573f5
WIP impl AccountInfo retrieval
ascjones a6e7225
Fix up storage struct generation
ascjones d2bd669
Implement AccountData triait directly on storage entry
ascjones 11248d0
Borrow storage map key and convert account id
ascjones b9ad905
Implement storage fetch client methods
ascjones f98d95a
Remove legacy metadata storage key construction
ascjones a8ca64a
Rename CheckEra to CheckMortality
ascjones 9eac486
Substitute perthings types for compact impls
ascjones a5281fc
Fmt
ascjones bbb4530
Downgrade dyn-clone for cargo-contract compat
ascjones 2d7bed8
Scale-fo 1.0
ascjones 8ab7976
scale-info 1.0
ascjones 6ac3f42
Remove special range handling
ascjones c935dc1
Restore wildcard type params
ascjones 13f69a3
Frame metadata 14.0
ascjones af7c4ce
WIP decoding events
ascjones 4e47acd
WIP more dynamically decoding events
ascjones 7e2ed94
Fmt
ascjones a2bb550
Decode events, handle errors
ascjones 0b233e0
Uncomment some tests
ascjones 09c5888
Remove unused get_mod function
ascjones 93c121d
Fix some warnings
ascjones a503911
Fix some more warnings
ascjones b362dfd
Fix some more warnings
ascjones 8357031
Add tests mod
ascjones e5333f1
Rename node-runtime tests mod to frame
ascjones 5405fb7
Fix some warnings
ascjones 1034b68
Fmt
ascjones 8556bc0
WIP generate storage client with getters
ascjones ed0d1bc
Storage client compiling
ascjones 327a215
Generate storage client api
ascjones e70534e
Fix up system account query account ids
ascjones d75d1f0
WIP generating tx api fns
ascjones 634f21f
Only generate tx api fields when calls available
ascjones cedf27e
Fix tx api call fns
ascjones 690e079
Fmt
ascjones b82d4e8
WIP generate event structs
ascjones 8342c31
call functions not async
ascjones 4cb16a3
Derive Eq for comparison on generated types
ascjones 97308a9
Generate event structs
ascjones f8f2da6
Fix call name
ascjones 4d0e392
Fmt
ascjones a264cf3
Update node runtime metadata to substrate c000780db
ascjones 2eb657a
Download latest substrate release for integration testing
ascjones c89791f
Fix event decoding
ascjones 537c633
Remove unused imports
ascjones 73490a3
Fix plain storage access, total_issuance pass
ascjones 4ab94d5
Fmt
ascjones 9a6c98c
Restore contracts tests
ascjones 599863e
Backoff connecting to substrate node
ascjones b99685a
Add required TypeInfo impls for local SignedExtension impls
ascjones f3ae886
Remove unnecessary assert formatting
ascjones a5c51af
Fix handling of DispatchError
ascjones 92f8665
Refactor contracts tests
ascjones 7da7f56
Troubleshooting contract not found
ascjones 01558f5
Remove more client feature stuff
ascjones 0203365
Fix dynamic event variant decoding, write consumed index to output
ascjones 184c096
Fmt
ascjones e778231
Use substrate branch with heavy dependency removed
ascjones ba71cc0
Remove sp-rcp dependency, define types locally
ascjones cadb26f
Ignore cargo timeing files
ascjones 2766b40
Use my branch for substrate test deps
ascjones 1b04411
Fix storage key type gen
ascjones af1ec84
Comment out fetching contract info
ascjones bbad328
Merge branch 'master' into aj-metadata-vnext
ascjones c8ebd1c
Add key iteration, extract storage client from main client
ascjones 0cf8ec7
Debugging key generation
ascjones d68e7dd
Use substrate master branch
ascjones a6f8eb4
Fix call test
ascjones 20aee21
Remove TypeSegmenter and dynclone dependency
ascjones 3de2815
Publicly expose Rpc mod
ascjones c5ef0fa
Unused import warnings
ascjones b2f0ddf
Add getter for runtime metadata
ascjones e8256e0
Add pallet and event indices for raw events
ascjones d0dda23
Add is_call and is_event convenience trait functions
ascjones 6198ac2
Add missing docs
ascjones cbbf0e1
Refactor tests crate
ascjones 76d7b11
Restore remaining client tests
ascjones c86a9ce
Fmt
ascjones d439722
Fix warnings
ascjones 997d6b7
Restore get_mod as test helper and fmt
ascjones 44ec197
Use client references for api calls
ascjones 950845f
Fix api usages with methods
ascjones 3cb4000
Use Bytes for RawEvent debug
ascjones 602f62b
Update metadata
ascjones 4d1de1b
Restoring some Balances tests
ascjones 384f88e
Populate runtime storage metadata
ascjones b340bc2
Restore balances lock test
ascjones f1b7b85
Restore Balances error test
ascjones ec90ecc
Fmt
ascjones e4907d4
Restore transfer subscription API
ascjones bab2aef
Staking test
ascjones 696ee63
Restore another staking test
ascjones 560ceb5
Restore another staking test
ascjones c5915b9
Restore another staking test
ascjones 5e9b7d2
Partially restore chill_works_for_controller_only staking test
ascjones 34e1da5
Fix fetching Optional storage entries
ascjones 442fe24
Restore staking bond test
ascjones 35a3141
Restore remaining staking tests
ascjones 83af04e
Fmt
ascjones b95ce3d
Restore sudo tests
ascjones 79355d3
Add some system tests
ascjones 5e7b7e7
Fmt
ascjones 368ec3b
Resolve some todos
ascjones f819cb6
Remove pass through rpc methods on Client, expose via rpc() getter
ascjones 903b153
Remove more rpc pass through methods
ascjones d984dd5
Remove submit tx pass through rpc methods
ascjones a9d1e8f
Add some comments to SubmittableExtrinsic methods
ascjones ccb1491
Construct the runtime api from the client
ascjones ffc1a3c
Fmt
ascjones f46c944
Use From trait instead of new for AccountData query
ascjones f834035
Rename subxt_proc_macro crate to subxt_macro
ascjones fc80bb0
Fix AccountData From impl
ascjones 72dc1f9
Extract codegen crate from macro crate
ascjones 6563914
Fmt
ascjones c66ac9f
Replace chameleon hidden field name
ascjones 7594bc5
Extract StructDef for generating structs
ascjones d0b0bb1
More refactoring of StructDef, moving towards sharing with typegen
ascjones 2c2dd9f
Replace explicit tests crate with single implicit integration tests c…
ascjones 7d9884d
Rename from substrate-subxt to subxt
ascjones cc0212d
Fix runtime path relative to root Cargo.toml
ascjones ea4666f
Move RpcClient creation to RpcClient
ascjones 851f612
WIP get examples to compile
ascjones 69e6ed6
Rename Runtime to Config trait
ascjones a30f9f8
WIP implementing default Config
ascjones d5bec8c
WIP implementing default extrinsic extras
ascjones 567ce0e
fix metadata constants (#299)
paulormart a672dc4
Move DefaultConfig definition and impl to macro
ascjones 518c028
Extract type substitute parsing to ir mod
ascjones 699ce18
Extract calls, events and storage from api generation
ascjones 021c186
Add some hardcoded type substitute defaults
ascjones 99a83c7
Fmt
ascjones 27c5b92
Add utility pallet tests (#300)
paulormart 4df1313
Add polkadot runtime metadata for example
ascjones da5bb8d
Merge branch 'aj-metadata-vnext' of github.com:paritytech/substrate-s…
ascjones c2e7ab7
Fix system errors and fmt
ascjones 8108f00
Add subxt-cli crate
ascjones fd18fcd
Add metadata and codegen subcommands
ascjones 643c8f8
Make subxt-cli codegen command work
ascjones 77ae552
Fmt
ascjones a0447ff
Add polkadot codegen test
ascjones 562b593
Comment about how to run codegen
ascjones 398c63c
Derive AsCompact for structs with single concrete unsigned int field
ascjones 192fa39
Fix bitvec codegen, adds as non optional dependency
ascjones adf8ebd
Regenerate polkadot api with bitvec fix
ascjones e430d1b
Edition 2021
ascjones 90312bd
Fix polkadot codegen with bitvec
ascjones b2d04bb
Polkadot balance transfer is working
ascjones d1566e8
Fix fetch remote
ascjones 927aa00
Fix transfer_subscribe example
ascjones b26cd2f
Fix submit_and_watch example
ascjones 091b255
Fmt
ascjones cdb881e
Generate storage iter method for iterating over keys
ascjones da71f69
Fmt
ascjones 23be116
Fix existential deposit test
ascjones 9d8c9a1
Fix staking tests
ascjones b500ac4
Add option for custom generated type derives
ascjones 43f59e4
Add generated type derives for test runtime api
ascjones c19d2e6
Fmt
ascjones 1fd0d5f
Copy WrapperTypeOpaque from substrate, add Encode/Decode
ascjones 0c45452
Fmt
ascjones 57f7a0b
Extract type generator to module, separate & fix tests
ascjones 4b45985
Fully qualified primitive and prelude types
ascjones 7caec49
Fix up remaining type gen tests
ascjones d4a4ce0
Skip formatting of generated polkadot example code
ascjones cc1fdab
Remove empty utility test file.
ascjones b570e39
Newline
ascjones 9fd9540
Update cli/src/main.rs
ascjones 4657b57
Rename subxt-cli executable to subxt
ascjones 36d5e57
Update src/client.rs
ascjones d250904
Merge remote-tracking branch 'origin/aj-metadata-vnext' into aj-metad…
ascjones 9818d0d
Add some code docs to TypeGenerator.
ascjones 13915e2
Extract TypePath to own file
ascjones 69ee2da
Extract type def generation to separate file
ascjones e8a8376
Renamed ModuleType to TypeDefGen
ascjones 4f3de30
Fmt
ascjones 1d1fffe
Factor out type parameter from final_key
ascjones b301a85
Fix some type paths
ascjones c1f6d53
Resolve some todos
ascjones a97fb2e
Resolve some panic todos in events
ascjones d58834b
Add EventsDecodingError
ascjones d0f5e69
Decode compact composite types with a single primitive field
ascjones 9da0bcc
Decode compact composite types with a single primitive field
ascjones 346504b
Update src/metadata.rs
ascjones 2f36a89
Remove Perbill compact substitute types
ascjones 6306b9f
Remove todos regarding maintaining Rust code items, promoted to follo…
ascjones 5dd6cf9
Remove todo regarding overridding default config impl
ascjones fc30e90
Remove todo regarding overridding default Extra
ascjones 63bb5ea
Remove todo regarding AccountData storage type defintion
ascjones 84fe1a0
Remove todo regarding borrowing storage key arguments
ascjones 6886f4c
Remove type substitution tests todo
ascjones 63641b4
Remove `Box` field name type hack todo
ascjones ba2e3a8
Remove Compact todo
ascjones 06a6ddf
Remove sudo todos
ascjones 0d07b0c
Remove BitVec implementation todo
ascjones f0bb889
Fmt
ascjones 2c93f3c
Add health warning to README
ascjones 641ac27
Fix up health warning
ascjones File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/target | ||
**/*.rs.bk | ||
Cargo.lock | ||
cargo-timing* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[package] | ||
name = "subxt-cli" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
# perform subxt codegen | ||
subxt-codegen = { version = "0.1.0", path = "../codegen" } | ||
# parse command line args | ||
structopt = "0.3.25" | ||
# make the request to a substrate node to get the metadata | ||
ureq = { version = "2.2.0", features = ["json"] } | ||
# colourful error reports | ||
color-eyre = "0.5.11" | ||
# serialize the metadata | ||
serde = { version = "1.0.130", features = ["derive"] } | ||
# serialize as json | ||
serde_json = "1.0.68" | ||
# hex encoded metadata to bytes | ||
hex = "0.4.3" | ||
# actual metadata types | ||
frame-metadata = { version = "14.0.0", features = ["v14", "std"] } | ||
# decode bytes into the metadata types | ||
scale = { package = "parity-scale-codec", version = "2.3.0", default-features = false } | ||
# handle urls to communicate with substrate nodes | ||
url = { version = "2.2.2", features = ["serde"] } | ||
# generate the item mod for codegen | ||
syn = "1.0.80" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So these could be using the published versions (if the
4.0.0
crates were released)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. When released. And we can't release this until they are, so hope that is coming soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ascjones are you saying that this pr can't be merged until v4.0.0 of the substrate crates are released? Why can't we use
polkadot-v0.9.11
? This is what I use in my fork of this PR, and seems to compile just fine. Also, I assume the connected parachain will also need to be updated to v4.0.0 for this to work? Will this be a major breaking change?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sander2 we can definitely merge this (indeed I'm typing this after it's merged) but we can't publish to crates.io with git dependencies, this is what Andrew means by "releasing" here. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, most people will be using polkadot-v0.9.12 for their parachain. I suggest we do the same for subxt. Or at least maintain a different branch that follows the latest polkadot releases.