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

SNIP 12 Utilities #935

Merged
merged 21 commits into from Mar 29, 2024
Merged

SNIP 12 Utilities #935

merged 21 commits into from Mar 29, 2024

Conversation

ericnordelo
Copy link
Member

@ericnordelo ericnordelo commented Mar 5, 2024

Fixes #409

PR Checklist

  • Tests
  • Documentation
  • Added entry to CHANGELOG.md
  • Tried the feature on a public network

@ericnordelo ericnordelo changed the title Feat/snip 12 SNIP 12 Utilities Mar 5, 2024
@ericnordelo ericnordelo marked this pull request as ready for review March 11, 2024 12:43
Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

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

Excellent start, Eric! I know we're still waiting on things to become finalized, but I left some initial feedback

docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
src/tests/mocks/snip12_mocks.cairo Outdated Show resolved Hide resolved
src/utils/cryptography/snip12.cairo Show resolved Hide resolved
docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
ericnordelo and others added 8 commits March 19, 2024 13:49
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>

#[starknet::interface]
trait INonces<TState> {
fn nonces(self: @TState, owner: ContractAddress) -> felt252;
Copy link
Contributor

Choose a reason for hiding this comment

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

i think felt252 might be just fine. but I wonder if you had any thoughts on using u256

Copy link
Member Author

Choose a reason for hiding this comment

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

felt252 should be cheaper than u256 even in the future if we have a smaller felt. As Ariel confirmed, I don't think fel252 will be removed, so for this case, it suits us better IMO.

Comment on lines +9 to +16
// selector!(
// "\"StarknetDomain\"(
// \"name\":\"shortstring\",
// \"version\":\"shortstring\",
// \"chainId\":\"shortstring\",
// \"revision\":\"shortstring\"
// )"
// );
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should just use the macro directly

Copy link
Member Author

Choose a reason for hiding this comment

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

More expensive step(gas)-wise for a constant thing.

src/utils/cryptography/snip12.cairo Show resolved Hide resolved
Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

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

I left a few tiny suggestions; otherwise, I think this is good to go (and fix changelog conflicts)! Nice work :)

docs/modules/ROOT/pages/guides/snip12.adoc Outdated Show resolved Hide resolved
src/tests/mocks/nonces_mocks.cairo Outdated Show resolved Hide resolved
src/tests/cryptography/test_snip12.cairo Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/utilities.adoc Show resolved Hide resolved
@ericnordelo ericnordelo merged commit b5413be into OpenZeppelin:main Mar 29, 2024
5 checks passed
@ericnordelo ericnordelo deleted the feat/snip-12 branch March 29, 2024 12:53
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.

EIP-712 / SNIP-12
3 participants