Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eth-gas-reporter

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eth-gas-reporter - npm Package Compare versions

Comparing version 0.1.12 to 0.2.0

mock/contracts/Undeployed.sol

2

CHANGELOG.md
## Changelog: eth-gas-reporter
0.1.11 / 2018-09-13
0.1.12 / 2018-09-14
===================

@@ -5,0 +5,0 @@ * Allow contracts to share method signatures (contribution @wighawag)

@@ -94,11 +94,5 @@ /**

const deployedContracts = {};
for(const key of Object.keys(contractNameFromCodeHash)) {
deployedContracts[contractNameFromCodeHash[key]] = true;
}
_.forEach(methodMap, (data, methodId) => {
if (!data) return
if(!deployedContracts[data.contract]) return // skip contract that were not deployed
let stats = {}

@@ -268,3 +262,3 @@

*/
async function getGasAndPriceRates (config=null) {
async function getGasAndPriceRates (config={}) {

@@ -387,5 +381,5 @@ const defaultGasPrice = 5

// report the gas used during initial truffle migration too :
// Report the gas used during initial truffle migration too :
const networkDeployment = contract.networks[networkId]
if (networkDeployment) {
if (networkDeployment && networkDeployment.transactionHash) {
const code = sync.getCode(networkDeployment.address);

@@ -413,2 +407,3 @@ const hash = sha1(code);

methodMap[name + '_' + key] = {
key: key,
contract: name,

@@ -415,0 +410,0 @@ method: methodIDs[key].name,

@@ -63,10 +63,34 @@ const mocha = require('mocha')

const receipt = sync.getTransactionReceipt(tx);
// Don't count methods that throw
const threw = parseInt(receipt.status) === 0 || receipt.status === false;
if (threw) return
const code = sync.getCode(transaction.to);
const hash = sha1(code);
const contractName = contractNameFromCodeHash[hash];
let contractName = contractNameFromCodeHash[hash];
// Handle cases where we don't have a deployment record for the contract
// or where we *do* (from migrations) but tx actually interacts with a
// proxy / something doesn't match.
let isProxied = false;
if (contractName) {
let candidateId = stats.getMethodID(contractName, transaction.input)
isProxied = !methodMap[candidateId]
}
// If unfound, search by fnHash alone instead of contract_fnHash
if (!contractName || isProxied ) {
let key = transaction.input.slice(2, 10);
let matches = Object.values(methodMap).filter(el => el.key === key);
if (matches.length >= 1) {
contractName = matches[0].contract;
}
}
const id = stats.getMethodID(contractName, transaction.input)
let threw = parseInt(receipt.status) === 0 || receipt.status === false;
if (methodMap[id] && !threw) {
if (methodMap[id]) {
methodMap[id].gasData.push(parseInt(receipt.gasUsed, 16))

@@ -73,0 +97,0 @@ methodMap[id].numberOfCalls++

@@ -6,2 +6,3 @@ var ConvertLib = artifacts.require('./ConvertLib.sol')

var VariableConstructor = artifacts.require('./VariableConstructor')
var Undeployed = artifacts.require('./Undeployed')

@@ -11,2 +12,3 @@ module.exports = function (deployer) {

deployer.link(ConvertLib, MetaCoin)
deployer.link(ConvertLib, Undeployed)
deployer.deploy(MetaCoin)

@@ -13,0 +15,0 @@ deployer.deploy(Wallet)

{
"name": "eth-gas-reporter",
"version": "0.1.10",
"version": "0.1.12",
"description": "Mocha reporter which shows gas used per unit test.",

@@ -8,3 +8,4 @@ "main": "index.js",

"geth": "./scripts/geth.sh",
"test": "./mock/test.sh"
"test": "./mock/test.sh",
"ci": "./scripts/ci.sh"
},

@@ -29,19 +30,19 @@ "repository": {

"dependencies": {
"abi-decoder": "^1.0.8",
"abi-decoder": "^1.2.0",
"cli-table3": "^0.5.0",
"colors": "^1.1.2",
"lodash": "^4.17.4",
"lodash": "^4.17.11",
"mocha": "^4.1.0",
"req-cwd": "^2.0.0",
"request": "^2.83.0",
"request": "^2.88.0",
"request-promise-native": "^1.0.5",
"sha1": "^1.1.1",
"shelljs": "^0.7.8",
"solidity-parser-antlr": "^0.2.10",
"solidity-parser-antlr": "^0.4.2",
"sync-request": "^6.0.0"
},
"devDependencies": {
"ganache-cli": "6.1.0",
"truffle": "^5.0.0-next.3"
"ganache-cli": "^6.4.3",
"truffle": "^5.0.15"
}
}
{
"name": "eth-gas-reporter",
"version": "0.1.12",
"version": "0.2.0",
"description": "Mocha reporter which shows gas used per unit test.",

@@ -8,3 +8,4 @@ "main": "index.js",

"geth": "./scripts/geth.sh",
"test": "./mock/test.sh"
"test": "./mock/test.sh",
"ci": "./scripts/ci.sh"
},

@@ -29,19 +30,19 @@ "repository": {

"dependencies": {
"abi-decoder": "^1.0.8",
"abi-decoder": "^1.2.0",
"cli-table3": "^0.5.0",
"colors": "^1.1.2",
"lodash": "^4.17.4",
"lodash": "^4.17.11",
"mocha": "^4.1.0",
"req-cwd": "^2.0.0",
"request": "^2.83.0",
"request": "^2.88.0",
"request-promise-native": "^1.0.5",
"sha1": "^1.1.1",
"shelljs": "^0.7.8",
"solidity-parser-antlr": "^0.2.10",
"solidity-parser-antlr": "^0.4.2",
"sync-request": "^6.0.0"
},
"devDependencies": {
"ganache-cli": "6.1.0",
"truffle": "^5.0.0-next.3"
"ganache-cli": "^6.4.3",
"truffle": "^5.0.15"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc