-
Notifications
You must be signed in to change notification settings - Fork 128
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
Increase AVAX support and add AVAXC #340
Conversation
AVAX uses bech32 for its X & P chains. A valid address format includes the 'X-' or 'P-' ID prepended to the address. This adds a custom decoder to strip the ID and decode the leftover address with bech32. Change is backwards compatible with existing functionality.
The Avalanche C-Chain (AVAXC) uses the EVM addressing system. That being said, on Avalanche, it is valid to have the chain ID prepended to the address. This decoder does some preparsing to strip the ID and pass the leftover address to a decoder.
Tried to keep the changes very tight in each commit, if the team wants any of them cut out let me know |
Thank you for your contribution. Any reason why |
Packages automatically updated when I did the package install. Happy to revert that commit. |
yes, that would be great |
So, I've reverted the package updates and was getting an error in the Travis tests. Tried merging in master with no success. Eventually I cloned the branch that #341 was based on and ran the tests locally with the same error result we are seeing here in Travis. My local result:
And the direct link to Travis result for this PR It looks like the Travis tests may not have been run for #341? @SeqSEE @makoto How would you like to proceed on getting this sorted out? |
@@ -1550,7 +1574,8 @@ export const formats: IFormat[] = [ | |||
hexChecksumChain('GO_LEGACY', 6060), | |||
bech32mChain('XCH', 8444, 'xch', 90), | |||
getConfig('NULS', 8964, nulsAddressEncoder, nulsAddressDecoder), | |||
bech32Chain('AVAX', 9000, 'avax'), | |||
getConfig('AVAX', 9000, makeBech32Encoder('avax'), makeAvaxDecoder('avax')), |
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.
Can you verify only X and P prefixes are allowed?
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.
Based on the documentation (https://support.avax.network/en/articles/4596397-what-is-an-address), X or P are allowed and are technically separate chains using the same addressing format (besides the prefix).
There seems to be a new feature, the chainId
can be used instead of an alias:
Same address, using the chainID instead of the chain alias:
11111111111111111111111111111111LpoYY-avax1kj06lhgx84h39snsljcey3tpc046ze68mek3g5
Is this something you would like to see supported too?
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.
Well spotted about chainId
. Is it something we can verify the format or it can be anything?
@@ -1550,7 +1574,8 @@ export const formats: IFormat[] = [ | |||
hexChecksumChain('GO_LEGACY', 6060), | |||
bech32mChain('XCH', 8444, 'xch', 90), | |||
getConfig('NULS', 8964, nulsAddressEncoder, nulsAddressDecoder), | |||
bech32Chain('AVAX', 9000, 'avax'), | |||
getConfig('AVAX', 9000, makeBech32Encoder('avax'), makeAvaxDecoder('avax')), | |||
getConfig('AVAXC', 9005, makeChecksummedHexEncoder(), makeAvaxcDecoder()), |
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.
Can you verify only C-prefix is allowed?
Also, please use ChainID for EVM compatible chains instead of SLIP44 cointype? Please see https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution for more detail. You should be able to make use of convertEVMChainIdToCoinType(chainId)
which I explained at https://medium.com/the-ethereum-name-service/improved-ens-support-for-evm-compatible-chains-19fc86e9722b (but probably have to strip C- off/back in when storing)
I didn't notice that MXR PR didn't run CI test. I will revert at #343 |
My comment is a bit scattered so here is the summary
Please let me know if you have any questions. |
Issue number
Missing X- and P- identity stripping as highlighted in #294
Description
Two changes are included:
X-
orP-
identifier prependedC-
identifier strippingReference to the specification
Reference to the test address.
Both addresses were pulled from transactions on the Avalanche blockchain explorer: https://explorer.avax.network/
List of features added/changed
How much has the filesize increased?
Before: 410838
After: 411043
Difference: 205 bytes
How Has This Been Tested?
Added to the existing unit test vectors for AVAX and new vectors for AVAXC
Checklist: