aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-profiler
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sol-profiler')
-rw-r--r--packages/sol-profiler/.npmignore6
-rw-r--r--packages/sol-profiler/CHANGELOG.json75
-rw-r--r--packages/sol-profiler/CHANGELOG.md38
-rw-r--r--packages/sol-profiler/README.md75
-rw-r--r--packages/sol-profiler/package.json50
-rw-r--r--packages/sol-profiler/src/globals.d.ts7
-rw-r--r--packages/sol-profiler/src/index.ts27
-rw-r--r--packages/sol-profiler/src/profiler_subprovider.ts98
-rw-r--r--packages/sol-profiler/tsconfig.json8
-rw-r--r--packages/sol-profiler/tslint.json3
-rw-r--r--packages/sol-profiler/typedoc-tsconfig.json7
11 files changed, 0 insertions, 394 deletions
diff --git a/packages/sol-profiler/.npmignore b/packages/sol-profiler/.npmignore
deleted file mode 100644
index 037786e46..000000000
--- a/packages/sol-profiler/.npmignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.*
-yarn-error.log
-/src/
-/scripts/
-tsconfig.json
-/lib/src/monorepo_scripts/
diff --git a/packages/sol-profiler/CHANGELOG.json b/packages/sol-profiler/CHANGELOG.json
deleted file mode 100644
index 89f3f7171..000000000
--- a/packages/sol-profiler/CHANGELOG.json
+++ /dev/null
@@ -1,75 +0,0 @@
-[
- {
- "version": "2.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ],
- "timestamp": 1549547375
- },
- {
- "timestamp": 1549452781,
- "version": "2.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "2.0.1",
- "changes": [
- {
- "note": "Fix a bug when some parts of the profiling report were missing because of the coverage ignore lines",
- "pr": 1535
- }
- ],
- "timestamp": 1549373905
- },
- {
- "version": "2.0.0",
- "changes": [
- {
- "note": "Upgrade the bignumber.js to v8.0.2",
- "pr": 1517
- }
- ]
- },
- {
- "timestamp": 1547747677,
- "version": "1.0.3",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1547561734,
- "version": "1.0.2",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "timestamp": 1547225310,
- "version": "1.0.1",
- "changes": [
- {
- "note": "Dependencies updated"
- }
- ]
- },
- {
- "version": "1.0.0",
- "changes": [
- {
- "note": "Initial release as a separate package. For historical entries see @0x/sol-tracing-utils",
- "pr": 1492
- }
- ]
- }
-]
diff --git a/packages/sol-profiler/CHANGELOG.md b/packages/sol-profiler/CHANGELOG.md
deleted file mode 100644
index bf9e59e54..000000000
--- a/packages/sol-profiler/CHANGELOG.md
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-changelogUtils.file is auto-generated using the monorepo-scripts package. Don't edit directly.
-Edit the package's CHANGELOG.json file only.
--->
-
-CHANGELOG
-
-## v2.0.3 - _February 7, 2019_
-
- * Dependencies updated
-
-## v2.0.2 - _February 6, 2019_
-
- * Dependencies updated
-
-## v2.0.1 - _February 5, 2019_
-
- * Fix a bug when some parts of the profiling report were missing because of the coverage ignore lines (#1535)
-
-## v2.0.0 - _Invalid date_
-
- * Upgrade the bignumber.js to v8.0.2 (#1517)
-
-## v1.0.3 - _January 17, 2019_
-
- * Dependencies updated
-
-## v1.0.2 - _January 15, 2019_
-
- * Dependencies updated
-
-## v1.0.1 - _January 11, 2019_
-
- * Dependencies updated
-
-## v1.0.0 - _Invalid date_
-
- * Initial release as a separate package. For historical entries see @0x/sol-tracing-utils (#1492)
diff --git a/packages/sol-profiler/README.md b/packages/sol-profiler/README.md
deleted file mode 100644
index 44fa29e3f..000000000
--- a/packages/sol-profiler/README.md
+++ /dev/null
@@ -1,75 +0,0 @@
-## @0x/sol-profiler
-
-Solidity line-by-line gas profiler.
-
-### Read the [Documentation](https://0xproject.com/docs/sol-profiler).
-
-## Installation
-
-```bash
-yarn add @0x/sol-profiler
-```
-
-**Import**
-
-```javascript
-import { ProfilerSubprovider } from '@0x/sol-profiler';
-```
-
-or
-
-```javascript
-var ProfilerSubprovider = require('@0x/sol-profiler').ProfilerSubprovider;
-```
-
-## Contributing
-
-We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
-
-Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
-
-### Install dependencies
-
-If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
-
-```bash
-yarn config set workspaces-experimental true
-```
-
-Then install dependencies
-
-```bash
-yarn install
-```
-
-### Build
-
-To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
-
-```bash
-PKG=@0x/sol-profiler yarn build
-```
-
-Or continuously rebuild on change:
-
-```bash
-PKG=@0x/sol-profiler yarn watch
-```
-
-### Clean
-
-```bash
-yarn clean
-```
-
-### Lint
-
-```bash
-yarn lint
-```
-
-### Run Tests
-
-```bash
-yarn test
-```
diff --git a/packages/sol-profiler/package.json b/packages/sol-profiler/package.json
deleted file mode 100644
index cce49e22e..000000000
--- a/packages/sol-profiler/package.json
+++ /dev/null
@@ -1,50 +0,0 @@
-{
- "name": "@0x/sol-profiler",
- "version": "2.0.3",
- "engines": {
- "node": ">=6.12"
- },
- "description": "Generate profiler reports for Solidity code",
- "main": "lib/src/index.js",
- "types": "lib/src/index.d.ts",
- "scripts": {
- "build": "tsc -b",
- "build:ci": "yarn build",
- "lint": "tslint --format stylish --project .",
- "clean": "shx rm -rf lib src/artifacts generated_docs",
- "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --tsconfig typedoc-tsconfig.json --json $JSON_FILE_PATH $PROJECT_FILES"
- },
- "config": {
- "postpublish": {
- "assets": []
- }
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/0xProject/0x-monorepo.git"
- },
- "license": "Apache-2.0",
- "bugs": {
- "url": "https://github.com/0xProject/0x-monorepo/issues"
- },
- "homepage": "https://github.com/0xProject/0x-monorepo/packages/sol-profiler/README.md",
- "dependencies": {
- "@0x/sol-tracing-utils": "^6.0.2",
- "@0x/subproviders": "^3.0.2",
- "@0x/typescript-typings": "^4.0.0",
- "ethereum-types": "^2.0.0",
- "lodash": "^4.17.11"
- },
- "devDependencies": {
- "@0x/tslint-config": "^3.0.0",
- "@types/node": "*",
- "npm-run-all": "^4.1.2",
- "shx": "^0.2.2",
- "tslint": "5.11.0",
- "typedoc": "0.13.0",
- "typescript": "3.0.1"
- },
- "publishConfig": {
- "access": "public"
- }
-}
diff --git a/packages/sol-profiler/src/globals.d.ts b/packages/sol-profiler/src/globals.d.ts
deleted file mode 100644
index e799b3529..000000000
--- a/packages/sol-profiler/src/globals.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// tslint:disable:completed-docs
-declare module '*.json' {
- const json: any;
- /* tslint:disable */
- export default json;
- /* tslint:enable */
-}
diff --git a/packages/sol-profiler/src/index.ts b/packages/sol-profiler/src/index.ts
deleted file mode 100644
index fcb715d2d..000000000
--- a/packages/sol-profiler/src/index.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-export {
- AbstractArtifactAdapter,
- SolCompilerArtifactAdapter,
- TruffleArtifactAdapter,
- ContractData,
- SourceCodes,
- Sources,
-} from '@0x/sol-tracing-utils';
-
-// HACK: ProfilerSubprovider is a hacky way to do profiling using coverage tools. Not production ready
-export { ProfilerSubprovider } from './profiler_subprovider';
-
-export {
- JSONRPCRequestPayload,
- Provider,
- JSONRPCErrorCallback,
- JSONRPCResponsePayload,
- JSONRPCResponseError,
-} from 'ethereum-types';
-
-export {
- JSONRPCRequestPayloadWithMethod,
- NextCallback,
- ErrorCallback,
- OnNextCompleted,
- Callback,
-} from '@0x/subproviders';
diff --git a/packages/sol-profiler/src/profiler_subprovider.ts b/packages/sol-profiler/src/profiler_subprovider.ts
deleted file mode 100644
index 9f195f768..000000000
--- a/packages/sol-profiler/src/profiler_subprovider.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-import * as _ from 'lodash';
-
-import {
- AbstractArtifactAdapter,
- collectCoverageEntries,
- ContractData,
- Coverage,
- SingleFileSubtraceHandler,
- SourceRange,
- Subtrace,
- TraceCollector,
- TraceInfo,
- TraceInfoSubprovider,
- utils,
-} from '@0x/sol-tracing-utils';
-
-/**
- * This class implements the [web3-provider-engine](https://github.com/MetaMask/provider-engine) subprovider interface.
- * ProfilerSubprovider is used to profile Solidity code while running tests.
- */
-export class ProfilerSubprovider extends TraceInfoSubprovider {
- private readonly _profilerCollector: TraceCollector;
- /**
- * Instantiates a ProfilerSubprovider instance
- * @param artifactAdapter Adapter for used artifacts format (0x, truffle, giveth, etc.)
- * @param defaultFromAddress default from address to use when sending transactions
- * @param isVerbose If true, we will log any unknown transactions. Otherwise we will ignore them
- */
- constructor(artifactAdapter: AbstractArtifactAdapter, defaultFromAddress: string, isVerbose: boolean = true) {
- const traceCollectionSubproviderConfig = {
- shouldCollectTransactionTraces: true,
- shouldCollectGasEstimateTraces: false,
- shouldCollectCallTraces: false,
- };
- super(defaultFromAddress, traceCollectionSubproviderConfig);
- this._profilerCollector = new TraceCollector(artifactAdapter, isVerbose, profilerHandler);
- }
- protected async _handleTraceInfoAsync(traceInfo: TraceInfo): Promise<void> {
- await this._profilerCollector.computeSingleTraceCoverageAsync(traceInfo);
- }
- /**
- * Write the test profiler results to a file in Istanbul format.
- */
- public async writeProfilerOutputAsync(): Promise<void> {
- await this._profilerCollector.writeOutputAsync();
- }
-}
-
-/**
- * Computed partial coverage for a single file & subtrace for the purposes of
- * gas profiling.
- * @param contractData Contract metadata (source, srcMap, bytecode)
- * @param subtrace A subset of a transcation/call trace that was executed within that contract
- * @param pcToSourceRange A mapping from program counters to source ranges
- * @param fileIndex Index of a file to compute coverage for
- * @return Partial istanbul coverage for that file & subtrace
- */
-export const profilerHandler: SingleFileSubtraceHandler = (
- contractData: ContractData,
- subtrace: Subtrace,
- pcToSourceRange: { [programCounter: number]: SourceRange },
- fileIndex: number,
-): Coverage => {
- const absoluteFileName = contractData.sources[fileIndex];
- const profilerEntriesDescription = collectCoverageEntries(contractData.sourceCodes[fileIndex]);
- const statementToGasConsumed: { [statementId: string]: number } = {};
- const statementIds = _.keys(profilerEntriesDescription.statementMap);
- for (const statementId of statementIds) {
- const statementDescription = profilerEntriesDescription.statementMap[statementId];
- const totalGasCost = _.sum(
- _.map(subtrace, structLog => {
- const sourceRange = pcToSourceRange[structLog.pc];
- if (_.isUndefined(sourceRange)) {
- return 0;
- }
- if (sourceRange.fileName !== absoluteFileName) {
- return 0;
- }
- if (utils.isRangeInside(sourceRange.location, statementDescription)) {
- return structLog.gasCost;
- } else {
- return 0;
- }
- }),
- );
- statementToGasConsumed[statementId] = totalGasCost;
- }
- const partialProfilerOutput = {
- [absoluteFileName]: {
- ...profilerEntriesDescription,
- path: absoluteFileName,
- f: {}, // I's meaningless in profiling context
- s: statementToGasConsumed,
- b: {}, // I's meaningless in profiling context
- },
- };
- return partialProfilerOutput;
-};
diff --git a/packages/sol-profiler/tsconfig.json b/packages/sol-profiler/tsconfig.json
deleted file mode 100644
index 233008d61..000000000
--- a/packages/sol-profiler/tsconfig.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "rootDir": "."
- },
- "include": ["./src/**/*"]
-}
diff --git a/packages/sol-profiler/tslint.json b/packages/sol-profiler/tslint.json
deleted file mode 100644
index dd9053357..000000000
--- a/packages/sol-profiler/tslint.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "extends": ["@0x/tslint-config"]
-}
diff --git a/packages/sol-profiler/typedoc-tsconfig.json b/packages/sol-profiler/typedoc-tsconfig.json
deleted file mode 100644
index a4c669cb6..000000000
--- a/packages/sol-profiler/typedoc-tsconfig.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "extends": "../../typedoc-tsconfig",
- "compilerOptions": {
- "outDir": "lib"
- },
- "include": ["./src/**/*"]
-}