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

Filecoin support! #603

Closed
wants to merge 462 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
462 commits
Select commit Hold shift + click to select a range
38b0feb
Type JSON.parse so it takes Buffers
davidmurdoch May 12, 2020
0db4551
Try to get tests working in CI again
davidmurdoch May 12, 2020
a902030
I don't understand anything
davidmurdoch May 12, 2020
26f06ba
Move types to top level
davidmurdoch May 12, 2020
132b4ae
Emit block after it is saved.
davidmurdoch May 12, 2020
0634a1d
Make Options more neatly imported
davidmurdoch May 12, 2020
82489cc
Make utils a little more neatly imported
davidmurdoch May 12, 2020
3908208
Improve server and ws-server test coverage
davidmurdoch May 12, 2020
97e93f0
Additional test coverage
davidmurdoch May 13, 2020
575c111
Udpate create script
davidmurdoch May 13, 2020
bdcce36
Update dependencies
davidmurdoch May 13, 2020
2c340b4
Update dependencies
davidmurdoch May 13, 2020
7310dd4
Move some tests over to the ethereum package
davidmurdoch May 13, 2020
15a58cd
More more tests over to Ethereum
davidmurdoch May 13, 2020
6196d72
Test contract writes
davidmurdoch May 14, 2020
47babba
Don't publish the scripts directory to npm
davidmurdoch Jun 4, 2020
870e741
fIx typo in comment
davidmurdoch Jun 4, 2020
675d0d6
Document blockTime parameter
davidmurdoch Jun 4, 2020
6de914e
add blockTime option to Ethereum options
davidmurdoch Jun 4, 2020
ea535d4
add TODO for `net_listening`
davidmurdoch Jun 4, 2020
f7c2aa6
add blockTime to etehreum blockchain options
davidmurdoch Jun 4, 2020
27cbbad
update typescript to v3.9.5
davidmurdoch Jun 4, 2020
94815b4
Some pending tx stuff
davidmurdoch Jun 6, 2020
c23ebdb
Add eth_sign
davidmurdoch Jun 9, 2020
35b2a3b
return block header on newHeads subscription
davidmurdoch Jun 9, 2020
ab33c68
support legacy provider subscription
davidmurdoch Jun 9, 2020
e8d2a12
add eth_getTransactionCount
davidmurdoch Jun 9, 2020
6188d5c
add ganache_setAccountNonce
davidmurdoch Jun 9, 2020
4e7447a
Support fractional amounts od `default_balance_ether`
davidmurdoch Jun 9, 2020
b094894
support gasPrice option as Quantity or string/number
davidmurdoch Jun 9, 2020
10fb243
handle evm_mine miner_start/_stop rpcs
davidmurdoch Jun 9, 2020
dfa6442
improve var name of web3_sha3 rpc
davidmurdoch Jun 11, 2020
90ee437
Don't mind an empty block after a successful one
davidmurdoch Jun 11, 2020
81c0222
fix typo in comment
davidmurdoch Jun 12, 2020
da7e7ea
update lerna and mocha
davidmurdoch Jun 12, 2020
5bd0716
organize npm scripts
davidmurdoch Jun 12, 2020
6388e94
Allow mining empty transactions
davidmurdoch Jun 26, 2020
4521e78
Fix multi-tx test
davidmurdoch Jun 26, 2020
99639bb
Refactor `getDefault` server-options function
davidmurdoch Jun 26, 2020
247187f
add evm_setTime and evm_increaseTime
davidmurdoch Jun 27, 2020
e6d097a
Improve initial installation experience
davidmurdoch Jul 1, 2020
55cb6dc
update dependencies
davidmurdoch Jul 2, 2020
bbc60bb
Update dependencies
davidmurdoch Jul 2, 2020
dae3d65
Remove source-map-support from tests as it causes problems in node 14…
davidmurdoch Jul 2, 2020
b44b989
DNM; switching to new comp; WIP
tcoulter Jul 10, 2020
f36ea2c
Update developer contributor installation instructions
davidmurdoch Jul 10, 2020
ef4ccfd
whitespace fix in compile.ts
davidmurdoch Jul 10, 2020
9c065bc
Update to match EIP1193
davidmurdoch Jul 10, 2020
a06b159
vscode has a hard time with detecting the target when extending from …
davidmurdoch Jul 10, 2020
e08c30f
Explain what unref is for
davidmurdoch Jul 10, 2020
e80f5c6
Wrap code comment in database.ts
davidmurdoch Jul 10, 2020
d12fc7b
Fix comparison of bigint to a number
davidmurdoch Jul 10, 2020
2339486
Update code to use TS 4.0.0-beta features
davidmurdoch Jul 10, 2020
1baad19
Wrap code comment in miner.ts
davidmurdoch Jul 10, 2020
a0a5d64
reformat some code in blockchain.ts
davidmurdoch Jul 10, 2020
587f8b6
Ensure consistent fn spacing in blockchain.ts
davidmurdoch Jul 10, 2020
715fe96
Fallback to block's `coinbase` when eth_call doesn't have a `from`
davidmurdoch Jul 10, 2020
c9d365d
Add `callGasLimit` option to Ethereum
davidmurdoch Jul 10, 2020
152627e
Stub out `eth_estimateGas`
davidmurdoch Jul 10, 2020
7f598f0
Add coinbase to eth_call's block
davidmurdoch Jul 10, 2020
e3c86a8
Add example for adding a module to a package
davidmurdoch Jul 10, 2020
b4a218a
FIx contract test broken by recent var rename
davidmurdoch Jul 10, 2020
7785fe7
Additional EIP-1193 changes
davidmurdoch Jul 11, 2020
9f66150
Refactor `putBlock`
davidmurdoch Jul 11, 2020
2dbb850
Undo that last one :-)
davidmurdoch Jul 11, 2020
89298d1
Add snapshot/revert
davidmurdoch Jul 11, 2020
9050cab
Use EIP-1193 style calls in the EthereumConnector
davidmurdoch Jul 11, 2020
088d5bd
Update comment after renaming class
davidmurdoch Jul 16, 2020
6dcbf20
organize tests
davidmurdoch Jul 17, 2020
a85a3fb
Add miner start/stop docs
davidmurdoch Jul 17, 2020
0aa2df9
Add miner_setGasPrice
davidmurdoch Jul 17, 2020
f132ba2
Add miner_setEtherbase
davidmurdoch Jul 17, 2020
b763799
Add param type for miner_setGasPrice
davidmurdoch Jul 17, 2020
eb040e4
Correct type passed to createBock
davidmurdoch Jul 17, 2020
3674ca0
Add eth_getCode
davidmurdoch Jul 17, 2020
fe731dc
Add actual mining status
davidmurdoch Jul 17, 2020
e109d3c
Document that "exact" modules versions should be installed
davidmurdoch Jul 20, 2020
b079df2
Move some deps to the ethereum package
davidmurdoch Jul 20, 2020
619e42b
Add eth_signTypedData
davidmurdoch Jul 20, 2020
6b441fb
Whitespace changes
davidmurdoch Jul 20, 2020
80168f2
Refactor eth_sign
davidmurdoch Jul 20, 2020
371f615
Refactor eth_sign
davidmurdoch Jul 20, 2020
99b00c0
Remove dead code
davidmurdoch Jul 20, 2020
2c9f7d5
Add rpc_modules
davidmurdoch Jul 20, 2020
564000b
Add ssh stubs
davidmurdoch Jul 20, 2020
0424707
Whitespace changes
davidmurdoch Jul 20, 2020
70c1ce4
Add EIP doctype comment to `eth_chainId`
davidmurdoch Jul 20, 2020
05eadef
Add bzz stubs
davidmurdoch Jul 20, 2020
a1f0d12
Add db_ stubs
davidmurdoch Jul 20, 2020
1e802eb
Add #region comment for eth_
davidmurdoch Jul 20, 2020
238e12c
Refactor eth_sendTransaction
davidmurdoch Jul 20, 2020
9c353e8
Add documentation to eth_getCode
davidmurdoch Jul 20, 2020
08c9d56
Add eth_submitHashrate
davidmurdoch Jul 20, 2020
0ff55ab
Add eth_submitWork
davidmurdoch Jul 20, 2020
01bd11d
Add eth_getWork
davidmurdoch Jul 20, 2020
b5c8a5c
Add eth_getUncleByBlockNumberAndIndex
davidmurdoch Jul 20, 2020
6d060e3
Add eth_getUncleByBlockHashAndIndex
davidmurdoch Jul 20, 2020
af28c53
Add eth_getCompilers
davidmurdoch Jul 20, 2020
efa458c
Add personal_ methods
davidmurdoch Jul 20, 2020
6a801ae
Move ethereum's @types to its src dir so they work
davidmurdoch Jul 20, 2020
bdbb75f
Create buffer from the preallocated buffer instead of new memory
davidmurdoch Jul 21, 2020
ac458e5
Remove dead code
davidmurdoch Jul 21, 2020
5756570
Add bzz stub tests
davidmurdoch Jul 21, 2020
107d3f4
Add db stub tests
davidmurdoch Jul 21, 2020
f2ff711
Add web3 tests
davidmurdoch Jul 21, 2020
884e201
Add levelup.LevelUp type to database
davidmurdoch Jul 21, 2020
2af253b
Handle callback style as promise
davidmurdoch Jul 21, 2020
bb68ad8
Implement `getRaw` for block tags
davidmurdoch Jul 21, 2020
a0bd1d2
Align invalid method error with geth
davidmurdoch Jul 21, 2020
b882cb2
Update version string to be more Ganachey
davidmurdoch Jul 21, 2020
cb41708
Add an uncle test
davidmurdoch Jul 21, 2020
197380b
Add storage tests
davidmurdoch Jul 21, 2020
6697836
Update getCode block-not-foudn behavior
davidmurdoch Jul 21, 2020
b0f9e1b
Refactor miner_stop/start
davidmurdoch Jul 21, 2020
b4b3a6b
Add eth_sign tests
davidmurdoch Jul 21, 2020
1f3393c
Avoid superfluous Promise in evm_mine
davidmurdoch Jul 21, 2020
35f2a43
Refactor eth_call
davidmurdoch Jul 21, 2020
a7fd940
First round-trip request with test (through the provider). Test is cu…
tcoulter Jul 21, 2020
732a73a
Merge branch 'ts' of https://github.com/trufflesuite/ganache-core int…
tcoulter Jul 21, 2020
e2cc72c
Update dev docs & include a `.vscode/launch.json`
davidmurdoch Jul 21, 2020
ee578af
just a little test
davidmurdoch Jul 21, 2020
f2f7b3f
Another test
davidmurdoch Jul 21, 2020
3745f40
Try again... it *might* just take github a moment to update
davidmurdoch Jul 21, 2020
c73824f
I think this fixes woes I had with patch-package
davidmurdoch Jul 21, 2020
e62bbfa
Make eth_accounts return lowercased accounts
davidmurdoch Jul 21, 2020
e9bc803
Ad tests for `personal_importRawKey`
davidmurdoch Jul 21, 2020
b85b3af
Add evm_mine tests
davidmurdoch Jul 21, 2020
174a703
Add describes to evm tests
davidmurdoch Jul 21, 2020
d1961d0
No changes. git is weird
davidmurdoch Jul 21, 2020
285aa11
Move eth_sign tests
davidmurdoch Jul 21, 2020
307f093
Add eth_coinbase test
davidmurdoch Jul 21, 2020
352dded
Add eth_mining test
davidmurdoch Jul 21, 2020
4b711fe
Add eth_hashrate test
davidmurdoch Jul 21, 2020
118d160
Add eth_protocolVersion test
davidmurdoch Jul 21, 2020
c1d9386
Fix test broken by lowercasing eth_accounts return values
davidmurdoch Jul 21, 2020
82d04c7
Fix evm_mine when interval mining
davidmurdoch Jul 21, 2020
eeff9ea
Add eth_syncing test
davidmurdoch Jul 21, 2020
e00f0de
Underlying data structure work
tcoulter Jul 22, 2020
88afa9c
add -E to lerna add example
davidmurdoch Jul 22, 2020
c3f9bff
Add scrypt-js dep
davidmurdoch Jul 22, 2020
8ee86f5
Add eth_getCompilers test
davidmurdoch Jul 22, 2020
b5aa678
Add miner_stop/eth_mining/miner_start tests
davidmurdoch Jul 22, 2020
5faee65
Make personal_* encrypt keys with ethereum key format
davidmurdoch Jul 22, 2020
fdf841a
Add miner_ tests
davidmurdoch Jul 22, 2020
02d8e67
chainId must be a number
davidmurdoch Jul 22, 2020
cb8db99
More data infra work. WIP
tcoulter Jul 22, 2020
b9106b5
Remove some superfluous return types
davidmurdoch Jul 22, 2020
a89e504
Add eth_submitWork test
davidmurdoch Jul 22, 2020
5088449
Add eth_getWork test
davidmurdoch Jul 22, 2020
9d0f190
Add eth_submitHashrate test
davidmurdoch Jul 22, 2020
059a092
Move types again
davidmurdoch Jul 23, 2020
9fd42dd
Completely restructured based on help from gnidan!
tcoulter Jul 23, 2020
9d83763
Add a schema object to the provider. Gear up for Ganache-custom metho…
tcoulter Jul 24, 2020
1d8e3dd
Merge branch 'ts' of https://github.com/trufflesuite/ganache-core int…
tcoulter Jul 24, 2020
536d144
Start structure for chain of tipsets; fix serialization
tcoulter Jul 24, 2020
89d43cc
Add tests for CID's and RootCID's
tcoulter Jul 24, 2020
5c1bb11
The "blockchain" is now actually a chain!
tcoulter Jul 24, 2020
cb6dc10
Now we have a blockchain that will mine on an interval!
tcoulter Jul 24, 2020
928a302
We now have miner objects, a StateListMiners API, a Block test!
tcoulter Jul 24, 2020
2699d60
And now we have an address!
tcoulter Jul 24, 2020
89b3bc2
And now we have (primitive) balance management for the default address!
tcoulter Jul 24, 2020
de8136e
Emit "ready", to gear up for async initialization of the IPFS server.
tcoulter Jul 24, 2020
b5f35b1
Foundation for launching an IPFS server! Includes start/stop and even…
tcoulter Jul 25, 2020
aac6b4b
Test refactoring to support IPFS server. Finish IPFS server test.
tcoulter Jul 26, 2020
372aac8
Storage proposal types. Also making serialized literals follow same s…
tcoulter Jul 27, 2020
b4244c6
Allow "mixed objects" - object defintiions with deserialized keys but…
tcoulter Jul 27, 2020
7e4e1b9
Whoops - wasn't supposed to be added.
tcoulter Jul 28, 2020
7d0020d
Add all-JS IPFS server and submitting of storage proposals
tcoulter Jul 28, 2020
d5a8072
Add automining, and advance deal states automatically when mining eac…
tcoulter Jul 28, 2020
588e751
Remove `newHeads` comment as it has been implemented
davidmurdoch Jul 28, 2020
278ebab
Add reason for using 10.7.0 as the lowest supported version.
davidmurdoch Jul 28, 2020
a7c7150
Add eth_getLogs
davidmurdoch Jul 28, 2020
8e13a32
Removme coverage reporter from ethereum test script
davidmurdoch Jul 28, 2020
5bccd6f
Move uncles tests and simplify some noop code
davidmurdoch Jul 28, 2020
310bc14
Fix and test eth_sendRawTransaction
davidmurdoch Jul 28, 2020
27ae1b3
Add shh_ tests
davidmurdoch Jul 28, 2020
f0d8c64
Change `Quantity.toBigInt` to return 0 instead of null when value is …
davidmurdoch Jul 28, 2020
014f608
Add test for eth_getTransactionCount
davidmurdoch Jul 28, 2020
2983276
Add test for rpc_modules
davidmurdoch Jul 28, 2020
bbadf47
Add test for evm_setAccountNonce
davidmurdoch Jul 28, 2020
d6350bf
Fix eth_unsubscribe and add test
davidmurdoch Jul 28, 2020
4ce562e
Fix a type error
davidmurdoch Jul 28, 2020
27f5a29
Add real address creation and proposal signing!
tcoulter Jul 29, 2020
f706d39
Lots of stuff (see description)
tcoulter Jul 30, 2020
2aff4fc
Lots more (see description)
tcoulter Jul 30, 2020
2ed372c
Merge branch 'ts' of https://github.com/trufflesuite/ganache-core int…
tcoulter Jul 30, 2020
cc841ba
npx lerna add typedoc -ED --scope=@ganache/ethereum
CruzMolina Jul 30, 2020
0713ca9
npx lerna add typedoc -ED --scope=@ganache/tezos
CruzMolina Jul 30, 2020
91cbe96
add build-docs script to chains/ethereum & chains/tezos
CruzMolina Jul 30, 2020
3961dee
add root build:docs script
CruzMolina Jul 30, 2020
5c48cf0
npx lerna add @trufflesuite/typedoc-default-themes -ED --scope=@ganac…
CruzMolina Jul 30, 2020
e982df4
add initial ethereum typedoc config
CruzMolina Jul 30, 2020
91496e9
rework chains/ethereum build:docs script
CruzMolina Jul 30, 2020
6e48234
adjust example code formatting for ethereum API
CruzMolina Jul 30, 2020
150d169
npx lerna add @trufflesuite/typedoc-default-themes -ED --scope=@ganac…
CruzMolina Jul 30, 2020
27023b0
add initial tezos typedoc config
CruzMolina Jul 30, 2020
5482fe2
rework chains/tezos build:docs script
CruzMolina Jul 30, 2020
5e4592d
Improve vscode debug performance
davidmurdoch Jul 31, 2020
d8704f6
Emittery return types are used anymore
davidmurdoch Jul 31, 2020
d51fa34
Add filter and log functions, and some tests.
davidmurdoch Jul 31, 2020
0682d36
Merge branch 'ts' of github.com:trufflesuite/ganache-core into ts
davidmurdoch Jul 31, 2020
836fdbf
npx lerna add open-cli -ED --scope=@ganache/ethereum
CruzMolina Jul 31, 2020
238b0b0
npx lerna add open-cli -ED --scope=@ganache/tezos
CruzMolina Jul 31, 2020
4e34735
add preview:docs script to chains/ethereum & chains/tezos
CruzMolina Jul 31, 2020
052b6b6
add root preview:docs script
CruzMolina Jul 31, 2020
ab1f454
Restructure options passed to Providers, Servers, and chain internals
tcoulter Jul 31, 2020
7fa905c
Make `npm run tsc` build runnable JS code!
davidmurdoch Jul 31, 2020
23b2e05
ensure we can test/debug w/out having to build 1st
davidmurdoch Jul 31, 2020
3b172dd
Add comment about why the index.ts file is present in each package
davidmurdoch Jul 31, 2020
ecaf22c
Hook up FilecoinConnector
tcoulter Jul 31, 2020
447a5dd
Merge branch 'ts' of https://github.com/trufflesuite/ganache-core int…
tcoulter Jul 31, 2020
a129bdc
Fix bad merge & make chains process their own default options
tcoulter Jul 31, 2020
3415ce8
Better documentation for uint-to-buffer
davidmurdoch Aug 1, 2020
ef6f153
Fix comment typo
davidmurdoch Aug 1, 2020
cbd4979
Add a too for making sure we clean up websocket listeners
davidmurdoch Aug 2, 2020
39d590a
Add script to easily clean up tsc output
tcoulter Aug 3, 2020
11a4d11
Should have gone with last commit
tcoulter Aug 3, 2020
b195239
Make deal states match what Powergate has
tcoulter Aug 3, 2020
7c593f5
Support ClientHasLocal api
tcoulter Aug 3, 2020
803ea25
emit the "ready" event correctly, clean up signatures.
tcoulter Aug 3, 2020
1d15192
Don't leak ws listeners
davidmurdoch Aug 3, 2020
9ce5303
FIx logs and pendingTranasctions subscriptions, add tests
davidmurdoch Aug 3, 2020
155f4cd
Support specifying the IPFS port to use
tcoulter Aug 3, 2020
0f5db70
Merge branch 'ts' of https://github.com/trufflesuite/ganache-core int…
tcoulter Aug 3, 2020
31358d0
Add optional logging
tcoulter Aug 4, 2020
93d4ca8
Subtract from balance when a proposal deal or retrieval offer is proc…
tcoulter Aug 4, 2020
9292794
Move blockchain instantiation to the provider
tcoulter Aug 4, 2020
1db8c6b
How did these even get here?
tcoulter Aug 4, 2020
464ba06
Add a nice toFIL helper
tcoulter Aug 4, 2020
1fdde03
`:Balance` was a nicety; adding on the `0` into `setTimeout` prevcent…
tcoulter Aug 4, 2020
4846ee9
All for address/private key determinism
tcoulter Aug 4, 2020
2a5baef
Unused!
tcoulter Aug 5, 2020
88fa3ea
Test if this fixes ganache-core as depenendency issue
tcoulter Aug 5, 2020
1bf257e
Should this be here?
tcoulter Aug 5, 2020
1148efe
Didn't work - reverting
tcoulter Aug 5, 2020
f1eb168
Let's try this again.
tcoulter Aug 5, 2020
ee44eef
Whoops - accident
tcoulter Aug 5, 2020
489f886
Source files weren't being included, preventing including ganache-cor…
tcoulter Aug 5, 2020
cea76d4
This change now appears to be unnecessary. Crossing my fingers that's…
tcoulter Aug 5, 2020
e4c13c1
In the name of everything holy it looks like it was required!
tcoulter Aug 5, 2020
aa9c871
Missed one - see previous commits
tcoulter Aug 5, 2020
38fa2ae
Looks like I overlooked this - it's needed to run built version
tcoulter Aug 5, 2020
141466a
Whoops. Oversight that caused build not to work.
tcoulter Aug 5, 2020
175ba3e
Webpack?
tcoulter Aug 5, 2020
73a3eed
Webpack version that "works" (Narrator: It doesn't.)
tcoulter Aug 6, 2020
053e93a
convert package-lock to shrinkwrap
davidmurdoch Aug 6, 2020
e76559e
WIP webpack config
davidmurdoch Aug 6, 2020
1a3816e
webpack WIP 2
davidmurdoch Aug 6, 2020
5f77f8d
create a webpack that seems to work
davidmurdoch Aug 6, 2020
af51ae3
Add top-level logging functionality of RPC requests
tcoulter Aug 6, 2020
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 .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/launch.json linguist-language=JSON5
39 changes: 39 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on: [push,pull_request]

jobs:
build:
strategy:
fail-fast: false
matrix:
node: [10.7.0, 10.x, 11.x, 12.x, 13.x, 14.x]
os: [windows-2019, ubuntu-16.04, ubuntu-18.04, macos-10.15]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: install node tools
if: matrix.os == 'windows-2019'
run: npm install --global --production windows-build-tools@4.0.0
- name: install node-gyp
if: matrix.os == 'windows-2019'
run: npm install --global node-gyp@latest
- name: Set node config to use python2.7
if: matrix.os == 'windows-2019'
run: npm config set python python2.7
- name: Set node config to set msvs_version to 2015
if: matrix.os == 'windows-2019'
run: npm config set msvs_version 2015
- run: npm ci
- run: npm test
env:
FORCE_COLOR: 1
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@ TODO
.DS_Store
.tern-port
.vscode
build
build
dist
.nyc_output
test/testdb/*
lerna-debug.log
npm-debug.log
src/**/*/lib
src/chains/filecoin/data
6 changes: 3 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.tern-project
.tern-port
.dockerignore
.travis.yml
.eslintrc.js
.github/
*.log
Dockerfile
ISSUE_TEMPLATE.md
.vscode/
test/
build/
webpack/
perf/
perf/
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
engine-strict=true
save-exact=true
sign-git-tag=true
3 changes: 3 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@istanbuljs/nyc-config-typescript"
}
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "none",
"printWidth": 120,
"arrowParens": "avoid",
"bracketSpacing": false
}
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

12 changes: 0 additions & 12 deletions Dockerfile

This file was deleted.

40 changes: 0 additions & 40 deletions ISSUE_TEMPLATE.md

This file was deleted.

29 changes: 15 additions & 14 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ The MIT License (MIT)

Copyright (c) 2015 Iuri Matias

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright (c) 2020 Truffle Blockchain Group

The above copyright notice and this permission notice shall be included in all
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

143 changes: 2 additions & 141 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,143 +1,4 @@
[![npm](https://img.shields.io/npm/v/ganache-core.svg)]()
[![npm](https://img.shields.io/npm/dm/ganache-core.svg)]()
[![Build Status](https://travis-ci.org/trufflesuite/ganache-core.svg?branch=master)](https://travis-ci.org/trufflesuite/ganache-core)
# Ganache Core
# JUST FOR EXPERIMENTS

This is the core code that powers the Ganache application and the the Ganache command line tool.

# INSTALL

`ganache-core` is written in Javascript and distributed as a Node package via `npm`. Make sure you have Node.js (>= v8.9.0) installed, and your environment is capable of installing and compiling `npm` modules.

**macOS** Make sure you have the XCode Command Line Tools installed. These are needed in general to be able to compile most C based languages on your machine, as well as many npm modules.

**Windows** See our [Windows install instructions](https://github.com/ethereumjs/testrpc/wiki/Installing-TestRPC-on-Windows).

**Ubuntu/Linux** Follow the basic instructions for installing [Node.js](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions) and make sure that you have `npm` installed, as well as the `build-essential` `apt` package (it supplies `make` which you will need to compile most things). Use the official Node.js packages, *do not use the package supplied by your distribution.*


```Bash
npm install ganache-core
```

# USAGE

As a Web3 provider:

```javascript
var Ganache = require("ganache-core");
web3.setProvider(Ganache.provider());
```

As a general http server:

```javascript
var Ganache = require("ganache-core");
var server = Ganache.server();
server.listen(port, function(err, blockchain) {...});
```

Both `.provider()` and `.server()` take a single object which allows you to specify behavior of the Ganache instance. This parameter is optional. Available options are:

* `"accounts"`: `Array` of `Object`'s. Each object should have a balance key with a hexadecimal value. The key `secretKey` can also be specified, which represents the account's private key. If no `secretKey`, the address is auto-generated with the given balance. If specified, the key is used to determine the account's address.
* `"debug"`: `boolean` - Output VM opcodes for debugging
* `"logger"`: `Object` - Object, like `console`, that implements a `log()` function.
* `"mnemonic"`: Use a specific HD wallet mnemonic to generate initial addresses.
* `"port"`: Port number to listen on when running as a server.
* `"seed"`: Use arbitrary data to generate the HD wallet mnemonic to be used.
* `"default_balance_ether"`: `number` - The default account balance, specified in ether.
* `"total_accounts"`: `number` - Number of accounts to generate at startup.
* `"fork"`: `string` or `object` - When a `string`, same as `--fork` option above. Can also be a Web3 Provider object, optionally used in conjunction with the `fork_block_number` option below.
* `"fork_block_number"`: `string` or `number` - Block number the provider should fork from, when the `fork` option is specified. If the `fork` option is specified as a string including the `@` sign and a block number, the block number in the `fork` parameter takes precedence.
* `"network_id"`: `integer` - Same as `--networkId` option above.
* `"time"`: `Date` - Date that the first block should start. Use this feature, along with the `evm_increaseTime` method to test time-dependent code.
* `"locked"`: `boolean` - whether or not accounts are locked by default.
* `"unlocked_accounts"`: `Array` - array of addresses or address indexes specifying which accounts should be unlocked.
* `"db_path"`: `String` - Specify a path to a directory to save the chain database. If a database already exists, that chain will be initialized instead of creating a new one.
* `"db"`: `Object` - Specify an alternative database instance, for instance [MemDOWN](https://github.com/level/memdown).
* `"ws"`: Enable a websocket server. This is `true` by default.
* `"vmErrorsOnRPCResponse"`: Whether to report runtime errors from EVM code as RPC errors. This is `true` by default to replicate the error reporting behavior of previous versions of ganache.
* `"hdPath"`: The hierarchical deterministic path to use when generating accounts. Default: "m/44'/60'/0'/0/"
* `"allowUnlimitedContractSize"`: Allows unlimited contract sizes while debugging. By setting this to `true`, the check within the EVM for contract size limit of 24KB (see [EIP-170](https://git.io/vxZkK)) is bypassed. Setting this to `true` **will** cause `ganache-core` to behave differently than production environments. (default: `false`; **ONLY** set to `true` during debugging).
* `"gasPrice"`: Sets the default gas price for transactions if not otherwise specified. Must be specified as a hex string in wei. Defaults to `"0x77359400"`, or 2 gwei.
* `"gasLimit"`: Sets the block gas limit. Must be specified as a hex string. Defaults to `"0x6691b7"`.

# IMPLEMENTED METHODS

The RPC methods currently implemented are:

* `bzz_hive` (stub)
* `bzz_info` (stub)
* `debug_traceTransaction`
* `eth_accounts`
* `eth_blockNumber`
* `eth_call`
* `eth_coinbase`
* `eth_estimateGas`
* `eth_gasPrice`
* `eth_getBalance`
* `eth_getBlockByNumber`
* `eth_getBlockByHash`
* `eth_getBlockTransactionCountByHash`
* `eth_getBlockTransactionCountByNumber`
* `eth_getCode` (only supports block number “latest”)
* `eth_getCompilers`
* `eth_getFilterChanges`
* `eth_getFilterLogs`
* `eth_getLogs`
* `eth_getStorageAt`
* `eth_getTransactionByHash`
* `eth_getTransactionByBlockHashAndIndex`
* `eth_getTransactionByBlockNumberAndIndex`
* `eth_getTransactionCount`
* `eth_getTransactionReceipt`
* `eth_hashrate`
* `eth_mining`
* `eth_newBlockFilter`
* `eth_newFilter` (includes log/event filters)
* `eth_protocolVersion`
* `eth_sendTransaction`
* `eth_sendRawTransaction`
* `eth_sign`
* `eth_subscribe` (only for websocket connections. "syncing" subscriptions are not yet supported)
* `eth_unsubscribe` (only for websocket connections. "syncing" subscriptions are not yet supported)
* `eth_syncing`
* `eth_uninstallFilter`
* `net_listening`
* `net_peerCount`
* `net_version`
* `miner_start`
* `miner_stop`
* `personal_listAccounts`
* `personal_lockAccount`
* `personal_newAccount`
* `personal_importRawKey`
* `personal_unlockAccount`
* `personal_sendTransaction`
* `shh_version`
* `rpc_modules`
* `web3_clientVersion`
* `web3_sha3`

There’s also special non-standard methods that aren’t included within the original RPC specification:

* `evm_snapshot` : Snapshot the state of the blockchain at the current block. Takes no parameters. Returns the integer id of the snapshot created.
* `evm_revert` : Revert the state of the blockchain to a previous snapshot. Takes a single parameter, which is the snapshot id to revert to. If no snapshot id is passed it will revert to the latest snapshot. Returns `true`.
* `evm_increaseTime` : Jump forward in time. Takes one parameter, which is the amount of time to increase in seconds. Returns the total time adjustment, in seconds.
* `evm_mine` : Force a block to be mined. Takes one optional parameter, which is the timestamp a block should setup as the mining time. Mines a block independent of whether or not mining is started or stopped.

# Unsupported Methods

* `eth_compileSolidity`: If you'd like Solidity compilation in Javascript, please see the [solc-js project](https://github.com/ethereum/solc-js).


# TESTING

Run tests via:

```
$ npm test
```

# LICENSE
[MIT](https://tldrlegal.com/license/mit-license)
[Developer Documentation](./docs/README.md);
42 changes: 42 additions & 0 deletions docs/DATAFLOW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Render at https://www.planttext.com/

```uml
@startuml

title Ganache Core Data Flow \n

start

:Server;

:HttpServer/WebsocketServer;

:Provider;

note left
Ethereum, Tezos, etc.
`request(method: string, params: any[])`
end note

:RequestCoordinator;

note left
Lets us limit how many simultenous requests we process.
end note

:Executor;

note left
Ensures the requested RPC is a valid Ledger endpoint
end note

:Ledger;

note left
Executes the request. Implementation dependent.
end note

stop

@enduml
```
Loading