Skip to content

[WIP] feat(sdk): domain specific hashing for signature #26

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ogabrielides
Copy link
Collaborator

No description provided.

@ogabrielides ogabrielides changed the title feat: domain specific hashing for signature feat(sdk): domain specific hashing for signature May 14, 2025
Comment on lines +3 to +4
pub const SIG_PREFIX_GAS_PRICE_ATTESTATION: &[u8] = b"ATT_GAS_PRICE";
pub const SIG_VERSION_GAS_PRICE_ATTESTATION: u8 = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to separate prefix and version? Isn't it equal to have the version in the prefix like:

  • "ATT_GAS_PRICE" for version 0
  • "ATT_GAS_PRICE_1" for version 1

and so on?

pub const SIG_VERSION_RECEIPT_ATTESTATION: u8 = 1;

pub trait SigHashable {
fn hash_for_signature(&self) -> Hash;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it also take a network-specifc prefix like this

Suggested change
fn hash_for_signature(&self) -> Hash;
fn hash_for_signature(&self, network_prefix: &[u8]) -> Hash;

where this prefix would be different on each network (e.g. devnet, testnet, mainnet etc.) so that signatures signed for devnet cannot be re-used on other networks?

@ogabrielides ogabrielides marked this pull request as draft May 19, 2025 13:04
@ogabrielides
Copy link
Collaborator Author

ogabrielides commented May 19, 2025

@poszu marking this PR as draft, I need to implement an EIP712-aligned solution instead of a custom one. I will work on that soon

@ogabrielides ogabrielides changed the title feat(sdk): domain specific hashing for signature [WIP] feat(sdk): domain specific hashing for signature May 19, 2025
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