New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@openzeppelin/test-helpers

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openzeppelin/test-helpers - npm Package Compare versions

Comparing version
0.5.12
to
0.5.13-0
+7
-0
CHANGELOG.md
# Changelog
## 0.5.13 (2021-08-12)
* Changed `send.ether` so it no longer forces `gasPrice: 0`.
NOTE: This may break some tests but gas price 0 is no longer valid since the London hard fork.
* Added `tracker.deltaWithFees`.
## 0.5.12 (2021-07-05)

@@ -4,0 +11,0 @@ * Added new `snapshot` module to capture and revert blockchain state.

+2
-2
{
"name": "@openzeppelin/test-helpers",
"version": "0.5.12",
"version": "0.5.13-0",
"description": "JavaScript testing helpers for Ethereum smart contract development.",

@@ -60,5 +60,5 @@ "main": "index.js",

"ganache-cli": "^6.5.0",
"openzeppelin-docs-utils": "github:OpenZeppelin/docs-utils",
"openzeppelin-docs-utils": "git+https://OpenZeppelin@github.com/OpenZeppelin/docs-utils.git",
"truffle": "^5.1.46"
}
}

@@ -10,2 +10,6 @@ const { web3, BN } = require('./setup');

async delta (unit = this.unit) {
const { delta } = await this.deltaWithFees(unit);
return delta;
}
async deltaWithFees (unit = this.unit) {
const current = await balanceCurrent(this.account);

@@ -15,7 +19,13 @@ const delta = current.sub(this.prev);

return new BN(fromWei(delta, unit));
const fees = await feesPaid(this.account, this.prevBlock);
this.prevBlock = await web3.eth.getBlockNumber();
return {
delta: new BN(fromWei(delta, unit)),
fees: new BN(fromWei(fees, unit)),
};
}
async get (unit = this.unit) {
this.prev = await balanceCurrent(this.account);
this.prevBlock = await web3.eth.getBlockNumber();
return new BN(fromWei(this.prev, unit));

@@ -35,2 +45,20 @@ }

async function feesPaid (account, sinceBlock) {
const currentBlock = await web3.eth.getBlockNumber();
let gas = new BN('0');
for (let b = sinceBlock + 1; b <= currentBlock; b += 1) {
const { transactions } = await web3.eth.getBlock(b);
for (const tx of transactions) {
const { from, gasPrice } = await web3.eth.getTransaction(tx);
if (from === account) {
const { gasUsed } = await web3.eth.getTransactionReceipt(tx);
gas = gas.add(new BN(gasPrice).muln(gasUsed));
}
}
}
return gas;
}
module.exports = {

@@ -37,0 +65,0 @@ current: balanceCurrent,

@@ -25,3 +25,3 @@ const { web3 } = require('./setup');

function ether (from, to, value) {
return web3.eth.sendTransaction({ from, to, value, gasPrice: 0 });
return web3.eth.sendTransaction({ from, to, value });
}

@@ -28,0 +28,0 @@