-
Notifications
You must be signed in to change notification settings - Fork 56
Metadata v12/refCount size change + misc fixes, improvements #41
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
Conversation
The serialization of BigIntegers may include an extra zero byte as prefix when the first byte is > 127, to act as a sign bit and distinguish it from a negative value. We only deal with unsigned values, so we must ignore that initial zero byte. Ref: https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html#toByteArray%28%29 This should fix #32
Additionally, add missing era() and eraBlockHash() methods to the ExtrinsicContext.Builder class. Ref: https://github.com/paritytech/substrate/commits/master/primitives/runtime/src/generic/era.rs (at dbf2163250833e6ac898e7f6c3c8f89f08a7c19d)
Ref: https://github.com/paritytech/polkadot/releases/tag/v0.8.25 Substrate PR: paritytech/substrate#6969 Should fix: - #30 - #39 Metadata obtained from Kusama network at hash: 0x318f1c8b14fdc9d9624a85b90eb3b2475ac1d19c7dcfcd9fbff25a26ed56f5d0 (Height 4,909,958)
Ref: https://github.com/paritytech/polkadot/releases/tag/v0.8.25 Substrate PR: paritytech/substrate#7164 Should fix: - #29 Related: - polkadot-js/api#2635
Codecov Report
@@ Coverage Diff @@
## master #41 +/- ##
============================================
+ Coverage 86.53% 86.80% +0.27%
- Complexity 872 887 +15
============================================
Files 111 113 +2
Lines 2903 2949 +46
Branches 423 429 +6
============================================
+ Hits 2512 2560 +48
Misses 278 278
+ Partials 113 111 -2
Continue to review full report at Codecov.
|
|
@pablojorge thank you very much for the PR, it fixes few very critical issues. I've checked the commit, everything is good. The only thing I would comment on is having the Era codec as method in Scale Reader/Writer. I prefer to use the main scale class to provide methods only for basic and common types, and use a generic method ( |
|
Sure! We're glad to contribute! Regarding the Era codec, yes, maybe adding the methods wasn't really necessary, will have in mind that if we add more |
|
can you give all of the projects jar or the download url |
|
Hey guys, where is the metadata found (text file for test)? I can get support for new metadata version (13) |
Intro
This PR adds support for newer versions of Polkadot and introduces several improvements and fixes.
Changes
Support for Metadata v12 and refcount size change
In Polkadot v0.8.25 (https://github.com/paritytech/polkadot/releases/tag/v0.8.25), the metadata was updated to v12 (to include a new
indexfield for modules) and therefcountfield ofAccountInfowas extended from 8 to 32 bits.Commits:
References:
Related issues:
Fixes
CompactBigIntWriter fix
The following commit fixes the serialization of CompactBigInts when the MSB is > 127, and the resulting byte array starts with an extra 0x00 (to signal it's a positive value):
Related issues:
Mortal era encoding fix
The following commit fixes the serialization of Mortal eras on both the signature payload and the transaction info of the extrinsic:
Additionally, it extends the
ExtrinsicContext.Builderclass to allow setting theeraanderaBlockHashfields.Improvements
The PR also extends the
PolkadotHttpApiconstructor and builder to accept atimeoutparameter, and extends theRpcExceptionclass to include thedatafield from JSON error responses.Commits: