Skip to content
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

Add to_bytes to identity #1030

Merged
merged 1 commit into from
Oct 29, 2024
Merged

Add to_bytes to identity #1030

merged 1 commit into from
Oct 29, 2024

Conversation

jkilpatr
Copy link
Member

The get_hash and get_hash_array functions are unstable between rust versions due to changes in the internal hashing function. This patch adds deprecation tags to these functions and implements a to and from bytes representation for the Identity struct.

This is distinct from the Ethereum ABI functions, as the byte representation is entierly defined by the Identity struct and not the Ethereum standard. As such it's a lot more straightforward to implement.

The downside is that the new implementation is quite a bit larger than the old hash implementation at 68 bytes versus 8 bytes. But that's not really a big deal, for 5000 routers thats an extra 300MB of data used in indexing. Furthermore there's no risk of someone trying to generate an Identity with a hash collision.

@jkilpatr jkilpatr requested a review from ch-iara October 29, 2024 15:19
@jkilpatr jkilpatr force-pushed the jkilpatr/identity-to-from-bytes branch from b5f3f44 to 6f49ed2 Compare October 29, 2024 15:41
The get_hash and get_hash_array functions are unstable between rust
versions due to changes in the internal hashing function. This patch
adds deprecation tags to these functions and implements a to and from
bytes representation for the Identity struct.

This is distinct from the Ethereum ABI functions, as the byte
representation is entierly defined by the Identity struct and not the
Ethereum standard. As such it's a lot more straightforward to implement.

The downside is that the new implementation is quite a bit larger than
the old hash implementation at 68 bytes versus 8 bytes. But that's not
really a big deal, for 5000 routers thats an extra 300MB of data used in
indexing. Furthermore there's no risk of someone trying to generate an
Identity with a hash collision.
@jkilpatr jkilpatr force-pushed the jkilpatr/identity-to-from-bytes branch from 6f49ed2 to cde7bd8 Compare October 29, 2024 15:42
@jkilpatr jkilpatr merged commit cde7bd8 into master Oct 29, 2024
15 checks passed
@jkilpatr jkilpatr deleted the jkilpatr/identity-to-from-bytes branch October 29, 2024 19:11
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.

2 participants