Skip to content

Conversation

@thewhaleking
Copy link
Contributor

I'm actually not quite sure how to add a test for this. But it resolves decoding an Extrinsic with the data

ScaleBytes("0x85028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01d8a8c7ab390badc106832ccb721d1acea313335db6c0bcd816c160a1c2784e3f41f503d08f321ab66aa3401e941737ebad721ea3db5c7bee784b87f9130fcc8e009c00001b000700c817a80402286bee0700902f50099228010001073b8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a4800")

given this metadata:
metadata.txt

@basfroman
Copy link

@arjanz pls take a look this PR

@arjanz
Copy link
Contributor

arjanz commented Oct 16, 2025

Confirmed, I created a unit test with data mentioned above and the patch fixed decoding of the extrinsic:

    def test_encode_with_bittensor_metadata(self):
        metadata_fixture_dict = load_type_registry_file(
            os.path.join(os.path.dirname(__file__), 'fixtures', 'metadata_hex.json')
        )

        metadata_decoder = RuntimeConfiguration().create_scale_object(
            'MetadataVersioned', data=ScaleBytes(metadata_fixture_dict["bittensor_test"])
        )

        metadata_decoder.decode()

        runtime_config = RuntimeConfigurationObject(implements_scale_info=True)
        runtime_config.update_type_registry(load_type_registry_preset("core"))
        runtime_config.add_portable_registry(metadata_decoder)

        extrinsic = runtime_config.create_scale_object(
            "Extrinsic",
            data=ScaleBytes("0x85028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01d8a8c7ab390badc106832ccb721d1acea313335db6c0bcd816c160a1c2784e3f41f503d08f321ab66aa3401e941737ebad721ea3db5c7bee784b87f9130fcc8e009c00001b000700c817a80402286bee0700902f50099228010001073b8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a4800"),
            metadata=metadata_decoder
        )

        extrinsic.decode()

        self.assertIsNotNone(extrinsic.value)

@arjanz arjanz changed the base branch from master to az-option-missing-metadata October 16, 2025 13:43
@arjanz arjanz merged commit e751481 into JAMdotTech:az-option-missing-metadata Oct 16, 2025
1 of 5 checks passed
arjanz added a commit that referenced this pull request Oct 16, 2025
* Missed passing `metadata=self.metadata` in `Option.process` (#134)

* Added extrinsic unit test
* Updated Python versions in Github Actions

---------

Co-authored-by: BD Himes <37844818+thewhaleking@users.noreply.github.com>
@arjanz
Copy link
Contributor

arjanz commented Oct 16, 2025

Patch released: https://pypi.org/project/scalecodec/1.2.12/

@thewhaleking
Copy link
Contributor Author

Patch released: https://pypi.org/project/scalecodec/1.2.12/

Wonderful. Thanks so much Arjan!

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

Successfully merging this pull request may close these issues.

3 participants