-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support ERC-6492 (Discussion) #68
Comments
Looking at the spec more, eth_call is suggested which doesn't submit a tx to the blockchain. Was getting that confused with call in solidity! So there might be a standard path forward. Will think more on it. |
I started making a fork/PR for this, but ran into some questions about the desire to refactor parts of this repo as I could see inclusion of this, plus other future standards, making the actual if signature.endswith(ERC6492_MAGIC_BYTES):
# decode data from the signature
factory_contract, factory_calldata, original_erc2171_signature = decode(
["address", "bytes", "bytes"], HexBytes(signature)
)
# create multicall contract
w3 = web3(str(msg.chain_id))
multicall_contract = w3.eth.contract(
address=w3.to_checksum_address(MULTICALL3_ADDRESS), abi=MULTICALL3_ABI
)
# generate EIP-1271 calldata
eip1271_contract = w3.eth.contract(
address=msg.address, abi=EIP1271_CONTRACT_ABI
)
message = encode_defunct(text=msg.prepare_message())
msg_hash = _hash_eip191_message(message)
tx = eip1271_contract.functions.isValidSignature(
msg_hash, original_erc2171_signature
).build_transaction()
# first eth_call
data = multicall_contract.functions.aggregate3(
[
(
w3.to_checksum_address(factory_contract), # target address
True, # allow failure
factory_calldata, # calldata
),
(
msg.address, # target address
True, # allow failure
HexBytes(tx["data"]), # calldata
),
]
).call()
sig_validation_successful = data[1][0]
magic_value = decode(["bytes4"], data[1][1])[0].hex()
# get signature repsonse
return sig_validation_successful and magic_value == EIP1271_MAGICVALUE Questions:
|
Wanted to open this issue as a place to discuss supporting ERC-6492. The ERC calls for the offchain verifier to essentially deploy the AA wallet and then verify the ERC-1271 signature after deploying.
This honestly feels like overkill to me, and surprises me that dapps should be responsible for deploying the contract for users.
Instead, I think we could work on recognizing the magic bytes32 value at the end of the signature to see the type of signature it is. Then, if the contract isn't deployed, could at least raise a better error message.
Let me know what you think! Happy to work on this in a PR!
The text was updated successfully, but these errors were encountered: