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

feat: Add SignatureBasedPaymaster contract #22

Merged
merged 5 commits into from
Mar 13, 2024

Conversation

hoshiyari420
Copy link
Contributor

Paymaster Description

Objective: Implement aSignatureBasedPaymaster contract that covers gas fees for users based on valid signature provided by the signer of the paymaster contract.

Changes introduced in this PR:

  • Adds SignatureBasedPaymaster contract.
  • Adds unit testing for SignatureBasedPaymaster matching repository standards.
  • Adds Deployment script for SignatureBasedPaymaster matching repository standards.
  • Updates script commands in package.json file
  • Updates readme file

Additional Information

Functionality:

  • This paymaster contract shall validate based on the signature provided through innerInputs whether or not the user's transaction shall be allowed to proceed or not.
  • The signer shall have authority to ensure signature is only valid upto particular timestamp.
  • The signature shall be EIP712 compliance which is signed on values like (user address, last timestamp, nonces).
  • Users are required to provide certain inputs such as signature and last timestamp as innerInputs in paymaster params.
  • The paymaster will then check signature based on transaction.from, block.timestamp and nonces to ensure only valid users are allowed to use paymaster.

Security Considerations:

  • Paymaster should use nonce for every user in validating signatures which increments on every successful transactions.
  • Paymaster should check expiry timestamp of signatures.
  • Paymaster should validate signatures based on transaction.from to ensure correct user has sent transaction.
  • Paymaster should revert if recovered signer does not match or signature expires.
  • Owner can update the paymaster signer.
  • Owner should be able to cancel any user's nonce.
  • EIP712 compliance signatures support.
  • Use of battle-tested standard libraries for ECDSA signature verification(Openzeppelin).

Copy link
Contributor

@dutterbutter dutterbutter 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 a great use case for paymaster usage and a fantastic external contribution. Thank you very much for the time and energy on this. 🚀 🙏

contracts/contracts/paymasters/SignatureBasedPaymaster.sol Outdated Show resolved Hide resolved
contracts/contracts/paymasters/SignatureBasedPaymaster.sol Outdated Show resolved Hide resolved
contracts/contracts/paymasters/SignatureBasedPaymaster.sol Outdated Show resolved Hide resolved
contracts/deploy/signatureBasedPaymaster.ts Outdated Show resolved Hide resolved
contracts/test/signatureBased.test.ts Outdated Show resolved Hide resolved
contracts/test/signatureBased.test.ts Outdated Show resolved Hide resolved
contracts/contracts/paymasters/SignatureBasedPaymaster.sol Outdated Show resolved Hide resolved
contracts/README.md Outdated Show resolved Hide resolved
contracts/test/signatureBased.test.ts Outdated Show resolved Hide resolved
@dutterbutter dutterbutter merged commit d3c313d into matter-labs:main Mar 13, 2024
1 check passed
@hoshiyari420
Copy link
Contributor Author

hoshiyari420 commented Mar 13, 2024

yay! 💫
Please do update the issue as well. #23 @dutterbutter

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