diff --git a/contracts/lib/BootstrapLib.sol b/contracts/lib/BootstrapLib.sol index c9b45297..5c614ec9 100644 --- a/contracts/lib/BootstrapLib.sol +++ b/contracts/lib/BootstrapLib.sol @@ -15,7 +15,7 @@ library BootstrapLib { /// @param module The address of the module. /// @param data The initialization data for the module. /// @return config A BootstrapConfig structure containing the module and its data. - function createSingleConfig(address module, bytes memory data) public pure returns (BootstrapConfig memory config) { + function createSingleConfig(address module, bytes memory data) internal pure returns (BootstrapConfig memory config) { config.module = module; config.data = data; } @@ -24,7 +24,7 @@ library BootstrapLib { /// @param module The address of the module. /// @param data The initialization data for the module. /// @return config An array containing a single BootstrapConfig structure. - function createArrayConfig(address module, bytes memory data) public pure returns (BootstrapConfig[] memory config) { + function createArrayConfig(address module, bytes memory data) internal pure returns (BootstrapConfig[] memory config) { config = new BootstrapConfig[](1); config[0].module = module; config[0].data = data; @@ -34,7 +34,7 @@ library BootstrapLib { /// @param modules An array of module addresses. /// @param datas An array of initialization data for each module. /// @return configs An array of BootstrapConfig structures. - function createMultipleConfigs(address[] memory modules, bytes[] memory datas) public pure returns (BootstrapConfig[] memory configs) { + function createMultipleConfigs(address[] memory modules, bytes[] memory datas) internal pure returns (BootstrapConfig[] memory configs) { require(modules.length == datas.length, "BootstrapLib: length mismatch"); configs = new BootstrapConfig[](modules.length); diff --git a/scripts/hardhat/deploy-fresh.ts b/scripts/hardhat/deploy-fresh.ts index 5148919f..7bc171de 100644 --- a/scripts/hardhat/deploy-fresh.ts +++ b/scripts/hardhat/deploy-fresh.ts @@ -46,12 +46,7 @@ async function main() { await mockRegistry.waitForDeployment(); const K1ValidatorFactory = await ethers.getContractFactory( - "K1ValidatorFactory", - { - libraries: { - BootstrapLib: await bootstrapLib.getAddress(), - }, - }, + "K1ValidatorFactory" ); const k1ValidatorFactory = await K1ValidatorFactory.deploy( diff --git a/scripts/hardhat/deployToMainnet.ts b/scripts/hardhat/deployToMainnet.ts index 930ee996..3c44f6ae 100644 --- a/scripts/hardhat/deployToMainnet.ts +++ b/scripts/hardhat/deployToMainnet.ts @@ -28,10 +28,7 @@ export async function deployToMainnet() { K1Validator.address, NexusBootstrap.address, Registry.address, - ], - libraries: { - BootstrapLib: BootstrapLib.address, - }, + ] }); const BiconomyMetaFactory = await deployments.deploy("BiconomyMetaFactory", { ...deployOptions, diff --git a/test/hardhat/smart-account/Nexus.Factory.specs.ts b/test/hardhat/smart-account/Nexus.Factory.specs.ts index 6774fab2..17eb9440 100644 --- a/test/hardhat/smart-account/Nexus.Factory.specs.ts +++ b/test/hardhat/smart-account/Nexus.Factory.specs.ts @@ -202,22 +202,23 @@ describe("Nexus Factory Tests", function () { ownerAddress = await owner.getAddress(); - const validator = await BootstrapLib.createSingleConfig( - await validatorModule.getAddress(), - solidityPacked(["address"], [ownerAddress]), - ); - const hook = await BootstrapLib.createSingleConfig( - await hookModule.getAddress(), - "0x", - ); + const validator = { + module: await validatorModule.getAddress(), + data: solidityPacked(["address"], [ownerAddress]), + } + + const hook = { + module: await hookModule.getAddress(), + data: "0x", + } parsedValidator = { - module: validator[0], - data: validator[1], + module: validator.module, + data: validator.data, }; parsedHook = { - module: hook[0], - data: hook[1], + module: hook.module, + data: hook.data, }; }); @@ -331,33 +332,32 @@ describe("Nexus Factory Tests", function () { ownerAddress = await owner.getAddress(); - const validator = await BootstrapLib.createSingleConfig( - await validatorModule.getAddress(), - solidityPacked(["address"], [ownerAddress]), - ); - - const executor = await BootstrapLib.createSingleConfig( - await executorModule.getAddress(), - "0x", - ); - const hook = await BootstrapLib.createSingleConfig( - await hookModule.getAddress(), - "0x", - ); + const validator = { + module: await validatorModule.getAddress(), + data: solidityPacked(["address"], [ownerAddress]), + } + const executor = { + module: await executorModule.getAddress(), + data: "0x", + } + const hook = { + module: await hookModule.getAddress(), + data: "0x", + } parsedValidator = { - module: validator[0], - data: validator[1], + module: validator.module, + data: validator.data, }; parsedExecutor = { - module: executor[0], - data: executor[1], + module: executor.module, + data: executor.data, }; parsedHook = { - module: hook[0], - data: hook[1], + module: hook.module, + data: hook.data, }; }); @@ -515,20 +515,21 @@ describe("Nexus Factory Tests", function () { registryFactory = registryFactory.connect(owner); ownerAddress = await owner.getAddress(); - - const validator = await BootstrapLib.createSingleConfig( - await validatorModule.getAddress(), - solidityPacked(["address"], [ownerAddress]), - ); - - const executor = await BootstrapLib.createSingleConfig( - await executorModule.getAddress(), - "0x", - ); - const hook = await BootstrapLib.createSingleConfig( - await hookModule.getAddress(), - "0x", - ); + + const validator = { + module: await validatorModule.getAddress(), + data: solidityPacked(["address"], [ownerAddress]), + } + + const executor = { + module: await executorModule.getAddress(), + data: "0x", + } + + const hook = { + module: await hookModule.getAddress(), + data: "0x", + } parsedValidator = { module: validator[0], diff --git a/test/hardhat/utils/deployment.ts b/test/hardhat/utils/deployment.ts index 0c8f6167..cbe41592 100644 --- a/test/hardhat/utils/deployment.ts +++ b/test/hardhat/utils/deployment.ts @@ -88,12 +88,7 @@ export async function getDeployedAccountK1Factory( // Get the contract factory for K1ValidatorFactory with linked library const K1ValidatorFactory = await ethers.getContractFactory( - "K1ValidatorFactory", - { - libraries: { - BootstrapLib: await BootstrapLib.getAddress(), - }, - }, + "K1ValidatorFactory" ); const deterministicAccountFactory = await deployments.deploy( @@ -102,9 +97,6 @@ export async function getDeployedAccountK1Factory( from: addresses[0], deterministicDeployment: true, args: [implementationAddress, owner, k1Validator, bootstrapper, registry], - libraries: { - BootstrapLib: await BootstrapLib.getAddress(), - }, }, ); diff --git a/test/hardhat/utils/operationHelpers.ts b/test/hardhat/utils/operationHelpers.ts index 36caf6e3..b12e0c02 100644 --- a/test/hardhat/utils/operationHelpers.ts +++ b/test/hardhat/utils/operationHelpers.ts @@ -225,12 +225,7 @@ export async function getInitCode( BootstrapLib.waitForDeployment(); const K1ValidatorFactory = await ethers.getContractFactory( - "K1ValidatorFactory", - { - libraries: { - BootstrapLib: await BootstrapLib.getAddress(), - }, - }, + "K1ValidatorFactory" ); // Encode the createAccount function call with the provided parameters