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

Eth account support #361

Merged
merged 66 commits into from Jun 29, 2022
Merged

Eth account support #361

merged 66 commits into from Jun 29, 2022

Conversation

JulissaDantes
Copy link
Contributor

@JulissaDantes JulissaDantes commented Jun 14, 2022

Fixes #161

Including secp256k1(the curve use by ethereum to generate their key pair and address) signature verification methods and eth_execute.

Adds a Ethereum signer in the test signers.py, called TestEthSigner, and instead of storing public and private key, stores private key and address(the last 20 bytes of the public key).

The ethereum account preset contract stores the ethereum address instead of public key, as its internal public key, because a secp256k1 curve key pair public key is bigger than a felt, and also because the starkness verification method uses the Ethereum address instead of the public key so there was no point in changing the account library storages to include it, and never use it.

PR Checklist

  • Tests
  • Documentation
  • Changelog entry

@JulissaDantes JulissaDantes marked this pull request as draft June 14, 2022 19:55
@JulissaDantes JulissaDantes marked this pull request as ready for review June 15, 2022 19:42
@frangio
Copy link
Contributor

frangio commented Jun 16, 2022

I see that you kept uint256_hash_low, uint256_hash_high as part of the signature. Is this necessary? It would be a lot better to use the native transaction hash in tx_info.

Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

This is looking very good, I'm happy to see a better API for the Account library to support the multiple use cases people want to build.

I left some comments and requested changes

docs/Account.md Outdated Show resolved Hide resolved
tests/account/test_eth_Account.py Outdated Show resolved Hide resolved
src/openzeppelin/account/Account.cairo Show resolved Hide resolved
docs/Account.md Outdated Show resolved Hide resolved
docs/Account.md Outdated Show resolved Hide resolved
pedersen_ptr : HashBuiltin*,
range_check_ptr
}(eth_address: felt):
Account.initializer(eth_address)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we sanitize somehow?

tests/utils.py Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
tests/account/test_eth_Account.py Outdated 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.

This looks really good, @JulissaDantes! I left a couple of comments and piggybacked on @martriay's comments and questions a bit

tests/account/test_eth_Account.py Outdated Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
docs/Account.md Show resolved Hide resolved
src/openzeppelin/account/Account.cairo Show resolved Hide resolved
tests/utils.py Outdated Show resolved Hide resolved
JulissaDantes and others added 4 commits June 17, 2022 10:16
Co-authored-by: Andrew Fleming <fleming.andrew@protonmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
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.

@JulissaDantes these improvements look excellent! I left a few questions and suggestions, but I think we're super close!

src/openzeppelin/account/library.cairo Outdated Show resolved Hide resolved
tests/access/test_Ownable.py Outdated Show resolved Hide resolved
tests/account/test_EthAccount.py Outdated Show resolved Hide resolved
tests/account/test_EthAccount.py Outdated Show resolved Hide resolved
tests/account/test_EthAccount.py Show resolved Hide resolved
docs/Account.md Outdated Show resolved Hide resolved
src/openzeppelin/account/library.cairo Outdated Show resolved Hide resolved
JulissaDantes and others added 6 commits June 27, 2022 07: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>
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.

@JulissaDantes I left some super minor suggestions. Otherwise, this looks good to me! Great work :)

docs/Account.md Outdated Show resolved Hide resolved
tests/account/test_EthAccount.py Outdated Show resolved Hide resolved
tests/account/test_EthAccount.py Outdated Show resolved Hide resolved
tests/signers.py Outdated Show resolved Hide resolved
tests/signers.py Outdated Show resolved Hide resolved
Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

Looking good! Left very few comments, we're almost there :D

docs/Account.md Outdated Show resolved Hide resolved
docs/Account.md Outdated Show resolved Hide resolved
docs/Account.md Outdated Show resolved Hide resolved
docs/Account.md Outdated Show resolved Hide resolved
tests/account/test_EthAccount.py Outdated Show resolved Hide resolved
tests/signers.py Outdated Show resolved Hide resolved
JulissaDantes and others added 8 commits June 29, 2022 08:20
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
Co-authored-by: Martín Triay <martriay@gmail.com>
docs/Account.md Outdated Show resolved Hide resolved
docs/Account.md Outdated Show resolved Hide resolved
Co-authored-by: Martín Triay <martriay@gmail.com>
@martriay martriay merged commit 2cd6027 into OpenZeppelin:main Jun 29, 2022
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.

Add eth signature support to Account
6 participants