Merge branch 'develop' into jack/contrib

This commit is contained in:
Jack Zampolin 2018-07-10 08:15:16 -07:00 committed by GitHub
commit 757da2eff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 34 deletions

11
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,11 @@
<!-- < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < ☺
v ✰ Thanks for creating a PR! ✰
v Before smashing the submit button please review the checkboxes.
v If a checkbox is n/a - please still include it but + a little note why
☺ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -->
* [ ] Updated all relevant documentation in docs
* [ ] Updated all code comments where relevant
* [ ] Wrote tests
* [ ] Squashed all commits, uses message "Merge pull request #XYZ: [title]" ([coding standards](https://github.com/tendermint/coding/blob/master/README.md#merging-a-pr))
* [ ] Added appropriate labels to PR (ex. wip, ready-for-review, docs)

26
Gopkg.lock generated
View File

@ -11,23 +11,22 @@
branch = "master"
name = "github.com/btcsuite/btcd"
packages = ["btcec"]
revision = "86fed781132ac890ee03e906e4ecd5d6fa180c64"
revision = "fdfc19097e7ac6b57035062056f5b7b4638b8898"
[[projects]]
branch = "master"
name = "github.com/btcsuite/btcutil"
packages = ["bech32"]
revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4"
revision = "ab6388e0c60ae4834a1f57511e20c17b5f78be4b"
[[projects]]
branch = "develop"
name = "github.com/cosmos/cosmos-sdk"
packages = [
"store",
"types",
"wire"
]
revision = "08625633c62555cbd4ddc61238d35da520d942cb"
revision = "0d6f99d6d514916974a7cc1a7e4577c650e987e1"
[[projects]]
name = "github.com/davecgh/go-spew"
@ -73,8 +72,8 @@
"rpc",
"trie"
]
revision = "dea1ce052a10cd7d401a5c04f83f371a06fe293c"
version = "v1.8.11"
revision = "37685930d953bcbe023f9bc65b135a8d8b8f1488"
version = "v1.8.12"
[[projects]]
name = "github.com/go-kit/kit"
@ -179,7 +178,7 @@
"leveldb/table",
"leveldb/util"
]
revision = "0d5a0ceb10cf9ab89fdd744cc8c50a83134f6697"
revision = "c4c61651e9e37fa117f53c5a906d3b63090d8445"
[[projects]]
branch = "master"
@ -221,15 +220,6 @@
revision = "5923b6288fe8ce9581936ee97c2bf9cf9c02c2f4"
version = "v0.22.0-rc2"
[[projects]]
name = "github.com/tendermint/tmlibs"
packages = [
"common",
"db",
"log"
]
revision = "692f1d86a6e2c0efa698fd1e4541b68c74ffaf38"
[[projects]]
branch = "master"
name = "golang.org/x/crypto"
@ -257,7 +247,7 @@
"trace",
"websocket"
]
revision = "ed29d75add3d7c4bf7ca65aac0c6df3d1420216f"
revision = "c21de06aaf072cea07f3a65d6970e5c7d8b6cd6d"
[[projects]]
name = "golang.org/x/text"
@ -336,6 +326,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "58fcc52223aba442a24118b546ef53abff5352bbdf306e652dee3106822bba50"
inputs-digest = "6bd7ad37cf8a53408eeb32265fbc699bf2cc4e7a15b0b98182bcebb5c887cea1"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -1,15 +1,15 @@
[[constraint]]
name = "github.com/cosmos/cosmos-sdk"
# TODO: Replace with a stable tagged version
branch = "develop"
# TODO: Replace with a stable tagged version (issue: #3)
revision = "0d6f99d6d514916974a7cc1a7e4577c650e987e1"
[[override]]
name = "google.golang.org/genproto"
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
[[constraint]]
version = "=0.22.0-rc2"
name = "github.com/tendermint/tendermint"
version = "=0.22.0-rc2"
[prune]
go-tests = true

View File

@ -20,7 +20,7 @@ import (
// NOTE: Ethermint will distribute the fees out to validators, so the structure
// and functionality of this is a WIP and subject to change.
type ChainContext struct {
Coinbase ethcommon.Address
Coinbase ethcommon.Address
headersByNumber map[uint64]*ethtypes.Header
}

41
main.go
View File

@ -7,10 +7,15 @@ package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io"
"os"
"runtime/pprof"
"time"
"github.com/cosmos/ethermint/core"
"github.com/cosmos/ethermint/state"
ethcommon "github.com/ethereum/go-ethereum/common"
ethmisc "github.com/ethereum/go-ethereum/consensus/misc"
ethcore "github.com/ethereum/go-ethereum/core"
@ -19,11 +24,12 @@ import (
ethvm "github.com/ethereum/go-ethereum/core/vm"
ethparams "github.com/ethereum/go-ethereum/params"
ethrlp "github.com/ethereum/go-ethereum/rlp"
"github.com/ledgerwatch/ethermint/core"
"github.com/ledgerwatch/ethermint/state"
dbm "github.com/tendermint/tendermint/libs/db"
)
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile `file`")
var blockchain = flag.String("blockchain", "blockchain", "file containing blocks to load")
var (
// TODO: Document...
miner501 = ethcommon.HexToAddress("0x35e8e5dC5FBd97c5b421A80B596C030a2Be2A04D")
@ -32,8 +38,22 @@ var (
// TODO: Document...
func main() {
stateDB := dbm.NewDB("state", dbm.MemDBBackend, "")
codeDB := dbm.NewDB("code", dbm.MemDBBackend, "")
flag.Parse()
if *cpuprofile != "" {
f, err := os.Create(*cpuprofile)
if err != nil {
fmt.Printf("could not create CPU profile: %v\n", err)
return
}
if err := pprof.StartCPUProfile(f); err != nil {
fmt.Printf("could not start CPU profile: %v\n", err)
return
}
defer pprof.StopCPUProfile()
}
stateDB := dbm.NewDB("state", dbm.LevelDBBackend, "")
codeDB := dbm.NewDB("code", dbm.LevelDBBackend, "")
ethermintDB, err := state.NewDatabase(stateDB, codeDB)
if err != nil {
@ -76,7 +96,7 @@ func main() {
// command.
//
// TODO: Allow this to be configurable
input, err := os.Open("blockchain")
input, err := os.Open(*blockchain)
if err != nil {
panic(err)
}
@ -101,6 +121,7 @@ func main() {
vmConfig := ethvm.Config{}
n := 0
startTime := time.Now()
for {
if err = stream.Decode(&block); err == io.EOF {
err = nil
@ -195,12 +216,12 @@ func main() {
}
n++
if (n%100) == 0 {
fmt.Printf("processed %d blocks\n", n)
}
if n >= 1000 {
break
if (n % 10000) == 0 {
fmt.Printf("processed %d blocks, time so far: %v\n", n, time.Since(startTime))
}
//if n >= 20000 {
// break
//}
}
fmt.Printf("processed %d blocks\n", n)

View File

@ -3,10 +3,10 @@ package state
import (
"github.com/cosmos/cosmos-sdk/store"
"github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ethermint/core"
ethcommon "github.com/ethereum/go-ethereum/common"
ethstate "github.com/ethereum/go-ethereum/core/state"
ethtrie "github.com/ethereum/go-ethereum/trie"
"github.com/ledgerwatch/ethermint/core"
dbm "github.com/tendermint/tendermint/libs/db"
)