Open
Conversation
…off-chain signers; TODO: add view fns for nonces and domain separator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2
Introduces permit-based approvals, which allow a user to approve an allowance via an off-chain signature, rather than using
approve()directly. This is inspired by EIP-2612 but is modified to fit Dusk’s crypto and ABI. In particular we don’t use EIP-712, and BLS and the hash function are used for signing and verification respectively.What was added
permit(PermitCall)- Setsallowance(owner, spender) = valueif thePermitCallcontains a valid BLS signature fromownerover a deterministic digest ofowner,spender,value,nonce, anddeadline.permit_nonces(owner) -> u64domain_separator() -> BlsScalarWhy not EIP-712?
EIP-2612 which introduces permit based approval, uses a signed message with a hash of typed structured data, which is computed via EIP-712. In this implementation we don’t use EIP-712. This is because:
secp256k1, and so the signing scheme and encoding are different.abi::hash. This is used off-chain to compute the digest and is also used on-chain. This is simpler and more efficient.