Skeleton of Ethermint

This commit is contained in:
Alexey Akhunov 2018-06-13 10:56:01 +01:00
parent 6d7bd6a2e9
commit e7be488a75
3 changed files with 281 additions and 0 deletions

157
Gopkg.lock generated Normal file
View File

@ -0,0 +1,157 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
name = "github.com/btcsuite/btcd"
packages = ["btcec"]
revision = "86fed781132ac890ee03e906e4ecd5d6fa180c64"
[[projects]]
name = "github.com/davecgh/go-spew"
packages = ["spew"]
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
[[projects]]
name = "github.com/ethereum/go-ethereum"
packages = [
"common",
"common/hexutil",
"common/math",
"core/state",
"core/types",
"crypto",
"crypto/secp256k1",
"crypto/sha3",
"ethdb",
"log",
"metrics",
"params",
"rlp",
"trie"
]
revision = "dea1ce052a10cd7d401a5c04f83f371a06fe293c"
version = "v1.8.11"
[[projects]]
name = "github.com/go-kit/kit"
packages = [
"log",
"log/level",
"log/term"
]
revision = "4dc7be5d2d12881735283bcab7352178e190fc71"
version = "v0.6.0"
[[projects]]
name = "github.com/go-logfmt/logfmt"
packages = ["."]
revision = "390ab7935ee28ec6b286364bba9b4dd6410cb3d5"
version = "v0.3.0"
[[projects]]
name = "github.com/go-stack/stack"
packages = ["."]
revision = "259ab82a6cad3992b4e21ff5cac294ccb06474bc"
version = "v1.7.0"
[[projects]]
name = "github.com/gogo/protobuf"
packages = [
"gogoproto",
"proto",
"protoc-gen-gogo/descriptor"
]
revision = "1adfc126b41513cc696b209667c8656ea7aac67c"
version = "v1.0.0"
[[projects]]
branch = "master"
name = "github.com/golang/snappy"
packages = ["."]
revision = "2e65f85255dbc3072edf28d6b5b8efc472979f5a"
[[projects]]
branch = "master"
name = "github.com/hashicorp/golang-lru"
packages = [
".",
"simplelru"
]
revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3"
[[projects]]
branch = "master"
name = "github.com/jmhodges/levigo"
packages = ["."]
revision = "c42d9e0ca023e2198120196f842701bb4c55d7b9"
[[projects]]
branch = "master"
name = "github.com/kr/logfmt"
packages = ["."]
revision = "b84e30acd515aadc4b783ad4ff83aff3299bdfe0"
[[projects]]
name = "github.com/pkg/errors"
packages = ["."]
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
version = "v0.8.0"
[[projects]]
branch = "master"
name = "github.com/syndtr/goleveldb"
packages = [
"leveldb",
"leveldb/cache",
"leveldb/comparer",
"leveldb/errors",
"leveldb/filter",
"leveldb/iterator",
"leveldb/journal",
"leveldb/memdb",
"leveldb/opt",
"leveldb/storage",
"leveldb/table",
"leveldb/util"
]
revision = "e2150783cd35f5b607daca48afd8c57ec54cc995"
[[projects]]
name = "github.com/tendermint/go-amino"
packages = ["."]
revision = "3c22a7a539411f89a96738fcfa14c1027e24e5ec"
version = "0.9.10"
[[projects]]
name = "github.com/tendermint/iavl"
packages = [
".",
"sha256truncated"
]
revision = "c9206995e8f948e99927f5084a88a7e94ca256da"
version = "v0.8.0-rc0"
[[projects]]
name = "github.com/tendermint/tmlibs"
packages = [
"common",
"db",
"log"
]
revision = "692f1d86a6e2c0efa698fd1e4541b68c74ffaf38"
version = "v0.8.4"
[[projects]]
branch = "v2"
name = "gopkg.in/karalabe/cookiejar.v2"
packages = ["collections/prque"]
revision = "8dcd6a7f4951f6ff3ee9cbb919a06d8925822e57"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "e53d8700b947bc1e65c0d9def7f322670a1163625680b49568ac801a54fe2158"
solver-name = "gps-cdcl"
solver-version = 1

32
Gopkg.toml Normal file
View File

@ -0,0 +1,32 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
name = "github.com/tendermint/iavl"
version = "0.8.0-rc0"
[prune]
go-tests = true

92
main.go Normal file
View File

@ -0,0 +1,92 @@
package main
import (
"fmt"
eth_common "github.com/ethereum/go-ethereum/common"
eth_state "github.com/ethereum/go-ethereum/core/state"
eth_ethdb "github.com/ethereum/go-ethereum/ethdb"
eth_trie "github.com/ethereum/go-ethereum/trie"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/iavl"
)
// Implementation of eth_state.Database
type OurDatabase struct {
tree *iavl.Tree
}
func OurNewDatabase(db dbm.DB, cacheSize int) *OurDatabase {
od := &OurDatabase{}
od.tree = iavl.NewTree(db, cacheSize)
return od
}
func (od *OurDatabase) OpenTrie(root eth_common.Hash) (eth_state.Trie, error) {
return &OurTrie{}, nil
}
func (od *OurDatabase) OpenStorageTrie(addrHash, root eth_common.Hash) (eth_state.Trie, error) {
return nil, nil
}
func (od *OurDatabase) CopyTrie(eth_state.Trie) eth_state.Trie {
return nil
}
func (od *OurDatabase) ContractCode(addrHash, codeHash eth_common.Hash) ([]byte, error) {
return nil, nil
}
func (od *OurDatabase) ContractCodeSize(addrHash, codeHash eth_common.Hash) (int, error) {
return 0, nil
}
func (od *OurDatabase) TrieDB() *eth_trie.Database {
return nil
}
// Implementation of eth_state.Trie
type OurTrie struct {
}
func (ot *OurTrie) TryGet(key []byte) ([]byte, error) {
return nil, nil
}
func (ot *OurTrie) TryUpdate(key, value []byte) error {
return nil
}
func (ot *OurTrie) TryDelete(key []byte) error {
return nil
}
func (ot *OurTrie) Commit(onleaf eth_trie.LeafCallback) (eth_common.Hash, error) {
return eth_common.Hash{}, nil
}
func (ot *OurTrie) Hash() eth_common.Hash {
return eth_common.Hash{}
}
func (ot *OurTrie) NodeIterator(startKey []byte) eth_trie.NodeIterator {
return nil
}
func (ot *OurTrie) GetKey([]byte) []byte {
return nil
}
func (ot *OurTrie) Prove(key []byte, fromLevel uint, proofDb eth_ethdb.Putter) error {
return nil
}
func main() {
fmt.Printf("Instantiating state.Database\n")
db := dbm.NewDB("test" /* name */, dbm.MemDBBackend, "" /* dir */)
var d eth_state.Database
d = OurNewDatabase(db, 1024)
d.OpenTrie(eth_common.Hash{})
}