Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

provide blake2_512 in runtime or provide from_ss58check_with_version for runtime #6918

Description

@atenjin

In our situation, we submit a chain address(Substrate type) to runtime, and verify whether this address is valid.
But in Substrate, to verify the chain address should parse from ss58 and check the ss58version.
ss58 decode could be implemented in runtime, but check ss58version need blake2_512 hash.
and in sp-io, substrate provide:

[runtime_interface]
pub trait Hashing {
	/// Conduct a 256-bit Keccak hash.
	fn keccak_256(data: &[u8]) -> [u8; 32] {
		sp_core::hashing::keccak_256(data)
	}

	/// Conduct a 256-bit Sha2 hash.
	fn sha2_256(data: &[u8]) -> [u8; 32] {
		sp_core::hashing::sha2_256(data)
	}

	/// Conduct a 128-bit Blake2 hash.
	fn blake2_128(data: &[u8]) -> [u8; 16] {
		sp_core::hashing::blake2_128(data)
	}

	/// Conduct a 256-bit Blake2 hash.
	fn blake2_256(data: &[u8]) -> [u8; 32] {
		sp_core::hashing::blake2_256(data)
	}
//...
}

but not provide blake2_512.
If I provide blake2_512 or from_ss58check_with_version from my local runtime_interface, currently parachain could not support custom runtime_interface definition.

So substrate could provide balke2_512 in runtime for generic requirements?
or could provide AccountId32::from_ss58check_with_version for the situation which some one need to verify Substrate Address in runtime?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions