-
Notifications
You must be signed in to change notification settings - Fork 6
python ss58 conversion #143
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
Open
thewhaleking
wants to merge
3
commits into
feat/thewhaleking/distribute-runtime
Choose a base branch
from
feat/thewhaleking/python-ss58-conversion
base: feat/thewhaleking/distribute-runtime
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
python ss58 conversion #143
thewhaleking
wants to merge
3
commits into
feat/thewhaleking/distribute-runtime
from
feat/thewhaleking/python-ss58-conversion
Conversation
This file contains hidden or 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
ibraheem-abe
approved these changes
Jun 27, 2025
basfroman
approved these changes
Jun 27, 2025
Comment on lines
+1005
to
+1013
if self.decode_ss58: | ||
try: | ||
type_str_int = int(type_string.split("::")[1]) | ||
decoded_type_str = runtime.type_id_to_name[type_str_int] | ||
obj = convert_account_ids( | ||
obj, decoded_type_str, runtime.ss58_format | ||
) | ||
except (ValueError, KeyError): | ||
pass |
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.
hacky logic :D
Comment on lines
+125
to
+128
for (kts, vts), (dk, dv) in zip( | ||
zip(pre_decoded_key_types, pre_decoded_value_types), | ||
zip(decoded_keys, decoded_values), | ||
): |
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.
for kts, vts, dk, dv in zip(
pre_decoded_key_types,
pre_decoded_value_types,
decoded_keys,
decoded_values,
):
wouldn't it be the same logic with a more elegant look?
looks like this is optimization too. no?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
This is not a breaking change, as we only do the convesion if
SubstrateInterface.decode_ss58
is set toTrue
(it isFalse
by default)Converts all AccountID bytes tuples to SS58.
Resolves #61
Based on #141
Speed concerns: when tested with the following:
Results were 107 seconds for
decode_ss58=True
and 111 seconds fordecode_ss58=False
. I don't think the added SS58 decoding makes it slower, and I think the minor difference in time can be explained by network imperfection. However, I will say this shows it should not run any slower (real world).