Skip to content

Commit

Permalink
test: skip lsp17extensions test because of NickFactory deployment e…
Browse files Browse the repository at this point in the history
…rror
  • Loading branch information
CJ42 committed Feb 27, 2024
1 parent a16853e commit f38759f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build-lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ jobs:
test-suites:
strategy:
matrix:
lsp:
[
lsp: [
"up",
"upinit",
"lsp1",
Expand All @@ -85,7 +84,9 @@ jobs:
"lsp11",
"lsp11init",
"lsp17",
"lsp17extensions",
# Deploying NickFactory currently fails with latest Hardhat version. Commenting out temporarily until resolved
# See following issue: https://github.com/NomicFoundation/hardhat/issues/4939
# "lsp17extensions",
"lsp20",
"lsp20init",
"lsp23",
Expand Down
22 changes: 10 additions & 12 deletions tests/LSP17Extensions/Extension4337/4337.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ethers } from 'hardhat';
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { EntryPoint__factory, EntryPoint } from '@account-abstraction/contracts';

import { BytesLike, parseEther } from 'ethers';
import { BytesLike, Signer, parseEther } from 'ethers';
import { expect } from 'chai';
import {
LSP6KeyManager,
Expand All @@ -18,12 +18,15 @@ import { ALL_PERMISSIONS } from '@lukso/lsp6-contracts';
import { combinePermissions } from '../../utils/helpers';
import { fillAndSign } from '../helpers/UserOp';

describe('4337', function () {
// Deploying NickFactory currently fails with latest Hardhat version. Commenting out temporarily until resolved
// See following issue: https://github.com/NomicFoundation/hardhat/issues/4939
describe.skip('4337', function () {
let bundler: SignerWithAddress;
let deployer: SignerWithAddress;
let deployer: Signer;
let universalProfile: UniversalProfile;
let universalProfileAddress: string;
let keyManager: LSP6KeyManager;
let keyManagerAddress: string;
let entryPoint: EntryPoint;
let controllerWith4337Permission: SignerWithAddress;
let controllerWithout4337Permission: SignerWithAddress;
Expand Down Expand Up @@ -51,12 +54,11 @@ describe('4337', function () {
);
universalProfileAddress = await universalProfile.getAddress();

keyManager = await new LSP6KeyManager__factory(deployer).deploy(
await universalProfile.getAddress(),
);
keyManager = await new LSP6KeyManager__factory(deployer).deploy(universalProfileAddress);
keyManagerAddress = await keyManager.getAddress();

// transfer ownership to keyManager
await universalProfile.transferOwnership(await keyManager.getAddress());
await universalProfile.transferOwnership(keyManagerAddress);

const dataKey =
ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + deployerAddress.slice(2);
Expand All @@ -65,7 +67,7 @@ describe('4337', function () {

const acceptOwnershipBytes = universalProfile.interface.encodeFunctionData('acceptOwnership');
await keyManager.execute(acceptOwnershipBytes);
expect(await universalProfile.owner()).to.eq(await keyManager.getAddress());
expect(await universalProfile.owner()).to.eq(keyManagerAddress);

// deploy entrypoint
entryPoint = await deployEntryPoint();
Expand Down Expand Up @@ -125,7 +127,6 @@ describe('4337', function () {

it('should pass', async function () {
const addressZeroBalanceBefore = await getBalance(ethers.ZeroAddress);

const userOperation = await fillAndSign(
{
sender: universalProfileAddress,
Expand All @@ -134,11 +135,8 @@ describe('4337', function () {
controllerWith4337Permission,
entryPoint,
);

await entryPoint.handleOps([userOperation], bundler.address);

const addressZeroBalanceAfter = await getBalance(ethers.ZeroAddress);

expect(addressZeroBalanceAfter - addressZeroBalanceBefore).to.eq(amountToTransfer);
});

Expand Down
19 changes: 13 additions & 6 deletions tests/LSP17Extensions/helpers/Create2Factory.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// from: https://github.com/Arachnid/deterministic-deployment-proxy
import { BigNumberish, JsonRpcProvider, Signer, ethers, toBeHex } from 'ethers';
import { BigNumberish, Signer, ethers, toBeHex } from 'ethers';
import { ethers as hardhatEthers } from 'hardhat';
import { getBytes, concat, zeroPadValue, keccak256 } from 'ethers';

import { TransactionRequest } from '@ethersproject/abstract-provider';
Expand All @@ -19,8 +20,8 @@ export class Create2Factory {
).toString();

constructor(
readonly provider: JsonRpcProvider,
readonly signer = (provider as unknown as JsonRpcProvider).getSigner().then(),
readonly provider: typeof hardhatEthers.provider = hardhatEthers.provider,
readonly signer = hardhatEthers.provider.getSigner().then(),
) {}

/**
Expand Down Expand Up @@ -103,12 +104,18 @@ export class Create2Factory {
if (await this._isFactoryDeployed()) {
return;
}
await (
await (signer ?? this.signer)
).sendTransaction({

const currentSigner = (await signer) ?? (await this.signer);
const tx = await currentSigner.sendTransaction({
to: Create2Factory.factoryDeployer,
value: BigInt(Create2Factory.factoryDeploymentFee),
});
await tx.wait();

// TODO: this transaction keeps failing with the following error, although the deployment transaction
// for the Create2Factory has not changed:
// `Error: VM Exception while processing transaction: invalid opcode`

await this.provider.send('eth_sendTransaction', [
{
data: Create2Factory.factoryTx,
Expand Down

0 comments on commit f38759f

Please sign in to comment.