Skip to content

Commit

Permalink
Clarify Use of Relayer
Browse files Browse the repository at this point in the history
Additionally, clarify that the transaction is executed by a relayer and
not natively by the passkey signer.
  • Loading branch information
nlordell committed Oct 22, 2024
1 parent 8bb328c commit b1feaa1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions modules/passkey/test/userstories/ExecuteSafeTransaction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ describe('Execute Safe Transaction [@userstory]', () => {
const setupTests = deployments.createFixture(async ({ deployments }) => {
const { SafeProxyFactory, SafeL2, FCLP256Verifier, SafeWebAuthnSignerFactory, SafeWebAuthnSharedSigner } = await deployments.run()

const [relayer] = await ethers.getSigners()

const proxyFactory = await ethers.getContractAt(SafeProxyFactory.abi, SafeProxyFactory.address)
const singleton = await ethers.getContractAt(SafeL2.abi, SafeL2.address)
const verifier = await ethers.getContractAt('IP256Verifier', FCLP256Verifier.address)
const signerFactory = await ethers.getContractAt('SafeWebAuthnSignerFactory', SafeWebAuthnSignerFactory.address)
const sharedSigner = await ethers.getContractAt('SafeWebAuthnSharedSigner', SafeWebAuthnSharedSigner.address)

return {
relayer,
proxyFactory,
singleton,
signerFactory,
Expand All @@ -35,7 +38,7 @@ describe('Execute Safe Transaction [@userstory]', () => {
})

it('should create a Safe and execute a transaction', async () => {
const { singleton, proxyFactory, verifier, navigator, SafeL2, signerFactory } = await setupTests()
const { relayer, singleton, proxyFactory, verifier, navigator, SafeL2, signerFactory } = await setupTests()

// Create a WebAuthn credential to own the Safe.
const credential = navigator.credentials.create({
Expand Down Expand Up @@ -127,9 +130,10 @@ describe('Execute Safe Transaction [@userstory]', () => {
})
const signatureData = encodeWebAuthnSignature(assertion.response)

// Execute the Safe transaction.
// Use relayer account to execute the signed Safe transaction.
const relayedSafe = safe.connect(relayer) as typeof safe
expect(
await safe.execTransaction(
await relayedSafe.execTransaction(
transaction.to,
transaction.value,
transaction.data,
Expand All @@ -151,7 +155,7 @@ describe('Execute Safe Transaction [@userstory]', () => {
})

it('should create a Safe and execute a transaction with the shared WebAuthn signer', async () => {
const { singleton, proxyFactory, verifier, navigator, SafeL2, sharedSigner } = await setupTests()
const { relayer, singleton, proxyFactory, verifier, navigator, SafeL2, sharedSigner } = await setupTests()

// Create a WebAuthn credential to own the Safe.
const credential = navigator.credentials.create({
Expand Down Expand Up @@ -250,9 +254,10 @@ describe('Execute Safe Transaction [@userstory]', () => {
})
const signatureData = encodeWebAuthnSignature(assertion.response)

// Execute the Safe transaction.
// Use relayer account to execute the signed Safe transaction.
const relayedSafe = safe.connect(relayer) as typeof safe
expect(
await safe.execTransaction(
await relayedSafe.execTransaction(
transaction.to,
transaction.value,
transaction.data,
Expand Down

0 comments on commit b1feaa1

Please sign in to comment.