From 573f9a07f3f9135032f51fcba837c28568d07ff7 Mon Sep 17 00:00:00 2001 From: Nick Gheorghita Date: Wed, 12 Aug 2020 16:12:47 -0500 Subject: [PATCH] Support listing packages for ethpm v1 --- packages/config/src/configDefaults.ts | 5 +- packages/core/lib/commands/install.js | 33 +- packages/core/lib/commands/packages.js | 14 +- packages/core/lib/commands/publish.js | 11 +- packages/ethpm-v1/lib/ethpm-v1.js | 54 ++++ packages/ethpm-v1/lib/registryAbi.js | 297 ++++++++++++++++++ packages/ethpm-v3/lib/ethpm-v3.js | 64 ++-- packages/ethpm-v3/lib/utils.js | 11 +- packages/ethpm-v3/tests/ethpm-v3.js | 12 +- .../test/scenarios/commands/install.js | 6 +- .../tokens/contracts/Migrations.sol | 0 .../tokens/contracts/eip20/EIP20.sol | 0 .../tokens/contracts/eip20/EIP20Factory.sol | 0 .../tokens/contracts/eip20/EIP20Interface.sol | 0 .../tokens/ethpm.json | 5 +- .../tokens/lock.json | 0 .../tokens/lock.uri | 0 17 files changed, 451 insertions(+), 61 deletions(-) create mode 100644 packages/ethpm-v1/lib/registryAbi.js rename packages/truffle/test/sources/ethpm/{installed_contracts => _ethpm_packages}/tokens/contracts/Migrations.sol (100%) rename packages/truffle/test/sources/ethpm/{installed_contracts => _ethpm_packages}/tokens/contracts/eip20/EIP20.sol (100%) rename packages/truffle/test/sources/ethpm/{installed_contracts => _ethpm_packages}/tokens/contracts/eip20/EIP20Factory.sol (100%) rename packages/truffle/test/sources/ethpm/{installed_contracts => _ethpm_packages}/tokens/contracts/eip20/EIP20Interface.sol (100%) rename packages/truffle/test/sources/ethpm/{installed_contracts => _ethpm_packages}/tokens/ethpm.json (89%) rename packages/truffle/test/sources/ethpm/{installed_contracts => _ethpm_packages}/tokens/lock.json (100%) rename packages/truffle/test/sources/ethpm/{installed_contracts => _ethpm_packages}/tokens/lock.uri (100%) diff --git a/packages/config/src/configDefaults.ts b/packages/config/src/configDefaults.ts index 7b1d1a1ae38..6b927679103 100644 --- a/packages/config/src/configDefaults.ts +++ b/packages/config/src/configDefaults.ts @@ -37,9 +37,10 @@ export const getInitialConfig = ({ ipfsProtocol: "https", ipfsPort: "5001", registry: { - address: "0x8011df4830b4f696cd81393997e5371b93338878", + address: "0xD230Dd91A049284a236f6ccba4412F647BDAAD9e", network: "ropsten" - } + }, + version: "3" }, ens: { enabled: false, diff --git a/packages/core/lib/commands/install.js b/packages/core/lib/commands/install.js index 2616d2a49b9..0602fd363f6 100644 --- a/packages/core/lib/commands/install.js +++ b/packages/core/lib/commands/install.js @@ -1,45 +1,52 @@ +const { callbackify } = require("util"); + const command = { command: "install", description: "Install a package from the Ethereum Package Registry", builder: {}, help: { - usage: "truffle install [--alias]", + usage: "truffle install [--alias]", options: [ { - option: "packageId", - description: `(required) Name of the package as listed in the Ethereum Package Registry. - Accepted formats: packageName, packageName@version, ethpm URI, ipfs URI.` + option: "packageIdentifier", + description: `(required) Name of the package as listed in the Ethereum Package Registry. Accepted formats: packageName, packageName@version, ethpm URI, ipfs URI.` }, { option: "--alias", - description: - "A different name under which this package will be installed." + description: "A different name under which to install this package." } ] }, - run: async function (options, done) { + run: function (options, done) { const Config = require("@truffle/config"); const PackageV1 = require("@truffle/ethpm-v1"); const PackageV3 = require("@truffle/ethpm-v3"); if (options._ && options._.length == 0) { - done(new Error(`Please provide a packageId.`)); + done( + new Error( + `Please provide a package identifier. Run 'truffle help install' for more information on valid package identifiers.` + ) + ); } if (options._ && options._.length > 1) { - done(new Error(`Only one packageId can be installed at a time.`)); + done( + new Error(`Only one package identifier can be installed at a time.`) + ); } - options.packageId = options._[0]; + options.packageIdentifier = options._[0]; const config = Config.detect(options); + let callbackFunction; if (config.ethpm.version == "1") { - await PackageV1.install(config); + callbackFunction = callbackify(PackageV1.install); } else if (config.ethpm.version == "3") { - await PackageV3.install(config); + callbackFunction = callbackify(PackageV3.install); } else { done(new Error(`Unsupported ethpm version: ${config.ethpm.version}.`)); } - done(); + callbackFunction(config, done); } }; diff --git a/packages/core/lib/commands/packages.js b/packages/core/lib/commands/packages.js index 3a0e5f01f95..50f8bac9592 100644 --- a/packages/core/lib/commands/packages.js +++ b/packages/core/lib/commands/packages.js @@ -1,3 +1,5 @@ +const { callbackify } = require("util"); + var command = { command: "packages", description: "List available packages on connected EthPM Registry", @@ -6,18 +8,22 @@ var command = { usage: "truffle packages", options: [] }, - run: async function (options, done) { + run: function (options, done) { var Config = require("@truffle/config"); + var PackageV1 = require("@truffle/ethpm-v1"); var PackageV3 = require("@truffle/ethpm-v3"); var config = Config.detect(options); + let callbackFunction; - if (config.ethpm.version == "1" || config.ethpm.version == "3") { - await PackageV3.packages(config); + if (config.ethpm.version == "1") { + callbackFunction = callbackify(PackageV1.packages); + } else if (config.ethpm.version == "3") { + callbackFunction = callbackify(PackageV3.packages); } else { done(new Error(`Unsupported ethpm version: ${config.ethpm.version}.`)); } - done(); + callbackFunction(config, done); } }; diff --git a/packages/core/lib/commands/publish.js b/packages/core/lib/commands/publish.js index 3353ed2c3b6..a6d97fe42aa 100644 --- a/packages/core/lib/commands/publish.js +++ b/packages/core/lib/commands/publish.js @@ -1,3 +1,5 @@ +const { callbackify } = require("util"); + var command = { command: "publish", description: "Publish a package to the Ethereum Package Registry", @@ -6,21 +8,22 @@ var command = { usage: "truffle publish", options: [] }, - run: async function (options, done) { + run: function (options, done) { var Config = require("@truffle/config"); var PackageV1 = require("@truffle/ethpm-v1"); var PackageV3 = require("@truffle/ethpm-v3"); var config = Config.detect(options); + let callbackFunction; if (config.ethpm.version == "1") { - await PackageV1.publish(config); + callbackFunction = callbackify(PackageV1.publish); } else if (config.ethpm.version == "3") { - await PackageV3.publish(config); + callbackFunction = callbackify(PackageV3.publish); } else { done(new Error(`Unsupported ethpm version: ${config.ethpm.version}.`)); } - done(); + callbackFunction(config, done); } }; diff --git a/packages/ethpm-v1/lib/ethpm-v1.js b/packages/ethpm-v1/lib/ethpm-v1.js index 478b997830a..c6283477257 100644 --- a/packages/ethpm-v1/lib/ethpm-v1.js +++ b/packages/ethpm-v1/lib/ethpm-v1.js @@ -4,12 +4,66 @@ const Networks = require("@truffle/core/lib/networks"); const EthPM = require("ethpm"); const EthPMRegistry = require("ethpm-registry"); const Web3 = require("web3"); +const registryAbi = require("./registryAbi"); const { createInterfaceAdapter } = require("@truffle/interface-adapter"); const path = require("path"); const fs = require("fs"); const OS = require("os"); const PackageV1 = { + packages: async options => { + try { + expect.options(options, [ + "ethpm", + "logger", + "working_directory", + "contracts_build_directory", + "networks" + ]); + } catch (err) { + throw new TruffleError( + `Invalid ethpm configuration in truffle-config: ${err.message}` + ); + } + + const ethpmV1Network = "ropsten"; + if (!options.networks[ethpmV1Network]) { + throw new TruffleError( + `Please include a provider in your networks config for the Ropsten testnet, the testnet where the ethpmV1 registry is deployed.` + ); + } + const provider = options.networks["ropsten"].provider(); + const web3 = new Web3(provider); + const ethpmV1RegistryAddress = "0x8011df4830b4f696cd81393997e5371b93338878"; + var contract = new web3.eth.Contract( + registryAbi.abi, + ethpmV1RegistryAddress + ); + var owner = await contract.methods.owner().call(); + + // Display info about connected registry + options.logger.log( + `Searching for packages published on registry located on the ethpm V1 registry: ${ethpmV1RegistryAddress}` + ); + options.logger.log(`Registry controlled by : ${owner}`); + + // Display info about all releases on registry + var numPackages = await contract.methods.getNumPackages().call(); + for (var x = 0; x < numPackages; x++) { + let packageName = await contract.methods.getPackageName(x).call(); + let releaseHashes = await contract.methods + .getAllPackageReleaseHashes(packageName) + .call(); + options.logger.log(packageName); + for (let hash of releaseHashes) { + let releaseData = await contract.methods.getReleaseData(hash).call(); + let version = `${releaseData.major}.${releaseData.minor}.${releaseData.patch}`; + options.logger.log(`- ${version} @ ${releaseData.releaseLockfileURI}`); + } + } + return; + }, + install: async function (options, callback) { const callbackPassed = typeof callback === "function"; expect.options(options, ["working_directory", "ethpm"]); diff --git a/packages/ethpm-v1/lib/registryAbi.js b/packages/ethpm-v1/lib/registryAbi.js new file mode 100644 index 00000000000..2e026e66abe --- /dev/null +++ b/packages/ethpm-v1/lib/registryAbi.js @@ -0,0 +1,297 @@ +const abi = [ + { + constant: true, + inputs: [], + name: "getNumReleases", + outputs: [{ name: "", type: "uint256" }], + payable: false, + type: "function" + }, + { + constant: false, + inputs: [{ name: "newReleaseValidator", type: "address" }], + name: "setReleaseValidator", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [ + { name: "name", type: "string" }, + { name: "offset", type: "uint256" }, + { name: "numReleases", type: "uint256" } + ], + name: "getPackageReleaseHashes", + outputs: [{ name: "", type: "bytes32[]" }], + payable: false, + type: "function" + }, + { + constant: false, + inputs: [{ name: "newOwner", type: "address" }], + name: "setOwner", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [ + { name: "name", type: "string" }, + { name: "major", type: "uint32" }, + { name: "minor", type: "uint32" }, + { name: "patch", type: "uint32" }, + { name: "preRelease", type: "string" }, + { name: "build", type: "string" } + ], + name: "getReleaseLockfileURI", + outputs: [{ name: "", type: "string" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [], + name: "getPackageDb", + outputs: [{ name: "", type: "address" }], + payable: false, + type: "function" + }, + { + constant: false, + inputs: [{ name: "newPackageDb", type: "address" }], + name: "setPackageDb", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [ + { name: "name", type: "string" }, + { name: "major", type: "uint32" }, + { name: "minor", type: "uint32" }, + { name: "patch", type: "uint32" }, + { name: "preRelease", type: "string" }, + { name: "build", type: "string" } + ], + name: "releaseExists", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [], + name: "getReleaseValidator", + outputs: [{ name: "", type: "address" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [{ name: "releaseHash", type: "bytes32" }], + name: "getReleaseData", + outputs: [ + { name: "major", type: "uint32" }, + { name: "minor", type: "uint32" }, + { name: "patch", type: "uint32" }, + { name: "preRelease", type: "string" }, + { name: "build", type: "string" }, + { name: "releaseLockfileURI", type: "string" }, + { name: "createdAt", type: "uint256" }, + { name: "updatedAt", type: "uint256" } + ], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [], + name: "getAllReleaseHashes", + outputs: [{ name: "", type: "bytes32[]" }], + payable: false, + type: "function" + }, + { + constant: false, + inputs: [ + { name: "name", type: "string" }, + { name: "newPackageOwner", type: "address" } + ], + name: "transferPackageOwner", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [{ name: "idx", type: "uint256" }], + name: "getReleaseHash", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + type: "function" + }, + { + constant: false, + inputs: [ + { name: "name", type: "string" }, + { name: "major", type: "uint32" }, + { name: "minor", type: "uint32" }, + { name: "patch", type: "uint32" }, + { name: "preRelease", type: "string" }, + { name: "build", type: "string" }, + { name: "releaseLockfileURI", type: "string" } + ], + name: "release", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [], + name: "getNumPackages", + outputs: [{ name: "", type: "uint256" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [ + { name: "offset", type: "uint256" }, + { name: "numReleases", type: "uint256" } + ], + name: "getReleaseHashes", + outputs: [{ name: "", type: "bytes32[]" }], + payable: false, + type: "function" + }, + { + constant: false, + inputs: [{ name: "newAuthority", type: "address" }], + name: "setAuthority", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [{ name: "name", type: "string" }], + name: "packageExists", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [], + name: "owner", + outputs: [{ name: "", type: "address" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [], + name: "authority", + outputs: [{ name: "", type: "address" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [{ name: "name", type: "string" }], + name: "getPackageData", + outputs: [ + { name: "packageOwner", type: "address" }, + { name: "createdAt", type: "uint256" }, + { name: "numReleases", type: "uint256" }, + { name: "updatedAt", type: "uint256" } + ], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [{ name: "name", type: "string" }], + name: "getAllPackageReleaseHashes", + outputs: [{ name: "", type: "bytes32[]" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [ + { name: "name", type: "string" }, + { name: "releaseIdx", type: "uint256" } + ], + name: "getReleaseHashForPackage", + outputs: [{ name: "", type: "bytes32" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [{ name: "idx", type: "uint256" }], + name: "getPackageName", + outputs: [{ name: "", type: "string" }], + payable: false, + type: "function" + }, + { + constant: false, + inputs: [{ name: "newReleaseDb", type: "address" }], + name: "setReleaseDb", + outputs: [{ name: "", type: "bool" }], + payable: false, + type: "function" + }, + { + constant: true, + inputs: [], + name: "getReleaseDb", + outputs: [{ name: "", type: "address" }], + payable: false, + type: "function" + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "nameHash", type: "bytes32" }, + { indexed: true, name: "releaseHash", type: "bytes32" } + ], + name: "PackageRelease", + type: "event" + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "oldOwner", type: "address" }, + { indexed: true, name: "newOwner", type: "address" } + ], + name: "PackageTransfer", + type: "event" + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "oldOwner", type: "address" }, + { indexed: true, name: "newOwner", type: "address" } + ], + name: "OwnerUpdate", + type: "event" + }, + { + anonymous: false, + inputs: [ + { indexed: true, name: "oldAuthority", type: "address" }, + { indexed: true, name: "newAuthority", type: "address" } + ], + name: "AuthorityUpdate", + type: "event" + } +]; + +module.exports = { abi }; diff --git a/packages/ethpm-v3/lib/ethpm-v3.js b/packages/ethpm-v3/lib/ethpm-v3.js index 3640d02b5e9..535343d994f 100644 --- a/packages/ethpm-v3/lib/ethpm-v3.js +++ b/packages/ethpm-v3/lib/ethpm-v3.js @@ -38,6 +38,17 @@ const PackageV3 = { ); } + let targetRegistry; + if (!isAddress(options.ethpm.registry.address)) { + targetRegistry = await utils.resolveEnsName( + options.ethpm.registry.address, + provider, + options + ); + } else { + targetRegistry = options.ethpm.registry.address; + } + var provider = utils.pluckProviderFromConfig(options); // Create an ethpm instance @@ -48,7 +59,7 @@ const PackageV3 = { }).connect({ provider: provider, workingDirectory: options.working_directory, - registryAddress: options.ethpm.registry.address, + registryAddress: targetRegistry, ipfs: { host: options.ethpm.ipfsHost, port: options.ethpm.ipfsPort, @@ -61,7 +72,7 @@ const PackageV3 = { // Display info about connected registry options.logger.log( - `Searching for packages published on registry located at: ${options.ethpm.registry.address}` + `Searching for packages published on registry located at: ${targetRegistry}` ); const owner = await ethpm.registries.registry.methods.owner().call(); options.logger.log(`Registry controlled by account: ${owner}`); @@ -85,7 +96,7 @@ const PackageV3 = { try { expect.options(options, [ "ethpm", - "packageId", + "packageIdentifier", "logger", "working_directory", "contracts_build_directory", @@ -155,17 +166,17 @@ const PackageV3 = { var resolvedManifestUri = false; // Parse IPFS URI - if (options.packageId.startsWith("ipfs://")) { - manifestUri = new URL(options.packageId); + if (options.packageIdentifier.startsWith("ipfs://")) { + manifestUri = new URL(options.packageIdentifier); resolvedManifestUri = true; } - // Parse ethpm URI || packageId + // Parse ethpm URI || packageIdentifier if (!resolvedManifestUri) { // Parse ethpm uri if ( - options.packageId.startsWith("ethpm://") || - options.packageId.startsWith("erc1319://") + options.packageIdentifier.startsWith("ethpm://") || + options.packageIdentifier.startsWith("erc1319://") ) { const targetInstallInfo = await utils.resolveEthpmUri( options, @@ -178,11 +189,11 @@ const PackageV3 = { // update provider if changed via ethpm uri provider = targetInstallInfo.targetProvider; } else { - // Parse packageId - const packageData = options.packageId.split("@"); + // Parse packageIdentifier + const packageData = options.packageIdentifier.split("@"); if (packageData.length > 2) { throw new TruffleError( - `Invalid ethpm uri or package id: ${options.packageId[0]}` + `Invalid ethpm uri or package id: ${options.packageIdentifier[0]}` ); } @@ -249,7 +260,7 @@ const PackageV3 = { // Check to make sure a manifest URI was located if (typeof manifestUri === "undefined") { throw new TruffleError( - `Unable to find a manifest URI for package ID: ${options.packageId}` + `Unable to find a manifest URI for package ID: ${options.packageIdentifier}` ); } @@ -369,6 +380,16 @@ const PackageV3 = { } var registryProvider = utils.pluckProviderFromConfig(options); + let targetRegistry; + if (!isAddress(options.ethpm.registry.address)) { + targetRegistry = await utils.resolveEnsName( + options.ethpm.registry.address, + registryProvider, + options + ); + } else { + targetRegistry = options.ethpm.registry.address; + } // Create an ethpm instance let ethpm; @@ -379,7 +400,7 @@ const PackageV3 = { registries: "ethpm/registries/web3" }).connect({ provider: registryProvider, - registryAddress: options.ethpm.registry.address, + registryAddress: targetRegistry, ipfs: { host: options.ethpm.ipfsHost, port: options.ethpm.ipfsPort, @@ -455,21 +476,20 @@ const PackageV3 = { const encodedTxData = ethpm.registries.registry.methods .release(ethpmConfig.name, ethpmConfig.version, manifestUri.href) .encodeABI(); - const tx = await w3.eth.signTransaction({ - from: fromAddress, - to: options.ethpm.registry.address, - gas: 4712388, - gasPrice: 100000000000, - data: encodedTxData - }); try { - await w3.eth.sendSignedTransaction(tx.raw); + await w3.eth.sendTransaction({ + from: fromAddress, + to: targetRegistry, + gas: 4712388, + gasPrice: 100000000000, + data: encodedTxData + }); } catch (err) { options.logger.log(`Error publishing release data to registry: ${err}`); return; } options.logger.log( - `Published ${ethpmConfig.name}@${ethpmConfig.version} to ${options.ethpm.registry.address}\n` + `Published ${ethpmConfig.name}@${ethpmConfig.version} to ${targetRegistry}\n` ); return; } diff --git a/packages/ethpm-v3/lib/utils.js b/packages/ethpm-v3/lib/utils.js index 46b956def0e..51b30c04d3f 100644 --- a/packages/ethpm-v3/lib/utils.js +++ b/packages/ethpm-v3/lib/utils.js @@ -62,7 +62,7 @@ async function getPublishableArtifacts(options, ethpm) { options.networks[provider].network_id == networkId && options.networks[provider].provider ) { - targetProvider = options.networks[provider].provider(); + targetProvider = pluckProviderFromConfig(options); } } @@ -110,8 +110,11 @@ async function resolveEnsName(address, provider, options) { let resolvedAddress; const w3 = new Web3(provider); const connectedChainId = await w3.eth.net.getId(); - if (connectedChainId != 1) { - throw new TruffleError("Invalid ethPM uri. Only mainnet ENS is supported."); + const supportedChainIds = [1, 3, 4, 5]; + if (!supportedChainIds.includes(connectedChainId)) { + throw new TruffleError( + "Invalid ethPM uri. ENS is only supported on mainnet, ropsten, rinkeby & goerli." + ); } if (options.ens.enabled === false) { throw new TruffleError( @@ -132,7 +135,7 @@ async function resolveEnsName(address, provider, options) { async function resolveEthpmUri(options, provider) { let targetRegistry; var targetProvider = provider; - const ethpmUri = new EthpmURI(options.packageId); + const ethpmUri = new EthpmURI(options.packageIdentifier); const w3 = new Web3(targetProvider); const connectedChainId = await w3.eth.net.getId(); diff --git a/packages/ethpm-v3/tests/ethpm-v3.js b/packages/ethpm-v3/tests/ethpm-v3.js index a55612bdd53..81b906d0e6f 100644 --- a/packages/ethpm-v3/tests/ethpm-v3.js +++ b/packages/ethpm-v3/tests/ethpm-v3.js @@ -198,7 +198,7 @@ describe("EthPM install", function () { }); it("requires a valid package name and version to install", async () => { - config.packageId = `erc1319://${registry._address}:1`; + config.packageIdentifier = `erc1319://${registry._address}:1`; try { await PackageV3.install(config); } catch (error) { @@ -209,7 +209,7 @@ describe("EthPM install", function () { }); it("invalidates ethpm uris for packages not published on itself", async () => { - config.packageId = `erc1319://${registry._address}:1/invalid@1.0.0`; + config.packageIdentifier = `erc1319://${registry._address}:1/invalid@1.0.0`; try { await PackageV3.install(config); } catch (error) { @@ -220,7 +220,7 @@ describe("EthPM install", function () { }); it("successfully installs single dependency from EthPM", async () => { - config.packageId = `erc1319://${registry._address}:1/ens@1.0.0`; + config.packageIdentifier = `erc1319://${registry._address}:1/ens@1.0.0`; await PackageV3.install(config); const expected_ethpm_directory = path.resolve( path.join(config.working_directory, "_ethpm_packages") @@ -238,7 +238,7 @@ describe("EthPM install", function () { }); it("successfully installs and provisions a package with dependencies from EthPMv3", async () => { - config.packageId = `erc1319://${registry._address}:1/ens@1.0.0`; + config.packageIdentifier = `erc1319://${registry._address}:1/ens@1.0.0`; await PackageV3.install(config); // Write a contract that uses transferable, so it will be compiled. @@ -263,7 +263,7 @@ describe("EthPM install", function () { // In addition, this package contains deployments. We need to make sure these deployments are available. it("successfully installs and provisions a deployed package with network artifacts from EthPM, without compiling v3", async () => { await Contracts.compile(config.with({ all: true, quiet: true })); - config.packageId = `erc1319://${registry._address}:1/ens@1.0.0`; + config.packageIdentifier = `erc1319://${registry._address}:1/ens@1.0.0`; await PackageV3.install(config); // Make sure we can resolve it. @@ -289,7 +289,7 @@ describe("EthPM install", function () { const installed_package = "ethregistrar"; const expected_contract_name = "BaseRegistrarImplementation"; - config.packageId = `erc1319://${registry._address}:1/ethregistrar@3.0.0`; + config.packageIdentifier = `erc1319://${registry._address}:1/ethregistrar@3.0.0`; await PackageV3.install(config); var expected_manifest_path = path.join( diff --git a/packages/truffle/test/scenarios/commands/install.js b/packages/truffle/test/scenarios/commands/install.js index 1e5bdcd792e..5807427e875 100644 --- a/packages/truffle/test/scenarios/commands/install.js +++ b/packages/truffle/test/scenarios/commands/install.js @@ -5,7 +5,7 @@ const fse = require("fs-extra"); const path = require("path"); let config; -describe("truffle install [ @standalone ]", () => { +describe("truffle install [standalone]", () => { before(async () => { config = await sandbox.create( path.join(__dirname, "../../sources/install/init") @@ -14,9 +14,9 @@ describe("truffle install [ @standalone ]", () => { }); it("unboxes successfully", async () => { - await CommandRunner.run("install zeppelin", config); + await CommandRunner.run("install owned", config); const theInstallDirExists = fse.pathExistsSync( - path.join(config.working_directory, "installed_contracts") + path.join(config.working_directory, "_ethpm_packages") ); assert(theInstallDirExists); }).timeout(20000); diff --git a/packages/truffle/test/sources/ethpm/installed_contracts/tokens/contracts/Migrations.sol b/packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/contracts/Migrations.sol similarity index 100% rename from packages/truffle/test/sources/ethpm/installed_contracts/tokens/contracts/Migrations.sol rename to packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/contracts/Migrations.sol diff --git a/packages/truffle/test/sources/ethpm/installed_contracts/tokens/contracts/eip20/EIP20.sol b/packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/contracts/eip20/EIP20.sol similarity index 100% rename from packages/truffle/test/sources/ethpm/installed_contracts/tokens/contracts/eip20/EIP20.sol rename to packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/contracts/eip20/EIP20.sol diff --git a/packages/truffle/test/sources/ethpm/installed_contracts/tokens/contracts/eip20/EIP20Factory.sol b/packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/contracts/eip20/EIP20Factory.sol similarity index 100% rename from packages/truffle/test/sources/ethpm/installed_contracts/tokens/contracts/eip20/EIP20Factory.sol rename to packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/contracts/eip20/EIP20Factory.sol diff --git a/packages/truffle/test/sources/ethpm/installed_contracts/tokens/contracts/eip20/EIP20Interface.sol b/packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/contracts/eip20/EIP20Interface.sol similarity index 100% rename from packages/truffle/test/sources/ethpm/installed_contracts/tokens/contracts/eip20/EIP20Interface.sol rename to packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/contracts/eip20/EIP20Interface.sol diff --git a/packages/truffle/test/sources/ethpm/installed_contracts/tokens/ethpm.json b/packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/ethpm.json similarity index 89% rename from packages/truffle/test/sources/ethpm/installed_contracts/tokens/ethpm.json rename to packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/ethpm.json index aaf7906c80b..31b790d4046 100644 --- a/packages/truffle/test/sources/ethpm/installed_contracts/tokens/ethpm.json +++ b/packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/ethpm.json @@ -17,7 +17,6 @@ "./contracts/eip20/EIP20Interface.sol" ], "dependencies": {}, - "manifest_version": 1, - "package_name": "tokens", + "name": "tokens", "version": "1.0.0" -} \ No newline at end of file +} diff --git a/packages/truffle/test/sources/ethpm/installed_contracts/tokens/lock.json b/packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/lock.json similarity index 100% rename from packages/truffle/test/sources/ethpm/installed_contracts/tokens/lock.json rename to packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/lock.json diff --git a/packages/truffle/test/sources/ethpm/installed_contracts/tokens/lock.uri b/packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/lock.uri similarity index 100% rename from packages/truffle/test/sources/ethpm/installed_contracts/tokens/lock.uri rename to packages/truffle/test/sources/ethpm/_ethpm_packages/tokens/lock.uri