Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Master #1

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ TODO
.tern-project
.DS_Store
.tern-port
yarn.lock
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mhart/alpine-node:6.9.2
FROM mhart/alpine-node:7.9.0

RUN apk add --no-cache make gcc g++ python git bash
COPY package.json /src/package.json
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ There’s also special non-standard methods that aren’t included within the or

# Docker

The Simplest way to get stared with the Docker image:
The Simplest way to get started with the Docker image:

```Bash
docker run -d -p 8545:8545 ethereumjs/testrpc:latest
Expand Down
4 changes: 4 additions & 0 deletions lib/blockchain_double.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,10 @@ BlockchainDouble.prototype.processTransactionTrace = function(hash, params, call
this.getTransactionReceipt(target_hash, function(err, receipt) {
if (err) return callback(err);

if (!receipt) {
return callback(new Error("Unknown transaction " + target_hash));
}

var targetBlock = receipt.block;

// Get the parent of the target block
Expand Down
4 changes: 2 additions & 2 deletions lib/statemanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ StateManager.prototype.printTransactionReceipt = function(tx_hash, error, callba
self.logger.log(" Contract created: " + receipt.contractAddress);
}

self.logger.log(" Gas usage: " + receipt.gasUsed);
self.logger.log(" Block Number: " + receipt.blockNumber);
self.logger.log(" Gas usage: " + parseInt(receipt.gasUsed, 16));
self.logger.log(" Block Number: " + parseInt(receipt.blockNumber, 16));
self.logger.log(" Block Time: " + new Date(to.number(block.header.timestamp) * 1000).toString());

if (error) {
Expand Down
15 changes: 12 additions & 3 deletions lib/subproviders/geth_api_double.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,13 @@ GethApiDouble.prototype.eth_getCode = function(address, block_number, callback)

GethApiDouble.prototype.eth_getBlockByNumber = function(block_number, include_full_transactions, callback) {
this.state.blockchain.getBlock(block_number, function(err, block) {
if (err) return callback(err);
if (err) {
if (err.message && err.message.indexOf("index out of range") >= 0) {
return callback(null, null);
} else {
return callback(err);
}
}

callback(null, {
number: to.hex(block.header.number),
Expand Down Expand Up @@ -345,9 +351,12 @@ GethApiDouble.prototype.evm_mine = function(callback) {
};

GethApiDouble.prototype.debug_traceTransaction = function(tx_hash, params, callback) {
if (typeof params == "function") {
callback = params;
params = [];
}

this.state.queueTransactionTrace(tx_hash, params, callback);
};



module.exports = GethApiDouble;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ganache-core",
"version": "0.0.1",
"version": "1.0.1",
"main": "./index.js",
"directories": {
"lib": "./lib"
Expand All @@ -15,7 +15,7 @@
"chai": "^3.5.0",
"ethereumjs-account": "~2.0.4",
"ethereumjs-block": "~1.2.2",
"ethereumjs-tx": "1.1.2",
"ethereumjs-tx": "^1.3.0",
"ethereumjs-util": "~5.1.0",
"ethereumjs-vm": "~2.0.1",
"ethereumjs-wallet": "~0.6.0",
Expand Down
9 changes: 9 additions & 0 deletions test/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@ var tests = function(web3) {
});
});

it("should return null given a future block number", function(done) {
web3.eth.getBlock(10000, true, function(err, block) {
if (err) return done(err);

assert.deepEqual(block, null);
done();
});
});

it("should return transactions in the block as well", function(done) {
web3.eth.sendTransaction({
from: accounts[0],
Expand Down