Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

ethermint app simulator #213

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
832759e
evm: move Keeper and Querier to /keeper package
fedekunze Mar 6, 2020
e5945f8
keeper: update keeper_test.go
fedekunze Mar 6, 2020
2d1a7b4
fix format
fedekunze Mar 6, 2020
23a7822
evm: use aliased types
fedekunze Mar 6, 2020
2e3081c
bump SDK version to v0.38.1
fedekunze Mar 6, 2020
f01326c
app: updates from new version
fedekunze Mar 6, 2020
213e278
errors: switch sdk.Error -> error
fedekunze Mar 6, 2020
af010c6
errors: switch sdk.Error -> error. Continuation
fedekunze Mar 6, 2020
28e94fb
more fixes
fedekunze Mar 6, 2020
865d962
update app/
fedekunze Mar 9, 2020
ad347a0
update keys and client pkgs
fedekunze Mar 9, 2020
1add197
merge master
fedekunze Mar 9, 2020
359de7a
build
fedekunze Mar 10, 2020
e41a25e
fix tests
fedekunze Mar 10, 2020
230ddf8
lint
fedekunze Mar 10, 2020
569a511
minor changes
fedekunze Mar 11, 2020
2c0dc2a
changelog
fedekunze Mar 11, 2020
6122b3c
address @austinbell comments
fedekunze Mar 11, 2020
fae679b
Fix keyring usage in rpc API and CLI
austinabell Mar 11, 2020
3988040
fix keyring
fedekunze Mar 12, 2020
ff91e3c
break line
fedekunze Mar 12, 2020
729ebf2
Misc cleanup (#188)
fedekunze Mar 12, 2020
b70f6cb
evm: update statedb to create ethermint Account instead of BaseAccount
fedekunze Mar 12, 2020
9eaf77f
fix importer test
fedekunze Mar 12, 2020
2a2c718
app: simulator support
fedekunze Mar 12, 2020
9db72db
address @austinabell comments
fedekunze Mar 13, 2020
2abf58b
update README
fedekunze Mar 13, 2020
ace3028
changelog
fedekunze Mar 13, 2020
6036b76
evm: update codec
fedekunze Mar 13, 2020
aac1ad0
Merge branch 'fedekunze/177-bump-sdk-version' of github.com:ChainSafe…
fedekunze Mar 13, 2020
919b29a
nolint
fedekunze Mar 13, 2020
b37053e
Merge branch 'development' into fedekunze/177-bump-sdk-version
fedekunze Mar 13, 2020
a0e6b76
Merge branch 'fedekunze/177-bump-sdk-version' of github.com:ChainSafe…
fedekunze Mar 16, 2020
2ff5360
register codec
fedekunze Mar 16, 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
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,13 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* (x/evm) [\#181](https://github.com/ChainSafe/ethermint/issues/181) Updated EVM module to the recommended module structure. [@fedekunze](https://github.com/fedekunze)
* (sdk) [\#171](https://github.com/ChainSafe/ethermint/issues/177) Bump Cosmos SDK version to [v0.38.1](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.38.1) [@fedekunze](https://github.com/fedekunze):
* Add `x/evidence` module to ethermint app
* Bump Go requirement to 1.13+
* (`x/evm`) [\#181](https://github.com/ChainSafe/ethermint/issues/181) Updated EVM module to the recommended module structure. [@fedekunze](https://github.com/fedekunze)
* (app) [\#188](https://github.com/ChainSafe/ethermint/issues/186) Misc cleanup [@fedekunze](https://github.com/fedekunze):
* (`x/evm`) Rename `EthereumTxMsg` --> `MsgEthereumTx` and `EmintMsg` --> `MsgEthermint` for consistency with SDK standards
* Updated integration and unit tests to use `EthermintApp` as testing suite
* Use expected keeper interface for `AccountKeeper`
* Replaced `count` type in keeper with `int`
* Add SDK events for transactions
66 changes: 58 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ DOCKER_IMAGE = cosmos/ethermint
ETHERMINT_DAEMON_BINARY = emintd
ETHERMINT_CLI_BINARY = emintcli
GO_MOD=GO111MODULE=on
BINDIR ?= $(GOPATH)/bin
SIMAPP = github.com/cosmos/ethermint/app
RUNSIM = $(BINDIR)/runsim

all: tools verify install

Expand Down Expand Up @@ -61,7 +64,6 @@ verify:
### TODO: Move tool depedencies to a separate makefile ###
##########################################################

GOLINT = github.com/tendermint/lint/golint
GOCILINT = github.com/golangci/golangci-lint/cmd/golangci-lint
UNCONVERT = github.com/mdempsky/unconvert
INEFFASSIGN = github.com/gordonklaus/ineffassign
Expand All @@ -77,13 +79,16 @@ MISSPELL_CHECK := $(shell command -v misspell 2> /dev/null)
ERRCHECK_CHECK := $(shell command -v errcheck 2> /dev/null)
UNPARAM_CHECK := $(shell command -v unparam 2> /dev/null)

tools:
ifdef GOLINT_CHECK
@echo "Golint is already installed. Run 'make update-tools' to update."
else
@echo "--> Installing golint"
${GO_MOD} go get -v $(GOLINT)
endif
# Install the runsim binary with a temporary workaround of entering an outside
# directory as the "go get" command ignores the -mod option and will polute the
# go.{mod, sum} files.
#
# ref: https://github.com/golang/go/issues/30515
$(RUNSIM):
@echo "Installing runsim..."
@(cd /tmp && go get github.com/cosmos/tools/cmd/[email protected])

tools: $(RUNSIM)
ifdef GOCILINT_CHECK
@echo "golangci-lint is already installed. Run 'make update-tools' to update."
else
Expand Down Expand Up @@ -165,3 +170,48 @@ format:

.PHONY: build install update-tools tools godocs clean format lint \
test-cli test-race test-unit test test-import

#######################
### Simulations ###
#######################

test-sim-nondeterminism:
@echo "Running non-determinism test..."
@go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \
-NumBlocks=100 -BlockSize=200 -Commit=true -Period=0 -v -timeout 24h

test-sim-custom-genesis-fast:
@echo "Running custom genesis simulation..."
@echo "By default, ${HOME}/.gaiad/config/genesis.json will be used."
@go test -mod=readonly $(SIMAPP) -run TestFullGaiaSimulation -Genesis=${HOME}/.gaiad/config/genesis.json \
-Enabled=true -NumBlocks=100 -BlockSize=200 -Commit=true -Seed=99 -Period=5 -v -timeout 24h

test-sim-import-export: runsim
@echo "Running Gaia import/export simulation. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaImportExport

test-sim-after-import: runsim
@echo "Running Gaia simulation-after-import. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 25 5 TestGaiaSimulationAfterImport

test-sim-custom-genesis-multi-seed: runsim
@echo "Running multi-seed custom genesis simulation..."
@echo "By default, ${HOME}/.gaiad/config/genesis.json will be used."
@$(BINDIR)/runsim -Jobs=4 -Genesis=${HOME}/.gaiad/config/genesis.json 400 5 TestFullGaiaSimulation

test-sim-multi-seed-long: runsim
@echo "Running multi-seed application simulation. This may take awhile!"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 500 50 TestFullAppSimulation

test-sim-multi-seed-short: runsim
@echo "Running multi-seed application simulation. This may take awhile!"
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 10 TestFullAppSimulation

test-sim-benchmark-invariants:
@echo "Running simulation invariant benchmarks..."
@go test -mod=readonly $(SIMAPP) -benchmem -bench=BenchmarkInvariants -run=^$ \
-Enabled=true -NumBlocks=1000 -BlockSize=200 \
-Commit=true -Seed=57 -v -timeout 24h

.PHONY: runsim test-sim-nondeterminism test-sim-custom-genesis-fast test-sim-fast sim-import-export \
test-sim-simulation-after-import test-sim-custom-genesis-multi-seed test-sim-multi-seed \
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

__**WARNING:**__ Ethermint is under VERY ACTIVE DEVELOPMENT and should be treated as pre-alpha software. This means it is not meant to be run in production, its APIs are subject to change without warning and should not be relied upon, and it should not be used to hold any value. We will remove this warning when we have a release that is stable, secure, and properly tested.

**Note**: Requires [Go 1.13+](https://golang.org/dl/)

## What is it?

`ethermint` will be an implementation of the EVM that runs on top of [`tendermint`](https://github.com/tendermint/tendermint) consensus, a Proof of Stake system. This project has as its primary goals:
Expand Down Expand Up @@ -37,10 +39,10 @@ To build, execute the following commands:

```bash
# To build the project and install it in $GOBIN
$ make install
make install

# To build the binary and put the resulting binary in ./build
$ make build
make build
```

### Starting a Ethermint daemon (node)
Expand All @@ -50,9 +52,11 @@ First, create a key to use in signing the genesis transaction:
```bash
emintcli keys add mykey
```

> replace mykey with whatever you want to name the key

Then, run these commands to start up a node

```bash
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
emintd init mymoniker --chain-id 8
Expand All @@ -78,6 +82,7 @@ emintd validate-genesis
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
emintd start --pruning=nothing
```

> Note: If you used `make build` instead of make install, and replace all `emintcli` and `emintd` references to `./build/emintcli` and `./build/emintd` respectively

### Starting Ethermint Web3 RPC API
Expand All @@ -90,7 +95,7 @@ emintcli rest-server --laddr "tcp://localhost:8545" --unlock-key mykey

and to make sure the server has started correctly, try querying the current block number:

```
```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' -H "Content-Type: application/json" http://localhost:8545
```

Expand Down Expand Up @@ -119,7 +124,7 @@ emintcli config keyring-backend file
To export the private key from Ethermint to something like Metamask, run:

```bash
emintcli keys export-eth-key mykey
emintcli keys unsafe-export-eth-key mykey
```

Import account through private key, and to verify that the Ethereum address is correct with:
Expand All @@ -133,13 +138,13 @@ emintcli keys parse $(emintcli keys show mykey -a)
Integration tests are invoked via:

```bash
$ make test
make test
```

To run CLI tests, execute:

```bash
$ make test-cli
make test-cli
```

#### Ethereum Mainnet Import
Expand All @@ -149,7 +154,7 @@ that includes blocks up to height `97638`. To execute and test a full import of
these blocks using the EVM module, execute:

```bash
$ make test-import
make test-import
```

You may also provide a custom blockchain export file to test importing more blocks
Expand Down
Loading