From 37efd08b42f595eac8146b6b81f3f36e2e6f340d Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Tue, 14 Jul 2015 02:21:02 +0000 Subject: [PATCH 01/90] p2p: validate recovered ephemeral pubkey against checksum in decodeAuthMsg --- p2p/rlpx.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/p2p/rlpx.go b/p2p/rlpx.go index eca3d9ed68..3e3589c499 100644 --- a/p2p/rlpx.go +++ b/p2p/rlpx.go @@ -267,6 +267,10 @@ func initiatorEncHandshake(conn io.ReadWriter, prv *ecdsa.PrivateKey, remoteID d } func newInitiatorHandshake(remoteID discover.NodeID) (*encHandshake, error) { + rpub, err := remoteID.Pubkey() + if err != nil { + return nil, fmt.Errorf("bad remoteID: %v", err) + } // generate random initiator nonce n := make([]byte, shaLen) if _, err := rand.Read(n); err != nil { @@ -277,10 +281,6 @@ func newInitiatorHandshake(remoteID discover.NodeID) (*encHandshake, error) { if err != nil { return nil, err } - rpub, err := remoteID.Pubkey() - if err != nil { - return nil, fmt.Errorf("bad remoteID: %v", err) - } h := &encHandshake{ initiator: true, remoteID: remoteID, @@ -417,6 +417,14 @@ func decodeAuthMsg(prv *ecdsa.PrivateKey, token []byte, auth []byte) (*encHandsh if err != nil { return nil, err } + + // validate the sha3 of recovered pubkey + remoteRandomPubMAC := msg[sigLen : sigLen+shaLen] + shaRemoteRandomPub := crypto.Sha3(remoteRandomPub[1:]) + if !bytes.Equal(remoteRandomPubMAC, shaRemoteRandomPub) { + return nil, fmt.Errorf("sha3 of recovered ephemeral pubkey does not match checksum in auth message") + } + h.remoteRandomPub, _ = importPublicKey(remoteRandomPub) return h, nil } From c1d516546d221de898ddeb12a77477d992d125df Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 6 Aug 2015 03:11:10 -0400 Subject: [PATCH 02/90] faster hex-prefix codec and string -> []byte --- trie/encoding.go | 43 +++++++++++++++++-------------------------- trie/encoding_test.go | 10 +++++----- trie/iterator.go | 2 +- trie/shortnode.go | 4 ++-- trie/trie.go | 10 +++++----- 5 files changed, 30 insertions(+), 39 deletions(-) diff --git a/trie/encoding.go b/trie/encoding.go index 524807f06b..8daf503a3f 100644 --- a/trie/encoding.go +++ b/trie/encoding.go @@ -18,11 +18,9 @@ package trie import ( "bytes" - "encoding/hex" - "strings" ) -func CompactEncode(hexSlice []byte) string { +func CompactEncode(hexSlice []byte) []byte { terminator := 0 if hexSlice[len(hexSlice)-1] == 16 { terminator = 1 @@ -45,10 +43,10 @@ func CompactEncode(hexSlice []byte) string { buff.WriteByte(byte(16*hexSlice[i] + hexSlice[i+1])) } - return buff.String() + return buff.Bytes() } -func CompactDecode(str string) []byte { +func CompactDecode(str []byte) []byte { base := CompactHexDecode(str) base = base[:len(base)-1] if base[0] >= 2 { @@ -63,30 +61,23 @@ func CompactDecode(str string) []byte { return base } -func CompactHexDecode(str string) []byte { - base := "0123456789abcdef" - var hexSlice []byte +func CompactHexDecode(str []byte) []byte { + var nibbles []byte - enc := hex.EncodeToString([]byte(str)) - for _, v := range enc { - hexSlice = append(hexSlice, byte(strings.IndexByte(base, byte(v)))) + for _, b := range str { + nibbles = append(nibbles, b/16) + nibbles = append(nibbles, b%16) } - hexSlice = append(hexSlice, 16) - - return hexSlice + nibbles = append(nibbles, 16) + return nibbles } -func DecodeCompact(key []byte) string { - const base = "0123456789abcdef" - var str string - - for _, v := range key { - if v < 16 { - str += string(base[v]) - } +// assumes key is odd length +func DecodeCompact(key []byte) []byte { + var res []byte + for i := 0; i < len(key)-1; i += 2 { + v1, v0 := key[i], key[i+1] + res = append(res, v1*16+v0) } - - res, _ := hex.DecodeString(str) - - return string(res) + return res } diff --git a/trie/encoding_test.go b/trie/encoding_test.go index e52c6ba8d8..faaa7f5833 100644 --- a/trie/encoding_test.go +++ b/trie/encoding_test.go @@ -48,28 +48,28 @@ func (s *TrieEncodingSuite) TestCompactEncode(c *checker.C) { func (s *TrieEncodingSuite) TestCompactHexDecode(c *checker.C) { exp := []byte{7, 6, 6, 5, 7, 2, 6, 2, 16} - res := CompactHexDecode("verb") + res := CompactHexDecode([]byte("verb")) c.Assert(res, checker.DeepEquals, exp) } func (s *TrieEncodingSuite) TestCompactDecode(c *checker.C) { // odd compact decode exp := []byte{1, 2, 3, 4, 5} - res := CompactDecode("\x11\x23\x45") + res := CompactDecode([]byte("\x11\x23\x45")) c.Assert(res, checker.DeepEquals, exp) // even compact decode exp = []byte{0, 1, 2, 3, 4, 5} - res = CompactDecode("\x00\x01\x23\x45") + res = CompactDecode([]byte("\x00\x01\x23\x45")) c.Assert(res, checker.DeepEquals, exp) // even terminated compact decode exp = []byte{0, 15, 1, 12, 11, 8 /*term*/, 16} - res = CompactDecode("\x20\x0f\x1c\xb8") + res = CompactDecode([]byte("\x20\x0f\x1c\xb8")) c.Assert(res, checker.DeepEquals, exp) // even terminated compact decode exp = []byte{15, 1, 12, 11, 8 /*term*/, 16} - res = CompactDecode("\x3f\x1c\xb8") + res = CompactDecode([]byte("\x3f\x1c\xb8")) c.Assert(res, checker.DeepEquals, exp) } diff --git a/trie/iterator.go b/trie/iterator.go index 698e64b34d..9c4c7fbe5b 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -41,7 +41,7 @@ func (self *Iterator) Next() bool { self.Key = make([]byte, 32) } - key := RemTerm(CompactHexDecode(string(self.Key))) + key := RemTerm(CompactHexDecode(self.Key)) k := self.next(self.trie.root, key, isIterStart) self.Key = []byte(DecodeCompact(k)) diff --git a/trie/shortnode.go b/trie/shortnode.go index b5fc6d1f95..569d5f1096 100644 --- a/trie/shortnode.go +++ b/trie/shortnode.go @@ -26,7 +26,7 @@ type ShortNode struct { } func NewShortNode(t *Trie, key []byte, value Node) *ShortNode { - return &ShortNode{t, []byte(CompactEncode(key)), value, false} + return &ShortNode{t, CompactEncode(key), value, false} } func (self *ShortNode) Value() Node { self.value = self.trie.trans(self.value) @@ -49,7 +49,7 @@ func (self *ShortNode) Hash() interface{} { } func (self *ShortNode) Key() []byte { - return CompactDecode(string(self.key)) + return CompactDecode(self.key) } func (self *ShortNode) setDirty(dirty bool) { diff --git a/trie/trie.go b/trie/trie.go index e7ee864021..abf48a8509 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -69,7 +69,7 @@ func (self *Trie) Iterator() *Iterator { func (self *Trie) Copy() *Trie { cpy := make([]byte, 32) - copy(cpy, self.roothash) + copy(cpy, self.roothash) // NOTE: cpy isn't being used anywhere? trie := New(nil, nil) trie.cache = self.cache.Copy() if self.root != nil { @@ -131,7 +131,7 @@ func (self *Trie) Update(key, value []byte) Node { self.mu.Lock() defer self.mu.Unlock() - k := CompactHexDecode(string(key)) + k := CompactHexDecode(key) if len(value) != 0 { node := NewValueNode(self, value) @@ -149,7 +149,7 @@ func (self *Trie) Get(key []byte) []byte { self.mu.Lock() defer self.mu.Unlock() - k := CompactHexDecode(string(key)) + k := CompactHexDecode(key) n := self.get(self.root, k) if n != nil { @@ -164,7 +164,7 @@ func (self *Trie) Delete(key []byte) Node { self.mu.Lock() defer self.mu.Unlock() - k := CompactHexDecode(string(key)) + k := CompactHexDecode(key) self.root = self.delete(self.root, k) return self.root @@ -336,7 +336,7 @@ func (self *Trie) mknode(value *common.Value) Node { case 2: // A value node may consists of 2 bytes. if value.Get(0).Len() != 0 { - key := CompactDecode(string(value.Get(0).Bytes())) + key := CompactDecode(value.Get(0).Bytes()) if key[len(key)-1] == 16 { return NewShortNode(self, key, NewValueNode(self, value.Get(1).Bytes())) } else { From b23b4dbd79b4699abde4b3954c7480e137ffc3be Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 6 Aug 2015 12:27:59 +0200 Subject: [PATCH 03/90] p2p/discover: close Table during testing Not closing the table used to be fine, but now the table has a database. --- p2p/discover/table.go | 4 +++- p2p/discover/table_test.go | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 48c4734757..67f7ec46fb 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -164,7 +164,9 @@ func randUint(max uint32) uint32 { // Close terminates the network listener and flushes the node database. func (tab *Table) Close() { - tab.net.close() + if tab.net != nil { + tab.net.close() + } tab.db.close() } diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index 310fe2b7bc..d259177bf8 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -35,6 +35,7 @@ func TestTable_pingReplace(t *testing.T) { doit := func(newNodeIsResponding, lastInBucketIsResponding bool) { transport := newPingRecorder() tab := newTable(transport, NodeID{}, &net.UDPAddr{}, "") + defer tab.Close() pingSender := newNode(MustHexID("a502af0f59b2aab7746995408c79e9ca312d2793cc997e44fc55eda62f0150bbb8c59a6f9269ba3a081518b62699ee807c7c19c20125ddfccca872608af9e370"), net.IP{}, 99, 99) // fill up the sender's bucket. @@ -158,9 +159,7 @@ func newPingRecorder() *pingRecorder { func (t *pingRecorder) findnode(toid NodeID, toaddr *net.UDPAddr, target NodeID) ([]*Node, error) { panic("findnode called on pingRecorder") } -func (t *pingRecorder) close() { - panic("close called on pingRecorder") -} +func (t *pingRecorder) close() {} func (t *pingRecorder) waitping(from NodeID) error { return nil // remote always pings } @@ -180,6 +179,7 @@ func TestTable_closest(t *testing.T) { // for any node table, Target and N tab := newTable(nil, test.Self, &net.UDPAddr{}, "") tab.add(test.All) + defer tab.Close() // check that doClosest(Target, N) returns nodes result := tab.closest(test.Target, test.N).entries @@ -237,6 +237,7 @@ func TestTable_ReadRandomNodesGetAll(t *testing.T) { } test := func(buf []*Node) bool { tab := newTable(nil, NodeID{}, &net.UDPAddr{}, "") + defer tab.Close() for i := 0; i < len(buf); i++ { ld := cfg.Rand.Intn(len(tab.buckets)) tab.add([]*Node{nodeAtDistance(tab.self.sha, ld)}) @@ -279,6 +280,7 @@ func (*closeTest) Generate(rand *rand.Rand, size int) reflect.Value { func TestTable_Lookup(t *testing.T) { self := nodeAtDistance(common.Hash{}, 0) tab := newTable(lookupTestnet, self.ID, &net.UDPAddr{}, "") + defer tab.Close() // lookup on empty table returns no nodes if results := tab.Lookup(lookupTestnet.target); len(results) > 0 { From c32073b11f12c3735c117b3b3c814505974d5a92 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 6 Aug 2015 11:58:14 +0200 Subject: [PATCH 04/90] miner, rpc: added submit hashrate for remote agents --- miner/miner.go | 11 +++++++++-- miner/remote_agent.go | 37 +++++++++++++++++++++++++++++++++++-- rpc/api/eth.go | 10 ++++++++++ rpc/api/eth_args.go | 31 +++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 4 deletions(-) diff --git a/miner/miner.go b/miner/miner.go index bf6a488020..5087785794 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -139,8 +139,15 @@ func (self *Miner) Mining() bool { return atomic.LoadInt32(&self.mining) > 0 } -func (self *Miner) HashRate() int64 { - return self.pow.GetHashrate() +func (self *Miner) HashRate() (tot int64) { + tot += self.pow.GetHashrate() + // do we care this might race? is it worth we're rewriting some + // aspects of the worker/locking up agents so we can get an accurate + // hashrate? + for _, agent := range self.worker.agents { + tot += agent.GetHashRate() + } + return } func (self *Miner) SetExtra(extra []byte) { diff --git a/miner/remote_agent.go b/miner/remote_agent.go index 674ca40acd..5c672a6e02 100644 --- a/miner/remote_agent.go +++ b/miner/remote_agent.go @@ -27,6 +27,11 @@ import ( "github.com/ethereum/go-ethereum/logger/glog" ) +type hashrate struct { + ping time.Time + rate uint64 +} + type RemoteAgent struct { mu sync.Mutex @@ -36,14 +41,24 @@ type RemoteAgent struct { currentWork *Work work map[common.Hash]*Work + + hashrateMu sync.RWMutex + hashrate map[common.Hash]hashrate } func NewRemoteAgent() *RemoteAgent { - agent := &RemoteAgent{work: make(map[common.Hash]*Work)} + agent := &RemoteAgent{work: make(map[common.Hash]*Work), hashrate: make(map[common.Hash]hashrate)} return agent } +func (a *RemoteAgent) SubmitHashrate(id common.Hash, rate uint64) { + a.hashrateMu.Lock() + defer a.hashrateMu.Unlock() + + a.hashrate[id] = hashrate{time.Now(), rate} +} + func (a *RemoteAgent) Work() chan<- *Work { return a.workCh } @@ -63,7 +78,17 @@ func (a *RemoteAgent) Stop() { close(a.workCh) } -func (a *RemoteAgent) GetHashRate() int64 { return 0 } +// GetHashRate returns the accumulated hashrate of all identifier combined +func (a *RemoteAgent) GetHashRate() (tot int64) { + a.hashrateMu.RLock() + defer a.hashrateMu.RUnlock() + + // this could overflow + for _, hashrate := range a.hashrate { + tot += int64(hashrate.rate) + } + return +} func (a *RemoteAgent) GetWork() [3]string { a.mu.Lock() @@ -131,6 +156,14 @@ out: } } a.mu.Unlock() + + a.hashrateMu.Lock() + for id, hashrate := range a.hashrate { + if time.Since(hashrate.ping) > 10*time.Second { + delete(a.hashrate, id) + } + } + a.hashrateMu.Unlock() } } } diff --git a/rpc/api/eth.go b/rpc/api/eth.go index 4041811f06..820ea761b3 100644 --- a/rpc/api/eth.go +++ b/rpc/api/eth.go @@ -92,6 +92,7 @@ var ( "eth_hashrate": (*ethApi).Hashrate, "eth_getWork": (*ethApi).GetWork, "eth_submitWork": (*ethApi).SubmitWork, + "eth_submitHashrate": (*ethApi).SubmitHashrate, "eth_resend": (*ethApi).Resend, "eth_pendingTransactions": (*ethApi).PendingTransactions, "eth_getTransactionReceipt": (*ethApi).GetTransactionReceipt, @@ -573,6 +574,15 @@ func (self *ethApi) SubmitWork(req *shared.Request) (interface{}, error) { return self.xeth.RemoteMining().SubmitWork(args.Nonce, common.HexToHash(args.Digest), common.HexToHash(args.Header)), nil } +func (self *ethApi) SubmitHashrate(req *shared.Request) (interface{}, error) { + args := new(SubmitHashRateArgs) + if err := self.codec.Decode(req.Params, &args); err != nil { + return nil, shared.NewDecodeParamError(err.Error()) + } + self.xeth.RemoteMining().SubmitHashrate(common.HexToHash(args.Id), args.Rate) + return nil, nil +} + func (self *ethApi) Resend(req *shared.Request) (interface{}, error) { args := new(ResendArgs) if err := self.codec.Decode(req.Params, &args); err != nil { diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index 1218bd6254..5a1841cbed 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -169,6 +169,37 @@ func (args *GetTxCountArgs) UnmarshalJSON(b []byte) (err error) { return nil } +type SubmitHashRateArgs struct { + Id string + Rate uint64 +} + +func (args *SubmitHashRateArgs) UnmarshalJSON(b []byte) (err error) { + var obj []interface{} + if err := json.Unmarshal(b, &obj); err != nil { + return shared.NewDecodeParamError(err.Error()) + } + + if len(obj) < 2 { + return shared.NewInsufficientParamsError(len(obj), 2) + } + + arg0, ok := obj[0].(string) + if !ok { + return shared.NewInvalidTypeError("hash", "not a string") + } + args.Id = arg0 + + arg1, ok := obj[1].(string) + if !ok { + return shared.NewInvalidTypeError("rate", "not a string") + } + + args.Rate = common.String2Big(arg1).Uint64() + + return nil +} + type HashArgs struct { Hash string } From 74f6d90153a4d62eefaa8a49f98dc6ed8e0100f6 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 6 Aug 2015 13:29:06 +0200 Subject: [PATCH 05/90] cmd/utils, core: disable exp diff for olympic net --- cmd/utils/cmd.go | 2 ++ core/chain_util.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index f8f7f6376e..983762db8f 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -21,6 +21,7 @@ import ( "bufio" "fmt" "io" + "math" "math/big" "os" "os/signal" @@ -152,6 +153,7 @@ func InitOlympic() { params.MaximumExtraDataSize = big.NewInt(1024) NetworkIdFlag.Value = 0 core.BlockReward = big.NewInt(1.5e+18) + core.ExpDiffPeriod = big.NewInt(math.MaxInt64) } func FormatTransactionData(data string) []byte { diff --git a/core/chain_util.go b/core/chain_util.go index 34f6c8d0aa..84b462ce3d 100644 --- a/core/chain_util.go +++ b/core/chain_util.go @@ -32,7 +32,7 @@ import ( var ( blockHashPre = []byte("block-hash-") blockNumPre = []byte("block-num-") - expDiffPeriod = big.NewInt(100000) + ExpDiffPeriod = big.NewInt(100000) ) // CalcDifficulty is the difficulty adjustment algorithm. It returns @@ -57,7 +57,7 @@ func CalcDifficulty(time, parentTime uint64, parentNumber, parentDiff *big.Int) } periodCount := new(big.Int).Add(parentNumber, common.Big1) - periodCount.Div(periodCount, expDiffPeriod) + periodCount.Div(periodCount, ExpDiffPeriod) if periodCount.Cmp(common.Big1) > 0 { // diff = diff + 2^(periodCount - 2) expDiff := periodCount.Sub(periodCount, common.Big2) From 78b101e15d4a92d9f0f1d9ca49e45d5699adb3d2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 6 Aug 2015 15:15:36 +0100 Subject: [PATCH 06/90] common: remove windows path functions They were unused and their tests failed on Windows. --- cmd/utils/flags.go | 2 +- common/path.go | 11 ---------- common/path_test.go | 52 --------------------------------------------- common/size_test.go | 2 +- 4 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 common/path_test.go diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 815d481244..cf969805da 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -478,7 +478,7 @@ func MakeAccountManager(ctx *cli.Context) *accounts.Manager { } func IpcSocketPath(ctx *cli.Context) (ipcpath string) { - if common.IsWindows() { + if runtime.GOOS == "windows" { ipcpath = common.DefaultIpcPath() if ctx.GlobalIsSet(IPCPathFlag.Name) { ipcpath = ctx.GlobalString(IPCPathFlag.Name) diff --git a/common/path.go b/common/path.go index 0d7adb9617..8b3c7d14b8 100644 --- a/common/path.go +++ b/common/path.go @@ -116,14 +116,3 @@ func DefaultIpcPath() string { } return filepath.Join(DefaultDataDir(), "geth.ipc") } - -func IsWindows() bool { - return runtime.GOOS == "windows" -} - -func WindonizePath(path string) string { - if string(path[0]) == "/" && IsWindows() { - path = path[1:] - } - return path -} diff --git a/common/path_test.go b/common/path_test.go deleted file mode 100644 index 71ffd5fe1e..0000000000 --- a/common/path_test.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package common - -import ( - "os" - // "testing" - - checker "gopkg.in/check.v1" -) - -type CommonSuite struct{} - -var _ = checker.Suite(&CommonSuite{}) - -func (s *CommonSuite) TestOS(c *checker.C) { - expwin := (os.PathSeparator == '\\' && os.PathListSeparator == ';') - res := IsWindows() - - if !expwin { - c.Assert(res, checker.Equals, expwin, checker.Commentf("IsWindows is", res, "but path is", os.PathSeparator)) - } else { - c.Assert(res, checker.Not(checker.Equals), expwin, checker.Commentf("IsWindows is", res, "but path is", os.PathSeparator)) - } -} - -func (s *CommonSuite) TestWindonziePath(c *checker.C) { - iswindowspath := os.PathSeparator == '\\' - path := "/opt/eth/test/file.ext" - res := WindonizePath(path) - ressep := string(res[0]) - - if !iswindowspath { - c.Assert(ressep, checker.Equals, "/") - } else { - c.Assert(ressep, checker.Not(checker.Equals), "/") - } -} diff --git a/common/size_test.go b/common/size_test.go index 8709a02374..ce19cab69f 100644 --- a/common/size_test.go +++ b/common/size_test.go @@ -40,7 +40,7 @@ func (s *SizeSuite) TestStorageSizeString(c *checker.C) { c.Assert(StorageSize(data3).String(), checker.Equals, exp3) } -func (s *CommonSuite) TestCommon(c *checker.C) { +func (s *SizeSuite) TestCommon(c *checker.C) { ether := CurrencyToString(BigPow(10, 19)) finney := CurrencyToString(BigPow(10, 16)) szabo := CurrencyToString(BigPow(10, 13)) From eae1191904fd739cdffdd2903509a44a35c4c2f2 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 6 Aug 2015 15:18:32 +0100 Subject: [PATCH 07/90] cmd/utils: fix path expansion on windows --- cmd/utils/customflags.go | 9 +++------ cmd/utils/customflags_test.go | 5 +---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go index e7efed4e3c..4450065c14 100644 --- a/cmd/utils/customflags.go +++ b/cmd/utils/customflags.go @@ -21,7 +21,7 @@ import ( "fmt" "os" "os/user" - "path/filepath" + "path" "strings" "github.com/codegangsta/cli" @@ -138,11 +138,8 @@ func (self *DirectoryFlag) Set(value string) { func expandPath(p string) string { if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") { if user, err := user.Current(); err == nil { - if err == nil { - p = strings.Replace(p, "~", user.HomeDir, 1) - } + p = user.HomeDir + p[1:] } } - - return filepath.Clean(os.ExpandEnv(p)) + return path.Clean(os.ExpandEnv(p)) } diff --git a/cmd/utils/customflags_test.go b/cmd/utils/customflags_test.go index 0fb0af63b7..de39ca36a1 100644 --- a/cmd/utils/customflags_test.go +++ b/cmd/utils/customflags_test.go @@ -23,18 +23,15 @@ import ( ) func TestPathExpansion(t *testing.T) { - user, _ := user.Current() - tests := map[string]string{ "/home/someuser/tmp": "/home/someuser/tmp", "~/tmp": user.HomeDir + "/tmp", + "~thisOtherUser/b/": "~thisOtherUser/b", "$DDDXXX/a/b": "/tmp/a/b", "/a/b/": "/a/b", } - os.Setenv("DDDXXX", "/tmp") - for test, expected := range tests { got := expandPath(test) if got != expected { From 383201996463ddb91aa754f81d00d472e3436380 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 6 Aug 2015 15:19:09 +0100 Subject: [PATCH 08/90] common/compiler, common/docserver, jsre: fix tests on windows --- common/compiler/solidity_test.go | 5 +++-- common/docserver/docserver.go | 1 - common/docserver/docserver_test.go | 19 ++++++++++++------ jsre/jsre_test.go | 32 +++++++++++++++++++++--------- 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/common/compiler/solidity_test.go b/common/compiler/solidity_test.go index 8255e8e2d9..3303bc15a1 100644 --- a/common/compiler/solidity_test.go +++ b/common/compiler/solidity_test.go @@ -20,6 +20,7 @@ import ( "encoding/json" "io/ioutil" "os" + "path" "testing" "github.com/ethereum/go-ethereum/common" @@ -94,7 +95,7 @@ func TestSaveInfo(t *testing.T) { if err != nil { t.Errorf("%v", err) } - filename := "/tmp/solctest.info.json" + filename := path.Join(os.TempDir(), "solctest.info.json") os.Remove(filename) cinfohash, err := SaveInfo(&cinfo, filename) if err != nil { @@ -110,4 +111,4 @@ func TestSaveInfo(t *testing.T) { if cinfohash != infohash { t.Errorf("content hash for info is incorrect. expected %v, got %v", infohash.Hex(), cinfohash.Hex()) } -} +} \ No newline at end of file diff --git a/common/docserver/docserver.go b/common/docserver/docserver.go index fa120fb380..dac542ba7e 100644 --- a/common/docserver/docserver.go +++ b/common/docserver/docserver.go @@ -38,7 +38,6 @@ func New(docRoot string) (self *DocServer) { DocRoot: docRoot, schemes: []string{"file"}, } - self.DocRoot = "/tmp/" self.RegisterProtocol("file", http.NewFileTransport(http.Dir(self.DocRoot))) return } diff --git a/common/docserver/docserver_test.go b/common/docserver/docserver_test.go index 92e39d167a..632603addb 100644 --- a/common/docserver/docserver_test.go +++ b/common/docserver/docserver_test.go @@ -20,6 +20,7 @@ import ( "io/ioutil" "net/http" "os" + "path" "testing" "github.com/ethereum/go-ethereum/common" @@ -27,12 +28,18 @@ import ( ) func TestGetAuthContent(t *testing.T) { - text := "test" - hash := common.Hash{} - copy(hash[:], crypto.Sha3([]byte(text))) - ioutil.WriteFile("/tmp/test.content", []byte(text), os.ModePerm) + dir, err := ioutil.TempDir("", "docserver-test") + if err != nil { + t.Fatal("cannot create temporary directory:", err) + } + defer os.RemoveAll(dir) + ds := New(dir) - ds := New("/tmp/") + text := "test" + hash := crypto.Sha3Hash([]byte(text)) + if err := ioutil.WriteFile(path.Join(dir, "test.content"), []byte(text), os.ModePerm); err != nil { + t.Fatal("could not write test file", err) + } content, err := ds.GetAuthContent("file:///test.content", hash) if err != nil { t.Errorf("no error expected, got %v", err) @@ -67,4 +74,4 @@ func TestRegisterScheme(t *testing.T) { if !ds.HasScheme("scheme") { t.Errorf("expected scheme to be registered") } -} +} \ No newline at end of file diff --git a/jsre/jsre_test.go b/jsre/jsre_test.go index ad210932a0..93dc7d1f9a 100644 --- a/jsre/jsre_test.go +++ b/jsre/jsre_test.go @@ -19,6 +19,7 @@ package jsre import ( "io/ioutil" "os" + "path" "testing" "time" @@ -40,10 +41,23 @@ func (no *testNativeObjectBinding) TestMethod(call otto.FunctionCall) otto.Value return v } -func TestExec(t *testing.T) { - jsre := New("/tmp") +func newWithTestJS(t *testing.T, testjs string) (*JSRE, string) { + dir, err := ioutil.TempDir("", "jsre-test") + if err != nil { + t.Fatal("cannot create temporary directory:", err) + } + if testjs != "" { + if err := ioutil.WriteFile(path.Join(dir, "test.js"), []byte(testjs), os.ModePerm); err != nil { + t.Fatal("cannot create test.js:", err) + } + } + return New(dir), dir +} + +func TestExec(t *testing.T) { + jsre, dir := newWithTestJS(t, `msg = "testMsg"`) + defer os.RemoveAll(dir) - ioutil.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`), os.ModePerm) err := jsre.Exec("test.js") if err != nil { t.Errorf("expected no error, got %v", err) @@ -64,9 +78,9 @@ func TestExec(t *testing.T) { } func TestNatto(t *testing.T) { - jsre := New("/tmp") + jsre, dir := newWithTestJS(t, `setTimeout(function(){msg = "testMsg"}, 1);`) + defer os.RemoveAll(dir) - ioutil.WriteFile("/tmp/test.js", []byte(`setTimeout(function(){msg = "testMsg"}, 1);`), os.ModePerm) err := jsre.Exec("test.js") if err != nil { t.Errorf("expected no error, got %v", err) @@ -88,7 +102,7 @@ func TestNatto(t *testing.T) { } func TestBind(t *testing.T) { - jsre := New("/tmp") + jsre := New("") jsre.Bind("no", &testNativeObjectBinding{}) @@ -105,9 +119,9 @@ func TestBind(t *testing.T) { } func TestLoadScript(t *testing.T) { - jsre := New("/tmp") + jsre, dir := newWithTestJS(t, `msg = "testMsg"`) + defer os.RemoveAll(dir) - ioutil.WriteFile("/tmp/test.js", []byte(`msg = "testMsg"`), os.ModePerm) _, err := jsre.Run(`loadScript("test.js")`) if err != nil { t.Errorf("expected no error, got %v", err) @@ -125,4 +139,4 @@ func TestLoadScript(t *testing.T) { t.Errorf("expected '%v', got '%v'", exp, got) } jsre.Stop(false) -} +} \ No newline at end of file From 6ee908848cef9ec82e4d20e1bb79063de5500207 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 6 Aug 2015 15:19:40 +0100 Subject: [PATCH 09/90] p2p/nat: disable UPnP test on windows --- p2p/nat/natupnp_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/p2p/nat/natupnp_test.go b/p2p/nat/natupnp_test.go index c1e322af70..79f6d25ae8 100644 --- a/p2p/nat/natupnp_test.go +++ b/p2p/nat/natupnp_test.go @@ -21,6 +21,7 @@ import ( "io" "net" "net/http" + "runtime" "strings" "testing" @@ -28,6 +29,10 @@ import ( ) func TestUPNP_DDWRT(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skipf("disabled to avoid firewall prompt") + } + dev := &fakeIGD{ t: t, ssdpResp: "HTTP/1.1 200 OK\r\n" + From 803096ca0f262be7d03081482777c3e293f5f7ac Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Thu, 6 Aug 2015 15:33:14 +0100 Subject: [PATCH 10/90] .gitattributes: add --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..dfe0770424 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto From 46c95940812ccd3f474dc5fab7a5351351e8f105 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 6 Aug 2015 12:39:07 -0400 Subject: [PATCH 11/90] trie: run codec tests, add benchmarks, faster --- trie/encoding.go | 36 ++++++++++++--------------- trie/encoding_test.go | 58 ++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 24 deletions(-) diff --git a/trie/encoding.go b/trie/encoding.go index 8daf503a3f..9c862d78fa 100644 --- a/trie/encoding.go +++ b/trie/encoding.go @@ -16,10 +16,6 @@ package trie -import ( - "bytes" -) - func CompactEncode(hexSlice []byte) []byte { terminator := 0 if hexSlice[len(hexSlice)-1] == 16 { @@ -38,12 +34,12 @@ func CompactEncode(hexSlice []byte) []byte { hexSlice = append([]byte{flags, 0}, hexSlice...) } - var buff bytes.Buffer - for i := 0; i < len(hexSlice); i += 2 { - buff.WriteByte(byte(16*hexSlice[i] + hexSlice[i+1])) + l := len(hexSlice) / 2 + var buf = make([]byte, l) + for i := 0; i < l; i++ { + buf[i] = 16*hexSlice[2*i] + hexSlice[2*i+1] } - - return buff.Bytes() + return buf } func CompactDecode(str []byte) []byte { @@ -62,22 +58,22 @@ func CompactDecode(str []byte) []byte { } func CompactHexDecode(str []byte) []byte { - var nibbles []byte - - for _, b := range str { - nibbles = append(nibbles, b/16) - nibbles = append(nibbles, b%16) + l := len(str)*2 + 1 + var nibbles = make([]byte, l) + for i, b := range str { + nibbles[i*2] = b / 16 + nibbles[i*2+1] = b % 16 } - nibbles = append(nibbles, 16) + nibbles[l-1] = 16 return nibbles } -// assumes key is odd length func DecodeCompact(key []byte) []byte { - var res []byte - for i := 0; i < len(key)-1; i += 2 { - v1, v0 := key[i], key[i+1] - res = append(res, v1*16+v0) + l := len(key) / 2 + var res = make([]byte, l) + for i := 0; i < l; i++ { + v1, v0 := key[2*i], key[2*i+1] + res[i] = v1*16 + v0 } return res } diff --git a/trie/encoding_test.go b/trie/encoding_test.go index faaa7f5833..e49b57ef02 100644 --- a/trie/encoding_test.go +++ b/trie/encoding_test.go @@ -17,9 +17,14 @@ package trie import ( + "encoding/hex" + "testing" + checker "gopkg.in/check.v1" ) +func Test(t *testing.T) { checker.TestingT(t) } + type TrieEncodingSuite struct{} var _ = checker.Suite(&TrieEncodingSuite{}) @@ -28,22 +33,22 @@ func (s *TrieEncodingSuite) TestCompactEncode(c *checker.C) { // even compact encode test1 := []byte{1, 2, 3, 4, 5} res1 := CompactEncode(test1) - c.Assert(res1, checker.Equals, "\x11\x23\x45") + c.Assert(res1, checker.DeepEquals, []byte("\x11\x23\x45")) // odd compact encode test2 := []byte{0, 1, 2, 3, 4, 5} res2 := CompactEncode(test2) - c.Assert(res2, checker.Equals, "\x00\x01\x23\x45") + c.Assert(res2, checker.DeepEquals, []byte("\x00\x01\x23\x45")) //odd terminated compact encode test3 := []byte{0, 15, 1, 12, 11, 8 /*term*/, 16} res3 := CompactEncode(test3) - c.Assert(res3, checker.Equals, "\x20\x0f\x1c\xb8") + c.Assert(res3, checker.DeepEquals, []byte("\x20\x0f\x1c\xb8")) // even terminated compact encode test4 := []byte{15, 1, 12, 11, 8 /*term*/, 16} res4 := CompactEncode(test4) - c.Assert(res4, checker.Equals, "\x3f\x1c\xb8") + c.Assert(res4, checker.DeepEquals, []byte("\x3f\x1c\xb8")) } func (s *TrieEncodingSuite) TestCompactHexDecode(c *checker.C) { @@ -73,3 +78,48 @@ func (s *TrieEncodingSuite) TestCompactDecode(c *checker.C) { res = CompactDecode([]byte("\x3f\x1c\xb8")) c.Assert(res, checker.DeepEquals, exp) } + +func (s *TrieEncodingSuite) TestDecodeCompact(c *checker.C) { + exp, _ := hex.DecodeString("012345") + res := DecodeCompact([]byte{0, 1, 2, 3, 4, 5}) + c.Assert(res, checker.DeepEquals, exp) + + exp, _ = hex.DecodeString("012345") + res = DecodeCompact([]byte{0, 1, 2, 3, 4, 5, 16}) + c.Assert(res, checker.DeepEquals, exp) + + exp, _ = hex.DecodeString("abcdef") + res = DecodeCompact([]byte{10, 11, 12, 13, 14, 15}) + c.Assert(res, checker.DeepEquals, exp) +} + +func BenchmarkCompactEncode(b *testing.B) { + + testBytes := []byte{0, 15, 1, 12, 11, 8 /*term*/, 16} + for i := 0; i < b.N; i++ { + CompactEncode(testBytes) + } +} + +func BenchmarkCompactDecode(b *testing.B) { + testBytes := []byte{0, 15, 1, 12, 11, 8 /*term*/, 16} + for i := 0; i < b.N; i++ { + CompactDecode(testBytes) + } +} + +func BenchmarkCompactHexDecode(b *testing.B) { + testBytes := []byte{7, 6, 6, 5, 7, 2, 6, 2, 16} + for i := 0; i < b.N; i++ { + CompactHexDecode(testBytes) + } + +} + +func BenchmarkDecodeCompact(b *testing.B) { + testBytes := []byte{7, 6, 6, 5, 7, 2, 6, 2, 16} + for i := 0; i < b.N; i++ { + DecodeCompact(testBytes) + } + +} From cf7cef4293cf1b1a9b393f1030f8c8e648c2975b Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 7 Aug 2015 09:52:12 +0200 Subject: [PATCH 12/90] xeth: added address hex check and length check --- xeth/xeth.go | 11 +++++++++++ xeth/xeth_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 xeth/xeth_test.go diff --git a/xeth/xeth.go b/xeth/xeth.go index 5d54c1f7e4..372068c148 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -20,8 +20,10 @@ package xeth import ( "bytes" "encoding/json" + "errors" "fmt" "math/big" + "regexp" "sync" "time" @@ -45,6 +47,7 @@ var ( defaultGasPrice = big.NewInt(10000000000000) //150000000000 defaultGas = big.NewInt(90000) //500000 dappStorePre = []byte("dapp-") + addrReg = regexp.MustCompile(`^(0x)?[a-fA-F0-9]{40}$`) ) // byte will be inferred @@ -878,6 +881,10 @@ func (self *XEth) Sign(fromStr, hashStr string, didUnlock bool) (string, error) return common.ToHex(sig), nil } +func isAddress(addr string) bool { + return addrReg.MatchString(addr) +} + func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error) { // this minimalistic recoding is enough (works for natspec.js) @@ -887,6 +894,10 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS return "", err } + if !isAddress(toStr) { + return "", errors.New("Invalid address") + } + var ( from = common.HexToAddress(fromStr) to = common.HexToAddress(toStr) diff --git a/xeth/xeth_test.go b/xeth/xeth_test.go new file mode 100644 index 0000000000..e649d20ef1 --- /dev/null +++ b/xeth/xeth_test.go @@ -0,0 +1,26 @@ +package xeth + +import "testing" + +func TestIsAddress(t *testing.T) { + for _, invalid := range []string{ + "0x00", + "0xNN", + "0x00000000000000000000000000000000000000NN", + "0xAAar000000000000000000000000000000000000", + } { + if isAddress(invalid) { + t.Error("Expected", invalid, "to be invalid") + } + } + + for _, valid := range []string{ + "0x0000000000000000000000000000000000000000", + "0xAABBbbCCccff9900000000000000000000000000", + "AABBbbCCccff9900000000000000000000000000", + } { + if !isAddress(valid) { + t.Error("Expected", valid, "to be valid") + } + } +} From 785b3e7a575f26f3c33e3369d8a75fb131f90584 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 6 Aug 2015 11:20:15 +0200 Subject: [PATCH 13/90] cmd/geth, eth: added canonical extra data Implemented canonical extra data according to https://github.com/ethereum/wiki/wiki/Extra-Data --- cmd/geth/main.go | 32 ++++++++++++++++++++++++++++++-- eth/backend.go | 9 ++------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 74f4e90c3a..ddfa8e661f 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -42,6 +42,8 @@ import ( "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/metrics" + "github.com/ethereum/go-ethereum/params" + "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" "github.com/mattn/go-colorable" @@ -49,11 +51,14 @@ import ( ) const ( - ClientIdentifier = "Geth" - Version = "1.0.1" + ClientIdentifier = "Geth " + VersionMajor = 1 + VersionMinor = 0 + VersionPatch = 1 ) var ( + Version = fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) gitCommit string // set via linker flagg nodeNameVersion string app *cli.App @@ -346,6 +351,27 @@ func main() { } } +func makeDefaultExtra() []byte { + var clientInfo = struct { + Version uint + Name string + GoVersion string + Os string + }{uint(VersionMajor<<16 | VersionMinor<<8 | VersionPatch), ClientIdentifier, runtime.Version(), runtime.GOOS} + extra, err := rlp.EncodeToBytes(clientInfo) + if err != nil { + glog.V(logger.Warn).Infoln("error setting canonical miner information:", err) + } + + if uint64(len(extra)) > params.MaximumExtraDataSize.Uint64() { + glog.V(logger.Warn).Infoln("error setting canonical miner information: extra exceeds", params.MaximumExtraDataSize) + glog.V(logger.Debug).Infof("extra: %x\n", extra) + return nil + } + + return extra +} + func run(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) if ctx.GlobalBool(utils.OlympicFlag.Name) { @@ -353,6 +379,8 @@ func run(ctx *cli.Context) { } cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx) + cfg.ExtraData = makeDefaultExtra() + ethereum, err := eth.New(cfg) if err != nil { utils.Fatalf("%v", err) diff --git a/eth/backend.go b/eth/backend.go index 4795000e09..ed46a4ab36 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -45,7 +45,6 @@ import ( "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/whisper" ) @@ -92,6 +91,7 @@ type Config struct { NatSpec bool AutoDAG bool PowTest bool + ExtraData []byte MaxPeers int MaxPendingPeers int @@ -378,12 +378,7 @@ func New(config *Config) (*Ethereum, error) { eth.miner = miner.New(eth, eth.EventMux(), eth.pow) eth.miner.SetGasPrice(config.GasPrice) - - extra := config.Name - if uint64(len(extra)) > params.MaximumExtraDataSize.Uint64() { - extra = extra[:params.MaximumExtraDataSize.Uint64()] - } - eth.miner.SetExtra([]byte(extra)) + eth.miner.SetExtra(config.ExtraData) if config.Shh { eth.whisper = whisper.New() From 132df860d90c163a8be55260bdd219892f9e1bef Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 7 Aug 2015 12:12:05 +0200 Subject: [PATCH 14/90] miner, rpc: added length check for extra data --- miner/miner.go | 9 ++++++++- rpc/api/miner.go | 8 ++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/miner/miner.go b/miner/miner.go index bf6a488020..3095d98281 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -18,6 +18,7 @@ package miner import ( + "fmt" "math/big" "sync/atomic" @@ -29,6 +30,7 @@ import ( "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/pow" ) @@ -143,8 +145,13 @@ func (self *Miner) HashRate() int64 { return self.pow.GetHashrate() } -func (self *Miner) SetExtra(extra []byte) { +func (self *Miner) SetExtra(extra []byte) error { + if uint64(len(extra)) > params.MaximumExtraDataSize.Uint64() { + return fmt.Errorf("Extra exceeds max length. %d > %v", len(extra), params.MaximumExtraDataSize) + } + self.worker.extra = extra + return nil } func (self *Miner) PendingState() *state.StateDB { diff --git a/rpc/api/miner.go b/rpc/api/miner.go index 3c3d1ee0b3..5325a660af 100644 --- a/rpc/api/miner.go +++ b/rpc/api/miner.go @@ -17,12 +17,9 @@ package api import ( - "fmt" - "github.com/ethereum/ethash" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/shared" ) @@ -126,11 +123,10 @@ func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) { return nil, err } - if uint64(len(args.Data)) > params.MaximumExtraDataSize.Uint64()*2 { - return false, fmt.Errorf("extra datasize can be no longer than %v bytes", params.MaximumExtraDataSize) + if err := self.ethereum.Miner().SetExtra([]byte(args.Data)); err != nil { + return false, err } - self.ethereum.Miner().SetExtra([]byte(args.Data)) return true, nil } From a33726b7db98fcb754c6d9d96538ce21cfc35f9a Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 7 Aug 2015 12:33:12 +0200 Subject: [PATCH 15/90] web3: regression. Fixes #1613 --- jsre/ethereum_js.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jsre/ethereum_js.go b/jsre/ethereum_js.go index 27dbed24cc..012e5af709 100644 --- a/jsre/ethereum_js.go +++ b/jsre/ethereum_js.go @@ -1137,10 +1137,10 @@ var toHex = function (val) { if (isString(val)) { if (val.indexOf('-0x') === 0) return fromDecimal(val); - else if (!isFinite(val)) - return fromAscii(val); else if(val.indexOf('0x') === 0) return val; + else if (!isFinite(val)) + return fromAscii(val); } return fromDecimal(val); From 846f34f78b5f76233655d0cf3611706e99f2efe2 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 17 Jul 2015 23:09:36 +0200 Subject: [PATCH 16/90] core/vm, tests: implemented semi-jit vm * changed stack and removed stack ptr. Let go decide on slice reuse. --- Makefile | 6 +- cmd/evm/main.go | 26 +- cmd/geth/main.go | 3 + cmd/utils/flags.go | 31 ++- core/block_processor.go | 2 - core/chain_manager.go | 2 +- core/vm/context.go | 1 + core/vm/contracts.go | 2 +- core/vm/gas.go | 4 +- core/vm/instructions.go | 587 +++++++++++++++++++++++++++++++++++++++ core/vm/jit.go | 537 +++++++++++++++++++++++++++++++++++ core/vm/jit_test.go | 119 ++++++++ core/vm/settings.go | 24 ++ core/vm/stack.go | 21 +- core/vm/vm.go | 125 +++++---- tests/state_test.go | 17 ++ tests/state_test_util.go | 56 ++++ tests/vm_test.go | 14 + tests/vm_test_util.go | 74 ++++- 19 files changed, 1572 insertions(+), 79 deletions(-) create mode 100644 core/vm/instructions.go create mode 100644 core/vm/jit.go create mode 100644 core/vm/jit_test.go create mode 100644 core/vm/settings.go diff --git a/Makefile b/Makefile index 03e3bf4c6f..3478b54333 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # with Go source code. If you know what GOPATH is then you probably # don't need to bother with make. -.PHONY: geth mist all test travis-test-with-coverage clean +.PHONY: geth evm mist all test travis-test-with-coverage clean GOBIN = build/bin geth: @@ -10,6 +10,10 @@ geth: @echo "Done building." @echo "Run \"$(GOBIN)/geth\" to launch geth." +evm: + build/env.sh $(GOROOT)/bin/go install -v $(shell build/ldflags.sh) ./cmd/evm + @echo "Done building." + @echo "Run \"$(GOBIN)/evm to start the evm." mist: build/env.sh go install -v $(shell build/ldflags.sh) ./cmd/mist @echo "Done building." diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 9659943820..7dd375b148 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -32,6 +32,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/ethdb" + "github.com/ethereum/go-ethereum/logger/glog" ) var ( @@ -40,6 +41,14 @@ var ( Name: "debug", Usage: "output full trace logs", } + ForceJitFlag = cli.BoolFlag{ + Name: "forcejit", + Usage: "forces jit compilation", + } + DisableJitFlag = cli.BoolFlag{ + Name: "nojit", + Usage: "disabled jit compilation", + } CodeFlag = cli.StringFlag{ Name: "code", Usage: "EVM code", @@ -77,6 +86,8 @@ func init() { app = utils.NewApp("0.2", "the evm command line interface") app.Flags = []cli.Flag{ DebugFlag, + ForceJitFlag, + DisableJitFlag, SysStatFlag, CodeFlag, GasFlag, @@ -90,6 +101,10 @@ func init() { func run(ctx *cli.Context) { vm.Debug = ctx.GlobalBool(DebugFlag.Name) + vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name) + vm.DisableJit = ctx.GlobalBool(DisableJitFlag.Name) + + glog.SetToStderr(true) db, _ := ethdb.NewMemDatabase() statedb := state.New(common.Hash{}, db) @@ -110,11 +125,6 @@ func run(ctx *cli.Context) { ) vmdone := time.Since(tstart) - if e != nil { - fmt.Println(e) - os.Exit(1) - } - if ctx.GlobalBool(DumpFlag.Name) { fmt.Println(string(statedb.Dump())) } @@ -133,7 +143,11 @@ num gc: %d `, mem.Alloc, mem.TotalAlloc, mem.Mallocs, mem.HeapAlloc, mem.HeapObjects, mem.NumGC) } - fmt.Printf("OUT: 0x%x\n", ret) + fmt.Printf("OUT: 0x%x", ret) + if e != nil { + fmt.Printf(" error: %v", e) + } + fmt.Println() } func main() { diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 74f4e90c3a..68c66a4abe 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -307,6 +307,9 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso utils.ExecFlag, utils.WhisperEnabledFlag, utils.VMDebugFlag, + utils.VMForceJitFlag, + utils.VMJitCacheFlag, + utils.VMEnableJitFlag, utils.NetworkIdFlag, utils.RPCCORSDomainFlag, utils.VerbosityFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index cf969805da..e7b30cfa0d 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -27,6 +27,7 @@ import ( "runtime" "strconv" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/metrics" "github.com/codegangsta/cli" @@ -172,6 +173,25 @@ var ( Value: "", } + // vm flags + VMDebugFlag = cli.BoolFlag{ + Name: "vmdebug", + Usage: "Virtual Machine debug output", + } + VMForceJitFlag = cli.BoolFlag{ + Name: "forcejit", + Usage: "Force the JIT VM to take precedence", + } + VMJitCacheFlag = cli.IntFlag{ + Name: "jitcache", + Usage: "Amount of cached JIT VM programs", + Value: 64, + } + VMEnableJitFlag = cli.BoolFlag{ + Name: "jitvm", + Usage: "Enable the JIT VM", + } + // logging and debug settings LogFileFlag = cli.StringFlag{ Name: "logfile", @@ -196,10 +216,6 @@ var ( Usage: "The syntax of the argument is a comma-separated list of pattern=N, where pattern is a literal file name (minus the \".go\" suffix) or \"glob\" pattern and N is a log verbosity level.", Value: glog.GetVModule(), } - VMDebugFlag = cli.BoolFlag{ - Name: "vmdebug", - Usage: "Virtual Machine debug output", - } BacktraceAtFlag = cli.GenericFlag{ Name: "backtrace_at", Usage: "If set to a file and line number (e.g., \"block.go:271\") holding a logging statement, a stack trace will be logged", @@ -434,6 +450,13 @@ func SetupLogger(ctx *cli.Context) { glog.SetLogDir(ctx.GlobalString(LogFileFlag.Name)) } +// SetupVM configured the VM package's global settings +func SetupVM(ctx *cli.Context) { + vm.DisableJit = !ctx.GlobalBool(VMEnableJitFlag.Name) + vm.ForceJit = ctx.GlobalBool(VMForceJitFlag.Name) + vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name)) +} + // MakeChain creates a chain manager from set command line flags. func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, extraDB common.Database) { datadir := ctx.GlobalString(DataDirFlag.Name) diff --git a/core/block_processor.go b/core/block_processor.go index 5a2ad8377f..6ed1bc8ef1 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -84,8 +84,6 @@ func (sm *BlockProcessor) TransitionState(statedb *state.StateDB, parent, block } func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *big.Int, transientProcess bool) (*types.Receipt, *big.Int, error) { - // If we are mining this block and validating we want to set the logs back to 0 - cb := statedb.GetStateObject(coinbase.Address()) _, gas, err := ApplyMessage(NewEnv(statedb, self.bc, tx, header), tx, cb) if err != nil { diff --git a/core/chain_manager.go b/core/chain_manager.go index fc1d1304fd..1b792933c9 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -632,7 +632,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) { switch status { case CanonStatTy: if glog.V(logger.Debug) { - glog.Infof("[%v] inserted block #%d (%d TXs %d UNCs) (%x...). Took %v\n", time.Now().UnixNano(), block.Number(), len(block.Transactions()), len(block.Uncles()), block.Hash().Bytes()[0:4], time.Since(bstart)) + glog.Infof("[%v] inserted block #%d (%d TXs %v G %d UNCs) (%x...). Took %v\n", time.Now().UnixNano(), block.Number(), len(block.Transactions()), block.GasUsed(), len(block.Uncles()), block.Hash().Bytes()[0:4], time.Since(bstart)) } queue[i] = ChainEvent{block, block.Hash(), logs} queueEvent.canonicalCount++ diff --git a/core/vm/context.go b/core/vm/context.go index 162666ef22..d17934ba59 100644 --- a/core/vm/context.go +++ b/core/vm/context.go @@ -35,6 +35,7 @@ type Context struct { jumpdests destinations // result of JUMPDEST analysis. Code []byte + Input []byte CodeAddr *common.Address value, Gas, UsedGas, Price *big.Int diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 2d70f173e9..b965fa095c 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -94,7 +94,7 @@ func ecrecoverFunc(in []byte) []byte { v := byte(vbig.Uint64()) if !crypto.ValidateSignatureValues(v, r, s) { - glog.V(logger.Error).Infof("EC RECOVER FAIL: v, r or s value invalid") + glog.V(logger.Debug).Infof("EC RECOVER FAIL: v, r or s value invalid") return nil } diff --git a/core/vm/gas.go b/core/vm/gas.go index af2e586a71..b2f068e6e1 100644 --- a/core/vm/gas.go +++ b/core/vm/gas.go @@ -54,8 +54,8 @@ func baseCheck(op OpCode, stack *stack, gas *big.Int) error { return err } - if r.stackPush > 0 && len(stack.data)-r.stackPop+r.stackPush > int(params.StackLimit.Int64())+1 { - return fmt.Errorf("stack limit reached %d (%d)", len(stack.data), params.StackLimit.Int64()) + if r.stackPush > 0 && stack.len()-r.stackPop+r.stackPush > int(params.StackLimit.Int64()) { + return fmt.Errorf("stack limit reached %d (%d)", stack.len(), params.StackLimit.Int64()) } gas.Add(gas, r.gas) diff --git a/core/vm/instructions.go b/core/vm/instructions.go new file mode 100644 index 0000000000..7793ff1698 --- /dev/null +++ b/core/vm/instructions.go @@ -0,0 +1,587 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . +package vm + +import ( + "math/big" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" +) + +type instrFn func(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) +type instrExFn func(instr instruction, ret *big.Int, env Environment, context *Context, memory *Memory, stack *stack) + +type instruction struct { + op OpCode + pc uint64 + fn instrFn + specFn instrExFn + data *big.Int + + gas *big.Int + spop int + spush int +} + +func opStaticJump(instr instruction, ret *big.Int, env Environment, context *Context, memory *Memory, stack *stack) { + ret.Set(instr.data) +} + +func opAdd(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + stack.push(U256(new(big.Int).Add(x, y))) +} + +func opSub(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + stack.push(U256(new(big.Int).Sub(x, y))) +} + +func opMul(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + stack.push(U256(new(big.Int).Mul(x, y))) +} + +func opDiv(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + base := new(big.Int) + x, y := stack.pop(), stack.pop() + + if y.Cmp(common.Big0) != 0 { + base.Div(x, y) + } + + // pop result back on the stack + stack.push(U256(base)) +} + +func opSdiv(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + base := new(big.Int) + x, y := S256(stack.pop()), S256(stack.pop()) + + if y.Cmp(common.Big0) == 0 { + base.Set(common.Big0) + } else { + n := new(big.Int) + if new(big.Int).Mul(x, y).Cmp(common.Big0) < 0 { + n.SetInt64(-1) + } else { + n.SetInt64(1) + } + + base.Div(x.Abs(x), y.Abs(y)).Mul(base, n) + + U256(base) + } + + stack.push(base) +} + +func opMod(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + base := new(big.Int) + x, y := stack.pop(), stack.pop() + + if y.Cmp(common.Big0) == 0 { + base.Set(common.Big0) + } else { + base.Mod(x, y) + } + + U256(base) + + stack.push(base) +} + +func opSmod(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + base := new(big.Int) + x, y := S256(stack.pop()), S256(stack.pop()) + + if y.Cmp(common.Big0) == 0 { + base.Set(common.Big0) + } else { + n := new(big.Int) + if x.Cmp(common.Big0) < 0 { + n.SetInt64(-1) + } else { + n.SetInt64(1) + } + + base.Mod(x.Abs(x), y.Abs(y)).Mul(base, n) + + U256(base) + } + + stack.push(base) +} + +func opExp(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + base := new(big.Int) + x, y := stack.pop(), stack.pop() + + base.Exp(x, y, Pow256) + + U256(base) + + stack.push(base) +} + +func opSignExtend(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + back := stack.pop() + if back.Cmp(big.NewInt(31)) < 0 { + bit := uint(back.Uint64()*8 + 7) + num := stack.pop() + mask := new(big.Int).Lsh(common.Big1, bit) + mask.Sub(mask, common.Big1) + if common.BitTest(num, int(bit)) { + num.Or(num, mask.Not(mask)) + } else { + num.And(num, mask) + } + + num = U256(num) + + stack.push(num) + } +} + +func opNot(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(U256(new(big.Int).Not(stack.pop()))) +} + +func opLt(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + // x < y + if x.Cmp(y) < 0 { + stack.push(common.BigTrue) + } else { + stack.push(common.BigFalse) + } +} + +func opGt(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + // x > y + if x.Cmp(y) > 0 { + stack.push(common.BigTrue) + } else { + stack.push(common.BigFalse) + } +} + +func opSlt(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := S256(stack.pop()), S256(stack.pop()) + + // x < y + if x.Cmp(S256(y)) < 0 { + stack.push(common.BigTrue) + } else { + stack.push(common.BigFalse) + } +} + +func opSgt(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := S256(stack.pop()), S256(stack.pop()) + + // x > y + if x.Cmp(y) > 0 { + stack.push(common.BigTrue) + } else { + stack.push(common.BigFalse) + } +} + +func opEq(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + // x == y + if x.Cmp(y) == 0 { + stack.push(common.BigTrue) + } else { + stack.push(common.BigFalse) + } +} + +func opIszero(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x := stack.pop() + if x.Cmp(common.BigFalse) > 0 { + stack.push(common.BigFalse) + } else { + stack.push(common.BigTrue) + } +} + +func opAnd(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + stack.push(new(big.Int).And(x, y)) +} +func opOr(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + stack.push(new(big.Int).Or(x, y)) +} +func opXor(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + x, y := stack.pop(), stack.pop() + + stack.push(new(big.Int).Xor(x, y)) +} +func opByte(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + base := new(big.Int) + th, val := stack.pop(), stack.pop() + + if th.Cmp(big.NewInt(32)) < 0 { + byt := big.NewInt(int64(common.LeftPadBytes(val.Bytes(), 32)[th.Int64()])) + + base.Set(byt) + } else { + base.Set(common.BigFalse) + } + + stack.push(base) +} +func opAddmod(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + base := new(big.Int) + x := stack.pop() + y := stack.pop() + z := stack.pop() + + if z.Cmp(Zero) > 0 { + add := new(big.Int).Add(x, y) + base.Mod(add, z) + + base = U256(base) + } + + stack.push(base) +} +func opMulmod(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + base := new(big.Int) + x := stack.pop() + y := stack.pop() + z := stack.pop() + + if z.Cmp(Zero) > 0 { + mul := new(big.Int).Mul(x, y) + base.Mod(mul, z) + + U256(base) + } + + stack.push(base) +} + +func opSha3(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + offset, size := stack.pop(), stack.pop() + hash := crypto.Sha3(memory.Get(offset.Int64(), size.Int64())) + + stack.push(common.BigD(hash)) +} + +func opAddress(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(common.Bytes2Big(context.Address().Bytes())) +} + +func opBalance(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + addr := common.BigToAddress(stack.pop()) + balance := env.State().GetBalance(addr) + + stack.push(new(big.Int).Set(balance)) +} + +func opOrigin(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(env.Origin().Big()) +} + +func opCaller(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(common.Bytes2Big(context.caller.Address().Bytes())) +} + +func opCallValue(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(new(big.Int).Set(context.value)) +} + +func opCalldataLoad(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(common.Bytes2Big(getData(context.Input, stack.pop(), common.Big32))) +} + +func opCalldataSize(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(big.NewInt(int64(len(context.Input)))) +} + +func opCalldataCopy(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + var ( + mOff = stack.pop() + cOff = stack.pop() + l = stack.pop() + ) + memory.Set(mOff.Uint64(), l.Uint64(), getData(context.Input, cOff, l)) +} + +func opExtCodeSize(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + addr := common.BigToAddress(stack.pop()) + l := big.NewInt(int64(len(env.State().GetCode(addr)))) + stack.push(l) +} + +func opCodeSize(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + l := big.NewInt(int64(len(context.Code))) + stack.push(l) +} + +func opCodeCopy(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + var ( + mOff = stack.pop() + cOff = stack.pop() + l = stack.pop() + ) + codeCopy := getData(context.Code, cOff, l) + + memory.Set(mOff.Uint64(), l.Uint64(), codeCopy) +} + +func opExtCodeCopy(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + var ( + addr = common.BigToAddress(stack.pop()) + mOff = stack.pop() + cOff = stack.pop() + l = stack.pop() + ) + codeCopy := getData(env.State().GetCode(addr), cOff, l) + + memory.Set(mOff.Uint64(), l.Uint64(), codeCopy) +} + +func opGasprice(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(new(big.Int).Set(context.Price)) +} + +func opBlockhash(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + num := stack.pop() + + n := new(big.Int).Sub(env.BlockNumber(), common.Big257) + if num.Cmp(n) > 0 && num.Cmp(env.BlockNumber()) < 0 { + stack.push(env.GetHash(num.Uint64()).Big()) + } else { + stack.push(common.Big0) + } +} + +func opCoinbase(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(env.Coinbase().Big()) +} + +func opTimestamp(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(new(big.Int).SetUint64(env.Time())) +} + +func opNumber(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(U256(env.BlockNumber())) +} + +func opDifficulty(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(new(big.Int).Set(env.Difficulty())) +} + +func opGasLimit(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(new(big.Int).Set(env.GasLimit())) +} + +func opPop(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.pop() +} + +func opPush(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(new(big.Int).Set(instr.data)) +} + +func opDup(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.dup(int(instr.data.Int64())) +} + +func opSwap(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.swap(int(instr.data.Int64())) +} + +func opLog(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + n := int(instr.data.Int64()) + topics := make([]common.Hash, n) + mStart, mSize := stack.pop(), stack.pop() + for i := 0; i < n; i++ { + topics[i] = common.BigToHash(stack.pop()) + } + + d := memory.Get(mStart.Int64(), mSize.Int64()) + log := state.NewLog(context.Address(), topics, d, env.BlockNumber().Uint64()) + env.AddLog(log) +} + +func opMload(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + offset := stack.pop() + val := common.BigD(memory.Get(offset.Int64(), 32)) + stack.push(val) +} + +func opMstore(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + // pop value of the stack + mStart, val := stack.pop(), stack.pop() + memory.Set(mStart.Uint64(), 32, common.BigToBytes(val, 256)) +} + +func opMstore8(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + off, val := stack.pop().Int64(), stack.pop().Int64() + memory.store[off] = byte(val & 0xff) +} + +func opSload(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + loc := common.BigToHash(stack.pop()) + val := env.State().GetState(context.Address(), loc).Big() + stack.push(val) +} + +func opSstore(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + loc := common.BigToHash(stack.pop()) + val := stack.pop() + + env.State().SetState(context.Address(), loc, common.BigToHash(val)) +} + +func opJump(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { +} +func opJumpi(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { +} +func opJumpdest(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { +} + +func opPc(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(instr.data) +} + +func opMsize(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(big.NewInt(int64(memory.Len()))) +} + +func opGas(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + stack.push(new(big.Int).Set(context.Gas)) +} + +func opCreate(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + var ( + value = stack.pop() + offset, size = stack.pop(), stack.pop() + input = memory.Get(offset.Int64(), size.Int64()) + gas = new(big.Int).Set(context.Gas) + addr common.Address + ) + + context.UseGas(context.Gas) + ret, suberr, ref := env.Create(context, input, gas, context.Price, value) + if suberr != nil { + stack.push(common.BigFalse) + + } else { + // gas < len(ret) * Createinstr.dataGas == NO_CODE + dataGas := big.NewInt(int64(len(ret))) + dataGas.Mul(dataGas, params.CreateDataGas) + if context.UseGas(dataGas) { + ref.SetCode(ret) + } + addr = ref.Address() + + stack.push(addr.Big()) + + } +} + +func opCall(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + gas := stack.pop() + // pop gas and value of the stack. + addr, value := stack.pop(), stack.pop() + value = U256(value) + // pop input size and offset + inOffset, inSize := stack.pop(), stack.pop() + // pop return size and offset + retOffset, retSize := stack.pop(), stack.pop() + + address := common.BigToAddress(addr) + + // Get the arguments from the memory + args := memory.Get(inOffset.Int64(), inSize.Int64()) + + if len(value.Bytes()) > 0 { + gas.Add(gas, params.CallStipend) + } + + ret, err := env.Call(context, address, args, gas, context.Price, value) + + if err != nil { + stack.push(common.BigFalse) + + } else { + stack.push(common.BigTrue) + + memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) + } +} + +func opCallCode(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + gas := stack.pop() + // pop gas and value of the stack. + addr, value := stack.pop(), stack.pop() + value = U256(value) + // pop input size and offset + inOffset, inSize := stack.pop(), stack.pop() + // pop return size and offset + retOffset, retSize := stack.pop(), stack.pop() + + address := common.BigToAddress(addr) + + // Get the arguments from the memory + args := memory.Get(inOffset.Int64(), inSize.Int64()) + + if len(value.Bytes()) > 0 { + gas.Add(gas, params.CallStipend) + } + + ret, err := env.CallCode(context, address, args, gas, context.Price, value) + + if err != nil { + stack.push(common.BigFalse) + + } else { + stack.push(common.BigTrue) + + memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) + } +} + +func opReturn(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {} +func opStop(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {} + +func opSuicide(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { + receiver := env.State().GetOrNewStateObject(common.BigToAddress(stack.pop())) + balance := env.State().GetBalance(context.Address()) + + receiver.AddBalance(balance) + + env.State().Delete(context.Address()) +} diff --git a/core/vm/jit.go b/core/vm/jit.go new file mode 100644 index 0000000000..a773092234 --- /dev/null +++ b/core/vm/jit.go @@ -0,0 +1,537 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . +package vm + +import ( + "fmt" + "math/big" + "sync/atomic" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" + "github.com/hashicorp/golang-lru" +) + +type progStatus int32 + +const ( + progUnknown progStatus = iota + progCompile + progReady + progError +) + +var programs *lru.Cache + +func init() { + programs, _ = lru.New(defaultJitMaxCache) +} + +// SetJITCacheSize recreates the program cache with the max given size. Setting +// a new cache is **not** thread safe. Use with caution. +func SetJITCacheSize(size int) { + programs, _ = lru.New(size) +} + +// GetProgram returns the program by id or nil when non-existant +func GetProgram(id common.Hash) *Program { + if p, ok := programs.Get(id); ok { + return p.(*Program) + } + + return nil +} + +// GenProgramStatus returns the status of the given program id +func GetProgramStatus(id common.Hash) progStatus { + program := GetProgram(id) + if program != nil { + return progStatus(atomic.LoadInt32(&program.status)) + } + + return progUnknown +} + +// Program is a compiled program for the JIT VM and holds all required for +// running a compiled JIT program. +type Program struct { + Id common.Hash // Id of the program + status int32 // status should be accessed atomically + + context *Context + + instructions []instruction // instruction set + mapping map[uint64]int // real PC mapping to array indices + destinations map[uint64]struct{} // cached jump destinations + + code []byte +} + +func NewProgram(code []byte) *Program { + program := &Program{ + Id: crypto.Sha3Hash(code), + mapping: make(map[uint64]int), + destinations: make(map[uint64]struct{}), + code: code, + } + + programs.Add(program.Id, program) + return program +} + +func (p *Program) addInstr(op OpCode, pc uint64, fn instrFn, data *big.Int) { + // PUSH and DUP are a bit special. They all cost the same but we do want to have checking on stack push limit + // PUSH is also allowed to calculate the same price for all PUSHes + // DUP requirements are handled elsewhere (except for the stack limit check) + baseOp := op + if op >= PUSH1 && op <= PUSH32 { + baseOp = PUSH1 + } + if op >= DUP1 && op <= DUP16 { + baseOp = DUP1 + } + base := _baseCheck[baseOp] + instr := instruction{op, pc, fn, nil, data, base.gas, base.stackPop, base.stackPush} + + p.instructions = append(p.instructions, instr) + p.mapping[pc] = len(p.instructions) - 1 +} + +func CompileProgram(program *Program) (err error) { + if progStatus(atomic.LoadInt32(&program.status)) == progCompile { + return nil + } + atomic.StoreInt32(&program.status, int32(progCompile)) + defer func() { + if err != nil { + atomic.StoreInt32(&program.status, int32(progError)) + } else { + atomic.StoreInt32(&program.status, int32(progReady)) + } + }() + + // loop thru the opcodes and "compile" in to instructions + for pc := uint64(0); pc < uint64(len(program.code)); pc++ { + switch op := OpCode(program.code[pc]); op { + case ADD: + program.addInstr(op, pc, opAdd, nil) + case SUB: + program.addInstr(op, pc, opSub, nil) + case MUL: + program.addInstr(op, pc, opMul, nil) + case DIV: + program.addInstr(op, pc, opDiv, nil) + case SDIV: + program.addInstr(op, pc, opSdiv, nil) + case MOD: + program.addInstr(op, pc, opMod, nil) + case SMOD: + program.addInstr(op, pc, opSmod, nil) + case EXP: + program.addInstr(op, pc, opExp, nil) + case SIGNEXTEND: + program.addInstr(op, pc, opSignExtend, nil) + case NOT: + program.addInstr(op, pc, opNot, nil) + case LT: + program.addInstr(op, pc, opLt, nil) + case GT: + program.addInstr(op, pc, opGt, nil) + case SLT: + program.addInstr(op, pc, opSlt, nil) + case SGT: + program.addInstr(op, pc, opSgt, nil) + case EQ: + program.addInstr(op, pc, opEq, nil) + case ISZERO: + program.addInstr(op, pc, opIszero, nil) + case AND: + program.addInstr(op, pc, opAnd, nil) + case OR: + program.addInstr(op, pc, opOr, nil) + case XOR: + program.addInstr(op, pc, opXor, nil) + case BYTE: + program.addInstr(op, pc, opByte, nil) + case ADDMOD: + program.addInstr(op, pc, opAddmod, nil) + case MULMOD: + program.addInstr(op, pc, opMulmod, nil) + case SHA3: + program.addInstr(op, pc, opSha3, nil) + case ADDRESS: + program.addInstr(op, pc, opAddress, nil) + case BALANCE: + program.addInstr(op, pc, opBalance, nil) + case ORIGIN: + program.addInstr(op, pc, opOrigin, nil) + case CALLER: + program.addInstr(op, pc, opCaller, nil) + case CALLVALUE: + program.addInstr(op, pc, opCallValue, nil) + case CALLDATALOAD: + program.addInstr(op, pc, opCalldataLoad, nil) + case CALLDATASIZE: + program.addInstr(op, pc, opCalldataSize, nil) + case CALLDATACOPY: + program.addInstr(op, pc, opCalldataCopy, nil) + case CODESIZE: + program.addInstr(op, pc, opCodeSize, nil) + case EXTCODESIZE: + program.addInstr(op, pc, opExtCodeSize, nil) + case CODECOPY: + program.addInstr(op, pc, opCodeCopy, nil) + case EXTCODECOPY: + program.addInstr(op, pc, opExtCodeCopy, nil) + case GASPRICE: + program.addInstr(op, pc, opGasprice, nil) + case BLOCKHASH: + program.addInstr(op, pc, opBlockhash, nil) + case COINBASE: + program.addInstr(op, pc, opCoinbase, nil) + case TIMESTAMP: + program.addInstr(op, pc, opTimestamp, nil) + case NUMBER: + program.addInstr(op, pc, opNumber, nil) + case DIFFICULTY: + program.addInstr(op, pc, opDifficulty, nil) + case GASLIMIT: + program.addInstr(op, pc, opGasLimit, nil) + case PUSH1, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8, PUSH9, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16, PUSH17, PUSH18, PUSH19, PUSH20, PUSH21, PUSH22, PUSH23, PUSH24, PUSH25, PUSH26, PUSH27, PUSH28, PUSH29, PUSH30, PUSH31, PUSH32: + size := uint64(op - PUSH1 + 1) + bytes := getData([]byte(program.code), new(big.Int).SetUint64(pc+1), new(big.Int).SetUint64(size)) + + program.addInstr(op, pc, opPush, common.Bytes2Big(bytes)) + + pc += size + + case POP: + program.addInstr(op, pc, opPop, nil) + case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16: + program.addInstr(op, pc, opDup, big.NewInt(int64(op-DUP1+1))) + case SWAP1, SWAP2, SWAP3, SWAP4, SWAP5, SWAP6, SWAP7, SWAP8, SWAP9, SWAP10, SWAP11, SWAP12, SWAP13, SWAP14, SWAP15, SWAP16: + program.addInstr(op, pc, opSwap, big.NewInt(int64(op-SWAP1+2))) + case LOG0, LOG1, LOG2, LOG3, LOG4: + program.addInstr(op, pc, opLog, big.NewInt(int64(op-LOG0))) + case MLOAD: + program.addInstr(op, pc, opMload, nil) + case MSTORE: + program.addInstr(op, pc, opMstore, nil) + case MSTORE8: + program.addInstr(op, pc, opMstore8, nil) + case SLOAD: + program.addInstr(op, pc, opSload, nil) + case SSTORE: + program.addInstr(op, pc, opSstore, nil) + case JUMP: + program.addInstr(op, pc, opJump, nil) + case JUMPI: + program.addInstr(op, pc, opJumpi, nil) + case JUMPDEST: + program.addInstr(op, pc, opJumpdest, nil) + program.destinations[pc] = struct{}{} + case PC: + program.addInstr(op, pc, opPc, big.NewInt(int64(pc))) + case MSIZE: + program.addInstr(op, pc, opMsize, nil) + case GAS: + program.addInstr(op, pc, opGas, nil) + case CREATE: + program.addInstr(op, pc, opCreate, nil) + case CALL: + program.addInstr(op, pc, opCall, nil) + case CALLCODE: + program.addInstr(op, pc, opCallCode, nil) + case RETURN: + program.addInstr(op, pc, opReturn, nil) + case SUICIDE: + program.addInstr(op, pc, opSuicide, nil) + case STOP: // Stop the context + program.addInstr(op, pc, opStop, nil) + default: + program.addInstr(op, pc, nil, nil) + } + } + + return nil +} + +func RunProgram(program *Program, env Environment, context *Context, input []byte) ([]byte, error) { + return runProgram(program, 0, NewMemory(), newstack(), env, context, input) +} + +func runProgram(program *Program, pcstart uint64, mem *Memory, stack *stack, env Environment, context *Context, input []byte) ([]byte, error) { + context.Input = input + + var ( + caller = context.caller + statedb = env.State() + pc int = program.mapping[pcstart] + + jump = func(to *big.Int) error { + if !validDest(program.destinations, to) { + nop := context.GetOp(to.Uint64()) + return fmt.Errorf("invalid jump destination (%v) %v", nop, to) + } + + pc = program.mapping[to.Uint64()] + + return nil + } + ) + + for pc < len(program.instructions) { + instr := program.instructions[pc] + + // calculate the new memory size and gas price for the current executing opcode + newMemSize, cost, err := jitCalculateGasAndSize(env, context, caller, instr, statedb, mem, stack) + if err != nil { + return nil, err + } + + // Use the calculated gas. When insufficient gas is present, use all gas and return an + // Out Of Gas error + if !context.UseGas(cost) { + return nil, OutOfGasError + } + // Resize the memory calculated previously + mem.Resize(newMemSize.Uint64()) + + // These opcodes return an argument and are thefor handled + // differently from the rest of the opcodes + switch instr.op { + case JUMP: + if err := jump(stack.pop()); err != nil { + return nil, err + } + continue + case JUMPI: + pos, cond := stack.pop(), stack.pop() + + if cond.Cmp(common.BigTrue) >= 0 { + if err := jump(pos); err != nil { + return nil, err + } + continue + } + case RETURN: + offset, size := stack.pop(), stack.pop() + ret := mem.GetPtr(offset.Int64(), size.Int64()) + + return context.Return(ret), nil + case SUICIDE: + instr.fn(instr, env, context, mem, stack) + + return context.Return(nil), nil + case STOP: + return context.Return(nil), nil + default: + if instr.fn == nil { + return nil, fmt.Errorf("Invalid opcode %x", instr.op) + } + + instr.fn(instr, env, context, mem, stack) + } + + pc++ + } + + return context.Return(nil), nil +} + +// validDest checks if the given distination is a valid one given the +// destination table of the program +func validDest(dests map[uint64]struct{}, dest *big.Int) bool { + // PC cannot go beyond len(code) and certainly can't be bigger than 64bits. + // Don't bother checking for JUMPDEST in that case. + if dest.Cmp(bigMaxUint64) > 0 { + return false + } + _, ok := dests[dest.Uint64()] + return ok +} + +// jitCalculateGasAndSize calculates the required given the opcode and stack items calculates the new memorysize for +// the operation. This does not reduce gas or resizes the memory. +func jitCalculateGasAndSize(env Environment, context *Context, caller ContextRef, instr instruction, statedb *state.StateDB, mem *Memory, stack *stack) (*big.Int, *big.Int, error) { + var ( + gas = new(big.Int) + newMemSize *big.Int = new(big.Int) + ) + err := jitBaseCheck(instr, stack, gas) + if err != nil { + return nil, nil, err + } + + // stack Check, memory resize & gas phase + switch op := instr.op; op { + case SWAP1, SWAP2, SWAP3, SWAP4, SWAP5, SWAP6, SWAP7, SWAP8, SWAP9, SWAP10, SWAP11, SWAP12, SWAP13, SWAP14, SWAP15, SWAP16: + n := int(op - SWAP1 + 2) + err := stack.require(n) + if err != nil { + return nil, nil, err + } + gas.Set(GasFastestStep) + case DUP1, DUP2, DUP3, DUP4, DUP5, DUP6, DUP7, DUP8, DUP9, DUP10, DUP11, DUP12, DUP13, DUP14, DUP15, DUP16: + n := int(op - DUP1 + 1) + err := stack.require(n) + if err != nil { + return nil, nil, err + } + gas.Set(GasFastestStep) + case LOG0, LOG1, LOG2, LOG3, LOG4: + n := int(op - LOG0) + err := stack.require(n + 2) + if err != nil { + return nil, nil, err + } + + mSize, mStart := stack.data[stack.len()-2], stack.data[stack.len()-1] + + gas.Add(gas, params.LogGas) + gas.Add(gas, new(big.Int).Mul(big.NewInt(int64(n)), params.LogTopicGas)) + gas.Add(gas, new(big.Int).Mul(mSize, params.LogDataGas)) + + newMemSize = calcMemSize(mStart, mSize) + case EXP: + gas.Add(gas, new(big.Int).Mul(big.NewInt(int64(len(stack.data[stack.len()-2].Bytes()))), params.ExpByteGas)) + case SSTORE: + err := stack.require(2) + if err != nil { + return nil, nil, err + } + + var g *big.Int + y, x := stack.data[stack.len()-2], stack.data[stack.len()-1] + val := statedb.GetState(context.Address(), common.BigToHash(x)) + + // This checks for 3 scenario's and calculates gas accordingly + // 1. From a zero-value address to a non-zero value (NEW VALUE) + // 2. From a non-zero value address to a zero-value address (DELETE) + // 3. From a nen-zero to a non-zero (CHANGE) + if common.EmptyHash(val) && !common.EmptyHash(common.BigToHash(y)) { + // 0 => non 0 + g = params.SstoreSetGas + } else if !common.EmptyHash(val) && common.EmptyHash(common.BigToHash(y)) { + statedb.Refund(params.SstoreRefundGas) + + g = params.SstoreClearGas + } else { + // non 0 => non 0 (or 0 => 0) + g = params.SstoreClearGas + } + gas.Set(g) + case SUICIDE: + if !statedb.IsDeleted(context.Address()) { + statedb.Refund(params.SuicideRefundGas) + } + case MLOAD: + newMemSize = calcMemSize(stack.peek(), u256(32)) + case MSTORE8: + newMemSize = calcMemSize(stack.peek(), u256(1)) + case MSTORE: + newMemSize = calcMemSize(stack.peek(), u256(32)) + case RETURN: + newMemSize = calcMemSize(stack.peek(), stack.data[stack.len()-2]) + case SHA3: + newMemSize = calcMemSize(stack.peek(), stack.data[stack.len()-2]) + + words := toWordSize(stack.data[stack.len()-2]) + gas.Add(gas, words.Mul(words, params.Sha3WordGas)) + case CALLDATACOPY: + newMemSize = calcMemSize(stack.peek(), stack.data[stack.len()-3]) + + words := toWordSize(stack.data[stack.len()-3]) + gas.Add(gas, words.Mul(words, params.CopyGas)) + case CODECOPY: + newMemSize = calcMemSize(stack.peek(), stack.data[stack.len()-3]) + + words := toWordSize(stack.data[stack.len()-3]) + gas.Add(gas, words.Mul(words, params.CopyGas)) + case EXTCODECOPY: + newMemSize = calcMemSize(stack.data[stack.len()-2], stack.data[stack.len()-4]) + + words := toWordSize(stack.data[stack.len()-4]) + gas.Add(gas, words.Mul(words, params.CopyGas)) + + case CREATE: + newMemSize = calcMemSize(stack.data[stack.len()-2], stack.data[stack.len()-3]) + case CALL, CALLCODE: + gas.Add(gas, stack.data[stack.len()-1]) + + if op == CALL { + if env.State().GetStateObject(common.BigToAddress(stack.data[stack.len()-2])) == nil { + gas.Add(gas, params.CallNewAccountGas) + } + } + + if len(stack.data[stack.len()-3].Bytes()) > 0 { + gas.Add(gas, params.CallValueTransferGas) + } + + x := calcMemSize(stack.data[stack.len()-6], stack.data[stack.len()-7]) + y := calcMemSize(stack.data[stack.len()-4], stack.data[stack.len()-5]) + + newMemSize = common.BigMax(x, y) + } + + if newMemSize.Cmp(common.Big0) > 0 { + newMemSizeWords := toWordSize(newMemSize) + newMemSize.Mul(newMemSizeWords, u256(32)) + + if newMemSize.Cmp(u256(int64(mem.Len()))) > 0 { + oldSize := toWordSize(big.NewInt(int64(mem.Len()))) + pow := new(big.Int).Exp(oldSize, common.Big2, Zero) + linCoef := new(big.Int).Mul(oldSize, params.MemoryGas) + quadCoef := new(big.Int).Div(pow, params.QuadCoeffDiv) + oldTotalFee := new(big.Int).Add(linCoef, quadCoef) + + pow.Exp(newMemSizeWords, common.Big2, Zero) + linCoef = new(big.Int).Mul(newMemSizeWords, params.MemoryGas) + quadCoef = new(big.Int).Div(pow, params.QuadCoeffDiv) + newTotalFee := new(big.Int).Add(linCoef, quadCoef) + + fee := new(big.Int).Sub(newTotalFee, oldTotalFee) + gas.Add(gas, fee) + } + } + + return newMemSize, gas, nil +} + +// jitBaseCheck is the same as baseCheck except it doesn't do the look up in the +// gas table. This is done during compilation instead. +func jitBaseCheck(instr instruction, stack *stack, gas *big.Int) error { + err := stack.require(instr.spop) + if err != nil { + return err + } + + if instr.spush > 0 && stack.len()-instr.spop+instr.spush > int(params.StackLimit.Int64()) { + return fmt.Errorf("stack limit reached %d (%d)", stack.len(), params.StackLimit.Int64()) + } + + // nil on gas means no base calculation + if instr.gas == nil { + return nil + } + + gas.Add(gas, instr.gas) + + return nil +} diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go new file mode 100644 index 0000000000..70432d47b0 --- /dev/null +++ b/core/vm/jit_test.go @@ -0,0 +1,119 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . +package vm + +import ( + "math/big" + "testing" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/ethdb" +) + +const maxRun = 1000 + +type vmBench struct { + precompile bool // compile prior to executing + nojit bool // ignore jit (sets DisbaleJit = true + forcejit bool // forces the jit, precompile is ignored + + code []byte + input []byte +} + +func runVmBench(test vmBench, b *testing.B) { + db, _ := ethdb.NewMemDatabase() + sender := state.NewStateObject(common.Address{}, db) + + if test.precompile && !test.forcejit { + NewProgram(test.code) + } + env := NewEnv() + + DisableJit = test.nojit + ForceJit = test.forcejit + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + context := NewContext(sender, sender, big.NewInt(100), big.NewInt(10000), big.NewInt(0)) + context.Code = test.code + context.CodeAddr = &common.Address{} + _, err := New(env).Run(context, test.input) + if err != nil { + b.Error(err) + b.FailNow() + } + } +} + +var benchmarks = map[string]vmBench{ + "pushes": vmBench{ + false, false, false, + common.Hex2Bytes("600a600a01600a600a01600a600a01600a600a01600a600a01600a600a01600a600a01600a600a01600a600a01600a600a01"), nil, + }, +} + +func BenchmarkPushes(b *testing.B) { + runVmBench(benchmarks["pushes"], b) +} + +type Env struct { + gasLimit *big.Int + depth int +} + +func NewEnv() *Env { + return &Env{big.NewInt(10000), 0} +} + +func (self *Env) Origin() common.Address { return common.Address{} } +func (self *Env) BlockNumber() *big.Int { return big.NewInt(0) } +func (self *Env) AddStructLog(log StructLog) { +} +func (self *Env) StructLogs() []StructLog { + return nil +} + +//func (self *Env) PrevHash() []byte { return self.parent } +func (self *Env) Coinbase() common.Address { return common.Address{} } +func (self *Env) Time() uint64 { return uint64(time.Now().Unix()) } +func (self *Env) Difficulty() *big.Int { return big.NewInt(0) } +func (self *Env) State() *state.StateDB { return nil } +func (self *Env) GasLimit() *big.Int { return self.gasLimit } +func (self *Env) VmType() Type { return StdVmTy } +func (self *Env) GetHash(n uint64) common.Hash { + return common.BytesToHash(crypto.Sha3([]byte(big.NewInt(int64(n)).String()))) +} +func (self *Env) AddLog(log *state.Log) { +} +func (self *Env) Depth() int { return self.depth } +func (self *Env) SetDepth(i int) { self.depth = i } +func (self *Env) Transfer(from, to Account, amount *big.Int) error { + return nil +} +func (self *Env) Call(caller ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error) { + return nil, nil +} +func (self *Env) CallCode(caller ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error) { + return nil, nil +} +func (self *Env) Create(caller ContextRef, data []byte, gas, price, value *big.Int) ([]byte, error, ContextRef) { + return nil, nil, nil +} diff --git a/core/vm/settings.go b/core/vm/settings.go new file mode 100644 index 0000000000..9e30d3adde --- /dev/null +++ b/core/vm/settings.go @@ -0,0 +1,24 @@ +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . +package vm + +var ( + DisableJit bool // Disable the JIT VM + ForceJit bool // Force the JIT, skip byte VM + MaxProgSize int // Max cache size for JIT Programs +) + +const defaultJitMaxCache int = 64 diff --git a/core/vm/stack.go b/core/vm/stack.go index 3d669b2f20..23c1094550 100644 --- a/core/vm/stack.go +++ b/core/vm/stack.go @@ -27,32 +27,27 @@ func newstack() *stack { type stack struct { data []*big.Int - ptr int } func (st *stack) Data() []*big.Int { - return st.data[:st.ptr] + return st.data } func (st *stack) push(d *big.Int) { // NOTE push limit (1024) is checked in baseCheck - stackItem := new(big.Int).Set(d) - if len(st.data) > st.ptr { - st.data[st.ptr] = stackItem - } else { - st.data = append(st.data, stackItem) - } - st.ptr++ + //stackItem := new(big.Int).Set(d) + //st.data = append(st.data, stackItem) + st.data = append(st.data, d) } func (st *stack) pop() (ret *big.Int) { - st.ptr-- - ret = st.data[st.ptr] + ret = st.data[len(st.data)-1] + st.data = st.data[:len(st.data)-1] return } func (st *stack) len() int { - return st.ptr + return len(st.data) } func (st *stack) swap(n int) { @@ -60,7 +55,7 @@ func (st *stack) swap(n int) { } func (st *stack) dup(n int) { - st.push(st.data[st.len()-n]) + st.push(new(big.Int).Set(st.data[st.len()-n])) } func (st *stack) peek() *big.Int { diff --git a/core/vm/vm.go b/core/vm/vm.go index 21e0a46656..c292b45d1a 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -24,30 +24,19 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/params" ) // Vm implements VirtualMachine type Vm struct { env Environment - - err error - // For logging - debug bool - - BreakPoints []int64 - Stepping bool - Fn string - - Recoverable bool - - // Will be called before the vm returns - After func(*Context, error) } // New returns a new Virtual Machine func New(env Environment) *Vm { - return &Vm{env: env, debug: Debug, Recoverable: true} + return &Vm{env: env} } // Run loops and evaluates the contract's code with the given input data @@ -55,17 +44,67 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { self.env.SetDepth(self.env.Depth() + 1) defer self.env.SetDepth(self.env.Depth() - 1) + // User defer pattern to check for an error and, based on the error being nil or not, use all gas and return. + defer func() { + if err != nil { + // In case of a VM exception (known exceptions) all gas consumed (panics NOT included). + context.UseGas(context.Gas) + + ret = context.Return(nil) + } + }() + + if context.CodeAddr != nil { + if p := Precompiled[context.CodeAddr.Str()]; p != nil { + return self.RunPrecompiled(p, input, context) + } + } + + var ( + codehash = crypto.Sha3Hash(context.Code) // codehash is used when doing jump dest caching + program *Program + ) + if !DisableJit { + // Fetch program status. + // * If ready run using JIT + // * If unknown, compile in a seperate goroutine + // * If forced wait for compilation and run once done + if status := GetProgramStatus(codehash); status == progReady { + return RunProgram(GetProgram(codehash), self.env, context, input) + } else if status == progUnknown { + if ForceJit { + // Create and compile program + program = NewProgram(context.Code) + perr := CompileProgram(program) + if perr == nil { + return RunProgram(program, self.env, context, input) + } + glog.V(logger.Info).Infoln("error compiling program", err) + } else { + // create and compile the program. Compilation + // is done in a seperate goroutine + program = NewProgram(context.Code) + go func() { + err := CompileProgram(program) + if err != nil { + glog.V(logger.Info).Infoln("error compiling program", err) + return + } + }() + } + } + } + var ( caller = context.caller code = context.Code value = context.value price = context.Price - op OpCode // current opcode - codehash = crypto.Sha3Hash(code) // codehash is used when doing jump dest caching - mem = NewMemory() // bound memory - stack = newstack() // local stack - statedb = self.env.State() // current state + op OpCode // current opcode + mem = NewMemory() // bound memory + stack = newstack() // local stack + statedb = self.env.State() // current state // For optimisation reason we're using uint64 as the program counter. // It's theoretically possible to go above 2^64. The YP defines the PC to be uint256. Pratically much less so feasible. pc = uint64(0) // program counter @@ -89,32 +128,25 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { // User defer pattern to check for an error and, based on the error being nil or not, use all gas and return. defer func() { - if self.After != nil { - self.After(context, err) - } - if err != nil { self.log(pc, op, context.Gas, cost, mem, stack, context, err) - - // In case of a VM exception (known exceptions) all gas consumed (panics NOT included). - context.UseGas(context.Gas) - - ret = context.Return(nil) } }() - if context.CodeAddr != nil { - if p := Precompiled[context.CodeAddr.Str()]; p != nil { - return self.RunPrecompiled(p, input, context) - } - } - // Don't bother with the execution if there's no code. if len(code) == 0 { return context.Return(nil), nil } for { + // Overhead of the atomic read might not be worth it + /* TODO this still causes a few issues in the tests + if program != nil && progStatus(atomic.LoadInt32(&program.status)) == progReady { + // move execution + glog.V(logger.Info).Infoln("Moved execution to JIT") + return runProgram(program, pc, mem, stack, self.env, context, input) + } + */ // The base for all big integer arithmetic base := new(big.Int) @@ -122,7 +154,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { op = context.GetOp(pc) // calculate the new memory size and gas price for the current executing opcode - newMemSize, cost, err = self.calculateGasAndSize(context, caller, op, statedb, mem, stack) + newMemSize, cost, err = calculateGasAndSize(self.env, context, caller, op, statedb, mem, stack) if err != nil { return nil, err } @@ -130,11 +162,9 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { // Use the calculated gas. When insufficient gas is present, use all gas and return an // Out Of Gas error if !context.UseGas(cost) { - - context.UseGas(context.Gas) - - return context.Return(nil), OutOfGasError + return nil, OutOfGasError } + // Resize the memory calculated previously mem.Resize(newMemSize.Uint64()) // Add a log message @@ -376,7 +406,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { addr := common.BigToAddress(stack.pop()) balance := statedb.GetBalance(addr) - stack.push(balance) + stack.push(new(big.Int).Set(balance)) case ORIGIN: origin := self.env.Origin() @@ -388,7 +418,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { stack.push(common.Bytes2Big(caller.Bytes())) case CALLVALUE: - stack.push(value) + stack.push(new(big.Int).Set(value)) case CALLDATALOAD: data := getData(input, stack.pop(), common.Big32) @@ -441,7 +471,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { mem.Set(mOff.Uint64(), l.Uint64(), codeCopy) case GASPRICE: - stack.push(context.Price) + stack.push(new(big.Int).Set(context.Price)) case BLOCKHASH: num := stack.pop() @@ -471,11 +501,11 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { case DIFFICULTY: difficulty := self.env.Difficulty() - stack.push(difficulty) + stack.push(new(big.Int).Set(difficulty)) case GASLIMIT: - stack.push(self.env.GasLimit()) + stack.push(new(big.Int).Set(self.env.GasLimit())) case PUSH1, PUSH2, PUSH3, PUSH4, PUSH5, PUSH6, PUSH7, PUSH8, PUSH9, PUSH10, PUSH11, PUSH12, PUSH13, PUSH14, PUSH15, PUSH16, PUSH17, PUSH18, PUSH19, PUSH20, PUSH21, PUSH22, PUSH23, PUSH24, PUSH25, PUSH26, PUSH27, PUSH28, PUSH29, PUSH30, PUSH31, PUSH32: size := uint64(op - PUSH1 + 1) @@ -555,8 +585,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { case MSIZE: stack.push(big.NewInt(int64(mem.Len()))) case GAS: - stack.push(context.Gas) - + stack.push(new(big.Int).Set(context.Gas)) case CREATE: var ( @@ -652,7 +681,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { // calculateGasAndSize calculates the required given the opcode and stack items calculates the new memorysize for // the operation. This does not reduce gas or resizes the memory. -func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCode, statedb *state.StateDB, mem *Memory, stack *stack) (*big.Int, *big.Int, error) { +func calculateGasAndSize(env Environment, context *Context, caller ContextRef, op OpCode, statedb *state.StateDB, mem *Memory, stack *stack) (*big.Int, *big.Int, error) { var ( gas = new(big.Int) newMemSize *big.Int = new(big.Int) @@ -759,7 +788,7 @@ func (self *Vm) calculateGasAndSize(context *Context, caller ContextRef, op OpCo gas.Add(gas, stack.data[stack.len()-1]) if op == CALL { - if self.env.State().GetStateObject(common.BigToAddress(stack.data[stack.len()-2])) == nil { + if env.State().GetStateObject(common.BigToAddress(stack.data[stack.len()-2])) == nil { gas.Add(gas, params.CallNewAccountGas) } } diff --git a/tests/state_test.go b/tests/state_test.go index 1684614df2..eb1900e1b8 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -20,8 +20,25 @@ import ( "os" "path/filepath" "testing" + + "github.com/ethereum/go-ethereum/core/vm" ) +func init() { + if os.Getenv("JITVM") == "true" { + vm.ForceJit = true + } else { + vm.DisableJit = true + } +} + +func BenchmarkStateCall1024(b *testing.B) { + fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json") + if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, false}, b); err != nil { + b.Error(err) + } +} + func TestStateSystemOperations(t *testing.T) { fn := filepath.Join(stateTestDir, "stSystemOperationsTest.json") if err := RunStateTest(fn, StateSkipTests); err != nil { diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 7086de3897..695e508522 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -23,6 +23,7 @@ import ( "io" "math/big" "strconv" + "testing" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" @@ -60,6 +61,61 @@ func RunStateTest(p string, skipTests []string) error { } +func BenchStateTest(p string, conf bconf, b *testing.B) error { + tests := make(map[string]VmTest) + if err := readJsonFile(p, &tests); err != nil { + return err + } + test, ok := tests[conf.name] + if !ok { + return fmt.Errorf("test not found: %s", conf.name) + } + + pNoJit := vm.DisableJit + vm.DisableJit = conf.nojit + pForceJit := vm.ForceJit + vm.ForceJit = conf.precomp + + // XXX Yeah, yeah... + env := make(map[string]string) + env["currentCoinbase"] = test.Env.CurrentCoinbase + env["currentDifficulty"] = test.Env.CurrentDifficulty + env["currentGasLimit"] = test.Env.CurrentGasLimit + env["currentNumber"] = test.Env.CurrentNumber + env["previousHash"] = test.Env.PreviousHash + if n, ok := test.Env.CurrentTimestamp.(float64); ok { + env["currentTimestamp"] = strconv.Itoa(int(n)) + } else { + env["currentTimestamp"] = test.Env.CurrentTimestamp.(string) + } + + b.ResetTimer() + for i := 0; i < b.N; i++ { + benchStateTest(test, env, b) + } + + vm.DisableJit = pNoJit + vm.ForceJit = pForceJit + + return nil +} + +func benchStateTest(test VmTest, env map[string]string, b *testing.B) { + b.StopTimer() + db, _ := ethdb.NewMemDatabase() + statedb := state.New(common.Hash{}, db) + for addr, account := range test.Pre { + obj := StateObjectFromAccount(db, addr, account) + statedb.SetStateObject(obj) + for a, v := range account.Storage { + obj.SetState(common.HexToHash(a), common.HexToHash(v)) + } + } + b.StartTimer() + + RunState(statedb, env, test.Exec) +} + func runStateTests(tests map[string]VmTest, skipTests []string) error { skipTest := make(map[string]bool, len(skipTests)) for _, name := range skipTests { diff --git a/tests/vm_test.go b/tests/vm_test.go index 3674ed440e..6b6b179fd9 100644 --- a/tests/vm_test.go +++ b/tests/vm_test.go @@ -21,6 +21,20 @@ import ( "testing" ) +func BenchmarkVmAckermann32Tests(b *testing.B) { + fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") + if err := BenchVmTest(fn, bconf{"ackermann32", true, false}, b); err != nil { + b.Error(err) + } +} + +func BenchmarkVmFibonacci16Tests(b *testing.B) { + fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") + if err := BenchVmTest(fn, bconf{"fibonacci16", true, true}, b); err != nil { + b.Error(err) + } +} + // I've created a new function for each tests so it's easier to identify where the problem lies if any of them fail. func TestVMArithmetic(t *testing.T) { fn := filepath.Join(vmTestDir, "vmArithmeticTest.json") diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go index e63a92558d..b29dcd20f6 100644 --- a/tests/vm_test_util.go +++ b/tests/vm_test_util.go @@ -22,6 +22,7 @@ import ( "io" "math/big" "strconv" + "testing" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" @@ -48,8 +49,79 @@ func RunVmTestWithReader(r io.Reader, skipTests []string) error { return nil } -func RunVmTest(p string, skipTests []string) error { +type bconf struct { + name string + precomp bool + nojit bool +} +func BenchVmTest(p string, conf bconf, b *testing.B) error { + tests := make(map[string]VmTest) + err := readJsonFile(p, &tests) + if err != nil { + return err + } + + test, ok := tests[conf.name] + if !ok { + return fmt.Errorf("test not found: %s", conf.name) + } + + pNoJit := vm.DisableJit + vm.DisableJit = conf.nojit + pForceJit := vm.ForceJit + vm.ForceJit = conf.precomp + + env := make(map[string]string) + env["currentCoinbase"] = test.Env.CurrentCoinbase + env["currentDifficulty"] = test.Env.CurrentDifficulty + env["currentGasLimit"] = test.Env.CurrentGasLimit + env["currentNumber"] = test.Env.CurrentNumber + env["previousHash"] = test.Env.PreviousHash + if n, ok := test.Env.CurrentTimestamp.(float64); ok { + env["currentTimestamp"] = strconv.Itoa(int(n)) + } else { + env["currentTimestamp"] = test.Env.CurrentTimestamp.(string) + } + + /* + if conf.precomp { + program := vm.NewProgram(test.code) + err := vm.AttachProgram(program) + if err != nil { + return err + } + } + */ + + b.ResetTimer() + for i := 0; i < b.N; i++ { + benchVmTest(test, env, b) + } + + vm.DisableJit = pNoJit + vm.ForceJit = pForceJit + + return nil +} + +func benchVmTest(test VmTest, env map[string]string, b *testing.B) { + b.StopTimer() + db, _ := ethdb.NewMemDatabase() + statedb := state.New(common.Hash{}, db) + for addr, account := range test.Pre { + obj := StateObjectFromAccount(db, addr, account) + statedb.SetStateObject(obj) + for a, v := range account.Storage { + obj.SetState(common.HexToHash(a), common.HexToHash(v)) + } + } + b.StartTimer() + + RunVm(statedb, env, test.Exec) +} + +func RunVmTest(p string, skipTests []string) error { tests := make(map[string]VmTest) err := readJsonFile(p, &tests) if err != nil { From 184e9ae9a81df2db6381e18d3daa035d913ae341 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Sun, 2 Aug 2015 02:20:41 +0200 Subject: [PATCH 17/90] core, tests: reduced state copy by N calls Reduced the amount of state copied that are required by N calls by doing a balance check prior to any state modifications. --- cmd/evm/main.go | 3 +++ core/execution.go | 27 +++++++++++++++++---------- core/vm/environment.go | 1 + core/vm/instructions.go | 1 + core/vm/jit.go | 3 ++- core/vm/jit_test.go | 3 +++ core/vm/settings.go | 1 + core/vm_env.go | 4 ++++ tests/util.go | 14 +++++++------- 9 files changed, 39 insertions(+), 18 deletions(-) diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 7dd375b148..be6546c953 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -206,6 +206,9 @@ func (self *VMEnv) StructLogs() []vm.StructLog { func (self *VMEnv) AddLog(log *state.Log) { self.state.AddLog(log) } +func (self *VMEnv) CanTransfer(from vm.Account, balance *big.Int) bool { + return from.Balance().Cmp(balance) >= 0 +} func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { return vm.Transfer(from, to, amount) } diff --git a/core/execution.go b/core/execution.go index 699bad9a38..3a136515df 100644 --- a/core/execution.go +++ b/core/execution.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/params" ) +// Execution is the execution environment for the given call or create action. type Execution struct { env vm.Environment address *common.Address @@ -35,12 +36,15 @@ type Execution struct { Gas, price, value *big.Int } +// NewExecution returns a new execution environment that handles all calling +// and creation logic defined by the YP. func NewExecution(env vm.Environment, address *common.Address, input []byte, gas, gasPrice, value *big.Int) *Execution { exe := &Execution{env: env, address: address, input: input, Gas: gas, price: gasPrice, value: value} exe.evm = vm.NewVm(env) return exe } +// Call executes within the given context func (self *Execution) Call(codeAddr common.Address, caller vm.ContextRef) ([]byte, error) { // Retrieve the executing code code := self.env.State().GetCode(codeAddr) @@ -48,6 +52,9 @@ func (self *Execution) Call(codeAddr common.Address, caller vm.ContextRef) ([]by return self.exec(&codeAddr, code, caller) } +// Create creates a new contract and runs the initialisation procedure of the +// contract. This returns the returned code for the contract and is stored +// elsewhere. func (self *Execution) Create(caller vm.ContextRef) (ret []byte, err error, account *state.StateObject) { // Input must be nil for create code := self.input @@ -63,16 +70,24 @@ func (self *Execution) Create(caller vm.ContextRef) (ret []byte, err error, acco return } +// exec executes the given code and executes within the contextAddr context. func (self *Execution) exec(contextAddr *common.Address, code []byte, caller vm.ContextRef) (ret []byte, err error) { env := self.env evm := self.evm + // Depth check execution. Fail if we're trying to execute above the + // limit. if env.Depth() > int(params.CallCreateDepth.Int64()) { caller.ReturnGas(self.Gas, self.price) return nil, vm.DepthError } - vsnapshot := env.State().Copy() + if !env.CanTransfer(env.State().GetStateObject(caller.Address()), self.value) { + caller.ReturnGas(self.Gas, self.price) + + return nil, ValueTransferErr("insufficient funds to transfer value. Req %v, has %v", self.value, env.State().GetBalance(caller.Address())) + } + var createAccount bool if self.address == nil { // Generate a new address @@ -95,15 +110,7 @@ func (self *Execution) exec(contextAddr *common.Address, code []byte, caller vm. } else { to = env.State().GetOrNewStateObject(*self.address) } - - err = env.Transfer(from, to, self.value) - if err != nil { - env.State().Set(vsnapshot) - - caller.ReturnGas(self.Gas, self.price) - - return nil, ValueTransferErr("insufficient funds to transfer value. Req %v, has %v", self.value, from.Balance()) - } + vm.Transfer(from, to, self.value) context := vm.NewContext(caller, to, self.value, self.Gas, self.price) context.SetCallCode(contextAddr, code) diff --git a/core/vm/environment.go b/core/vm/environment.go index 723924b6fc..5a1bf32010 100644 --- a/core/vm/environment.go +++ b/core/vm/environment.go @@ -36,6 +36,7 @@ type Environment interface { Time() uint64 Difficulty() *big.Int GasLimit() *big.Int + CanTransfer(from Account, balance *big.Int) bool Transfer(from, to Account, amount *big.Int) error AddLog(*state.Log) AddStructLog(StructLog) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 7793ff1698..d7605e5a29 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -13,6 +13,7 @@ // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . + package vm import ( diff --git a/core/vm/jit.go b/core/vm/jit.go index a773092234..c66630ae83 100644 --- a/core/vm/jit.go +++ b/core/vm/jit.go @@ -13,6 +13,7 @@ // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . + package vm import ( @@ -48,7 +49,7 @@ func SetJITCacheSize(size int) { programs, _ = lru.New(size) } -// GetProgram returns the program by id or nil when non-existant +// GetProgram returns the program by id or nil when non-existent func GetProgram(id common.Hash) *Program { if p, ok := programs.Get(id); ok { return p.(*Program) diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go index 70432d47b0..5b3feea992 100644 --- a/core/vm/jit_test.go +++ b/core/vm/jit_test.go @@ -105,6 +105,9 @@ func (self *Env) AddLog(log *state.Log) { } func (self *Env) Depth() int { return self.depth } func (self *Env) SetDepth(i int) { self.depth = i } +func (self *Env) CanTransfer(from Account, balance *big.Int) bool { + return from.Balance().Cmp(balance) >= 0 +} func (self *Env) Transfer(from, to Account, amount *big.Int) error { return nil } diff --git a/core/vm/settings.go b/core/vm/settings.go index 9e30d3adde..b94efd9ab1 100644 --- a/core/vm/settings.go +++ b/core/vm/settings.go @@ -13,6 +13,7 @@ // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . + package vm var ( diff --git a/core/vm_env.go b/core/vm_env.go index c1a86d63e2..7198295437 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -69,6 +69,10 @@ func (self *VMEnv) GetHash(n uint64) common.Hash { func (self *VMEnv) AddLog(log *state.Log) { self.state.AddLog(log) } +func (self *VMEnv) CanTransfer(from vm.Account, balance *big.Int) bool { + return from.Balance().Cmp(balance) >= 0 +} + func (self *VMEnv) Transfer(from, to vm.Account, amount *big.Int) error { return vm.Transfer(from, to, amount) } diff --git a/tests/util.go b/tests/util.go index 6ee1a42db7..3b94effc8f 100644 --- a/tests/util.go +++ b/tests/util.go @@ -18,7 +18,6 @@ package tests import ( "bytes" - "errors" "fmt" "math/big" @@ -192,18 +191,19 @@ func (self *Env) AddLog(log *state.Log) { } func (self *Env) Depth() int { return self.depth } func (self *Env) SetDepth(i int) { self.depth = i } -func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error { +func (self *Env) CanTransfer(from vm.Account, balance *big.Int) bool { if self.skipTransfer { - // ugly hack if self.initial { self.initial = false - return nil + return true } + } - if from.Balance().Cmp(amount) < 0 { - return errors.New("Insufficient balance in account") - } + return from.Balance().Cmp(balance) >= 0 +} +func (self *Env) Transfer(from, to vm.Account, amount *big.Int) error { + if self.skipTransfer { return nil } return vm.Transfer(from, to, amount) From ac697326a6045eaa760b159e4bda37c57be61cbf Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 6 Aug 2015 23:06:47 +0200 Subject: [PATCH 18/90] core/vm: reduced big int allocations Reduced big int allocation by making stack items modifiable. Instead of adding items such as `common.Big0` to the stack, `new(big.Int)` is added instead. One must expect that any item that is added to the stack might change. --- core/vm/instructions.go | 171 ++++++++++++++-------------------------- core/vm/jit.go | 17 ++-- core/vm/stack.go | 11 ++- tests/vm_test.go | 2 +- 4 files changed, 78 insertions(+), 123 deletions(-) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index d7605e5a29..6b7b412209 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -46,40 +46,33 @@ func opStaticJump(instr instruction, ret *big.Int, env Environment, context *Con func opAdd(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - stack.push(U256(new(big.Int).Add(x, y))) + stack.push(U256(x.Add(x, y))) } func opSub(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - stack.push(U256(new(big.Int).Sub(x, y))) + stack.push(U256(x.Sub(x, y))) } func opMul(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - stack.push(U256(new(big.Int).Mul(x, y))) + stack.push(U256(x.Mul(x, y))) } func opDiv(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - base := new(big.Int) x, y := stack.pop(), stack.pop() - if y.Cmp(common.Big0) != 0 { - base.Div(x, y) + stack.push(U256(x.Div(x, y))) + } else { + stack.push(new(big.Int)) } - - // pop result back on the stack - stack.push(U256(base)) } func opSdiv(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - base := new(big.Int) x, y := S256(stack.pop()), S256(stack.pop()) - if y.Cmp(common.Big0) == 0 { - base.Set(common.Big0) + stack.push(new(big.Int)) + return } else { n := new(big.Int) if new(big.Int).Mul(x, y).Cmp(common.Big0) < 0 { @@ -88,35 +81,27 @@ func opSdiv(instr instruction, env Environment, context *Context, memory *Memory n.SetInt64(1) } - base.Div(x.Abs(x), y.Abs(y)).Mul(base, n) + res := x.Div(x.Abs(x), y.Abs(y)) + res.Mul(res, n) - U256(base) + stack.push(U256(res)) } - - stack.push(base) } func opMod(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - base := new(big.Int) x, y := stack.pop(), stack.pop() - if y.Cmp(common.Big0) == 0 { - base.Set(common.Big0) + stack.push(new(big.Int)) } else { - base.Mod(x, y) + stack.push(U256(x.Mod(x, y))) } - - U256(base) - - stack.push(base) } func opSmod(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - base := new(big.Int) x, y := S256(stack.pop()), S256(stack.pop()) if y.Cmp(common.Big0) == 0 { - base.Set(common.Big0) + stack.push(new(big.Int)) } else { n := new(big.Int) if x.Cmp(common.Big0) < 0 { @@ -125,23 +110,16 @@ func opSmod(instr instruction, env Environment, context *Context, memory *Memory n.SetInt64(1) } - base.Mod(x.Abs(x), y.Abs(y)).Mul(base, n) + res := x.Mod(x.Abs(x), y.Abs(y)) + res.Mul(res, n) - U256(base) + stack.push(U256(res)) } - - stack.push(base) } func opExp(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - base := new(big.Int) x, y := stack.pop(), stack.pop() - - base.Exp(x, y, Pow256) - - U256(base) - - stack.push(base) + stack.push(U256(x.Exp(x, y, Pow256))) } func opSignExtend(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { @@ -149,7 +127,7 @@ func opSignExtend(instr instruction, env Environment, context *Context, memory * if back.Cmp(big.NewInt(31)) < 0 { bit := uint(back.Uint64()*8 + 7) num := stack.pop() - mask := new(big.Int).Lsh(common.Big1, bit) + mask := back.Lsh(common.Big1, bit) mask.Sub(mask, common.Big1) if common.BitTest(num, int(bit)) { num.Or(num, mask.Not(mask)) @@ -157,145 +135,116 @@ func opSignExtend(instr instruction, env Environment, context *Context, memory * num.And(num, mask) } - num = U256(num) - - stack.push(num) + stack.push(U256(num)) } } func opNot(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(U256(new(big.Int).Not(stack.pop()))) + x := stack.pop() + stack.push(U256(x.Not(x))) } func opLt(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - // x < y if x.Cmp(y) < 0 { - stack.push(common.BigTrue) + stack.push(big.NewInt(1)) } else { - stack.push(common.BigFalse) + stack.push(new(big.Int)) } } func opGt(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - // x > y if x.Cmp(y) > 0 { - stack.push(common.BigTrue) + stack.push(big.NewInt(1)) } else { - stack.push(common.BigFalse) + stack.push(new(big.Int)) } } func opSlt(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := S256(stack.pop()), S256(stack.pop()) - - // x < y if x.Cmp(S256(y)) < 0 { - stack.push(common.BigTrue) + stack.push(big.NewInt(1)) } else { - stack.push(common.BigFalse) + stack.push(new(big.Int)) } } func opSgt(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := S256(stack.pop()), S256(stack.pop()) - - // x > y if x.Cmp(y) > 0 { - stack.push(common.BigTrue) + stack.push(big.NewInt(1)) } else { - stack.push(common.BigFalse) + stack.push(new(big.Int)) } } func opEq(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - // x == y if x.Cmp(y) == 0 { - stack.push(common.BigTrue) + stack.push(big.NewInt(1)) } else { - stack.push(common.BigFalse) + stack.push(new(big.Int)) } } func opIszero(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x := stack.pop() - if x.Cmp(common.BigFalse) > 0 { - stack.push(common.BigFalse) + if x.Cmp(common.Big0) > 0 { + stack.push(new(big.Int)) } else { - stack.push(common.BigTrue) + stack.push(big.NewInt(1)) } } func opAnd(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - stack.push(new(big.Int).And(x, y)) + stack.push(x.And(x, y)) } func opOr(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - stack.push(new(big.Int).Or(x, y)) + stack.push(x.Or(x, y)) } func opXor(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { x, y := stack.pop(), stack.pop() - - stack.push(new(big.Int).Xor(x, y)) + stack.push(x.Xor(x, y)) } func opByte(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - base := new(big.Int) th, val := stack.pop(), stack.pop() - if th.Cmp(big.NewInt(32)) < 0 { - byt := big.NewInt(int64(common.LeftPadBytes(val.Bytes(), 32)[th.Int64()])) - - base.Set(byt) + byte := big.NewInt(int64(common.LeftPadBytes(val.Bytes(), 32)[th.Int64()])) + stack.push(byte) } else { - base.Set(common.BigFalse) + stack.push(new(big.Int)) } - - stack.push(base) } func opAddmod(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - base := new(big.Int) - x := stack.pop() - y := stack.pop() - z := stack.pop() - + x, y, z := stack.pop(), stack.pop(), stack.pop() if z.Cmp(Zero) > 0 { - add := new(big.Int).Add(x, y) - base.Mod(add, z) - - base = U256(base) + add := x.Add(x, y) + add.Mod(add, z) + stack.push(U256(add)) + } else { + stack.push(new(big.Int)) } - - stack.push(base) } func opMulmod(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - base := new(big.Int) - x := stack.pop() - y := stack.pop() - z := stack.pop() - + x, y, z := stack.pop(), stack.pop(), stack.pop() if z.Cmp(Zero) > 0 { - mul := new(big.Int).Mul(x, y) - base.Mod(mul, z) - - U256(base) + mul := x.Mul(x, y) + mul.Mod(mul, z) + stack.push(U256(mul)) + } else { + stack.push(new(big.Int)) } - - stack.push(base) } func opSha3(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { offset, size := stack.pop(), stack.pop() hash := crypto.Sha3(memory.Get(offset.Int64(), size.Int64())) - stack.push(common.BigD(hash)) + stack.push(common.BytesToBig(hash)) } func opAddress(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { @@ -383,7 +332,7 @@ func opBlockhash(instr instruction, env Environment, context *Context, memory *M if num.Cmp(n) > 0 && num.Cmp(env.BlockNumber()) < 0 { stack.push(env.GetHash(num.Uint64()).Big()) } else { - stack.push(common.Big0) + stack.push(new(big.Int)) } } @@ -497,7 +446,7 @@ func opCreate(instr instruction, env Environment, context *Context, memory *Memo context.UseGas(context.Gas) ret, suberr, ref := env.Create(context, input, gas, context.Price, value) if suberr != nil { - stack.push(common.BigFalse) + stack.push(new(big.Int)) } else { // gas < len(ret) * Createinstr.dataGas == NO_CODE @@ -535,10 +484,10 @@ func opCall(instr instruction, env Environment, context *Context, memory *Memory ret, err := env.Call(context, address, args, gas, context.Price, value) if err != nil { - stack.push(common.BigFalse) + stack.push(new(big.Int)) } else { - stack.push(common.BigTrue) + stack.push(big.NewInt(1)) memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) } @@ -566,10 +515,10 @@ func opCallCode(instr instruction, env Environment, context *Context, memory *Me ret, err := env.CallCode(context, address, args, gas, context.Price, value) if err != nil { - stack.push(common.BigFalse) + stack.push(new(big.Int)) } else { - stack.push(common.BigTrue) + stack.push(big.NewInt(1)) memory.Set(retOffset.Uint64(), retSize.Uint64(), ret) } diff --git a/core/vm/jit.go b/core/vm/jit.go index c66630ae83..d5c2d78300 100644 --- a/core/vm/jit.go +++ b/core/vm/jit.go @@ -404,9 +404,10 @@ func jitCalculateGasAndSize(env Environment, context *Context, caller ContextRef mSize, mStart := stack.data[stack.len()-2], stack.data[stack.len()-1] + add := new(big.Int) gas.Add(gas, params.LogGas) - gas.Add(gas, new(big.Int).Mul(big.NewInt(int64(n)), params.LogTopicGas)) - gas.Add(gas, new(big.Int).Mul(mSize, params.LogDataGas)) + gas.Add(gas, add.Mul(big.NewInt(int64(n)), params.LogTopicGas)) + gas.Add(gas, add.Mul(mSize, params.LogDataGas)) newMemSize = calcMemSize(mStart, mSize) case EXP: @@ -496,18 +497,20 @@ func jitCalculateGasAndSize(env Environment, context *Context, caller ContextRef newMemSize.Mul(newMemSizeWords, u256(32)) if newMemSize.Cmp(u256(int64(mem.Len()))) > 0 { + // be careful reusing variables here when changing. + // The order has been optimised to reduce allocation oldSize := toWordSize(big.NewInt(int64(mem.Len()))) pow := new(big.Int).Exp(oldSize, common.Big2, Zero) - linCoef := new(big.Int).Mul(oldSize, params.MemoryGas) + linCoef := oldSize.Mul(oldSize, params.MemoryGas) quadCoef := new(big.Int).Div(pow, params.QuadCoeffDiv) oldTotalFee := new(big.Int).Add(linCoef, quadCoef) pow.Exp(newMemSizeWords, common.Big2, Zero) - linCoef = new(big.Int).Mul(newMemSizeWords, params.MemoryGas) - quadCoef = new(big.Int).Div(pow, params.QuadCoeffDiv) - newTotalFee := new(big.Int).Add(linCoef, quadCoef) + linCoef = linCoef.Mul(newMemSizeWords, params.MemoryGas) + quadCoef = quadCoef.Div(pow, params.QuadCoeffDiv) + newTotalFee := linCoef.Add(linCoef, quadCoef) - fee := new(big.Int).Sub(newTotalFee, oldTotalFee) + fee := newTotalFee.Sub(newTotalFee, oldTotalFee) gas.Add(gas, fee) } } diff --git a/core/vm/stack.go b/core/vm/stack.go index 23c1094550..009ac9e1b6 100644 --- a/core/vm/stack.go +++ b/core/vm/stack.go @@ -21,14 +21,17 @@ import ( "math/big" ) -func newstack() *stack { - return &stack{} -} - +// stack is an object for basic stack operations. Items popped to the stack are +// expected to be changed and modified. stack does not take care of adding newly +// initialised objects. type stack struct { data []*big.Int } +func newstack() *stack { + return &stack{} +} + func (st *stack) Data() []*big.Int { return st.data } diff --git a/tests/vm_test.go b/tests/vm_test.go index 6b6b179fd9..afa1424d57 100644 --- a/tests/vm_test.go +++ b/tests/vm_test.go @@ -30,7 +30,7 @@ func BenchmarkVmAckermann32Tests(b *testing.B) { func BenchmarkVmFibonacci16Tests(b *testing.B) { fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") - if err := BenchVmTest(fn, bconf{"fibonacci16", true, true}, b); err != nil { + if err := BenchVmTest(fn, bconf{"fibonacci16", true, false}, b); err != nil { b.Error(err) } } From b6c5b3b4a77eb2e725cf2e9b257fff7b2861e95e Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Fri, 7 Aug 2015 14:30:45 +0200 Subject: [PATCH 19/90] xeth: fixed contract addr check --- xeth/xeth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xeth/xeth.go b/xeth/xeth.go index 372068c148..f447a1ac35 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -894,7 +894,7 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS return "", err } - if !isAddress(toStr) { + if len(toStr) > 0 && toStr != "0x" && !isAddress(toStr) { return "", errors.New("Invalid address") } From 3ccab5a1e8c4a6c4245f62dfaf7120dc54745997 Mon Sep 17 00:00:00 2001 From: caktux Date: Fri, 7 Aug 2015 14:13:33 -0400 Subject: [PATCH 20/90] string version for build server --- cmd/geth/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index ddfa8e661f..df44397035 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -52,13 +52,13 @@ import ( const ( ClientIdentifier = "Geth " + Version = "1.0.1" VersionMajor = 1 VersionMinor = 0 VersionPatch = 1 ) var ( - Version = fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) gitCommit string // set via linker flagg nodeNameVersion string app *cli.App From a23478c0be94e1e727a64d20341b8d6f98d7f0a0 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 6 Aug 2015 19:57:39 +0200 Subject: [PATCH 21/90] core, eth, trie, xeth: merged state, chain, extra databases in one --- cmd/geth/chaincmd.go | 26 ++--- cmd/utils/flags.go | 18 ++-- core/bench_test.go | 4 +- core/block_processor.go | 16 ++- core/block_processor_test.go | 8 +- core/chain_makers.go | 6 +- core/chain_makers_test.go | 4 +- core/chain_manager.go | 48 ++++----- core/chain_manager_test.go | 18 ++-- core/genesis.go | 18 ++-- core/manager.go | 5 +- eth/backend.go | 192 ++++++++++++++++++++++------------- eth/protocol_test.go | 4 +- ethdb/database.go | 5 +- miner/worker.go | 10 +- rpc/api/debug.go | 2 +- tests/block_test_util.go | 2 +- trie/cache.go | 6 +- trie/trie.go | 2 + xeth/state.go | 2 +- xeth/xeth.go | 16 +-- 21 files changed, 224 insertions(+), 188 deletions(-) diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 2d8eb15c29..876b8c6bad 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -74,10 +74,10 @@ func importChain(ctx *cli.Context) { if len(ctx.Args()) != 1 { utils.Fatalf("This command requires an argument.") } - chain, blockDB, stateDB, extraDB := utils.MakeChain(ctx) + chain, chainDb := utils.MakeChain(ctx) start := time.Now() err := utils.ImportChain(chain, ctx.Args().First()) - closeAll(blockDB, stateDB, extraDB) + chainDb.Close() if err != nil { utils.Fatalf("Import error: %v", err) } @@ -88,7 +88,7 @@ func exportChain(ctx *cli.Context) { if len(ctx.Args()) < 1 { utils.Fatalf("This command requires an argument.") } - chain, _, _, _ := utils.MakeChain(ctx) + chain, _ := utils.MakeChain(ctx) start := time.Now() var err error @@ -136,8 +136,8 @@ func removeDB(ctx *cli.Context) { func upgradeDB(ctx *cli.Context) { glog.Infoln("Upgrading blockchain database") - chain, blockDB, stateDB, extraDB := utils.MakeChain(ctx) - v, _ := blockDB.Get([]byte("BlockchainVersion")) + chain, chainDb := utils.MakeChain(ctx) + v, _ := chainDb.Get([]byte("BlockchainVersion")) bcVersion := int(common.NewValue(v).Uint()) if bcVersion == 0 { bcVersion = core.BlockChainVersion @@ -149,15 +149,14 @@ func upgradeDB(ctx *cli.Context) { if err := utils.ExportChain(chain, exportFile); err != nil { utils.Fatalf("Unable to export chain for reimport %s", err) } - closeAll(blockDB, stateDB, extraDB) - os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "blockchain")) - os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "state")) + chainDb.Close() + os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "chaindata")) // Import the chain file. - chain, blockDB, stateDB, extraDB = utils.MakeChain(ctx) - blockDB.Put([]byte("BlockchainVersion"), common.NewValue(core.BlockChainVersion).Bytes()) + chain, chainDb = utils.MakeChain(ctx) + chainDb.Put([]byte("BlockchainVersion"), common.NewValue(core.BlockChainVersion).Bytes()) err := utils.ImportChain(chain, exportFile) - closeAll(blockDB, stateDB, extraDB) + chainDb.Close() if err != nil { utils.Fatalf("Import error %v (a backup is made in %s, use the import command to import it)", err, exportFile) } else { @@ -167,7 +166,7 @@ func upgradeDB(ctx *cli.Context) { } func dump(ctx *cli.Context) { - chain, _, stateDB, _ := utils.MakeChain(ctx) + chain, chainDb := utils.MakeChain(ctx) for _, arg := range ctx.Args() { var block *types.Block if hashish(arg) { @@ -180,10 +179,11 @@ func dump(ctx *cli.Context) { fmt.Println("{}") utils.Fatalf("block not found") } else { - state := state.New(block.Root(), stateDB) + state := state.New(block.Root(), chainDb) fmt.Printf("%s\n", state.Dump()) } } + chainDb.Close() } // hashish returns true for strings that look like hashes. diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index cf969805da..e0ea7116d1 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -435,23 +435,17 @@ func SetupLogger(ctx *cli.Context) { } // MakeChain creates a chain manager from set command line flags. -func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, extraDB common.Database) { +func MakeChain(ctx *cli.Context) (chain *core.ChainManager, chainDb common.Database) { datadir := ctx.GlobalString(DataDirFlag.Name) cache := ctx.GlobalInt(CacheFlag.Name) var err error - if blockDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "blockchain"), cache); err != nil { - Fatalf("Could not open database: %v", err) - } - if stateDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "state"), cache); err != nil { - Fatalf("Could not open database: %v", err) - } - if extraDB, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "extra"), cache); err != nil { + if chainDb, err = ethdb.NewLDBDatabase(filepath.Join(datadir, "chaindata"), cache); err != nil { Fatalf("Could not open database: %v", err) } if ctx.GlobalBool(OlympicFlag.Name) { InitOlympic() - _, err := core.WriteTestNetGenesisBlock(stateDB, blockDB, 42) + _, err := core.WriteTestNetGenesisBlock(chainDb, 42) if err != nil { glog.Fatalln(err) } @@ -460,14 +454,14 @@ func MakeChain(ctx *cli.Context) (chain *core.ChainManager, blockDB, stateDB, ex eventMux := new(event.TypeMux) pow := ethash.New() //genesis := core.GenesisBlock(uint64(ctx.GlobalInt(GenesisNonceFlag.Name)), blockDB) - chain, err = core.NewChainManager(blockDB, stateDB, extraDB, pow, eventMux) + chain, err = core.NewChainManager(chainDb, pow, eventMux) if err != nil { Fatalf("Could not start chainmanager: %v", err) } - proc := core.NewBlockProcessor(stateDB, extraDB, pow, chain, eventMux) + proc := core.NewBlockProcessor(chainDb, pow, chain, eventMux) chain.SetProcessor(proc) - return chain, blockDB, stateDB, extraDB + return chain, chainDb } // MakeChain creates an account manager from set command line flags. diff --git a/core/bench_test.go b/core/bench_test.go index 67ba15970f..baae8a7a5e 100644 --- a/core/bench_test.go +++ b/core/bench_test.go @@ -168,8 +168,8 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) { // Time the insertion of the new chain. // State and blocks are stored in the same DB. evmux := new(event.TypeMux) - chainman, _ := NewChainManager(db, db, db, FakePow{}, evmux) - chainman.SetProcessor(NewBlockProcessor(db, db, FakePow{}, chainman, evmux)) + chainman, _ := NewChainManager(db, FakePow{}, evmux) + chainman.SetProcessor(NewBlockProcessor(db, FakePow{}, chainman, evmux)) defer chainman.Stop() b.ReportAllocs() b.ResetTimer() diff --git a/core/block_processor.go b/core/block_processor.go index 5a2ad8377f..38bf772fbf 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -41,8 +41,7 @@ const ( ) type BlockProcessor struct { - db common.Database - extraDb common.Database + chainDb common.Database // Mutex for locking the block processor. Blocks can only be handled one at a time mutex sync.Mutex // Canonical block chain @@ -57,10 +56,9 @@ type BlockProcessor struct { eventMux *event.TypeMux } -func NewBlockProcessor(db, extra common.Database, pow pow.PoW, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor { +func NewBlockProcessor(db common.Database, pow pow.PoW, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor { sm := &BlockProcessor{ - db: db, - extraDb: extra, + chainDb: db, mem: make(map[string]*big.Int), Pow: pow, bc: chainManager, @@ -201,7 +199,7 @@ func (sm *BlockProcessor) Process(block *types.Block) (logs state.Logs, receipts func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (logs state.Logs, receipts types.Receipts, err error) { // Create a new state based on the parent's root (e.g., create copy) - state := state.New(parent.Root(), sm.db) + state := state.New(parent.Root(), sm.chainDb) header := block.Header() uncles := block.Uncles() txs := block.Transactions() @@ -342,7 +340,7 @@ func (sm *BlockProcessor) VerifyUncles(statedb *state.StateDB, block, parent *ty // GetBlockReceipts returns the receipts beloniging to the block hash func (sm *BlockProcessor) GetBlockReceipts(bhash common.Hash) types.Receipts { if block := sm.ChainManager().GetBlock(bhash); block != nil { - return GetBlockReceipts(sm.extraDb, block.Hash()) + return GetBlockReceipts(sm.chainDb, block.Hash()) } return nil @@ -352,7 +350,7 @@ func (sm *BlockProcessor) GetBlockReceipts(bhash common.Hash) types.Receipts { // where it tries to get it from the (updated) method which gets them from the receipts or // the depricated way by re-processing the block. func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err error) { - receipts := GetBlockReceipts(sm.extraDb, block.Hash()) + receipts := GetBlockReceipts(sm.chainDb, block.Hash()) if len(receipts) > 0 { // coalesce logs for _, receipt := range receipts { @@ -364,7 +362,7 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro // TODO: remove backward compatibility var ( parent = sm.bc.GetBlock(block.ParentHash()) - state = state.New(parent.Root(), sm.db) + state = state.New(parent.Root(), sm.chainDb) ) sm.TransitionState(state, parent, block, true) diff --git a/core/block_processor_test.go b/core/block_processor_test.go index f48ce9607f..4525f417bf 100644 --- a/core/block_processor_test.go +++ b/core/block_processor_test.go @@ -33,19 +33,19 @@ func proc() (*BlockProcessor, *ChainManager) { db, _ := ethdb.NewMemDatabase() var mux event.TypeMux - WriteTestNetGenesisBlock(db, db, 0) - chainMan, err := NewChainManager(db, db, db, thePow(), &mux) + WriteTestNetGenesisBlock(db, 0) + chainMan, err := NewChainManager(db, thePow(), &mux) if err != nil { fmt.Println(err) } - return NewBlockProcessor(db, db, ezp.New(), chainMan, &mux), chainMan + return NewBlockProcessor(db, ezp.New(), chainMan, &mux), chainMan } func TestNumber(t *testing.T) { pow := ezp.New() _, chain := proc() - statedb := state.New(chain.Genesis().Root(), chain.stateDb) + statedb := state.New(chain.Genesis().Root(), chain.chainDb) header := makeHeader(chain.Genesis(), statedb) header.Number = big.NewInt(3) err := ValidateHeader(pow, header, chain.Genesis(), false) diff --git a/core/chain_makers.go b/core/chain_makers.go index 85a6175dc9..0bb1df95a8 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -184,9 +184,9 @@ func makeHeader(parent *types.Block, state *state.StateDB) *types.Header { func newCanonical(n int, db common.Database) (*BlockProcessor, error) { evmux := &event.TypeMux{} - WriteTestNetGenesisBlock(db, db, 0) - chainman, _ := NewChainManager(db, db, db, FakePow{}, evmux) - bman := NewBlockProcessor(db, db, FakePow{}, chainman, evmux) + WriteTestNetGenesisBlock(db, 0) + chainman, _ := NewChainManager(db, FakePow{}, evmux) + bman := NewBlockProcessor(db, FakePow{}, chainman, evmux) bman.bc.SetProcessor(bman) parent := bman.bc.CurrentBlock() if n == 0 { diff --git a/core/chain_makers_test.go b/core/chain_makers_test.go index 98a585f9be..1c868624df 100644 --- a/core/chain_makers_test.go +++ b/core/chain_makers_test.go @@ -77,8 +77,8 @@ func ExampleGenerateChain() { // Import the chain. This runs all block validation rules. evmux := &event.TypeMux{} - chainman, _ := NewChainManager(db, db, db, FakePow{}, evmux) - chainman.SetProcessor(NewBlockProcessor(db, db, FakePow{}, chainman, evmux)) + chainman, _ := NewChainManager(db, FakePow{}, evmux) + chainman.SetProcessor(NewBlockProcessor(db, FakePow{}, chainman, evmux)) if i, err := chainman.InsertChain(chain); err != nil { fmt.Printf("insert error (block %d): %v\n", i, err) return diff --git a/core/chain_manager.go b/core/chain_manager.go index fc1d1304fd..87353b9446 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -56,9 +56,7 @@ const ( type ChainManager struct { //eth EthManager - blockDb common.Database - stateDb common.Database - extraDb common.Database + chainDb common.Database processor types.BlockProcessor eventMux *event.TypeMux genesisBlock *types.Block @@ -85,12 +83,10 @@ type ChainManager struct { pow pow.PoW } -func NewChainManager(blockDb, stateDb, extraDb common.Database, pow pow.PoW, mux *event.TypeMux) (*ChainManager, error) { +func NewChainManager(chainDb common.Database, pow pow.PoW, mux *event.TypeMux) (*ChainManager, error) { cache, _ := lru.New(blockCacheLimit) bc := &ChainManager{ - blockDb: blockDb, - stateDb: stateDb, - extraDb: extraDb, + chainDb: chainDb, eventMux: mux, quit: make(chan struct{}), cache: cache, @@ -103,7 +99,7 @@ func NewChainManager(blockDb, stateDb, extraDb common.Database, pow pow.PoW, mux if err != nil { return nil, err } - bc.genesisBlock, err = WriteGenesisBlock(stateDb, blockDb, reader) + bc.genesisBlock, err = WriteGenesisBlock(chainDb, reader) if err != nil { return nil, err } @@ -195,15 +191,15 @@ func (self *ChainManager) SetProcessor(proc types.BlockProcessor) { } func (self *ChainManager) State() *state.StateDB { - return state.New(self.CurrentBlock().Root(), self.stateDb) + return state.New(self.CurrentBlock().Root(), self.chainDb) } func (bc *ChainManager) recover() bool { - data, _ := bc.blockDb.Get([]byte("checkpoint")) + data, _ := bc.chainDb.Get([]byte("checkpoint")) if len(data) != 0 { block := bc.GetBlock(common.BytesToHash(data)) if block != nil { - err := bc.blockDb.Put([]byte("LastBlock"), block.Hash().Bytes()) + err := bc.chainDb.Put([]byte("LastBlock"), block.Hash().Bytes()) if err != nil { glog.Fatalln("db write err:", err) } @@ -217,7 +213,7 @@ func (bc *ChainManager) recover() bool { } func (bc *ChainManager) setLastState() error { - data, _ := bc.blockDb.Get([]byte("LastBlock")) + data, _ := bc.chainDb.Get([]byte("LastBlock")) if len(data) != 0 { block := bc.GetBlock(common.BytesToHash(data)) if block != nil { @@ -264,7 +260,7 @@ func (bc *ChainManager) Reset() { bc.cache, _ = lru.New(blockCacheLimit) // Prepare the genesis block - err := WriteBlock(bc.blockDb, bc.genesisBlock) + err := WriteBlock(bc.chainDb, bc.genesisBlock) if err != nil { glog.Fatalln("db err:", err) } @@ -277,7 +273,7 @@ func (bc *ChainManager) Reset() { } func (bc *ChainManager) removeBlock(block *types.Block) { - bc.blockDb.Delete(append(blockHashPre, block.Hash().Bytes()...)) + bc.chainDb.Delete(append(blockHashPre, block.Hash().Bytes()...)) } func (bc *ChainManager) ResetWithGenesisBlock(gb *types.Block) { @@ -292,7 +288,7 @@ func (bc *ChainManager) ResetWithGenesisBlock(gb *types.Block) { gb.Td = gb.Difficulty() bc.genesisBlock = gb - err := WriteBlock(bc.blockDb, bc.genesisBlock) + err := WriteBlock(bc.chainDb, bc.genesisBlock) if err != nil { glog.Fatalln("db err:", err) } @@ -339,14 +335,14 @@ func (self *ChainManager) ExportN(w io.Writer, first uint64, last uint64) error // insert injects a block into the current chain block chain. Note, this function // assumes that the `mu` mutex is held! func (bc *ChainManager) insert(block *types.Block) { - err := WriteHead(bc.blockDb, block) + err := WriteHead(bc.chainDb, block) if err != nil { glog.Fatal("db write fail:", err) } bc.checkpoint++ if bc.checkpoint > checkpointLimit { - err = bc.blockDb.Put([]byte("checkpoint"), block.Hash().Bytes()) + err = bc.chainDb.Put([]byte("checkpoint"), block.Hash().Bytes()) if err != nil { glog.Fatal("db write fail:", err) } @@ -369,7 +365,7 @@ func (bc *ChainManager) HasBlock(hash common.Hash) bool { return true } - data, _ := bc.blockDb.Get(append(blockHashPre, hash[:]...)) + data, _ := bc.chainDb.Get(append(blockHashPre, hash[:]...)) return len(data) != 0 } @@ -399,7 +395,7 @@ func (self *ChainManager) GetBlock(hash common.Hash) *types.Block { return block.(*types.Block) } - block := GetBlockByHash(self.blockDb, hash) + block := GetBlockByHash(self.chainDb, hash) if block == nil { return nil } @@ -433,7 +429,7 @@ func (self *ChainManager) GetBlocksFromHash(hash common.Hash, n int) (blocks []* // non blocking version func (self *ChainManager) getBlockByNumber(num uint64) *types.Block { - return GetBlockByNumber(self.blockDb, num) + return GetBlockByNumber(self.chainDb, num) } func (self *ChainManager) GetUnclesInChain(block *types.Block, length int) (uncles []*types.Header) { @@ -521,7 +517,7 @@ func (self *ChainManager) WriteBlock(block *types.Block, queued bool) (status wr status = SideStatTy } - err = WriteBlock(self.blockDb, block) + err = WriteBlock(self.chainDb, block) if err != nil { glog.Fatalln("db err:", err) } @@ -638,9 +634,9 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) { queueEvent.canonicalCount++ // This puts transactions in a extra db for rpc - PutTransactions(self.extraDb, block, block.Transactions()) + PutTransactions(self.chainDb, block, block.Transactions()) // store the receipts - PutReceipts(self.extraDb, receipts) + PutReceipts(self.chainDb, receipts) case SideStatTy: if glog.V(logger.Detail) { glog.Infof("inserted forked block #%d (TD=%v) (%d TXs %d UNCs) (%x...). Took %v\n", block.Number(), block.Difficulty(), len(block.Transactions()), len(block.Uncles()), block.Hash().Bytes()[0:4], time.Since(bstart)) @@ -651,7 +647,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) { queue[i] = ChainSplitEvent{block, logs} queueEvent.splitCount++ } - PutBlockReceipts(self.extraDb, block, receipts) + PutBlockReceipts(self.chainDb, block, receipts) stats.processed++ } @@ -733,8 +729,8 @@ func (self *ChainManager) merge(oldBlock, newBlock *types.Block) error { // insert the block in the canonical way, re-writing history self.insert(block) // write canonical receipts and transactions - PutTransactions(self.extraDb, block, block.Transactions()) - PutReceipts(self.extraDb, GetBlockReceipts(self.extraDb, block.Hash())) + PutTransactions(self.chainDb, block, block.Transactions()) + PutReceipts(self.chainDb, GetBlockReceipts(self.chainDb, block.Hash())) } self.mu.Unlock() diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index f0c097df6c..002dcbe446 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -48,14 +48,14 @@ func thePow() pow.PoW { func theChainManager(db common.Database, t *testing.T) *ChainManager { var eventMux event.TypeMux - WriteTestNetGenesisBlock(db, db, 0) - chainMan, err := NewChainManager(db, db, db, thePow(), &eventMux) + WriteTestNetGenesisBlock(db, 0) + chainMan, err := NewChainManager(db, thePow(), &eventMux) if err != nil { t.Error("failed creating chainmanager:", err) t.FailNow() return nil } - blockMan := NewBlockProcessor(db, db, nil, chainMan, &eventMux) + blockMan := NewBlockProcessor(db, nil, chainMan, &eventMux) chainMan.SetProcessor(blockMan) return chainMan @@ -125,7 +125,7 @@ func testChain(chainB types.Blocks, bman *BlockProcessor) (*big.Int, error) { bman.bc.mu.Lock() { - WriteBlock(bman.bc.blockDb, block) + WriteBlock(bman.bc.chainDb, block) } bman.bc.mu.Unlock() } @@ -387,7 +387,7 @@ func makeChainWithDiff(genesis *types.Block, d []int, seed byte) []*types.Block func chm(genesis *types.Block, db common.Database) *ChainManager { var eventMux event.TypeMux - bc := &ChainManager{extraDb: db, blockDb: db, stateDb: db, genesisBlock: genesis, eventMux: &eventMux, pow: FakePow{}} + bc := &ChainManager{chainDb: db, genesisBlock: genesis, eventMux: &eventMux, pow: FakePow{}} bc.cache, _ = lru.New(100) bc.futureBlocks, _ = lru.New(100) bc.processor = bproc{} @@ -399,7 +399,7 @@ func chm(genesis *types.Block, db common.Database) *ChainManager { func TestReorgLongest(t *testing.T) { db, _ := ethdb.NewMemDatabase() - genesis, err := WriteTestNetGenesisBlock(db, db, 0) + genesis, err := WriteTestNetGenesisBlock(db, 0) if err != nil { t.Error(err) t.FailNow() @@ -422,7 +422,7 @@ func TestReorgLongest(t *testing.T) { func TestReorgShortest(t *testing.T) { db, _ := ethdb.NewMemDatabase() - genesis, err := WriteTestNetGenesisBlock(db, db, 0) + genesis, err := WriteTestNetGenesisBlock(db, 0) if err != nil { t.Error(err) t.FailNow() @@ -446,13 +446,13 @@ func TestReorgShortest(t *testing.T) { func TestInsertNonceError(t *testing.T) { for i := 1; i < 25 && !t.Failed(); i++ { db, _ := ethdb.NewMemDatabase() - genesis, err := WriteTestNetGenesisBlock(db, db, 0) + genesis, err := WriteTestNetGenesisBlock(db, 0) if err != nil { t.Error(err) t.FailNow() } bc := chm(genesis, db) - bc.processor = NewBlockProcessor(db, db, bc.pow, bc, bc.eventMux) + bc.processor = NewBlockProcessor(db, bc.pow, bc, bc.eventMux) blocks := makeChain(bc.currentBlock, i, db, 0) fail := rand.Int() % len(blocks) diff --git a/core/genesis.go b/core/genesis.go index 4c0323c176..97afb3a4ae 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -33,7 +33,7 @@ import ( ) // WriteGenesisBlock writes the genesis block to the database as block number 0 -func WriteGenesisBlock(stateDb, blockDb common.Database, reader io.Reader) (*types.Block, error) { +func WriteGenesisBlock(chainDb common.Database, reader io.Reader) (*types.Block, error) { contents, err := ioutil.ReadAll(reader) if err != nil { return nil, err @@ -59,7 +59,7 @@ func WriteGenesisBlock(stateDb, blockDb common.Database, reader io.Reader) (*typ return nil, err } - statedb := state.New(common.Hash{}, stateDb) + statedb := state.New(common.Hash{}, chainDb) for addr, account := range genesis.Alloc { address := common.HexToAddress(addr) statedb.AddBalance(address, common.String2Big(account.Balance)) @@ -84,9 +84,9 @@ func WriteGenesisBlock(stateDb, blockDb common.Database, reader io.Reader) (*typ }, nil, nil, nil) block.Td = difficulty - if block := GetBlockByHash(blockDb, block.Hash()); block != nil { + if block := GetBlockByHash(chainDb, block.Hash()); block != nil { glog.V(logger.Info).Infoln("Genesis block already in chain. Writing canonical number") - err := WriteCanonNumber(blockDb, block) + err := WriteCanonNumber(chainDb, block) if err != nil { return nil, err } @@ -95,11 +95,11 @@ func WriteGenesisBlock(stateDb, blockDb common.Database, reader io.Reader) (*typ statedb.Sync() - err = WriteBlock(blockDb, block) + err = WriteBlock(chainDb, block) if err != nil { return nil, err } - err = WriteHead(blockDb, block) + err = WriteHead(chainDb, block) if err != nil { return nil, err } @@ -133,11 +133,11 @@ func WriteGenesisBlockForTesting(db common.Database, addr common.Address, balanc "0x%x":{"balance":"0x%x"} } }`, types.EncodeNonce(0), params.GenesisGasLimit.Bytes(), params.GenesisDifficulty.Bytes(), addr, balance.Bytes()) - block, _ := WriteGenesisBlock(db, db, strings.NewReader(testGenesis)) + block, _ := WriteGenesisBlock(db, strings.NewReader(testGenesis)) return block } -func WriteTestNetGenesisBlock(stateDb, blockDb common.Database, nonce uint64) (*types.Block, error) { +func WriteTestNetGenesisBlock(chainDb common.Database, nonce uint64) (*types.Block, error) { testGenesis := fmt.Sprintf(`{ "nonce":"0x%x", "gasLimit":"0x%x", @@ -157,5 +157,5 @@ func WriteTestNetGenesisBlock(stateDb, blockDb common.Database, nonce uint64) (* "1a26338f0d905e295fccb71fa9ea849ffa12aaf4": {"balance": "1606938044258990275541962092341162602522202993782792835301376"} } }`, types.EncodeNonce(nonce), params.GenesisGasLimit.Bytes(), params.GenesisDifficulty.Bytes()) - return WriteGenesisBlock(stateDb, blockDb, strings.NewReader(testGenesis)) + return WriteGenesisBlock(chainDb, strings.NewReader(testGenesis)) } diff --git a/core/manager.go b/core/manager.go index a07c326592..8b0401b031 100644 --- a/core/manager.go +++ b/core/manager.go @@ -28,8 +28,7 @@ type Backend interface { BlockProcessor() *BlockProcessor ChainManager() *ChainManager TxPool() *TxPool - BlockDb() common.Database - StateDb() common.Database - ExtraDb() common.Database + ChainDb() common.Database + DappDb() common.Database EventMux() *event.TypeMux } diff --git a/eth/backend.go b/eth/backend.go index ed46a4ab36..c9b71803fb 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -45,6 +45,7 @@ import ( "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/nat" + "github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/whisper" ) @@ -206,9 +207,8 @@ type Ethereum struct { shutdownChan chan bool // DB interfaces - blockDb common.Database // Block chain database - stateDb common.Database // State changes database - extraDb common.Database // Extra database (txs, etc) + chainDb common.Database // Block chain databe + dappDb common.Database // Dapp database // Closed when databases are flushed and closed databasesClosed chan bool @@ -266,27 +266,27 @@ func New(config *Config) (*Ethereum, error) { if newdb == nil { newdb = func(path string) (common.Database, error) { return ethdb.NewLDBDatabase(path, config.DatabaseCache) } } - blockDb, err := newdb(filepath.Join(config.DataDir, "blockchain")) + + // attempt to merge database together, upgrading from an old version + if err := mergeDatabases(config.DataDir, newdb); err != nil { + return nil, err + } + + chainDb, err := newdb(filepath.Join(config.DataDir, "chaindata")) if err != nil { return nil, fmt.Errorf("blockchain db err: %v", err) } - if db, ok := blockDb.(*ethdb.LDBDatabase); ok { - db.Meter("eth/db/block/") + if db, ok := chainDb.(*ethdb.LDBDatabase); ok { + db.Meter("eth/db/chaindata/") } - stateDb, err := newdb(filepath.Join(config.DataDir, "state")) + dappDb, err := newdb(filepath.Join(config.DataDir, "dapp")) if err != nil { - return nil, fmt.Errorf("state db err: %v", err) + return nil, fmt.Errorf("dapp db err: %v", err) } - if db, ok := stateDb.(*ethdb.LDBDatabase); ok { - db.Meter("eth/db/state/") - } - extraDb, err := newdb(filepath.Join(config.DataDir, "extra")) - if err != nil { - return nil, fmt.Errorf("extra db err: %v", err) - } - if db, ok := extraDb.(*ethdb.LDBDatabase); ok { - db.Meter("eth/db/extra/") + if db, ok := dappDb.(*ethdb.LDBDatabase); ok { + db.Meter("eth/db/dapp/") } + nodeDb := filepath.Join(config.DataDir, "nodes") glog.V(logger.Info).Infof("Protocol Versions: %v, Network Id: %v", ProtocolVersions, config.NetworkId) @@ -296,7 +296,7 @@ func New(config *Config) (*Ethereum, error) { return nil, err } - block, err := core.WriteGenesisBlock(stateDb, blockDb, fr) + block, err := core.WriteGenesisBlock(chainDb, fr) if err != nil { return nil, err } @@ -304,7 +304,7 @@ func New(config *Config) (*Ethereum, error) { } if config.Olympic { - _, err := core.WriteTestNetGenesisBlock(stateDb, blockDb, 42) + _, err := core.WriteTestNetGenesisBlock(chainDb, 42) if err != nil { return nil, err } @@ -313,26 +313,25 @@ func New(config *Config) (*Ethereum, error) { // This is for testing only. if config.GenesisBlock != nil { - core.WriteBlock(blockDb, config.GenesisBlock) - core.WriteHead(blockDb, config.GenesisBlock) + core.WriteBlock(chainDb, config.GenesisBlock) + core.WriteHead(chainDb, config.GenesisBlock) } if !config.SkipBcVersionCheck { - b, _ := blockDb.Get([]byte("BlockchainVersion")) + b, _ := chainDb.Get([]byte("BlockchainVersion")) bcVersion := int(common.NewValue(b).Uint()) if bcVersion != config.BlockChainVersion && bcVersion != 0 { return nil, fmt.Errorf("Blockchain DB version mismatch (%d / %d). Run geth upgradedb.\n", bcVersion, config.BlockChainVersion) } - saveBlockchainVersion(blockDb, config.BlockChainVersion) + saveBlockchainVersion(chainDb, config.BlockChainVersion) } glog.V(logger.Info).Infof("Blockchain DB Version: %d", config.BlockChainVersion) eth := &Ethereum{ shutdownChan: make(chan bool), databasesClosed: make(chan bool), - blockDb: blockDb, - stateDb: stateDb, - extraDb: extraDb, + chainDb: chainDb, + dappDb: dappDb, eventMux: &event.TypeMux{}, accountManager: config.AccountManager, DataDir: config.DataDir, @@ -362,7 +361,7 @@ func New(config *Config) (*Ethereum, error) { eth.pow = ethash.New() } //genesis := core.GenesisBlock(uint64(config.GenesisNonce), stateDb) - eth.chainManager, err = core.NewChainManager(blockDb, stateDb, extraDb, eth.pow, eth.EventMux()) + eth.chainManager, err = core.NewChainManager(chainDb, eth.pow, eth.EventMux()) if err != nil { if err == core.ErrNoGenesis { return nil, fmt.Errorf(`Genesis block not found. Please supply a genesis block with the "--genesis /path/to/file" argument`) @@ -372,7 +371,7 @@ func New(config *Config) (*Ethereum, error) { } eth.txPool = core.NewTxPool(eth.EventMux(), eth.chainManager.State, eth.chainManager.GasLimit) - eth.blockProcessor = core.NewBlockProcessor(stateDb, extraDb, eth.pow, eth.chainManager, eth.EventMux()) + eth.blockProcessor = core.NewBlockProcessor(chainDb, eth.pow, eth.chainManager, eth.EventMux()) eth.chainManager.SetProcessor(eth.blockProcessor) eth.protocolManager = NewProtocolManager(config.NetworkId, eth.eventMux, eth.txPool, eth.pow, eth.chainManager) @@ -520,9 +519,8 @@ func (s *Ethereum) BlockProcessor() *core.BlockProcessor { return s.blockProcess func (s *Ethereum) TxPool() *core.TxPool { return s.txPool } func (s *Ethereum) Whisper() *whisper.Whisper { return s.whisper } func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux } -func (s *Ethereum) BlockDb() common.Database { return s.blockDb } -func (s *Ethereum) StateDb() common.Database { return s.stateDb } -func (s *Ethereum) ExtraDb() common.Database { return s.extraDb } +func (s *Ethereum) ChainDb() common.Database { return s.chainDb } +func (s *Ethereum) DappDb() common.Database { return s.dappDb } func (s *Ethereum) IsListening() bool { return true } // Always listening func (s *Ethereum) PeerCount() int { return s.net.PeerCount() } func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() } @@ -569,23 +567,19 @@ done: select { case <-ticker.C: // don't change the order of database flushes - if err := s.extraDb.Flush(); err != nil { - glog.Fatalf("fatal error: flush extraDb: %v (Restart your node. We are aware of this issue)\n", err) + if err := s.dappDb.Flush(); err != nil { + glog.Fatalf("fatal error: flush dappDb: %v (Restart your node. We are aware of this issue)\n", err) } - if err := s.stateDb.Flush(); err != nil { - glog.Fatalf("fatal error: flush stateDb: %v (Restart your node. We are aware of this issue)\n", err) - } - if err := s.blockDb.Flush(); err != nil { - glog.Fatalf("fatal error: flush blockDb: %v (Restart your node. We are aware of this issue)\n", err) + if err := s.chainDb.Flush(); err != nil { + glog.Fatalf("fatal error: flush chainDb: %v (Restart your node. We are aware of this issue)\n", err) } case <-s.shutdownChan: break done } } - s.blockDb.Close() - s.stateDb.Close() - s.extraDb.Close() + s.chainDb.Close() + s.dappDb.Close() close(s.databasesClosed) } @@ -683,14 +677,6 @@ func (self *Ethereum) StartAutoDAG() { }() } -// dagFiles(epoch) returns the two alternative DAG filenames (not a path) -// 1) - 2) full-R- -func dagFiles(epoch uint64) (string, string) { - seedHash, _ := ethash.GetSeedHash(epoch * epochLength) - dag := fmt.Sprintf("full-R%d-%x", ethashRevision, seedHash[:8]) - return dag, "full-R" + dag -} - // stopAutoDAG stops automatic DAG pregeneration by quitting the loop func (self *Ethereum) StopAutoDAG() { if self.autodagquit != nil { @@ -700,30 +686,6 @@ func (self *Ethereum) StopAutoDAG() { glog.V(logger.Info).Infof("Automatic pregeneration of ethash DAG OFF (ethash dir: %s)", ethash.DefaultDir) } -/* - // The databases were previously tied to protocol versions. Currently we - // are moving away from this decision as approaching Frontier. The below - // code was left in for now but should eventually be just dropped. - - func saveProtocolVersion(db common.Database, protov int) { - d, _ := db.Get([]byte("ProtocolVersion")) - protocolVersion := common.NewValue(d).Uint() - - if protocolVersion == 0 { - db.Put([]byte("ProtocolVersion"), common.NewValue(protov).Bytes()) - } - } -*/ - -func saveBlockchainVersion(db common.Database, bcVersion int) { - d, _ := db.Get([]byte("BlockchainVersion")) - blockchainVersion := common.NewValue(d).Uint() - - if blockchainVersion == 0 { - db.Put([]byte("BlockchainVersion"), common.NewValue(bcVersion).Bytes()) - } -} - func (self *Ethereum) Solc() (*compiler.Solidity, error) { var err error if self.solc == nil { @@ -738,3 +700,87 @@ func (self *Ethereum) SetSolc(solcPath string) (*compiler.Solidity, error) { self.solc = nil return self.Solc() } + +// dagFiles(epoch) returns the two alternative DAG filenames (not a path) +// 1) - 2) full-R- +func dagFiles(epoch uint64) (string, string) { + seedHash, _ := ethash.GetSeedHash(epoch * epochLength) + dag := fmt.Sprintf("full-R%d-%x", ethashRevision, seedHash[:8]) + return dag, "full-R" + dag +} + +func saveBlockchainVersion(db common.Database, bcVersion int) { + d, _ := db.Get([]byte("BlockchainVersion")) + blockchainVersion := common.NewValue(d).Uint() + + if blockchainVersion == 0 { + db.Put([]byte("BlockchainVersion"), common.NewValue(bcVersion).Bytes()) + } +} + +// mergeDatabases when required merge old database layout to one single database +func mergeDatabases(datadir string, newdb func(path string) (common.Database, error)) error { + // Check if already upgraded + data := filepath.Join(datadir, "chaindata") + if _, err := os.Stat(data); !os.IsNotExist(err) { + return nil + } + // make sure it's not just a clean path + chainPath := filepath.Join(datadir, "blockchain") + if _, err := os.Stat(chainPath); os.IsNotExist(err) { + return nil + } + glog.Infoln("Database upgrade required. Upgrading...") + + database, err := newdb(data) + if err != nil { + return fmt.Errorf("creating data db err: %v", err) + } + defer database.Close() + + glog.Infoln("Merging blockchain database...") + chainDb, err := newdb(chainPath) + if err != nil { + return fmt.Errorf("state db err: %v", err) + } + defer chainDb.Close() + + if db, ok := chainDb.(*ethdb.LDBDatabase); ok { + it := db.NewIterator() + for it.Next() { + database.Put(it.Key(), it.Value()) + } + } + + glog.Infoln("Merging state database...") + state := filepath.Join(datadir, "state") + stateDb, err := newdb(state) + if err != nil { + return fmt.Errorf("state db err: %v", err) + } + defer stateDb.Close() + + if db, ok := chainDb.(*ethdb.LDBDatabase); ok { + it := db.NewIterator() + for it.Next() { + database.Put(append(trie.StatePre, it.Key()...), it.Value()) + } + } + + glog.Infoln("Merging transaction database...") + extra := filepath.Join(datadir, "extra") + extraDb, err := newdb(extra) + if err != nil { + return fmt.Errorf("state db err: %v", err) + } + defer extraDb.Close() + + if db, ok := chainDb.(*ethdb.LDBDatabase); ok { + it := db.NewIterator() + for it.Next() { + database.Put(it.Key(), it.Value()) + } + } + + return nil +} diff --git a/eth/protocol_test.go b/eth/protocol_test.go index a24d98f696..08c9b6a063 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -179,10 +179,10 @@ type testPeer struct { func newProtocolManagerForTesting(txAdded chan<- []*types.Transaction) *ProtocolManager { db, _ := ethdb.NewMemDatabase() - core.WriteTestNetGenesisBlock(db, db, 0) + core.WriteTestNetGenesisBlock(db, 0) var ( em = new(event.TypeMux) - chain, _ = core.NewChainManager(db, db, db, core.FakePow{}, em) + chain, _ = core.NewChainManager(db, core.FakePow{}, em) txpool = &fakeTxPool{added: txAdded} pm = NewProtocolManager(NetworkId, em, txpool, core.FakePow{}, chain) ) diff --git a/ethdb/database.go b/ethdb/database.go index ace56c6c74..9e80e54091 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -39,9 +39,8 @@ var OpenFileLimit = 64 // cacheRatio specifies how the total alloted cache is distributed between the // various system databases. var cacheRatio = map[string]float64{ - "blockchain": 1.0 / 13.0, - "extra": 2.0 / 13.0, - "state": 10.0 / 13.0, + "dapp": 2.0 / 13.0, + "chaindata": 11.0 / 13.0, } type LDBDatabase struct { diff --git a/miner/worker.go b/miner/worker.go index 535ce51447..df3681470d 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -100,7 +100,7 @@ type worker struct { eth core.Backend chain *core.ChainManager proc *core.BlockProcessor - extraDb common.Database + chainDb common.Database coinbase common.Address gasPrice *big.Int @@ -126,7 +126,7 @@ func newWorker(coinbase common.Address, eth core.Backend) *worker { worker := &worker{ eth: eth, mux: eth.EventMux(), - extraDb: eth.ExtraDb(), + chainDb: eth.ChainDb(), recv: make(chan *Result, resultQueueSize), gasPrice: new(big.Int), chain: eth.ChainManager(), @@ -291,9 +291,9 @@ func (self *worker) wait() { // check if canon block and write transactions if stat == core.CanonStatTy { // This puts transactions in a extra db for rpc - core.PutTransactions(self.extraDb, block, block.Transactions()) + core.PutTransactions(self.chainDb, block, block.Transactions()) // store the receipts - core.PutReceipts(self.extraDb, work.receipts) + core.PutReceipts(self.chainDb, work.receipts) } // broadcast before waiting for validation @@ -344,7 +344,7 @@ func (self *worker) push(work *Work) { // makeCurrent creates a new environment for the current cycle. func (self *worker) makeCurrent(parent *types.Block, header *types.Header) { - state := state.New(parent.Root(), self.eth.StateDb()) + state := state.New(parent.Root(), self.eth.ChainDb()) work := &Work{ state: state, ancestors: set.New(), diff --git a/rpc/api/debug.go b/rpc/api/debug.go index cdacd6c62e..d325b17209 100644 --- a/rpc/api/debug.go +++ b/rpc/api/debug.go @@ -119,7 +119,7 @@ func (self *debugApi) DumpBlock(req *shared.Request) (interface{}, error) { return nil, fmt.Errorf("block #%d not found", args.BlockNumber) } - stateDb := state.New(block.Root(), self.ethereum.StateDb()) + stateDb := state.New(block.Root(), self.ethereum.ChainDb()) if stateDb == nil { return nil, nil } diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 42e4383d1c..8cb7b78825 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -204,7 +204,7 @@ func (test *BlockTest) makeEthConfig() *eth.Config { // InsertPreState populates the given database with the genesis // accounts defined by the test. func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, error) { - db := ethereum.StateDb() + db := ethereum.ChainDb() statedb := state.New(common.Hash{}, db) for addrString, acct := range t.preAccounts { addr, err := hex.DecodeString(addrString) diff --git a/trie/cache.go b/trie/cache.go index 2705b0e450..99d8033a6d 100644 --- a/trie/cache.go +++ b/trie/cache.go @@ -38,6 +38,8 @@ func NewCache(backend Backend) *Cache { } func (self *Cache) Get(key []byte) []byte { + key = append(StatePre, key...) + data := self.store[string(key)] if data == nil { data, _ = self.backend.Get(key) @@ -47,8 +49,8 @@ func (self *Cache) Get(key []byte) []byte { } func (self *Cache) Put(key []byte, data []byte) { - // write the data to the ldb batch - //self.batch.Put(key, rle.Compress(data)) + key = append(StatePre, key...) + self.batch.Put(key, data) self.store[string(key)] = data } diff --git a/trie/trie.go b/trie/trie.go index abf48a8509..2970bc185e 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -27,6 +27,8 @@ import ( "github.com/ethereum/go-ethereum/crypto" ) +var StatePre = []byte("state-") + func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) { t2 := New(nil, backend) diff --git a/xeth/state.go b/xeth/state.go index 16bfb523d2..981fe63b7e 100644 --- a/xeth/state.go +++ b/xeth/state.go @@ -45,7 +45,7 @@ func (self *State) SafeGet(addr string) *Object { func (self *State) safeGet(addr string) *state.StateObject { object := self.state.GetStateObject(common.HexToAddress(addr)) if object == nil { - object = state.NewStateObject(common.HexToAddress(addr), self.xeth.backend.StateDb()) + object = state.NewStateObject(common.HexToAddress(addr), self.xeth.backend.ChainDb()) } return object diff --git a/xeth/xeth.go b/xeth/xeth.go index 372068c148..b80b621551 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -213,9 +213,9 @@ func (self *XEth) AtStateNum(num int64) *XEth { st = self.backend.Miner().PendingState().Copy() default: if block := self.getBlockByHeight(num); block != nil { - st = state.New(block.Root(), self.backend.StateDb()) + st = state.New(block.Root(), self.backend.ChainDb()) } else { - st = state.New(self.backend.ChainManager().GetBlockByNumber(0).Root(), self.backend.StateDb()) + st = state.New(self.backend.ChainManager().GetBlockByNumber(0).Root(), self.backend.ChainDb()) } } @@ -259,7 +259,7 @@ func (self *XEth) UpdateState() (wait chan *big.Int) { wait <- n n = nil } - statedb := state.New(ev.Block.Root(), self.backend.StateDb()) + statedb := state.New(ev.Block.Root(), self.backend.ChainDb()) self.state = NewState(self, statedb) } case n, ok = <-wait: @@ -311,7 +311,7 @@ func (self *XEth) EthBlockByHash(strHash string) *types.Block { func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blhash common.Hash, blnum *big.Int, txi uint64) { // Due to increasing return params and need to determine if this is from transaction pool or // some chain, this probably needs to be refactored for more expressiveness - data, _ := self.backend.ExtraDb().Get(common.FromHex(hash)) + data, _ := self.backend.ChainDb().Get(common.FromHex(hash)) if len(data) != 0 { dtx := new(types.Transaction) if err := rlp.DecodeBytes(data, dtx); err != nil { @@ -330,7 +330,7 @@ func (self *XEth) EthTransactionByHash(hash string) (tx *types.Transaction, blha Index uint64 } - v, dberr := self.backend.ExtraDb().Get(append(common.FromHex(hash), 0x0001)) + v, dberr := self.backend.ChainDb().Get(append(common.FromHex(hash), 0x0001)) // TODO check specifically for ErrNotFound if dberr != nil { return @@ -365,7 +365,7 @@ func (self *XEth) GetBlockReceipts(bhash common.Hash) types.Receipts { } func (self *XEth) GetTxReceipt(txhash common.Hash) *types.Receipt { - return core.GetReceipt(self.backend.ExtraDb(), txhash) + return core.GetReceipt(self.backend.ChainDb(), txhash) } func (self *XEth) GasLimit() *big.Int { @@ -408,13 +408,13 @@ func (self *XEth) SetSolc(solcPath string) (*compiler.Solidity, error) { // store DApp value in extra database func (self *XEth) DbPut(key, val []byte) bool { - self.backend.ExtraDb().Put(append(dappStorePre, key...), val) + self.backend.DappDb().Put(append(dappStorePre, key...), val) return true } // retrieve DApp value from extra database func (self *XEth) DbGet(key []byte) ([]byte, error) { - val, err := self.backend.ExtraDb().Get(append(dappStorePre, key...)) + val, err := self.backend.DappDb().Get(append(dappStorePre, key...)) return val, err } From eec38c5853526f0cf8df0ccbd8e13f0a6c76a04a Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Sun, 9 Aug 2015 02:06:16 +0200 Subject: [PATCH 22/90] cmd/geth, core/vm: setup vm settings and defaulted JIT disabled --- cmd/geth/main.go | 1 + core/vm/settings.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 0e73822f37..895e55b44d 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -336,6 +336,7 @@ JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Conso } app.Before = func(ctx *cli.Context) error { utils.SetupLogger(ctx) + utils.SetupVM(ctx) if ctx.GlobalBool(utils.PProfEanbledFlag.Name) { utils.StartPProf(ctx) } diff --git a/core/vm/settings.go b/core/vm/settings.go index b94efd9ab1..0cd931b6ae 100644 --- a/core/vm/settings.go +++ b/core/vm/settings.go @@ -17,9 +17,9 @@ package vm var ( - DisableJit bool // Disable the JIT VM - ForceJit bool // Force the JIT, skip byte VM - MaxProgSize int // Max cache size for JIT Programs + DisableJit bool = true // Disable the JIT VM + ForceJit bool // Force the JIT, skip byte VM + MaxProgSize int // Max cache size for JIT Programs ) const defaultJitMaxCache int = 64 From 32395ddb891f3a32bc1295296a0887ed9479eeb0 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 11 Aug 2015 00:16:38 +0200 Subject: [PATCH 23/90] core/vm: fixed jit error & added inline docs opNumber did not create a new big int which could lead to the block's number being modified. --- core/vm/instructions.go | 19 ++++++++----------- core/vm/jit.go | 6 ++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 6b7b412209..2de35a4430 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -341,19 +341,19 @@ func opCoinbase(instr instruction, env Environment, context *Context, memory *Me } func opTimestamp(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(new(big.Int).SetUint64(env.Time())) + stack.push(U256(new(big.Int).SetUint64(env.Time()))) } func opNumber(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(U256(env.BlockNumber())) + stack.push(U256(new(big.Int).Set(env.BlockNumber()))) } func opDifficulty(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(new(big.Int).Set(env.Difficulty())) + stack.push(U256(new(big.Int).Set(env.Difficulty()))) } func opGasLimit(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(new(big.Int).Set(env.GasLimit())) + stack.push(U256(new(big.Int).Set(env.GasLimit()))) } func opPop(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { @@ -415,15 +415,12 @@ func opSstore(instr instruction, env Environment, context *Context, memory *Memo env.State().SetState(context.Address(), loc, common.BigToHash(val)) } -func opJump(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { -} -func opJumpi(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { -} -func opJumpdest(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { -} +func opJump(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {} +func opJumpi(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {} +func opJumpdest(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) {} func opPc(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(instr.data) + stack.push(new(big.Int).Set(instr.data)) } func opMsize(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { diff --git a/core/vm/jit.go b/core/vm/jit.go index d5c2d78300..084d2a3f33 100644 --- a/core/vm/jit.go +++ b/core/vm/jit.go @@ -83,6 +83,7 @@ type Program struct { code []byte } +// NewProgram returns a new JIT program func NewProgram(code []byte) *Program { program := &Program{ Id: crypto.Sha3Hash(code), @@ -113,6 +114,7 @@ func (p *Program) addInstr(op OpCode, pc uint64, fn instrFn, data *big.Int) { p.mapping[pc] = len(p.instructions) - 1 } +// CompileProgram compiles the given program and return an error when it fails func CompileProgram(program *Program) (err error) { if progStatus(atomic.LoadInt32(&program.status)) == progCompile { return nil @@ -272,6 +274,8 @@ func CompileProgram(program *Program) (err error) { return nil } +// RunProgram runs the program given the enviroment and context and returns an +// error if the execution failed (non-consensus) func RunProgram(program *Program, env Environment, context *Context, input []byte) ([]byte, error) { return runProgram(program, 0, NewMemory(), newstack(), env, context, input) } @@ -352,6 +356,8 @@ func runProgram(program *Program, pcstart uint64, mem *Memory, stack *stack, env pc++ } + context.Input = nil + return context.Return(nil), nil } From 01ed3fa1a9414328eb6c4fc839e1b2044a786a7a Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 7 Aug 2015 00:10:26 +0200 Subject: [PATCH 24/90] p2p/discover: unlock the table during ping replacement Table.mutex was being held while waiting for a reply packet, which effectively made many parts of the whole stack block on that packet, including the net_peerCount RPC call. --- p2p/discover/table.go | 121 ++++++++++++++++++++++--------------- p2p/discover/table_test.go | 6 +- p2p/discover/udp_test.go | 2 +- 3 files changed, 77 insertions(+), 52 deletions(-) diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 67f7ec46fb..b077f010c7 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -78,9 +78,8 @@ type transport interface { close() } -// bucket contains nodes, ordered by their last activity. -// the entry that was most recently active is the last element -// in entries. +// bucket contains nodes, ordered by their last activity. the entry +// that was most recently active is the first element in entries. type bucket struct { lastLookup time.Time entries []*Node @@ -235,7 +234,7 @@ func (tab *Table) Lookup(targetID NodeID) []*Node { if fails >= maxFindnodeFailures { glog.V(logger.Detail).Infof("Evacuating node %x: %d findnode failures", n.ID[:8], fails) - tab.del(n) + tab.delete(n) } } reply <- tab.bondall(r) @@ -401,15 +400,11 @@ func (tab *Table) bond(pinged bool, id NodeID, addr *net.UDPAddr, tcpPort uint16 node = w.n } } - // Even if bonding temporarily failed, give the node a chance if node != nil { - tab.mutex.Lock() - defer tab.mutex.Unlock() - - b := tab.buckets[logdist(tab.self.sha, node.sha)] - if !b.bump(node) { - tab.pingreplace(node, b) - } + // Add the node to the table even if the bonding ping/pong + // fails. It will be relaced quickly if it continues to be + // unresponsive. + tab.add(node) tab.db.updateFindFails(id, 0) } return node, result @@ -420,7 +415,7 @@ func (tab *Table) pingpong(w *bondproc, pinged bool, id NodeID, addr *net.UDPAdd <-tab.bondslots defer func() { tab.bondslots <- struct{}{} }() - // Ping the remote side and wait for a pong + // Ping the remote side and wait for a pong. if w.err = tab.ping(id, addr); w.err != nil { close(w.done) return @@ -431,33 +426,14 @@ func (tab *Table) pingpong(w *bondproc, pinged bool, id NodeID, addr *net.UDPAdd // waitping will simply time out. tab.net.waitping(id) } - // Bonding succeeded, update the node database + // Bonding succeeded, update the node database. w.n = newNode(id, addr.IP, uint16(addr.Port), tcpPort) tab.db.updateNode(w.n) close(w.done) } -func (tab *Table) pingreplace(new *Node, b *bucket) { - if len(b.entries) == bucketSize { - oldest := b.entries[bucketSize-1] - if err := tab.ping(oldest.ID, oldest.addr()); err == nil { - // The node responded, we don't need to replace it. - return - } - } else { - // Add a slot at the end so the last entry doesn't - // fall off when adding the new node. - b.entries = append(b.entries, nil) - } - copy(b.entries[1:], b.entries) - b.entries[0] = new - if tab.nodeAddedHook != nil { - tab.nodeAddedHook(new) - } -} - -// ping a remote endpoint and wait for a reply, also updating the node database -// accordingly. +// ping a remote endpoint and wait for a reply, also updating the node +// database accordingly. func (tab *Table) ping(id NodeID, addr *net.UDPAddr) error { // Update the last ping and send the message tab.db.updateLastPing(id, time.Now()) @@ -467,24 +443,53 @@ func (tab *Table) ping(id NodeID, addr *net.UDPAddr) error { // Pong received, update the database and return tab.db.updateLastPong(id, time.Now()) tab.db.ensureExpirer() - return nil } -// add puts the entries into the table if their corresponding -// bucket is not full. The caller must hold tab.mutex. -func (tab *Table) add(entries []*Node) { +// add attempts to add the given node its corresponding bucket. If the +// bucket has space available, adding the node succeeds immediately. +// Otherwise, the node is added if the least recently active node in +// the bucket does not respond to a ping packet. +// +// The caller must not hold tab.mutex. +func (tab *Table) add(new *Node) { + b := tab.buckets[logdist(tab.self.sha, new.sha)] + tab.mutex.Lock() + if b.bump(new) { + tab.mutex.Unlock() + return + } + var oldest *Node + if len(b.entries) == bucketSize { + oldest = b.entries[bucketSize-1] + // Let go of the mutex so other goroutines can access + // the table while we ping the least recently active node. + tab.mutex.Unlock() + if err := tab.ping(oldest.ID, oldest.addr()); err == nil { + // The node responded, don't replace it. + return + } + tab.mutex.Lock() + } + added := b.replace(new, oldest) + tab.mutex.Unlock() + if added && tab.nodeAddedHook != nil { + tab.nodeAddedHook(new) + } +} + +// stuff adds nodes the table to the end of their corresponding bucket +// if the bucket is not full. The caller must hold tab.mutex. +func (tab *Table) stuff(nodes []*Node) { outer: - for _, n := range entries { + for _, n := range nodes { if n.ID == tab.self.ID { - // don't add self. - continue + continue // don't add self } bucket := tab.buckets[logdist(tab.self.sha, n.sha)] for i := range bucket.entries { if bucket.entries[i].ID == n.ID { - // already in bucket - continue outer + continue outer // already in bucket } } if len(bucket.entries) < bucketSize { @@ -496,12 +501,11 @@ outer: } } -// del removes an entry from the node table (used to evacuate failed/non-bonded -// discovery peers). -func (tab *Table) del(node *Node) { +// delete removes an entry from the node table (used to evacuate +// failed/non-bonded discovery peers). +func (tab *Table) delete(node *Node) { tab.mutex.Lock() defer tab.mutex.Unlock() - bucket := tab.buckets[logdist(tab.self.sha, node.sha)] for i := range bucket.entries { if bucket.entries[i].ID == node.ID { @@ -511,6 +515,27 @@ func (tab *Table) del(node *Node) { } } +func (b *bucket) replace(n *Node, last *Node) bool { + // Don't add if b already contains n. + for i := range b.entries { + if b.entries[i].ID == n.ID { + return false + } + } + // Replace last if it is still the last entry or just add n if b + // isn't full. If is no longer the last entry, it has either been + // replaced with someone else or became active. + if len(b.entries) == bucketSize && (last == nil || b.entries[bucketSize-1].ID != last.ID) { + return false + } + if len(b.entries) < bucketSize { + b.entries = append(b.entries, nil) + } + copy(b.entries[1:], b.entries) + b.entries[0] = n + return true +} + func (b *bucket) bump(n *Node) bool { for i := range b.entries { if b.entries[i].ID == n.ID { diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index d259177bf8..426f4e9ccc 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -178,8 +178,8 @@ func TestTable_closest(t *testing.T) { test := func(test *closeTest) bool { // for any node table, Target and N tab := newTable(nil, test.Self, &net.UDPAddr{}, "") - tab.add(test.All) defer tab.Close() + tab.stuff(test.All) // check that doClosest(Target, N) returns nodes result := tab.closest(test.Target, test.N).entries @@ -240,7 +240,7 @@ func TestTable_ReadRandomNodesGetAll(t *testing.T) { defer tab.Close() for i := 0; i < len(buf); i++ { ld := cfg.Rand.Intn(len(tab.buckets)) - tab.add([]*Node{nodeAtDistance(tab.self.sha, ld)}) + tab.stuff([]*Node{nodeAtDistance(tab.self.sha, ld)}) } gotN := tab.ReadRandomNodes(buf) if gotN != tab.len() { @@ -288,7 +288,7 @@ func TestTable_Lookup(t *testing.T) { } // seed table with initial node (otherwise lookup will terminate immediately) seed := newNode(lookupTestnet.dists[256][0], net.IP{}, 256, 0) - tab.add([]*Node{seed}) + tab.stuff([]*Node{seed}) results := tab.Lookup(lookupTestnet.target) t.Logf("results:") diff --git a/p2p/discover/udp_test.go b/p2p/discover/udp_test.go index 8d6d3e8557..b913424dd0 100644 --- a/p2p/discover/udp_test.go +++ b/p2p/discover/udp_test.go @@ -167,7 +167,7 @@ func TestUDP_findnode(t *testing.T) { for i := 0; i < bucketSize; i++ { nodes.push(nodeAtDistance(test.table.self.sha, i+2), bucketSize) } - test.table.add(nodes.entries) + test.table.stuff(nodes.entries) // ensure there's a bond with the test node, // findnode won't be accepted otherwise. From 590c99a98fd4e58fd34db7e31639b240461ee532 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 8 Aug 2015 02:49:28 +0200 Subject: [PATCH 25/90] p2p/discover: fix UDP reply packet timeout handling If the timeout fired (even just nanoseconds) before the deadline of the next pending reply, the timer was not rescheduled. The timer would've been rescheduled anyway once the next packet was sent, but there were cases where no next packet could ever be sent due to the locking issue fixed in the previous commit. As timing-related bugs go, this issue had been present for a long time and I could never reproduce it. The test added in this commit did reproduce the issue on about one out of 15 runs. --- p2p/discover/udp.go | 78 ++++++++++++++++++++++++---------------- p2p/discover/udp_test.go | 73 +++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 31 deletions(-) diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index d7ca9000d4..008e63937d 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -18,6 +18,7 @@ package discover import ( "bytes" + "container/list" "crypto/ecdsa" "errors" "fmt" @@ -43,6 +44,7 @@ var ( errUnsolicitedReply = errors.New("unsolicited reply") errUnknownNode = errors.New("unknown node") errTimeout = errors.New("RPC timeout") + errClockWarp = errors.New("reply deadline too far in the future") errClosed = errors.New("socket closed") ) @@ -296,7 +298,7 @@ func (t *udp) pending(id NodeID, ptype byte, callback func(interface{}) bool) <- } func (t *udp) handleReply(from NodeID, ptype byte, req packet) bool { - matched := make(chan bool) + matched := make(chan bool, 1) select { case t.gotreply <- reply{from, ptype, req, matched}: // loop will handle it @@ -310,68 +312,82 @@ func (t *udp) handleReply(from NodeID, ptype byte, req packet) bool { // the refresh timer and the pending reply queue. func (t *udp) loop() { var ( - pending []*pending - nextDeadline time.Time - timeout = time.NewTimer(0) - refresh = time.NewTicker(refreshInterval) + plist = list.New() + timeout = time.NewTimer(0) + nextTimeout *pending // head of plist when timeout was last reset + refresh = time.NewTicker(refreshInterval) ) <-timeout.C // ignore first timeout defer refresh.Stop() defer timeout.Stop() - rearmTimeout := func() { - now := time.Now() - if len(pending) == 0 || now.Before(nextDeadline) { + resetTimeout := func() { + if plist.Front() == nil || nextTimeout == plist.Front().Value { return } - nextDeadline = pending[0].deadline - timeout.Reset(nextDeadline.Sub(now)) + // Start the timer so it fires when the next pending reply has expired. + now := time.Now() + for el := plist.Front(); el != nil; el = el.Next() { + nextTimeout = el.Value.(*pending) + if dist := nextTimeout.deadline.Sub(now); dist < 2*respTimeout { + timeout.Reset(dist) + return + } + // Remove pending replies whose deadline is too far in the + // future. These can occur if the system clock jumped + // backwards after the deadline was assigned. + nextTimeout.errc <- errClockWarp + plist.Remove(el) + } + nextTimeout = nil + timeout.Stop() } for { + resetTimeout() + select { case <-refresh.C: go t.refresh() case <-t.closing: - for _, p := range pending { - p.errc <- errClosed + for el := plist.Front(); el != nil; el = el.Next() { + el.Value.(*pending).errc <- errClosed } - pending = nil return case p := <-t.addpending: p.deadline = time.Now().Add(respTimeout) - pending = append(pending, p) - rearmTimeout() + plist.PushBack(p) case r := <-t.gotreply: var matched bool - for i := 0; i < len(pending); i++ { - if p := pending[i]; p.from == r.from && p.ptype == r.ptype { + for el := plist.Front(); el != nil; el = el.Next() { + p := el.Value.(*pending) + if p.from == r.from && p.ptype == r.ptype { matched = true + // Remove the matcher if its callback indicates + // that all replies have been received. This is + // required for packet types that expect multiple + // reply packets. if p.callback(r.data) { - // callback indicates the request is done, remove it. p.errc <- nil - copy(pending[i:], pending[i+1:]) - pending = pending[:len(pending)-1] - i-- + plist.Remove(el) } } } r.matched <- matched case now := <-timeout.C: - // notify and remove callbacks whose deadline is in the past. - i := 0 - for ; i < len(pending) && now.After(pending[i].deadline); i++ { - pending[i].errc <- errTimeout + nextTimeout = nil + // Notify and remove callbacks whose deadline is in the past. + for el := plist.Front(); el != nil; el = el.Next() { + p := el.Value.(*pending) + if now.After(p.deadline) || now.Equal(p.deadline) { + p.errc <- errTimeout + plist.Remove(el) + } } - if i > 0 { - copy(pending, pending[i:]) - pending = pending[:len(pending)-i] - } - rearmTimeout() } } } @@ -385,7 +401,7 @@ const ( var ( headSpace = make([]byte, headSize) - // Neighbors responses are sent across multiple packets to + // Neighbors replies are sent across multiple packets to // stay below the 1280 byte limit. We compute the maximum number // of entries by stuffing a packet until it grows too large. maxNeighbors int diff --git a/p2p/discover/udp_test.go b/p2p/discover/udp_test.go index b913424dd0..a86d3737bc 100644 --- a/p2p/discover/udp_test.go +++ b/p2p/discover/udp_test.go @@ -19,10 +19,12 @@ package discover import ( "bytes" "crypto/ecdsa" + "encoding/binary" "errors" "fmt" "io" logpkg "log" + "math/rand" "net" "os" "path/filepath" @@ -138,6 +140,77 @@ func TestUDP_pingTimeout(t *testing.T) { } } +func TestUDP_responseTimeouts(t *testing.T) { + t.Parallel() + test := newUDPTest(t) + defer test.table.Close() + + rand.Seed(time.Now().UnixNano()) + randomDuration := func(max time.Duration) time.Duration { + return time.Duration(rand.Int63n(int64(max))) + } + + var ( + nReqs = 200 + nTimeouts = 0 // number of requests with ptype > 128 + nilErr = make(chan error, nReqs) // for requests that get a reply + timeoutErr = make(chan error, nReqs) // for requests that time out + ) + for i := 0; i < nReqs; i++ { + // Create a matcher for a random request in udp.loop. Requests + // with ptype <= 128 will not get a reply and should time out. + // For all other requests, a reply is scheduled to arrive + // within the timeout window. + p := &pending{ + ptype: byte(rand.Intn(255)), + callback: func(interface{}) bool { return true }, + } + binary.BigEndian.PutUint64(p.from[:], uint64(i)) + if p.ptype <= 128 { + p.errc = timeoutErr + nTimeouts++ + } else { + p.errc = nilErr + time.AfterFunc(randomDuration(60*time.Millisecond), func() { + if !test.udp.handleReply(p.from, p.ptype, nil) { + t.Logf("not matched: %v", p) + } + }) + } + test.udp.addpending <- p + time.Sleep(randomDuration(30 * time.Millisecond)) + } + + // Check that all timeouts were delivered and that the rest got nil errors. + // The replies must be delivered. + var ( + recvDeadline = time.After(20 * time.Second) + nTimeoutsRecv, nNil = 0, 0 + ) + for i := 0; i < nReqs; i++ { + select { + case err := <-timeoutErr: + if err != errTimeout { + t.Fatalf("got non-timeout error on timeoutErr %d: %v", i, err) + } + nTimeoutsRecv++ + case err := <-nilErr: + if err != nil { + t.Fatalf("got non-nil error on nilErr %d: %v", i, err) + } + nNil++ + case <-recvDeadline: + t.Fatalf("exceeded recv deadline") + } + } + if nTimeoutsRecv != nTimeouts { + t.Errorf("wrong number of timeout errors received: got %d, want %d", nTimeoutsRecv, nTimeouts) + } + if nNil != nReqs-nTimeouts { + t.Errorf("wrong number of successful replies: got %d, want %d", nNil, nReqs-nTimeouts) + } +} + func TestUDP_findnodeTimeout(t *testing.T) { t.Parallel() test := newUDPTest(t) From 67c8ccc309733b0664e287a5b29f1cc62d22a78d Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 11 Aug 2015 11:19:14 +0200 Subject: [PATCH 26/90] cmd/ethtest: added trace flag for debugging --- cmd/ethtest/main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go index 5429cab31a..67b9653960 100644 --- a/cmd/ethtest/main.go +++ b/cmd/ethtest/main.go @@ -26,6 +26,7 @@ import ( "strings" "github.com/codegangsta/cli" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/tests" ) @@ -62,6 +63,10 @@ var ( Name: "skip", Usage: "Tests names to skip", } + TraceFlag = cli.BoolFlag{ + Name: "trace", + Usage: "Enable VM tracing", + } ) func runTestWithReader(test string, r io.Reader) error { @@ -173,7 +178,6 @@ func runSuite(test, file string) { glog.Fatalln(err) } } - } } } @@ -184,6 +188,7 @@ func setupApp(c *cli.Context) { continueOnError = c.GlobalBool(ContinueOnErrorFlag.Name) useStdIn := c.GlobalBool(ReadStdInFlag.Name) skipTests = strings.Split(c.GlobalString(SkipTestsFlag.Name), " ") + vm.Debug = c.GlobalBool(TraceFlag.Name) if !useStdIn { runSuite(flagTest, flagFile) @@ -211,6 +216,7 @@ func main() { ContinueOnErrorFlag, ReadStdInFlag, SkipTestsFlag, + TraceFlag, } if err := app.Run(os.Args); err != nil { From bf6ea2919dc424586eff00974b813bbbedcede9b Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 11 Aug 2015 17:17:20 +0200 Subject: [PATCH 27/90] web3: updated --- jsre/ethereum_js.go | 3075 +++++++++++++++++++++++++++++-------------- 1 file changed, 2122 insertions(+), 953 deletions(-) diff --git a/jsre/ethereum_js.go b/jsre/ethereum_js.go index 012e5af709..f33bb7c25a 100644 --- a/jsre/ethereum_js.go +++ b/jsre/ethereum_js.go @@ -18,6 +18,622 @@ package jsre const Web3_JS = ` require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 64 || this.offset !== undefined; + return this.offset !== undefined; }; /** @@ -708,71 +1360,398 @@ SolidityParam.encodeList = function (params) { }, '')); }; -/** - * This method should be used to decode plain (static) solidity param at given index - * - * @method decodeParam - * @param {String} bytes - * @param {Number} index - * @returns {SolidityParam} - */ -SolidityParam.decodeParam = function (bytes, index) { - index = index || 0; - return new SolidityParam(bytes.substr(index * 64, 64)); -}; -/** - * This method should be called to get offset value from bytes at given index - * - * @method getOffset - * @param {String} bytes - * @param {Number} index - * @returns {Number} offset as number - */ -var getOffset = function (bytes, index) { - // we can do this cause offset is rather small - return parseInt('0x' + bytes.substr(index * 64, 64)); -}; - -/** - * This method should be called to decode solidity bytes param at given index - * - * @method decodeBytes - * @param {String} bytes - * @param {Number} index - * @returns {SolidityParam} - */ -SolidityParam.decodeBytes = function (bytes, index) { - index = index || 0; - - var offset = getOffset(bytes, index); - - var l = parseInt('0x' + bytes.substr(offset * 2, 64)); - l = Math.floor((l + 31) / 32); - - // (1 + l) * , cause we also parse length - return new SolidityParam(bytes.substr(offset * 2, (1 + l) * 64), 0); -}; - -/** - * This method should be used to decode solidity array at given index - * - * @method decodeArray - * @param {String} bytes - * @param {Number} index - * @returns {SolidityParam} - */ -SolidityParam.decodeArray = function (bytes, index) { - index = index || 0; - var offset = getOffset(bytes, index); - var length = parseInt('0x' + bytes.substr(offset * 2, 64)); - return new SolidityParam(bytes.substr(offset * 2, (length + 1) * 64), 0); -}; module.exports = SolidityParam; -},{"../utils/utils":7}],4:[function(require,module,exports){ +},{"../utils/utils":20}],12:[function(require,module,exports){ +var f = require('./formatters'); +var SolidityType = require('./type'); + +/** + * SolidityTypeReal is a prootype that represents real type + * It matches: + * real + * real[] + * real[4] + * real[][] + * real[3][] + * real[][6][], ... + * real32 + * real64[] + * real8[4] + * real256[][] + * real[3][] + * real64[][6][], ... + */ +var SolidityTypeReal = function () { + this._inputFormatter = f.formatInputReal; + this._outputFormatter = f.formatOutputReal; +}; + +SolidityTypeReal.prototype = new SolidityType({}); +SolidityTypeReal.prototype.constructor = SolidityTypeReal; + +SolidityTypeReal.prototype.isType = function (name) { + return !!name.match(/real([0-9]*)?(\[([0-9]*)\])?/); +}; + +SolidityTypeReal.prototype.staticPartLength = function (name) { + return 32 * this.staticArrayLength(name); +}; + +module.exports = SolidityTypeReal; + +},{"./formatters":9,"./type":14}],13:[function(require,module,exports){ +var f = require('./formatters'); +var SolidityType = require('./type'); + +var SolidityTypeString = function () { + this._inputFormatter = f.formatInputString; + this._outputFormatter = f.formatOutputString; +}; + +SolidityTypeString.prototype = new SolidityType({}); +SolidityTypeString.prototype.constructor = SolidityTypeString; + +SolidityTypeString.prototype.isType = function (name) { + return !!name.match(/^string(\[([0-9]*)\])*$/); +}; + +SolidityTypeString.prototype.staticPartLength = function (name) { + return 32 * this.staticArrayLength(name); +}; + +SolidityTypeString.prototype.isDynamicType = function () { + return true; +}; + +module.exports = SolidityTypeString; + + +},{"./formatters":9,"./type":14}],14:[function(require,module,exports){ +var f = require('./formatters'); +var SolidityParam = require('./param'); + +/** + * SolidityType prototype is used to encode/decode solidity params of certain type + */ +var SolidityType = function (config) { + this._inputFormatter = config.inputFormatter; + this._outputFormatter = config.outputFormatter; +}; + +/** + * Should be used to determine if this SolidityType do match given name + * + * @method isType + * @param {String} name + * @return {Bool} true if type match this SolidityType, otherwise false + */ +SolidityType.prototype.isType = function (name) { + throw "this method should be overrwritten for type " + name; +}; + +/** + * Should be used to determine what is the length of static part in given type + * + * @method staticPartLength + * @param {String} name + * @return {Number} length of static part in bytes + */ +SolidityType.prototype.staticPartLength = function (name) { + throw "this method should be overrwritten for type: " + name; +}; + +/** + * Should be used to determine if type is dynamic array + * eg: + * "type[]" => true + * "type[4]" => false + * + * @method isDynamicArray + * @param {String} name + * @return {Bool} true if the type is dynamic array + */ +SolidityType.prototype.isDynamicArray = function (name) { + var nestedTypes = this.nestedTypes(name); + return !!nestedTypes && !nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g); +}; + +/** + * Should be used to determine if type is static array + * eg: + * "type[]" => false + * "type[4]" => true + * + * @method isStaticArray + * @param {String} name + * @return {Bool} true if the type is static array + */ +SolidityType.prototype.isStaticArray = function (name) { + var nestedTypes = this.nestedTypes(name); + return !!nestedTypes && !!nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g); +}; + +/** + * Should return length of static array + * eg. + * "int[32]" => 32 + * "int256[14]" => 14 + * "int[2][3]" => 3 + * "int" => 1 + * "int[1]" => 1 + * "int[]" => 1 + * + * @method staticArrayLength + * @param {String} name + * @return {Number} static array length + */ +SolidityType.prototype.staticArrayLength = function (name) { + var nestedTypes = this.nestedTypes(name); + if (nestedTypes) { + return parseInt(nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g) || 1); + } + return 1; +}; + +/** + * Should return nested type + * eg. + * "int[32]" => "int" + * "int256[14]" => "int256" + * "int[2][3]" => "int[2]" + * "int" => "int" + * "int[]" => "int" + * + * @method nestedName + * @param {String} name + * @return {String} nested name + */ +SolidityType.prototype.nestedName = function (name) { + // remove last [] in name + var nestedTypes = this.nestedTypes(name); + if (!nestedTypes) { + return name; + } + + return name.substr(0, name.length - nestedTypes[nestedTypes.length - 1].length); +}; + +/** + * Should return true if type has dynamic size by default + * such types are "string", "bytes" + * + * @method isDynamicType + * @param {String} name + * @return {Bool} true if is dynamic, otherwise false + */ +SolidityType.prototype.isDynamicType = function () { + return false; +}; + +/** + * Should return array of nested types + * eg. + * "int[2][3][]" => ["[2]", "[3]", "[]"] + * "int[] => ["[]"] + * "int" => null + * + * @method nestedTypes + * @param {String} name + * @return {Array} array of nested types + */ +SolidityType.prototype.nestedTypes = function (name) { + // return list of strings eg. "[]", "[3]", "[]", "[2]" + return name.match(/(\[[0-9]*\])/g); +}; + +/** + * Should be used to encode the value + * + * @method encode + * @param {Object} value + * @param {String} name + * @return {String} encoded value + */ +SolidityType.prototype.encode = function (value, name) { + var self = this; + if (this.isDynamicArray(name)) { + + return (function () { + var length = value.length; // in int + var nestedName = self.nestedName(name); + + var result = []; + result.push(f.formatInputInt(length).encode()); + + value.forEach(function (v) { + result.push(self.encode(v, nestedName)); + }); + + return result; + })(); + + } else if (this.isStaticArray(name)) { + + return (function () { + var length = self.staticArrayLength(name); // in int + var nestedName = self.nestedName(name); + + var result = []; + for (var i = 0; i < length; i++) { + result.push(self.encode(value[i], nestedName)); + } + + return result; + })(); + + } + + return this._inputFormatter(value, name).encode(); +}; + +/** + * Should be used to decode value from bytes + * + * @method decode + * @param {String} bytes + * @param {Number} offset in bytes + * @param {String} name type name + * @returns {Object} decoded value + */ +SolidityType.prototype.decode = function (bytes, offset, name) { + var self = this; + + if (this.isDynamicArray(name)) { + + return (function () { + var arrayOffset = parseInt('0x' + bytes.substr(offset * 2, 64)); // in bytes + var length = parseInt('0x' + bytes.substr(arrayOffset * 2, 64)); // in int + var arrayStart = arrayOffset + 32; // array starts after length; // in bytes + + var nestedName = self.nestedName(name); + var nestedStaticPartLength = self.staticPartLength(nestedName); // in bytes + var result = []; + + for (var i = 0; i < length * nestedStaticPartLength; i += nestedStaticPartLength) { + result.push(self.decode(bytes, arrayStart + i, nestedName)); + } + + return result; + })(); + + } else if (this.isStaticArray(name)) { + + return (function () { + var length = self.staticArrayLength(name); // in int + var arrayStart = offset; // in bytes + + var nestedName = self.nestedName(name); + var nestedStaticPartLength = self.staticPartLength(nestedName); // in bytes + var result = []; + + for (var i = 0; i < length * nestedStaticPartLength; i += nestedStaticPartLength) { + result.push(self.decode(bytes, arrayStart + i, nestedName)); + } + + return result; + })(); + } else if (this.isDynamicType(name)) { + + return (function () { + var dynamicOffset = parseInt('0x' + bytes.substr(offset * 2, 64)); // in bytes + var length = parseInt('0x' + bytes.substr(dynamicOffset * 2, 64)); // in bytes + var roundedLength = Math.floor((length + 31) / 32); // in int + + return self._outputFormatter(new SolidityParam(bytes.substr(dynamicOffset * 2, ( 1 + roundedLength) * 64), 0)); + })(); + } + + var length = this.staticPartLength(name); + return this._outputFormatter(new SolidityParam(bytes.substr(offset * 2, length * 2))); +}; + +module.exports = SolidityType; + +},{"./formatters":9,"./param":11}],15:[function(require,module,exports){ +var f = require('./formatters'); +var SolidityType = require('./type'); + +/** + * SolidityTypeUInt is a prootype that represents uint type + * It matches: + * uint + * uint[] + * uint[4] + * uint[][] + * uint[3][] + * uint[][6][], ... + * uint32 + * uint64[] + * uint8[4] + * uint256[][] + * uint[3][] + * uint64[][6][], ... + */ +var SolidityTypeUInt = function () { + this._inputFormatter = f.formatInputInt; + this._outputFormatter = f.formatOutputInt; +}; + +SolidityTypeUInt.prototype = new SolidityType({}); +SolidityTypeUInt.prototype.constructor = SolidityTypeUInt; + +SolidityTypeUInt.prototype.isType = function (name) { + return !!name.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/); +}; + +SolidityTypeUInt.prototype.staticPartLength = function (name) { + return 32 * this.staticArrayLength(name); +}; + +module.exports = SolidityTypeUInt; + +},{"./formatters":9,"./type":14}],16:[function(require,module,exports){ +var f = require('./formatters'); +var SolidityType = require('./type'); + +/** + * SolidityTypeUReal is a prootype that represents ureal type + * It matches: + * ureal + * ureal[] + * ureal[4] + * ureal[][] + * ureal[3][] + * ureal[][6][], ... + * ureal32 + * ureal64[] + * ureal8[4] + * ureal256[][] + * ureal[3][] + * ureal64[][6][], ... + */ +var SolidityTypeUReal = function () { + this._inputFormatter = f.formatInputReal; + this._outputFormatter = f.formatOutputUReal; +}; + +SolidityTypeUReal.prototype = new SolidityType({}); +SolidityTypeUReal.prototype.constructor = SolidityTypeUReal; + +SolidityTypeUReal.prototype.isType = function (name) { + return !!name.match(/^ureal([0-9]*)?(\[([0-9]*)\])*$/); +}; + +SolidityTypeUReal.prototype.staticPartLength = function (name) { + return 32 * this.staticArrayLength(name); +}; + +module.exports = SolidityTypeUReal; + +},{"./formatters":9,"./type":14}],17:[function(require,module,exports){ 'use strict'; // go env doesn't have and need XMLHttpRequest @@ -783,7 +1762,7 @@ if (typeof XMLHttpRequest === 'undefined') { } -},{}],5:[function(require,module,exports){ +},{}],18:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -819,6 +1798,7 @@ if (typeof XMLHttpRequest === 'undefined') { * @constructor */ + /// required to define ETH_BIGNUMBER_ROUNDING_MODE var BigNumber = require('bignumber.js'); @@ -863,7 +1843,7 @@ module.exports = { }; -},{"bignumber.js":"bignumber.js"}],6:[function(require,module,exports){ +},{"bignumber.js":"bignumber.js"}],19:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -886,6 +1866,7 @@ module.exports = { * @date 2015 */ + var utils = require('./utils'); var sha3 = require('crypto-js/sha3'); @@ -904,7 +1885,7 @@ module.exports = function (str, isNew) { }; -},{"./utils":7,"crypto-js/sha3":34}],7:[function(require,module,exports){ +},{"./utils":20,"crypto-js/sha3":47}],20:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -940,6 +1921,7 @@ module.exports = function (str, isNew) { * @constructor */ + var BigNumber = require('bignumber.js'); var unitMap = { @@ -1015,7 +1997,7 @@ var toAscii = function(hex) { str += String.fromCharCode(code); } - return decodeURIComponent(escape(str)); + return decodeURIComponent(escape(str)); // jshint ignore:line }; /** @@ -1026,7 +2008,7 @@ var toAscii = function(hex) { * @returns {String} hex representation of input string */ var toHexNative = function(str) { - str = unescape(encodeURIComponent(str)); + str = unescape(encodeURIComponent(str)); // jshint ignore:line var hex = ""; for(var i = 0; i < str.length; i++) { var n = str.charCodeAt(i).toString(16); @@ -1377,18 +2359,6 @@ var isJson = function (str) { } }; -/** - * This method should be called to check if string is valid ethereum IBAN number - * Supports direct and indirect IBANs - * - * @method isIBAN - * @param {String} - * @return {Boolean} - */ -var isIBAN = function (iban) { - return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30})$/.test(iban); -}; - module.exports = { padLeft: padLeft, padRight: padRight, @@ -1413,17 +2383,16 @@ module.exports = { isObject: isObject, isBoolean: isBoolean, isArray: isArray, - isJson: isJson, - isIBAN: isIBAN + isJson: isJson }; -},{"bignumber.js":"bignumber.js"}],8:[function(require,module,exports){ +},{"bignumber.js":"bignumber.js"}],21:[function(require,module,exports){ module.exports={ - "version": "0.9.1" + "version": "0.12.1" } -},{}],9:[function(require,module,exports){ +},{}],22:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -1451,11 +2420,11 @@ module.exports={ */ var version = require('./version.json'); -var net = require('./web3/net'); -var eth = require('./web3/eth'); -var db = require('./web3/db'); -var shh = require('./web3/shh'); -var watches = require('./web3/watches'); +var net = require('./web3/methods/net'); +var eth = require('./web3/methods/eth'); +var db = require('./web3/methods/db'); +var shh = require('./web3/methods/shh'); +var watches = require('./web3/methods/watches'); var Filter = require('./web3/filter'); var utils = require('./utils/utils'); var formatters = require('./web3/formatters'); @@ -1600,7 +2569,7 @@ setupMethods(web3.shh, shh.methods); module.exports = web3; -},{"./utils/config":5,"./utils/sha3":6,"./utils/utils":7,"./version.json":8,"./web3/batch":11,"./web3/db":13,"./web3/eth":15,"./web3/filter":17,"./web3/formatters":18,"./web3/method":24,"./web3/net":26,"./web3/property":27,"./web3/requestmanager":28,"./web3/shh":29,"./web3/watches":31}],10:[function(require,module,exports){ +},{"./utils/config":18,"./utils/sha3":19,"./utils/utils":20,"./version.json":21,"./web3/batch":24,"./web3/filter":28,"./web3/formatters":29,"./web3/method":35,"./web3/methods/db":36,"./web3/methods/eth":37,"./web3/methods/net":38,"./web3/methods/shh":39,"./web3/methods/watches":40,"./web3/property":42,"./web3/requestmanager":43}],23:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -1628,7 +2597,7 @@ var SolidityEvent = require('./event'); var formatters = require('./formatters'); var utils = require('../utils/utils'); var Filter = require('./filter'); -var watches = require('./watches'); +var watches = require('./methods/watches'); var AllSolidityEvents = function (json, address) { this._json = json; @@ -1669,6 +2638,13 @@ AllSolidityEvents.prototype.decode = function (data) { }; AllSolidityEvents.prototype.execute = function (options, callback) { + + if (utils.isFunction(arguments[arguments.length - 1])) { + callback = arguments[arguments.length - 1]; + if(arguments.length === 1) + options = null; + } + var o = this.encode(options); var formatter = this.decode.bind(this); return new Filter(o, watches.eth(), formatter, callback); @@ -1682,7 +2658,7 @@ AllSolidityEvents.prototype.attachToContract = function (contract) { module.exports = AllSolidityEvents; -},{"../utils/sha3":6,"../utils/utils":7,"./event":16,"./filter":17,"./formatters":18,"./watches":31}],11:[function(require,module,exports){ +},{"../utils/sha3":19,"../utils/utils":20,"./event":27,"./filter":28,"./formatters":29,"./methods/watches":40}],24:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -1750,7 +2726,7 @@ Batch.prototype.execute = function () { module.exports = Batch; -},{"./errors":14,"./jsonrpc":23,"./requestmanager":28}],12:[function(require,module,exports){ +},{"./errors":26,"./jsonrpc":34,"./requestmanager":43}],25:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2029,65 +3005,7 @@ var Contract = function (abi, address) { module.exports = contract; -},{"../solidity/coder":1,"../utils/utils":7,"../web3":9,"./allevents":10,"./event":16,"./function":19}],13:[function(require,module,exports){ -/* - This file is part of ethereum.js. - - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** @file db.js - * @authors: - * Marek Kotewicz - * @date 2015 - */ - -var Method = require('./method'); - -var putString = new Method({ - name: 'putString', - call: 'db_putString', - params: 3 -}); - - -var getString = new Method({ - name: 'getString', - call: 'db_getString', - params: 2 -}); - -var putHex = new Method({ - name: 'putHex', - call: 'db_putHex', - params: 3 -}); - -var getHex = new Method({ - name: 'getHex', - call: 'db_getHex', - params: 2 -}); - -var methods = [ - putString, getString, putHex, getHex -]; - -module.exports = { - methods: methods -}; - -},{"./method":24}],14:[function(require,module,exports){ +},{"../solidity/coder":7,"../utils/utils":20,"../web3":22,"./allevents":23,"./event":27,"./function":30}],26:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2127,300 +3045,7 @@ module.exports = { }; -},{}],15:[function(require,module,exports){ -/* - This file is part of ethereum.js. - - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** - * @file eth.js - * @author Marek Kotewicz - * @author Fabian Vogelsteller - * @date 2015 - */ - -/** - * Web3 - * - * @module web3 - */ - -/** - * Eth methods and properties - * - * An example method object can look as follows: - * - * { - * name: 'getBlock', - * call: blockCall, - * params: 2, - * outputFormatter: formatters.outputBlockFormatter, - * inputFormatter: [ // can be a formatter funciton or an array of functions. Where each item in the array will be used for one parameter - * utils.toHex, // formats paramter 1 - * function(param){ return !!param; } // formats paramter 2 - * ] - * }, - * - * @class [web3] eth - * @constructor - */ - -"use strict"; - -var formatters = require('./formatters'); -var utils = require('../utils/utils'); -var Method = require('./method'); -var Property = require('./property'); - -var blockCall = function (args) { - return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockByHash" : "eth_getBlockByNumber"; -}; - -var transactionFromBlockCall = function (args) { - return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex'; -}; - -var uncleCall = function (args) { - return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex'; -}; - -var getBlockTransactionCountCall = function (args) { - return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber'; -}; - -var uncleCountCall = function (args) { - return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber'; -}; - -/// @returns an array of objects describing web3.eth api methods - -var getBalance = new Method({ - name: 'getBalance', - call: 'eth_getBalance', - params: 2, - inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter], - outputFormatter: formatters.outputBigNumberFormatter -}); - -var getStorageAt = new Method({ - name: 'getStorageAt', - call: 'eth_getStorageAt', - params: 3, - inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter] -}); - -var getCode = new Method({ - name: 'getCode', - call: 'eth_getCode', - params: 2, - inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter] -}); - -var getBlock = new Method({ - name: 'getBlock', - call: blockCall, - params: 2, - inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }], - outputFormatter: formatters.outputBlockFormatter -}); - -var getUncle = new Method({ - name: 'getUncle', - call: uncleCall, - params: 2, - inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex], - outputFormatter: formatters.outputBlockFormatter, - -}); - -var getCompilers = new Method({ - name: 'getCompilers', - call: 'eth_getCompilers', - params: 0 -}); - -var getBlockTransactionCount = new Method({ - name: 'getBlockTransactionCount', - call: getBlockTransactionCountCall, - params: 1, - inputFormatter: [formatters.inputBlockNumberFormatter], - outputFormatter: utils.toDecimal -}); - -var getBlockUncleCount = new Method({ - name: 'getBlockUncleCount', - call: uncleCountCall, - params: 1, - inputFormatter: [formatters.inputBlockNumberFormatter], - outputFormatter: utils.toDecimal -}); - -var getTransaction = new Method({ - name: 'getTransaction', - call: 'eth_getTransactionByHash', - params: 1, - outputFormatter: formatters.outputTransactionFormatter -}); - -var getTransactionFromBlock = new Method({ - name: 'getTransactionFromBlock', - call: transactionFromBlockCall, - params: 2, - inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex], - outputFormatter: formatters.outputTransactionFormatter -}); - -var getTransactionReceipt = new Method({ - name: 'getTransactionReceipt', - call: 'eth_getTransactionReceipt', - params: 1, - outputFormatter: formatters.outputTransactionReceiptFormatter -}); - -var getTransactionCount = new Method({ - name: 'getTransactionCount', - call: 'eth_getTransactionCount', - params: 2, - inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter], - outputFormatter: utils.toDecimal -}); - -var sendRawTransaction = new Method({ - name: 'sendRawTransaction', - call: 'eth_sendRawTransaction', - params: 1, - inputFormatter: [null] -}); - -var sendTransaction = new Method({ - name: 'sendTransaction', - call: 'eth_sendTransaction', - params: 1, - inputFormatter: [formatters.inputTransactionFormatter] -}); - -var call = new Method({ - name: 'call', - call: 'eth_call', - params: 2, - inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter] -}); - -var estimateGas = new Method({ - name: 'estimateGas', - call: 'eth_estimateGas', - params: 1, - inputFormatter: [formatters.inputTransactionFormatter], - outputFormatter: utils.toDecimal -}); - -var compileSolidity = new Method({ - name: 'compile.solidity', - call: 'eth_compileSolidity', - params: 1 -}); - -var compileLLL = new Method({ - name: 'compile.lll', - call: 'eth_compileLLL', - params: 1 -}); - -var compileSerpent = new Method({ - name: 'compile.serpent', - call: 'eth_compileSerpent', - params: 1 -}); - -var submitWork = new Method({ - name: 'submitWork', - call: 'eth_submitWork', - params: 3 -}); - -var getWork = new Method({ - name: 'getWork', - call: 'eth_getWork', - params: 0 -}); - -var methods = [ - getBalance, - getStorageAt, - getCode, - getBlock, - getUncle, - getCompilers, - getBlockTransactionCount, - getBlockUncleCount, - getTransaction, - getTransactionFromBlock, - getTransactionReceipt, - getTransactionCount, - call, - estimateGas, - sendRawTransaction, - sendTransaction, - compileSolidity, - compileLLL, - compileSerpent, - submitWork, - getWork -]; - -/// @returns an array of objects describing web3.eth api properties - - - -var properties = [ - new Property({ - name: 'coinbase', - getter: 'eth_coinbase' - }), - new Property({ - name: 'mining', - getter: 'eth_mining' - }), - new Property({ - name: 'hashrate', - getter: 'eth_hashrate', - outputFormatter: utils.toDecimal - }), - new Property({ - name: 'gasPrice', - getter: 'eth_gasPrice', - outputFormatter: formatters.outputBigNumberFormatter - }), - new Property({ - name: 'accounts', - getter: 'eth_accounts' - }), - new Property({ - name: 'blockNumber', - getter: 'eth_blockNumber', - outputFormatter: utils.toDecimal - }) -]; - -module.exports = { - methods: methods, - properties: properties -}; - - -},{"../utils/utils":7,"./formatters":18,"./method":24,"./property":27}],16:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2448,7 +3073,7 @@ var coder = require('../solidity/coder'); var formatters = require('./formatters'); var sha3 = require('../utils/sha3'); var Filter = require('./filter'); -var watches = require('./watches'); +var watches = require('./methods/watches'); /** * This prototype should be used to create event filters @@ -2629,7 +3254,7 @@ SolidityEvent.prototype.attachToContract = function (contract) { module.exports = SolidityEvent; -},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"./filter":17,"./formatters":18,"./watches":31}],17:[function(require,module,exports){ +},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./filter":28,"./formatters":29,"./methods/watches":40}],28:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2795,6 +3420,7 @@ var Filter = function (options, methods, formatter, callback) { } }); + return this; }; Filter.prototype.watch = function (callback) { @@ -2840,7 +3466,7 @@ Filter.prototype.get = function (callback) { module.exports = Filter; -},{"../utils/utils":7,"./formatters":18,"./requestmanager":28}],18:[function(require,module,exports){ +},{"../utils/utils":20,"./formatters":29,"./requestmanager":43}],29:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2866,6 +3492,7 @@ module.exports = Filter; var utils = require('../utils/utils'); var config = require('../utils/config'); +var Iban = require('./iban'); /** * Should the format output to a big number @@ -2898,6 +3525,34 @@ var inputBlockNumberFormatter = function (blockNumber) { return utils.toHex(blockNumber); }; +/** + * Formats the input of a transaction and converts all values to HEX + * + * @method inputCallFormatter + * @param {Object} transaction options + * @returns object +*/ +var inputCallFormatter = function (options){ + + options.from = options.from || config.defaultAccount; + + if (options.from) { + options.from = inputAddressFormatter(options.from); + } + + if (options.to) { // it might be contract creation + options.to = inputAddressFormatter(options.to); + } + + ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) { + return options[key] !== undefined; + }).forEach(function(key){ + options[key] = utils.fromDecimal(options[key]); + }); + + return options; +}; + /** * Formats the input of a transaction and converts all values to HEX * @@ -2908,11 +3563,10 @@ var inputBlockNumberFormatter = function (blockNumber) { var inputTransactionFormatter = function (options){ options.from = options.from || config.defaultAccount; + options.from = inputAddressFormatter(options.from); - // make code -> data - if (options.code) { - options.data = options.code; - delete options.code; + if (options.to) { // it might be contract creation + options.to = inputAddressFormatter(options.to); } ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) { @@ -3073,10 +3727,24 @@ var outputPostFormatter = function(post){ return post; }; +var inputAddressFormatter = function (address) { + var iban = new Iban(address); + if (iban.isValid() && iban.isDirect()) { + return '0x' + iban.address(); + } else if (utils.isStrictAddress(address)) { + return address; + } else if (utils.isAddress(address)) { + return '0x' + address; + } + throw 'invalid address'; +}; + module.exports = { inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter, inputBlockNumberFormatter: inputBlockNumberFormatter, + inputCallFormatter: inputCallFormatter, inputTransactionFormatter: inputTransactionFormatter, + inputAddressFormatter: inputAddressFormatter, inputPostFormatter: inputPostFormatter, outputBigNumberFormatter: outputBigNumberFormatter, outputTransactionFormatter: outputTransactionFormatter, @@ -3087,7 +3755,7 @@ module.exports = { }; -},{"../utils/config":5,"../utils/utils":7}],19:[function(require,module,exports){ +},{"../utils/config":18,"../utils/utils":20,"./iban":32}],30:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -3324,7 +3992,7 @@ SolidityFunction.prototype.attachToContract = function (contract) { module.exports = SolidityFunction; -},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":18}],20:[function(require,module,exports){ +},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"../web3":22,"./formatters":29}],31:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -3351,51 +4019,61 @@ module.exports = SolidityFunction; "use strict"; -var XMLHttpRequest = (typeof window !== 'undefined' && window.XMLHttpRequest) ? window.XMLHttpRequest : require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line var errors = require('./errors'); +// workaround to use httpprovider in different envs +var XMLHttpRequest; // jshint ignore: line + +// meteor server environment +if (typeof Meteor !== 'undefined' && Meteor.isServer) { // jshint ignore: line + XMLHttpRequest = Npm.require('xmlhttprequest').XMLHttpRequest; // jshint ignore: line + +// browser +} else if (typeof window !== 'undefined' && window.XMLHttpRequest) { + XMLHttpRequest = window.XMLHttpRequest; // jshint ignore: line + +// node +} else { + XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore: line +} + +/** + * HttpProvider should be used to send rpc calls over http + */ var HttpProvider = function (host) { this.host = host || 'http://localhost:8545'; }; -HttpProvider.prototype.isConnected = function() { +/** + * Should be called to prepare new XMLHttpRequest + * + * @method prepareRequest + * @param {Boolean} true if request should be async + * @return {XMLHttpRequest} object + */ +HttpProvider.prototype.prepareRequest = function (async) { var request = new XMLHttpRequest(); - - request.open('POST', this.host, false); - request.setRequestHeader('Content-type','application/json'); - - try { - request.send(JSON.stringify({ - id: 9999999999, - jsonrpc: '2.0', - method: 'net_listening', - params: [] - })); - return true; - } catch(e) { - return false; - } + request.open('POST', this.host, async); + request.setRequestHeader('Content-Type','application/json'); + return request; }; +/** + * Should be called to make sync request + * + * @method send + * @param {Object} payload + * @return {Object} result + */ HttpProvider.prototype.send = function (payload) { - var request = new XMLHttpRequest(); + var request = this.prepareRequest(false); - request.open('POST', this.host, false); - request.setRequestHeader('Content-type','application/json'); - try { request.send(JSON.stringify(payload)); } catch(error) { throw errors.InvalidConnection(this.host); } - - // check request.status - // TODO: throw an error here! it cannot silently fail!!! - //if (request.status !== 200) { - //return; - //} - var result = request.responseText; try { @@ -3407,8 +4085,16 @@ HttpProvider.prototype.send = function (payload) { return result; }; +/** + * Should be used to make async request + * + * @method sendAsync + * @param {Object} payload + * @param {Function} callback triggered on end with (err, result) + */ HttpProvider.prototype.sendAsync = function (payload, callback) { - var request = new XMLHttpRequest(); + var request = this.prepareRequest(true); + request.onreadystatechange = function() { if (request.readyState === 4) { var result = request.responseText; @@ -3423,9 +4109,6 @@ HttpProvider.prototype.sendAsync = function (payload, callback) { callback(error, result); } }; - - request.open('POST', this.host, true); - request.setRequestHeader('Content-type','application/json'); try { request.send(JSON.stringify(payload)); @@ -3434,10 +4117,30 @@ HttpProvider.prototype.sendAsync = function (payload, callback) { } }; +/** + * Synchronously tries to make Http request + * + * @method isConnected + * @return {Boolean} returns true if request haven't failed. Otherwise false + */ +HttpProvider.prototype.isConnected = function() { + try { + this.send({ + id: 9999999999, + jsonrpc: '2.0', + method: 'net_listening', + params: [] + }); + return true; + } catch(e) { + return false; + } +}; + module.exports = HttpProvider; -},{"./errors":14,"xmlhttprequest":4}],21:[function(require,module,exports){ +},{"./errors":26,"xmlhttprequest":17}],32:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -3455,30 +4158,139 @@ module.exports = HttpProvider; along with ethereum.js. If not, see . */ /** - * @file icap.js + * @file iban.js * @author Marek Kotewicz * @date 2015 */ -var utils = require('../utils/utils'); +var BigNumber = require('bignumber.js'); + +var padLeft = function (string, bytes) { + var result = string; + while (result.length < bytes * 2) { + result = '00' + result; + } + return result; +}; /** - * This prototype should be used to extract necessary information from iban address + * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to + * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616. + * + * @method iso13616Prepare + * @param {String} iban the IBAN + * @returns {String} the prepared IBAN + */ +var iso13616Prepare = function (iban) { + var A = 'A'.charCodeAt(0); + var Z = 'Z'.charCodeAt(0); + + iban = iban.toUpperCase(); + iban = iban.substr(4) + iban.substr(0,4); + + return iban.split('').map(function(n){ + var code = n.charCodeAt(0); + if (code >= A && code <= Z){ + // A = 10, B = 11, ... Z = 35 + return code - A + 10; + } else { + return n; + } + }).join(''); +}; + +/** + * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064. + * + * @method mod9710 + * @param {String} iban + * @returns {Number} + */ +var mod9710 = function (iban) { + var remainder = iban, + block; + + while (remainder.length > 2){ + block = remainder.slice(0, 9); + remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); + } + + return parseInt(remainder, 10) % 97; +}; + +/** + * This prototype should be used to create iban object from iban correct string * * @param {String} iban */ -var ICAP = function (iban) { +var Iban = function (iban) { this._iban = iban; }; /** - * Should be called to check if icap is correct + * This method should be used to create iban object from ethereum address + * + * @method fromAddress + * @param {String} address + * @return {Iban} the IBAN object + */ +Iban.fromAddress = function (address) { + var asBn = new BigNumber(address, 16); + var base36 = asBn.toString(36); + var padded = padLeft(base36, 15); + return Iban.fromBban(padded.toUpperCase()); +}; + +/** + * Convert the passed BBAN to an IBAN for this country specification. + * Please note that "generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account". + * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits + * + * @method fromBban + * @param {String} bban the BBAN to convert to IBAN + * @returns {Iban} the IBAN object + */ +Iban.fromBban = function (bban) { + var countryCode = 'XE'; + + var remainder = mod9710(iso13616Prepare(countryCode + '00' + bban)); + var checkDigit = ('0' + (98 - remainder)).slice(-2); + + return new Iban(countryCode + checkDigit + bban); +}; + +/** + * Should be used to create IBAN object for given institution and identifier + * + * @method createIndirect + * @param {Object} options, required options are "institution" and "identifier" + * @return {Iban} the IBAN object + */ +Iban.createIndirect = function (options) { + return Iban.fromBban('ETH' + options.institution + options.identifier); +}; + +/** + * Thos method should be used to check if given string is valid iban object + * + * @method isValid + * @param {String} iban string + * @return {Boolean} true if it is valid IBAN + */ +Iban.isValid = function (iban) { + var i = new Iban(iban); + return i.isValid(); +}; + +/** + * Should be called to check if iban is correct * * @method isValid * @returns {Boolean} true if it is, otherwise false */ -ICAP.prototype.isValid = function () { - return utils.isIBAN(this._iban); +Iban.prototype.isValid = function () { + return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30})$/.test(this._iban) && + mod9710(iso13616Prepare(this._iban)) === 1; }; /** @@ -3487,8 +4299,8 @@ ICAP.prototype.isValid = function () { * @method isDirect * @returns {Boolean} true if it is, otherwise false */ -ICAP.prototype.isDirect = function () { - return this._iban.length === 34; +Iban.prototype.isDirect = function () { + return this._iban.length === 34 || this._iban.length === 35; }; /** @@ -3497,7 +4309,7 @@ ICAP.prototype.isDirect = function () { * @method isIndirect * @returns {Boolean} true if it is, otherwise false */ -ICAP.prototype.isIndirect = function () { +Iban.prototype.isIndirect = function () { return this._iban.length === 20; }; @@ -3508,7 +4320,7 @@ ICAP.prototype.isIndirect = function () { * @method checksum * @returns {String} checksum */ -ICAP.prototype.checksum = function () { +Iban.prototype.checksum = function () { return this._iban.substr(2, 2); }; @@ -3519,7 +4331,7 @@ ICAP.prototype.checksum = function () { * @method institution * @returns {String} institution identifier */ -ICAP.prototype.institution = function () { +Iban.prototype.institution = function () { return this.isIndirect() ? this._iban.substr(7, 4) : ''; }; @@ -3530,7 +4342,7 @@ ICAP.prototype.institution = function () { * @method client * @returns {String} client identifier */ -ICAP.prototype.client = function () { +Iban.prototype.client = function () { return this.isIndirect() ? this._iban.substr(11) : ''; }; @@ -3540,14 +4352,24 @@ ICAP.prototype.client = function () { * @method address * @returns {String} client direct address */ -ICAP.prototype.address = function () { - return this.isDirect() ? this._iban.substr(4) : ''; +Iban.prototype.address = function () { + if (this.isDirect()) { + var base36 = this._iban.substr(4); + var asBn = new BigNumber(base36, 36); + return padLeft(asBn.toString(16), 20); + } + + return ''; }; -module.exports = ICAP; +Iban.prototype.toString = function () { + return this._iban; +}; + +module.exports = Iban; -},{"../utils/utils":7}],22:[function(require,module,exports){ +},{"bignumber.js":"bignumber.js"}],33:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -3575,16 +4397,23 @@ module.exports = ICAP; var utils = require('../utils/utils'); var errors = require('./errors'); -var errorTimeout = '{"jsonrpc": "2.0", "error": {"code": -32603, "message": "IPC Request timed out for method \'__method__\'"}, "id": "__id__"}'; - +var errorTimeout = function (method, id) { + var err = { + "jsonrpc": "2.0", + "error": { + "code": -32603, + "message": "IPC Request timed out for method \'" + method + "\'" + }, + "id": id + }; + return JSON.stringify(err); +}; var IpcProvider = function (path, net) { var _this = this; this.responseCallbacks = {}; this.path = path; - net = net || require('net'); - this.connection = net.connect({path: this.path}); this.connection.on('error', function(e){ @@ -3701,7 +4530,7 @@ Timeout all requests when the end/error event is fired IpcProvider.prototype._timeout = function() { for(var key in this.responseCallbacks) { if(this.responseCallbacks.hasOwnProperty(key)){ - this.responseCallbacks[key](errorTimeout.replace('__id__', key).replace('__method__', this.responseCallbacks[key].method)); + this.responseCallbacks[key](errorTimeout(this.responseCallbacks[key].method, key)); delete this.responseCallbacks[key]; } } @@ -3760,7 +4589,7 @@ IpcProvider.prototype.sendAsync = function (payload, callback) { module.exports = IpcProvider; -},{"../utils/utils":7,"./errors":14,"net":32}],23:[function(require,module,exports){ +},{"../utils/utils":20,"./errors":26}],34:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -3853,7 +4682,7 @@ Jsonrpc.prototype.toBatchPayload = function (messages) { module.exports = Jsonrpc; -},{}],24:[function(require,module,exports){ +},{}],35:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -4027,7 +4856,7 @@ Method.prototype.send = function () { module.exports = Method; -},{"../utils/utils":7,"./errors":14,"./requestmanager":28}],25:[function(require,module,exports){ +},{"../utils/utils":20,"./errors":26,"./requestmanager":43}],36:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -4044,38 +4873,341 @@ module.exports = Method; You should have received a copy of the GNU Lesser General Public License along with ethereum.js. If not, see . */ -/** - * @file namereg.js - * @author Marek Kotewicz +/** @file db.js + * @authors: + * Marek Kotewicz * @date 2015 */ -var contract = require('./contract'); +var Method = require('../method'); -var address = '0xc6d9d2cd449a754c494264e1809c50e34d64562b'; +var putString = new Method({ + name: 'putString', + call: 'db_putString', + params: 3 +}); -var abi = [ - {"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"name","outputs":[{"name":"o_name","type":"bytes32"}],"type":"function"}, - {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"owner","outputs":[{"name":"","type":"address"}],"type":"function"}, - {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"content","outputs":[{"name":"","type":"bytes32"}],"type":"function"}, - {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"addr","outputs":[{"name":"","type":"address"}],"type":"function"}, - {"constant":false,"inputs":[{"name":"_name","type":"bytes32"}],"name":"reserve","outputs":[],"type":"function"}, - {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"subRegistrar","outputs":[{"name":"o_subRegistrar","type":"address"}],"type":"function"}, - {"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_newOwner","type":"address"}],"name":"transfer","outputs":[],"type":"function"}, - {"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_registrar","type":"address"}],"name":"setSubRegistrar","outputs":[],"type":"function"}, - {"constant":false,"inputs":[],"name":"Registrar","outputs":[],"type":"function"}, - {"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_a","type":"address"},{"name":"_primary","type":"bool"}],"name":"setAddress","outputs":[],"type":"function"}, - {"constant":false,"inputs":[{"name":"_name","type":"bytes32"},{"name":"_content","type":"bytes32"}],"name":"setContent","outputs":[],"type":"function"}, - {"constant":false,"inputs":[{"name":"_name","type":"bytes32"}],"name":"disown","outputs":[],"type":"function"}, - {"constant":true,"inputs":[{"name":"_name","type":"bytes32"}],"name":"register","outputs":[{"name":"","type":"address"}],"type":"function"}, - {"anonymous":false,"inputs":[{"indexed":true,"name":"name","type":"bytes32"}],"name":"Changed","type":"event"}, - {"anonymous":false,"inputs":[{"indexed":true,"name":"name","type":"bytes32"},{"indexed":true,"name":"addr","type":"address"}],"name":"PrimaryChanged","type":"event"} + +var getString = new Method({ + name: 'getString', + call: 'db_getString', + params: 2 +}); + +var putHex = new Method({ + name: 'putHex', + call: 'db_putHex', + params: 3 +}); + +var getHex = new Method({ + name: 'getHex', + call: 'db_getHex', + params: 2 +}); + +var methods = [ + putString, getString, putHex, getHex ]; -module.exports = contract(abi).at(address); +module.exports = { + methods: methods +}; + +},{"../method":35}],37:[function(require,module,exports){ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** + * @file eth.js + * @author Marek Kotewicz + * @author Fabian Vogelsteller + * @date 2015 + */ + +/** + * Web3 + * + * @module web3 + */ + +/** + * Eth methods and properties + * + * An example method object can look as follows: + * + * { + * name: 'getBlock', + * call: blockCall, + * params: 2, + * outputFormatter: formatters.outputBlockFormatter, + * inputFormatter: [ // can be a formatter funciton or an array of functions. Where each item in the array will be used for one parameter + * utils.toHex, // formats paramter 1 + * function(param){ return !!param; } // formats paramter 2 + * ] + * }, + * + * @class [web3] eth + * @constructor + */ + +"use strict"; + +var formatters = require('../formatters'); +var utils = require('../../utils/utils'); +var Method = require('../method'); +var Property = require('../property'); + +var blockCall = function (args) { + return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockByHash" : "eth_getBlockByNumber"; +}; + +var transactionFromBlockCall = function (args) { + return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex'; +}; + +var uncleCall = function (args) { + return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex'; +}; + +var getBlockTransactionCountCall = function (args) { + return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber'; +}; + +var uncleCountCall = function (args) { + return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber'; +}; + +/// @returns an array of objects describing web3.eth api methods + +var getBalance = new Method({ + name: 'getBalance', + call: 'eth_getBalance', + params: 2, + inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter], + outputFormatter: formatters.outputBigNumberFormatter +}); + +var getStorageAt = new Method({ + name: 'getStorageAt', + call: 'eth_getStorageAt', + params: 3, + inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter] +}); + +var getCode = new Method({ + name: 'getCode', + call: 'eth_getCode', + params: 2, + inputFormatter: [formatters.inputAddressFormatter, formatters.inputDefaultBlockNumberFormatter] +}); + +var getBlock = new Method({ + name: 'getBlock', + call: blockCall, + params: 2, + inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }], + outputFormatter: formatters.outputBlockFormatter +}); + +var getUncle = new Method({ + name: 'getUncle', + call: uncleCall, + params: 2, + inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex], + outputFormatter: formatters.outputBlockFormatter, + +}); + +var getCompilers = new Method({ + name: 'getCompilers', + call: 'eth_getCompilers', + params: 0 +}); + +var getBlockTransactionCount = new Method({ + name: 'getBlockTransactionCount', + call: getBlockTransactionCountCall, + params: 1, + inputFormatter: [formatters.inputBlockNumberFormatter], + outputFormatter: utils.toDecimal +}); + +var getBlockUncleCount = new Method({ + name: 'getBlockUncleCount', + call: uncleCountCall, + params: 1, + inputFormatter: [formatters.inputBlockNumberFormatter], + outputFormatter: utils.toDecimal +}); + +var getTransaction = new Method({ + name: 'getTransaction', + call: 'eth_getTransactionByHash', + params: 1, + outputFormatter: formatters.outputTransactionFormatter +}); + +var getTransactionFromBlock = new Method({ + name: 'getTransactionFromBlock', + call: transactionFromBlockCall, + params: 2, + inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex], + outputFormatter: formatters.outputTransactionFormatter +}); + +var getTransactionReceipt = new Method({ + name: 'getTransactionReceipt', + call: 'eth_getTransactionReceipt', + params: 1, + outputFormatter: formatters.outputTransactionReceiptFormatter +}); + +var getTransactionCount = new Method({ + name: 'getTransactionCount', + call: 'eth_getTransactionCount', + params: 2, + inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter], + outputFormatter: utils.toDecimal +}); + +var sendRawTransaction = new Method({ + name: 'sendRawTransaction', + call: 'eth_sendRawTransaction', + params: 1, + inputFormatter: [null] +}); + +var sendTransaction = new Method({ + name: 'sendTransaction', + call: 'eth_sendTransaction', + params: 1, + inputFormatter: [formatters.inputTransactionFormatter] +}); + +var call = new Method({ + name: 'call', + call: 'eth_call', + params: 2, + inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter] +}); + +var estimateGas = new Method({ + name: 'estimateGas', + call: 'eth_estimateGas', + params: 1, + inputFormatter: [formatters.inputCallFormatter], + outputFormatter: utils.toDecimal +}); + +var compileSolidity = new Method({ + name: 'compile.solidity', + call: 'eth_compileSolidity', + params: 1 +}); + +var compileLLL = new Method({ + name: 'compile.lll', + call: 'eth_compileLLL', + params: 1 +}); + +var compileSerpent = new Method({ + name: 'compile.serpent', + call: 'eth_compileSerpent', + params: 1 +}); + +var submitWork = new Method({ + name: 'submitWork', + call: 'eth_submitWork', + params: 3 +}); + +var getWork = new Method({ + name: 'getWork', + call: 'eth_getWork', + params: 0 +}); + +var methods = [ + getBalance, + getStorageAt, + getCode, + getBlock, + getUncle, + getCompilers, + getBlockTransactionCount, + getBlockUncleCount, + getTransaction, + getTransactionFromBlock, + getTransactionReceipt, + getTransactionCount, + call, + estimateGas, + sendRawTransaction, + sendTransaction, + compileSolidity, + compileLLL, + compileSerpent, + submitWork, + getWork +]; + +/// @returns an array of objects describing web3.eth api properties -},{"./contract":12}],26:[function(require,module,exports){ + +var properties = [ + new Property({ + name: 'coinbase', + getter: 'eth_coinbase' + }), + new Property({ + name: 'mining', + getter: 'eth_mining' + }), + new Property({ + name: 'hashrate', + getter: 'eth_hashrate', + outputFormatter: utils.toDecimal + }), + new Property({ + name: 'gasPrice', + getter: 'eth_gasPrice', + outputFormatter: formatters.outputBigNumberFormatter + }), + new Property({ + name: 'accounts', + getter: 'eth_accounts' + }), + new Property({ + name: 'blockNumber', + getter: 'eth_blockNumber', + outputFormatter: utils.toDecimal + }) +]; + +module.exports = { + methods: methods, + properties: properties +}; + + +},{"../../utils/utils":20,"../formatters":29,"../method":35,"../property":42}],38:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -4098,8 +5230,8 @@ module.exports = contract(abi).at(address); * @date 2015 */ -var utils = require('../utils/utils'); -var Property = require('./property'); +var utils = require('../../utils/utils'); +var Property = require('../property'); /// @returns an array of objects describing web3.eth api methods var methods = [ @@ -4125,7 +5257,229 @@ module.exports = { }; -},{"../utils/utils":7,"./property":27}],27:[function(require,module,exports){ +},{"../../utils/utils":20,"../property":42}],39:[function(require,module,exports){ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file shh.js + * @authors: + * Marek Kotewicz + * @date 2015 + */ + +var Method = require('../method'); +var formatters = require('../formatters'); + +var post = new Method({ + name: 'post', + call: 'shh_post', + params: 1, + inputFormatter: [formatters.inputPostFormatter] +}); + +var newIdentity = new Method({ + name: 'newIdentity', + call: 'shh_newIdentity', + params: 0 +}); + +var hasIdentity = new Method({ + name: 'hasIdentity', + call: 'shh_hasIdentity', + params: 1 +}); + +var newGroup = new Method({ + name: 'newGroup', + call: 'shh_newGroup', + params: 0 +}); + +var addToGroup = new Method({ + name: 'addToGroup', + call: 'shh_addToGroup', + params: 0 +}); + +var methods = [ + post, + newIdentity, + hasIdentity, + newGroup, + addToGroup +]; + +module.exports = { + methods: methods +}; + + +},{"../formatters":29,"../method":35}],40:[function(require,module,exports){ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** @file watches.js + * @authors: + * Marek Kotewicz + * @date 2015 + */ + +var Method = require('../method'); + +/// @returns an array of objects describing web3.eth.filter api methods +var eth = function () { + var newFilterCall = function (args) { + var type = args[0]; + + switch(type) { + case 'latest': + args.shift(); + this.params = 0; + return 'eth_newBlockFilter'; + case 'pending': + args.shift(); + this.params = 0; + return 'eth_newPendingTransactionFilter'; + default: + return 'eth_newFilter'; + } + }; + + var newFilter = new Method({ + name: 'newFilter', + call: newFilterCall, + params: 1 + }); + + var uninstallFilter = new Method({ + name: 'uninstallFilter', + call: 'eth_uninstallFilter', + params: 1 + }); + + var getLogs = new Method({ + name: 'getLogs', + call: 'eth_getFilterLogs', + params: 1 + }); + + var poll = new Method({ + name: 'poll', + call: 'eth_getFilterChanges', + params: 1 + }); + + return [ + newFilter, + uninstallFilter, + getLogs, + poll + ]; +}; + +/// @returns an array of objects describing web3.shh.watch api methods +var shh = function () { + var newFilter = new Method({ + name: 'newFilter', + call: 'shh_newFilter', + params: 1 + }); + + var uninstallFilter = new Method({ + name: 'uninstallFilter', + call: 'shh_uninstallFilter', + params: 1 + }); + + var getLogs = new Method({ + name: 'getLogs', + call: 'shh_getMessages', + params: 1 + }); + + var poll = new Method({ + name: 'poll', + call: 'shh_getFilterChanges', + params: 1 + }); + + return [ + newFilter, + uninstallFilter, + getLogs, + poll + ]; +}; + +module.exports = { + eth: eth, + shh: shh +}; + + +},{"../method":35}],41:[function(require,module,exports){ +/* + This file is part of ethereum.js. + + ethereum.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ethereum.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with ethereum.js. If not, see . +*/ +/** + * @file namereg.js + * @author Marek Kotewicz + * @date 2015 + */ + +var contract = require('./contract'); +var globalRegistrarAbi = require('../contracts/GlobalRegistrar.json'); +var icapRegistrarAbi= require('../contracts/ICAPRegistrar.json'); + +var globalNameregAddress = '0xc6d9d2cd449a754c494264e1809c50e34d64562b'; +var ibanNameregAddress = '0xa1a111bc074c9cfa781f0c38e63bd51c91b8af00'; + +module.exports = { + namereg: contract(globalRegistrarAbi).at(globalNameregAddress), + ibanNamereg: contract(icapRegistrarAbi).at(ibanNameregAddress) +}; + + +},{"../contracts/GlobalRegistrar.json":1,"../contracts/ICAPRegistrar.json":2,"./contract":25}],42:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -4277,7 +5631,7 @@ Property.prototype.request = function () { module.exports = Property; -},{"../utils/utils":7,"./requestmanager":28}],28:[function(require,module,exports){ +},{"../utils/utils":20,"./requestmanager":43}],43:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -4427,8 +5781,6 @@ RequestManager.prototype.setProvider = function (p) { } }; -/*jshint maxparams:4 */ - /** * Should be used to start polling * @@ -4441,9 +5793,8 @@ RequestManager.prototype.setProvider = function (p) { * @todo cleanup number of params */ RequestManager.prototype.startPolling = function (data, pollId, callback, uninstall) { - this.polls['poll_'+ pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall}; + this.polls[pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall}; }; -/*jshint maxparams:3 */ /** * Should be used to stop polling for filter with given id @@ -4452,7 +5803,7 @@ RequestManager.prototype.startPolling = function (data, pollId, callback, uninst * @param {Number} pollId */ RequestManager.prototype.stopPolling = function (pollId) { - delete this.polls['poll_'+ pollId]; + delete this.polls[pollId]; }; /** @@ -4542,77 +5893,7 @@ RequestManager.prototype.poll = function () { module.exports = RequestManager; -},{"../utils/config":5,"../utils/utils":7,"./errors":14,"./jsonrpc":23}],29:[function(require,module,exports){ -/* - This file is part of ethereum.js. - - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** @file shh.js - * @authors: - * Marek Kotewicz - * @date 2015 - */ - -var Method = require('./method'); -var formatters = require('./formatters'); - -var post = new Method({ - name: 'post', - call: 'shh_post', - params: 1, - inputFormatter: [formatters.inputPostFormatter] -}); - -var newIdentity = new Method({ - name: 'newIdentity', - call: 'shh_newIdentity', - params: 0 -}); - -var hasIdentity = new Method({ - name: 'hasIdentity', - call: 'shh_hasIdentity', - params: 1 -}); - -var newGroup = new Method({ - name: 'newGroup', - call: 'shh_newGroup', - params: 0 -}); - -var addToGroup = new Method({ - name: 'addToGroup', - call: 'shh_addToGroup', - params: 0 -}); - -var methods = [ - post, - newIdentity, - hasIdentity, - newGroup, - addToGroup -]; - -module.exports = { - methods: methods -}; - - -},{"./formatters":18,"./method":24}],30:[function(require,module,exports){ +},{"../utils/config":18,"../utils/utils":20,"./errors":26,"./jsonrpc":34}],44:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -4636,36 +5917,37 @@ module.exports = { */ var web3 = require('../web3'); -var ICAP = require('./icap'); -var namereg = require('./namereg'); +var Iban = require('./iban'); +var namereg = require('./namereg').ibanNamereg; var contract = require('./contract'); +var exchangeAbi = require('../contracts/SmartExchange.json'); /** - * Should be used to make ICAP transfer + * Should be used to make Iban transfer * * @method transfer - * @param {String} iban number - * @param {String} from (address) + * @param {String} from + * @param {String} to iban * @param {Value} value to be tranfered * @param {Function} callback, callback */ -var transfer = function (from, iban, value, callback) { - var icap = new ICAP(iban); - if (!icap.isValid()) { +var transfer = function (from, to, value, callback) { + var iban = new Iban(to); + if (!iban.isValid()) { throw new Error('invalid iban address'); } - if (icap.isDirect()) { - return transferToAddress(from, icap.address(), value, callback); + if (iban.isDirect()) { + return transferToAddress(from, iban.address(), value, callback); } if (!callback) { - var address = namereg.addr(icap.institution()); - return deposit(from, address, value, icap.client()); + var address = namereg.addr(iban.institution()); + return deposit(from, address, value, iban.client()); } - namereg.addr(icap.insitution(), function (err, address) { - return deposit(from, address, value, icap.client(), callback); + namereg.addr(iban.institution(), function (err, address) { + return deposit(from, address, value, iban.client(), callback); }); }; @@ -4674,14 +5956,14 @@ var transfer = function (from, iban, value, callback) { * Should be used to transfer funds to certain address * * @method transferToAddress - * @param {String} address - * @param {String} from (address) + * @param {String} from + * @param {String} to * @param {Value} value to be tranfered * @param {Function} callback, callback */ -var transferToAddress = function (from, address, value, callback) { +var transferToAddress = function (from, to, value, callback) { return web3.eth.sendTransaction({ - address: address, + address: to, from: from, value: value }, callback); @@ -4691,15 +5973,15 @@ var transferToAddress = function (from, address, value, callback) { * Should be used to deposit funds to generic Exchange contract (must implement deposit(bytes32) method!) * * @method deposit - * @param {String} address - * @param {String} from (address) - * @param {Value} value to be tranfered + * @param {String} from + * @param {String} to + * @param {Value} value to be transfered * @param {String} client unique identifier * @param {Function} callback, callback */ -var deposit = function (from, address, value, client, callback) { - var abi = [{"constant":false,"inputs":[{"name":"name","type":"bytes32"}],"name":"deposit","outputs":[],"type":"function"}]; - return contract(abi).at(address).deposit(client, { +var deposit = function (from, to, value, client, callback) { + var abi = exchangeAbi; + return contract(abi).at(to).deposit(client, { from: from, value: value }, callback); @@ -4708,125 +5990,9 @@ var deposit = function (from, address, value, client, callback) { module.exports = transfer; -},{"../web3":9,"./contract":12,"./icap":21,"./namereg":25}],31:[function(require,module,exports){ -/* - This file is part of ethereum.js. +},{"../contracts/SmartExchange.json":3,"../web3":22,"./contract":25,"./iban":32,"./namereg":41}],45:[function(require,module,exports){ - ethereum.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - ethereum.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . -*/ -/** @file watches.js - * @authors: - * Marek Kotewicz - * @date 2015 - */ - -var Method = require('./method'); - -/// @returns an array of objects describing web3.eth.filter api methods -var eth = function () { - var newFilterCall = function (args) { - var type = args[0]; - - switch(type) { - case 'latest': - args.shift(); - this.params = 0; - return 'eth_newBlockFilter'; - case 'pending': - args.shift(); - this.params = 0; - return 'eth_newPendingTransactionFilter'; - default: - return 'eth_newFilter'; - } - }; - - var newFilter = new Method({ - name: 'newFilter', - call: newFilterCall, - params: 1 - }); - - var uninstallFilter = new Method({ - name: 'uninstallFilter', - call: 'eth_uninstallFilter', - params: 1 - }); - - var getLogs = new Method({ - name: 'getLogs', - call: 'eth_getFilterLogs', - params: 1 - }); - - var poll = new Method({ - name: 'poll', - call: 'eth_getFilterChanges', - params: 1 - }); - - return [ - newFilter, - uninstallFilter, - getLogs, - poll - ]; -}; - -/// @returns an array of objects describing web3.shh.watch api methods -var shh = function () { - var newFilter = new Method({ - name: 'newFilter', - call: 'shh_newFilter', - params: 1 - }); - - var uninstallFilter = new Method({ - name: 'uninstallFilter', - call: 'shh_uninstallFilter', - params: 1 - }); - - var getLogs = new Method({ - name: 'getLogs', - call: 'shh_getMessages', - params: 1 - }); - - var poll = new Method({ - name: 'poll', - call: 'shh_getFilterChanges', - params: 1 - }); - - return [ - newFilter, - uninstallFilter, - getLogs, - poll - ]; -}; - -module.exports = { - eth: eth, - shh: shh -}; - - -},{"./method":24}],32:[function(require,module,exports){ - -},{}],33:[function(require,module,exports){ +},{}],46:[function(require,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS @@ -5569,7 +6735,7 @@ module.exports = { return CryptoJS; })); -},{}],34:[function(require,module,exports){ +},{}],47:[function(require,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS @@ -5893,7 +7059,7 @@ module.exports = { return CryptoJS.SHA3; })); -},{"./core":33,"./x64-core":35}],35:[function(require,module,exports){ +},{"./core":46,"./x64-core":48}],48:[function(require,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS @@ -6198,7 +7364,7 @@ module.exports = { return CryptoJS; })); -},{"./core":33}],"bignumber.js":[function(require,module,exports){ +},{"./core":46}],"bignumber.js":[function(require,module,exports){ 'use strict'; module.exports = BigNumber; // jshint ignore:line @@ -6206,13 +7372,16 @@ module.exports = BigNumber; // jshint ignore:line },{}],"web3":[function(require,module,exports){ var web3 = require('./lib/web3'); +var namereg = require('./lib/web3/namereg'); web3.providers.HttpProvider = require('./lib/web3/httpprovider'); web3.providers.IpcProvider = require('./lib/web3/ipcprovider'); web3.eth.contract = require('./lib/web3/contract'); -web3.eth.namereg = require('./lib/web3/namereg'); +web3.eth.namereg = namereg.namereg; +web3.eth.ibanNamereg = namereg.ibanNamereg; web3.eth.sendIBANTransaction = require('./lib/web3/transfer'); +web3.eth.iban = require('./lib/web3/iban'); // dont override global variable if (typeof window !== 'undefined' && typeof window.web3 === 'undefined') { @@ -6222,6 +7391,6 @@ if (typeof window !== 'undefined' && typeof window.web3 === 'undefined') { module.exports = web3; -},{"./lib/web3":9,"./lib/web3/contract":12,"./lib/web3/httpprovider":20,"./lib/web3/ipcprovider":22,"./lib/web3/namereg":25,"./lib/web3/transfer":30}]},{},["web3"]) +},{"./lib/web3":22,"./lib/web3/contract":25,"./lib/web3/httpprovider":31,"./lib/web3/iban":32,"./lib/web3/ipcprovider":33,"./lib/web3/namereg":41,"./lib/web3/transfer":44}]},{},["web3"]) //# sourceMappingURL=web3-light.js.map ` From 9cacec70f9af77aaf9bf7f48b90f16ebc6d36298 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 11 Aug 2015 00:27:30 +0200 Subject: [PATCH 28/90] cmd/evm, core/vm, tests: changed DisableVm to EnableVm --- cmd/evm/main.go | 2 +- cmd/utils/flags.go | 2 +- core/block_processor.go | 12 +----------- core/vm/jit_test.go | 2 +- core/vm/settings.go | 6 +++--- core/vm/vm.go | 2 +- tests/state_test.go | 5 ++--- tests/state_test_util.go | 6 +++--- tests/vm_test.go | 5 +++-- tests/vm_test_util.go | 8 ++++---- 10 files changed, 20 insertions(+), 30 deletions(-) diff --git a/cmd/evm/main.go b/cmd/evm/main.go index be6546c953..6639069b99 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -102,7 +102,7 @@ func init() { func run(ctx *cli.Context) { vm.Debug = ctx.GlobalBool(DebugFlag.Name) vm.ForceJit = ctx.GlobalBool(ForceJitFlag.Name) - vm.DisableJit = ctx.GlobalBool(DisableJitFlag.Name) + vm.EnableJit = !ctx.GlobalBool(DisableJitFlag.Name) glog.SetToStderr(true) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 462da93059..f9bc3ed4dc 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -452,7 +452,7 @@ func SetupLogger(ctx *cli.Context) { // SetupVM configured the VM package's global settings func SetupVM(ctx *cli.Context) { - vm.DisableJit = !ctx.GlobalBool(VMEnableJitFlag.Name) + vm.EnableJit = ctx.GlobalBool(VMEnableJitFlag.Name) vm.ForceJit = ctx.GlobalBool(VMForceJitFlag.Name) vm.SetJITCacheSize(ctx.GlobalInt(VMJitCacheFlag.Name)) } diff --git a/core/block_processor.go b/core/block_processor.go index 4772153563..829e4314c3 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -354,18 +354,8 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro for _, receipt := range receipts { logs = append(logs, receipt.Logs()...) } - return } - - // TODO: remove backward compatibility - var ( - parent = sm.bc.GetBlock(block.ParentHash()) - state = state.New(parent.Root(), sm.chainDb) - ) - - sm.TransitionState(state, parent, block, true) - - return state.Logs(), nil + return logs, nil } // See YP section 4.3.4. "Block Header Validity" diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go index 5b3feea992..b9e2c69999 100644 --- a/core/vm/jit_test.go +++ b/core/vm/jit_test.go @@ -46,7 +46,7 @@ func runVmBench(test vmBench, b *testing.B) { } env := NewEnv() - DisableJit = test.nojit + EnableJit = !test.nojit ForceJit = test.forcejit b.ResetTimer() diff --git a/core/vm/settings.go b/core/vm/settings.go index 0cd931b6ae..f9296f6c8b 100644 --- a/core/vm/settings.go +++ b/core/vm/settings.go @@ -17,9 +17,9 @@ package vm var ( - DisableJit bool = true // Disable the JIT VM - ForceJit bool // Force the JIT, skip byte VM - MaxProgSize int // Max cache size for JIT Programs + EnableJit bool // Enables the JIT VM + ForceJit bool // Force the JIT, skip byte VM + MaxProgSize int // Max cache size for JIT Programs ) const defaultJitMaxCache int = 64 diff --git a/core/vm/vm.go b/core/vm/vm.go index c292b45d1a..da764004ad 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -64,7 +64,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { codehash = crypto.Sha3Hash(context.Code) // codehash is used when doing jump dest caching program *Program ) - if !DisableJit { + if EnableJit { // Fetch program status. // * If ready run using JIT // * If unknown, compile in a seperate goroutine diff --git a/tests/state_test.go b/tests/state_test.go index eb1900e1b8..7090b05410 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -27,14 +27,13 @@ import ( func init() { if os.Getenv("JITVM") == "true" { vm.ForceJit = true - } else { - vm.DisableJit = true + vm.EnableJit = true } } func BenchmarkStateCall1024(b *testing.B) { fn := filepath.Join(stateTestDir, "stCallCreateCallCodeTest.json") - if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, false}, b); err != nil { + if err := BenchVmTest(fn, bconf{"Call1024BalanceTooLow", true, os.Getenv("JITVM") == "true"}, b); err != nil { b.Error(err) } } diff --git a/tests/state_test_util.go b/tests/state_test_util.go index 695e508522..def9b0c36d 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -71,8 +71,8 @@ func BenchStateTest(p string, conf bconf, b *testing.B) error { return fmt.Errorf("test not found: %s", conf.name) } - pNoJit := vm.DisableJit - vm.DisableJit = conf.nojit + pJit := vm.EnableJit + vm.EnableJit = conf.jit pForceJit := vm.ForceJit vm.ForceJit = conf.precomp @@ -94,7 +94,7 @@ func BenchStateTest(p string, conf bconf, b *testing.B) error { benchStateTest(test, env, b) } - vm.DisableJit = pNoJit + vm.EnableJit = pJit vm.ForceJit = pForceJit return nil diff --git a/tests/vm_test.go b/tests/vm_test.go index afa1424d57..96718db3ce 100644 --- a/tests/vm_test.go +++ b/tests/vm_test.go @@ -17,20 +17,21 @@ package tests import ( + "os" "path/filepath" "testing" ) func BenchmarkVmAckermann32Tests(b *testing.B) { fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") - if err := BenchVmTest(fn, bconf{"ackermann32", true, false}, b); err != nil { + if err := BenchVmTest(fn, bconf{"ackermann32", true, os.Getenv("JITVM") == "true"}, b); err != nil { b.Error(err) } } func BenchmarkVmFibonacci16Tests(b *testing.B) { fn := filepath.Join(vmTestDir, "vmPerformanceTest.json") - if err := BenchVmTest(fn, bconf{"fibonacci16", true, false}, b); err != nil { + if err := BenchVmTest(fn, bconf{"fibonacci16", true, os.Getenv("JITVM") == "true"}, b); err != nil { b.Error(err) } } diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go index b29dcd20f6..71a4f5e335 100644 --- a/tests/vm_test_util.go +++ b/tests/vm_test_util.go @@ -52,7 +52,7 @@ func RunVmTestWithReader(r io.Reader, skipTests []string) error { type bconf struct { name string precomp bool - nojit bool + jit bool } func BenchVmTest(p string, conf bconf, b *testing.B) error { @@ -67,8 +67,8 @@ func BenchVmTest(p string, conf bconf, b *testing.B) error { return fmt.Errorf("test not found: %s", conf.name) } - pNoJit := vm.DisableJit - vm.DisableJit = conf.nojit + pJit := vm.EnableJit + vm.EnableJit = conf.jit pForceJit := vm.ForceJit vm.ForceJit = conf.precomp @@ -99,7 +99,7 @@ func BenchVmTest(p string, conf bconf, b *testing.B) error { benchVmTest(test, env, b) } - vm.DisableJit = pNoJit + vm.EnableJit = pJit vm.ForceJit = pForceJit return nil From 0ef80bb3d05ecb44297d25c889a85555bc55ef0c Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 11 Aug 2015 17:14:46 +0100 Subject: [PATCH 29/90] cmd/geth, jsre: restore command line editing on windows PR #856 broke command line editing by wrapping stdout with a filter that interprets ANSI escape sequences to fix colored printing on windows. Implement the printer in Go instead so it can do its own platform-dependent coloring. As a nice side effect, the JS console is now noticeably more responsive when printing results. Fixes #1608 Fixes #1612 --- Godeps/Godeps.json | 18 +- .../src/github.com/fatih/color/.travis.yml | 3 + .../src/github.com/fatih/color/LICENSE.md | 20 + .../src/github.com/fatih/color/README.md | 151 +++++ .../src/github.com/fatih/color/color.go | 353 +++++++++++ .../src/github.com/fatih/color/color_test.go | 176 ++++++ .../src/github.com/fatih/color/doc.go | 114 ++++ .../github.com/mattn/go-colorable/README.md | 42 -- .../mattn/go-colorable/colorable_others.go | 16 - .../mattn/go-colorable/colorable_windows.go | 594 ------------------ .../github.com/shiena/ansicolor/.gitignore | 27 + .../src/github.com/shiena/ansicolor/LICENSE | 21 + .../src/github.com/shiena/ansicolor/README.md | 100 +++ .../github.com/shiena/ansicolor/ansicolor.go | 20 + .../shiena/ansicolor/ansicolor/main.go | 27 + .../shiena/ansicolor/ansicolor_ansi.go | 17 + .../shiena/ansicolor/ansicolor_test.go | 25 + .../shiena/ansicolor/ansicolor_windows.go | 351 +++++++++++ .../ansicolor/ansicolor_windows_test.go | 236 +++++++ .../shiena/ansicolor/example_test.go | 24 + .../shiena/ansicolor/export_test.go | 19 + cmd/geth/js.go | 39 +- cmd/geth/main.go | 19 - jsre/jsre.go | 33 +- jsre/jsre_test.go | 11 +- jsre/pp_js.go | 137 ---- jsre/pretty.go | 220 +++++++ 27 files changed, 1941 insertions(+), 872 deletions(-) create mode 100644 Godeps/_workspace/src/github.com/fatih/color/.travis.yml create mode 100644 Godeps/_workspace/src/github.com/fatih/color/LICENSE.md create mode 100644 Godeps/_workspace/src/github.com/fatih/color/README.md create mode 100644 Godeps/_workspace/src/github.com/fatih/color/color.go create mode 100644 Godeps/_workspace/src/github.com/fatih/color/color_test.go create mode 100644 Godeps/_workspace/src/github.com/fatih/color/doc.go delete mode 100644 Godeps/_workspace/src/github.com/mattn/go-colorable/README.md delete mode 100644 Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go delete mode 100644 Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/README.md create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go create mode 100644 Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go delete mode 100644 jsre/pp_js.go create mode 100644 jsre/pretty.go diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 199914baa4..d5c41227dc 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -24,14 +24,18 @@ "Comment": "v23.1-227-g8f6ccaa", "Rev": "8f6ccaaef9b418553807a73a95cb5f49cd3ea39f" }, + { + "ImportPath": "github.com/fatih/color", + "Comment": "v0.1-5-gf773d4c", + "Rev": "f773d4c806cc8e4a5749d6a35e2a4bbcd71443d6" + }, { "ImportPath": "github.com/gizak/termui", "Rev": "bab8dce01c193d82bc04888a0a9a7814d505f532" }, { - "ImportPath": "github.com/howeyc/fsnotify", - "Comment": "v0.9.0-11-g6b1ef89", - "Rev": "6b1ef893dc11e0447abda6da20a5203481878dda" + "ImportPath": "github.com/hashicorp/golang-lru", + "Rev": "7f9ef20a0256f494e24126014135cf893ab71e9e" }, { "ImportPath": "github.com/huin/goupnp", @@ -45,10 +49,6 @@ "ImportPath": "github.com/kardianos/osext", "Rev": "ccfcd0245381f0c94c68f50626665eed3c6b726a" }, - { - "ImportPath": "github.com/mattn/go-colorable", - "Rev": "043ae16291351db8465272edf465c9f388161627" - }, { "ImportPath": "github.com/mattn/go-isatty", "Rev": "fdbe02a1b44e75977b2690062b83cf507d70c013" @@ -78,6 +78,10 @@ "ImportPath": "github.com/rs/cors", "Rev": "6e0c3cb65fc0fdb064c743d176a620e3ca446dfb" }, + { + "ImportPath": "github.com/shiena/ansicolor", + "Rev": "a5e2b567a4dd6cc74545b8a4f27c9d63b9e7735b" + }, { "ImportPath": "github.com/syndtr/goleveldb/leveldb", "Rev": "4875955338b0a434238a31165cb87255ab6e9e4a" diff --git a/Godeps/_workspace/src/github.com/fatih/color/.travis.yml b/Godeps/_workspace/src/github.com/fatih/color/.travis.yml new file mode 100644 index 0000000000..2405aef3a8 --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/.travis.yml @@ -0,0 +1,3 @@ +language: go +go: 1.3 + diff --git a/Godeps/_workspace/src/github.com/fatih/color/LICENSE.md b/Godeps/_workspace/src/github.com/fatih/color/LICENSE.md new file mode 100644 index 0000000000..25fdaf639d --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2013 Fatih Arslan + +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 SOFTWARE. diff --git a/Godeps/_workspace/src/github.com/fatih/color/README.md b/Godeps/_workspace/src/github.com/fatih/color/README.md new file mode 100644 index 0000000000..d6fb06a3e3 --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/README.md @@ -0,0 +1,151 @@ +# Color [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/fatih/color) [![Build Status](http://img.shields.io/travis/fatih/color.svg?style=flat-square)](https://travis-ci.org/fatih/color) + + + +Color lets you use colorized outputs in terms of [ANSI Escape Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It has support for Windows too! The API can be used in several ways, pick one that suits you. + + + +![Color](http://i.imgur.com/c1JI0lA.png) + + +## Install + +```bash +go get github.com/fatih/color +``` + +## Examples + +### Standard colors + +```go +// Print with default helper functions +color.Cyan("Prints text in cyan.") + +// A newline will be appended automatically +color.Blue("Prints %s in blue.", "text") + +// These are using the default foreground colors +color.Red("We have red") +color.Magenta("And many others ..") + +``` + +### Mix and reuse colors + +```go +// Create a new color object +c := color.New(color.FgCyan).Add(color.Underline) +c.Println("Prints cyan text with an underline.") + +// Or just add them to New() +d := color.New(color.FgCyan, color.Bold) +d.Printf("This prints bold cyan %s\n", "too!.") + +// Mix up foreground and background colors, create new mixes! +red := color.New(color.FgRed) + +boldRed := red.Add(color.Bold) +boldRed.Println("This will print text in bold red.") + +whiteBackground := red.Add(color.BgWhite) +whiteBackground.Println("Red text with white background.") +``` + +### Custom print functions (PrintFunc) + +```go +// Create a custom print function for convenience +red := color.New(color.FgRed).PrintfFunc() +red("Warning") +red("Error: %s", err) + +// Mix up multiple attributes +notice := color.New(color.Bold, color.FgGreen).PrintlnFunc() +notice("Don't forget this...") +``` + +### Insert into noncolor strings (SprintFunc) + +```go +// Create SprintXxx functions to mix strings with other non-colorized strings: +yellow := color.New(color.FgYellow).SprintFunc() +red := color.New(color.FgRed).SprintFunc() +fmt.Printf("This is a %s and this is %s.\n", yellow("warning"), red("error")) + +info := color.New(color.FgWhite, color.BgGreen).SprintFunc() +fmt.Printf("This %s rocks!\n", info("package")) + +// Use helper functions +fmt.Printf("This", color.RedString("warning"), "should be not neglected.") +fmt.Printf(color.GreenString("Info:"), "an important message." ) + +// Windows supported too! Just don't forget to change the output to color.Output +fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS")) +``` + +### Plug into existing code + +```go +// Use handy standard colors +color.Set(color.FgYellow) + +fmt.Println("Existing text will now be in yellow") +fmt.Printf("This one %s\n", "too") + +color.Unset() // Don't forget to unset + +// You can mix up parameters +color.Set(color.FgMagenta, color.Bold) +defer color.Unset() // Use it in your function + +fmt.Println("All text will now be bold magenta.") +``` + +### Disable color + +There might be a case where you want to disable color output (for example to +pipe the standard output of your app to somewhere else). `Color` has support to +disable colors both globally and for single color definition. For example +suppose you have a CLI app and a `--no-color` bool flag. You can easily disable +the color output with: + +```go + +var flagNoColor = flag.Bool("no-color", false, "Disable color output") + +if *flagNoColor { + color.NoColor = true // disables colorized output +} +``` + +It also has support for single color definitions (local). You can +disable/enable color output on the fly: + +```go +c := color.New(color.FgCyan) +c.Println("Prints cyan text") + +c.DisableColor() +c.Println("This is printed without any color") + +c.EnableColor() +c.Println("This prints again cyan...") +``` + +## Todo + +* Save/Return previous values +* Evaluate fmt.Formatter interface + + +## Credits + + * [Fatih Arslan](https://github.com/fatih) + * Windows support via @shiena: [ansicolor](https://github.com/shiena/ansicolor) + +## License + +The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) for more details + diff --git a/Godeps/_workspace/src/github.com/fatih/color/color.go b/Godeps/_workspace/src/github.com/fatih/color/color.go new file mode 100644 index 0000000000..c4a10c3c8d --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/color.go @@ -0,0 +1,353 @@ +package color + +import ( + "fmt" + "os" + "strconv" + "strings" + + "github.com/mattn/go-isatty" + "github.com/shiena/ansicolor" +) + +// NoColor defines if the output is colorized or not. It's dynamically set to +// false or true based on the stdout's file descriptor referring to a terminal +// or not. This is a global option and affects all colors. For more control +// over each color block use the methods DisableColor() individually. +var NoColor = !isatty.IsTerminal(os.Stdout.Fd()) + +// Color defines a custom color object which is defined by SGR parameters. +type Color struct { + params []Attribute + noColor *bool +} + +// Attribute defines a single SGR Code +type Attribute int + +const escape = "\x1b" + +// Base attributes +const ( + Reset Attribute = iota + Bold + Faint + Italic + Underline + BlinkSlow + BlinkRapid + ReverseVideo + Concealed + CrossedOut +) + +// Foreground text colors +const ( + FgBlack Attribute = iota + 30 + FgRed + FgGreen + FgYellow + FgBlue + FgMagenta + FgCyan + FgWhite +) + +// Background text colors +const ( + BgBlack Attribute = iota + 40 + BgRed + BgGreen + BgYellow + BgBlue + BgMagenta + BgCyan + BgWhite +) + +// New returns a newly created color object. +func New(value ...Attribute) *Color { + c := &Color{params: make([]Attribute, 0)} + c.Add(value...) + return c +} + +// Set sets the given parameters immediately. It will change the color of +// output with the given SGR parameters until color.Unset() is called. +func Set(p ...Attribute) *Color { + c := New(p...) + c.Set() + return c +} + +// Unset resets all escape attributes and clears the output. Usually should +// be called after Set(). +func Unset() { + if NoColor { + return + } + + fmt.Fprintf(Output, "%s[%dm", escape, Reset) +} + +// Set sets the SGR sequence. +func (c *Color) Set() *Color { + if c.isNoColorSet() { + return c + } + + fmt.Fprintf(Output, c.format()) + return c +} + +func (c *Color) unset() { + if c.isNoColorSet() { + return + } + + Unset() +} + +// Add is used to chain SGR parameters. Use as many as parameters to combine +// and create custom color objects. Example: Add(color.FgRed, color.Underline). +func (c *Color) Add(value ...Attribute) *Color { + c.params = append(c.params, value...) + return c +} + +func (c *Color) prepend(value Attribute) { + c.params = append(c.params, 0) + copy(c.params[1:], c.params[0:]) + c.params[0] = value +} + +// Output defines the standard output of the print functions. By default +// os.Stdout is used. +var Output = ansicolor.NewAnsiColorWriter(os.Stdout) + +// Print formats using the default formats for its operands and writes to +// standard output. Spaces are added between operands when neither is a +// string. It returns the number of bytes written and any write error +// encountered. This is the standard fmt.Print() method wrapped with the given +// color. +func (c *Color) Print(a ...interface{}) (n int, err error) { + c.Set() + defer c.unset() + + return fmt.Fprint(Output, a...) +} + +// Printf formats according to a format specifier and writes to standard output. +// It returns the number of bytes written and any write error encountered. +// This is the standard fmt.Printf() method wrapped with the given color. +func (c *Color) Printf(format string, a ...interface{}) (n int, err error) { + c.Set() + defer c.unset() + + return fmt.Fprintf(Output, format, a...) +} + +// Println formats using the default formats for its operands and writes to +// standard output. Spaces are always added between operands and a newline is +// appended. It returns the number of bytes written and any write error +// encountered. This is the standard fmt.Print() method wrapped with the given +// color. +func (c *Color) Println(a ...interface{}) (n int, err error) { + c.Set() + defer c.unset() + + return fmt.Fprintln(Output, a...) +} + +// PrintFunc returns a new function that prints the passed arguments as +// colorized with color.Print(). +func (c *Color) PrintFunc() func(a ...interface{}) { + return func(a ...interface{}) { c.Print(a...) } +} + +// PrintfFunc returns a new function that prints the passed arguments as +// colorized with color.Printf(). +func (c *Color) PrintfFunc() func(format string, a ...interface{}) { + return func(format string, a ...interface{}) { c.Printf(format, a...) } +} + +// PrintlnFunc returns a new function that prints the passed arguments as +// colorized with color.Println(). +func (c *Color) PrintlnFunc() func(a ...interface{}) { + return func(a ...interface{}) { c.Println(a...) } +} + +// SprintFunc returns a new function that returns colorized strings for the +// given arguments with fmt.Sprint(). Useful to put into or mix into other +// string. Windows users should use this in conjuction with color.Output, example: +// +// put := New(FgYellow).SprintFunc() +// fmt.Fprintf(color.Output, "This is a %s", put("warning")) +func (c *Color) SprintFunc() func(a ...interface{}) string { + return func(a ...interface{}) string { + return c.wrap(fmt.Sprint(a...)) + } +} + +// SprintfFunc returns a new function that returns colorized strings for the +// given arguments with fmt.Sprintf(). Useful to put into or mix into other +// string. Windows users should use this in conjuction with color.Output. +func (c *Color) SprintfFunc() func(format string, a ...interface{}) string { + return func(format string, a ...interface{}) string { + return c.wrap(fmt.Sprintf(format, a...)) + } +} + +// SprintlnFunc returns a new function that returns colorized strings for the +// given arguments with fmt.Sprintln(). Useful to put into or mix into other +// string. Windows users should use this in conjuction with color.Output. +func (c *Color) SprintlnFunc() func(a ...interface{}) string { + return func(a ...interface{}) string { + return c.wrap(fmt.Sprintln(a...)) + } +} + +// sequence returns a formated SGR sequence to be plugged into a "\x1b[...m" +// an example output might be: "1;36" -> bold cyan +func (c *Color) sequence() string { + format := make([]string, len(c.params)) + for i, v := range c.params { + format[i] = strconv.Itoa(int(v)) + } + + return strings.Join(format, ";") +} + +// wrap wraps the s string with the colors attributes. The string is ready to +// be printed. +func (c *Color) wrap(s string) string { + if c.isNoColorSet() { + return s + } + + return c.format() + s + c.unformat() +} + +func (c *Color) format() string { + return fmt.Sprintf("%s[%sm", escape, c.sequence()) +} + +func (c *Color) unformat() string { + return fmt.Sprintf("%s[%dm", escape, Reset) +} + +// DisableColor disables the color output. Useful to not change any existing +// code and still being able to output. Can be used for flags like +// "--no-color". To enable back use EnableColor() method. +func (c *Color) DisableColor() { + c.noColor = boolPtr(true) +} + +// EnableColor enables the color output. Use it in conjuction with +// DisableColor(). Otherwise this method has no side effects. +func (c *Color) EnableColor() { + c.noColor = boolPtr(false) +} + +func (c *Color) isNoColorSet() bool { + // check first if we have user setted action + if c.noColor != nil { + return *c.noColor + } + + // if not return the global option, which is disabled by default + return NoColor +} + +func boolPtr(v bool) *bool { + return &v +} + +// Black is an convenient helper function to print with black foreground. A +// newline is appended to format by default. +func Black(format string, a ...interface{}) { printColor(format, FgBlack, a...) } + +// Red is an convenient helper function to print with red foreground. A +// newline is appended to format by default. +func Red(format string, a ...interface{}) { printColor(format, FgRed, a...) } + +// Green is an convenient helper function to print with green foreground. A +// newline is appended to format by default. +func Green(format string, a ...interface{}) { printColor(format, FgGreen, a...) } + +// Yellow is an convenient helper function to print with yellow foreground. +// A newline is appended to format by default. +func Yellow(format string, a ...interface{}) { printColor(format, FgYellow, a...) } + +// Blue is an convenient helper function to print with blue foreground. A +// newline is appended to format by default. +func Blue(format string, a ...interface{}) { printColor(format, FgBlue, a...) } + +// Magenta is an convenient helper function to print with magenta foreground. +// A newline is appended to format by default. +func Magenta(format string, a ...interface{}) { printColor(format, FgMagenta, a...) } + +// Cyan is an convenient helper function to print with cyan foreground. A +// newline is appended to format by default. +func Cyan(format string, a ...interface{}) { printColor(format, FgCyan, a...) } + +// White is an convenient helper function to print with white foreground. A +// newline is appended to format by default. +func White(format string, a ...interface{}) { printColor(format, FgWhite, a...) } + +func printColor(format string, p Attribute, a ...interface{}) { + if !strings.HasSuffix(format, "\n") { + format += "\n" + } + + c := &Color{params: []Attribute{p}} + c.Printf(format, a...) +} + +// BlackString is an convenient helper function to return a string with black +// foreground. +func BlackString(format string, a ...interface{}) string { + return New(FgBlack).SprintfFunc()(format, a...) +} + +// RedString is an convenient helper function to return a string with red +// foreground. +func RedString(format string, a ...interface{}) string { + return New(FgRed).SprintfFunc()(format, a...) +} + +// GreenString is an convenient helper function to return a string with green +// foreground. +func GreenString(format string, a ...interface{}) string { + return New(FgGreen).SprintfFunc()(format, a...) +} + +// YellowString is an convenient helper function to return a string with yellow +// foreground. +func YellowString(format string, a ...interface{}) string { + return New(FgYellow).SprintfFunc()(format, a...) +} + +// BlueString is an convenient helper function to return a string with blue +// foreground. +func BlueString(format string, a ...interface{}) string { + return New(FgBlue).SprintfFunc()(format, a...) +} + +// MagentaString is an convenient helper function to return a string with magenta +// foreground. +func MagentaString(format string, a ...interface{}) string { + return New(FgMagenta).SprintfFunc()(format, a...) +} + +// CyanString is an convenient helper function to return a string with cyan +// foreground. +func CyanString(format string, a ...interface{}) string { + return New(FgCyan).SprintfFunc()(format, a...) +} + +// WhiteString is an convenient helper function to return a string with white +// foreground. +func WhiteString(format string, a ...interface{}) string { + return New(FgWhite).SprintfFunc()(format, a...) +} diff --git a/Godeps/_workspace/src/github.com/fatih/color/color_test.go b/Godeps/_workspace/src/github.com/fatih/color/color_test.go new file mode 100644 index 0000000000..a1192b559d --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/color_test.go @@ -0,0 +1,176 @@ +package color + +import ( + "bytes" + "fmt" + "os" + "testing" + + "github.com/shiena/ansicolor" +) + +// Testing colors is kinda different. First we test for given colors and their +// escaped formatted results. Next we create some visual tests to be tested. +// Each visual test includes the color name to be compared. +func TestColor(t *testing.T) { + rb := new(bytes.Buffer) + Output = rb + + testColors := []struct { + text string + code Attribute + }{ + {text: "black", code: FgBlack}, + {text: "red", code: FgRed}, + {text: "green", code: FgGreen}, + {text: "yellow", code: FgYellow}, + {text: "blue", code: FgBlue}, + {text: "magent", code: FgMagenta}, + {text: "cyan", code: FgCyan}, + {text: "white", code: FgWhite}, + } + + for _, c := range testColors { + New(c.code).Print(c.text) + + line, _ := rb.ReadString('\n') + scannedLine := fmt.Sprintf("%q", line) + colored := fmt.Sprintf("\x1b[%dm%s\x1b[0m", c.code, c.text) + escapedForm := fmt.Sprintf("%q", colored) + + fmt.Printf("%s\t: %s\n", c.text, line) + + if scannedLine != escapedForm { + t.Errorf("Expecting %s, got '%s'\n", escapedForm, scannedLine) + } + } +} + +func TestNoColor(t *testing.T) { + rb := new(bytes.Buffer) + Output = rb + + testColors := []struct { + text string + code Attribute + }{ + {text: "black", code: FgBlack}, + {text: "red", code: FgRed}, + {text: "green", code: FgGreen}, + {text: "yellow", code: FgYellow}, + {text: "blue", code: FgBlue}, + {text: "magent", code: FgMagenta}, + {text: "cyan", code: FgCyan}, + {text: "white", code: FgWhite}, + } + + for _, c := range testColors { + p := New(c.code) + p.DisableColor() + p.Print(c.text) + + line, _ := rb.ReadString('\n') + if line != c.text { + t.Errorf("Expecting %s, got '%s'\n", c.text, line) + } + } + + // global check + NoColor = true + defer func() { + NoColor = false + }() + for _, c := range testColors { + p := New(c.code) + p.Print(c.text) + + line, _ := rb.ReadString('\n') + if line != c.text { + t.Errorf("Expecting %s, got '%s'\n", c.text, line) + } + } + +} + +func TestColorVisual(t *testing.T) { + // First Visual Test + fmt.Println("") + Output = ansicolor.NewAnsiColorWriter(os.Stdout) + + New(FgRed).Printf("red\t") + New(BgRed).Print(" ") + New(FgRed, Bold).Println(" red") + + New(FgGreen).Printf("green\t") + New(BgGreen).Print(" ") + New(FgGreen, Bold).Println(" green") + + New(FgYellow).Printf("yellow\t") + New(BgYellow).Print(" ") + New(FgYellow, Bold).Println(" yellow") + + New(FgBlue).Printf("blue\t") + New(BgBlue).Print(" ") + New(FgBlue, Bold).Println(" blue") + + New(FgMagenta).Printf("magenta\t") + New(BgMagenta).Print(" ") + New(FgMagenta, Bold).Println(" magenta") + + New(FgCyan).Printf("cyan\t") + New(BgCyan).Print(" ") + New(FgCyan, Bold).Println(" cyan") + + New(FgWhite).Printf("white\t") + New(BgWhite).Print(" ") + New(FgWhite, Bold).Println(" white") + fmt.Println("") + + // Second Visual test + Black("black") + Red("red") + Green("green") + Yellow("yellow") + Blue("blue") + Magenta("magenta") + Cyan("cyan") + White("white") + + // Third visual test + fmt.Println() + Set(FgBlue) + fmt.Println("is this blue?") + Unset() + + Set(FgMagenta) + fmt.Println("and this magenta?") + Unset() + + // Fourth Visual test + fmt.Println() + blue := New(FgBlue).PrintlnFunc() + blue("blue text with custom print func") + + red := New(FgRed).PrintfFunc() + red("red text with a printf func: %d\n", 123) + + put := New(FgYellow).SprintFunc() + warn := New(FgRed).SprintFunc() + + fmt.Fprintf(Output, "this is a %s and this is %s.\n", put("warning"), warn("error")) + + info := New(FgWhite, BgGreen).SprintFunc() + fmt.Fprintf(Output, "this %s rocks!\n", info("package")) + + // Fifth Visual Test + fmt.Println() + + fmt.Fprintln(Output, BlackString("black")) + fmt.Fprintln(Output, RedString("red")) + fmt.Fprintln(Output, GreenString("green")) + fmt.Fprintln(Output, YellowString("yellow")) + fmt.Fprintln(Output, BlueString("blue")) + fmt.Fprintln(Output, MagentaString("magenta")) + fmt.Fprintln(Output, CyanString("cyan")) + fmt.Fprintln(Output, WhiteString("white")) +} diff --git a/Godeps/_workspace/src/github.com/fatih/color/doc.go b/Godeps/_workspace/src/github.com/fatih/color/doc.go new file mode 100644 index 0000000000..17908787c9 --- /dev/null +++ b/Godeps/_workspace/src/github.com/fatih/color/doc.go @@ -0,0 +1,114 @@ +/* +Package color is an ANSI color package to output colorized or SGR defined +output to the standard output. The API can be used in several way, pick one +that suits you. + +Use simple and default helper functions with predefined foreground colors: + + color.Cyan("Prints text in cyan.") + + // a newline will be appended automatically + color.Blue("Prints %s in blue.", "text") + + // More default foreground colors.. + color.Red("We have red") + color.Yellow("Yellow color too!") + color.Magenta("And many others ..") + +However there are times where custom color mixes are required. Below are some +examples to create custom color objects and use the print functions of each +separate color object. + + // Create a new color object + c := color.New(color.FgCyan).Add(color.Underline) + c.Println("Prints cyan text with an underline.") + + // Or just add them to New() + d := color.New(color.FgCyan, color.Bold) + d.Printf("This prints bold cyan %s\n", "too!.") + + + // Mix up foreground and background colors, create new mixes! + red := color.New(color.FgRed) + + boldRed := red.Add(color.Bold) + boldRed.Println("This will print text in bold red.") + + whiteBackground := red.Add(color.BgWhite) + whiteBackground.Println("Red text with White background.") + + +You can create PrintXxx functions to simplify even more: + + // Create a custom print function for convenient + red := color.New(color.FgRed).PrintfFunc() + red("warning") + red("error: %s", err) + + // Mix up multiple attributes + notice := color.New(color.Bold, color.FgGreen).PrintlnFunc() + notice("don't forget this...") + + +Or create SprintXxx functions to mix strings with other non-colorized strings: + + yellow := New(FgYellow).SprintFunc() + red := New(FgRed).SprintFunc() + + fmt.Printf("this is a %s and this is %s.\n", yellow("warning"), red("error")) + + info := New(FgWhite, BgGreen).SprintFunc() + fmt.Printf("this %s rocks!\n", info("package")) + +Windows support is enabled by default. All Print functions works as intended. +However only for color.SprintXXX functions, user should use fmt.FprintXXX and +set the output to color.Output: + + fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS")) + + info := New(FgWhite, BgGreen).SprintFunc() + fmt.Fprintf(color.Output, "this %s rocks!\n", info("package")) + +Using with existing code is possible. Just use the Set() method to set the +standard output to the given parameters. That way a rewrite of an existing +code is not required. + + // Use handy standard colors. + color.Set(color.FgYellow) + + fmt.Println("Existing text will be now in Yellow") + fmt.Printf("This one %s\n", "too") + + color.Unset() // don't forget to unset + + // You can mix up parameters + color.Set(color.FgMagenta, color.Bold) + defer color.Unset() // use it in your function + + fmt.Println("All text will be now bold magenta.") + +There might be a case where you want to disable color output (for example to +pipe the standard output of your app to somewhere else). `Color` has support to +disable colors both globally and for single color definition. For example +suppose you have a CLI app and a `--no-color` bool flag. You can easily disable +the color output with: + + var flagNoColor = flag.Bool("no-color", false, "Disable color output") + + if *flagNoColor { + color.NoColor = true // disables colorized output + } + +It also has support for single color definitions (local). You can +disable/enable color output on the fly: + + c := color.New(color.FgCyan) + c.Println("Prints cyan text") + + c.DisableColor() + c.Println("This is printed without any color") + + c.EnableColor() + c.Println("This prints again cyan...") +*/ +package color diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/README.md b/Godeps/_workspace/src/github.com/mattn/go-colorable/README.md deleted file mode 100644 index c69da4a761..0000000000 --- a/Godeps/_workspace/src/github.com/mattn/go-colorable/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# go-colorable - -Colorable writer for windows. - -For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) -This package is possible to handle escape sequence for ansi color on windows. - -## Too Bad! - -![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) - - -## So Good! - -![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) - -## Usage - -```go -logrus.SetOutput(colorable.NewColorableStdout()) - -logrus.Info("succeeded") -logrus.Warn("not correct") -logrus.Error("something error") -logrus.Fatal("panic") -``` - -You can compile above code on non-windows OSs. - -## Installation - -``` -$ go get github.com/mattn/go-colorable -``` - -# License - -MIT - -# Author - -Yasuhiro Matsumoto (a.k.a mattn) diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go b/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go deleted file mode 100644 index 219f02f62a..0000000000 --- a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_others.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build !windows - -package colorable - -import ( - "io" - "os" -) - -func NewColorableStdout() io.Writer { - return os.Stdout -} - -func NewColorableStderr() io.Writer { - return os.Stderr -} diff --git a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go b/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go deleted file mode 100644 index 6a27878088..0000000000 --- a/Godeps/_workspace/src/github.com/mattn/go-colorable/colorable_windows.go +++ /dev/null @@ -1,594 +0,0 @@ -package colorable - -import ( - "bytes" - "fmt" - "io" - "os" - "strconv" - "strings" - "syscall" - "unsafe" - - "github.com/mattn/go-isatty" -) - -const ( - foregroundBlue = 0x1 - foregroundGreen = 0x2 - foregroundRed = 0x4 - foregroundIntensity = 0x8 - foregroundMask = (foregroundRed | foregroundBlue | foregroundGreen | foregroundIntensity) - backgroundBlue = 0x10 - backgroundGreen = 0x20 - backgroundRed = 0x40 - backgroundIntensity = 0x80 - backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity) -) - -type wchar uint16 -type short int16 -type dword uint32 -type word uint16 - -type coord struct { - x short - y short -} - -type smallRect struct { - left short - top short - right short - bottom short -} - -type consoleScreenBufferInfo struct { - size coord - cursorPosition coord - attributes word - window smallRect - maximumWindowSize coord -} - -var ( - kernel32 = syscall.NewLazyDLL("kernel32.dll") - procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo") - procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute") -) - -type Writer struct { - out io.Writer - handle syscall.Handle - lastbuf bytes.Buffer - oldattr word -} - -func NewColorableStdout() io.Writer { - var csbi consoleScreenBufferInfo - out := os.Stdout - if !isatty.IsTerminal(out.Fd()) { - return out - } - handle := syscall.Handle(out.Fd()) - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - return &Writer{out: out, handle: handle, oldattr: csbi.attributes} -} - -func NewColorableStderr() io.Writer { - var csbi consoleScreenBufferInfo - out := os.Stderr - if !isatty.IsTerminal(out.Fd()) { - return out - } - handle := syscall.Handle(out.Fd()) - procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) - return &Writer{out: out, handle: handle, oldattr: csbi.attributes} -} - -var color256 = map[int]int{ - 0: 0x000000, - 1: 0x800000, - 2: 0x008000, - 3: 0x808000, - 4: 0x000080, - 5: 0x800080, - 6: 0x008080, - 7: 0xc0c0c0, - 8: 0x808080, - 9: 0xff0000, - 10: 0x00ff00, - 11: 0xffff00, - 12: 0x0000ff, - 13: 0xff00ff, - 14: 0x00ffff, - 15: 0xffffff, - 16: 0x000000, - 17: 0x00005f, - 18: 0x000087, - 19: 0x0000af, - 20: 0x0000d7, - 21: 0x0000ff, - 22: 0x005f00, - 23: 0x005f5f, - 24: 0x005f87, - 25: 0x005faf, - 26: 0x005fd7, - 27: 0x005fff, - 28: 0x008700, - 29: 0x00875f, - 30: 0x008787, - 31: 0x0087af, - 32: 0x0087d7, - 33: 0x0087ff, - 34: 0x00af00, - 35: 0x00af5f, - 36: 0x00af87, - 37: 0x00afaf, - 38: 0x00afd7, - 39: 0x00afff, - 40: 0x00d700, - 41: 0x00d75f, - 42: 0x00d787, - 43: 0x00d7af, - 44: 0x00d7d7, - 45: 0x00d7ff, - 46: 0x00ff00, - 47: 0x00ff5f, - 48: 0x00ff87, - 49: 0x00ffaf, - 50: 0x00ffd7, - 51: 0x00ffff, - 52: 0x5f0000, - 53: 0x5f005f, - 54: 0x5f0087, - 55: 0x5f00af, - 56: 0x5f00d7, - 57: 0x5f00ff, - 58: 0x5f5f00, - 59: 0x5f5f5f, - 60: 0x5f5f87, - 61: 0x5f5faf, - 62: 0x5f5fd7, - 63: 0x5f5fff, - 64: 0x5f8700, - 65: 0x5f875f, - 66: 0x5f8787, - 67: 0x5f87af, - 68: 0x5f87d7, - 69: 0x5f87ff, - 70: 0x5faf00, - 71: 0x5faf5f, - 72: 0x5faf87, - 73: 0x5fafaf, - 74: 0x5fafd7, - 75: 0x5fafff, - 76: 0x5fd700, - 77: 0x5fd75f, - 78: 0x5fd787, - 79: 0x5fd7af, - 80: 0x5fd7d7, - 81: 0x5fd7ff, - 82: 0x5fff00, - 83: 0x5fff5f, - 84: 0x5fff87, - 85: 0x5fffaf, - 86: 0x5fffd7, - 87: 0x5fffff, - 88: 0x870000, - 89: 0x87005f, - 90: 0x870087, - 91: 0x8700af, - 92: 0x8700d7, - 93: 0x8700ff, - 94: 0x875f00, - 95: 0x875f5f, - 96: 0x875f87, - 97: 0x875faf, - 98: 0x875fd7, - 99: 0x875fff, - 100: 0x878700, - 101: 0x87875f, - 102: 0x878787, - 103: 0x8787af, - 104: 0x8787d7, - 105: 0x8787ff, - 106: 0x87af00, - 107: 0x87af5f, - 108: 0x87af87, - 109: 0x87afaf, - 110: 0x87afd7, - 111: 0x87afff, - 112: 0x87d700, - 113: 0x87d75f, - 114: 0x87d787, - 115: 0x87d7af, - 116: 0x87d7d7, - 117: 0x87d7ff, - 118: 0x87ff00, - 119: 0x87ff5f, - 120: 0x87ff87, - 121: 0x87ffaf, - 122: 0x87ffd7, - 123: 0x87ffff, - 124: 0xaf0000, - 125: 0xaf005f, - 126: 0xaf0087, - 127: 0xaf00af, - 128: 0xaf00d7, - 129: 0xaf00ff, - 130: 0xaf5f00, - 131: 0xaf5f5f, - 132: 0xaf5f87, - 133: 0xaf5faf, - 134: 0xaf5fd7, - 135: 0xaf5fff, - 136: 0xaf8700, - 137: 0xaf875f, - 138: 0xaf8787, - 139: 0xaf87af, - 140: 0xaf87d7, - 141: 0xaf87ff, - 142: 0xafaf00, - 143: 0xafaf5f, - 144: 0xafaf87, - 145: 0xafafaf, - 146: 0xafafd7, - 147: 0xafafff, - 148: 0xafd700, - 149: 0xafd75f, - 150: 0xafd787, - 151: 0xafd7af, - 152: 0xafd7d7, - 153: 0xafd7ff, - 154: 0xafff00, - 155: 0xafff5f, - 156: 0xafff87, - 157: 0xafffaf, - 158: 0xafffd7, - 159: 0xafffff, - 160: 0xd70000, - 161: 0xd7005f, - 162: 0xd70087, - 163: 0xd700af, - 164: 0xd700d7, - 165: 0xd700ff, - 166: 0xd75f00, - 167: 0xd75f5f, - 168: 0xd75f87, - 169: 0xd75faf, - 170: 0xd75fd7, - 171: 0xd75fff, - 172: 0xd78700, - 173: 0xd7875f, - 174: 0xd78787, - 175: 0xd787af, - 176: 0xd787d7, - 177: 0xd787ff, - 178: 0xd7af00, - 179: 0xd7af5f, - 180: 0xd7af87, - 181: 0xd7afaf, - 182: 0xd7afd7, - 183: 0xd7afff, - 184: 0xd7d700, - 185: 0xd7d75f, - 186: 0xd7d787, - 187: 0xd7d7af, - 188: 0xd7d7d7, - 189: 0xd7d7ff, - 190: 0xd7ff00, - 191: 0xd7ff5f, - 192: 0xd7ff87, - 193: 0xd7ffaf, - 194: 0xd7ffd7, - 195: 0xd7ffff, - 196: 0xff0000, - 197: 0xff005f, - 198: 0xff0087, - 199: 0xff00af, - 200: 0xff00d7, - 201: 0xff00ff, - 202: 0xff5f00, - 203: 0xff5f5f, - 204: 0xff5f87, - 205: 0xff5faf, - 206: 0xff5fd7, - 207: 0xff5fff, - 208: 0xff8700, - 209: 0xff875f, - 210: 0xff8787, - 211: 0xff87af, - 212: 0xff87d7, - 213: 0xff87ff, - 214: 0xffaf00, - 215: 0xffaf5f, - 216: 0xffaf87, - 217: 0xffafaf, - 218: 0xffafd7, - 219: 0xffafff, - 220: 0xffd700, - 221: 0xffd75f, - 222: 0xffd787, - 223: 0xffd7af, - 224: 0xffd7d7, - 225: 0xffd7ff, - 226: 0xffff00, - 227: 0xffff5f, - 228: 0xffff87, - 229: 0xffffaf, - 230: 0xffffd7, - 231: 0xffffff, - 232: 0x080808, - 233: 0x121212, - 234: 0x1c1c1c, - 235: 0x262626, - 236: 0x303030, - 237: 0x3a3a3a, - 238: 0x444444, - 239: 0x4e4e4e, - 240: 0x585858, - 241: 0x626262, - 242: 0x6c6c6c, - 243: 0x767676, - 244: 0x808080, - 245: 0x8a8a8a, - 246: 0x949494, - 247: 0x9e9e9e, - 248: 0xa8a8a8, - 249: 0xb2b2b2, - 250: 0xbcbcbc, - 251: 0xc6c6c6, - 252: 0xd0d0d0, - 253: 0xdadada, - 254: 0xe4e4e4, - 255: 0xeeeeee, -} - -func (w *Writer) Write(data []byte) (n int, err error) { - var csbi consoleScreenBufferInfo - procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) - - er := bytes.NewBuffer(data) -loop: - for { - r1, _, err := procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) - if r1 == 0 { - break loop - } - - c1, _, err := er.ReadRune() - if err != nil { - break loop - } - if c1 != 0x1b { - fmt.Fprint(w.out, string(c1)) - continue - } - c2, _, err := er.ReadRune() - if err != nil { - w.lastbuf.WriteRune(c1) - break loop - } - if c2 != 0x5b { - w.lastbuf.WriteRune(c1) - w.lastbuf.WriteRune(c2) - continue - } - - var buf bytes.Buffer - var m rune - for { - c, _, err := er.ReadRune() - if err != nil { - w.lastbuf.WriteRune(c1) - w.lastbuf.WriteRune(c2) - w.lastbuf.Write(buf.Bytes()) - break loop - } - if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { - m = c - break - } - buf.Write([]byte(string(c))) - } - - switch m { - case 'm': - attr := csbi.attributes - cs := buf.String() - if cs == "" { - procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(w.oldattr)) - continue - } - token := strings.Split(cs, ";") - for i, ns := range token { - if n, err = strconv.Atoi(ns); err == nil { - switch { - case n == 0 || n == 100: - attr = w.oldattr - case 1 <= n && n <= 5: - attr |= foregroundIntensity - case n == 7: - attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) - case 22 == n || n == 25 || n == 25: - attr |= foregroundIntensity - case n == 27: - attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) - case 30 <= n && n <= 37: - attr = (attr & backgroundMask) - if (n-30)&1 != 0 { - attr |= foregroundRed - } - if (n-30)&2 != 0 { - attr |= foregroundGreen - } - if (n-30)&4 != 0 { - attr |= foregroundBlue - } - case n == 38: // set foreground color. - if i < len(token)-2 && token[i+1] == "5" { - if n256, err := strconv.Atoi(token[i+2]); err == nil { - if n256foreAttr == nil { - n256setup() - } - attr &= backgroundMask - attr |= n256foreAttr[n256] - i += 2 - } - } else { - attr = attr & (w.oldattr & backgroundMask) - } - case n == 39: // reset foreground color. - attr &= backgroundMask - attr |= w.oldattr & foregroundMask - case 40 <= n && n <= 47: - attr = (attr & foregroundMask) - if (n-40)&1 != 0 { - attr |= backgroundRed - } - if (n-40)&2 != 0 { - attr |= backgroundGreen - } - if (n-40)&4 != 0 { - attr |= backgroundBlue - } - case n == 48: // set background color. - if i < len(token)-2 && token[i+1] == "5" { - if n256, err := strconv.Atoi(token[i+2]); err == nil { - if n256backAttr == nil { - n256setup() - } - attr &= foregroundMask - attr |= n256backAttr[n256] - i += 2 - } - } else { - attr = attr & (w.oldattr & foregroundMask) - } - case n == 49: // reset foreground color. - attr &= foregroundMask - attr |= w.oldattr & backgroundMask - } - procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr)) - } - } - } - } - return len(data) - w.lastbuf.Len(), nil -} - -type consoleColor struct { - red bool - green bool - blue bool - intensity bool -} - -func minmax3(a, b, c int) (min, max int) { - if a < b { - if b < c { - return a, c - } else if a < c { - return a, b - } else { - return c, b - } - } else { - if a < c { - return b, c - } else if b < c { - return b, a - } else { - return c, a - } - } -} - -func toConsoleColor(rgb int) (c consoleColor) { - r, g, b := (rgb&0xFF0000)>>16, (rgb&0x00FF00)>>8, rgb&0x0000FF - min, max := minmax3(r, g, b) - a := (min + max) / 2 - if r < 128 && g < 128 && b < 128 { - if r >= a { - c.red = true - } - if g >= a { - c.green = true - } - if b >= a { - c.blue = true - } - // non-intensed white is lighter than intensed black, so swap those. - if c.red && c.green && c.blue { - c.red, c.green, c.blue = false, false, false - c.intensity = true - } - } else { - if min < 128 { - min = 128 - a = (min + max) / 2 - } - if r >= a { - c.red = true - } - if g >= a { - c.green = true - } - if b >= a { - c.blue = true - } - c.intensity = true - // intensed black is darker than non-intensed white, so swap those. - if !c.red && !c.green && !c.blue { - c.red, c.green, c.blue = true, true, true - c.intensity = false - } - } - return c -} - -func (c consoleColor) foregroundAttr() (attr word) { - if c.red { - attr |= foregroundRed - } - if c.green { - attr |= foregroundGreen - } - if c.blue { - attr |= foregroundBlue - } - if c.intensity { - attr |= foregroundIntensity - } - return -} - -func (c consoleColor) backgroundAttr() (attr word) { - if c.red { - attr |= backgroundRed - } - if c.green { - attr |= backgroundGreen - } - if c.blue { - attr |= backgroundBlue - } - if c.intensity { - attr |= backgroundIntensity - } - return -} - -var n256foreAttr []word -var n256backAttr []word - -func n256setup() { - n256foreAttr = make([]word, 256) - n256backAttr = make([]word, 256) - for i, rgb := range color256 { - c := toConsoleColor(rgb) - n256foreAttr[i] = c.foregroundAttr() - n256backAttr[i] = c.backgroundAttr() - } -} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore b/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore new file mode 100644 index 0000000000..69cec52c4e --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/.gitignore @@ -0,0 +1,27 @@ +# Created by http://www.gitignore.io + +### Go ### +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test + diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE b/Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE new file mode 100644 index 0000000000..e58473ed94 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) [2014] [shiena] + +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 +SOFTWARE. diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/README.md b/Godeps/_workspace/src/github.com/shiena/ansicolor/README.md new file mode 100644 index 0000000000..7797a4f186 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/README.md @@ -0,0 +1,100 @@ +[![GoDoc](https://godoc.org/github.com/shiena/ansicolor?status.svg)](https://godoc.org/github.com/shiena/ansicolor) + +# ansicolor + +Ansicolor library provides color console in Windows as ANSICON for Golang. + +## Features + +|Escape sequence|Text attributes| +|---------------|----| +|\x1b[0m|All attributes off(color at startup)| +|\x1b[1m|Bold on(enable foreground intensity)| +|\x1b[4m|Underline on| +|\x1b[5m|Blink on(enable background intensity)| +|\x1b[21m|Bold off(disable foreground intensity)| +|\x1b[24m|Underline off| +|\x1b[25m|Blink off(disable background intensity)| + +|Escape sequence|Foreground colors| +|---------------|----| +|\x1b[30m|Black| +|\x1b[31m|Red| +|\x1b[32m|Green| +|\x1b[33m|Yellow| +|\x1b[34m|Blue| +|\x1b[35m|Magenta| +|\x1b[36m|Cyan| +|\x1b[37m|White| +|\x1b[39m|Default(foreground color at startup)| +|\x1b[90m|Light Gray| +|\x1b[91m|Light Red| +|\x1b[92m|Light Green| +|\x1b[93m|Light Yellow| +|\x1b[94m|Light Blue| +|\x1b[95m|Light Magenta| +|\x1b[96m|Light Cyan| +|\x1b[97m|Light White| + +|Escape sequence|Background colors| +|---------------|----| +|\x1b[40m|Black| +|\x1b[41m|Red| +|\x1b[42m|Green| +|\x1b[43m|Yellow| +|\x1b[44m|Blue| +|\x1b[45m|Magenta| +|\x1b[46m|Cyan| +|\x1b[47m|White| +|\x1b[49m|Default(background color at startup)| +|\x1b[100m|Light Gray| +|\x1b[101m|Light Red| +|\x1b[102m|Light Green| +|\x1b[103m|Light Yellow| +|\x1b[104m|Light Blue| +|\x1b[105m|Light Magenta| +|\x1b[106m|Light Cyan| +|\x1b[107m|Light White| + +## Example + +```go +package main + +import ( + "fmt" + "os" + + "github.com/shiena/ansicolor" +) + +func main() { + w := ansicolor.NewAnsiColorWriter(os.Stdout) + text := "%sforeground %sbold%s %sbackground%s\n" + fmt.Fprintf(w, text, "\x1b[31m", "\x1b[1m", "\x1b[21m", "\x1b[41;32m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[32m", "\x1b[1m", "\x1b[21m", "\x1b[42;31m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[33m", "\x1b[1m", "\x1b[21m", "\x1b[43;34m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[34m", "\x1b[1m", "\x1b[21m", "\x1b[44;33m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[35m", "\x1b[1m", "\x1b[21m", "\x1b[45;36m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[36m", "\x1b[1m", "\x1b[21m", "\x1b[46;35m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[37m", "\x1b[1m", "\x1b[21m", "\x1b[47;30m", "\x1b[0m") +} +``` + +![screenshot](https://gist.githubusercontent.com/shiena/a1bada24b525314a7d5e/raw/c763aa7cda6e4fefaccf831e2617adc40b6151c7/main.png) + +## See also: + +- https://github.com/daviddengcn/go-colortext +- https://github.com/adoxa/ansicon +- https://github.com/aslakhellesoy/wac +- https://github.com/wsxiaoys/terminal + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request + diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go new file mode 100644 index 0000000000..d3ece8fc0c --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor.go @@ -0,0 +1,20 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// Package ansicolor provides color console in Windows as ANSICON. +package ansicolor + +import "io" + +// NewAnsiColorWriter creates and initializes a new ansiColorWriter +// using io.Writer w as its initial contents. +// In the console of Windows, which change the foreground and background +// colors of the text by the escape sequence. +// In the console of other systems, which writes to w all text. +func NewAnsiColorWriter(w io.Writer) io.Writer { + if _, ok := w.(*ansiColorWriter); !ok { + return &ansiColorWriter{w: w} + } + return w +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go new file mode 100644 index 0000000000..d86cfc0f34 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor/main.go @@ -0,0 +1,27 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +/* + +The ansicolor command colors a console text by ANSI escape sequence like wac. + + $ go get github.com/shiena/ansicolor/ansicolor + +See also: + https://github.com/aslakhellesoy/wac + +*/ +package main + +import ( + "io" + "os" + + "github.com/shiena/ansicolor" +) + +func main() { + w := ansicolor.NewAnsiColorWriter(os.Stdout) + io.Copy(w, os.Stdin) +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go new file mode 100644 index 0000000000..57b4633a77 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_ansi.go @@ -0,0 +1,17 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// +build !windows + +package ansicolor + +import "io" + +type ansiColorWriter struct { + w io.Writer +} + +func (cw *ansiColorWriter) Write(p []byte) (int, error) { + return cw.w.Write(p) +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go new file mode 100644 index 0000000000..4feeb1de67 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_test.go @@ -0,0 +1,25 @@ +package ansicolor_test + +import ( + "bytes" + "testing" + + "github.com/shiena/ansicolor" +) + +func TestNewAnsiColor1(t *testing.T) { + inner := bytes.NewBufferString("") + w := ansicolor.NewAnsiColorWriter(inner) + if w == inner { + t.Errorf("Get %#v, want %#v", w, inner) + } +} + +func TestNewAnsiColor2(t *testing.T) { + inner := bytes.NewBufferString("") + w1 := ansicolor.NewAnsiColorWriter(inner) + w2 := ansicolor.NewAnsiColorWriter(w1) + if w1 != w2 { + t.Errorf("Get %#v, want %#v", w1, w2) + } +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go new file mode 100644 index 0000000000..d918ffe914 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows.go @@ -0,0 +1,351 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// +build windows + +package ansicolor + +import ( + "bytes" + "io" + "strings" + "syscall" + "unsafe" +) + +type csiState int + +const ( + outsideCsiCode csiState = iota + firstCsiCode + secondCsiCode +) + +type ansiColorWriter struct { + w io.Writer + state csiState + paramBuf bytes.Buffer +} + +const ( + firstCsiChar byte = '\x1b' + secondeCsiChar byte = '[' + separatorChar byte = ';' + sgrCode byte = 'm' +) + +const ( + foregroundBlue = uint16(0x0001) + foregroundGreen = uint16(0x0002) + foregroundRed = uint16(0x0004) + foregroundIntensity = uint16(0x0008) + backgroundBlue = uint16(0x0010) + backgroundGreen = uint16(0x0020) + backgroundRed = uint16(0x0040) + backgroundIntensity = uint16(0x0080) + underscore = uint16(0x8000) + + foregroundMask = foregroundBlue | foregroundGreen | foregroundRed | foregroundIntensity + backgroundMask = backgroundBlue | backgroundGreen | backgroundRed | backgroundIntensity +) + +const ( + ansiReset = "0" + ansiIntensityOn = "1" + ansiIntensityOff = "21" + ansiUnderlineOn = "4" + ansiUnderlineOff = "24" + ansiBlinkOn = "5" + ansiBlinkOff = "25" + + ansiForegroundBlack = "30" + ansiForegroundRed = "31" + ansiForegroundGreen = "32" + ansiForegroundYellow = "33" + ansiForegroundBlue = "34" + ansiForegroundMagenta = "35" + ansiForegroundCyan = "36" + ansiForegroundWhite = "37" + ansiForegroundDefault = "39" + + ansiBackgroundBlack = "40" + ansiBackgroundRed = "41" + ansiBackgroundGreen = "42" + ansiBackgroundYellow = "43" + ansiBackgroundBlue = "44" + ansiBackgroundMagenta = "45" + ansiBackgroundCyan = "46" + ansiBackgroundWhite = "47" + ansiBackgroundDefault = "49" + + ansiLightForegroundGray = "90" + ansiLightForegroundRed = "91" + ansiLightForegroundGreen = "92" + ansiLightForegroundYellow = "93" + ansiLightForegroundBlue = "94" + ansiLightForegroundMagenta = "95" + ansiLightForegroundCyan = "96" + ansiLightForegroundWhite = "97" + + ansiLightBackgroundGray = "100" + ansiLightBackgroundRed = "101" + ansiLightBackgroundGreen = "102" + ansiLightBackgroundYellow = "103" + ansiLightBackgroundBlue = "104" + ansiLightBackgroundMagenta = "105" + ansiLightBackgroundCyan = "106" + ansiLightBackgroundWhite = "107" +) + +type drawType int + +const ( + foreground drawType = iota + background +) + +type winColor struct { + code uint16 + drawType drawType +} + +var colorMap = map[string]winColor{ + ansiForegroundBlack: {0, foreground}, + ansiForegroundRed: {foregroundRed, foreground}, + ansiForegroundGreen: {foregroundGreen, foreground}, + ansiForegroundYellow: {foregroundRed | foregroundGreen, foreground}, + ansiForegroundBlue: {foregroundBlue, foreground}, + ansiForegroundMagenta: {foregroundRed | foregroundBlue, foreground}, + ansiForegroundCyan: {foregroundGreen | foregroundBlue, foreground}, + ansiForegroundWhite: {foregroundRed | foregroundGreen | foregroundBlue, foreground}, + ansiForegroundDefault: {foregroundRed | foregroundGreen | foregroundBlue, foreground}, + + ansiBackgroundBlack: {0, background}, + ansiBackgroundRed: {backgroundRed, background}, + ansiBackgroundGreen: {backgroundGreen, background}, + ansiBackgroundYellow: {backgroundRed | backgroundGreen, background}, + ansiBackgroundBlue: {backgroundBlue, background}, + ansiBackgroundMagenta: {backgroundRed | backgroundBlue, background}, + ansiBackgroundCyan: {backgroundGreen | backgroundBlue, background}, + ansiBackgroundWhite: {backgroundRed | backgroundGreen | backgroundBlue, background}, + ansiBackgroundDefault: {0, background}, + + ansiLightForegroundGray: {foregroundIntensity, foreground}, + ansiLightForegroundRed: {foregroundIntensity | foregroundRed, foreground}, + ansiLightForegroundGreen: {foregroundIntensity | foregroundGreen, foreground}, + ansiLightForegroundYellow: {foregroundIntensity | foregroundRed | foregroundGreen, foreground}, + ansiLightForegroundBlue: {foregroundIntensity | foregroundBlue, foreground}, + ansiLightForegroundMagenta: {foregroundIntensity | foregroundRed | foregroundBlue, foreground}, + ansiLightForegroundCyan: {foregroundIntensity | foregroundGreen | foregroundBlue, foreground}, + ansiLightForegroundWhite: {foregroundIntensity | foregroundRed | foregroundGreen | foregroundBlue, foreground}, + + ansiLightBackgroundGray: {backgroundIntensity, background}, + ansiLightBackgroundRed: {backgroundIntensity | backgroundRed, background}, + ansiLightBackgroundGreen: {backgroundIntensity | backgroundGreen, background}, + ansiLightBackgroundYellow: {backgroundIntensity | backgroundRed | backgroundGreen, background}, + ansiLightBackgroundBlue: {backgroundIntensity | backgroundBlue, background}, + ansiLightBackgroundMagenta: {backgroundIntensity | backgroundRed | backgroundBlue, background}, + ansiLightBackgroundCyan: {backgroundIntensity | backgroundGreen | backgroundBlue, background}, + ansiLightBackgroundWhite: {backgroundIntensity | backgroundRed | backgroundGreen | backgroundBlue, background}, +} + +var ( + kernel32 = syscall.NewLazyDLL("kernel32.dll") + procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute") + procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo") + defaultAttr *textAttributes +) + +func init() { + screenInfo := getConsoleScreenBufferInfo(uintptr(syscall.Stdout)) + if screenInfo != nil { + colorMap[ansiForegroundDefault] = winColor{ + screenInfo.WAttributes & (foregroundRed | foregroundGreen | foregroundBlue), + foreground, + } + colorMap[ansiBackgroundDefault] = winColor{ + screenInfo.WAttributes & (backgroundRed | backgroundGreen | backgroundBlue), + background, + } + defaultAttr = convertTextAttr(screenInfo.WAttributes) + } +} + +type coord struct { + X, Y int16 +} + +type smallRect struct { + Left, Top, Right, Bottom int16 +} + +type consoleScreenBufferInfo struct { + DwSize coord + DwCursorPosition coord + WAttributes uint16 + SrWindow smallRect + DwMaximumWindowSize coord +} + +func getConsoleScreenBufferInfo(hConsoleOutput uintptr) *consoleScreenBufferInfo { + var csbi consoleScreenBufferInfo + ret, _, _ := procGetConsoleScreenBufferInfo.Call( + hConsoleOutput, + uintptr(unsafe.Pointer(&csbi))) + if ret == 0 { + return nil + } + return &csbi +} + +func setConsoleTextAttribute(hConsoleOutput uintptr, wAttributes uint16) bool { + ret, _, _ := procSetConsoleTextAttribute.Call( + hConsoleOutput, + uintptr(wAttributes)) + return ret != 0 +} + +type textAttributes struct { + foregroundColor uint16 + backgroundColor uint16 + foregroundIntensity uint16 + backgroundIntensity uint16 + underscore uint16 + otherAttributes uint16 +} + +func convertTextAttr(winAttr uint16) *textAttributes { + fgColor := winAttr & (foregroundRed | foregroundGreen | foregroundBlue) + bgColor := winAttr & (backgroundRed | backgroundGreen | backgroundBlue) + fgIntensity := winAttr & foregroundIntensity + bgIntensity := winAttr & backgroundIntensity + underline := winAttr & underscore + otherAttributes := winAttr &^ (foregroundMask | backgroundMask | underscore) + return &textAttributes{fgColor, bgColor, fgIntensity, bgIntensity, underline, otherAttributes} +} + +func convertWinAttr(textAttr *textAttributes) uint16 { + var winAttr uint16 = 0 + winAttr |= textAttr.foregroundColor + winAttr |= textAttr.backgroundColor + winAttr |= textAttr.foregroundIntensity + winAttr |= textAttr.backgroundIntensity + winAttr |= textAttr.underscore + winAttr |= textAttr.otherAttributes + return winAttr +} + +func changeColor(param []byte) { + if defaultAttr == nil { + return + } + + screenInfo := getConsoleScreenBufferInfo(uintptr(syscall.Stdout)) + if screenInfo == nil { + return + } + + winAttr := convertTextAttr(screenInfo.WAttributes) + strParam := string(param) + if len(strParam) <= 0 { + strParam = "0" + } + csiParam := strings.Split(strParam, string(separatorChar)) + for _, p := range csiParam { + c, ok := colorMap[p] + switch { + case !ok: + switch p { + case ansiReset: + winAttr.foregroundColor = defaultAttr.foregroundColor + winAttr.backgroundColor = defaultAttr.backgroundColor + winAttr.foregroundIntensity = defaultAttr.foregroundIntensity + winAttr.backgroundIntensity = defaultAttr.backgroundIntensity + winAttr.underscore = 0 + winAttr.otherAttributes = 0 + case ansiIntensityOn: + winAttr.foregroundIntensity = foregroundIntensity + case ansiIntensityOff: + winAttr.foregroundIntensity = 0 + case ansiUnderlineOn: + winAttr.underscore = underscore + case ansiUnderlineOff: + winAttr.underscore = 0 + case ansiBlinkOn: + winAttr.backgroundIntensity = backgroundIntensity + case ansiBlinkOff: + winAttr.backgroundIntensity = 0 + default: + // unknown code + } + case c.drawType == foreground: + winAttr.foregroundColor = c.code + case c.drawType == background: + winAttr.backgroundColor = c.code + } + } + winTextAttribute := convertWinAttr(winAttr) + setConsoleTextAttribute(uintptr(syscall.Stdout), winTextAttribute) +} + +func parseEscapeSequence(command byte, param []byte) { + switch command { + case sgrCode: + changeColor(param) + } +} + +func isParameterChar(b byte) bool { + return ('0' <= b && b <= '9') || b == separatorChar +} + +func (cw *ansiColorWriter) Write(p []byte) (int, error) { + r, nw, nc, first, last := 0, 0, 0, 0, 0 + var err error + for i, ch := range p { + switch cw.state { + case outsideCsiCode: + if ch == firstCsiChar { + nc++ + cw.state = firstCsiCode + } + case firstCsiCode: + switch ch { + case firstCsiChar: + nc++ + break + case secondeCsiChar: + nc++ + cw.state = secondCsiCode + last = i - 1 + default: + cw.state = outsideCsiCode + } + case secondCsiCode: + nc++ + if isParameterChar(ch) { + cw.paramBuf.WriteByte(ch) + } else { + nw, err = cw.w.Write(p[first:last]) + r += nw + if err != nil { + return r, err + } + first = i + 1 + param := cw.paramBuf.Bytes() + cw.paramBuf.Reset() + parseEscapeSequence(ch, param) + cw.state = outsideCsiCode + } + default: + cw.state = outsideCsiCode + } + } + + if cw.state == outsideCsiCode { + nw, err = cw.w.Write(p[first:len(p)]) + } + + return r + nw + nc, err +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go new file mode 100644 index 0000000000..6c126d517a --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/ansicolor_windows_test.go @@ -0,0 +1,236 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// +build windows + +package ansicolor_test + +import ( + "bytes" + "fmt" + "syscall" + "testing" + + "github.com/shiena/ansicolor" + . "github.com/shiena/ansicolor" +) + +func TestWritePlanText(t *testing.T) { + inner := bytes.NewBufferString("") + w := ansicolor.NewAnsiColorWriter(inner) + expected := "plain text" + fmt.Fprintf(w, expected) + actual := inner.String() + if actual != expected { + t.Errorf("Get %s, want %s", actual, expected) + } +} + +func TestWriteParseText(t *testing.T) { + inner := bytes.NewBufferString("") + w := ansicolor.NewAnsiColorWriter(inner) + + inputTail := "\x1b[0mtail text" + expectedTail := "tail text" + fmt.Fprintf(w, inputTail) + actualTail := inner.String() + inner.Reset() + if actualTail != expectedTail { + t.Errorf("Get %s, want %s", actualTail, expectedTail) + } + + inputHead := "head text\x1b[0m" + expectedHead := "head text" + fmt.Fprintf(w, inputHead) + actualHead := inner.String() + inner.Reset() + if actualHead != expectedHead { + t.Errorf("Get %s, want %s", actualHead, expectedHead) + } + + inputBothEnds := "both ends \x1b[0m text" + expectedBothEnds := "both ends text" + fmt.Fprintf(w, inputBothEnds) + actualBothEnds := inner.String() + inner.Reset() + if actualBothEnds != expectedBothEnds { + t.Errorf("Get %s, want %s", actualBothEnds, expectedBothEnds) + } + + inputManyEsc := "\x1b\x1b\x1b\x1b[0m many esc" + expectedManyEsc := "\x1b\x1b\x1b many esc" + fmt.Fprintf(w, inputManyEsc) + actualManyEsc := inner.String() + inner.Reset() + if actualManyEsc != expectedManyEsc { + t.Errorf("Get %s, want %s", actualManyEsc, expectedManyEsc) + } + + expectedSplit := "split text" + for _, ch := range "split \x1b[0m text" { + fmt.Fprintf(w, string(ch)) + } + actualSplit := inner.String() + inner.Reset() + if actualSplit != expectedSplit { + t.Errorf("Get %s, want %s", actualSplit, expectedSplit) + } +} + +type screenNotFoundError struct { + error +} + +func writeAnsiColor(expectedText, colorCode string) (actualText string, actualAttributes uint16, err error) { + inner := bytes.NewBufferString("") + w := ansicolor.NewAnsiColorWriter(inner) + fmt.Fprintf(w, "\x1b[%sm%s", colorCode, expectedText) + + actualText = inner.String() + screenInfo := GetConsoleScreenBufferInfo(uintptr(syscall.Stdout)) + if screenInfo != nil { + actualAttributes = screenInfo.WAttributes + } else { + err = &screenNotFoundError{} + } + return +} + +type testParam struct { + text string + attributes uint16 + ansiColor string +} + +func TestWriteAnsiColorText(t *testing.T) { + screenInfo := GetConsoleScreenBufferInfo(uintptr(syscall.Stdout)) + if screenInfo == nil { + t.Fatal("Could not get ConsoleScreenBufferInfo") + } + defer ChangeColor(screenInfo.WAttributes) + defaultFgColor := screenInfo.WAttributes & uint16(0x0007) + defaultBgColor := screenInfo.WAttributes & uint16(0x0070) + defaultFgIntensity := screenInfo.WAttributes & uint16(0x0008) + defaultBgIntensity := screenInfo.WAttributes & uint16(0x0080) + + fgParam := []testParam{ + {"foreground black ", uint16(0x0000 | 0x0000), "30"}, + {"foreground red ", uint16(0x0004 | 0x0000), "31"}, + {"foreground green ", uint16(0x0002 | 0x0000), "32"}, + {"foreground yellow ", uint16(0x0006 | 0x0000), "33"}, + {"foreground blue ", uint16(0x0001 | 0x0000), "34"}, + {"foreground magenta", uint16(0x0005 | 0x0000), "35"}, + {"foreground cyan ", uint16(0x0003 | 0x0000), "36"}, + {"foreground white ", uint16(0x0007 | 0x0000), "37"}, + {"foreground default", defaultFgColor | 0x0000, "39"}, + {"foreground light gray ", uint16(0x0000 | 0x0008 | 0x0000), "90"}, + {"foreground light red ", uint16(0x0004 | 0x0008 | 0x0000), "91"}, + {"foreground light green ", uint16(0x0002 | 0x0008 | 0x0000), "92"}, + {"foreground light yellow ", uint16(0x0006 | 0x0008 | 0x0000), "93"}, + {"foreground light blue ", uint16(0x0001 | 0x0008 | 0x0000), "94"}, + {"foreground light magenta", uint16(0x0005 | 0x0008 | 0x0000), "95"}, + {"foreground light cyan ", uint16(0x0003 | 0x0008 | 0x0000), "96"}, + {"foreground light white ", uint16(0x0007 | 0x0008 | 0x0000), "97"}, + } + + bgParam := []testParam{ + {"background black ", uint16(0x0007 | 0x0000), "40"}, + {"background red ", uint16(0x0007 | 0x0040), "41"}, + {"background green ", uint16(0x0007 | 0x0020), "42"}, + {"background yellow ", uint16(0x0007 | 0x0060), "43"}, + {"background blue ", uint16(0x0007 | 0x0010), "44"}, + {"background magenta", uint16(0x0007 | 0x0050), "45"}, + {"background cyan ", uint16(0x0007 | 0x0030), "46"}, + {"background white ", uint16(0x0007 | 0x0070), "47"}, + {"background default", uint16(0x0007) | defaultBgColor, "49"}, + {"background light gray ", uint16(0x0007 | 0x0000 | 0x0080), "100"}, + {"background light red ", uint16(0x0007 | 0x0040 | 0x0080), "101"}, + {"background light green ", uint16(0x0007 | 0x0020 | 0x0080), "102"}, + {"background light yellow ", uint16(0x0007 | 0x0060 | 0x0080), "103"}, + {"background light blue ", uint16(0x0007 | 0x0010 | 0x0080), "104"}, + {"background light magenta", uint16(0x0007 | 0x0050 | 0x0080), "105"}, + {"background light cyan ", uint16(0x0007 | 0x0030 | 0x0080), "106"}, + {"background light white ", uint16(0x0007 | 0x0070 | 0x0080), "107"}, + } + + resetParam := []testParam{ + {"all reset", defaultFgColor | defaultBgColor | defaultFgIntensity | defaultBgIntensity, "0"}, + {"all reset", defaultFgColor | defaultBgColor | defaultFgIntensity | defaultBgIntensity, ""}, + } + + boldParam := []testParam{ + {"bold on", uint16(0x0007 | 0x0008), "1"}, + {"bold off", uint16(0x0007), "21"}, + } + + underscoreParam := []testParam{ + {"underscore on", uint16(0x0007 | 0x8000), "4"}, + {"underscore off", uint16(0x0007), "24"}, + } + + blinkParam := []testParam{ + {"blink on", uint16(0x0007 | 0x0080), "5"}, + {"blink off", uint16(0x0007), "25"}, + } + + mixedParam := []testParam{ + {"both black, bold, underline, blink", uint16(0x0000 | 0x0000 | 0x0008 | 0x8000 | 0x0080), "30;40;1;4;5"}, + {"both red, bold, underline, blink", uint16(0x0004 | 0x0040 | 0x0008 | 0x8000 | 0x0080), "31;41;1;4;5"}, + {"both green, bold, underline, blink", uint16(0x0002 | 0x0020 | 0x0008 | 0x8000 | 0x0080), "32;42;1;4;5"}, + {"both yellow, bold, underline, blink", uint16(0x0006 | 0x0060 | 0x0008 | 0x8000 | 0x0080), "33;43;1;4;5"}, + {"both blue, bold, underline, blink", uint16(0x0001 | 0x0010 | 0x0008 | 0x8000 | 0x0080), "34;44;1;4;5"}, + {"both magenta, bold, underline, blink", uint16(0x0005 | 0x0050 | 0x0008 | 0x8000 | 0x0080), "35;45;1;4;5"}, + {"both cyan, bold, underline, blink", uint16(0x0003 | 0x0030 | 0x0008 | 0x8000 | 0x0080), "36;46;1;4;5"}, + {"both white, bold, underline, blink", uint16(0x0007 | 0x0070 | 0x0008 | 0x8000 | 0x0080), "37;47;1;4;5"}, + {"both default, bold, underline, blink", uint16(defaultFgColor | defaultBgColor | 0x0008 | 0x8000 | 0x0080), "39;49;1;4;5"}, + } + + assertTextAttribute := func(expectedText string, expectedAttributes uint16, ansiColor string) { + actualText, actualAttributes, err := writeAnsiColor(expectedText, ansiColor) + if actualText != expectedText { + t.Errorf("Get %s, want %s", actualText, expectedText) + } + if err != nil { + t.Fatal("Could not get ConsoleScreenBufferInfo") + } + if actualAttributes != expectedAttributes { + t.Errorf("Text: %s, Get 0x%04x, want 0x%04x", expectedText, actualAttributes, expectedAttributes) + } + } + + for _, v := range fgParam { + ResetColor() + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + for _, v := range bgParam { + ChangeColor(uint16(0x0070 | 0x0007)) + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + for _, v := range resetParam { + ChangeColor(uint16(0x0000 | 0x0070 | 0x0008)) + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + ResetColor() + for _, v := range boldParam { + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + ResetColor() + for _, v := range underscoreParam { + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + ResetColor() + for _, v := range blinkParam { + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } + + for _, v := range mixedParam { + ResetColor() + assertTextAttribute(v.text, v.attributes, v.ansiColor) + } +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go new file mode 100644 index 0000000000..f2ac67c174 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/example_test.go @@ -0,0 +1,24 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package ansicolor_test + +import ( + "fmt" + "os" + + "github.com/shiena/ansicolor" +) + +func ExampleNewAnsiColorWriter() { + w := ansicolor.NewAnsiColorWriter(os.Stdout) + text := "%sforeground %sbold%s %sbackground%s\n" + fmt.Fprintf(w, text, "\x1b[31m", "\x1b[1m", "\x1b[21m", "\x1b[41;32m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[32m", "\x1b[1m", "\x1b[21m", "\x1b[42;31m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[33m", "\x1b[1m", "\x1b[21m", "\x1b[43;34m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[34m", "\x1b[1m", "\x1b[21m", "\x1b[44;33m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[35m", "\x1b[1m", "\x1b[21m", "\x1b[45;36m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[36m", "\x1b[1m", "\x1b[21m", "\x1b[46;35m", "\x1b[0m") + fmt.Fprintf(w, text, "\x1b[37m", "\x1b[1m", "\x1b[21m", "\x1b[47;30m", "\x1b[0m") +} diff --git a/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go b/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go new file mode 100644 index 0000000000..6d2f7c0741 --- /dev/null +++ b/Godeps/_workspace/src/github.com/shiena/ansicolor/export_test.go @@ -0,0 +1,19 @@ +// Copyright 2014 shiena Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +// +build windows + +package ansicolor + +import "syscall" + +var GetConsoleScreenBufferInfo = getConsoleScreenBufferInfo + +func ChangeColor(color uint16) { + setConsoleTextAttribute(uintptr(syscall.Stdout), color) +} + +func ResetColor() { + ChangeColor(uint16(0x0007)) +} diff --git a/cmd/geth/js.go b/cmd/geth/js.go index bf56423ece..485e176978 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -252,22 +252,22 @@ func (self *jsre) batch(statement string) { // show summary of current geth instance func (self *jsre) welcome() { - self.re.Eval(`console.log('instance: ' + web3.version.client);`) - self.re.Eval(`console.log(' datadir: ' + admin.datadir);`) - self.re.Eval(`console.log("coinbase: " + eth.coinbase);`) - self.re.Eval(`var lastBlockTimestamp = 1000 * eth.getBlock(eth.blockNumber).timestamp`) - self.re.Eval(`console.log("at block: " + eth.blockNumber + " (" + new Date(lastBlockTimestamp).toLocaleDateString() - + " " + new Date(lastBlockTimestamp).toLocaleTimeString() + ")");`) - + self.re.Run(` + (function () { + console.log('instance: ' + web3.version.client); + console.log(' datadir: ' + admin.datadir); + console.log("coinbase: " + eth.coinbase); + var ts = 1000 * eth.getBlock(eth.blockNumber).timestamp; + console.log("at block: " + eth.blockNumber + " (" + new Date(ts) + ")"); + })(); + `) if modules, err := self.supportedApis(); err == nil { loadedModules := make([]string, 0) for api, version := range modules { loadedModules = append(loadedModules, fmt.Sprintf("%s:%s", api, version)) } sort.Strings(loadedModules) - - self.re.Eval(fmt.Sprintf("var modules = '%s';", strings.Join(loadedModules, " "))) - self.re.Eval(`console.log(" modules: " + modules);`) + fmt.Println("modules:", strings.Join(loadedModules, " ")) } } @@ -309,12 +309,12 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { utils.Fatalf("Error loading web3.js: %v", err) } - _, err = js.re.Eval("var web3 = require('web3');") + _, err = js.re.Run("var web3 = require('web3');") if err != nil { utils.Fatalf("Error requiring web3: %v", err) } - _, err = js.re.Eval("web3.setProvider(jeth)") + _, err = js.re.Run("web3.setProvider(jeth)") if err != nil { utils.Fatalf("Error setting web3 provider: %v", err) } @@ -333,13 +333,13 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { } } - _, err = js.re.Eval(shortcuts) + _, err = js.re.Run(shortcuts) if err != nil { utils.Fatalf("Error setting namespaces: %v", err) } - js.re.Eval(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`) + js.re.Run(`var GlobalRegistrar = eth.contract(` + registrar.GlobalRegistrarAbi + `); registrar = GlobalRegistrar.at("` + registrar.GlobalRegistrarAddr + `");`) return nil } @@ -458,8 +458,7 @@ func (self *jsre) parseInput(code string) { fmt.Println("[native] error", r) } }() - value, err := self.re.Run(code) - if err != nil { + if err := self.re.EvalAndPrettyPrint(code); err != nil { if ottoErr, ok := err.(*otto.Error); ok { fmt.Println(ottoErr.String()) } else { @@ -467,7 +466,6 @@ func (self *jsre) parseInput(code string) { } return } - self.printValue(value) } var indentCount = 0 @@ -486,10 +484,3 @@ func (self *jsre) setIndent() { self.ps1 += " " } } - -func (self *jsre) printValue(v interface{}) { - val, err := self.re.PrettyPrint(v) - if err == nil { - fmt.Printf("%v", val) - } -} diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 895e55b44d..0bdcddf500 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -19,7 +19,6 @@ package main import ( "fmt" - "io" "io/ioutil" _ "net/http/pprof" "os" @@ -46,8 +45,6 @@ import ( "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" - "github.com/mattn/go-colorable" - "github.com/mattn/go-isatty" ) const ( @@ -398,14 +395,6 @@ func run(ctx *cli.Context) { func attach(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) - // Wrap the standard output with a colorified stream (windows) - if isatty.IsTerminal(os.Stdout.Fd()) { - if pr, pw, err := os.Pipe(); err == nil { - go io.Copy(colorable.NewColorableStdout(), pr) - os.Stdout = pw - } - } - var client comms.EthereumClient var err error if ctx.Args().Present() { @@ -438,14 +427,6 @@ func attach(ctx *cli.Context) { func console(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) - // Wrap the standard output with a colorified stream (windows) - if isatty.IsTerminal(os.Stdout.Fd()) { - if pr, pw, err := os.Pipe(); err == nil { - go io.Copy(colorable.NewColorableStdout(), pr) - os.Stdout = pw - } - } - cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx) ethereum, err := eth.New(cfg) if err != nil { diff --git a/jsre/jsre.go b/jsre/jsre.go index d4c9828970..bb0cc71edd 100644 --- a/jsre/jsre.go +++ b/jsre/jsre.go @@ -65,7 +65,6 @@ func New(assetPath string) *JSRE { } re.loopWg.Add(1) go re.runEventLoop() - re.Compile("pp.js", pp_js) // load prettyprint func definition re.Set("loadScript", re.loadScript) return re } @@ -255,35 +254,19 @@ func (self *JSRE) loadScript(call otto.FunctionCall) otto.Value { return otto.TrueValue() } -// PrettyPrint writes v to standard output. -func (self *JSRE) PrettyPrint(v interface{}) (val otto.Value, err error) { - var method otto.Value +// EvalAndPrettyPrint evaluates code and pretty prints the result to +// standard output. +func (self *JSRE) EvalAndPrettyPrint(code string) (err error) { self.do(func(vm *otto.Otto) { - val, err = vm.ToValue(v) + var val otto.Value + val, err = vm.Run(code) if err != nil { return } - method, err = vm.Get("prettyPrint") - if err != nil { - return - } - val, err = method.Call(method, val) + prettyPrint(vm, val) + fmt.Println() }) - return val, err -} - -// Eval evaluates JS function and returns result in a pretty printed string format. -func (self *JSRE) Eval(code string) (s string, err error) { - var val otto.Value - val, err = self.Run(code) - if err != nil { - return - } - val, err = self.PrettyPrint(val) - if err != nil { - return - } - return fmt.Sprintf("%v", val), nil + return err } // Compile compiles and then runs a piece of JS code. diff --git a/jsre/jsre_test.go b/jsre/jsre_test.go index 93dc7d1f9a..8450f546c3 100644 --- a/jsre/jsre_test.go +++ b/jsre/jsre_test.go @@ -103,19 +103,14 @@ func TestNatto(t *testing.T) { func TestBind(t *testing.T) { jsre := New("") + defer jsre.Stop(false) jsre.Bind("no", &testNativeObjectBinding{}) - val, err := jsre.Run(`no.TestMethod("testMsg")`) + _, err := jsre.Run(`no.TestMethod("testMsg")`) if err != nil { t.Errorf("expected no error, got %v", err) } - pp, err := jsre.PrettyPrint(val) - if err != nil { - t.Errorf("expected no error, got %v", err) - } - t.Logf("no: %v", pp) - jsre.Stop(false) } func TestLoadScript(t *testing.T) { @@ -139,4 +134,4 @@ func TestLoadScript(t *testing.T) { t.Errorf("expected '%v', got '%v'", exp, got) } jsre.Stop(false) -} \ No newline at end of file +} diff --git a/jsre/pp_js.go b/jsre/pp_js.go deleted file mode 100644 index 80fe523c14..0000000000 --- a/jsre/pp_js.go +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package jsre - -const pp_js = ` -function pp(object, indent) { - try { - JSON.stringify(object) - } catch(e) { - return pp(e, indent); - } - - var str = ""; - if(object instanceof Array) { - str += "["; - for(var i = 0, l = object.length; i < l; i++) { - str += pp(object[i], indent); - - if(i < l-1) { - str += ", "; - } - } - str += " ]"; - } else if (object instanceof Error) { - str += "\033[31m" + "Error:\033[0m " + object.message; - } else if (isBigNumber(object)) { - str += "\033[32m'" + object.toString(10) + "'"; - } else if(typeof(object) === "object") { - str += "{\n"; - indent += " "; - - var fields = getFields(object); - var last = fields[fields.length - 1]; - fields.forEach(function (key) { - str += indent + key + ": "; - try { - str += pp(object[key], indent); - } catch (e) { - str += pp(e, indent); - } - if(key !== last) { - str += ","; - } - str += "\n"; - }); - str += indent.substr(2, indent.length) + "}"; - } else if(typeof(object) === "string") { - str += "\033[32m'" + object + "'"; - } else if(typeof(object) === "undefined") { - str += "\033[1m\033[30m" + object; - } else if(typeof(object) === "number") { - str += "\033[31m" + object; - } else if(typeof(object) === "function") { - str += "\033[35m" + object.toString().split(" {")[0]; - } else { - str += object; - } - - str += "\033[0m"; - - return str; -} - -var redundantFields = [ - 'valueOf', - 'toString', - 'toLocaleString', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' -]; - -var getFields = function (object) { - var members = Object.getOwnPropertyNames(object); - if (object.constructor && object.constructor.prototype) { - members = members.concat(Object.getOwnPropertyNames(object.constructor.prototype)); - } - - var fields = members.filter(function (member) { - return !isMemberFunction(object, member) - }).sort() - var funcs = members.filter(function (member) { - return isMemberFunction(object, member) - }).sort() - - var results = fields.concat(funcs); - return results.filter(function (field) { - return redundantFields.indexOf(field) === -1; - }); -}; - -var isMemberFunction = function(object, member) { - try { - return typeof(object[member]) === "function"; - } catch(e) { - return false; - } -} - -var isBigNumber = function (object) { - var result = typeof BigNumber !== 'undefined' && object instanceof BigNumber; - - if (!result) { - if (typeof(object) === "object" && object.constructor != null) { - result = object.constructor.toString().indexOf("function BigNumber(") == 0; - } - } - - return result -}; - -function prettyPrint(/* */) { - var args = arguments; - var ret = ""; - for(var i = 0, l = args.length; i < l; i++) { - ret += pp(args[i], "") + "\n"; - } - return ret; -} - -var print = prettyPrint; -` diff --git a/jsre/pretty.go b/jsre/pretty.go new file mode 100644 index 0000000000..cf04deec65 --- /dev/null +++ b/jsre/pretty.go @@ -0,0 +1,220 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package jsre + +import ( + "fmt" + "sort" + "strconv" + "strings" + + "github.com/fatih/color" + "github.com/robertkrimen/otto" +) + +const ( + maxPrettyPrintLevel = 3 + indentString = " " +) + +var ( + functionColor = color.New(color.FgMagenta) + specialColor = color.New(color.Bold) + numberColor = color.New(color.FgRed) + stringColor = color.New(color.FgGreen) +) + +// these fields are hidden when printing objects. +var boringKeys = map[string]bool{ + "valueOf": true, + "toString": true, + "toLocaleString": true, + "hasOwnProperty": true, + "isPrototypeOf": true, + "propertyIsEnumerable": true, + "constructor": true, +} + +// prettyPrint writes value to standard output. +func prettyPrint(vm *otto.Otto, value otto.Value) { + ppctx{vm}.printValue(value, 0) +} + +type ppctx struct{ vm *otto.Otto } + +func (ctx ppctx) indent(level int) string { + return strings.Repeat(indentString, level) +} + +func (ctx ppctx) printValue(v otto.Value, level int) { + switch { + case v.IsObject(): + ctx.printObject(v.Object(), level) + case v.IsNull(): + specialColor.Print("null") + case v.IsUndefined(): + specialColor.Print("undefined") + case v.IsString(): + s, _ := v.ToString() + stringColor.Printf("%q", s) + case v.IsBoolean(): + b, _ := v.ToBoolean() + specialColor.Printf("%t", b) + case v.IsNaN(): + numberColor.Printf("NaN") + case v.IsNumber(): + s, _ := v.ToString() + numberColor.Printf("%s", s) + default: + fmt.Printf("") + } +} + +func (ctx ppctx) printObject(obj *otto.Object, level int) { + switch obj.Class() { + case "Array": + lv, _ := obj.Get("length") + len, _ := lv.ToInteger() + if len == 0 { + fmt.Printf("[]") + return + } + if level > maxPrettyPrintLevel { + fmt.Print("[...]") + return + } + fmt.Print("[") + for i := int64(0); i < len; i++ { + el, err := obj.Get(strconv.FormatInt(i, 10)) + if err == nil { + ctx.printValue(el, level+1) + } + if i < len-1 { + fmt.Printf(", ") + } + } + fmt.Print("]") + + case "Object": + // Print values from bignumber.js as regular numbers. + if ctx.isBigNumber(obj) { + numberColor.Print(toString(obj)) + return + } + // Otherwise, print all fields indented, but stop if we're too deep. + keys := ctx.fields(obj) + if len(keys) == 0 { + fmt.Print("{}") + return + } + if level > maxPrettyPrintLevel { + fmt.Print("{...}") + return + } + fmt.Println("{") + for i, k := range keys { + v, _ := obj.Get(k) + fmt.Printf("%s%s: ", ctx.indent(level+1), k) + ctx.printValue(v, level+1) + if i < len(keys)-1 { + fmt.Printf(",") + } + fmt.Println() + } + fmt.Printf("%s}", ctx.indent(level)) + + case "Function": + // Use toString() to display the argument list if possible. + if robj, err := obj.Call("toString"); err != nil { + functionColor.Print("function()") + } else { + desc := strings.Trim(strings.Split(robj.String(), "{")[0], " \t\n") + desc = strings.Replace(desc, " (", "(", 1) + functionColor.Print(desc) + } + + case "RegExp": + stringColor.Print(toString(obj)) + + default: + if v, _ := obj.Get("toString"); v.IsFunction() && level <= maxPrettyPrintLevel { + s, _ := obj.Call("toString") + fmt.Printf("<%s %s>", obj.Class(), s.String()) + } else { + fmt.Printf("<%s>", obj.Class()) + } + } +} + +func (ctx ppctx) fields(obj *otto.Object) []string { + var ( + vals, methods []string + seen = make(map[string]bool) + ) + add := func(k string) { + if seen[k] || boringKeys[k] { + return + } + seen[k] = true + if v, _ := obj.Get(k); v.IsFunction() { + methods = append(methods, k) + } else { + vals = append(vals, k) + } + } + // add own properties + ctx.doOwnProperties(obj.Value(), add) + // add properties of the constructor + if cp := constructorPrototype(obj); cp != nil { + ctx.doOwnProperties(cp.Value(), add) + } + sort.Strings(vals) + sort.Strings(methods) + return append(vals, methods...) +} + +func (ctx ppctx) doOwnProperties(v otto.Value, f func(string)) { + Object, _ := ctx.vm.Object("Object") + rv, _ := Object.Call("getOwnPropertyNames", v) + gv, _ := rv.Export() + for _, v := range gv.([]interface{}) { + f(v.(string)) + } +} + +func (ctx ppctx) isBigNumber(v *otto.Object) bool { + BigNumber, err := ctx.vm.Run("BigNumber.prototype") + if err != nil { + panic(err) + } + cp := constructorPrototype(v) + return cp != nil && cp.Value() == BigNumber +} + +func toString(obj *otto.Object) string { + s, _ := obj.Call("toString") + return s.String() +} + +func constructorPrototype(obj *otto.Object) *otto.Object { + if v, _ := obj.Get("constructor"); v.Object() != nil { + if v, _ = v.Object().Get("prototype"); v.Object() != nil { + return v.Object() + } + } + return nil +} From f9cbd16f27e393d4937354ee31435e0a2f689484 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Fri, 7 Aug 2015 09:56:49 +0200 Subject: [PATCH 30/90] support for user agents --- cmd/geth/js.go | 10 +-- cmd/geth/main.go | 2 +- cmd/utils/flags.go | 25 ++++-- rpc/api/admin.go | 9 ++ rpc/api/net.go | 3 +- rpc/api/personal.go | 22 ++--- rpc/api/personal_args.go | 22 +++-- rpc/api/{ssh_js.go => shh_js.go} | 0 rpc/codec/codec.go | 2 + rpc/codec/json.go | 43 ++++++---- rpc/comms/comms.go | 2 +- rpc/comms/inproc.go | 2 +- rpc/comms/ipc.go | 35 ++------ rpc/comms/ipc_unix.go | 9 +- rpc/comms/ipc_windows.go | 9 +- rpc/jeth.go | 89 +++++++++++++++++-- rpc/useragent/agent.go | 24 ++++++ rpc/useragent/remote_frontend.go | 141 +++++++++++++++++++++++++++++++ xeth/xeth.go | 4 + 19 files changed, 363 insertions(+), 90 deletions(-) rename rpc/api/{ssh_js.go => shh_js.go} (100%) create mode 100644 rpc/useragent/agent.go create mode 100644 rpc/useragent/remote_frontend.go diff --git a/cmd/geth/js.go b/cmd/geth/js.go index bf56423ece..ff319ab6bf 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -145,19 +145,15 @@ func apiWordCompleter(line string, pos int) (head string, completions []string, return begin, completionWords, end } -func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive bool, f xeth.Frontend) *jsre { +func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive bool) *jsre { js := &jsre{ps1: "> "} js.wait = make(chan *big.Int) js.client = client js.ds = docserver.New("/") - if f == nil { - f = js - } - // update state in separare forever blocks js.re = re.New(libPath) - if err := js.apiBindings(f); err != nil { + if err := js.apiBindings(js); err != nil { utils.Fatalf("Unable to initialize console - %v", err) } @@ -291,7 +287,7 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { utils.Fatalf("Unable to determine supported api's: %v", err) } - jeth := rpc.NewJeth(api.Merge(apiImpl...), js.re, js.client) + jeth := rpc.NewJeth(api.Merge(apiImpl...), js.re, js.client, f) js.re.Set("jeth", struct{}{}) t, _ := js.re.Get("jeth") jethObj := t.Object() diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 895e55b44d..b0dcf4e50d 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -425,7 +425,7 @@ func attach(ctx *cli.Context) { ctx.GlobalString(utils.JSpathFlag.Name), client, true, - nil) + ) if ctx.GlobalString(utils.ExecFlag.Name) != "" { repl.batch(ctx.GlobalString(utils.ExecFlag.Name)) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 462da93059..9e15d4a40d 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -21,30 +21,32 @@ import ( "fmt" "log" "math/big" + "net" "net/http" "os" "path/filepath" "runtime" "strconv" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/metrics" - "github.com/codegangsta/cli" "github.com/ethereum/ethash" "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/rpc/api" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" + "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/ethereum/go-ethereum/rpc/useragent" "github.com/ethereum/go-ethereum/xeth" ) @@ -518,15 +520,20 @@ func StartIPC(eth *eth.Ethereum, ctx *cli.Context) error { Endpoint: IpcSocketPath(ctx), } - xeth := xeth.New(eth, nil) - codec := codec.JSON + initializer := func(conn net.Conn) (shared.EthereumApi, error) { + fe := useragent.NewRemoteFrontend(conn, eth.AccountManager()) + xeth := xeth.New(eth, fe) + codec := codec.JSON - apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec, xeth, eth) - if err != nil { - return err + apis, err := api.ParseApiString(ctx.GlobalString(IPCApiFlag.Name), codec, xeth, eth) + if err != nil { + return nil, err + } + + return api.Merge(apis...), nil } - return comms.StartIpc(config, codec, api.Merge(apis...)) + return comms.StartIpc(config, codec.JSON, initializer) } func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error { diff --git a/rpc/api/admin.go b/rpc/api/admin.go index 29f342ab63..5e392ae320 100644 --- a/rpc/api/admin.go +++ b/rpc/api/admin.go @@ -37,6 +37,7 @@ import ( "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/comms" "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/ethereum/go-ethereum/rpc/useragent" "github.com/ethereum/go-ethereum/xeth" ) @@ -71,6 +72,7 @@ var ( "admin_httpGet": (*adminApi).HttpGet, "admin_sleepBlocks": (*adminApi).SleepBlocks, "admin_sleep": (*adminApi).Sleep, + "admin_enableUserAgent": (*adminApi).EnableUserAgent, } ) @@ -474,3 +476,10 @@ func (self *adminApi) HttpGet(req *shared.Request) (interface{}, error) { return string(resp), nil } + +func (self *adminApi) EnableUserAgent(req *shared.Request) (interface{}, error) { + if fe, ok := self.xeth.Frontend().(*useragent.RemoteFrontend); ok { + fe.Enable() + } + return true, nil +} diff --git a/rpc/api/net.go b/rpc/api/net.go index 39c230e143..9c63696152 100644 --- a/rpc/api/net.go +++ b/rpc/api/net.go @@ -32,7 +32,7 @@ var ( netMapping = map[string]nethandler{ "net_peerCount": (*netApi).PeerCount, "net_listening": (*netApi).IsListening, - "net_version": (*netApi).Version, + "net_version": (*netApi).Version, } ) @@ -97,4 +97,3 @@ func (self *netApi) IsListening(req *shared.Request) (interface{}, error) { func (self *netApi) Version(req *shared.Request) (interface{}, error) { return self.xeth.NetworkVersion(), nil } - diff --git a/rpc/api/personal.go b/rpc/api/personal.go index e9942c1e55..6c73ac83df 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -17,6 +17,7 @@ package api import ( + "fmt" "time" "github.com/ethereum/go-ethereum/common" @@ -125,18 +126,17 @@ func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error) return nil, shared.NewDecodeParamError(err.Error()) } - var err error + if len(args.Passphrase) == 0 { + fe := self.xeth.Frontend() + if fe == nil { + return false, fmt.Errorf("No password provided") + } + return fe.UnlockAccount(common.HexToAddress(args.Address).Bytes()), nil + } + am := self.ethereum.AccountManager() addr := common.HexToAddress(args.Address) - if args.Duration == -1 { - err = am.Unlock(addr, args.Passphrase) - } else { - err = am.TimedUnlock(addr, args.Passphrase, time.Duration(args.Duration)*time.Second) - } - - if err == nil { - return true, nil - } - return false, err + err := am.TimedUnlock(addr, args.Passphrase, time.Duration(args.Duration)*time.Second) + return err == nil, err } diff --git a/rpc/api/personal_args.go b/rpc/api/personal_args.go index 7f00701e32..5a584fb0ce 100644 --- a/rpc/api/personal_args.go +++ b/rpc/api/personal_args.go @@ -86,10 +86,10 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewDecodeParamError(err.Error()) } - args.Duration = -1 + args.Duration = 0 - if len(obj) < 2 { - return shared.NewInsufficientParamsError(len(obj), 2) + if len(obj) < 1 { + return shared.NewInsufficientParamsError(len(obj), 1) } if addrstr, ok := obj[0].(string); ok { @@ -98,10 +98,18 @@ func (args *UnlockAccountArgs) UnmarshalJSON(b []byte) (err error) { return shared.NewInvalidTypeError("address", "not a string") } - if passphrasestr, ok := obj[1].(string); ok { - args.Passphrase = passphrasestr - } else { - return shared.NewInvalidTypeError("passphrase", "not a string") + if len(obj) >= 2 && obj[1] != nil { + if passphrasestr, ok := obj[1].(string); ok { + args.Passphrase = passphrasestr + } else { + return shared.NewInvalidTypeError("passphrase", "not a string") + } + } + + if len(obj) >= 3 && obj[2] != nil { + if duration, ok := obj[2].(float64); ok { + args.Duration = int(duration) + } } return nil diff --git a/rpc/api/ssh_js.go b/rpc/api/shh_js.go similarity index 100% rename from rpc/api/ssh_js.go rename to rpc/api/shh_js.go diff --git a/rpc/codec/codec.go b/rpc/codec/codec.go index 2fdb0d8f3e..786080b44a 100644 --- a/rpc/codec/codec.go +++ b/rpc/codec/codec.go @@ -31,6 +31,8 @@ type ApiCoder interface { ReadRequest() ([]*shared.Request, bool, error) // Parse response message from underlying stream ReadResponse() (interface{}, error) + // Read raw message from underlying stream + Recv() (interface{}, error) // Encode response to encoded form in underlying stream WriteResponse(interface{}) error // Decode single message from data diff --git a/rpc/codec/json.go b/rpc/codec/json.go index d811b20968..cfc449143b 100644 --- a/rpc/codec/json.go +++ b/rpc/codec/json.go @@ -21,6 +21,7 @@ import ( "fmt" "net" "time" + "strings" "github.com/ethereum/go-ethereum/rpc/shared" ) @@ -73,35 +74,41 @@ func (self *JsonCodec) ReadRequest() (requests []*shared.Request, isBatch bool, return nil, false, err } -func (self *JsonCodec) ReadResponse() (interface{}, error) { - bytesInBuffer := 0 - buf := make([]byte, MAX_RESPONSE_SIZE) - - deadline := time.Now().Add(READ_TIMEOUT * time.Second) - if err := self.c.SetDeadline(deadline); err != nil { +func (self *JsonCodec) Recv() (interface{}, error) { + var msg json.RawMessage + err := self.d.Decode(&msg) + if err != nil { + self.c.Close() return nil, err } - for { - n, err := self.c.Read(buf[bytesInBuffer:]) - if err != nil { - return nil, err - } - bytesInBuffer += n + return msg, err +} - var failure shared.ErrorResponse - if err = json.Unmarshal(buf[:bytesInBuffer], &failure); err == nil && failure.Error != nil { +func (self *JsonCodec) ReadResponse() (interface{}, error) { + in, err := self.Recv() + if err != nil { + return nil, err + } + + if msg, ok := in.(json.RawMessage); ok { + var req *shared.Request + if err = json.Unmarshal(msg, &req); err == nil && strings.HasPrefix(req.Method, "agent_") { + return req, nil + } + + var failure *shared.ErrorResponse + if err = json.Unmarshal(msg, &failure); err == nil && failure.Error != nil { return failure, fmt.Errorf(failure.Error.Message) } - var success shared.SuccessResponse - if err = json.Unmarshal(buf[:bytesInBuffer], &success); err == nil { + var success *shared.SuccessResponse + if err = json.Unmarshal(msg, &success); err == nil { return success, nil } } - self.c.Close() - return nil, fmt.Errorf("Unable to read response") + return in, err } // Decode data diff --git a/rpc/comms/comms.go b/rpc/comms/comms.go index f5eeae84fb..731b2f62e4 100644 --- a/rpc/comms/comms.go +++ b/rpc/comms/comms.go @@ -49,7 +49,7 @@ var ( ) type EthereumClient interface { - // Close underlaying connection + // Close underlying connection Close() // Send request Send(interface{}) error diff --git a/rpc/comms/inproc.go b/rpc/comms/inproc.go index f279f0163d..e8058e32bf 100644 --- a/rpc/comms/inproc.go +++ b/rpc/comms/inproc.go @@ -60,7 +60,7 @@ func (self *InProcClient) Send(req interface{}) error { } func (self *InProcClient) Recv() (interface{}, error) { - return self.lastRes, self.lastErr + return *shared.NewRpcResponse(self.lastId, self.lastJsonrpc, self.lastRes, self.lastErr), nil } func (self *InProcClient) SupportedModules() (map[string]string, error) { diff --git a/rpc/comms/ipc.go b/rpc/comms/ipc.go index 0250aa01e0..e982ada133 100644 --- a/rpc/comms/ipc.go +++ b/rpc/comms/ipc.go @@ -44,35 +44,18 @@ func (self *ipcClient) Close() { func (self *ipcClient) Send(req interface{}) error { var err error - if r, ok := req.(*shared.Request); ok { - if err = self.coder.WriteResponse(r); err != nil { - if _, ok := err.(*net.OpError); ok { // connection lost, retry once - if err = self.reconnect(); err == nil { - err = self.coder.WriteResponse(r) - } + if err = self.coder.WriteResponse(req); err != nil { + if _, ok := err.(*net.OpError); ok { // connection lost, retry once + if err = self.reconnect(); err == nil { + err = self.coder.WriteResponse(req) } } - return err } - - return fmt.Errorf("Invalid request (%T)", req) + return err } func (self *ipcClient) Recv() (interface{}, error) { - res, err := self.coder.ReadResponse() - if err != nil { - return nil, err - } - - if r, ok := res.(shared.SuccessResponse); ok { - return r.Result, nil - } - - if r, ok := res.(shared.ErrorResponse); ok { - return r.Error, nil - } - - return res, err + return self.coder.ReadResponse() } func (self *ipcClient) SupportedModules() (map[string]string, error) { @@ -91,7 +74,7 @@ func (self *ipcClient) SupportedModules() (map[string]string, error) { return nil, err } - if sucRes, ok := res.(shared.SuccessResponse); ok { + if sucRes, ok := res.(*shared.SuccessResponse); ok { data, _ := json.Marshal(sucRes.Result) modules := make(map[string]string) err = json.Unmarshal(data, &modules) @@ -109,8 +92,8 @@ func NewIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) { } // Start IPC server -func StartIpc(cfg IpcConfig, codec codec.Codec, offeredApi shared.EthereumApi) error { - return startIpc(cfg, codec, offeredApi) +func StartIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { + return startIpc(cfg, codec, initializer) } func newIpcConnId() int { diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go index 432bf93b53..6968fa8447 100644 --- a/rpc/comms/ipc_unix.go +++ b/rpc/comms/ipc_unix.go @@ -48,7 +48,7 @@ func (self *ipcClient) reconnect() error { return err } -func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { +func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { os.Remove(cfg.Endpoint) // in case it still exists from a previous run l, err := net.Listen("unix", cfg.Endpoint) @@ -69,6 +69,13 @@ func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { id := newIpcConnId() glog.V(logger.Debug).Infof("New IPC connection with id %06d started\n", id) + api, err := initializer(conn) + if err != nil { + glog.V(logger.Error).Infof("Unable to initialize IPC connection - %v\n", err) + conn.Close() + continue + } + go handle(id, conn, api, codec) } diff --git a/rpc/comms/ipc_windows.go b/rpc/comms/ipc_windows.go index ee49f069bf..b2fe2b29db 100644 --- a/rpc/comms/ipc_windows.go +++ b/rpc/comms/ipc_windows.go @@ -667,7 +667,7 @@ func (self *ipcClient) reconnect() error { return err } -func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { +func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { os.Remove(cfg.Endpoint) // in case it still exists from a previous run l, err := Listen(cfg.Endpoint) @@ -687,6 +687,13 @@ func startIpc(cfg IpcConfig, codec codec.Codec, api shared.EthereumApi) error { id := newIpcConnId() glog.V(logger.Debug).Infof("New IPC connection with id %06d started\n", id) + api, err := initializer(conn) + if err != nil { + glog.V(logger.Error).Infof("Unable to initialize IPC connection - %v\n", err) + conn.Close() + continue + } + go handle(id, conn, api, codec) } diff --git a/rpc/jeth.go b/rpc/jeth.go index 07add2bad8..158bfb64cb 100644 --- a/rpc/jeth.go +++ b/rpc/jeth.go @@ -18,12 +18,17 @@ package rpc import ( "encoding/json" - "fmt" + "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/jsre" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc/comms" "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/ethereum/go-ethereum/rpc/useragent" + "github.com/ethereum/go-ethereum/xeth" + "github.com/robertkrimen/otto" ) @@ -31,10 +36,21 @@ type Jeth struct { ethApi shared.EthereumApi re *jsre.JSRE client comms.EthereumClient + fe xeth.Frontend } -func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClient) *Jeth { - return &Jeth{ethApi, re, client} +func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClient, fe xeth.Frontend) *Jeth { + // enable the jeth as the user agent + req := shared.Request{ + Id: 0, + Method: useragent.EnableUserAgentMethod, + Jsonrpc: shared.JsonRpcVersion, + Params: []byte("[]"), + } + client.Send(&req) + client.Recv() + + return &Jeth{ethApi, re, client, fe} } func (self *Jeth) err(call otto.FunctionCall, code int, msg string, id interface{}) (response otto.Value) { @@ -72,16 +88,34 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) { if err != nil { return self.err(call, -32603, err.Error(), req.Id) } - respif, err = self.client.Recv() + recv: + respif, err = self.client.Recv() if err != nil { return self.err(call, -32603, err.Error(), req.Id) } + agentreq, isRequest := respif.(*shared.Request) + if isRequest { + self.handleRequest(agentreq) + goto recv // receive response after agent interaction + } + + sucres, isSuccessResponse := respif.(*shared.SuccessResponse) + errres, isErrorResponse := respif.(*shared.ErrorResponse) + if !isSuccessResponse && !isErrorResponse { + return self.err(call, -32603, fmt.Sprintf("Invalid response type (%T)", respif), req.Id) + } + call.Otto.Set("ret_jsonrpc", shared.JsonRpcVersion) call.Otto.Set("ret_id", req.Id) - res, _ := json.Marshal(respif) + var res []byte + if isSuccessResponse { + res, err = json.Marshal(sucres.Result) + } else if isErrorResponse { + res, err = json.Marshal(errres.Error) + } call.Otto.Set("ret_result", string(res)) call.Otto.Set("response_idx", i) @@ -105,3 +139,48 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) { return } + +// handleRequest will handle user agent requests by interacting with the user and sending +// the user response back to the geth service +func (self *Jeth) handleRequest(req *shared.Request) bool { + var err error + var args []interface{} + if err = json.Unmarshal(req.Params, &args); err != nil { + glog.V(logger.Info).Infof("Unable to parse agent request - %v\n", err) + return false + } + + switch req.Method { + case useragent.AskPasswordMethod: + return self.askPassword(req.Id, req.Jsonrpc, args) + case useragent.ConfirmTransactionMethod: + return self.confirmTransaction(req.Id, req.Jsonrpc, args) + } + + return false +} + +// askPassword will ask the user to supply the password for a given account +func (self *Jeth) askPassword(id interface{}, jsonrpc string, args []interface{}) bool { + var err error + var passwd string + if len(args) >= 1 { + if account, ok := args[0].(string); ok { + fmt.Printf("Unlock account %s\n", account) + passwd, err = utils.PromptPassword("Passphrase: ", true) + } else { + return false + } + } + + if err = self.client.Send(shared.NewRpcResponse(id, jsonrpc, passwd, err)); err != nil { + glog.V(logger.Info).Infof("Unable to send user agent ask password response - %v\n", err) + } + + return err == nil +} + +func (self *Jeth) confirmTransaction(id interface{}, jsonrpc string, args []interface{}) bool { + // Accept all tx which are send from this console + return self.client.Send(shared.NewRpcResponse(id, jsonrpc, true, nil)) == nil +} diff --git a/rpc/useragent/agent.go b/rpc/useragent/agent.go new file mode 100644 index 0000000000..df0739e659 --- /dev/null +++ b/rpc/useragent/agent.go @@ -0,0 +1,24 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// package user agent provides frontends and agents which can interact with the user +package useragent + +var ( + AskPasswordMethod = "agent_askPassword" + ConfirmTransactionMethod = "agent_confirmTransaction" + EnableUserAgentMethod = "admin_enableUserAgent" +) diff --git a/rpc/useragent/remote_frontend.go b/rpc/useragent/remote_frontend.go new file mode 100644 index 0000000000..0dd4a60497 --- /dev/null +++ b/rpc/useragent/remote_frontend.go @@ -0,0 +1,141 @@ +// Copyright 2015 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +package useragent + +import ( + "encoding/json" + "fmt" + "net" + + "github.com/ethereum/go-ethereum/accounts" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/rpc/shared" +) + +// remoteFrontend implements xeth.Frontend and will communicate with an external +// user agent over a connection +type RemoteFrontend struct { + enabled bool + mgr *accounts.Manager + d *json.Decoder + e *json.Encoder + n int +} + +// NewRemoteFrontend creates a new frontend which will interact with an user agent +// over the given connection +func NewRemoteFrontend(conn net.Conn, mgr *accounts.Manager) *RemoteFrontend { + return &RemoteFrontend{false, mgr, json.NewDecoder(conn), json.NewEncoder(conn), 0} +} + +// Enable will enable user interaction +func (fe *RemoteFrontend) Enable() { + fe.enabled = true +} + +// UnlockAccount asks the user agent for the user password and tries to unlock the account. +// It will try 3 attempts before giving up. +func (fe *RemoteFrontend) UnlockAccount(address []byte) bool { + if !fe.enabled { + return false + } + + err := fe.send(AskPasswordMethod, common.Bytes2Hex(address)) + if err != nil { + glog.V(logger.Error).Infof("Unable to send password request to agent - %v\n", err) + return false + } + + passwdRes, err := fe.recv() + if err != nil { + glog.V(logger.Error).Infof("Unable to recv password response from agent - %v\n", err) + return false + } + + if passwd, ok := passwdRes.Result.(string); ok { + err = fe.mgr.Unlock(common.BytesToAddress(address), passwd) + } + + if err == nil { + return true + } + + glog.V(logger.Debug).Infoln("3 invalid account unlock attempts") + return false +} + +// ConfirmTransaction asks the user for approval +func (fe *RemoteFrontend) ConfirmTransaction(tx string) bool { + if !fe.enabled { + return true // backwards compatibility + } + + err := fe.send(ConfirmTransactionMethod, tx) + if err != nil { + glog.V(logger.Error).Infof("Unable to send tx confirmation request to agent - %v\n", err) + return false + } + + confirmResponse, err := fe.recv() + if err != nil { + glog.V(logger.Error).Infof("Unable to recv tx confirmation response from agent - %v\n", err) + return false + } + + if confirmed, ok := confirmResponse.Result.(bool); ok { + return confirmed + } + + return false +} + +// send request to the agent +func (fe *RemoteFrontend) send(method string, params ...interface{}) error { + fe.n += 1 + + p, err := json.Marshal(params) + if err != nil { + glog.V(logger.Info).Infof("Unable to send agent request %v\n", err) + return err + } + + req := shared.Request{ + Method: method, + Jsonrpc: shared.JsonRpcVersion, + Id: fe.n, + Params: p, + } + + return fe.e.Encode(&req) +} + +// recv user response from agent +func (fe *RemoteFrontend) recv() (*shared.SuccessResponse, error) { + var res json.RawMessage + if err := fe.d.Decode(&res); err != nil { + return nil, err + } + + var response shared.SuccessResponse + if err := json.Unmarshal(res, &response); err == nil { + return &response, nil + } + + return nil, fmt.Errorf("Invalid user agent response") +} diff --git a/xeth/xeth.go b/xeth/xeth.go index 5110aa62c3..5a57608bc1 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -885,6 +885,10 @@ func isAddress(addr string) bool { return addrReg.MatchString(addr) } +func (self *XEth) Frontend() Frontend { + return self.frontend +} + func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceStr, codeStr string) (string, error) { // this minimalistic recoding is enough (works for natspec.js) From 31a2793662ea65f4e73a82340fe17b5a06a502e9 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 12 Aug 2015 13:32:52 +0200 Subject: [PATCH 31/90] cmd/geth: remove spaces in client identifier --- cmd/geth/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 895e55b44d..4905d502a4 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -51,7 +51,7 @@ import ( ) const ( - ClientIdentifier = "Geth " + ClientIdentifier = "Geth" Version = "1.0.1" VersionMajor = 1 VersionMinor = 0 From 0d10d5a0a5e5d25fac1b609281b1981e698b62c9 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 12 Aug 2015 14:15:54 +0200 Subject: [PATCH 32/90] p2p: fix value of DiscSubprotocolError We had the wrong value (12) since forever. --- p2p/peer_error.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/peer_error.go b/p2p/peer_error.go index b1762a6ee8..62c7b665dd 100644 --- a/p2p/peer_error.go +++ b/p2p/peer_error.go @@ -66,7 +66,7 @@ const ( DiscUnexpectedIdentity DiscSelf DiscReadTimeout - DiscSubprotocolError + DiscSubprotocolError = 0x10 ) var discReasonToString = [...]string{ From 1d2420323ca555f8ac45969bd39415c5e619e4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Thu, 13 Aug 2015 11:12:38 +0300 Subject: [PATCH 33/90] rlp: add support for boolean encoding/decoding --- rlp/decode.go | 29 +++++++++++++++++++++++++++++ rlp/decode_test.go | 9 +++++++++ rlp/encode.go | 11 +++++++++++ rlp/encode_test.go | 4 ++++ 4 files changed, 53 insertions(+) diff --git a/rlp/decode.go b/rlp/decode.go index c0b5f06994..1381f5274e 100644 --- a/rlp/decode.go +++ b/rlp/decode.go @@ -183,6 +183,8 @@ func makeDecoder(typ reflect.Type, tags tags) (dec decoder, err error) { return decodeBigIntNoPtr, nil case isUint(kind): return decodeUint, nil + case kind == reflect.Bool: + return decodeBool, nil case kind == reflect.String: return decodeString, nil case kind == reflect.Slice || kind == reflect.Array: @@ -211,6 +213,15 @@ func decodeUint(s *Stream, val reflect.Value) error { return nil } +func decodeBool(s *Stream, val reflect.Value) error { + b, err := s.Bool() + if err != nil { + return wrapStreamError(err, val.Type()) + } + val.SetBool(b) + return nil +} + func decodeString(s *Stream, val reflect.Value) error { b, err := s.Bytes() if err != nil { @@ -697,6 +708,24 @@ func (s *Stream) uint(maxbits int) (uint64, error) { } } +// Bool reads an RLP string of up to 1 byte and returns its contents +// as an boolean. If the input does not contain an RLP string, the +// returned error will be ErrExpectedString. +func (s *Stream) Bool() (bool, error) { + num, err := s.uint(8) + if err != nil { + return false, err + } + switch num { + case 0: + return false, nil + case 1: + return true, nil + default: + return false, fmt.Errorf("rlp: invalid boolean value: %d", num) + } +} + // List starts decoding an RLP list. If the input does not contain a // list, the returned error will be ErrExpectedList. When the list's // end has been reached, any Stream operation will return EOL. diff --git a/rlp/decode_test.go b/rlp/decode_test.go index 331faa9d83..d6b0611dd0 100644 --- a/rlp/decode_test.go +++ b/rlp/decode_test.go @@ -19,6 +19,7 @@ package rlp import ( "bytes" "encoding/hex" + "errors" "fmt" "io" "math/big" @@ -116,6 +117,9 @@ func TestStreamErrors(t *testing.T) { {"817F", calls{"Uint"}, nil, ErrCanonSize}, {"8180", calls{"Uint"}, nil, nil}, + // Non-valid boolean + {"02", calls{"Bool"}, nil, errors.New("rlp: invalid boolean value: 2")}, + // Size tags must use the smallest possible encoding. // Leading zero bytes in the size tag are also rejected. {"8100", calls{"Uint"}, nil, ErrCanonSize}, @@ -315,6 +319,11 @@ var ( ) var decodeTests = []decodeTest{ + // booleans + {input: "01", ptr: new(bool), value: true}, + {input: "80", ptr: new(bool), value: false}, + {input: "02", ptr: new(bool), error: "rlp: invalid boolean value: 2"}, + // integers {input: "05", ptr: new(uint32), value: uint32(5)}, {input: "80", ptr: new(uint32), value: uint32(0)}, diff --git a/rlp/encode.go b/rlp/encode.go index 0ddef7bbb5..b525ae4e7a 100644 --- a/rlp/encode.go +++ b/rlp/encode.go @@ -361,6 +361,8 @@ func makeWriter(typ reflect.Type) (writer, error) { return writeBigIntNoPtr, nil case isUint(kind): return writeUint, nil + case kind == reflect.Bool: + return writeBool, nil case kind == reflect.String: return writeString, nil case kind == reflect.Slice && isByte(typ.Elem()): @@ -398,6 +400,15 @@ func writeUint(val reflect.Value, w *encbuf) error { return nil } +func writeBool(val reflect.Value, w *encbuf) error { + if val.Bool() { + w.str = append(w.str, 0x01) + } else { + w.str = append(w.str, 0x80) + } + return nil +} + func writeBigIntPtr(val reflect.Value, w *encbuf) error { ptr := val.Interface().(*big.Int) if ptr == nil { diff --git a/rlp/encode_test.go b/rlp/encode_test.go index e83c76b51e..60bd956926 100644 --- a/rlp/encode_test.go +++ b/rlp/encode_test.go @@ -71,6 +71,10 @@ type encTest struct { } var encTests = []encTest{ + // booleans + {val: true, output: "01"}, + {val: false, output: "80"}, + // integers {val: uint32(0), output: "80"}, {val: uint32(127), output: "7F"}, From b8ca0a830e89d4d7c4314c13bcbc2629992f43d9 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 13 Aug 2015 20:44:03 +0200 Subject: [PATCH 34/90] eth, trie: removed key prefixing from state entries & merge db fix Fixed database merge strategy to use the correct database. Due to a copy paste fail when doing type evaluation the same database was being iterated (chain), all others were ignored. Removed state prefixing because {H(code): code} is stored in the same database as the rest of the state. --- eth/backend.go | 34 +++++++++++++++++++--------------- trie/cache.go | 4 ---- trie/trie.go | 2 -- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index c9b71803fb..953a150ad3 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -45,7 +45,6 @@ import ( "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/trie" "github.com/ethereum/go-ethereum/whisper" ) @@ -738,48 +737,53 @@ func mergeDatabases(datadir string, newdb func(path string) (common.Database, er } defer database.Close() - glog.Infoln("Merging blockchain database...") + // Migrate blocks chainDb, err := newdb(chainPath) if err != nil { return fmt.Errorf("state db err: %v", err) } defer chainDb.Close() - if db, ok := chainDb.(*ethdb.LDBDatabase); ok { - it := db.NewIterator() + if chain, ok := chainDb.(*ethdb.LDBDatabase); ok { + glog.Infoln("Merging blockchain database...") + it := chain.NewIterator() for it.Next() { database.Put(it.Key(), it.Value()) } + it.Release() } - glog.Infoln("Merging state database...") - state := filepath.Join(datadir, "state") - stateDb, err := newdb(state) + // Migrate state + stateDb, err := newdb(filepath.Join(datadir, "state")) if err != nil { return fmt.Errorf("state db err: %v", err) } defer stateDb.Close() - if db, ok := chainDb.(*ethdb.LDBDatabase); ok { - it := db.NewIterator() + if state, ok := stateDb.(*ethdb.LDBDatabase); ok { + glog.Infoln("Merging state database...") + it := state.NewIterator() for it.Next() { - database.Put(append(trie.StatePre, it.Key()...), it.Value()) + database.Put(it.Key(), it.Value()) } + it.Release() } - glog.Infoln("Merging transaction database...") - extra := filepath.Join(datadir, "extra") - extraDb, err := newdb(extra) + // Migrate transaction / receipts + extraDb, err := newdb(filepath.Join(datadir, "extra")) if err != nil { return fmt.Errorf("state db err: %v", err) } defer extraDb.Close() - if db, ok := chainDb.(*ethdb.LDBDatabase); ok { - it := db.NewIterator() + if extra, ok := extraDb.(*ethdb.LDBDatabase); ok { + glog.Infoln("Merging transaction database...") + + it := extra.NewIterator() for it.Next() { database.Put(it.Key(), it.Value()) } + it.Release() } return nil diff --git a/trie/cache.go b/trie/cache.go index 99d8033a6d..e475fc861a 100644 --- a/trie/cache.go +++ b/trie/cache.go @@ -38,8 +38,6 @@ func NewCache(backend Backend) *Cache { } func (self *Cache) Get(key []byte) []byte { - key = append(StatePre, key...) - data := self.store[string(key)] if data == nil { data, _ = self.backend.Get(key) @@ -49,8 +47,6 @@ func (self *Cache) Get(key []byte) []byte { } func (self *Cache) Put(key []byte, data []byte) { - key = append(StatePre, key...) - self.batch.Put(key, data) self.store[string(key)] = data } diff --git a/trie/trie.go b/trie/trie.go index 2970bc185e..abf48a8509 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -27,8 +27,6 @@ import ( "github.com/ethereum/go-ethereum/crypto" ) -var StatePre = []byte("state-") - func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) { t2 := New(nil, backend) From 87d1cde7e4a8dbb3100af177fdfbf25314143c0f Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Fri, 14 Aug 2015 13:06:34 +0200 Subject: [PATCH 35/90] main print console output for js statement given by the exec argument --- cmd/geth/js.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmd/geth/js.go b/cmd/geth/js.go index 485e176978..c5b25fe982 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -232,15 +232,10 @@ func (self *jsre) loadAutoCompletion() { } func (self *jsre) batch(statement string) { - val, err := self.re.Run(statement) + err := self.re.EvalAndPrettyPrint(statement) if err != nil { fmt.Printf("error: %v", err) - } else if val.IsDefined() && val.IsObject() { - obj, _ := self.re.Get("ret_result") - fmt.Printf("%v", obj) - } else if val.IsDefined() { - fmt.Printf("%v", val) } if self.atexit != nil { From c472b8f7257763fb977a595d455999054e48c550 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Fri, 14 Aug 2015 11:31:29 +0200 Subject: [PATCH 36/90] main clear current line on ctrl-C --- cmd/geth/js.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/geth/js.go b/cmd/geth/js.go index ff319ab6bf..86bee731f2 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -383,6 +383,11 @@ func (self *jsre) interactive() { for { line, err := self.Prompt(<-prompt) if err != nil { + if err == liner.ErrPromptAborted { // ctrl-C + self.resetPrompt() + inputln <- "" + continue + } return } inputln <- line @@ -469,6 +474,12 @@ func (self *jsre) parseInput(code string) { var indentCount = 0 var str = "" +func (self *jsre) resetPrompt() { + indentCount = 0 + str = "" + self.ps1 = "> " +} + func (self *jsre) setIndent() { open := strings.Count(str, "{") open += strings.Count(str, "(") From 7bb5ac045e5e2f06bbae085114aeffc80af58de4 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Sat, 15 Aug 2015 00:33:52 +0200 Subject: [PATCH 37/90] xeth: added a transact mu Added a transact mutex. The transact mutex will fix an issue where transactions were created with the same nonce resulting in some transactions being dropped. This happened when two concurrent calls would call the `Transact` method (which is OK) which would both call `GetNonce`. While the managed is thread safe it does not help us in this case. --- xeth/xeth.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xeth/xeth.go b/xeth/xeth.go index 5a57608bc1..0ad0e507a2 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -89,8 +89,7 @@ type XEth struct { messagesMu sync.RWMutex messages map[int]*whisperFilter - // regmut sync.Mutex - // register map[string][]*interface{} // TODO improve return type + transactMu sync.Mutex agent *miner.RemoteAgent @@ -952,8 +951,9 @@ func (self *XEth) Transact(fromStr, toStr, nonceStr, valueStr, gasStr, gasPriceS } */ - // TODO: align default values to have the same type, e.g. not depend on - // common.Value conversions later on + self.transactMu.Lock() + defer self.transactMu.Unlock() + var nonce uint64 if len(nonceStr) != 0 { nonce = common.Big(nonceStr).Uint64() From 49703bea0aac8c06856a506b35bccf30cf0c2520 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 15 Aug 2015 23:55:17 +0100 Subject: [PATCH 38/90] jsre: bind the pretty printer to "inspect" in JS --- jsre/jsre.go | 1 + jsre/pretty.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/jsre/jsre.go b/jsre/jsre.go index bb0cc71edd..0db9e33fc5 100644 --- a/jsre/jsre.go +++ b/jsre/jsre.go @@ -66,6 +66,7 @@ func New(assetPath string) *JSRE { re.loopWg.Add(1) go re.runEventLoop() re.Set("loadScript", re.loadScript) + re.Set("inspect", prettyPrintJS) return re } diff --git a/jsre/pretty.go b/jsre/pretty.go index cf04deec65..7300a5f375 100644 --- a/jsre/pretty.go +++ b/jsre/pretty.go @@ -54,6 +54,14 @@ func prettyPrint(vm *otto.Otto, value otto.Value) { ppctx{vm}.printValue(value, 0) } +func prettyPrintJS(call otto.FunctionCall) otto.Value { + for _, v := range call.ArgumentList { + prettyPrint(call.Otto, v) + fmt.Println() + } + return otto.UndefinedValue() +} + type ppctx struct{ vm *otto.Otto } func (ctx ppctx) indent(level int) string { From 1086e2f298215cb0d4973a2c10ae9c9c8fd38462 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sat, 15 Aug 2015 23:56:05 +0100 Subject: [PATCH 39/90] jsre: fix annoying indentation when printing arrays of objects The pretty printer, dumb as it is, printed arrays of objects as [{ ... }] With this change, they now print as: [{ ... }] --- jsre/pretty.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/jsre/pretty.go b/jsre/pretty.go index 7300a5f375..99aa9b33e5 100644 --- a/jsre/pretty.go +++ b/jsre/pretty.go @@ -51,7 +51,7 @@ var boringKeys = map[string]bool{ // prettyPrint writes value to standard output. func prettyPrint(vm *otto.Otto, value otto.Value) { - ppctx{vm}.printValue(value, 0) + ppctx{vm}.printValue(value, 0, false) } func prettyPrintJS(call otto.FunctionCall) otto.Value { @@ -68,10 +68,10 @@ func (ctx ppctx) indent(level int) string { return strings.Repeat(indentString, level) } -func (ctx ppctx) printValue(v otto.Value, level int) { +func (ctx ppctx) printValue(v otto.Value, level int, inArray bool) { switch { case v.IsObject(): - ctx.printObject(v.Object(), level) + ctx.printObject(v.Object(), level, inArray) case v.IsNull(): specialColor.Print("null") case v.IsUndefined(): @@ -92,7 +92,7 @@ func (ctx ppctx) printValue(v otto.Value, level int) { } } -func (ctx ppctx) printObject(obj *otto.Object, level int) { +func (ctx ppctx) printObject(obj *otto.Object, level int, inArray bool) { switch obj.Class() { case "Array": lv, _ := obj.Get("length") @@ -109,7 +109,7 @@ func (ctx ppctx) printObject(obj *otto.Object, level int) { for i := int64(0); i < len; i++ { el, err := obj.Get(strconv.FormatInt(i, 10)) if err == nil { - ctx.printValue(el, level+1) + ctx.printValue(el, level+1, true) } if i < len-1 { fmt.Printf(", ") @@ -137,12 +137,15 @@ func (ctx ppctx) printObject(obj *otto.Object, level int) { for i, k := range keys { v, _ := obj.Get(k) fmt.Printf("%s%s: ", ctx.indent(level+1), k) - ctx.printValue(v, level+1) + ctx.printValue(v, level+1, false) if i < len(keys)-1 { fmt.Printf(",") } fmt.Println() } + if inArray { + level-- + } fmt.Printf("%s}", ctx.indent(level)) case "Function": From 8603ec7055a09e5e20938ec47930c416ec8e7d5c Mon Sep 17 00:00:00 2001 From: Maran Date: Wed, 12 Aug 2015 22:16:18 +0200 Subject: [PATCH 40/90] rpc/api: format pendingTx response. Fixes #1648 --- rpc/api/eth_args.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index 5a1841cbed..8bd077e209 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -908,14 +908,14 @@ func (args *SubmitWorkArgs) UnmarshalJSON(b []byte) (err error) { type tx struct { tx *types.Transaction - To string - From string - Nonce string - Value string - Data string - GasLimit string - GasPrice string - Hash string + To string `json:"to"` + From string `json:"from"` + Nonce string `json:"nonce"` + Value string `json:"value"` + Data string `json:"data"` + GasLimit string `json:"gas"` + GasPrice string `json:"gasPrice"` + Hash string `json:"hash"` } func newTx(t *types.Transaction) *tx { From 1c3ca3ce6a20d559dd10506953333670575bf4e7 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 13 Aug 2015 16:36:22 +0200 Subject: [PATCH 41/90] xeth: max gas limit --- xeth/xeth.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xeth/xeth.go b/xeth/xeth.go index 5a57608bc1..1bb2792227 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -823,18 +823,22 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st } from.SetBalance(common.MaxBig) - from.SetGasLimit(self.backend.ChainManager().GasLimit()) + from.SetGasLimit(common.MaxBig) + msg := callmsg{ from: from, - to: common.HexToAddress(toStr), gas: common.Big(gasStr), gasPrice: common.Big(gasPriceStr), value: common.Big(valueStr), data: common.FromHex(dataStr), } + if len(toStr) > 0 { + addr := common.HexToAddress(toStr) + msg.to = &addr + } if msg.gas.Cmp(big.NewInt(0)) == 0 { - msg.gas = DefaultGas() + msg.gas = big.NewInt(50000000) } if msg.gasPrice.Cmp(big.NewInt(0)) == 0 { @@ -998,7 +1002,7 @@ func (self *XEth) sign(tx *types.Transaction, from common.Address, didUnlock boo // callmsg is the message type used for call transations. type callmsg struct { from *state.StateObject - to common.Address + to *common.Address gas, gasPrice *big.Int value *big.Int data []byte @@ -1007,7 +1011,7 @@ type callmsg struct { // accessor boilerplate to implement core.Message func (m callmsg) From() (common.Address, error) { return m.from.Address(), nil } func (m callmsg) Nonce() uint64 { return m.from.Nonce() } -func (m callmsg) To() *common.Address { return &m.to } +func (m callmsg) To() *common.Address { return m.to } func (m callmsg) GasPrice() *big.Int { return m.gasPrice } func (m callmsg) Gas() *big.Int { return m.gas } func (m callmsg) Value() *big.Int { return m.value } From 309788de37505253293416c3323962f9a16bbd07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 17 Aug 2015 14:04:20 +0300 Subject: [PATCH 42/90] rpc: update the xeth over RPC API to use the success/failure messages --- rpc/xeth.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/rpc/xeth.go b/rpc/xeth.go index 65a1edeb8a..9527a96c00 100644 --- a/rpc/xeth.go +++ b/rpc/xeth.go @@ -53,7 +53,7 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac Method: method, Params: data, } - // Send the request over and process the response + // Send the request over and retrieve the response if err := self.client.Send(req); err != nil { return nil, err } @@ -61,9 +61,17 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac if err != nil { return nil, err } - value, ok := res.(map[string]interface{}) - if !ok { - return nil, fmt.Errorf("Invalid response type: have %v, want %v", reflect.TypeOf(res), reflect.TypeOf(make(map[string]interface{}))) + // Ensure the response is valid, and extract the results + success, isSuccessResponse := res.(*shared.SuccessResponse) + failure, isFailureResponse := res.(*shared.ErrorResponse) + switch { + case isFailureResponse: + return nil, fmt.Errorf("Method invocation failed: %v", failure.Error) + + case isSuccessResponse: + return success.Result.(map[string]interface{}), nil + + default: + return nil, fmt.Errorf("Invalid response type: %v", reflect.TypeOf(res)) } - return value, nil } From 8884f856ef3973f89e1edf4809438e22d043d6b9 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Mon, 17 Aug 2015 14:36:57 +0200 Subject: [PATCH 43/90] Added SG bootnode --- eth/backend.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 953a150ad3..2a8262db8c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -61,8 +61,9 @@ var ( defaultBootNodes = []*discover.Node{ // ETH/DEV Go Bootnodes - discover.MustParseNode("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303"), - discover.MustParseNode("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303"), + discover.MustParseNode("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303"), // IE + discover.MustParseNode("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303"), // BR + discover.MustParseNode("enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303"), // SG // ETH/DEV cpp-ethereum (poc-9.ethdev.com) discover.MustParseNode("enode://487611428e6c99a11a9795a6abe7b529e81315ca6aad66e2a2fc76e3adf263faba0d35466c2f8f68d561dbefa8878d4df5f1f2ddb1fbeab7f42ffb8cd328bd4a@5.1.83.226:30303"), } From 80b294c3c75091c36970fa7cf133f80c43a49514 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Mon, 17 Aug 2015 14:51:27 +0200 Subject: [PATCH 44/90] Update CPP pubkey --- eth/backend.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/backend.go b/eth/backend.go index 2a8262db8c..2b21a7c960 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -65,7 +65,7 @@ var ( discover.MustParseNode("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303"), // BR discover.MustParseNode("enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303"), // SG // ETH/DEV cpp-ethereum (poc-9.ethdev.com) - discover.MustParseNode("enode://487611428e6c99a11a9795a6abe7b529e81315ca6aad66e2a2fc76e3adf263faba0d35466c2f8f68d561dbefa8878d4df5f1f2ddb1fbeab7f42ffb8cd328bd4a@5.1.83.226:30303"), + discover.MustParseNode("enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303"), } staticNodes = "static-nodes.json" // Path within to search for the static node list From 8839fee415cebb70476312a1bc495abb0eed82e9 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Mon, 17 Aug 2015 15:09:30 +0200 Subject: [PATCH 45/90] rpc/api: return boolean value for eth_submitHashrate --- rpc/api/eth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc/api/eth.go b/rpc/api/eth.go index 820ea761b3..5199bd966d 100644 --- a/rpc/api/eth.go +++ b/rpc/api/eth.go @@ -577,10 +577,10 @@ func (self *ethApi) SubmitWork(req *shared.Request) (interface{}, error) { func (self *ethApi) SubmitHashrate(req *shared.Request) (interface{}, error) { args := new(SubmitHashRateArgs) if err := self.codec.Decode(req.Params, &args); err != nil { - return nil, shared.NewDecodeParamError(err.Error()) + return false, shared.NewDecodeParamError(err.Error()) } self.xeth.RemoteMining().SubmitHashrate(common.HexToHash(args.Id), args.Rate) - return nil, nil + return true, nil } func (self *ethApi) Resend(req *shared.Request) (interface{}, error) { From 49ece3155c998bd877cf96d1b6826c0c5f293a63 Mon Sep 17 00:00:00 2001 From: zsfelfoldi Date: Sun, 9 Aug 2015 02:13:15 +0200 Subject: [PATCH 46/90] GPO update --- eth/gasprice.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/eth/gasprice.go b/eth/gasprice.go index 031098e9a1..3caad73c6c 100644 --- a/eth/gasprice.go +++ b/eth/gasprice.go @@ -37,12 +37,11 @@ type blockPriceInfo struct { type GasPriceOracle struct { eth *Ethereum chain *core.ChainManager - pool *core.TxPool events event.Subscription blocks map[uint64]*blockPriceInfo firstProcessed, lastProcessed uint64 lastBaseMutex sync.Mutex - lastBase *big.Int + lastBase, minBase *big.Int } func NewGasPriceOracle(eth *Ethereum) (self *GasPriceOracle) { @@ -50,13 +49,15 @@ func NewGasPriceOracle(eth *Ethereum) (self *GasPriceOracle) { self.blocks = make(map[uint64]*blockPriceInfo) self.eth = eth self.chain = eth.chainManager - self.pool = eth.txPool self.events = eth.EventMux().Subscribe( core.ChainEvent{}, core.ChainSplitEvent{}, - core.TxPreEvent{}, - core.TxPostEvent{}, ) + + minbase := new(big.Int).Mul(self.eth.GpoMinGasPrice, big.NewInt(100)) + minbase = minbase.Div(minbase, big.NewInt(int64(self.eth.GpobaseCorrectionFactor))) + self.minBase = minbase + self.processPastBlocks() go self.listenLoop() return @@ -93,8 +94,6 @@ func (self *GasPriceOracle) listenLoop() { self.processBlock(ev.Block) case core.ChainSplitEvent: self.processBlock(ev.Block) - case core.TxPreEvent: - case core.TxPostEvent: } } self.events.Unsubscribe() @@ -131,6 +130,10 @@ func (self *GasPriceOracle) processBlock(block *types.Block) { newBase := new(big.Int).Mul(lastBase, big.NewInt(1000000+crand)) newBase.Div(newBase, big.NewInt(1000000)) + if newBase.Cmp(self.minBase) < 0 { + newBase = self.minBase + } + bpi := self.blocks[i] if bpi == nil { bpi = &blockPriceInfo{} @@ -146,7 +149,7 @@ func (self *GasPriceOracle) processBlock(block *types.Block) { // returns the lowers possible price with which a tx was or could have been included func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { - gasUsed := new(big.Int) + gasUsed := big.NewInt(0) receipts := self.eth.BlockProcessor().GetBlockReceipts(block.Hash()) if len(receipts) > 0 { @@ -158,12 +161,12 @@ func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { if new(big.Int).Mul(gasUsed, big.NewInt(100)).Cmp(new(big.Int).Mul(block.GasLimit(), big.NewInt(int64(self.eth.GpoFullBlockRatio)))) < 0 { // block is not full, could have posted a tx with MinGasPrice - return self.eth.GpoMinGasPrice + return big.NewInt(0) } txs := block.Transactions() if len(txs) == 0 { - return self.eth.GpoMinGasPrice + return big.NewInt(0) } // block is full, find smallest gasPrice minPrice := txs[0].GasPrice() From d4da2f630ee16411fe41fc7c50b10a59c696503e Mon Sep 17 00:00:00 2001 From: zelig Date: Tue, 18 Aug 2015 01:25:04 +0200 Subject: [PATCH 47/90] crypto: remove obsolete key files --- crypto/keypair.go | 66 -- crypto/mnemonic.go | 76 -- crypto/mnemonic_test.go | 90 --- crypto/mnemonic_words.go | 1646 -------------------------------------- 4 files changed, 1878 deletions(-) delete mode 100644 crypto/keypair.go delete mode 100644 crypto/mnemonic.go delete mode 100644 crypto/mnemonic_test.go delete mode 100644 crypto/mnemonic_words.go diff --git a/crypto/keypair.go b/crypto/keypair.go deleted file mode 100644 index e070f292fc..0000000000 --- a/crypto/keypair.go +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -import ( - "strings" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/secp256k1" -) - -type KeyPair struct { - PrivateKey []byte - PublicKey []byte - address []byte - mnemonic string - // The associated account - // account *StateObject -} - -func GenerateNewKeyPair() *KeyPair { - _, prv := secp256k1.GenerateKeyPair() - keyPair, _ := NewKeyPairFromSec(prv) // swallow error, this one cannot err - return keyPair -} - -func NewKeyPairFromSec(seckey []byte) (*KeyPair, error) { - pubkey, err := secp256k1.GeneratePubKey(seckey) - if err != nil { - return nil, err - } - - return &KeyPair{PrivateKey: seckey, PublicKey: pubkey}, nil -} - -func (k *KeyPair) Address() []byte { - if k.address == nil { - k.address = Sha3(k.PublicKey[1:])[12:] - } - return k.address -} - -func (k *KeyPair) Mnemonic() string { - if k.mnemonic == "" { - k.mnemonic = strings.Join(MnemonicEncode(common.Bytes2Hex(k.PrivateKey)), " ") - } - return k.mnemonic -} - -func (k *KeyPair) AsStrings() (string, string, string, string) { - return k.Mnemonic(), common.Bytes2Hex(k.Address()), common.Bytes2Hex(k.PrivateKey), common.Bytes2Hex(k.PublicKey) -} diff --git a/crypto/mnemonic.go b/crypto/mnemonic.go deleted file mode 100644 index 34698926cb..0000000000 --- a/crypto/mnemonic.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -import ( - "fmt" - "strconv" -) - -// TODO: See if we can refactor this into a shared util lib if we need it multiple times -func IndexOf(slice []string, value string) int64 { - for p, v := range slice { - if v == value { - return int64(p) - } - } - return -1 -} - -func MnemonicEncode(message string) []string { - var out []string - n := int64(len(MnemonicWords)) - - for i := 0; i < len(message); i += (len(message) / 8) { - x := message[i : i+8] - bit, _ := strconv.ParseInt(x, 16, 64) - w1 := (bit % n) - w2 := ((bit / n) + w1) % n - w3 := ((bit / n / n) + w2) % n - out = append(out, MnemonicWords[w1], MnemonicWords[w2], MnemonicWords[w3]) - } - return out -} - -func MnemonicDecode(wordsar []string) string { - var out string - n := int64(len(MnemonicWords)) - - for i := 0; i < len(wordsar); i += 3 { - word1 := wordsar[i] - word2 := wordsar[i+1] - word3 := wordsar[i+2] - w1 := IndexOf(MnemonicWords, word1) - w2 := IndexOf(MnemonicWords, word2) - w3 := IndexOf(MnemonicWords, word3) - - y := (w2 - w1) % n - z := (w3 - w2) % n - - // Golang handles modulo with negative numbers different then most languages - // The modulo can be negative, we don't want that. - if z < 0 { - z += n - } - if y < 0 { - y += n - } - x := w1 + n*(y) + n*n*(z) - out += fmt.Sprintf("%08x", x) - } - return out -} diff --git a/crypto/mnemonic_test.go b/crypto/mnemonic_test.go deleted file mode 100644 index 07b364a01e..0000000000 --- a/crypto/mnemonic_test.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -import ( - "testing" -) - -func TestMnDecode(t *testing.T) { - words := []string{ - "ink", - "balance", - "gain", - "fear", - "happen", - "melt", - "mom", - "surface", - "stir", - "bottle", - "unseen", - "expression", - "important", - "curl", - "grant", - "fairy", - "across", - "back", - "figure", - "breast", - "nobody", - "scratch", - "worry", - "yesterday", - } - encode := "c61d43dc5bb7a4e754d111dae8105b6f25356492df5e50ecb33b858d94f8c338" - result := MnemonicDecode(words) - if encode != result { - t.Error("We expected", encode, "got", result, "instead") - } -} -func TestMnEncode(t *testing.T) { - encode := "c61d43dc5bb7a4e754d111dae8105b6f25356492df5e50ecb33b858d94f8c338" - result := []string{ - "ink", - "balance", - "gain", - "fear", - "happen", - "melt", - "mom", - "surface", - "stir", - "bottle", - "unseen", - "expression", - "important", - "curl", - "grant", - "fairy", - "across", - "back", - "figure", - "breast", - "nobody", - "scratch", - "worry", - "yesterday", - } - words := MnemonicEncode(encode) - for i, word := range words { - if word != result[i] { - t.Error("Mnenonic does not match:", words, result) - } - } -} diff --git a/crypto/mnemonic_words.go b/crypto/mnemonic_words.go deleted file mode 100644 index 6b8412e897..0000000000 --- a/crypto/mnemonic_words.go +++ /dev/null @@ -1,1646 +0,0 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package crypto - -var MnemonicWords []string = []string{ - "like", - "just", - "love", - "know", - "never", - "want", - "time", - "out", - "there", - "make", - "look", - "eye", - "down", - "only", - "think", - "heart", - "back", - "then", - "into", - "about", - "more", - "away", - "still", - "them", - "take", - "thing", - "even", - "through", - "long", - "always", - "world", - "too", - "friend", - "tell", - "try", - "hand", - "thought", - "over", - "here", - "other", - "need", - "smile", - "again", - "much", - "cry", - "been", - "night", - "ever", - "little", - "said", - "end", - "some", - "those", - "around", - "mind", - "people", - "girl", - "leave", - "dream", - "left", - "turn", - "myself", - "give", - "nothing", - "really", - "off", - "before", - "something", - "find", - "walk", - "wish", - "good", - "once", - "place", - "ask", - "stop", - "keep", - "watch", - "seem", - "everything", - "wait", - "got", - "yet", - "made", - "remember", - "start", - "alone", - "run", - "hope", - "maybe", - "believe", - "body", - "hate", - "after", - "close", - "talk", - "stand", - "own", - "each", - "hurt", - "help", - "home", - "god", - "soul", - "new", - "many", - "two", - "inside", - "should", - "true", - "first", - "fear", - "mean", - "better", - "play", - "another", - "gone", - "change", - "use", - "wonder", - "someone", - "hair", - "cold", - "open", - "best", - "any", - "behind", - "happen", - "water", - "dark", - "laugh", - "stay", - "forever", - "name", - "work", - "show", - "sky", - "break", - "came", - "deep", - "door", - "put", - "black", - "together", - "upon", - "happy", - "such", - "great", - "white", - "matter", - "fill", - "past", - "please", - "burn", - "cause", - "enough", - "touch", - "moment", - "soon", - "voice", - "scream", - "anything", - "stare", - "sound", - "red", - "everyone", - "hide", - "kiss", - "truth", - "death", - "beautiful", - "mine", - "blood", - "broken", - "very", - "pass", - "next", - "forget", - "tree", - "wrong", - "air", - "mother", - "understand", - "lip", - "hit", - "wall", - "memory", - "sleep", - "free", - "high", - "realize", - "school", - "might", - "skin", - "sweet", - "perfect", - "blue", - "kill", - "breath", - "dance", - "against", - "fly", - "between", - "grow", - "strong", - "under", - "listen", - "bring", - "sometimes", - "speak", - "pull", - "person", - "become", - "family", - "begin", - "ground", - "real", - "small", - "father", - "sure", - "feet", - "rest", - "young", - "finally", - "land", - "across", - "today", - "different", - "guy", - "line", - "fire", - "reason", - "reach", - "second", - "slowly", - "write", - "eat", - "smell", - "mouth", - "step", - "learn", - "three", - "floor", - "promise", - "breathe", - "darkness", - "push", - "earth", - "guess", - "save", - "song", - "above", - "along", - "both", - "color", - "house", - "almost", - "sorry", - "anymore", - "brother", - "okay", - "dear", - "game", - "fade", - "already", - "apart", - "warm", - "beauty", - "heard", - "notice", - "question", - "shine", - "began", - "piece", - "whole", - "shadow", - "secret", - "street", - "within", - "finger", - "point", - "morning", - "whisper", - "child", - "moon", - "green", - "story", - "glass", - "kid", - "silence", - "since", - "soft", - "yourself", - "empty", - "shall", - "angel", - "answer", - "baby", - "bright", - "dad", - "path", - "worry", - "hour", - "drop", - "follow", - "power", - "war", - "half", - "flow", - "heaven", - "act", - "chance", - "fact", - "least", - "tired", - "children", - "near", - "quite", - "afraid", - "rise", - "sea", - "taste", - "window", - "cover", - "nice", - "trust", - "lot", - "sad", - "cool", - "force", - "peace", - "return", - "blind", - "easy", - "ready", - "roll", - "rose", - "drive", - "held", - "music", - "beneath", - "hang", - "mom", - "paint", - "emotion", - "quiet", - "clear", - "cloud", - "few", - "pretty", - "bird", - "outside", - "paper", - "picture", - "front", - "rock", - "simple", - "anyone", - "meant", - "reality", - "road", - "sense", - "waste", - "bit", - "leaf", - "thank", - "happiness", - "meet", - "men", - "smoke", - "truly", - "decide", - "self", - "age", - "book", - "form", - "alive", - "carry", - "escape", - "damn", - "instead", - "able", - "ice", - "minute", - "throw", - "catch", - "leg", - "ring", - "course", - "goodbye", - "lead", - "poem", - "sick", - "corner", - "desire", - "known", - "problem", - "remind", - "shoulder", - "suppose", - "toward", - "wave", - "drink", - "jump", - "woman", - "pretend", - "sister", - "week", - "human", - "joy", - "crack", - "grey", - "pray", - "surprise", - "dry", - "knee", - "less", - "search", - "bleed", - "caught", - "clean", - "embrace", - "future", - "king", - "son", - "sorrow", - "chest", - "hug", - "remain", - "sat", - "worth", - "blow", - "daddy", - "final", - "parent", - "tight", - "also", - "create", - "lonely", - "safe", - "cross", - "dress", - "evil", - "silent", - "bone", - "fate", - "perhaps", - "anger", - "class", - "scar", - "snow", - "tiny", - "tonight", - "continue", - "control", - "dog", - "edge", - "mirror", - "month", - "suddenly", - "comfort", - "given", - "loud", - "quickly", - "gaze", - "plan", - "rush", - "stone", - "town", - "battle", - "ignore", - "spirit", - "stood", - "stupid", - "yours", - "brown", - "build", - "dust", - "hey", - "kept", - "pay", - "phone", - "twist", - "although", - "ball", - "beyond", - "hidden", - "nose", - "taken", - "fail", - "float", - "pure", - "somehow", - "wash", - "wrap", - "angry", - "cheek", - "creature", - "forgotten", - "heat", - "rip", - "single", - "space", - "special", - "weak", - "whatever", - "yell", - "anyway", - "blame", - "job", - "choose", - "country", - "curse", - "drift", - "echo", - "figure", - "grew", - "laughter", - "neck", - "suffer", - "worse", - "yeah", - "disappear", - "foot", - "forward", - "knife", - "mess", - "somewhere", - "stomach", - "storm", - "beg", - "idea", - "lift", - "offer", - "breeze", - "field", - "five", - "often", - "simply", - "stuck", - "win", - "allow", - "confuse", - "enjoy", - "except", - "flower", - "seek", - "strength", - "calm", - "grin", - "gun", - "heavy", - "hill", - "large", - "ocean", - "shoe", - "sigh", - "straight", - "summer", - "tongue", - "accept", - "crazy", - "everyday", - "exist", - "grass", - "mistake", - "sent", - "shut", - "surround", - "table", - "ache", - "brain", - "destroy", - "heal", - "nature", - "shout", - "sign", - "stain", - "choice", - "doubt", - "glance", - "glow", - "mountain", - "queen", - "stranger", - "throat", - "tomorrow", - "city", - "either", - "fish", - "flame", - "rather", - "shape", - "spin", - "spread", - "ash", - "distance", - "finish", - "image", - "imagine", - "important", - "nobody", - "shatter", - "warmth", - "became", - "feed", - "flesh", - "funny", - "lust", - "shirt", - "trouble", - "yellow", - "attention", - "bare", - "bite", - "money", - "protect", - "amaze", - "appear", - "born", - "choke", - "completely", - "daughter", - "fresh", - "friendship", - "gentle", - "probably", - "six", - "deserve", - "expect", - "grab", - "middle", - "nightmare", - "river", - "thousand", - "weight", - "worst", - "wound", - "barely", - "bottle", - "cream", - "regret", - "relationship", - "stick", - "test", - "crush", - "endless", - "fault", - "itself", - "rule", - "spill", - "art", - "circle", - "join", - "kick", - "mask", - "master", - "passion", - "quick", - "raise", - "smooth", - "unless", - "wander", - "actually", - "broke", - "chair", - "deal", - "favorite", - "gift", - "note", - "number", - "sweat", - "box", - "chill", - "clothes", - "lady", - "mark", - "park", - "poor", - "sadness", - "tie", - "animal", - "belong", - "brush", - "consume", - "dawn", - "forest", - "innocent", - "pen", - "pride", - "stream", - "thick", - "clay", - "complete", - "count", - "draw", - "faith", - "press", - "silver", - "struggle", - "surface", - "taught", - "teach", - "wet", - "bless", - "chase", - "climb", - "enter", - "letter", - "melt", - "metal", - "movie", - "stretch", - "swing", - "vision", - "wife", - "beside", - "crash", - "forgot", - "guide", - "haunt", - "joke", - "knock", - "plant", - "pour", - "prove", - "reveal", - "steal", - "stuff", - "trip", - "wood", - "wrist", - "bother", - "bottom", - "crawl", - "crowd", - "fix", - "forgive", - "frown", - "grace", - "loose", - "lucky", - "party", - "release", - "surely", - "survive", - "teacher", - "gently", - "grip", - "speed", - "suicide", - "travel", - "treat", - "vein", - "written", - "cage", - "chain", - "conversation", - "date", - "enemy", - "however", - "interest", - "million", - "page", - "pink", - "proud", - "sway", - "themselves", - "winter", - "church", - "cruel", - "cup", - "demon", - "experience", - "freedom", - "pair", - "pop", - "purpose", - "respect", - "shoot", - "softly", - "state", - "strange", - "bar", - "birth", - "curl", - "dirt", - "excuse", - "lord", - "lovely", - "monster", - "order", - "pack", - "pants", - "pool", - "scene", - "seven", - "shame", - "slide", - "ugly", - "among", - "blade", - "blonde", - "closet", - "creek", - "deny", - "drug", - "eternity", - "gain", - "grade", - "handle", - "key", - "linger", - "pale", - "prepare", - "swallow", - "swim", - "tremble", - "wheel", - "won", - "cast", - "cigarette", - "claim", - "college", - "direction", - "dirty", - "gather", - "ghost", - "hundred", - "loss", - "lung", - "orange", - "present", - "swear", - "swirl", - "twice", - "wild", - "bitter", - "blanket", - "doctor", - "everywhere", - "flash", - "grown", - "knowledge", - "numb", - "pressure", - "radio", - "repeat", - "ruin", - "spend", - "unknown", - "buy", - "clock", - "devil", - "early", - "false", - "fantasy", - "pound", - "precious", - "refuse", - "sheet", - "teeth", - "welcome", - "add", - "ahead", - "block", - "bury", - "caress", - "content", - "depth", - "despite", - "distant", - "marry", - "purple", - "threw", - "whenever", - "bomb", - "dull", - "easily", - "grasp", - "hospital", - "innocence", - "normal", - "receive", - "reply", - "rhyme", - "shade", - "someday", - "sword", - "toe", - "visit", - "asleep", - "bought", - "center", - "consider", - "flat", - "hero", - "history", - "ink", - "insane", - "muscle", - "mystery", - "pocket", - "reflection", - "shove", - "silently", - "smart", - "soldier", - "spot", - "stress", - "train", - "type", - "view", - "whether", - "bus", - "energy", - "explain", - "holy", - "hunger", - "inch", - "magic", - "mix", - "noise", - "nowhere", - "prayer", - "presence", - "shock", - "snap", - "spider", - "study", - "thunder", - "trail", - "admit", - "agree", - "bag", - "bang", - "bound", - "butterfly", - "cute", - "exactly", - "explode", - "familiar", - "fold", - "further", - "pierce", - "reflect", - "scent", - "selfish", - "sharp", - "sink", - "spring", - "stumble", - "universe", - "weep", - "women", - "wonderful", - "action", - "ancient", - "attempt", - "avoid", - "birthday", - "branch", - "chocolate", - "core", - "depress", - "drunk", - "especially", - "focus", - "fruit", - "honest", - "match", - "palm", - "perfectly", - "pillow", - "pity", - "poison", - "roar", - "shift", - "slightly", - "thump", - "truck", - "tune", - "twenty", - "unable", - "wipe", - "wrote", - "coat", - "constant", - "dinner", - "drove", - "egg", - "eternal", - "flight", - "flood", - "frame", - "freak", - "gasp", - "glad", - "hollow", - "motion", - "peer", - "plastic", - "root", - "screen", - "season", - "sting", - "strike", - "team", - "unlike", - "victim", - "volume", - "warn", - "weird", - "attack", - "await", - "awake", - "built", - "charm", - "crave", - "despair", - "fought", - "grant", - "grief", - "horse", - "limit", - "message", - "ripple", - "sanity", - "scatter", - "serve", - "split", - "string", - "trick", - "annoy", - "blur", - "boat", - "brave", - "clearly", - "cling", - "connect", - "fist", - "forth", - "imagination", - "iron", - "jock", - "judge", - "lesson", - "milk", - "misery", - "nail", - "naked", - "ourselves", - "poet", - "possible", - "princess", - "sail", - "size", - "snake", - "society", - "stroke", - "torture", - "toss", - "trace", - "wise", - "bloom", - "bullet", - "cell", - "check", - "cost", - "darling", - "during", - "footstep", - "fragile", - "hallway", - "hardly", - "horizon", - "invisible", - "journey", - "midnight", - "mud", - "nod", - "pause", - "relax", - "shiver", - "sudden", - "value", - "youth", - "abuse", - "admire", - "blink", - "breast", - "bruise", - "constantly", - "couple", - "creep", - "curve", - "difference", - "dumb", - "emptiness", - "gotta", - "honor", - "plain", - "planet", - "recall", - "rub", - "ship", - "slam", - "soar", - "somebody", - "tightly", - "weather", - "adore", - "approach", - "bond", - "bread", - "burst", - "candle", - "coffee", - "cousin", - "crime", - "desert", - "flutter", - "frozen", - "grand", - "heel", - "hello", - "language", - "level", - "movement", - "pleasure", - "powerful", - "random", - "rhythm", - "settle", - "silly", - "slap", - "sort", - "spoken", - "steel", - "threaten", - "tumble", - "upset", - "aside", - "awkward", - "bee", - "blank", - "board", - "button", - "card", - "carefully", - "complain", - "crap", - "deeply", - "discover", - "drag", - "dread", - "effort", - "entire", - "fairy", - "giant", - "gotten", - "greet", - "illusion", - "jeans", - "leap", - "liquid", - "march", - "mend", - "nervous", - "nine", - "replace", - "rope", - "spine", - "stole", - "terror", - "accident", - "apple", - "balance", - "boom", - "childhood", - "collect", - "demand", - "depression", - "eventually", - "faint", - "glare", - "goal", - "group", - "honey", - "kitchen", - "laid", - "limb", - "machine", - "mere", - "mold", - "murder", - "nerve", - "painful", - "poetry", - "prince", - "rabbit", - "shelter", - "shore", - "shower", - "soothe", - "stair", - "steady", - "sunlight", - "tangle", - "tease", - "treasure", - "uncle", - "begun", - "bliss", - "canvas", - "cheer", - "claw", - "clutch", - "commit", - "crimson", - "crystal", - "delight", - "doll", - "existence", - "express", - "fog", - "football", - "gay", - "goose", - "guard", - "hatred", - "illuminate", - "mass", - "math", - "mourn", - "rich", - "rough", - "skip", - "stir", - "student", - "style", - "support", - "thorn", - "tough", - "yard", - "yearn", - "yesterday", - "advice", - "appreciate", - "autumn", - "bank", - "beam", - "bowl", - "capture", - "carve", - "collapse", - "confusion", - "creation", - "dove", - "feather", - "girlfriend", - "glory", - "government", - "harsh", - "hop", - "inner", - "loser", - "moonlight", - "neighbor", - "neither", - "peach", - "pig", - "praise", - "screw", - "shield", - "shimmer", - "sneak", - "stab", - "subject", - "throughout", - "thrown", - "tower", - "twirl", - "wow", - "army", - "arrive", - "bathroom", - "bump", - "cease", - "cookie", - "couch", - "courage", - "dim", - "guilt", - "howl", - "hum", - "husband", - "insult", - "led", - "lunch", - "mock", - "mostly", - "natural", - "nearly", - "needle", - "nerd", - "peaceful", - "perfection", - "pile", - "price", - "remove", - "roam", - "sanctuary", - "serious", - "shiny", - "shook", - "sob", - "stolen", - "tap", - "vain", - "void", - "warrior", - "wrinkle", - "affection", - "apologize", - "blossom", - "bounce", - "bridge", - "cheap", - "crumble", - "decision", - "descend", - "desperately", - "dig", - "dot", - "flip", - "frighten", - "heartbeat", - "huge", - "lazy", - "lick", - "odd", - "opinion", - "process", - "puzzle", - "quietly", - "retreat", - "score", - "sentence", - "separate", - "situation", - "skill", - "soak", - "square", - "stray", - "taint", - "task", - "tide", - "underneath", - "veil", - "whistle", - "anywhere", - "bedroom", - "bid", - "bloody", - "burden", - "careful", - "compare", - "concern", - "curtain", - "decay", - "defeat", - "describe", - "double", - "dreamer", - "driver", - "dwell", - "evening", - "flare", - "flicker", - "grandma", - "guitar", - "harm", - "horrible", - "hungry", - "indeed", - "lace", - "melody", - "monkey", - "nation", - "object", - "obviously", - "rainbow", - "salt", - "scratch", - "shown", - "shy", - "stage", - "stun", - "third", - "tickle", - "useless", - "weakness", - "worship", - "worthless", - "afternoon", - "beard", - "boyfriend", - "bubble", - "busy", - "certain", - "chin", - "concrete", - "desk", - "diamond", - "doom", - "drawn", - "due", - "felicity", - "freeze", - "frost", - "garden", - "glide", - "harmony", - "hopefully", - "hunt", - "jealous", - "lightning", - "mama", - "mercy", - "peel", - "physical", - "position", - "pulse", - "punch", - "quit", - "rant", - "respond", - "salty", - "sane", - "satisfy", - "savior", - "sheep", - "slept", - "social", - "sport", - "tuck", - "utter", - "valley", - "wolf", - "aim", - "alas", - "alter", - "arrow", - "awaken", - "beaten", - "belief", - "brand", - "ceiling", - "cheese", - "clue", - "confidence", - "connection", - "daily", - "disguise", - "eager", - "erase", - "essence", - "everytime", - "expression", - "fan", - "flag", - "flirt", - "foul", - "fur", - "giggle", - "glorious", - "ignorance", - "law", - "lifeless", - "measure", - "mighty", - "muse", - "north", - "opposite", - "paradise", - "patience", - "patient", - "pencil", - "petal", - "plate", - "ponder", - "possibly", - "practice", - "slice", - "spell", - "stock", - "strife", - "strip", - "suffocate", - "suit", - "tender", - "tool", - "trade", - "velvet", - "verse", - "waist", - "witch", - "aunt", - "bench", - "bold", - "cap", - "certainly", - "click", - "companion", - "creator", - "dart", - "delicate", - "determine", - "dish", - "dragon", - "drama", - "drum", - "dude", - "everybody", - "feast", - "forehead", - "former", - "fright", - "fully", - "gas", - "hook", - "hurl", - "invite", - "juice", - "manage", - "moral", - "possess", - "raw", - "rebel", - "royal", - "scale", - "scary", - "several", - "slight", - "stubborn", - "swell", - "talent", - "tea", - "terrible", - "thread", - "torment", - "trickle", - "usually", - "vast", - "violence", - "weave", - "acid", - "agony", - "ashamed", - "awe", - "belly", - "blend", - "blush", - "character", - "cheat", - "common", - "company", - "coward", - "creak", - "danger", - "deadly", - "defense", - "define", - "depend", - "desperate", - "destination", - "dew", - "duck", - "dusty", - "embarrass", - "engine", - "example", - "explore", - "foe", - "freely", - "frustrate", - "generation", - "glove", - "guilty", - "health", - "hurry", - "idiot", - "impossible", - "inhale", - "jaw", - "kingdom", - "mention", - "mist", - "moan", - "mumble", - "mutter", - "observe", - "ode", - "pathetic", - "pattern", - "pie", - "prefer", - "puff", - "rape", - "rare", - "revenge", - "rude", - "scrape", - "spiral", - "squeeze", - "strain", - "sunset", - "suspend", - "sympathy", - "thigh", - "throne", - "total", - "unseen", - "weapon", - "weary", -} From 4d5501c46af2f8c02dd6e361a01b943608958130 Mon Sep 17 00:00:00 2001 From: Maran Date: Tue, 18 Aug 2015 15:56:37 +0200 Subject: [PATCH 48/90] cmd/geth: Fix chain purging from cmd line --- cmd/geth/chaincmd.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index 876b8c6bad..c420459189 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -115,17 +115,16 @@ func exportChain(ctx *cli.Context) { } func removeDB(ctx *cli.Context) { - confirm, err := utils.PromptConfirm("Remove local databases?") + confirm, err := utils.PromptConfirm("Remove local database?") if err != nil { utils.Fatalf("%v", err) } if confirm { - fmt.Println("Removing chain and state databases...") + fmt.Println("Removing chaindata...") start := time.Now() - os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "blockchain")) - os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "state")) + os.RemoveAll(filepath.Join(ctx.GlobalString(utils.DataDirFlag.Name), "chaindata")) fmt.Printf("Removed in %v\n", time.Since(start)) } else { From b4369e10150f4c1211ae1bf2de6cf0567e9a7dd2 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 18 Aug 2015 21:16:33 +0200 Subject: [PATCH 49/90] core, miner: write miner receipts --- core/block_processor.go | 8 +++----- core/chain_manager.go | 4 +++- core/filter.go | 4 +++- miner/worker.go | 7 +++++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/core/block_processor.go b/core/block_processor.go index 829e4314c3..dd7fe8962c 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -349,11 +349,9 @@ func (sm *BlockProcessor) GetBlockReceipts(bhash common.Hash) types.Receipts { // the depricated way by re-processing the block. func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err error) { receipts := GetBlockReceipts(sm.chainDb, block.Hash()) - if len(receipts) > 0 { - // coalesce logs - for _, receipt := range receipts { - logs = append(logs, receipt.Logs()...) - } + // coalesce logs + for _, receipt := range receipts { + logs = append(logs, receipt.Logs()...) } return logs, nil } diff --git a/core/chain_manager.go b/core/chain_manager.go index 1647031b1c..cf5b8bd78b 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -647,7 +647,9 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) { queue[i] = ChainSplitEvent{block, logs} queueEvent.splitCount++ } - PutBlockReceipts(self.chainDb, block, receipts) + if err := PutBlockReceipts(self.chainDb, block, receipts); err != nil { + glog.V(logger.Warn).Infoln("error writing block receipts:", err) + } stats.processed++ } diff --git a/core/filter.go b/core/filter.go index 8a876396be..c34d6ff6cc 100644 --- a/core/filter.go +++ b/core/filter.go @@ -22,6 +22,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/logger" + "github.com/ethereum/go-ethereum/logger/glog" ) type AccountChange struct { @@ -111,7 +113,7 @@ done: // Get the logs of the block unfiltered, err := self.eth.BlockProcessor().GetLogs(block) if err != nil { - chainlogger.Warnln("err: filter get logs ", err) + glog.V(logger.Warn).Infoln("err: filter get logs ", err) break } diff --git a/miner/worker.go b/miner/worker.go index df3681470d..aa2132a51c 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -297,14 +297,17 @@ func (self *worker) wait() { } // broadcast before waiting for validation - go func(block *types.Block, logs state.Logs) { + go func(block *types.Block, logs state.Logs, receipts []*types.Receipt) { self.mux.Post(core.NewMinedBlockEvent{block}) self.mux.Post(core.ChainEvent{block, block.Hash(), logs}) if stat == core.CanonStatTy { self.mux.Post(core.ChainHeadEvent{block}) self.mux.Post(logs) } - }(block, work.state.Logs()) + if err := core.PutBlockReceipts(self.chainDb, block, receipts); err != nil { + glog.V(logger.Warn).Infoln("error writing block receipts:", err) + } + }(block, work.state.Logs(), work.receipts) } // check staleness and display confirmation From cc87551edc62fb8796c2800c655a0162ef7ab441 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Tue, 18 Aug 2015 22:46:48 +0200 Subject: [PATCH 50/90] Codecov integration --- .travis.yml | 4 ++-- build/test-global-coverage.sh | 31 ++++++++++--------------------- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2b3ff92f61..13211f7363 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ install: # - go get code.google.com/p/go.tools/cmd/goimports # - go get github.com/golang/lint/golint # - go get golang.org/x/tools/cmd/vet - - go get golang.org/x/tools/cmd/cover github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover before_script: # - gofmt -l -w . # - goimports -l -w . @@ -15,7 +15,7 @@ before_script: script: - make travis-test-with-coverage after_success: - - if [ "$COVERALLS_TOKEN" ]; then goveralls -coverprofile=profile.cov -service=travis-ci -repotoken $COVERALLS_TOKEN; fi + - bash <(curl -s https://codecov.io/bash) env: global: - secure: "U2U1AmkU4NJBgKR/uUAebQY87cNL0+1JHjnLOmmXwxYYyj5ralWb1aSuSH3qSXiT93qLBmtaUkuv9fberHVqrbAeVlztVdUsKAq7JMQH+M99iFkC9UiRMqHmtjWJ0ok4COD1sRYixxi21wb/JrMe3M1iL4QJVS61iltjHhVdM64=" diff --git a/build/test-global-coverage.sh b/build/test-global-coverage.sh index 5bb233a31d..a51b6a9e57 100755 --- a/build/test-global-coverage.sh +++ b/build/test-global-coverage.sh @@ -1,26 +1,15 @@ -#!/bin/bash - -# This script runs all package tests and merges the resulting coverage -# profiles. Coverage is accounted per package under test. +#!/usr/bin/env bash set -e +echo "" > coverage.txt -if [ ! -f "build/env.sh" ]; then - echo "$0 must be run from the root of the repository." - exit 2 -fi - -echo "mode: count" > profile.cov - -for pkg in $(go list ./...); do - # drop the namespace prefix. - dir=${pkg##github.com/ethereum/go-ethereum/} - - if [[ $dir != "tests" ]]; then - go test -covermode=count -coverprofile=$dir/profile.tmp $pkg - fi - if [[ -f $dir/profile.tmp ]]; then - tail -n +2 $dir/profile.tmp >> profile.cov - rm $dir/profile.tmp +for d in $(find ./* -maxdepth 10 -type d -not -path "./build" -not -path "./Godeps/*" ); do + if ls $d/*.go &> /dev/null; then + go test -coverprofile=profile.out -covermode=atomic $d + if [ -f profile.out ]; then + cat profile.out >> coverage.txt + echo '<<<<<< EOF' >> coverage.txt + rm profile.out + fi fi done From 18d450b2d02c68bf8b3d02d04d3a4f6362e374c9 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Tue, 18 Aug 2015 22:46:58 +0200 Subject: [PATCH 51/90] Updated README, Added CONTRIBUTING --- CONTRIBUTING.md | 9 +++++++++ README.md | 45 ++++++++++++++++++++------------------------- 2 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..918a2c1546 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +If you'd like to contribute to go-ethereum please fork, fix, commit and +send a pull request. Commits who do not comply with the coding standards +are ignored (use gofmt!). If you send pull requests make absolute sure that you +commit on the `develop` branch and that you do not merge to master. +Commits that are directly based on master are simply ignored. + +See [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide) +for more details on configuring your environment, testing, and +dependency management. diff --git a/README.md b/README.md index b9ab28fdb1..717e726e34 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,18 @@ ## Ethereum Go -Ethereum Go Client, by Jeffrey Wilcke (and some other people). +Official golang implementation of the Ethereum protocol | Linux | OSX | ARM | Windows | Tests ----------|---------|-----|-----|---------|------ -develop | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/Linux%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/OSX%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20develop%20branch)](https://build.ethdev.com/builders/ARM%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20develop%20branch)](https://build.ethdev.com/builders/Windows%20Go%20develop%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=develop)](https://travis-ci.org/ethereum/go-ethereum) [![Coverage Status](https://coveralls.io/repos/ethereum/go-ethereum/badge.svg?branch=develop)](https://coveralls.io/r/ethereum/go-ethereum?branch=develop) -master | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](https://build.ethdev.com/builders/Linux%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=OSX%20Go%20master%20branch)](https://build.ethdev.com/builders/OSX%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20master%20branch)](https://build.ethdev.com/builders/ARM%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20master%20branch)](https://build.ethdev.com/builders/Windows%20Go%20master%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=master)](https://travis-ci.org/ethereum/go-ethereum) [![Coverage Status](https://coveralls.io/repos/ethereum/go-ethereum/badge.svg?branch=master)](https://coveralls.io/r/ethereum/go-ethereum?branch=master) +develop | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/Linux%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/OSX%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20develop%20branch)](https://build.ethdev.com/builders/ARM%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20develop%20branch)](https://build.ethdev.com/builders/Windows%20Go%20develop%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=develop)](https://travis-ci.org/ethereum/go-ethereum) [![codecov.io](http://codecov.io/github/ethereum/go-ethereum/coverage.svg?branch=develop)](http://codecov.io/github/ethereum/go-ethereum?branch=develop) +master | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](https://build.ethdev.com/builders/Linux%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=OSX%20Go%20master%20branch)](https://build.ethdev.com/builders/OSX%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20master%20branch)](https://build.ethdev.com/builders/ARM%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20master%20branch)](https://build.ethdev.com/builders/Windows%20Go%20master%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=master)](https://travis-ci.org/ethereum/go-ethereum) [![codecov.io](http://codecov.io/github/ethereum/go-ethereum/coverage.svg?branch=master)](http://codecov.io/github/ethereum/go-ethereum?branch=master) -[![Bugs](https://badge.waffle.io/ethereum/go-ethereum.png?label=bug&title=Bugs)](https://waffle.io/ethereum/go-ethereum) -[![Stories in Ready](https://badge.waffle.io/ethereum/go-ethereum.png?label=ready&title=Ready)](https://waffle.io/ethereum/go-ethereum) -[![Stories in Progress](https://badge.waffle.io/ethereum/go-ethereum.svg?label=in%20progress&title=In Progress)](http://waffle.io/ethereum/go-ethereum) +[![API Reference]( +https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667 +)](https://godoc.org/github.com/ethereum/go-ethereum) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) -Automated development builds -====================== +## Automated development builds The following builds are build automatically by our build servers after each push to the [develop](https://github.com/ethereum/go-ethereum/tree/develop) branch. @@ -25,8 +24,7 @@ The following builds are build automatically by our build servers after each pus * [Windows 64-bit](https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.zip) * [ARM](https://build.ethdev.com/builds/ARM%20Go%20develop%20branch/geth-ARM-latest.tar.bz2) -Building the source -=================== +## Building the source For prerequisites and detailed build instructions please read the [Installation Instructions](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum) @@ -38,34 +36,31 @@ Once the dependencies are installed, run make geth -Executables -=========== +## Executables Go Ethereum comes with several wrappers/executables found in [the `cmd` directory](https://github.com/ethereum/go-ethereum/tree/develop/cmd): -* `geth` Ethereum CLI (ethereum command line interface client) -* `bootnode` runs a bootstrap node for the Discovery Protocol -* `ethtest` test tool which runs with the [tests](https://github.com/ethereum/tests) suite: - `/path/to/test.json > ethtest --test BlockTests --stdin`. -* `evm` is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas - 10000 -price 0 -dump`. See `-h` for a detailed description. -* `disasm` disassembles EVM code: `echo "6001" | disasm` -* `rlpdump` prints RLP structures + Command | | +----------|---------| +`geth` | Ethereum CLI (ethereum command line interface client) | +`bootnode` | runs a bootstrap node for the Discovery Protocol | +`ethtest` | test tool which runs with the [tests](https://github.com/ethereum/tests) suite: `/path/to/test.json > ethtest --test BlockTests --stdin`. +`evm` | is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas 10000 -price 0 -dump`. See `-h` for a detailed description. | +`disasm` | disassembles EVM code: `echo "6001" | disasm` | +`rlpdump` | prints RLP structures | -Command line options -==================== +## Command line options `geth` can be configured via command line options, environment variables and config files. To get the options available: - geth --help + geth help For further details on options, see the [wiki](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options) -Contribution -============ +## Contribution If you'd like to contribute to go-ethereum please fork, fix, commit and send a pull request. Commits who do not comply with the coding standards From 941920f2aa651abc6bd72deda09f62d77aeaa2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Wed, 19 Aug 2015 15:14:26 +0300 Subject: [PATCH 52/90] eth: fix an issue with pulling and inserting blocks twice --- eth/handler.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eth/handler.go b/eth/handler.go index 2bd3699013..5d233dd968 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -413,10 +413,12 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { pm.fetcher.Enqueue(p.id, request.Block) - // TODO: Schedule a sync to cover potential gaps (this needs proto update) + // Update the peers total difficulty if needed, schedule a download if gapped if request.TD.Cmp(p.Td()) > 0 { p.SetTd(request.TD) - go pm.synchronise(p) + if request.TD.Cmp(new(big.Int).Add(pm.chainman.Td(), request.Block.Difficulty())) > 0 { + go pm.synchronise(p) + } } case TxMsg: From 7d5ff770e22a3791c0f9c2794a19f59ca2756b33 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 19 Aug 2015 14:11:12 +0200 Subject: [PATCH 53/90] p2p/discover: continue reading after temporary errors Might solve #1579 --- p2p/discover/udp.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index 008e63937d..6aefb68f7e 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -458,6 +458,10 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte, return packet, nil } +type tempError interface { + Temporary() bool +} + // readLoop runs in its own goroutine. it handles incoming UDP packets. func (t *udp) readLoop() { defer t.conn.Close() @@ -467,7 +471,13 @@ func (t *udp) readLoop() { buf := make([]byte, 1280) for { nbytes, from, err := t.conn.ReadFromUDP(buf) - if err != nil { + if tempErr, ok := err.(tempError); ok && tempErr.Temporary() { + // Ignore temporary read errors. + glog.V(logger.Debug).Infof("Temporary read error: %v", err) + continue + } else if err != nil { + // Shut down the loop for permament errors. + glog.V(logger.Debug).Infof("Read error: %v", err) return } t.handlePacket(from, buf[:nbytes]) From edccc7ae3430836141b803c252f26bf1ef98d185 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 19 Aug 2015 14:35:01 +0200 Subject: [PATCH 54/90] p2p: continue listening after temporary errors --- p2p/server.go | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/p2p/server.go b/p2p/server.go index 7351a26544..d8be853230 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -542,6 +542,10 @@ func (srv *Server) encHandshakeChecks(peers map[discover.NodeID]*Peer, c *conn) } } +type tempError interface { + Temporary() bool +} + // listenLoop runs in its own goroutine and accepts // inbound connections. func (srv *Server) listenLoop() { @@ -561,16 +565,31 @@ func (srv *Server) listenLoop() { } for { + // Wait for a handshake slot before accepting. <-slots - fd, err := srv.listener.Accept() - if err != nil { - return - } - mfd := newMeteredConn(fd, true) - glog.V(logger.Debug).Infof("Accepted conn %v\n", mfd.RemoteAddr()) + var ( + fd net.Conn + err error + ) + for { + fd, err = srv.listener.Accept() + if tempErr, ok := err.(tempError); ok && tempErr.Temporary() { + glog.V(logger.Debug).Infof("Temporary read error: %v", err) + continue + } else if err != nil { + glog.V(logger.Debug).Infof("Read error: %v", err) + return + } + break + } + fd = newMeteredConn(fd, true) + glog.V(logger.Debug).Infof("Accepted conn %v\n", fd.RemoteAddr()) + + // Spawn the handler. It will give the slot back when the connection + // has been established. go func() { - srv.setupConn(mfd, inboundConn, nil) + srv.setupConn(fd, inboundConn, nil) slots <- struct{}{} }() } From dd54fef89888372ab5961c1b5a6ac917fc47d49c Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 17 Aug 2015 11:27:41 +0200 Subject: [PATCH 55/90] p2p/discover: don't attempt to replace nodes that are being replaced PR #1621 changed Table locking so the mutex is not held while a contested node is being pinged. If multiple nodes ping the local node during this time window, multiple ping packets will be sent to the contested node. The changes in this commit prevent multiple packets by tracking whether the node is being replaced. --- p2p/discover/node.go | 4 ++++ p2p/discover/table.go | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/p2p/discover/node.go b/p2p/discover/node.go index b6956e197d..a14f294249 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -48,6 +48,10 @@ type Node struct { // In those tests, the content of sha will not actually correspond // with ID. sha common.Hash + + // whether this node is currently being pinged in order to replace + // it in a bucket + contested bool } func newNode(id NodeID, ip net.IP, udpPort, tcpPort uint16) *Node { diff --git a/p2p/discover/table.go b/p2p/discover/table.go index b077f010c7..972bc10777 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -455,24 +455,31 @@ func (tab *Table) ping(id NodeID, addr *net.UDPAddr) error { func (tab *Table) add(new *Node) { b := tab.buckets[logdist(tab.self.sha, new.sha)] tab.mutex.Lock() + defer tab.mutex.Unlock() if b.bump(new) { - tab.mutex.Unlock() return } var oldest *Node if len(b.entries) == bucketSize { oldest = b.entries[bucketSize-1] + if oldest.contested { + // The node is already being replaced, don't attempt + // to replace it. + return + } + oldest.contested = true // Let go of the mutex so other goroutines can access // the table while we ping the least recently active node. tab.mutex.Unlock() - if err := tab.ping(oldest.ID, oldest.addr()); err == nil { + err := tab.ping(oldest.ID, oldest.addr()) + tab.mutex.Lock() + oldest.contested = false + if err == nil { // The node responded, don't replace it. return } - tab.mutex.Lock() } added := b.replace(new, oldest) - tab.mutex.Unlock() if added && tab.nodeAddedHook != nil { tab.nodeAddedHook(new) } From 269c5c71072f9e17e6387f853d626bff1160db5c Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Wed, 19 Aug 2015 21:46:01 +0200 Subject: [PATCH 56/90] Revert "fdtrack: temporary hack for tracking file descriptor usage" This reverts commit 5c949d3b3ba81ea0563575b19a7b148aeac4bf61. --- .../src/github.com/huin/goupnp/httpu/httpu.go | 4 - .../src/github.com/huin/goupnp/soap/soap.go | 14 --- .../github.com/jackpal/go-nat-pmp/natpmp.go | 4 - .../goleveldb/leveldb/storage/file_storage.go | 5 - cmd/geth/main.go | 4 - fdtrack/fdtrack.go | 112 ------------------ fdtrack/fdusage.go | 29 ----- fdtrack/fdusage_darwin.go | 72 ----------- fdtrack/fdusage_linux.go | 53 --------- p2p/dial.go | 2 - p2p/discover/udp.go | 3 - p2p/metrics.go | 8 +- p2p/server.go | 3 +- rpc/comms/http.go | 2 - rpc/comms/ipc_unix.go | 6 +- 15 files changed, 7 insertions(+), 314 deletions(-) delete mode 100644 fdtrack/fdtrack.go delete mode 100644 fdtrack/fdusage.go delete mode 100644 fdtrack/fdusage_darwin.go delete mode 100644 fdtrack/fdusage_linux.go diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go b/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go index 3f4606af0f..862c3def42 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/httpu/httpu.go @@ -9,8 +9,6 @@ import ( "net/http" "sync" "time" - - "github.com/ethereum/go-ethereum/fdtrack" ) // HTTPUClient is a client for dealing with HTTPU (HTTP over UDP). Its typical @@ -27,7 +25,6 @@ func NewHTTPUClient() (*HTTPUClient, error) { if err != nil { return nil, err } - fdtrack.Open("upnp") return &HTTPUClient{conn: conn}, nil } @@ -36,7 +33,6 @@ func NewHTTPUClient() (*HTTPUClient, error) { func (httpu *HTTPUClient) Close() error { httpu.connLock.Lock() defer httpu.connLock.Unlock() - fdtrack.Close("upnp") return httpu.conn.Close() } diff --git a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go b/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go index 786ce6fa84..815610734c 100644 --- a/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go +++ b/Godeps/_workspace/src/github.com/huin/goupnp/soap/soap.go @@ -7,12 +7,9 @@ import ( "encoding/xml" "fmt" "io/ioutil" - "net" "net/http" "net/url" "reflect" - - "github.com/ethereum/go-ethereum/fdtrack" ) const ( @@ -29,17 +26,6 @@ type SOAPClient struct { func NewSOAPClient(endpointURL url.URL) *SOAPClient { return &SOAPClient{ EndpointURL: endpointURL, - HTTPClient: http.Client{ - Transport: &http.Transport{ - Dial: func(network, addr string) (net.Conn, error) { - c, err := net.Dial(network, addr) - if c != nil { - c = fdtrack.WrapConn("upnp", c) - } - return c, err - }, - }, - }, } } diff --git a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go b/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go index b165c784e3..8ce4e8342e 100644 --- a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go +++ b/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go @@ -5,8 +5,6 @@ import ( "log" "net" "time" - - "github.com/ethereum/go-ethereum/fdtrack" ) // Implement the NAT-PMP protocol, typically supported by Apple routers and open source @@ -104,8 +102,6 @@ func (n *Client) rpc(msg []byte, resultSize int) (result []byte, err error) { if err != nil { return } - fdtrack.Open("natpmp") - defer fdtrack.Close("natpmp") defer conn.Close() result = make([]byte, resultSize) diff --git a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go index 6d44f74b38..46cc9d0701 100644 --- a/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go +++ b/Godeps/_workspace/src/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go @@ -18,7 +18,6 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/syndtr/goleveldb/leveldb/util" ) @@ -370,8 +369,6 @@ func (fw fileWrap) Close() error { err := fw.File.Close() if err != nil { f.fs.log(fmt.Sprintf("close %s.%d: %v", f.Type(), f.Num(), err)) - } else { - fdtrack.Close("leveldb") } return err } @@ -403,7 +400,6 @@ func (f *file) Open() (Reader, error) { return nil, err } ok: - fdtrack.Open("leveldb") f.open = true f.fs.open++ return fileWrap{of, f}, nil @@ -422,7 +418,6 @@ func (f *file) Create() (Writer, error) { if err != nil { return nil, err } - fdtrack.Open("leveldb") f.open = true f.fs.open++ return fileWrap{of, f}, nil diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 2dc3c438f6..07c4daf60c 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -37,7 +37,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/metrics" @@ -546,9 +545,6 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) { // Start Ethereum itself utils.StartEthereum(eth) - // Start logging file descriptor stats. - fdtrack.Start() - am := eth.AccountManager() account := ctx.GlobalString(utils.UnlockedAccountFlag.Name) accounts := strings.Split(account, " ") diff --git a/fdtrack/fdtrack.go b/fdtrack/fdtrack.go deleted file mode 100644 index 2f5ab57f44..0000000000 --- a/fdtrack/fdtrack.go +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// Package fdtrack logs statistics about open file descriptors. -package fdtrack - -import ( - "fmt" - "net" - "sort" - "sync" - "time" - - "github.com/ethereum/go-ethereum/logger/glog" -) - -var ( - mutex sync.Mutex - all = make(map[string]int) -) - -func Open(desc string) { - mutex.Lock() - all[desc] += 1 - mutex.Unlock() -} - -func Close(desc string) { - mutex.Lock() - defer mutex.Unlock() - if c, ok := all[desc]; ok { - if c == 1 { - delete(all, desc) - } else { - all[desc]-- - } - } -} - -func WrapListener(desc string, l net.Listener) net.Listener { - Open(desc) - return &wrappedListener{l, desc} -} - -type wrappedListener struct { - net.Listener - desc string -} - -func (w *wrappedListener) Accept() (net.Conn, error) { - c, err := w.Listener.Accept() - if err == nil { - c = WrapConn(w.desc, c) - } - return c, err -} - -func (w *wrappedListener) Close() error { - err := w.Listener.Close() - if err == nil { - Close(w.desc) - } - return err -} - -func WrapConn(desc string, conn net.Conn) net.Conn { - Open(desc) - return &wrappedConn{conn, desc} -} - -type wrappedConn struct { - net.Conn - desc string -} - -func (w *wrappedConn) Close() error { - err := w.Conn.Close() - if err == nil { - Close(w.desc) - } - return err -} - -func Start() { - go func() { - for range time.Tick(15 * time.Second) { - mutex.Lock() - var sum, tracked = 0, []string{} - for what, n := range all { - sum += n - tracked = append(tracked, fmt.Sprintf("%s:%d", what, n)) - } - mutex.Unlock() - used, _ := fdusage() - sort.Strings(tracked) - glog.Infof("fd usage %d/%d, tracked %d %v", used, fdlimit(), sum, tracked) - } - }() -} diff --git a/fdtrack/fdusage.go b/fdtrack/fdusage.go deleted file mode 100644 index 689625a8f5..0000000000 --- a/fdtrack/fdusage.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build !linux,!darwin - -package fdtrack - -import "errors" - -func fdlimit() int { - return 0 -} - -func fdusage() (int, error) { - return 0, errors.New("not implemented") -} diff --git a/fdtrack/fdusage_darwin.go b/fdtrack/fdusage_darwin.go deleted file mode 100644 index 04a3a9baf7..0000000000 --- a/fdtrack/fdusage_darwin.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build darwin - -package fdtrack - -import ( - "os" - "syscall" - "unsafe" -) - -// #cgo CFLAGS: -lproc -// #include -// #include -import "C" - -func fdlimit() int { - var nofile syscall.Rlimit - if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &nofile); err != nil { - return 0 - } - return int(nofile.Cur) -} - -func fdusage() (int, error) { - pid := C.int(os.Getpid()) - // Query for a rough estimate on the amout of data that - // proc_pidinfo will return. - rlen, err := C.proc_pidinfo(pid, C.PROC_PIDLISTFDS, 0, nil, 0) - if rlen <= 0 { - return 0, err - } - // Load the list of file descriptors. We don't actually care about - // the content, only about the size. Since the number of fds can - // change while we're reading them, the loop enlarges the buffer - // until proc_pidinfo says the result fitted. - var buf unsafe.Pointer - defer func() { - if buf != nil { - C.free(buf) - } - }() - for buflen := rlen; ; buflen *= 2 { - buf, err = C.reallocf(buf, C.size_t(buflen)) - if buf == nil { - return 0, err - } - rlen, err = C.proc_pidinfo(pid, C.PROC_PIDLISTFDS, 0, buf, buflen) - if rlen <= 0 { - return 0, err - } else if rlen == buflen { - continue - } - return int(rlen / C.PROC_PIDLISTFD_SIZE), nil - } - panic("unreachable") -} diff --git a/fdtrack/fdusage_linux.go b/fdtrack/fdusage_linux.go deleted file mode 100644 index d9a856a0ca..0000000000 --- a/fdtrack/fdusage_linux.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -// +build linux - -package fdtrack - -import ( - "io" - "os" - "syscall" -) - -func fdlimit() int { - var nofile syscall.Rlimit - if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &nofile); err != nil { - return 0 - } - return int(nofile.Cur) -} - -func fdusage() (int, error) { - f, err := os.Open("/proc/self/fd") - if err != nil { - return 0, err - } - defer f.Close() - const batchSize = 100 - n := 0 - for { - list, err := f.Readdirnames(batchSize) - n += len(list) - if err == io.EOF { - break - } else if err != nil { - return 0, err - } - } - return n, nil -} diff --git a/p2p/dial.go b/p2p/dial.go index 8b210bacd2..0fd3a4cf52 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -23,7 +23,6 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/p2p/discover" @@ -213,7 +212,6 @@ func (t *dialTask) Do(srv *Server) { glog.V(logger.Detail).Infof("dial error: %v", err) return } - fd = fdtrack.WrapConn("p2p", fd) mfd := newMeteredConn(fd, false) srv.setupConn(mfd, t.flags, t.dest) diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index 008e63937d..e98e8d0ba6 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -26,7 +26,6 @@ import ( "time" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/p2p/nat" @@ -200,7 +199,6 @@ func ListenUDP(priv *ecdsa.PrivateKey, laddr string, natm nat.Interface, nodeDBP if err != nil { return nil, err } - fdtrack.Open("p2p") conn, err := net.ListenUDP("udp", addr) if err != nil { return nil, err @@ -238,7 +236,6 @@ func newUDP(priv *ecdsa.PrivateKey, c conn, natm nat.Interface, nodeDBPath strin func (t *udp) close() { close(t.closing) - fdtrack.Close("p2p") t.conn.Close() // TODO: wait for the loops to end. } diff --git a/p2p/metrics.go b/p2p/metrics.go index 8ee4ed04b6..f98cac2742 100644 --- a/p2p/metrics.go +++ b/p2p/metrics.go @@ -34,7 +34,7 @@ var ( // meteredConn is a wrapper around a network TCP connection that meters both the // inbound and outbound network traffic. type meteredConn struct { - net.Conn + *net.TCPConn // Network connection to wrap with metering } // newMeteredConn creates a new metered connection, also bumping the ingress or @@ -45,13 +45,13 @@ func newMeteredConn(conn net.Conn, ingress bool) net.Conn { } else { egressConnectMeter.Mark(1) } - return &meteredConn{conn} + return &meteredConn{conn.(*net.TCPConn)} } // Read delegates a network read to the underlying connection, bumping the ingress // traffic meter along the way. func (c *meteredConn) Read(b []byte) (n int, err error) { - n, err = c.Conn.Read(b) + n, err = c.TCPConn.Read(b) ingressTrafficMeter.Mark(int64(n)) return } @@ -59,7 +59,7 @@ func (c *meteredConn) Read(b []byte) (n int, err error) { // Write delegates a network write to the underlying connection, bumping the // egress traffic meter along the way. func (c *meteredConn) Write(b []byte) (n int, err error) { - n, err = c.Conn.Write(b) + n, err = c.TCPConn.Write(b) egressTrafficMeter.Mark(int64(n)) return } diff --git a/p2p/server.go b/p2p/server.go index 7351a26544..ba83c55035 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -25,7 +25,6 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/p2p/discover" @@ -373,7 +372,7 @@ func (srv *Server) startListening() error { } laddr := listener.Addr().(*net.TCPAddr) srv.ListenAddr = laddr.String() - srv.listener = fdtrack.WrapListener("p2p", listener) + srv.listener = listener srv.loopWG.Add(1) go srv.listenLoop() // Map the TCP listening port if NAT is configured. diff --git a/rpc/comms/http.go b/rpc/comms/http.go index c08b744a13..c165aa27e1 100644 --- a/rpc/comms/http.go +++ b/rpc/comms/http.go @@ -29,7 +29,6 @@ import ( "io" "io/ioutil" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc/codec" @@ -178,7 +177,6 @@ func listenHTTP(addr string, h http.Handler) (*stopServer, error) { if err != nil { return nil, err } - l = fdtrack.WrapListener("rpc", l) s := &stopServer{l: l, idle: make(map[net.Conn]struct{})} s.Server = &http.Server{ Addr: addr, diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go index 6968fa8447..24aefa5f34 100644 --- a/rpc/comms/ipc_unix.go +++ b/rpc/comms/ipc_unix.go @@ -22,7 +22,6 @@ import ( "net" "os" - "github.com/ethereum/go-ethereum/fdtrack" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc/codec" @@ -51,16 +50,15 @@ func (self *ipcClient) reconnect() error { func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { os.Remove(cfg.Endpoint) // in case it still exists from a previous run - l, err := net.Listen("unix", cfg.Endpoint) + l, err := net.ListenUnix("unix", &net.UnixAddr{Name: cfg.Endpoint, Net: "unix"}) if err != nil { return err } - l = fdtrack.WrapListener("ipc", l) os.Chmod(cfg.Endpoint, 0600) go func() { for { - conn, err := l.Accept() + conn, err := l.AcceptUnix() if err != nil { glog.V(logger.Error).Infof("Error accepting ipc connection - %v\n", err) continue From 9bf17eb05a4591d8dec9779a9efddc5c2276699a Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Thu, 13 Aug 2015 15:30:17 +0200 Subject: [PATCH 57/90] rpc/comms reconnect ipc client after write error --- rpc/comms/ipc.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rpc/comms/ipc.go b/rpc/comms/ipc.go index e982ada133..d897bf3137 100644 --- a/rpc/comms/ipc.go +++ b/rpc/comms/ipc.go @@ -44,12 +44,14 @@ func (self *ipcClient) Close() { func (self *ipcClient) Send(req interface{}) error { var err error - if err = self.coder.WriteResponse(req); err != nil { - if _, ok := err.(*net.OpError); ok { // connection lost, retry once + if r, ok := req.(*shared.Request); ok { + if err = self.coder.WriteResponse(r); err != nil { if err = self.reconnect(); err == nil { - err = self.coder.WriteResponse(req) + err = self.coder.WriteResponse(r) } } + + return err } return err } From 9fb7bc7443cd3041a6a82477d1f8065fdeb90438 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Wed, 19 Aug 2015 23:05:39 +0200 Subject: [PATCH 58/90] geth: bumped version 1.0.2 --- cmd/geth/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 07c4daf60c..010e3cfb81 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -48,10 +48,10 @@ import ( const ( ClientIdentifier = "Geth" - Version = "1.0.1" + Version = "1.0.2" VersionMajor = 1 VersionMinor = 0 - VersionPatch = 1 + VersionPatch = 2 ) var ( From 54088b0b8b76b9538cf10fa5a606a4170f571065 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 20 Aug 2015 13:08:08 +0200 Subject: [PATCH 59/90] cmd/geth: bumped version 1.0.3 --- cmd/geth/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 010e3cfb81..3f3d0f6f9b 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -48,10 +48,10 @@ import ( const ( ClientIdentifier = "Geth" - Version = "1.0.2" + Version = "1.0.3" VersionMajor = 1 VersionMinor = 0 - VersionPatch = 2 + VersionPatch = 3 ) var ( From 36f7fe61c3697a3e99b95fe3f3c12fc16ed2d39f Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 20 Aug 2015 18:22:50 +0200 Subject: [PATCH 60/90] core, tests: Double SUICIDE fix --- core/blocks.go | 5 +- core/state/state_object.go | 5 +- core/state/statedb.go | 16 +- tests/block_test_util.go | 2 +- .../BlockchainTests/bcValidBlockTest.json | 922 +++++++++++++++--- 5 files changed, 785 insertions(+), 165 deletions(-) diff --git a/core/blocks.go b/core/blocks.go index 326e4c3fc5..96545bfebe 100644 --- a/core/blocks.go +++ b/core/blocks.go @@ -20,8 +20,5 @@ import "github.com/ethereum/go-ethereum/common" // Set of manually tracked bad hashes (usually hard forks) var BadHashes = map[common.Hash]bool{ - common.HexToHash("f269c503aed286caaa0d114d6a5320e70abbc2febe37953207e76a2873f2ba79"): true, - common.HexToHash("38f5bbbffd74804820ffa4bab0cd540e9de229725afb98c1a7e57936f4a714bc"): true, - common.HexToHash("7064455b364775a16afbdecd75370e912c6e2879f202eda85b9beae547fff3ac"): true, - common.HexToHash("5b7c80070a6eff35f3eb3181edb023465c776d40af2885571e1bc4689f3a44d8"): true, + common.HexToHash("0x05bef30ef572270f654746da22639a7a0c97dd97a7050b9e252391996aaeb689"): true, } diff --git a/core/state/state_object.go b/core/state/state_object.go index 3d4f0b3769..c76feb7743 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -82,8 +82,9 @@ type StateObject struct { // Mark for deletion // When an object is marked for deletion it will be delete from the trie // during the "update" phase of the state transition - remove bool - dirty bool + remove bool + deleted bool + dirty bool } func (self *StateObject) Reset() { diff --git a/core/state/statedb.go b/core/state/statedb.go index 45bdfc084d..577f7162eb 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -203,18 +203,20 @@ func (self *StateDB) UpdateStateObject(stateObject *StateObject) { // Delete the given state object and delete it from the state trie func (self *StateDB) DeleteStateObject(stateObject *StateObject) { + stateObject.deleted = true + addr := stateObject.Address() self.trie.Delete(addr[:]) - - //delete(self.stateObjects, addr.Str()) } // Retrieve a state object given my the address. Nil if not found -func (self *StateDB) GetStateObject(addr common.Address) *StateObject { - //addr = common.Address(addr) - - stateObject := self.stateObjects[addr.Str()] +func (self *StateDB) GetStateObject(addr common.Address) (stateObject *StateObject) { + stateObject = self.stateObjects[addr.Str()] if stateObject != nil { + if stateObject.deleted { + stateObject = nil + } + return stateObject } @@ -236,7 +238,7 @@ func (self *StateDB) SetStateObject(object *StateObject) { // Retrieve a state object or create a new state object if nil func (self *StateDB) GetOrNewStateObject(addr common.Address) *StateObject { stateObject := self.GetStateObject(addr) - if stateObject == nil { + if stateObject == nil || stateObject.deleted { stateObject = self.CreateAccount(addr) } diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 8cb7b78825..d47c2b101d 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -150,7 +150,7 @@ func runBlockTests(bt map[string]*BlockTest, skipTests []string) error { // test the block if err := runBlockTest(test); err != nil { - return err + return fmt.Errorf("%s: %v", name, err) } glog.Infoln("Block test passed: ", name) diff --git a/tests/files/BlockchainTests/bcValidBlockTest.json b/tests/files/BlockchainTests/bcValidBlockTest.json index 67a4b123a5..66b3c25eb5 100755 --- a/tests/files/BlockchainTests/bcValidBlockTest.json +++ b/tests/files/BlockchainTests/bcValidBlockTest.json @@ -2,7 +2,7 @@ "ExtraData1024" : { "blocks" : [ { - "rlp" : "0xf90667f905fba0b05b12d82d9f5ea5f1a1d1e0ae300b6765d849c05e85c6e3325adb6a237479e2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fefd882560b8455b7f276b9040001020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000a0575d3f5fddc1ae8149849dc8e570ec26acceeb71368b7e110112f91e04df574188a786d7a6465bed98f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0" + "rlp" : "0xf90667f905fba08c2fd497eec8ef215f5314aa333dec79cdd7d3ed4ac4b0278b7cb7e896141beba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fe3de82560b8455d5f36db9040001020304050607080910111213141516171819202122232410000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000100000000000000000002000000000000000000030000000000000000000400000000000000000005000000000000000000060000000000000000000700000000000000000008000000000000000000090000000000000000000100000000000000000001000000000000000000020000000000000000000300000000000000000004000000000000000000050000000000000000000600000000000000000007000000000000000000080000000000000000000900000000000000000001000000000000000000010000000000000000000200000000000000000003000000000000000000040000000000000000000500000000000000000006000000000000000000070000000000000000000800000000000000000009000000000000000000010000000000000000000a0fd3fc8e3e2037d4da6ddb2cd53ccf71bfe20e0180b750681615da9f392b2b5cb88483597d2f41121d1f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0" } ], "genesisBlockHeader" : { @@ -12,9 +12,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "b05b12d82d9f5ea5f1a1d1e0ae300b6765d849c05e85c6e3325adb6a237479e2", - "mixHash" : "2138e36442388fbdac952de3df1f45378988bbc0c9908dc75a088a50118df47a", - "nonce" : "4d10a3ed53d49c2a", + "hash" : "8c2fd497eec8ef215f5314aa333dec79cdd7d3ed4ac4b0278b7cb7e896141beb", + "mixHash" : "94113ea0cff9f8e6238d4690bfb792c01f278981cb69324f99b3f7d74a0555f0", + "nonce" : "31a7ad4c847d6419", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -23,8 +23,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a02138e36442388fbdac952de3df1f45378988bbc0c9908dc75a088a50118df47a884d10a3ed53d49c2ac0c0", - "lastblockhash" : "b05b12d82d9f5ea5f1a1d1e0ae300b6765d849c05e85c6e3325adb6a237479e2", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a094113ea0cff9f8e6238d4690bfb792c01f278981cb69324f99b3f7d74a0555f08831a7ad4c847d6419c0c0", + "lastblockhash" : "8c2fd497eec8ef215f5314aa333dec79cdd7d3ed4ac4b0278b7cb7e896141beb", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x64", @@ -66,20 +66,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x9b60", - "hash" : "4f1efc7a5fc299d3005126217a0a59a1b546d57fba01e9a56ce8d4644989576d", - "mixHash" : "c767990fd2c6a53ff263f07e4865138f6069150ca9a6795c9cb4445e2f688ea4", - "nonce" : "babc01507e64ab08", + "hash" : "8673ec3c2dc51b15ae7d459f4d1b4fb8c2b0540a6ff36c44a89bdd2635f40259", + "mixHash" : "df5262c6a6a63550d25f3f5eb79f0adf4f10bd8d5f391a2e7a0351e042eb3700", + "nonce" : "d0a5076139120a1b", "number" : "0x01", - "parentHash" : "e1202f3547324ec0e187240fd556e9149c61c0e8f3700f974f33b806ec76015f", + "parentHash" : "2dbce99ecc0642021115fd662f970c97db29f0ab77d8cbcfe2fdac5a9c4e751a", "receiptTrie" : "ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707", "stateRoot" : "423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969", - "timestamp" : "0x55b7f279", + "timestamp" : "0x55d5f36f", "transactionsTrie" : "7f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80ae", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf902a6f901f9a0e1202f3547324ec0e187240fd556e9149c61c0e8f3700f974f33b806ec76015fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969a07f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80aea0ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8829b608455b7f27980a0c767990fd2c6a53ff263f07e4865138f6069150ca9a6795c9cb4445e2f688ea488babc01507e64ab08f8a7f8a5800a8307a1208081ffb857604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff1ca00e7d3c664c49aa9f5ce4eb76c8547450466262a78bd093160f492ea0853c68e9a03f843e72210ff1da4fd9e375339872bcf0fad05c014e280ffc755e173700dd62c0", + "rlp" : "0xf902a6f901f9a02dbce99ecc0642021115fd662f970c97db29f0ab77d8cbcfe2fdac5a9c4e751aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969a07f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80aea0ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de829b608455d5f36f80a0df5262c6a6a63550d25f3f5eb79f0adf4f10bd8d5f391a2e7a0351e042eb370088d0a5076139120a1bf8a7f8a5800a8307a1208081ffb857604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff1ca00e7d3c664c49aa9f5ce4eb76c8547450466262a78bd093160f492ea0853c68e9a03f843e72210ff1da4fd9e375339872bcf0fad05c014e280ffc755e173700dd62c0", "transactions" : [ { "data" : "0x604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff", @@ -102,20 +102,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020040", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fd815", "gasUsed" : "0x29e8", - "hash" : "c4a1935a0c4982b76074c9408d4929a68f4ab126eb3aa9744fbb9c8b5b7108c4", - "mixHash" : "f7c83c4dd1027d640134a0796c36836f16bb156b9ad6aac4a7be6c03c1bde51c", - "nonce" : "8a08c681aff3f007", + "hash" : "1c9757e5d46f60bdbf30ad82313b09613b3eacd03250d4e57cd64b4c0536a45f", + "mixHash" : "e92fb366af9ae483a489a07f3efee04e9a1f37a7f8293743c446e5340007d585", + "nonce" : "c80b72a0f5bec0b0", "number" : "0x02", - "parentHash" : "4f1efc7a5fc299d3005126217a0a59a1b546d57fba01e9a56ce8d4644989576d", + "parentHash" : "8673ec3c2dc51b15ae7d459f4d1b4fb8c2b0540a6ff36c44a89bdd2635f40259", "receiptTrie" : "f07efe64d675e0da95ad02d9acabe60870e522a1ef3c2703ddcac44b58a3634c", "stateRoot" : "44b99148dcf8c520293cfa3c86244b4998e57de44313d21d1b0267dc0a68a5d0", - "timestamp" : "0x55b7f27a", + "timestamp" : "0x55d5f371", "transactionsTrie" : "581b9ae3564d0a429f48551804ec427b549b0f9ff92f0e2e96a4898167f82409", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90285f901f9a04f1efc7a5fc299d3005126217a0a59a1b546d57fba01e9a56ce8d4644989576da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a044b99148dcf8c520293cfa3c86244b4998e57de44313d21d1b0267dc0a68a5d0a0581b9ae3564d0a429f48551804ec427b549b0f9ff92f0e2e96a4898167f82409a0f07efe64d675e0da95ad02d9acabe60870e522a1ef3c2703ddcac44b58a3634cb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefd88229e88455b7f27a80a0f7c83c4dd1027d640134a0796c36836f16bb156b9ad6aac4a7be6c03c1bde51c888a08c681aff3f007f886f884010a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c000000000000000000000000000000000000000000000000000000000000000001ba0e9f25400a2683c5323e1f0a2c1d1bbfbc7a525e861993b9f21e414acfa876df0a04e3cb018a144be08a3cf6abc8abfcb0f159190af5d697283f05b326ba59ccc10c0", + "rlp" : "0xf90285f901f9a08673ec3c2dc51b15ae7d459f4d1b4fb8c2b0540a6ff36c44a89bdd2635f40259a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a044b99148dcf8c520293cfa3c86244b4998e57de44313d21d1b0267dc0a68a5d0a0581b9ae3564d0a429f48551804ec427b549b0f9ff92f0e2e96a4898167f82409a0f07efe64d675e0da95ad02d9acabe60870e522a1ef3c2703ddcac44b58a3634cb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fd8158229e88455d5f37180a0e92fb366af9ae483a489a07f3efee04e9a1f37a7f8293743c446e5340007d58588c80b72a0f5bec0b0f886f884010a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c000000000000000000000000000000000000000000000000000000000000000001ba0e9f25400a2683c5323e1f0a2c1d1bbfbc7a525e861993b9f21e414acfa876df0a04e3cb018a144be08a3cf6abc8abfcb0f159190af5d697283f05b326ba59ccc10c0", "transactions" : [ { "data" : "0xcbf0b0c00000000000000000000000000000000000000000000000000000000000000000", @@ -138,20 +138,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020080", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fcc2c", "gasUsed" : "0x5558", - "hash" : "2bea41e919041367b4b757b26e14a7bf59962caeea87be6970fac230e70277fd", - "mixHash" : "caf1160147f0e9f35b8040ded51058cdb92ff2c0f5fe17b57377ad04a51eb32f", - "nonce" : "fa1c1726b129b73d", + "hash" : "35f8fc45e4c6c4917c6335ec17af3b62f417d89d7190388bd9ded21937fcb0ec", + "mixHash" : "f97c32aacf87573135d2cc28fad71cf7887f12365f789310dd6a0ee8056b36aa", + "nonce" : "1cbda4bcf4227d5e", "number" : "0x03", - "parentHash" : "c4a1935a0c4982b76074c9408d4929a68f4ab126eb3aa9744fbb9c8b5b7108c4", + "parentHash" : "1c9757e5d46f60bdbf30ad82313b09613b3eacd03250d4e57cd64b4c0536a45f", "receiptTrie" : "826e862432492d77d6484d0bc7f1446ee70b2c65e8375af09c1d03e306c93e96", "stateRoot" : "bf1799991c6f2f23f1d93ede356e877388ad45e6731ac5e071db76e23df23fc6", - "timestamp" : "0x55b7f27c", + "timestamp" : "0x55d5f373", "transactionsTrie" : "eb87d8102765efd55c70863ab739867ed1bd718611d2b37058d6b7ebd0941a97", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90285f901f9a0c4a1935a0c4982b76074c9408d4929a68f4ab126eb3aa9744fbb9c8b5b7108c4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bf1799991c6f2f23f1d93ede356e877388ad45e6731ac5e071db76e23df23fc6a0eb87d8102765efd55c70863ab739867ed1bd718611d2b37058d6b7ebd0941a97a0826e862432492d77d6484d0bc7f1446ee70b2c65e8375af09c1d03e306c93e96b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefd88255588455b7f27c80a0caf1160147f0e9f35b8040ded51058cdb92ff2c0f5fe17b57377ad04a51eb32f88fa1c1726b129b73df886f884020a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c001100000000000110000000000000110000000000000110000000000000000111ba02db741161d0014df4fdc93cfb33867295da3b2d9bcc9af8e2d6bb478e1a877d0a0439808cf9ba3e46e97e20a05450daa2a6dca8b21fc47041b5fa492fb322f39e4c0", + "rlp" : "0xf90285f901f9a01c9757e5d46f60bdbf30ad82313b09613b3eacd03250d4e57cd64b4c0536a45fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bf1799991c6f2f23f1d93ede356e877388ad45e6731ac5e071db76e23df23fc6a0eb87d8102765efd55c70863ab739867ed1bd718611d2b37058d6b7ebd0941a97a0826e862432492d77d6484d0bc7f1446ee70b2c65e8375af09c1d03e306c93e96b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fcc2c8255588455d5f37380a0f97c32aacf87573135d2cc28fad71cf7887f12365f789310dd6a0ee8056b36aa881cbda4bcf4227d5ef886f884020a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c001100000000000110000000000000110000000000000110000000000000000111ba02db741161d0014df4fdc93cfb33867295da3b2d9bcc9af8e2d6bb478e1a877d0a0439808cf9ba3e46e97e20a05450daa2a6dca8b21fc47041b5fa492fb322f39e4c0", "transactions" : [ { "data" : "0xcbf0b0c00110000000000011000000000000011000000000000011000000000000000011", @@ -176,9 +176,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "e1202f3547324ec0e187240fd556e9149c61c0e8f3700f974f33b806ec76015f", - "mixHash" : "9e1cfca29377121b0aef8a9236f3b123d49dabd48046861bcc1e25fc62c99ff5", - "nonce" : "8756853304b83657", + "hash" : "2dbce99ecc0642021115fd662f970c97db29f0ab77d8cbcfe2fdac5a9c4e751a", + "mixHash" : "e660eaee8fd51b47772bc099e9d42b44b725985863e65c3beaf973aa8c08288d", + "nonce" : "6bd62d8354f7f889", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -187,8 +187,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a09e1cfca29377121b0aef8a9236f3b123d49dabd48046861bcc1e25fc62c99ff5888756853304b83657c0c0", - "lastblockhash" : "2bea41e919041367b4b757b26e14a7bf59962caeea87be6970fac230e70277fd", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0e660eaee8fd51b47772bc099e9d42b44b725985863e65c3beaf973aa8c08288d886bd62d8354f7f889c0c0", + "lastblockhash" : "35f8fc45e4c6c4917c6335ec17af3b62f417d89d7190388bd9ded21937fcb0ec", "postState" : { "0000000000000000000000000000000000000000" : { "balance" : "0x0100", @@ -229,6 +229,152 @@ } } }, + "RecallSuicidedContractInOneBlock" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020000", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x9b60", + "hash" : "cf83ae01626704224c3cb3689a2808d33587e348463bc27db5da8b574b2ed9f4", + "mixHash" : "64f49eed71bbc033392ba8543967d7417a677348ccb9125b5e3993b233032d2b", + "nonce" : "6afddfbe3fc0727c", + "number" : "0x01", + "parentHash" : "e0dffadd3df956f9c6dffdad1481b2de060890e85dde5d4c769ed97ca1019a15", + "receiptTrie" : "ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707", + "stateRoot" : "423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969", + "timestamp" : "0x55d5f375", + "transactionsTrie" : "7f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80ae", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf902a6f901f9a0e0dffadd3df956f9c6dffdad1481b2de060890e85dde5d4c769ed97ca1019a15a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0423ca0dbb9d7ea2a10cc94b19ceffab7bf52c6163fb6c6a005a1464748e9d969a07f40c85c972d94c1505e6309a763cabd663665e88520dc1df9910bdb2edb80aea0ec3f8def09644029c390920a2e25d14648d2c1f6244425a15068e8c9f8c19707b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de829b608455d5f37580a064f49eed71bbc033392ba8543967d7417a677348ccb9125b5e3993b233032d2b886afddfbe3fc0727cf8a7f8a5800a8307a1208081ffb857604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff1ca00e7d3c664c49aa9f5ce4eb76c8547450466262a78bd093160f492ea0853c68e9a03f843e72210ff1da4fd9e375339872bcf0fad05c014e280ffc755e173700dd62c0", + "transactions" : [ + { + "data" : "0x604b80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463cbf0b0c08114602d57005b60006004358073ffffffffffffffffffffffffffffffffffffffff16ff", + "gasLimit" : "0x07a120", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x0e7d3c664c49aa9f5ce4eb76c8547450466262a78bd093160f492ea0853c68e9", + "s" : "0x3f843e72210ff1da4fd9e375339872bcf0fad05c014e280ffc755e173700dd62", + "to" : "", + "v" : "0x1c", + "value" : "0xff" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020040", + "extraData" : "0x", + "gasLimit" : "0x2fd815", + "gasUsed" : "0x7f40", + "hash" : "ac96fa4af300f71025f7442cf278abe45dc789a167bff8e102ea3f3bb1dee2ca", + "mixHash" : "55bb9767542a6acd7e02cebbff51330846c1e2c4ca703f4655b8be478165d8bd", + "nonce" : "ba79253406610fb9", + "number" : "0x02", + "parentHash" : "cf83ae01626704224c3cb3689a2808d33587e348463bc27db5da8b574b2ed9f4", + "receiptTrie" : "4e6849e0b3c4415a7266cce7d4e494a5a743fca2f95755667fce336c52771c9d", + "stateRoot" : "a3c6cbad55204a40a6661061ea40fbc40491d5e97ca2d5858a025ad5f2178edf", + "timestamp" : "0x55d5f376", + "transactionsTrie" : "4fe1aa9540114cce1ee19a4751bede622013e27f1025c7ef5d955f0132f978db", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf9030cf901f9a0cf83ae01626704224c3cb3689a2808d33587e348463bc27db5da8b574b2ed9f4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0a3c6cbad55204a40a6661061ea40fbc40491d5e97ca2d5858a025ad5f2178edfa04fe1aa9540114cce1ee19a4751bede622013e27f1025c7ef5d955f0132f978dba04e6849e0b3c4415a7266cce7d4e494a5a743fca2f95755667fce336c52771c9db90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fd815827f408455d5f37680a055bb9767542a6acd7e02cebbff51330846c1e2c4ca703f4655b8be478165d8bd88ba79253406610fb9f9010cf884010a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c000000000000000000000000000000000000000000000000000000000000000001ba0e9f25400a2683c5323e1f0a2c1d1bbfbc7a525e861993b9f21e414acfa876df0a04e3cb018a144be08a3cf6abc8abfcb0f159190af5d697283f05b326ba59ccc10f884020a8307a120946295ee1b4f6dd65047762f924ecd367c17eabf8f01a4cbf0b0c001100000000000110000000000000110000000000000110000000000000000111ba02db741161d0014df4fdc93cfb33867295da3b2d9bcc9af8e2d6bb478e1a877d0a0439808cf9ba3e46e97e20a05450daa2a6dca8b21fc47041b5fa492fb322f39e4c0", + "transactions" : [ + { + "data" : "0xcbf0b0c00000000000000000000000000000000000000000000000000000000000000000", + "gasLimit" : "0x07a120", + "gasPrice" : "0x0a", + "nonce" : "0x01", + "r" : "0xe9f25400a2683c5323e1f0a2c1d1bbfbc7a525e861993b9f21e414acfa876df0", + "s" : "0x4e3cb018a144be08a3cf6abc8abfcb0f159190af5d697283f05b326ba59ccc10", + "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", + "v" : "0x1b", + "value" : "0x01" + }, + { + "data" : "0xcbf0b0c00110000000000011000000000000011000000000000011000000000000000011", + "gasLimit" : "0x07a120", + "gasPrice" : "0x0a", + "nonce" : "0x02", + "r" : "0x2db741161d0014df4fdc93cfb33867295da3b2d9bcc9af8e2d6bb478e1a877d0", + "s" : "0x439808cf9ba3e46e97e20a05450daa2a6dca8b21fc47041b5fa492fb322f39e4", + "to" : "6295ee1b4f6dd65047762f924ecd367c17eabf8f", + "v" : "0x1b", + "value" : "0x01" + } + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020000", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "e0dffadd3df956f9c6dffdad1481b2de060890e85dde5d4c769ed97ca1019a15", + "mixHash" : "13558d7be6a18d42bcf54c92ac59c16de2f867012bf6896ea67fea10d3f5bd02", + "nonce" : "515d58cf8b44534a", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "7dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a013558d7be6a18d42bcf54c92ac59c16de2f867012bf6896ea67fea10d3f5bd0288515d58cf8b44534ac0c0", + "lastblockhash" : "ac96fa4af300f71025f7442cf278abe45dc789a167bff8e102ea3f3bb1dee2ca", + "postState" : { + "0000000000000000000000000000000000000000" : { + "balance" : "0x0100", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { + "balance" : "0x01", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489f30a40", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x09184e6794bf", + "code" : "0x", + "nonce" : "0x03", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x09184e72a000", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, "SimpleTx" : { "blocks" : [ { @@ -239,18 +385,18 @@ "extraData" : "0x", "gasLimit" : "0x2fefd8", "gasUsed" : "0x5208", - "hash" : "9a09e1629419f50a178d08223268dce04d3e9b40c47e23b930af5e6f93b2322c", - "mixHash" : "d72a653d355a6fb95dfca8a70dfb7a1a0c14c43eefd9935d4e2a76863a2675d2", - "nonce" : "ad238c92cd105000", + "hash" : "1233b33c3768c89bd2e949d05a429c8ed5206b1b8bef36d755b088a3c47bf855", + "mixHash" : "22b3f6f80e88965d5e57331e657fc2def2969152c348273fd3a556f62dc8825a", + "nonce" : "6c9b38c24303299c", "number" : "0x01", - "parentHash" : "141fc55a58be70b15bf8449b005772d708f366b088093b57e4c50b31973317f0", + "parentHash" : "c6cde6f56d64db59c89e4543a1c2c1264f8190b02bc762683bbea75a6d61784e", "receiptTrie" : "bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52", "stateRoot" : "964e6c9995e7e3757e934391b4f16b50c20409ee4eb9abd4c4617cb805449b9a", - "timestamp" : "0x55b7f27f", + "timestamp" : "0x55d5f379", "transactionsTrie" : "53d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dc", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90260f901f9a0141fc55a58be70b15bf8449b005772d708f366b088093b57e4c50b31973317f0a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0964e6c9995e7e3757e934391b4f16b50c20409ee4eb9abd4c4617cb805449b9aa053d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dca0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f27f80a0d72a653d355a6fb95dfca8a70dfb7a1a0c14c43eefd9935d4e2a76863a2675d288ad238c92cd105000f861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1c0", + "rlp" : "0xf90260f901f9a0c6cde6f56d64db59c89e4543a1c2c1264f8190b02bc762683bbea75a6d61784ea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0964e6c9995e7e3757e934391b4f16b50c20409ee4eb9abd4c4617cb805449b9aa053d5b71a8fbb9590de82d69dfa4ac31923b0c8afce0d30d0d8d1e931f25030dca0bc37d79753ad738a6dac4921e57392f145d8887476de3f783dfa7edae9283e52b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455d5f37980a022b3f6f80e88965d5e57331e657fc2def2969152c348273fd3a556f62dc8825a886c9b38c24303299cf861f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1c0", "transactions" : [ { "data" : "0x", @@ -275,9 +421,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "141fc55a58be70b15bf8449b005772d708f366b088093b57e4c50b31973317f0", - "mixHash" : "dc198bc5b76f3985177efaad99b25bccfbfe9d56328e7ab41ab6a8054ae3203a", - "nonce" : "534d14675dbebd2c", + "hash" : "c6cde6f56d64db59c89e4543a1c2c1264f8190b02bc762683bbea75a6d61784e", + "mixHash" : "8c73628251e10dcd7cac339d4d5d60c28897d59f832435f77c327e4fc04d5e4b", + "nonce" : "a5a076acffc3d021", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -286,8 +432,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0dc198bc5b76f3985177efaad99b25bccfbfe9d56328e7ab41ab6a8054ae3203a88534d14675dbebd2cc0c0", - "lastblockhash" : "9a09e1629419f50a178d08223268dce04d3e9b40c47e23b930af5e6f93b2322c", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a08c73628251e10dcd7cac339d4d5d60c28897d59f832435f77c327e4fc04d5e4b88a5a076acffc3d021c0c0", + "lastblockhash" : "1233b33c3768c89bd2e949d05a429c8ed5206b1b8bef36d755b088a3c47bf855", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x0a", @@ -329,20 +475,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0xf618", - "hash" : "d0c476cd471208ea9000f14343f820bacf5bb84818f164c91ee482b4d15777e5", - "mixHash" : "eb2d5fce544f077d65d201bee95b3047c4ae82f2f47c34e07bccd61348827370", - "nonce" : "3574397101ab284e", + "hash" : "7b4977120a0ee41f3f6a37d35887745fa3ec4f040b19c86c04f1705dcc7cb597", + "mixHash" : "d94fe632206c4afc4f52a75d128ccc6de848e9a458c2217ac8265a647c907750", + "nonce" : "ba192f1cb643c16f", "number" : "0x01", - "parentHash" : "d7a1383adceae842ac7e0c749ec52ad9154f0091db88877d81c6ad722c234892", + "parentHash" : "37cbb5aa6f955d7fc4048cc3dca511979b8a37679835d510cfeb4c6cbe6cde16", "receiptTrie" : "86e489f2e34f4665b59315779d2bb5c16dc9bf7066aad3c89557556a40d76492", "stateRoot" : "63dd9ae8517e40e5e48d7efc1440411c120b3e880ed01d0f6874380cf69d45bf", - "timestamp" : "0x55b7f280", + "timestamp" : "0x55d5f37b", "transactionsTrie" : "9ca199690a5ad007f08fac5b524d2fa2fa1e0397f7534f1d9c7e388c571aa2c4", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90323f901f9a0d7a1383adceae842ac7e0c749ec52ad9154f0091db88877d81c6ad722c234892a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a063dd9ae8517e40e5e48d7efc1440411c120b3e880ed01d0f6874380cf69d45bfa09ca199690a5ad007f08fac5b524d2fa2fa1e0397f7534f1d9c7e388c571aa2c4a086e489f2e34f4665b59315779d2bb5c16dc9bf7066aad3c89557556a40d76492b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882f6188455b7f28080a0eb2d5fce544f077d65d201bee95b3047c4ae82f2f47c34e07bccd61348827370883574397101ab284ef90123f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1f85f800182520894000000000000000000000000000b9331677e6ebf0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3f85f030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3c0", + "rlp" : "0xf90323f901f9a037cbb5aa6f955d7fc4048cc3dca511979b8a37679835d510cfeb4c6cbe6cde16a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a063dd9ae8517e40e5e48d7efc1440411c120b3e880ed01d0f6874380cf69d45bfa09ca199690a5ad007f08fac5b524d2fa2fa1e0397f7534f1d9c7e388c571aa2c4a086e489f2e34f4665b59315779d2bb5c16dc9bf7066aad3c89557556a40d76492b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de82f6188455d5f37b80a0d94fe632206c4afc4f52a75d128ccc6de848e9a458c2217ac8265a647c90775088ba192f1cb643c16ff90123f85f800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0f3266921c93d600c43f6fa4724b7abae079b35b9e95df592f95f9f3445e94c88a012f977552ebdb7a492cf35f3106df16ccb4576ebad4113056ee1f52cbe4978c1f85f800182520894000000000000000000000000000b9331677e6ebf0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3f85f030182520894b94f5374fce5edbc8e2a8697c15331677e6ebf0b0a801ca098ff921201554726367d2be8c804a7ff89ccf285ebc57dff8ae4c44b9c19ac4aa08887321be575c8095f789dd4c743dfe42c1820f9231f98a962b210e3ac2452a3c0", "transactions" : [ { "data" : "0x", @@ -389,9 +535,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "d7a1383adceae842ac7e0c749ec52ad9154f0091db88877d81c6ad722c234892", - "mixHash" : "a4cf31bdf7b647a9c5b4927e113c52fb135ee98648df831149ea161cb06d2291", - "nonce" : "d71919b098132f9c", + "hash" : "37cbb5aa6f955d7fc4048cc3dca511979b8a37679835d510cfeb4c6cbe6cde16", + "mixHash" : "d618479348484fbc60b890b62529d620231bb098ed243c6067c7f01c90df9048", + "nonce" : "85fb6f380fc20c15", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -400,8 +546,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bba25a960aa5c66a2cbd42582b5859a1b8f01db4ccc9eda59e82c315e50dc871a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0a4cf31bdf7b647a9c5b4927e113c52fb135ee98648df831149ea161cb06d229188d71919b098132f9cc0c0", - "lastblockhash" : "d0c476cd471208ea9000f14343f820bacf5bb84818f164c91ee482b4d15777e5", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bba25a960aa5c66a2cbd42582b5859a1b8f01db4ccc9eda59e82c315e50dc871a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0d618479348484fbc60b890b62529d620231bb098ed243c6067c7f01c90df90488885fb6f380fc20c15c0c0", + "lastblockhash" : "7b4977120a0ee41f3f6a37d35887745fa3ec4f040b19c86c04f1705dcc7cb597", "postState" : { "000000000000000000000000000b9331677e6ebf" : { "balance" : "0x0a", @@ -485,20 +631,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0xc350", - "hash" : "3c9b70cb4d3df2d3c3f78efe8ea133e88c229acb0434909b70265424ea0ffc50", - "mixHash" : "19d3895481b5be9641325654014804396c0032528cc127002e0925ddfb596584", - "nonce" : "b28baa17581f6103", + "hash" : "77a8d519b4f678feecda052fa9cd6bac5c1d7313c66af8b434fdf2afe4c0db70", + "mixHash" : "6b4d051c23def9cefc87924bc76619f857a4a6de07a9dadf11552d16b11d00ac", + "nonce" : "ff16b3b8f6dc207a", "number" : "0x01", - "parentHash" : "6985f169ef6a9a8ee58645e7bd93d825672632f2098640eecfdba0c851ec008b", + "parentHash" : "7880053bd588b13a5c3535f212df856c730606b9e51267219e908216bc006a03", "receiptTrie" : "5e947bdcb71ec84c3e4f884827f8bcc98412c54bffa8ee25770d55ddbcb05f23", "stateRoot" : "d4d1286d3c22aaacd7bd2adcc2934ba68740c4c5360c89f99a3a6a727a8bcbbd", - "timestamp" : "0x55b7f282", + "timestamp" : "0x55d5f37e", "transactionsTrie" : "0f6203a75e815282560cdf61871ed2fa253b910d74f0f772bbb980d2f13dedd9", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf903fef901f9a06985f169ef6a9a8ee58645e7bd93d825672632f2098640eecfdba0c851ec008ba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0d4d1286d3c22aaacd7bd2adcc2934ba68740c4c5360c89f99a3a6a727a8bcbbda00f6203a75e815282560cdf61871ed2fa253b910d74f0f772bbb980d2f13dedd9a05e947bdcb71ec84c3e4f884827f8bcc98412c54bffa8ee25770d55ddbcb05f23b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd882c3508455b7f28280a019d3895481b5be9641325654014804396c0032528cc127002e0925ddfb59658488b28baa17581f6103f901fef901fb803282c3508080b901ae60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b561ba04d2aeb53154952b3a3d4718d8a11476c1165f8b53fad1c16e7c27d2a0df29298a0695d3859403ff7ae34072e8f48f29d603aef37fff7d01e55f32de724c9492239c0", + "rlp" : "0xf903fef901f9a07880053bd588b13a5c3535f212df856c730606b9e51267219e908216bc006a03a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0d4d1286d3c22aaacd7bd2adcc2934ba68740c4c5360c89f99a3a6a727a8bcbbda00f6203a75e815282560cdf61871ed2fa253b910d74f0f772bbb980d2f13dedd9a05e947bdcb71ec84c3e4f884827f8bcc98412c54bffa8ee25770d55ddbcb05f23b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de82c3508455d5f37e80a06b4d051c23def9cefc87924bc76619f857a4a6de07a9dadf11552d16b11d00ac88ff16b3b8f6dc207af901fef901fb803282c3508080b901ae60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b561ba04d2aeb53154952b3a3d4718d8a11476c1165f8b53fad1c16e7c27d2a0df29298a0695d3859403ff7ae34072e8f48f29d603aef37fff7d01e55f32de724c9492239c0", "transactions" : [ { "data" : "0x60056013565b6101918061001d6000396000f35b3360008190555056006001600060e060020a6000350480630a874df61461003a57806341c0e1b514610058578063a02b161e14610066578063dbbdf0831461007757005b610045600435610149565b80600160a060020a031660005260206000f35b610060610161565b60006000f35b6100716004356100d4565b60006000f35b61008560043560243561008b565b60006000f35b600054600160a060020a031632600160a060020a031614156100ac576100b1565b6100d0565b8060018360005260205260406000208190555081600060005260206000a15b5050565b600054600160a060020a031633600160a060020a031614158015610118575033600160a060020a0316600182600052602052604060002054600160a060020a031614155b61012157610126565b610146565b600060018260005260205260406000208190555080600060005260206000a15b50565b60006001826000526020526040600020549050919050565b600054600160a060020a031633600160a060020a0316146101815761018f565b600054600160a060020a0316ff5b56", @@ -523,9 +669,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x64", - "hash" : "6985f169ef6a9a8ee58645e7bd93d825672632f2098640eecfdba0c851ec008b", - "mixHash" : "f0a4f86d751e9307fadaa929b37cfa5fe1a02999157e04ef9ccc061e85a26981", - "nonce" : "fb14a9a8b9e31de0", + "hash" : "7880053bd588b13a5c3535f212df856c730606b9e51267219e908216bc006a03", + "mixHash" : "02f48916fece039bbb816bbc50f0a08ff9ffb5f7c91d66de884e1a0884969b01", + "nonce" : "e89cfda8dde9b93f", "number" : "0x00", "parentHash" : "efb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -534,8 +680,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a0efb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8648454c98c8142a0f0a4f86d751e9307fadaa929b37cfa5fe1a02999157e04ef9ccc061e85a2698188fb14a9a8b9e31de0c0c0", - "lastblockhash" : "3c9b70cb4d3df2d3c3f78efe8ea133e88c229acb0434909b70265424ea0ffc50", + "genesisRLP" : "0xf901fcf901f7a0efb4db878627027c81b3bb1c7dd3a18dae3914a49cdd24a3e40ab3bbfbb240c5a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8648454c98c8142a002f48916fece039bbb816bbc50f0a08ff9ffb5f7c91d66de884e1a0884969b0188e89cfda8dde9b93fc0c0", + "lastblockhash" : "77a8d519b4f678feecda052fa9cd6bac5c1d7313c66af8b434fdf2afe4c0db70", "postState" : { "8888f1f195afa192cfee860698584c030f4c9db1" : { "balance" : "0x45639182451a25a0", @@ -570,20 +716,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x5208", - "hash" : "3fd20fa702f48c4bd057083e98287a1334a132372cee46797c719b49788383d1", - "mixHash" : "abbe70ebd0a3e21bbb974a81353e9ab7c1aeebec833fc8df6c0691659a1a61ca", - "nonce" : "255b34be2e6ca2f8", + "hash" : "36d8fbfc8833d1fde1acd0117797d69bf3034c07280c7846f4a7c5f690c0d1bd", + "mixHash" : "04a94f9f31db791e1c1043f7c2b1a2898df6a80a54ab0878f42473b3c2af5cb9", + "nonce" : "bbbb6e598e5760eb", "number" : "0x01", - "parentHash" : "3b5df92257c6c44e65ec28717e78f50a0aaa7e01f1cafcb439fd1020a24dfbca", + "parentHash" : "859886d7bd1ee6db9677192606fca39f236ad52aa269fd2084f169cdc0184181", "receiptTrie" : "443970a57a806576827076eb900c8c0727c18df44f4ced9fee3c74f2401617f6", "stateRoot" : "3087516fb6d1378db34011edb02d4ba48be6b74e60e38163ff4f42097d87215b", - "timestamp" : "0x55b7f285", + "timestamp" : "0x55d5f37f", "transactionsTrie" : "ac17c4b8de7653cfabc0272d6e1803064949cdd66fd57a713ae1ffe24bfb5293", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90261f901f9a03b5df92257c6c44e65ec28717e78f50a0aaa7e01f1cafcb439fd1020a24dfbcaa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a03087516fb6d1378db34011edb02d4ba48be6b74e60e38163ff4f42097d87215ba0ac17c4b8de7653cfabc0272d6e1803064949cdd66fd57a713ae1ffe24bfb5293a0443970a57a806576827076eb900c8c0727c18df44f4ced9fee3c74f2401617f6b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f28580a0abbe70ebd0a3e21bbb974a81353e9ab7c1aeebec833fc8df6c0691659a1a61ca88255b34be2e6ca2f8f862f860800183014c0894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca04d52b16e9e2813953622dc36e9fc90c1d12fa114a0f7eec136f8129eef11be4ca039aa3ab1e3a55f591c272f7e48f82d1570d27f64cfcd4abd581c05be11d646c0c0", + "rlp" : "0xf90261f901f9a0859886d7bd1ee6db9677192606fca39f236ad52aa269fd2084f169cdc0184181a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a03087516fb6d1378db34011edb02d4ba48be6b74e60e38163ff4f42097d87215ba0ac17c4b8de7653cfabc0272d6e1803064949cdd66fd57a713ae1ffe24bfb5293a0443970a57a806576827076eb900c8c0727c18df44f4ced9fee3c74f2401617f6b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de8252088455d5f37f80a004a94f9f31db791e1c1043f7c2b1a2898df6a80a54ab0878f42473b3c2af5cb988bbbb6e598e5760ebf862f860800183014c0894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca04d52b16e9e2813953622dc36e9fc90c1d12fa114a0f7eec136f8129eef11be4ca039aa3ab1e3a55f591c272f7e48f82d1570d27f64cfcd4abd581c05be11d646c0c0", "transactions" : [ { "data" : "0x", @@ -608,9 +754,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "3b5df92257c6c44e65ec28717e78f50a0aaa7e01f1cafcb439fd1020a24dfbca", - "mixHash" : "661dd4e25905645d3764cb8919a20028b95c936823f7d2f6857fd244f1c8df0f", - "nonce" : "e2549b0340f4e9b1", + "hash" : "859886d7bd1ee6db9677192606fca39f236ad52aa269fd2084f169cdc0184181", + "mixHash" : "44883e5b7f534d928f2e629de72c8c81bb600b74d5ed8205b473a8c55597a540", + "nonce" : "475a338100c88919", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -619,8 +765,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0661dd4e25905645d3764cb8919a20028b95c936823f7d2f6857fd244f1c8df0f88e2549b0340f4e9b1c0c0", - "lastblockhash" : "3fd20fa702f48c4bd057083e98287a1334a132372cee46797c719b49788383d1", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a044883e5b7f534d928f2e629de72c8c81bb600b74d5ed8205b473a8c55597a54088475a338100c88919c0c0", + "lastblockhash" : "36d8fbfc8833d1fde1acd0117797d69bf3034c07280c7846f4a7c5f690c0d1bd", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x0a", @@ -662,20 +808,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x00", - "hash" : "ff4052223054747805f51212eaa245d7e2d2c1102ceaf68085e67d97f12e7ee3", - "mixHash" : "6d61bf247c58b5dbc32070eeae92e472e88b57f07bbfcd70d474be3acea3a10b", - "nonce" : "4effe5f5d22168b2", + "hash" : "4518faee37d63fa607e3d185f998608455c1335ff24548396f951d739d84caf6", + "mixHash" : "3f8815db0719f146b997d1b87e75ad11c09db9557321074dd38b21d0def784ea", + "nonce" : "2357882b0f288034", "number" : "0x01", - "parentHash" : "55b8b40d89cec89769874ae436fdb4dba5a76160a1dd002fc17766bcf6a66916", + "parentHash" : "8a83ada0e0f4251ae1f4de435f56ed7723df9afd12bba44addff5e5ef41b8e41", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "stateRoot" : "8503769bb14067be7c5e438c353094e5a9a6c72f375fad4a76878a8882ceb496", - "timestamp" : "0x55b7f287", + "timestamp" : "0x55d5f380", "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf901fcf901f7a055b8b40d89cec89769874ae436fdb4dba5a76160a1dd002fc17766bcf6a66916a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a08503769bb14067be7c5e438c353094e5a9a6c72f375fad4a76878a8882ceb496a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8808455b7f28780a06d61bf247c58b5dbc32070eeae92e472e88b57f07bbfcd70d474be3acea3a10b884effe5f5d22168b2c0c0", + "rlp" : "0xf901fcf901f7a08a83ada0e0f4251ae1f4de435f56ed7723df9afd12bba44addff5e5ef41b8e41a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a08503769bb14067be7c5e438c353094e5a9a6c72f375fad4a76878a8882ceb496a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de808455d5f38080a03f8815db0719f146b997d1b87e75ad11c09db9557321074dd38b21d0def784ea882357882b0f288034c0c0", "transactions" : [ ], "uncleHeaders" : [ @@ -689,9 +835,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "55b8b40d89cec89769874ae436fdb4dba5a76160a1dd002fc17766bcf6a66916", - "mixHash" : "7fb89eaf6dee42a4e9414aa660f84c738befb439f2b82b0f1bb1973086cc4b67", - "nonce" : "b9e2a6a44f2d6132", + "hash" : "8a83ada0e0f4251ae1f4de435f56ed7723df9afd12bba44addff5e5ef41b8e41", + "mixHash" : "5b4b6d03199c1615a7262b7d7a30bdcd948b4f559c8273da457360a140023fcc", + "nonce" : "7f37019fd56f6bdb", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -700,8 +846,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a07fb89eaf6dee42a4e9414aa660f84c738befb439f2b82b0f1bb1973086cc4b6788b9e2a6a44f2d6132c0c0", - "lastblockhash" : "ff4052223054747805f51212eaa245d7e2d2c1102ceaf68085e67d97f12e7ee3", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a05b4b6d03199c1615a7262b7d7a30bdcd948b4f559c8273da457360a140023fcc887f37019fd56f6bdbc0c0", + "lastblockhash" : "4518faee37d63fa607e3d185f998608455c1335ff24548396f951d739d84caf6", "postState" : { "8888f1f195afa192cfee860698584c030f4c9db1" : { "balance" : "0x4563918244f40000", @@ -736,20 +882,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x014820", - "hash" : "d83bf2449124bae9734e39cbeef25384762572485cedd6b4e49d9f9d62c3ab27", - "mixHash" : "eddeaa4c7bd8fb0837d216aee7ee2bc13ec083ed49368611c8db4b22e5717938", - "nonce" : "ec769ba593955274", + "hash" : "274d394e8c4917a6f69a0de847c4a0dea8a6497d4d8ecca7c585f57d903ad72a", + "mixHash" : "2e8f712996da2d6de99d6de00d650c1f64b2e1c62387956eba6e75c38a38d1cf", + "nonce" : "9b96a98327192017", "number" : "0x01", - "parentHash" : "0162a6c3efcdab1d020ee96966b6d2389647b765e854575c6fc51acc1d62a39f", + "parentHash" : "2a6269150eab64ecdc6ee16dd899acbf09c2f304c1ab658b4df62b83c234a550", "receiptTrie" : "4cf33491338ba5c04157a50abc2ba539a9f84a982ff43af45b0b0382e9bbbad7", "stateRoot" : "374444ef3d413eeeb69c71cfefba8380d463a8fbd233a32b7e0035afa5c400d1", - "timestamp" : "0x55b7f289", + "timestamp" : "0x55d5f382", "transactionsTrie" : "c52db987225c0bbeb1808b41fa870bc5f134073ed79c2d1a9c8b28545de80f49", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90385f901faa00162a6c3efcdab1d020ee96966b6d2389647b765e854575c6fc51acc1d62a39fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0374444ef3d413eeeb69c71cfefba8380d463a8fbd233a32b7e0035afa5c400d1a0c52db987225c0bbeb1808b41fa870bc5f134073ed79c2d1a9c8b28545de80f49a04cf33491338ba5c04157a50abc2ba539a9f84a982ff43af45b0b0382e9bbbad7b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd8830148208455b7f28980a0eddeaa4c7bd8fb0837d216aee7ee2bc13ec083ed49368611c8db4b22e571793888ec769ba593955274f90184f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0272bb540c27b214d5cb7deb7ee3a5b0045574474f59a494033efa146c67d0cd2a0272179cc62995b02183f47adcc6a11a66b7cc66c543f9bd4eea28c0368415f62f85f010182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0cd5d6b8050014bc9d170d316d1d5ce8a321e964033c81a267db9abf46871798ba029109ebdc6c46e732e68f26acbc79c4b27ee90123edb2b2d9cc303533584a685f85f020182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0d9e6314ad1ab598ed8948dcc9e68382e8ea532019c9d6363a30b827237d7c89ba058ab0d9c0d6054dbdb626ae4211aca67517f93ceeebdb71e5a8a06117bf52e3ef85f030182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca07b2200ec5136ce610f849f66d04175024134620b94ee509897025c25b1c1b0e7a076cc6272ea4917f4f3a875030a69b6ceef2e11ad21c9c2acaf4964f2344e665ac0", + "rlp" : "0xf90385f901faa02a6269150eab64ecdc6ee16dd899acbf09c2f304c1ab658b4df62b83c234a550a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0374444ef3d413eeeb69c71cfefba8380d463a8fbd233a32b7e0035afa5c400d1a0c52db987225c0bbeb1808b41fa870bc5f134073ed79c2d1a9c8b28545de80f49a04cf33491338ba5c04157a50abc2ba539a9f84a982ff43af45b0b0382e9bbbad7b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de830148208455d5f38280a02e8f712996da2d6de99d6de00d650c1f64b2e1c62387956eba6e75c38a38d1cf889b96a98327192017f90184f85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0272bb540c27b214d5cb7deb7ee3a5b0045574474f59a494033efa146c67d0cd2a0272179cc62995b02183f47adcc6a11a66b7cc66c543f9bd4eea28c0368415f62f85f010182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0cd5d6b8050014bc9d170d316d1d5ce8a321e964033c81a267db9abf46871798ba029109ebdc6c46e732e68f26acbc79c4b27ee90123edb2b2d9cc303533584a685f85f020182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca0d9e6314ad1ab598ed8948dcc9e68382e8ea532019c9d6363a30b827237d7c89ba058ab0d9c0d6054dbdb626ae4211aca67517f93ceeebdb71e5a8a06117bf52e3ef85f030182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca07b2200ec5136ce610f849f66d04175024134620b94ee509897025c25b1c1b0e7a076cc6272ea4917f4f3a875030a69b6ceef2e11ad21c9c2acaf4964f2344e665ac0", "transactions" : [ { "data" : "0x", @@ -807,9 +953,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "0162a6c3efcdab1d020ee96966b6d2389647b765e854575c6fc51acc1d62a39f", - "mixHash" : "7b7a8a26a239e764118d70095fd7b09ea8fb472a3d5a9114c10dc0fccbe9a5fd", - "nonce" : "01e806c57d7064b0", + "hash" : "2a6269150eab64ecdc6ee16dd899acbf09c2f304c1ab658b4df62b83c234a550", + "mixHash" : "bb09ae3a7189ef5816e52078d798f7fc20db94b79dab95a1c5ef9fbb6e049a6f", + "nonce" : "529ca9d230a6b676", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -818,8 +964,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a07b7a8a26a239e764118d70095fd7b09ea8fb472a3d5a9114c10dc0fccbe9a5fd8801e806c57d7064b0c0c0", - "lastblockhash" : "d83bf2449124bae9734e39cbeef25384762572485cedd6b4e49d9f9d62c3ab27", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0bb09ae3a7189ef5816e52078d798f7fc20db94b79dab95a1c5ef9fbb6e049a6f88529ca9d230a6b676c0c0", + "lastblockhash" : "274d394e8c4917a6f69a0de847c4a0dea8a6497d4d8ecca7c585f57d903ad72a", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x28", @@ -861,20 +1007,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x5208", - "hash" : "a8b5b078d574e979676b1e08456bd062ac71cfd0c9a7c0730e46a37895f8f0f3", - "mixHash" : "028f31c5f12a9b859fd49a3d0fde134f95c09a8b55e98654517e7c2c97cd9fac", - "nonce" : "d1064ddf066b7fef", + "hash" : "adc8932eaf583e4b4b34d178d26996631eb75b051772584bf0d6b41600a7b847", + "mixHash" : "6c3e4bf7ae0cb93ee67b01ea59a3f20de0a57b3200fdb3e0e955a6324b0a7dde", + "nonce" : "8825a74a706f6238", "number" : "0x01", - "parentHash" : "3214af7096561dcdb66ed0658d523dc5d88fcad38d837e2a574d6f0f451e2401", + "parentHash" : "f7b70a12006718c3e4627bdfe3c919fd9eabbf76ff7479f32cf3ddb49c63e6ad", "receiptTrie" : "61d9e5e4b662b22b0f085689e02d37aa14ec80fbdf37f867d9e90a6a7faeb8d3", "stateRoot" : "c1ce557179e21d2943e2a22ceb238403d0f353f1abafc424286cfe27621adcca", - "timestamp" : "0x55b7f28c", + "timestamp" : "0x55d5f384", "transactionsTrie" : "0b02bd3fe4650efdbb64e9df234e189c6fb8ae493fecf5880a90ba3e322c63a4", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90261f901f9a03214af7096561dcdb66ed0658d523dc5d88fcad38d837e2a574d6f0f451e2401a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0c1ce557179e21d2943e2a22ceb238403d0f353f1abafc424286cfe27621adccaa00b02bd3fe4650efdbb64e9df234e189c6fb8ae493fecf5880a90ba3e322c63a4a061d9e5e4b662b22b0f085689e02d37aa14ec80fbdf37f867d9e90a6a7faeb8d3b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f28c80a0028f31c5f12a9b859fd49a3d0fde134f95c09a8b55e98654517e7c2c97cd9fac88d1064ddf066b7feff862f860808083014c0894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0ecde765b594ddb833b31bf9a628c37b339bf902ee753a33f9c1a97b4926af0e6a03066e5a2a101f72195110cbcf749e379afc6bc8232d7c3ea3d7b81ed5397a5b3c0", + "rlp" : "0xf90261f901f9a0f7b70a12006718c3e4627bdfe3c919fd9eabbf76ff7479f32cf3ddb49c63e6ada01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0c1ce557179e21d2943e2a22ceb238403d0f353f1abafc424286cfe27621adccaa00b02bd3fe4650efdbb64e9df234e189c6fb8ae493fecf5880a90ba3e322c63a4a061d9e5e4b662b22b0f085689e02d37aa14ec80fbdf37f867d9e90a6a7faeb8d3b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de8252088455d5f38480a06c3e4bf7ae0cb93ee67b01ea59a3f20de0a57b3200fdb3e0e955a6324b0a7dde888825a74a706f6238f862f860808083014c0894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba0ecde765b594ddb833b31bf9a628c37b339bf902ee753a33f9c1a97b4926af0e6a03066e5a2a101f72195110cbcf749e379afc6bc8232d7c3ea3d7b81ed5397a5b3c0", "transactions" : [ { "data" : "0x", @@ -899,9 +1045,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "3214af7096561dcdb66ed0658d523dc5d88fcad38d837e2a574d6f0f451e2401", - "mixHash" : "9ba11764c6f074b44ee8fd4461cfb580cc0fd51fea59e32bfe15bbf127ff2304", - "nonce" : "690f0fd809cfd732", + "hash" : "f7b70a12006718c3e4627bdfe3c919fd9eabbf76ff7479f32cf3ddb49c63e6ad", + "mixHash" : "2bc2e574eea3a4fe7f92ec525312ab9b5c350bc0139e1d444d478c06347b29b5", + "nonce" : "7ce9a2d4a8a46868", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -910,8 +1056,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a09ba11764c6f074b44ee8fd4461cfb580cc0fd51fea59e32bfe15bbf127ff230488690f0fd809cfd732c0c0", - "lastblockhash" : "a8b5b078d574e979676b1e08456bd062ac71cfd0c9a7c0730e46a37895f8f0f3", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a02bc2e574eea3a4fe7f92ec525312ab9b5c350bc0139e1d444d478c06347b29b5887ce9a2d4a8a46868c0c0", + "lastblockhash" : "adc8932eaf583e4b4b34d178d26996631eb75b051772584bf0d6b41600a7b847", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x0a", @@ -953,20 +1099,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x560b", - "hash" : "173d6a2fb94fc7b2710860907f2c6f0ec8d321a559c66fea1c8f85b7642877db", - "mixHash" : "22324b542887e000ad8e42492e7d92c0b066d4c97c3e9bad41e98e858b4ca664", - "nonce" : "96b8a08d3ccbe745", + "hash" : "9db645ca22e25dbe760ed94e4b979a24aaced81feddf8058f1447b6be2252a9c", + "mixHash" : "19077b96c944a3f30c8e3cdc38fd8b2e4ab2fdac14d71c03ea13a416d7ef32ca", + "nonce" : "6889326f8c6fb276", "number" : "0x01", - "parentHash" : "cef2d831b979a7c3a28438aed5a71f4b5cefae2c2eb8e8ee7d9912b64bb7ab74", + "parentHash" : "8e221317873233bc0e5ee34f33c1d376f0db5bc65ba5bd427c02e1ca0663ba25", "receiptTrie" : "c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296", "stateRoot" : "bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bf", - "timestamp" : "0x55b7f28f", + "timestamp" : "0x55d5f386", "transactionsTrie" : "498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90265f901f9a0cef2d831b979a7c3a28438aed5a71f4b5cefae2c2eb8e8ee7d9912b64bb7ab74a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fefd882560b8455b7f28f80a022324b542887e000ad8e42492e7d92c0b066d4c97c3e9bad41e98e858b4ca6648896b8a08d3ccbe745f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0", + "rlp" : "0xf90265f901f9a08e221317873233bc0e5ee34f33c1d376f0db5bc65ba5bd427c02e1ca0663ba25a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0bac6177a79e910c98d86ec31a09ae37ac2de15b754fd7bed1ba52362c49416bfa0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0c7778a7376099ee2e5c455791c1885b5c361b95713fddcbe32d97fd01334d296b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008302000001832fe3de82560b8455d5f38680a019077b96c944a3f30c8e3cdc38fd8b2e4ab2fdac14d71c03ea13a416d7ef32ca886889326f8c6fb276f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0", "transactions" : [ { "data" : "0x", @@ -991,9 +1137,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "cef2d831b979a7c3a28438aed5a71f4b5cefae2c2eb8e8ee7d9912b64bb7ab74", - "mixHash" : "c9897e804a25a198b1fb3c6350d5be02e45d8bbe2ce062bbb14d641490a08c0e", - "nonce" : "d354735f6dc31f19", + "hash" : "8e221317873233bc0e5ee34f33c1d376f0db5bc65ba5bd427c02e1ca0663ba25", + "mixHash" : "512588f77e4b6b7deb3651e89214c54ae9d7b0b51650baad9cec23d162ce91c0", + "nonce" : "f89ef32e65f27ed8", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -1002,8 +1148,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0c9897e804a25a198b1fb3c6350d5be02e45d8bbe2ce062bbb14d641490a08c0e88d354735f6dc31f19c0c0", - "lastblockhash" : "173d6a2fb94fc7b2710860907f2c6f0ec8d321a559c66fea1c8f85b7642877db", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0925002c3260b44e44c3edebad1cc442142b03020209df1ab8bb86752edbd2cd7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0512588f77e4b6b7deb3651e89214c54ae9d7b0b51650baad9cec23d162ce91c088f89ef32e65f27ed8c0c0", + "lastblockhash" : "9db645ca22e25dbe760ed94e4b979a24aaced81feddf8058f1447b6be2252a9c", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x012a05f264", @@ -1044,6 +1190,480 @@ } } }, + "timeDiff0" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x038630", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x560b", + "hash" : "e016b3366903c44b33a0b79af1e286fc13b80fb54d2cbaf62c289be14e2bf958", + "mixHash" : "5f90930a01b1cc113338264120191d7deb9beaefc6b9c2de9dc604bc3be6dae7", + "nonce" : "85aaae2774202ad0", + "number" : "0x01", + "parentHash" : "5e135c4bdefcd8851f92a3a4670e8bf7662961b66876bbb65b572a31358d6d14", + "receiptTrie" : "5e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26", + "stateRoot" : "201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914", + "timestamp" : "0x55d5f388", + "transactionsTrie" : "c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90262f901f9a05e135c4bdefcd8851f92a3a4670e8bf7662961b66876bbb65b572a31358d6d14a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914a0c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7a05e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008303863001832fe3de82560b8455d5f38880a05f90930a01b1cc113338264120191d7deb9beaefc6b9c2de9dc604bc3be6dae78885aaae2774202ad0f863f861800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d87821388801ba0149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393a03cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36c0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0xc350", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393", + "s" : "0x3cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x1388" + } + ], + "uncleHeaders" : [ + ] + }, + { + "rlp" : "0xf901fcf901f7a0e016b3366903c44b33a0b79af1e286fc13b80fb54d2cbaf62c289be14e2bf958a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a002832fd800808455d5f38880a08f4407a10797e7dffabcf54459eb6f63ba0d6925ba7b6e999848d334123b09fe88436e39fd86607230c0c0" + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "5e135c4bdefcd8851f92a3a4670e8bf7662961b66876bbb65b572a31358d6d14", + "mixHash" : "cd34e2cf76dab4ec5e90d8aee1c23968edf59d1264c238769b457959768b2792", + "nonce" : "0f7a20795f299b7b", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a080832fefd8808454c98c8142a0cd34e2cf76dab4ec5e90d8aee1c23968edf59d1264c238769b457959768b2792880f7a20795f299b7bc0c0", + "lastblockhash" : "e016b3366903c44b33a0b79af1e286fc13b80fb54d2cbaf62c289be14e2bf958", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x13ec", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x4563918244f75c6e", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174873780a", + "code" : "0x", + "nonce" : "0x01", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x64", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, + "timeDiff12" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x038630", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x560b", + "hash" : "022df90fbe4b089dfa6b0a879b9787b262ede8171a1170878e0f694e5e13977d", + "mixHash" : "8226205217edade35ca29967d4dd7a7aa5d9d2453d2e608d023cd8f5a1fb7298", + "nonce" : "27b3c785ac56dee5", + "number" : "0x01", + "parentHash" : "29b2b142238c3820d4ede0193cf4bf11c7a242c38074e1820d410f54f219cc50", + "receiptTrie" : "5e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26", + "stateRoot" : "201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914", + "timestamp" : "0x55d5f38c", + "transactionsTrie" : "c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90262f901f9a029b2b142238c3820d4ede0193cf4bf11c7a242c38074e1820d410f54f219cc50a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914a0c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7a05e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008303863001832fe3de82560b8455d5f38c80a08226205217edade35ca29967d4dd7a7aa5d9d2453d2e608d023cd8f5a1fb72988827b3c785ac56dee5f863f861800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d87821388801ba0149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393a03cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36c0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0xc350", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393", + "s" : "0x3cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x1388" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x", + "gasLimit" : "0x2fd800", + "gasUsed" : "0x00", + "hash" : "5765fc0b211f0686440ad73a8a7b40c2d1bbba1a380755c2fc02ba2fd0ed3920", + "mixHash" : "3d33c0eb4de9bd8df7f581bef8f2a8e184bac0f7b49f7b8bf567b0599edfdeef", + "nonce" : "d08ba7d2e8860f81", + "number" : "0x02", + "parentHash" : "022df90fbe4b089dfa6b0a879b9787b262ede8171a1170878e0f694e5e13977d", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78", + "timestamp" : "0x55d5f398", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf901fcf901f7a0022df90fbe4b089dfa6b0a879b9787b262ede8171a1170878e0f694e5e13977da01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a002832fd800808455d5f39880a03d33c0eb4de9bd8df7f581bef8f2a8e184bac0f7b49f7b8bf567b0599edfdeef88d08ba7d2e8860f81c0c0", + "transactions" : [ + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "29b2b142238c3820d4ede0193cf4bf11c7a242c38074e1820d410f54f219cc50", + "mixHash" : "c3fa7245f0b834661ee019eb3d5c93b1b0feefed21ac808b714e846c4b0f0eb2", + "nonce" : "8de870f337f9fdee", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a080832fefd8808454c98c8142a0c3fa7245f0b834661ee019eb3d5c93b1b0feefed21ac808b714e846c4b0f0eb2888de870f337f9fdeec0c0", + "lastblockhash" : "5765fc0b211f0686440ad73a8a7b40c2d1bbba1a380755c2fc02ba2fd0ed3920", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x13ec", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489eb5c6e", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174873780a", + "code" : "0x", + "nonce" : "0x01", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x64", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, + "timeDiff13" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x038630", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x560b", + "hash" : "32e292b358e8af8d64ff76b578c54498b589c0796110fce0208ea7b9bac8c823", + "mixHash" : "662a7e387a457a9ea534c61809c9b2179a939aeb7b2f43ee99cb79e3acd0a892", + "nonce" : "4b4187434fff8ace", + "number" : "0x01", + "parentHash" : "32a200899b03f628f35544e00bf4df519224e7a2b0bdf4ec17cf49e79d6aba23", + "receiptTrie" : "5e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26", + "stateRoot" : "201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914", + "timestamp" : "0x55d5f3a4", + "transactionsTrie" : "c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90262f901f9a032a200899b03f628f35544e00bf4df519224e7a2b0bdf4ec17cf49e79d6aba23a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914a0c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7a05e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008303863001832fe3de82560b8455d5f3a480a0662a7e387a457a9ea534c61809c9b2179a939aeb7b2f43ee99cb79e3acd0a892884b4187434fff8acef863f861800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d87821388801ba0149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393a03cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36c0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0xc350", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393", + "s" : "0x3cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x1388" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0385c0", + "extraData" : "0x", + "gasLimit" : "0x2fd800", + "gasUsed" : "0x00", + "hash" : "ce62a266c155dbb5a54d1751eff2157eb4aaf30cec6ba4fada794064be5f3c4c", + "mixHash" : "47fdbc9960f9e8ac28228008b70eae19c80df8f091df7a2f99f423c458f7cd2a", + "nonce" : "1d8e8adcf90009c6", + "number" : "0x02", + "parentHash" : "32e292b358e8af8d64ff76b578c54498b589c0796110fce0208ea7b9bac8c823", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78", + "timestamp" : "0x55d5f3b1", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf901fcf901f7a032e292b358e8af8d64ff76b578c54498b589c0796110fce0208ea7b9bac8c823a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830385c002832fd800808455d5f3b180a047fdbc9960f9e8ac28228008b70eae19c80df8f091df7a2f99f423c458f7cd2a881d8e8adcf90009c6c0c0", + "transactions" : [ + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "32a200899b03f628f35544e00bf4df519224e7a2b0bdf4ec17cf49e79d6aba23", + "mixHash" : "888f553018e58e19b120c7a23bd9257ce0a5e47674dde39ff5cdc879f1cd89bd", + "nonce" : "f5b845e1ecbbcc28", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a080832fefd8808454c98c8142a0888f553018e58e19b120c7a23bd9257ce0a5e47674dde39ff5cdc879f1cd89bd88f5b845e1ecbbcc28c0c0", + "lastblockhash" : "ce62a266c155dbb5a54d1751eff2157eb4aaf30cec6ba4fada794064be5f3c4c", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x13ec", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489eb5c6e", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174873780a", + "code" : "0x", + "nonce" : "0x01", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x64", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, + "timeDiff14" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000040000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x038630", + "extraData" : "0x", + "gasLimit" : "0x2fe3de", + "gasUsed" : "0x560b", + "hash" : "844baa5fea0b9e184029509c7f0ecdcc88cdd4afa2eb16f47c6e17693228a8d4", + "mixHash" : "0132a62f6f12967c7dd21b6293422880c6972a2e4949265d4ad1b7d8cf242990", + "nonce" : "7e0dac58cdfdcb85", + "number" : "0x01", + "parentHash" : "6aab9fc348a1137614fd7493bffd8069faf8623440bf2669f3b3e1b6739d122b", + "receiptTrie" : "5e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26", + "stateRoot" : "201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914", + "timestamp" : "0x55d5f3b6", + "transactionsTrie" : "c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90262f901f9a06aab9fc348a1137614fd7493bffd8069faf8623440bf2669f3b3e1b6739d122ba01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0201eacb02252d150f7f1a1dc2440f7fab2f468329953051836f81bae65e26914a0c590d5598e571c0acebad12175f241738803400f57cfb272e595999dbbfd08d7a05e7d8bf8bc817405813b0866e3bfa1ad048f982be5b81ab17b4db03266b24b26b90100000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000400000000000000000000000000000000000000000000000000000008303863001832fe3de82560b8455d5f3b680a00132a62f6f12967c7dd21b6293422880c6972a2e4949265d4ad1b7d8cf242990887e0dac58cdfdcb85f863f861800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d87821388801ba0149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393a03cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36c0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0xc350", + "gasPrice" : "0x0a", + "nonce" : "0x00", + "r" : "0x149dedccf5d524176aa17525074acf56f17cd7b472a9860c9d3ec4d87a6d0393", + "s" : "0x3cf6326d11c57d8b558c21c63fc848f8d0b76582060044e8e48d9d0d29054a36", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x1388" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0385c0", + "extraData" : "0x", + "gasLimit" : "0x2fd800", + "gasUsed" : "0x00", + "hash" : "8a2f8db544b6d65d1ca99a61a9afea0f7ff97f253ef293adb764fd893298b986", + "mixHash" : "7905c4293448b50ee78be5e43e3cf31950d8743e82c1733b7d0a038f4f8121d5", + "nonce" : "1906d96c17fa4d0b", + "number" : "0x02", + "parentHash" : "844baa5fea0b9e184029509c7f0ecdcc88cdd4afa2eb16f47c6e17693228a8d4", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78", + "timestamp" : "0x55d5f3c4", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf901fcf901f7a0844baa5fea0b9e184029509c7f0ecdcc88cdd4afa2eb16f47c6e17693228a8d4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b18395884d55f5dc870bc46e565a5dbdc5659325f66cc457b38bcecb01662f78a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830385c002832fd800808455d5f3c480a07905c4293448b50ee78be5e43e3cf31950d8743e82c1733b7d0a038f4f8121d5881906d96c17fa4d0bc0c0", + "transactions" : [ + ], + "uncleHeaders" : [ + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x0386a0", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "6aab9fc348a1137614fd7493bffd8069faf8623440bf2669f3b3e1b6739d122b", + "mixHash" : "7df1f98666a1a1530a41bdc26363e97d6654bb20824c17bc9f0e53163ca6d655", + "nonce" : "94892f238c65f5dd", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0b7829295a16db7cae65a071afbb272390f893dc1b0d3f098504148a7056f8056a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830386a080832fefd8808454c98c8142a07df1f98666a1a1530a41bdc26363e97d6654bb20824c17bc9f0e53163ca6d6558894892f238c65f5ddc0c0", + "lastblockhash" : "8a2f8db544b6d65d1ca99a61a9afea0f7ff97f253ef293adb764fd893298b986", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x13ec", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489eb5c6e", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174873780a", + "code" : "0x", + "nonce" : "0x01", + "storage" : { + } + } + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x64", + "code" : "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600052600060206000a1", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x174876e800", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, "txEqualValue" : { "blocks" : [ { @@ -1052,20 +1672,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x5208", - "hash" : "0d1095c688a64015ceda25220045e676c959383aa5e26b4a96b294291c3c09fa", - "mixHash" : "278ab67208b96a18d072e19ff9b1ee7e94a02633a9fd4ade2ba9db3d66d3df54", - "nonce" : "b5f17c43df51ed1d", + "hash" : "ed9d2f59e63cdd914799f58ba90cfd88e74fb6cfce9f0471e65ab387edca0186", + "mixHash" : "7f2b44632d02c094801cc87f5a4c3b046df84b2560490e387d73e0d03c1cee02", + "nonce" : "c91331bc23d7928d", "number" : "0x01", - "parentHash" : "a1be177a6a2793204e15c15d4824097984977ed938cf1f067e165059e348c0a7", + "parentHash" : "aa26c99940f2c9da1900dd7c8fc3734691572d7f9f323644d8666217bde3cd42", "receiptTrie" : "e13e6a83dd076e2589464165628f05caf91a7c54975779549344656b17a89962", "stateRoot" : "ae2d2b287506883322f1c2dae3015b4f2a393332eb0f0aacf11750175ee1ef53", - "timestamp" : "0x55b7f291", + "timestamp" : "0x55d5f3cf", "transactionsTrie" : "498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90265f901f9a0a1be177a6a2793204e15c15d4824097984977ed938cf1f067e165059e348c0a7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ae2d2b287506883322f1c2dae3015b4f2a393332eb0f0aacf11750175ee1ef53a0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0e13e6a83dd076e2589464165628f05caf91a7c54975779549344656b17a89962b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f29180a0278ab67208b96a18d072e19ff9b1ee7e94a02633a9fd4ade2ba9db3d66d3df5488b5f17c43df51ed1df866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0", + "rlp" : "0xf90265f901f9a0aa26c99940f2c9da1900dd7c8fc3734691572d7f9f323644d8666217bde3cd42a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0ae2d2b287506883322f1c2dae3015b4f2a393332eb0f0aacf11750175ee1ef53a0498785da562aa0c5dd5937cf15f22139b0b1bcf3b4fc48986e1bb1dae9292796a0e13e6a83dd076e2589464165628f05caf91a7c54975779549344656b17a89962b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de8252088455d5f3cf80a07f2b44632d02c094801cc87f5a4c3b046df84b2560490e387d73e0d03c1cee0288c91331bc23d7928df866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d8785012a05f200801ca0ee0b9ec878fbd4258a9473199d8ecc32996a20c323c004e79e0cda20e0418ce3a04e6bc63927d1510bab54f37e46fa036faf4b2c465d271920d9afea1fadf7bd21c0", "transactions" : [ { "data" : "0x", @@ -1090,9 +1710,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "a1be177a6a2793204e15c15d4824097984977ed938cf1f067e165059e348c0a7", - "mixHash" : "398a711c44ddec4affa9fe0f6d5a8b661c0e476d4286b0b457d1fa5f949d56d6", - "nonce" : "854dce3725faf400", + "hash" : "aa26c99940f2c9da1900dd7c8fc3734691572d7f9f323644d8666217bde3cd42", + "mixHash" : "e7fc98b9e9f997750f11975832e15a84aca2f6c01f81e96e0a3bc1535b17aac6", + "nonce" : "5cbb7f6f582ab25c", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -1101,8 +1721,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0398a711c44ddec4affa9fe0f6d5a8b661c0e476d4286b0b457d1fa5f949d56d688854dce3725faf400c0c0", - "lastblockhash" : "0d1095c688a64015ceda25220045e676c959383aa5e26b4a96b294291c3c09fa", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0e7fc98b9e9f997750f11975832e15a84aca2f6c01f81e96e0a3bc1535b17aac6885cbb7f6f582ab25cc0c0", + "lastblockhash" : "ed9d2f59e63cdd914799f58ba90cfd88e74fb6cfce9f0471e65ab387edca0186", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x012a05f200", @@ -1144,20 +1764,20 @@ "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", "difficulty" : "0x020000", "extraData" : "0x", - "gasLimit" : "0x2fefd8", + "gasLimit" : "0x2fe3de", "gasUsed" : "0x5208", - "hash" : "feb5732416765067a7c68878fc57ffbb12277f5ad51afb8cd8da7758bce9d1c4", - "mixHash" : "dd069a437769855ba9337ae52b802a4ce92f7e54864ae597ec98000175357482", - "nonce" : "d5854365d85492e6", + "hash" : "094eb118175f79f80fdbc3140d379e0c0b04bef7cd285ea61a1184a8201f5a1f", + "mixHash" : "c3af16a9ee71f47e48ed294aab34d26141e9b3badbf537f42afba78e73e485fd", + "nonce" : "2d1073468aa45fcc", "number" : "0x01", - "parentHash" : "28ec23fed489293ad9db90e7745921dcd8cbf31f72ddb2cd3164e120d5c81797", + "parentHash" : "4460b49f668be62df7cfb79e680a532688a1ea2b84f31e7c5cfca612871efef8", "receiptTrie" : "67bf4b6c7db8be32886532357198d3a32f204c9001b0980747ab8fa9e937e1a2", "stateRoot" : "f0f9da9e88dbc17e483569ef49113473ac1d0fef5f63a3b2564b2c1ee8898ab0", - "timestamp" : "0x55b7f294", + "timestamp" : "0x55d5f3d7", "transactionsTrie" : "2e4a44bb8e3ee134ec210f7f92c1138ad2e3c29f19a821fd17f262254cd15840", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "rlp" : "0xf90265f901f9a028ec23fed489293ad9db90e7745921dcd8cbf31f72ddb2cd3164e120d5c81797a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0f0f9da9e88dbc17e483569ef49113473ac1d0fef5f63a3b2564b2c1ee8898ab0a02e4a44bb8e3ee134ec210f7f92c1138ad2e3c29f19a821fd17f262254cd15840a067bf4b6c7db8be32886532357198d3a32f204c9001b0980747ab8fa9e937e1a2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455b7f29480a0dd069a437769855ba9337ae52b802a4ce92f7e54864ae597ec9800017535748288d5854365d85492e6f866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d878501dcd65000801ba0ebb726ae53468a164a482cd9e3a5a23607185985c93b922e3be620b04b30e9bda0047360f7f081043ccb735c9fa5c20fc4ecba55ceca57bf96f4d7686371af0dc9c0", + "rlp" : "0xf90265f901f9a04460b49f668be62df7cfb79e680a532688a1ea2b84f31e7c5cfca612871efef8a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0f0f9da9e88dbc17e483569ef49113473ac1d0fef5f63a3b2564b2c1ee8898ab0a02e4a44bb8e3ee134ec210f7f92c1138ad2e3c29f19a821fd17f262254cd15840a067bf4b6c7db8be32886532357198d3a32f204c9001b0980747ab8fa9e937e1a2b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fe3de8252088455d5f3d780a0c3af16a9ee71f47e48ed294aab34d26141e9b3badbf537f42afba78e73e485fd882d1073468aa45fccf866f864800a82c35094095e7baea6a6c7c4c2dfeb977efac326af552d878501dcd65000801ba0ebb726ae53468a164a482cd9e3a5a23607185985c93b922e3be620b04b30e9bda0047360f7f081043ccb735c9fa5c20fc4ecba55ceca57bf96f4d7686371af0dc9c0", "transactions" : [ { "data" : "0x", @@ -1182,9 +1802,9 @@ "extraData" : "0x42", "gasLimit" : "0x2fefd8", "gasUsed" : "0x00", - "hash" : "28ec23fed489293ad9db90e7745921dcd8cbf31f72ddb2cd3164e120d5c81797", - "mixHash" : "6c5322280e970809d6bf1811b49359fccf694286ea3be7c8f676666d6771c730", - "nonce" : "95c7f750a8e77586", + "hash" : "4460b49f668be62df7cfb79e680a532688a1ea2b84f31e7c5cfca612871efef8", + "mixHash" : "29fc027153197af656eba7187179b7e5e45d6235fe1b26f2e692e084a5c9596d", + "nonce" : "f0b89f070195f820", "number" : "0x00", "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", @@ -1193,8 +1813,8 @@ "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, - "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a06c5322280e970809d6bf1811b49359fccf694286ea3be7c8f676666d6771c7308895c7f750a8e77586c0c0", - "lastblockhash" : "feb5732416765067a7c68878fc57ffbb12277f5ad51afb8cd8da7758bce9d1c4", + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cafd881ab193703b83816c49ff6c2bf6ba6f464a1be560c42106128c8dbc35e7a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a029fc027153197af656eba7187179b7e5e45d6235fe1b26f2e692e084a5c9596d88f0b89f070195f820c0c0", + "lastblockhash" : "094eb118175f79f80fdbc3140d379e0c0b04bef7cd285ea61a1184a8201f5a1f", "postState" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "0x01dcd65000", From b884d6ebaaa3b954a21e6814166064482579e9e1 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 20 Aug 2015 18:37:44 +0200 Subject: [PATCH 61/90] canary update --- core/canary.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/canary.go b/core/canary.go index 5eefe066cf..69db18e582 100644 --- a/core/canary.go +++ b/core/canary.go @@ -24,10 +24,10 @@ import ( ) var ( - jeff = common.HexToAddress("a8edb1ac2c86d3d9d78f96cd18001f60df29e52c") - vitalik = common.HexToAddress("1baf27b88c48dd02b744999cf3522766929d2b2a") - christoph = common.HexToAddress("60d11b58744784dc97f878f7e3749c0f1381a004") - gav = common.HexToAddress("4bb7e8ae99b645c2b7860b8f3a2328aae28bd80a") + jeff = common.HexToAddress("959c33de5961820567930eccce51ea715c496f85") + vitalik = common.HexToAddress("c8158da0b567a8cc898991c2c2a073af67dc03a9") + christoph = common.HexToAddress("7a19a893f91d5b6e2cdf941b6acbba2cbcf431ee") + gav = common.HexToAddress("539dd9aaf45c3feb03f9c004f4098bd3268fef6b") ) // Canary will check the 0'd address of the 4 contracts above. From 3793991c0e14a205cae3b2f8ccc8a45792ec2b80 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 20 Aug 2015 18:50:47 +0200 Subject: [PATCH 62/90] remove 0x --- core/blocks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/blocks.go b/core/blocks.go index 96545bfebe..ecccc541f0 100644 --- a/core/blocks.go +++ b/core/blocks.go @@ -20,5 +20,5 @@ import "github.com/ethereum/go-ethereum/common" // Set of manually tracked bad hashes (usually hard forks) var BadHashes = map[common.Hash]bool{ - common.HexToHash("0x05bef30ef572270f654746da22639a7a0c97dd97a7050b9e252391996aaeb689"): true, + common.HexToHash("05bef30ef572270f654746da22639a7a0c97dd97a7050b9e252391996aaeb689"): true, } From d51d0022cee91d6588186455afbe6e54fae2cbf7 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 20 Aug 2015 21:43:36 +0200 Subject: [PATCH 63/90] cmd/geth: bumped version 1.1.0 --- cmd/geth/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 3f3d0f6f9b..ff556c984e 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -48,10 +48,10 @@ import ( const ( ClientIdentifier = "Geth" - Version = "1.0.3" + Version = "1.1.0" VersionMajor = 1 - VersionMinor = 0 - VersionPatch = 3 + VersionMinor = 1 + VersionPatch = 0 ) var ( From dc3fb69dce674069479313837a5612045303c418 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 25 Aug 2015 12:23:25 +0200 Subject: [PATCH 64/90] Merge pull request #1710 from bas-vk/useragent user agent messages were dumped in some cases (cherry picked from commit a219159e7e18ccaa52c9c493a19a11e6b7bab3dd) --- rpc/comms/ipc.go | 12 ++++-------- rpc/comms/ipc_unix.go | 23 ++++++++++++++++++++++- rpc/comms/ipc_windows.go | 23 ++++++++++++++++++++++- rpc/jeth.go | 10 ---------- 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/rpc/comms/ipc.go b/rpc/comms/ipc.go index d897bf3137..3de659b65c 100644 --- a/rpc/comms/ipc.go +++ b/rpc/comms/ipc.go @@ -42,16 +42,12 @@ func (self *ipcClient) Close() { self.coder.Close() } -func (self *ipcClient) Send(req interface{}) error { +func (self *ipcClient) Send(msg interface{}) error { var err error - if r, ok := req.(*shared.Request); ok { - if err = self.coder.WriteResponse(r); err != nil { - if err = self.reconnect(); err == nil { - err = self.coder.WriteResponse(r) - } + if err = self.coder.WriteResponse(msg); err != nil { + if err = self.reconnect(); err == nil { + err = self.coder.WriteResponse(msg) } - - return err } return err } diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go index 24aefa5f34..9d90da0719 100644 --- a/rpc/comms/ipc_unix.go +++ b/rpc/comms/ipc_unix.go @@ -26,6 +26,7 @@ import ( "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/ethereum/go-ethereum/rpc/useragent" ) func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) { @@ -34,7 +35,18 @@ func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) { return nil, err } - return &ipcClient{cfg.Endpoint, c, codec, codec.New(c)}, nil + coder := codec.New(c) + msg := shared.Request{ + Id: 0, + Method: useragent.EnableUserAgentMethod, + Jsonrpc: shared.JsonRpcVersion, + Params: []byte("[]"), + } + + coder.WriteResponse(msg) + coder.Recv() + + return &ipcClient{cfg.Endpoint, c, codec, coder}, nil } func (self *ipcClient) reconnect() error { @@ -42,6 +54,15 @@ func (self *ipcClient) reconnect() error { c, err := net.DialUnix("unix", nil, &net.UnixAddr{self.endpoint, "unix"}) if err == nil { self.coder = self.codec.New(c) + + msg := shared.Request{ + Id: 0, + Method: useragent.EnableUserAgentMethod, + Jsonrpc: shared.JsonRpcVersion, + Params: []byte("[]"), + } + self.coder.WriteResponse(msg) + self.coder.Recv() } return err diff --git a/rpc/comms/ipc_windows.go b/rpc/comms/ipc_windows.go index b2fe2b29db..47edd9e5bc 100644 --- a/rpc/comms/ipc_windows.go +++ b/rpc/comms/ipc_windows.go @@ -32,6 +32,7 @@ import ( "github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/rpc/codec" "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/ethereum/go-ethereum/rpc/useragent" ) var ( @@ -656,13 +657,33 @@ func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) { return nil, err } - return &ipcClient{cfg.Endpoint, c, codec, codec.New(c)}, nil + coder := codec.New(c) + msg := shared.Request{ + Id: 0, + Method: useragent.EnableUserAgentMethod, + Jsonrpc: shared.JsonRpcVersion, + Params: []byte("[]"), + } + + coder.WriteResponse(msg) + coder.Recv() + + return &ipcClient{cfg.Endpoint, c, codec, coder}, nil } func (self *ipcClient) reconnect() error { c, err := Dial(self.endpoint) if err == nil { self.coder = self.codec.New(c) + + req := shared.Request{ + Id: 0, + Method: useragent.EnableUserAgentMethod, + Jsonrpc: shared.JsonRpcVersion, + Params: []byte("[]"), + } + self.coder.WriteResponse(req) + self.coder.Recv() } return err } diff --git a/rpc/jeth.go b/rpc/jeth.go index 158bfb64cb..757f6b7eb5 100644 --- a/rpc/jeth.go +++ b/rpc/jeth.go @@ -40,16 +40,6 @@ type Jeth struct { } func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClient, fe xeth.Frontend) *Jeth { - // enable the jeth as the user agent - req := shared.Request{ - Id: 0, - Method: useragent.EnableUserAgentMethod, - Jsonrpc: shared.JsonRpcVersion, - Params: []byte("[]"), - } - client.Send(&req) - client.Recv() - return &Jeth{ethApi, re, client, fe} } From fd512fa12c59657d9e47cc3411e6e24bd1af89cb Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 25 Aug 2015 15:49:36 +0200 Subject: [PATCH 65/90] Merge pull request #1711 from Gustav-Simonsson/timestamp_big_int Add tests for uncle timestamps and refactor timestamp type (cherry picked from commit abce09954b6901b446c004ee06b389c338922f28) --- cmd/evm/main.go | 6 +- core/block_processor.go | 20 +- core/block_processor_test.go | 4 +- core/chain_makers.go | 11 +- core/chain_manager.go | 3 +- core/error.go | 7 +- core/genesis.go | 2 +- core/types/block.go | 9 +- core/types/block_test.go | 2 +- core/vm/environment.go | 2 +- core/vm/instructions.go | 2 +- core/vm/jit_test.go | 2 +- core/vm/vm.go | 2 +- core/vm_env.go | 2 +- eth/handler.go | 2 +- miner/worker.go | 10 +- tests/block_test.go | 7 + tests/block_test_util.go | 6 +- tests/files/BlockchainTests/bcUncleTest.json | 315 ++++++++++++++++++- tests/util.go | 6 +- xeth/types.go | 3 +- 21 files changed, 380 insertions(+), 43 deletions(-) diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 6639069b99..243dd62669 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -166,7 +166,7 @@ type VMEnv struct { depth int Gas *big.Int - time uint64 + time *big.Int logs []vm.StructLog } @@ -175,7 +175,7 @@ func NewEnv(state *state.StateDB, transactor common.Address, value *big.Int) *VM state: state, transactor: &transactor, value: value, - time: uint64(time.Now().Unix()), + time: big.NewInt(time.Now().Unix()), } } @@ -183,7 +183,7 @@ func (self *VMEnv) State() *state.StateDB { return self.state } func (self *VMEnv) Origin() common.Address { return *self.transactor } func (self *VMEnv) BlockNumber() *big.Int { return common.Big0 } func (self *VMEnv) Coinbase() common.Address { return *self.transactor } -func (self *VMEnv) Time() uint64 { return self.time } +func (self *VMEnv) Time() *big.Int { return self.time } func (self *VMEnv) Difficulty() *big.Int { return common.Big1 } func (self *VMEnv) BlockHash() []byte { return make([]byte, 32) } func (self *VMEnv) Value() *big.Int { return self.value } diff --git a/core/block_processor.go b/core/block_processor.go index dd7fe8962c..99d27fa717 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -203,7 +203,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (logs st txs := block.Transactions() // Block validation - if err = ValidateHeader(sm.Pow, header, parent, false); err != nil { + if err = ValidateHeader(sm.Pow, header, parent, false, false); err != nil { return } @@ -327,7 +327,7 @@ func (sm *BlockProcessor) VerifyUncles(statedb *state.StateDB, block, parent *ty return UncleError("uncle[%d](%x)'s parent is not ancestor (%x)", i, hash[:4], uncle.ParentHash[0:4]) } - if err := ValidateHeader(sm.Pow, uncle, ancestors[uncle.ParentHash], true); err != nil { + if err := ValidateHeader(sm.Pow, uncle, ancestors[uncle.ParentHash], true, true); err != nil { return ValidationError(fmt.Sprintf("uncle[%d](%x) header invalid: %v", i, hash[:4], err)) } } @@ -358,19 +358,25 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro // See YP section 4.3.4. "Block Header Validity" // Validates a block. Returns an error if the block is invalid. -func ValidateHeader(pow pow.PoW, block *types.Header, parent *types.Block, checkPow bool) error { +func ValidateHeader(pow pow.PoW, block *types.Header, parent *types.Block, checkPow, uncle bool) error { if big.NewInt(int64(len(block.Extra))).Cmp(params.MaximumExtraDataSize) == 1 { return fmt.Errorf("Block extra data too long (%d)", len(block.Extra)) } - if block.Time > uint64(time.Now().Unix()) { - return BlockFutureErr + if uncle { + if block.Time.Cmp(common.MaxBig) == 1 { + return BlockTSTooBigErr + } + } else { + if block.Time.Cmp(big.NewInt(time.Now().Unix())) == 1 { + return BlockFutureErr + } } - if block.Time <= parent.Time() { + if block.Time.Cmp(parent.Time()) != 1 { return BlockEqualTSErr } - expd := CalcDifficulty(block.Time, parent.Time(), parent.Number(), parent.Difficulty()) + expd := CalcDifficulty(block.Time.Uint64(), parent.Time().Uint64(), parent.Number(), parent.Difficulty()) if expd.Cmp(block.Difficulty) != 0 { return fmt.Errorf("Difficulty check failed for block %v, %v", block.Difficulty, expd) } diff --git a/core/block_processor_test.go b/core/block_processor_test.go index 4525f417bf..e0b2d3313f 100644 --- a/core/block_processor_test.go +++ b/core/block_processor_test.go @@ -48,13 +48,13 @@ func TestNumber(t *testing.T) { statedb := state.New(chain.Genesis().Root(), chain.chainDb) header := makeHeader(chain.Genesis(), statedb) header.Number = big.NewInt(3) - err := ValidateHeader(pow, header, chain.Genesis(), false) + err := ValidateHeader(pow, header, chain.Genesis(), false, false) if err != BlockNumberErr { t.Errorf("expected block number error, got %q", err) } header = makeHeader(chain.Genesis(), statedb) - err = ValidateHeader(pow, header, chain.Genesis(), false) + err = ValidateHeader(pow, header, chain.Genesis(), false, false) if err == BlockNumberErr { t.Errorf("didn't expect block number error") } diff --git a/core/chain_makers.go b/core/chain_makers.go index 0bb1df95a8..b009e0c28c 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -166,16 +166,21 @@ func GenerateChain(parent *types.Block, db common.Database, n int, gen func(int, } func makeHeader(parent *types.Block, state *state.StateDB) *types.Header { - time := parent.Time() + 10 // block time is fixed at 10 seconds + var time *big.Int + if parent.Time() == nil { + time = big.NewInt(10) + } else { + time = new(big.Int).Add(parent.Time(), big.NewInt(10)) // block time is fixed at 10 seconds + } return &types.Header{ Root: state.Root(), ParentHash: parent.Hash(), Coinbase: parent.Coinbase(), - Difficulty: CalcDifficulty(time, parent.Time(), parent.Number(), parent.Difficulty()), + Difficulty: CalcDifficulty(time.Uint64(), new(big.Int).Sub(time, big.NewInt(10)).Uint64(), parent.Number(), parent.Difficulty()), GasLimit: CalcGasLimit(parent), GasUsed: new(big.Int), Number: new(big.Int).Add(parent.Number(), common.Big1), - Time: uint64(time), + Time: time, } } diff --git a/core/chain_manager.go b/core/chain_manager.go index cf5b8bd78b..c8127951ea 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -596,7 +596,8 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) { // Allow up to MaxFuture second in the future blocks. If this limit // is exceeded the chain is discarded and processed at a later time // if given. - if max := uint64(time.Now().Unix()) + maxTimeFutureBlocks; block.Time() > max { + max := big.NewInt(time.Now().Unix() + maxTimeFutureBlocks) + if block.Time().Cmp(max) == 1 { return i, fmt.Errorf("%v: BlockFutureErr, %v > %v", BlockFutureErr, block.Time(), max) } diff --git a/core/error.go b/core/error.go index 5e6ff4de7f..09eea22d6d 100644 --- a/core/error.go +++ b/core/error.go @@ -25,9 +25,10 @@ import ( ) var ( - BlockNumberErr = errors.New("block number invalid") - BlockFutureErr = errors.New("block time is in the future") - BlockEqualTSErr = errors.New("block time stamp equal to previous") + BlockNumberErr = errors.New("block number invalid") + BlockFutureErr = errors.New("block time is in the future") + BlockTSTooBigErr = errors.New("block time too big") + BlockEqualTSErr = errors.New("block time stamp equal to previous") ) // Parent error. In case a parent is unknown this error will be thrown diff --git a/core/genesis.go b/core/genesis.go index 97afb3a4ae..7d4e03c990 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -73,7 +73,7 @@ func WriteGenesisBlock(chainDb common.Database, reader io.Reader) (*types.Block, difficulty := common.String2Big(genesis.Difficulty) block := types.NewBlock(&types.Header{ Nonce: types.EncodeNonce(common.String2Big(genesis.Nonce).Uint64()), - Time: common.String2Big(genesis.Timestamp).Uint64(), + Time: common.String2Big(genesis.Timestamp), ParentHash: common.HexToHash(genesis.ParentHash), Extra: common.FromHex(genesis.ExtraData), GasLimit: common.String2Big(genesis.GasLimit), diff --git a/core/types/block.go b/core/types/block.go index 427a3e6cb3..2188e6d4da 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -60,7 +60,7 @@ type Header struct { Number *big.Int // The block number GasLimit *big.Int // Gas limit GasUsed *big.Int // Gas used - Time uint64 // Creation time + Time *big.Int // Creation time Extra []byte // Extra data MixDigest common.Hash // for quick difficulty verification Nonce BlockNonce @@ -94,7 +94,7 @@ func (h *Header) UnmarshalJSON(data []byte) error { Coinbase string Difficulty string GasLimit string - Time uint64 + Time *big.Int Extra string } dec := json.NewDecoder(bytes.NewReader(data)) @@ -210,6 +210,9 @@ func NewBlockWithHeader(header *Header) *Block { func copyHeader(h *Header) *Header { cpy := *h + if cpy.Time = new(big.Int); h.Time != nil { + cpy.Time.Set(h.Time) + } if cpy.Difficulty = new(big.Int); h.Difficulty != nil { cpy.Difficulty.Set(h.Difficulty) } @@ -301,13 +304,13 @@ func (b *Block) Number() *big.Int { return new(big.Int).Set(b.header.Number) func (b *Block) GasLimit() *big.Int { return new(big.Int).Set(b.header.GasLimit) } func (b *Block) GasUsed() *big.Int { return new(big.Int).Set(b.header.GasUsed) } func (b *Block) Difficulty() *big.Int { return new(big.Int).Set(b.header.Difficulty) } +func (b *Block) Time() *big.Int { return new(big.Int).Set(b.header.Time) } func (b *Block) NumberU64() uint64 { return b.header.Number.Uint64() } func (b *Block) MixDigest() common.Hash { return b.header.MixDigest } func (b *Block) Nonce() uint64 { return binary.BigEndian.Uint64(b.header.Nonce[:]) } func (b *Block) Bloom() Bloom { return b.header.Bloom } func (b *Block) Coinbase() common.Address { return b.header.Coinbase } -func (b *Block) Time() uint64 { return b.header.Time } func (b *Block) Root() common.Hash { return b.header.Root } func (b *Block) ParentHash() common.Hash { return b.header.ParentHash } func (b *Block) TxHash() common.Hash { return b.header.TxHash } diff --git a/core/types/block_test.go b/core/types/block_test.go index aebb6328bd..cdd8431f4d 100644 --- a/core/types/block_test.go +++ b/core/types/block_test.go @@ -47,7 +47,7 @@ func TestBlockEncoding(t *testing.T) { check("Root", block.Root(), common.HexToHash("ef1552a40b7165c3cd773806b9e0c165b75356e0314bf0706f279c729f51e017")) check("Hash", block.Hash(), common.HexToHash("0a5843ac1cb04865017cb35a57b50b07084e5fcee39b5acadade33149f4fff9e")) check("Nonce", block.Nonce(), uint64(0xa13a5a8c8f2bb1c4)) - check("Time", block.Time(), uint64(1426516743)) + check("Time", block.Time(), big.NewInt(1426516743)) check("Size", block.Size(), common.StorageSize(len(blockEnc))) tx1 := NewTransaction(0, common.HexToAddress("095e7baea6a6c7c4c2dfeb977efac326af552d87"), big.NewInt(10), big.NewInt(50000), big.NewInt(10), nil) diff --git a/core/vm/environment.go b/core/vm/environment.go index 5a1bf32010..916081f513 100644 --- a/core/vm/environment.go +++ b/core/vm/environment.go @@ -33,7 +33,7 @@ type Environment interface { BlockNumber() *big.Int GetHash(n uint64) common.Hash Coinbase() common.Address - Time() uint64 + Time() *big.Int Difficulty() *big.Int GasLimit() *big.Int CanTransfer(from Account, balance *big.Int) bool diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 2de35a4430..aa0117cc85 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -341,7 +341,7 @@ func opCoinbase(instr instruction, env Environment, context *Context, memory *Me } func opTimestamp(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { - stack.push(U256(new(big.Int).SetUint64(env.Time()))) + stack.push(U256(new(big.Int).Set(env.Time()))) } func opNumber(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) { diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go index b9e2c69999..d8e4426379 100644 --- a/core/vm/jit_test.go +++ b/core/vm/jit_test.go @@ -93,7 +93,7 @@ func (self *Env) StructLogs() []StructLog { //func (self *Env) PrevHash() []byte { return self.parent } func (self *Env) Coinbase() common.Address { return common.Address{} } -func (self *Env) Time() uint64 { return uint64(time.Now().Unix()) } +func (self *Env) Time() *big.Int { return big.NewInt(time.Now().Unix()) } func (self *Env) Difficulty() *big.Int { return big.NewInt(0) } func (self *Env) State() *state.StateDB { return nil } func (self *Env) GasLimit() *big.Int { return self.gasLimit } diff --git a/core/vm/vm.go b/core/vm/vm.go index da764004ad..d9e1a0ce50 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -491,7 +491,7 @@ func (self *Vm) Run(context *Context, input []byte) (ret []byte, err error) { case TIMESTAMP: time := self.env.Time() - stack.push(new(big.Int).SetUint64(time)) + stack.push(new(big.Int).Set(time)) case NUMBER: number := self.env.BlockNumber() diff --git a/core/vm_env.go b/core/vm_env.go index 7198295437..a08f024fe7 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -49,7 +49,7 @@ func NewEnv(state *state.StateDB, chain *ChainManager, msg Message, header *type func (self *VMEnv) Origin() common.Address { f, _ := self.msg.From(); return f } func (self *VMEnv) BlockNumber() *big.Int { return self.header.Number } func (self *VMEnv) Coinbase() common.Address { return self.header.Coinbase } -func (self *VMEnv) Time() uint64 { return self.header.Time } +func (self *VMEnv) Time() *big.Int { return self.header.Time } func (self *VMEnv) Difficulty() *big.Int { return self.header.Difficulty } func (self *VMEnv) GasLimit() *big.Int { return self.header.GasLimit } func (self *VMEnv) Value() *big.Int { return self.msg.Value() } diff --git a/eth/handler.go b/eth/handler.go index 5d233dd968..4f3d1f34cf 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -117,7 +117,7 @@ func NewProtocolManager(networkId int, mux *event.TypeMux, txpool txPool, pow po manager.downloader = downloader.New(manager.eventMux, manager.chainman.HasBlock, manager.chainman.GetBlock, manager.chainman.CurrentBlock, manager.chainman.InsertChain, manager.removePeer) validator := func(block *types.Block, parent *types.Block) error { - return core.ValidateHeader(pow, block.Header(), parent, true) + return core.ValidateHeader(pow, block.Header(), parent, true, false) } heighter := func() uint64 { return manager.chainman.CurrentBlock().NumberU64() diff --git a/miner/worker.go b/miner/worker.go index aa2132a51c..86970ec071 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -278,7 +278,7 @@ func (self *worker) wait() { glog.V(logger.Error).Infoln("Invalid block found during mining") continue } - if err := core.ValidateHeader(self.eth.BlockProcessor().Pow, block.Header(), parent, true); err != nil && err != core.BlockFutureErr { + if err := core.ValidateHeader(self.eth.BlockProcessor().Pow, block.Header(), parent, true, false); err != nil && err != core.BlockFutureErr { glog.V(logger.Error).Infoln("Invalid header on mined block:", err) continue } @@ -434,8 +434,8 @@ func (self *worker) commitNewWork() { tstart := time.Now() parent := self.chain.CurrentBlock() tstamp := tstart.Unix() - if tstamp <= int64(parent.Time()) { - tstamp = int64(parent.Time()) + 1 + if parent.Time().Cmp(new(big.Int).SetInt64(tstamp)) != 1 { + tstamp = parent.Time().Int64() + 1 } // this will ensure we're not going off too far in the future if now := time.Now().Unix(); tstamp > now+4 { @@ -448,12 +448,12 @@ func (self *worker) commitNewWork() { header := &types.Header{ ParentHash: parent.Hash(), Number: num.Add(num, common.Big1), - Difficulty: core.CalcDifficulty(uint64(tstamp), parent.Time(), parent.Number(), parent.Difficulty()), + Difficulty: core.CalcDifficulty(uint64(tstamp), parent.Time().Uint64(), parent.Number(), parent.Difficulty()), GasLimit: core.CalcGasLimit(parent), GasUsed: new(big.Int), Coinbase: self.coinbase, Extra: self.extra, - Time: uint64(tstamp), + Time: big.NewInt(tstamp), } previous := self.current diff --git a/tests/block_test.go b/tests/block_test.go index f42b474b72..b0db5fe568 100644 --- a/tests/block_test.go +++ b/tests/block_test.go @@ -35,6 +35,13 @@ func TestBcUncleHeaderValidityTests(t *testing.T) { } } +func TestBcUncleTests(t *testing.T) { + err := RunBlockTest(filepath.Join(blockTestDir, "bcUncleTest.json"), BlockSkipTests) + if err != nil { + t.Fatal(err) + } +} + func TestBcInvalidHeaderTests(t *testing.T) { err := RunBlockTest(filepath.Join(blockTestDir, "bcInvalidHeaderTest.json"), BlockSkipTests) if err != nil { diff --git a/tests/block_test_util.go b/tests/block_test_util.go index d47c2b101d..2090afce71 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -365,8 +365,8 @@ func (s *BlockTest) validateBlockHeader(h *btHeader, h2 *types.Header) error { return fmt.Errorf("GasUsed: expected: %v, decoded: %v", expectedGasUsed, h2.GasUsed) } - expectedTimestamp := mustConvertUint(h.Timestamp, 16) - if expectedTimestamp != h2.Time { + expectedTimestamp := mustConvertBigInt(h.Timestamp, 16) + if expectedTimestamp.Cmp(h2.Time) != 0 { return fmt.Errorf("Timestamp: expected: %v, decoded: %v", expectedTimestamp, h2.Time) } @@ -461,7 +461,7 @@ func mustConvertHeader(in btHeader) *types.Header { GasUsed: mustConvertBigInt(in.GasUsed, 16), GasLimit: mustConvertBigInt(in.GasLimit, 16), Difficulty: mustConvertBigInt(in.Difficulty, 16), - Time: mustConvertUint(in.Timestamp, 16), + Time: mustConvertBigInt(in.Timestamp, 16), Nonce: types.EncodeNonce(mustConvertUint(in.Nonce, 16)), } return header diff --git a/tests/files/BlockchainTests/bcUncleTest.json b/tests/files/BlockchainTests/bcUncleTest.json index bd6326a889..0d0e83c0c1 100755 --- a/tests/files/BlockchainTests/bcUncleTest.json +++ b/tests/files/BlockchainTests/bcUncleTest.json @@ -4543,5 +4543,318 @@ } } } + }, + "uncleTimestampTooBig" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020000", + "extraData" : "0x", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x5208", + "hash" : "6bd328a10bb674cc758bd1bccb8afb584808766434c28b85580b422c75d4130e", + "mixHash" : "fefce638471ab6b66b1f1423ae574a99a6b2137229fe1846c508554d718d2bc1", + "nonce" : "f8cf2912afdd244d", + "number" : "0x01", + "parentHash" : "b964d0b68e5a3c7265e4087dc2a8aaf599f06b6d6c1316a1b1b6475587f569e2", + "receiptTrie" : "e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313", + "stateRoot" : "cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878", + "timestamp" : "0x55d9d69f", + "transactionsTrie" : "5c9151c2413d1cd25c51ffb4ac38948acc1359bf08c6b49f283660e9bcf0f516", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90261f901f9a0b964d0b68e5a3c7265e4087dc2a8aaf599f06b6d6c1316a1b1b6475587f569e2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a05c9151c2413d1cd25c51ffb4ac38948acc1359bf08c6b49f283660e9bcf0f516a0e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455d9d69f80a0fefce638471ab6b66b1f1423ae574a99a6b2137229fe1846c508554d718d2bc188f8cf2912afdd244df862f86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba077c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8a03f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288dc0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0x04cb2f", + "gasPrice" : "0x01", + "nonce" : "0x00", + "r" : "0x77c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8", + "s" : "0x3f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288d", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x0a" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020040", + "extraData" : "0x", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x5208", + "hash" : "4c179927c9b9897464c7133033b412c9b66ee2bb1fa4a4b2595a6006d4081e3f", + "mixHash" : "3449cf46635bab4ae7121dcd145e6ca12ac4337f79e88354c41bff1c48335b48", + "nonce" : "4376da5cd48ffb68", + "number" : "0x02", + "parentHash" : "6bd328a10bb674cc758bd1bccb8afb584808766434c28b85580b422c75d4130e", + "receiptTrie" : "5ea1a8b24652fed0ecab4738edd9211891eb8c4353c345973b78a02cc0f32f6b", + "stateRoot" : "e7e4760f75476ec7f51869d8bdce5c693058fd5a95c77ea9c0bf7ced1e50d70e", + "timestamp" : "0x55d9d6a1", + "transactionsTrie" : "c673e076264c4669a5c2e479f1757b78e42511efe33b5fd2c0a23b929c7f87f5", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90260f901f9a06bd328a10bb674cc758bd1bccb8afb584808766434c28b85580b422c75d4130ea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0e7e4760f75476ec7f51869d8bdce5c693058fd5a95c77ea9c0bf7ced1e50d70ea0c673e076264c4669a5c2e479f1757b78e42511efe33b5fd2c0a23b929c7f87f5a05ea1a8b24652fed0ecab4738edd9211891eb8c4353c345973b78a02cc0f32f6bb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefd88252088455d9d6a180a03449cf46635bab4ae7121dcd145e6ca12ac4337f79e88354c41bff1c48335b48884376da5cd48ffb68f861f85f01018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba033c86e64d708c97c6b135cadff79dbf45985aa0b53694789e90d15f756765f239f1d0f8caa2a16405148c9d85581be5814960010f3cba938b5501590cea1f7cfc0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0x04cb2f", + "gasPrice" : "0x01", + "nonce" : "0x01", + "r" : "0x33c86e64d708c97c6b135cadff79dbf45985aa0b53694789e90d15f756765f23", + "s" : "0x1d0f8caa2a16405148c9d85581be5814960010f3cba938b5501590cea1f7cf", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x0a" + } + ], + "uncleHeaders" : [ + ] + }, + { + "rlp" : "0xf90459f901f9a04c179927c9b9897464c7133033b412c9b66ee2bb1fa4a4b2595a6006d4081e3fa0f4fd3b99eb9b343e87bc472fdcd6b18e5cbcb231b1e70f8948e97b02c008ac26948888f1f195afa192cfee860698584c030f4c9db1a0e9940294a09308406a3d2e09203aed11db40259fac0a25e639ad2b30b82d07dea01722b8a91bfc4f5614ce36ee77c7cce6620ab4af36d3c54baa66d7dbeb7bce1aa04ede0225773c7a517b91994aca65ade45124e7ef4b8be1e6097c9773a11920afb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefd88252088455d9d6a680a0caf6f553d8c1394d291caaeabc61bc25f9126f4c313c829b2a51134cbd23d27188e6999e52421f5a38f862f86002018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca015eb1cc916728b9799e55c489857727669afb2986433d5f54cde11faaed9f0eea05d36f6d06c34aae8d0a2a5895c8ba4a17ad46a5fa59f361cb3e7e01a23030e38f901f6f901f3a06bd328a10bb674cc758bd1bccb8afb584808766434c28b85580b422c75d4130ea01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794bcde5374fce5edbc8e2a8697c15331677e6ebf0ba0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000002832fefd8808080a077355633b05269548d6b3bd8e80d334fcb1a31c566b980dfc56eb57d5c16acc388846c622f81a727e7" + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020000", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "b964d0b68e5a3c7265e4087dc2a8aaf599f06b6d6c1316a1b1b6475587f569e2", + "mixHash" : "b65f3c17c458ce015c087c3e4c0ffeeb010bf648a1faa2585c674d81ea7dcdfd", + "nonce" : "0b2ec3394d2421e3", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "7dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0b65f3c17c458ce015c087c3e4c0ffeeb010bf648a1faa2585c674d81ea7dcdfd880b2ec3394d2421e3c0c0", + "lastblockhash" : "4c179927c9b9897464c7133033b412c9b66ee2bb1fa4a4b2595a6006d4081e3f", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x14", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489e8a410", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x09184e71fbdc", + "code" : "0x", + "nonce" : "0x02", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x09184e72a000", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } + }, + "uncleTimestampMaxUint256" : { + "blocks" : [ + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020000", + "extraData" : "0x", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x5208", + "hash" : "19c900975f94fd78dc12ad13740200fbe0a2eba43fd070bedc65588b0c95438a", + "mixHash" : "4296af28ea723598c959f1cabc6f01fa0c75d126cfde89f13ccd9debcf3079c3", + "nonce" : "3213b3fd7789f5d5", + "number" : "0x01", + "parentHash" : "e688d736f1307c6f97b6777381b30556137b9d4ca5c43fbd5b30d6b5df315264", + "receiptTrie" : "e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313", + "stateRoot" : "cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878", + "timestamp" : "0x55d9c571", + "transactionsTrie" : "5c9151c2413d1cd25c51ffb4ac38948acc1359bf08c6b49f283660e9bcf0f516", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90261f901f9a0e688d736f1307c6f97b6777381b30556137b9d4ca5c43fbd5b30d6b5df315264a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a05c9151c2413d1cd25c51ffb4ac38948acc1359bf08c6b49f283660e9bcf0f516a0e9244cf7503b79c03d3a099e07a80d2dbc77bb0b502d8a89d51ac0d68dd31313b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000001832fefd88252088455d9c57180a04296af28ea723598c959f1cabc6f01fa0c75d126cfde89f13ccd9debcf3079c3883213b3fd7789f5d5f862f86080018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba077c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8a03f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288dc0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0x04cb2f", + "gasPrice" : "0x01", + "nonce" : "0x00", + "r" : "0x77c7cd36820c71821c1aed59de46e70e701c4a8dd89c9ba508ab722210f60da8", + "s" : "0x3f29825d40c7c3f7bff3ca69267e0f3fb74b2d18b8c2c4e3c135b5d3b06e288d", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x0a" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020040", + "extraData" : "0x", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x5208", + "hash" : "04e0807bea4d9766809afba8f4dbf2e5ab4e522aa4570bb915381c6593530e89", + "mixHash" : "782e9bf4a3427dee8cf2494f966830dd04a217eb5cf8769dba0ed6400212264f", + "nonce" : "e83b4878a0b9a46f", + "number" : "0x02", + "parentHash" : "19c900975f94fd78dc12ad13740200fbe0a2eba43fd070bedc65588b0c95438a", + "receiptTrie" : "5ea1a8b24652fed0ecab4738edd9211891eb8c4353c345973b78a02cc0f32f6b", + "stateRoot" : "e7e4760f75476ec7f51869d8bdce5c693058fd5a95c77ea9c0bf7ced1e50d70e", + "timestamp" : "0x55d9c573", + "transactionsTrie" : "c673e076264c4669a5c2e479f1757b78e42511efe33b5fd2c0a23b929c7f87f5", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "rlp" : "0xf90260f901f9a019c900975f94fd78dc12ad13740200fbe0a2eba43fd070bedc65588b0c95438aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a0e7e4760f75476ec7f51869d8bdce5c693058fd5a95c77ea9c0bf7ced1e50d70ea0c673e076264c4669a5c2e479f1757b78e42511efe33b5fd2c0a23b929c7f87f5a05ea1a8b24652fed0ecab4738edd9211891eb8c4353c345973b78a02cc0f32f6bb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefd88252088455d9c57380a0782e9bf4a3427dee8cf2494f966830dd04a217eb5cf8769dba0ed6400212264f88e83b4878a0b9a46ff861f85f01018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba033c86e64d708c97c6b135cadff79dbf45985aa0b53694789e90d15f756765f239f1d0f8caa2a16405148c9d85581be5814960010f3cba938b5501590cea1f7cfc0", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0x04cb2f", + "gasPrice" : "0x01", + "nonce" : "0x01", + "r" : "0x33c86e64d708c97c6b135cadff79dbf45985aa0b53694789e90d15f756765f23", + "s" : "0x1d0f8caa2a16405148c9d85581be5814960010f3cba938b5501590cea1f7cf", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1b", + "value" : "0x0a" + } + ], + "uncleHeaders" : [ + ] + }, + { + "blockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020080", + "extraData" : "0x", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x5208", + "hash" : "eed1b4da708283370856fc76352d68f36d9766b7f366da372e2992ced9a1f663", + "mixHash" : "c250fe02a675a64e068023f48df2662ff2269d970f7689bde287228e200d5401", + "nonce" : "105781dacf8bcf41", + "number" : "0x03", + "parentHash" : "04e0807bea4d9766809afba8f4dbf2e5ab4e522aa4570bb915381c6593530e89", + "receiptTrie" : "4ede0225773c7a517b91994aca65ade45124e7ef4b8be1e6097c9773a11920af", + "stateRoot" : "e9940294a09308406a3d2e09203aed11db40259fac0a25e639ad2b30b82d07de", + "timestamp" : "0x55d9c577", + "transactionsTrie" : "1722b8a91bfc4f5614ce36ee77c7cce6620ab4af36d3c54baa66d7dbeb7bce1a", + "uncleHash" : "1e8797b712282d23d059df15e9082411499795fe2644bdfb35f310c10c78169b" + }, + "rlp" : "0xf90479f901f9a004e0807bea4d9766809afba8f4dbf2e5ab4e522aa4570bb915381c6593530e89a01e8797b712282d23d059df15e9082411499795fe2644bdfb35f310c10c78169b948888f1f195afa192cfee860698584c030f4c9db1a0e9940294a09308406a3d2e09203aed11db40259fac0a25e639ad2b30b82d07dea01722b8a91bfc4f5614ce36ee77c7cce6620ab4af36d3c54baa66d7dbeb7bce1aa04ede0225773c7a517b91994aca65ade45124e7ef4b8be1e6097c9773a11920afb90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302008003832fefd88252088455d9c57780a0c250fe02a675a64e068023f48df2662ff2269d970f7689bde287228e200d540188105781dacf8bcf41f862f86002018304cb2f94095e7baea6a6c7c4c2dfeb977efac326af552d870a801ca015eb1cc916728b9799e55c489857727669afb2986433d5f54cde11faaed9f0eea05d36f6d06c34aae8d0a2a5895c8ba4a17ad46a5fa59f361cb3e7e01a23030e38f90216f90213a019c900975f94fd78dc12ad13740200fbe0a2eba43fd070bedc65588b0c95438aa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794bcde5374fce5edbc8e2a8697c15331677e6ebf0ba0cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000002832fefd880a0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80a06868c784ca472bb16eb9b23029965a737713003d0da6c006e4923e400cd783fc88d99c24fcd2648302", + "transactions" : [ + { + "data" : "0x", + "gasLimit" : "0x04cb2f", + "gasPrice" : "0x01", + "nonce" : "0x02", + "r" : "0x15eb1cc916728b9799e55c489857727669afb2986433d5f54cde11faaed9f0ee", + "s" : "0x5d36f6d06c34aae8d0a2a5895c8ba4a17ad46a5fa59f361cb3e7e01a23030e38", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "v" : "0x1c", + "value" : "0x0a" + } + ], + "uncleHeaders" : [ + { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "bcde5374fce5edbc8e2a8697c15331677e6ebf0b", + "difficulty" : "0x020000", + "extraData" : "0x", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "5264110fedc6f468e9b3c1fead10ee4bdd4957bcb6d193503f8ede6a0d478b95", + "mixHash" : "6868c784ca472bb16eb9b23029965a737713003d0da6c006e4923e400cd783fc", + "nonce" : "d99c24fcd2648302", + "number" : "0x02", + "parentHash" : "19c900975f94fd78dc12ad13740200fbe0a2eba43fd070bedc65588b0c95438a", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "cb52de543653d86ccd13ba3ddf8b052525b04231c6884a4db3188a184681d878", + "timestamp" : "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + } + ], + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "0x020000", + "extraData" : "0x42", + "gasLimit" : "0x2fefd8", + "gasUsed" : "0x00", + "hash" : "e688d736f1307c6f97b6777381b30556137b9d4ca5c43fbd5b30d6b5df315264", + "mixHash" : "f35b4695bdfef02db19d255636bec7911667c7056df2b2f475053ea78dd1b0ff", + "nonce" : "5333c47f947590d8", + "number" : "0x00", + "parentHash" : "0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "7dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "genesisRLP" : "0xf901fcf901f7a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347948888f1f195afa192cfee860698584c030f4c9db1a07dba07d6b448a186e9612e5f737d1c909dce473e53199901a302c00646d523c1a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080832fefd8808454c98c8142a0f35b4695bdfef02db19d255636bec7911667c7056df2b2f475053ea78dd1b0ff885333c47f947590d8c0c0", + "lastblockhash" : "eed1b4da708283370856fc76352d68f36d9766b7f366da372e2992ced9a1f663", + "postState" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "0x14", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "8888f1f195afa192cfee860698584c030f4c9db1" : { + "balance" : "0x8ac7230489e8a410", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x09184e71fbdc", + "code" : "0x", + "nonce" : "0x02", + "storage" : { + } + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "0x09184e72a000", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + } + } } -} \ No newline at end of file +} diff --git a/tests/util.go b/tests/util.go index 3b94effc8f..a9b5011a9a 100644 --- a/tests/util.go +++ b/tests/util.go @@ -135,7 +135,7 @@ type Env struct { coinbase common.Address number *big.Int - time uint64 + time *big.Int difficulty *big.Int gasLimit *big.Int @@ -165,7 +165,7 @@ func NewEnvFromMap(state *state.StateDB, envValues map[string]string, exeValues //env.parent = common.Hex2Bytes(envValues["previousHash"]) env.coinbase = common.HexToAddress(envValues["currentCoinbase"]) env.number = common.Big(envValues["currentNumber"]) - env.time = common.Big(envValues["currentTimestamp"]).Uint64() + env.time = common.Big(envValues["currentTimestamp"]) env.difficulty = common.Big(envValues["currentDifficulty"]) env.gasLimit = common.Big(envValues["currentGasLimit"]) env.Gas = new(big.Int) @@ -178,7 +178,7 @@ func (self *Env) BlockNumber() *big.Int { return self.number } //func (self *Env) PrevHash() []byte { return self.parent } func (self *Env) Coinbase() common.Address { return self.coinbase } -func (self *Env) Time() uint64 { return self.time } +func (self *Env) Time() *big.Int { return self.time } func (self *Env) Difficulty() *big.Int { return self.difficulty } func (self *Env) State() *state.StateDB { return self.state } func (self *Env) GasLimit() *big.Int { return self.gasLimit } diff --git a/xeth/types.go b/xeth/types.go index ad5101d61f..218c8dc7cd 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -19,6 +19,7 @@ package xeth import ( "bytes" "fmt" + "math/big" "strings" "github.com/ethereum/go-ethereum/common" @@ -76,7 +77,7 @@ type Block struct { Hash string `json:"hash"` Transactions *common.List `json:"transactions"` Uncles *common.List `json:"uncles"` - Time uint64 `json:"time"` + Time *big.Int `json:"time"` Coinbase string `json:"coinbase"` Name string `json:"name"` GasLimit string `json:"gasLimit"` From 042dcf1b281cb88289025e939fc91f9698f9f2fa Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Tue, 1 Sep 2015 23:36:05 +0200 Subject: [PATCH 66/90] Merge pull request #1755 from fjl/coinbase core: improve block gas tracking (cherry picked from commit e9b031b88b0a8a567a2e9e02da96cdadd3de1bcb) --- core/block_processor.go | 28 +++++++++++++++++++--------- core/state_transition.go | 23 ++++++++--------------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/core/block_processor.go b/core/block_processor.go index 99d27fa717..1238fda7b9 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -56,6 +56,18 @@ type BlockProcessor struct { eventMux *event.TypeMux } +// TODO: type GasPool big.Int +// +// GasPool is implemented by state.StateObject. This is a historical +// coincidence. Gas tracking should move out of StateObject. + +// GasPool tracks the amount of gas available during +// execution of the transactions in a block. +type GasPool interface { + AddGas(gas, price *big.Int) + SubGas(gas, price *big.Int) error +} + func NewBlockProcessor(db common.Database, pow pow.PoW, chainManager *ChainManager, eventMux *event.TypeMux) *BlockProcessor { sm := &BlockProcessor{ chainDb: db, @@ -64,16 +76,15 @@ func NewBlockProcessor(db common.Database, pow pow.PoW, chainManager *ChainManag bc: chainManager, eventMux: eventMux, } - return sm } func (sm *BlockProcessor) TransitionState(statedb *state.StateDB, parent, block *types.Block, transientProcess bool) (receipts types.Receipts, err error) { - coinbase := statedb.GetOrNewStateObject(block.Coinbase()) - coinbase.SetGasLimit(block.GasLimit()) + gp := statedb.GetOrNewStateObject(block.Coinbase()) + gp.SetGasLimit(block.GasLimit()) // Process the transactions on to parent state - receipts, err = sm.ApplyTransactions(coinbase, statedb, block, block.Transactions(), transientProcess) + receipts, err = sm.ApplyTransactions(gp, statedb, block, block.Transactions(), transientProcess) if err != nil { return nil, err } @@ -81,9 +92,8 @@ func (sm *BlockProcessor) TransitionState(statedb *state.StateDB, parent, block return receipts, nil } -func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *big.Int, transientProcess bool) (*types.Receipt, *big.Int, error) { - cb := statedb.GetStateObject(coinbase.Address()) - _, gas, err := ApplyMessage(NewEnv(statedb, self.bc, tx, header), tx, cb) +func (self *BlockProcessor) ApplyTransaction(gp GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *big.Int, transientProcess bool) (*types.Receipt, *big.Int, error) { + _, gas, err := ApplyMessage(NewEnv(statedb, self.bc, tx, header), tx, gp) if err != nil { return nil, nil, err } @@ -118,7 +128,7 @@ func (self *BlockProcessor) ChainManager() *ChainManager { return self.bc } -func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, statedb *state.StateDB, block *types.Block, txs types.Transactions, transientProcess bool) (types.Receipts, error) { +func (self *BlockProcessor) ApplyTransactions(gp GasPool, statedb *state.StateDB, block *types.Block, txs types.Transactions, transientProcess bool) (types.Receipts, error) { var ( receipts types.Receipts totalUsedGas = big.NewInt(0) @@ -130,7 +140,7 @@ func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, state for i, tx := range txs { statedb.StartRecord(tx.Hash(), block.Hash(), i) - receipt, txGas, err := self.ApplyTransaction(coinbase, statedb, header, tx, totalUsedGas, transientProcess) + receipt, txGas, err := self.ApplyTransaction(gp, statedb, header, tx, totalUsedGas, transientProcess) if err != nil { return nil, err } diff --git a/core/state_transition.go b/core/state_transition.go index a5d4fc19b9..6ff7fa1ffd 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -45,7 +45,7 @@ import ( * 6) Derive new state root */ type StateTransition struct { - coinbase common.Address + gp GasPool msg Message gas, gasPrice *big.Int initialGas *big.Int @@ -53,8 +53,6 @@ type StateTransition struct { data []byte state *state.StateDB - cb, rec, sen *state.StateObject - env vm.Environment } @@ -96,13 +94,13 @@ func IntrinsicGas(data []byte) *big.Int { return igas } -func ApplyMessage(env vm.Environment, msg Message, coinbase *state.StateObject) ([]byte, *big.Int, error) { - return NewStateTransition(env, msg, coinbase).transitionState() +func ApplyMessage(env vm.Environment, msg Message, gp GasPool) ([]byte, *big.Int, error) { + return NewStateTransition(env, msg, gp).transitionState() } -func NewStateTransition(env vm.Environment, msg Message, coinbase *state.StateObject) *StateTransition { +func NewStateTransition(env vm.Environment, msg Message, gp GasPool) *StateTransition { return &StateTransition{ - coinbase: coinbase.Address(), + gp: gp, env: env, msg: msg, gas: new(big.Int), @@ -111,13 +109,9 @@ func NewStateTransition(env vm.Environment, msg Message, coinbase *state.StateOb value: msg.Value(), data: msg.Data(), state: env.State(), - cb: coinbase, } } -func (self *StateTransition) Coinbase() *state.StateObject { - return self.state.GetOrNewStateObject(self.coinbase) -} func (self *StateTransition) From() (*state.StateObject, error) { f, err := self.msg.From() if err != nil { @@ -160,7 +154,7 @@ func (self *StateTransition) BuyGas() error { if sender.Balance().Cmp(mgval) < 0 { return fmt.Errorf("insufficient ETH for gas (%x). Req %v, has %v", sender.Address().Bytes()[:4], mgval, sender.Balance()) } - if err = self.Coinbase().SubGas(mgas, self.gasPrice); err != nil { + if err = self.gp.SubGas(mgas, self.gasPrice); err != nil { return err } self.AddGas(mgas) @@ -241,13 +235,12 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er } self.refundGas() - self.state.AddBalance(self.coinbase, new(big.Int).Mul(self.gasUsed(), self.gasPrice)) + self.state.AddBalance(self.env.Coinbase(), new(big.Int).Mul(self.gasUsed(), self.gasPrice)) return ret, self.gasUsed(), err } func (self *StateTransition) refundGas() { - coinbase := self.Coinbase() sender, _ := self.From() // err already checked // Return remaining gas remaining := new(big.Int).Mul(self.gas, self.gasPrice) @@ -258,7 +251,7 @@ func (self *StateTransition) refundGas() { self.gas.Add(self.gas, refund) self.state.AddBalance(sender.Address(), refund.Mul(refund, self.gasPrice)) - coinbase.AddGas(self.gas, self.gasPrice) + self.gp.AddGas(self.gas, self.gasPrice) } func (self *StateTransition) gasUsed() *big.Int { From 8f09242d7f527972acb1a8b2a61c9f55000e955d Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Tue, 1 Sep 2015 23:43:22 +0200 Subject: [PATCH 67/90] Bump version to 1.1.1 --- cmd/geth/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index ff556c984e..c821e3bc20 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -48,10 +48,10 @@ import ( const ( ClientIdentifier = "Geth" - Version = "1.1.0" + Version = "1.1.1" VersionMajor = 1 VersionMinor = 1 - VersionPatch = 0 + VersionPatch = 1 ) var ( From 9d6221444c8c2efb8750eb718ce428df7c63132b Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Fri, 7 Aug 2015 15:37:14 -0400 Subject: [PATCH 68/90] test change lol --- .gitignore | 2 +- .gitmodules | 6 +- .idea/.name | 1 + .idea/encodings.xml | 4 + .idea/go-expanse.iml | 8 + .idea/modules.xml | 8 + .idea/scopes/scope_settings.xml | 5 + .idea/vcs.xml | 6 + .idea/workspace.xml | 1143 ++++++++++++ .mailmap | 14 +- AUTHORS | 6 +- COPYING | 2 +- Godeps/Godeps.json | 4 +- .../github.com/ethereum/ethash/.travis.yml | 8 +- .../src/github.com/ethereum/ethash/README.md | 8 +- .../src/github.com/ethereum/ethash/ethash.go | 14 +- .../github.com/ethereum/ethash/ethash_test.go | 38 +- .../src/github.com/ethereum/ethash/setup.py | 6 +- .../ethash/src/benchmark/benchmark.cpp | 8 +- .../ethereum/ethash/src/libethash/compiler.h | 8 +- .../ethash/src/libethash/data_sizes.h | 8 +- .../ethereum/ethash/src/libethash/fnv.h | 8 +- .../ethereum/ethash/src/libethash/internal.c | 2 +- .../ethereum/ethash/src/libethash/io.h | 6 +- .../ethash/src/libethash/util_win32.c | 8 +- .../ethereum/ethash/src/python/core.c | 6 +- .../ethereum/ethash/test/c/test.cpp | 2 +- .../src/golang.org/x/net/html/entity.go | 4 +- Makefile | 8 +- README.md | 57 +- accounts/abi/abi.go | 12 +- accounts/abi/abi_test.go | 12 +- accounts/abi/doc.go | 14 +- accounts/abi/numbers.go | 12 +- accounts/abi/numbers_test.go | 10 +- accounts/abi/type.go | 12 +- accounts/account_manager.go | 14 +- accounts/accounts_test.go | 14 +- build/env.sh | 12 +- build/test-global-coverage.sh | 1 + build/update-license.go | 10 +- cmd/bootnode/main.go | 20 +- cmd/disasm/main.go | 14 +- cmd/ethtest/.gitignore | 2 +- cmd/ethtest/main.go | 16 +- cmd/evm/main.go | 10 +- cmd/geth/blocktestcmd.go | 60 +- cmd/geth/chaincmd.go | 24 +- cmd/geth/js.go | 64 +- cmd/geth/js_test.go | 154 +- cmd/geth/main.go | 136 +- cmd/geth/monitorcmd.go | 30 +- cmd/rlpdump/main.go | 12 +- cmd/utils/cmd.go | 38 +- cmd/utils/customflags.go | 12 +- cmd/utils/customflags_test.go | 10 +- cmd/utils/flags.go | 68 +- cmd/utils/legalese.go | 10 +- common/README.md | 14 +- common/big.go | 10 +- common/big_test.go | 10 +- common/bytes.go | 10 +- common/bytes_test.go | 10 +- common/compiler/solidity.go | 18 +- common/compiler/solidity_test.go | 14 +- common/db.go | 10 +- common/debug.go | 12 +- common/docserver/docserver.go | 14 +- common/docserver/docserver_test.go | 16 +- common/list.go | 10 +- common/main_test.go | 10 +- common/math/dist.go | 12 +- common/math/dist_test.go | 10 +- common/natspec/natspec.go | 20 +- common/natspec/natspec_e2e_test.go | 70 +- common/natspec/natspec_e2e_test.go.orig | 54 +- common/natspec/natspec_js.go | 60 +- common/natspec/natspec_test.go | 10 +- common/number/int.go | 12 +- common/number/uint_test.go | 12 +- common/package.go | 12 +- common/path.go | 26 +- common/path_test.go | 52 + common/registrar/contracts.go | 10 +- common/registrar/ethreg/ethreg.go | 14 +- common/registrar/registrar.go | 22 +- common/registrar/registrar_test.go | 14 +- common/rlp.go | 10 +- common/rlp_test.go | 12 +- common/size.go | 10 +- common/size_test.go | 10 +- common/test_utils.go | 10 +- common/types.go | 10 +- common/types_template.go | 10 +- common/types_test.go | 10 +- common/value.go | 12 +- common/value_test.go | 10 +- compression/rle/read_write.go | 14 +- compression/rle/read_write_test.go | 10 +- core/asm.go | 14 +- core/bad_block.go | 20 +- core/bench_test.go | 24 +- core/block_cache.go | 14 +- core/block_cache_test.go | 14 +- core/block_processor.go | 28 +- core/block_processor_test.go | 22 +- core/blocks.go | 12 +- core/canary.go | 14 +- core/chain_makers.go | 20 +- core/chain_makers_test.go | 20 +- core/chain_manager.go | 30 +- core/chain_manager_test.go | 26 +- core/chain_util.go | 22 +- core/chain_util_test.go | 12 +- core/default_genesis.go | 10 +- core/error.go | 12 +- core/events.go | 16 +- core/execution.go | 22 +- core/fees.go | 12 +- core/filter.go | 24 +- core/filter_test.go | 10 +- core/genesis.go | 22 +- core/helper_test.go | 20 +- core/manager.go | 16 +- core/state/dump.go | 12 +- core/state/errors.go | 10 +- core/state/log.go | 14 +- core/state/main_test.go | 10 +- core/state/managed_state.go | 12 +- core/state/managed_state_test.go | 14 +- core/state/state_object.go | 22 +- core/state/state_test.go | 14 +- core/state/statedb.go | 22 +- core/state_transition.go | 22 +- core/transaction_pool.go | 22 +- core/transaction_pool_test.go | 22 +- core/transaction_util.go | 22 +- core/types/block.go | 22 +- core/types/block_test.go | 14 +- core/types/bloom9.go | 16 +- core/types/bloom9_test.go | 12 +- core/types/common.go | 14 +- core/types/derive_sha.go | 18 +- core/types/receipt.go | 16 +- core/types/transaction.go | 20 +- core/types/transaction_test.go | 18 +- core/vm/analysis.go | 12 +- core/vm/asm.go | 12 +- core/vm/common.go | 14 +- core/vm/context.go | 12 +- core/vm/contracts.go | 20 +- core/vm/disasm.go | 10 +- core/vm/environment.go | 14 +- core/vm/errors.go | 12 +- core/vm/gas.go | 12 +- core/vm/logger.go | 12 +- core/vm/memory.go | 10 +- core/vm/opcodes.go | 10 +- core/vm/settings.go | 10 +- core/vm/stack.go | 10 +- core/vm/virtual_machine.go | 10 +- core/vm/vm.go | 12 +- core/vm/vm_jit.go | 18 +- core/vm/vm_jit_fake.go | 10 +- core/vm_env.go | 18 +- crypto/crypto.go | 24 +- crypto/crypto_test.go | 14 +- crypto/encrypt_decrypt_test.go | 12 +- crypto/key.go | 12 +- crypto/key_store_passphrase.go | 16 +- crypto/key_store_plain.go | 12 +- crypto/key_store_test.go | 16 +- crypto/keypair.go | 66 + crypto/mnemonic.go | 76 + crypto/mnemonic_test.go | 90 + crypto/mnemonic_words.go | 1646 +++++++++++++++++ crypto/randentropy/rand_entropy.go | 12 +- crypto/secp256k1/notes.go | 10 +- crypto/secp256k1/secp256.go | 12 +- crypto/secp256k1/secp256_test.go | 12 +- docker/Dockerfile | 12 +- docker/supervisord.conf | 8 +- errs/errors.go | 14 +- errs/errors_test.go | 12 +- eth/backend.go | 134 +- eth/downloader/downloader.go | 30 +- eth/downloader/downloader_test.go | 22 +- eth/downloader/events.go | 10 +- eth/downloader/peer.go | 14 +- eth/downloader/queue.go | 18 +- eth/fetcher/fetcher.go | 20 +- eth/fetcher/fetcher_test.go | 20 +- eth/fetcher/metrics.go | 24 +- eth/gasprice.go | 54 +- eth/handler.go | 50 +- eth/metrics.go | 54 +- eth/peer.go | 30 +- eth/protocol.go | 20 +- eth/protocol_test.go | 28 +- eth/sync.go | 22 +- ethdb/README.md | 4 +- ethdb/database.go | 16 +- ethdb/database_test.go | 12 +- ethdb/memory_database.go | 12 +- event/event.go | 10 +- event/event_test.go | 10 +- event/example_test.go | 10 +- event/filter/eth_filter.go | 16 +- event/filter/filter.go | 10 +- event/filter/filter_test.go | 10 +- event/filter/generic_filter.go | 10 +- fdtrack/fdtrack.go | 112 ++ fdtrack/fdusage_darwin.go | 72 + generators/defaults.go | 12 +- jsre/bignumber_js.go | 10 +- jsre/ethereum_js.go | 262 ++- jsre/jsre.go | 12 +- jsre/jsre_test.go | 10 +- jsre/pp_js.go | 137 ++ logger/example_test.go | 10 +- logger/log.go | 12 +- logger/loggers.go | 12 +- logger/loggers_test.go | 10 +- logger/logsystem.go | 10 +- logger/sys.go | 10 +- logger/types.go | 46 +- logger/verbosity.go | 10 +- metrics/disk.go | 10 +- metrics/disk_linux.go | 10 +- metrics/disk_nop.go | 10 +- metrics/metrics.go | 14 +- miner/agent.go | 18 +- miner/miner.go | 18 +- miner/remote_agent.go | 18 +- miner/worker.go | 54 +- p2p/dial.go | 10 +- p2p/dial_test.go | 12 +- p2p/discover/database.go | 18 +- p2p/discover/database_test.go | 34 +- p2p/discover/node.go | 20 +- p2p/discover/node_test.go | 14 +- p2p/discover/table.go | 18 +- p2p/discover/table_test.go | 14 +- p2p/discover/udp.go | 12 +- p2p/discover/udp_test.go | 22 +- p2p/message.go | 12 +- p2p/message_test.go | 10 +- p2p/metrics.go | 12 +- p2p/nat/nat.go | 14 +- p2p/nat/nat_test.go | 10 +- p2p/nat/natpmp.go | 10 +- p2p/nat/natupnp.go | 10 +- p2p/nat/natupnp_test.go | 10 +- p2p/peer.go | 18 +- p2p/peer_error.go | 10 +- p2p/peer_test.go | 10 +- p2p/protocol.go | 10 +- p2p/rlpx.go | 22 +- p2p/rlpx_test.go | 20 +- p2p/server.go | 14 +- p2p/server_test.go | 16 +- params/protocol_params.go | 14 +- pow/block.go | 14 +- pow/dagger/dagger.go | 16 +- pow/dagger/dagger_test.go | 12 +- pow/ezp/pow.go | 18 +- pow/pow.go | 10 +- rlp/decode.go | 10 +- rlp/decode_test.go | 10 +- rlp/doc.go | 14 +- rlp/encode.go | 10 +- rlp/encode_test.go | 10 +- rlp/encoder_example_test.go | 10 +- rlp/typecache.go | 10 +- rpc/api/admin.go | 38 +- rpc/api/admin_args.go | 18 +- rpc/api/admin_js.go | 10 +- rpc/api/api.go | 14 +- rpc/api/api_test.go | 32 +- rpc/api/args.go | 12 +- rpc/api/args_test.go | 12 +- rpc/api/db.go | 24 +- rpc/api/db_args.go | 14 +- rpc/api/db_js.go | 10 +- rpc/api/debug.go | 38 +- rpc/api/debug_args.go | 12 +- rpc/api/debug_js.go | 10 +- rpc/api/eth.go | 40 +- rpc/api/eth_args.go | 18 +- rpc/api/eth_js.go | 12 +- rpc/api/mergedapi.go | 22 +- rpc/api/miner.go | 34 +- rpc/api/miner_args.go | 14 +- rpc/api/miner_js.go | 10 +- rpc/api/net.go | 24 +- rpc/api/net_js.go | 10 +- rpc/api/parsing.go | 16 +- rpc/api/personal.go | 30 +- rpc/api/personal_args.go | 12 +- rpc/api/personal_js.go | 10 +- rpc/api/shh.go | 24 +- rpc/api/shh_args.go | 12 +- rpc/api/shh_js.go | 10 +- rpc/api/txpool.go | 26 +- rpc/api/txpool_js.go | 10 +- rpc/api/utils.go | 42 +- rpc/api/web3.go | 20 +- rpc/api/web3_args.go | 12 +- rpc/codec/codec.go | 12 +- rpc/codec/json.go | 12 +- rpc/codec/json_test.go | 10 +- rpc/comms/comms.go | 32 +- rpc/comms/http.go | 14 +- rpc/comms/inproc.go | 18 +- rpc/comms/ipc.go | 16 +- rpc/comms/ipc_unix.go | 12 +- rpc/comms/ipc_windows.go | 12 +- rpc/jeth.go | 16 +- rpc/shared/errors.go | 10 +- rpc/shared/types.go | 18 +- rpc/shared/utils.go | 12 +- rpc/useragent/agent.go | 10 +- rpc/xeth.go | 20 +- tests/block_test.go | 10 +- tests/block_test_util.go | 50 +- .../files/ansible/roles/common/tasks/main.yml | 2 +- tests/files/ansible/roles/ec2/vars/main.yml | 2 +- .../ansible/roles/testrunner/tasks/main.yml | 6 +- .../test-files/create-docker-images.sh | 6 +- .../ansible/test-files/docker-cpp/Dockerfile | 20 +- .../test-files/docker-cppjit/Dockerfile | 22 +- .../ansible/test-files/docker-go/Dockerfile | 12 +- .../test-files/docker-python/Dockerfile | 6 +- tests/files/ansible/test-files/testrunner.sh | 8 +- tests/files/package.json | 12 +- tests/init.go | 14 +- tests/rlp_test.go | 10 +- tests/rlp_test_util.go | 12 +- tests/state_test.go | 10 +- tests/state_test_util.go | 24 +- tests/transaction_test.go | 10 +- tests/transaction_test_util.go | 18 +- tests/util.go | 22 +- tests/vm_test.go | 10 +- tests/vm_test_util.go | 20 +- trie/cache.go | 14 +- trie/encoding.go | 10 +- trie/encoding_test.go | 10 +- trie/fullnode.go | 10 +- trie/hashnode.go | 12 +- trie/iterator.go | 10 +- trie/iterator_test.go | 10 +- trie/node.go | 10 +- trie/secure_trie.go | 12 +- trie/shortnode.go | 12 +- trie/slice.go | 10 +- trie/trie.go | 14 +- trie/trie_test.go | 14 +- trie/valuenode.go | 12 +- whisper/doc.go | 12 +- whisper/envelope.go | 20 +- whisper/envelope_test.go | 14 +- whisper/filter.go | 12 +- whisper/filter_test.go | 10 +- whisper/main.go | 28 +- whisper/message.go | 20 +- whisper/message_test.go | 12 +- whisper/peer.go | 20 +- whisper/peer_test.go | 14 +- whisper/topic.go | 14 +- whisper/topic_test.go | 10 +- whisper/whisper.go | 28 +- whisper/whisper_test.go | 14 +- xeth/frontend.go | 10 +- xeth/state.go | 14 +- xeth/types.go | 24 +- xeth/whisper.go | 18 +- xeth/whisper_filter.go | 12 +- xeth/whisper_message.go | 16 +- xeth/xeth.go | 60 +- 380 files changed, 6661 insertions(+), 3217 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/encodings.xml create mode 100644 .idea/go-expanse.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 common/path_test.go create mode 100644 crypto/keypair.go create mode 100644 crypto/mnemonic.go create mode 100644 crypto/mnemonic_test.go create mode 100644 crypto/mnemonic_words.go create mode 100644 fdtrack/fdtrack.go create mode 100644 fdtrack/fdusage_darwin.go create mode 100644 jsre/pp_js.go diff --git a/.gitignore b/.gitignore index 3b34d32c28..48077ede1c 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ Godeps/_workspace/bin deploy/osx/Mist.app deploy/osx/Mist\ Installer.dmg -cmd/mist/assets/ext/ethereum.js/ +cmd/mist/assets/ext/expanse.js/ # used by the Makefile /build/_workspace/ diff --git a/.gitmodules b/.gitmodules index 219564eb7b..fbd82891d0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "cmd/mist/assets/ext/ethereum.js"] - path = cmd/mist/assets/ext/ethereum.js - url = https://github.com/ethereum/web3.js +[submodule "cmd/mist/assets/ext/expanse.js"] + path = cmd/mist/assets/ext/expanse.js + url = https://github.com/expanse-project/web3.js diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000000..2adf87fbaf --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +go-expanse \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000..d82104827f --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/go-expanse.iml b/.idea/go-expanse.iml new file mode 100644 index 0000000000..c956989b29 --- /dev/null +++ b/.idea/go-expanse.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000..2318fdd1a3 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000000..922003b843 --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000..94a25f7f4c --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000..b88a882863 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,1143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1438971860269 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.mailmap b/.mailmap index 704d397486..527178eba1 100644 --- a/.mailmap +++ b/.mailmap @@ -1,7 +1,7 @@ -Jeffrey Wilcke -Jeffrey Wilcke -Jeffrey Wilcke -Jeffrey Wilcke +Jeffrey Wilcke +Jeffrey Wilcke +Jeffrey Wilcke +Jeffrey Wilcke Viktor Trón @@ -12,7 +12,7 @@ Nick Savers Maran Hidskes Taylor Gerring -Taylor Gerring +Taylor Gerring Bas van Kervel Bas van Kervel @@ -57,5 +57,5 @@ Nick Dodson Jason Carver Jason Carver -Joseph Chow -Joseph Chow ethers +Joseph Chow +Joseph Chow ethers diff --git a/AUTHORS b/AUTHORS index 0c5b547d7a..0e67eac1fb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ -# This is the official list of go-ethereum authors for copyright purposes. +# This is the official list of go-expanse authors for copyright purposes. Alex Leverington Alexandre Van de Sande @@ -10,8 +10,8 @@ Felix Lange Gustav Simonsson Jae Kwon Jason Carver -Jeffrey Wilcke -Joseph Chow +Jeffrey Wilcke +Joseph Chow Kobi Gurkan Maran Hidskes Marek Kotewicz diff --git a/COPYING b/COPYING index 8d66e87723..593b66738e 100644 --- a/COPYING +++ b/COPYING @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2014 The go-ethereum Authors. + Copyright (C) 2015 The go-expanse Authors. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index d5c41227dc..25b3793337 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,5 +1,5 @@ { - "ImportPath": "github.com/ethereum/go-ethereum", + "ImportPath": "github.com/expanse-project/go-expanse", "GoVersion": "go1.4", "Packages": [ "./..." @@ -20,7 +20,7 @@ "Rev": "3e6e67c4dcea3ac2f25fd4731abc0e1deaf36216" }, { - "ImportPath": "github.com/ethereum/ethash", + "ImportPath": "github.com/expanse-project/ethash", "Comment": "v23.1-227-g8f6ccaa", "Rev": "8f6ccaaef9b418553807a73a95cb5f49cd3ea39f" }, diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml b/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml index b83b02bf3c..a6d979e02e 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml @@ -6,12 +6,12 @@ before_install: # for g++4.8 and C++11 - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test - # Set up go-ethereum + # Set up go-expanse - sudo apt-get update -y -qq - sudo apt-get install -yqq libgmp3-dev - - git clone --depth=10 https://github.com/ethereum/go-ethereum ${GOPATH}/src/github.com/ethereum/go-ethereum - # use canned dependencies from the go-ethereum repository - - export GOPATH=$GOPATH:$GOPATH/src/github.com/ethereum/go-ethereum/Godeps/_workspace/ + - git clone --depth=10 https://github.com/expanse-project/go-expanse ${GOPATH}/src/github.com/expanse-project/go-expanse + # use canned dependencies from the go-expanse repository + - export GOPATH=$GOPATH:$GOPATH/src/github.com/expanse-project/go-expanse/Godeps/_workspace/ - echo $GOPATH install: diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/README.md b/Godeps/_workspace/src/github.com/ethereum/ethash/README.md index 2b2c3b544c..a0004a373f 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/README.md +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/README.md @@ -1,14 +1,14 @@ -[![Build Status](https://travis-ci.org/ethereum/ethash.svg?branch=master)](https://travis-ci.org/ethereum/ethash) +[![Build Status](https://travis-ci.org/expanse/ethash.svg?branch=master)](https://travis-ci.org/expanse/ethash) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/debris/ethash?branch=master&svg=true)](https://ci.appveyor.com/project/debris/ethash-nr37r/branch/master) # Ethash -For details on this project, please see the Ethereum wiki: -https://github.com/ethereum/wiki/wiki/Ethash +For details on this project, please see the Expanse wiki: +https://github.com/expanse-project/wiki/wiki/Ethash ### Coding Style for C++ code: -Follow the same exact style as in [cpp-ethereum](https://github.com/ethereum/cpp-ethereum/blob/develop/CodingStandards.txt) +Follow the same exact style as in [cpp-expanse](https://github.com/expanse-project/cpp-expanse/blob/develop/CodingStandards.txt) ### Coding Style for C code: diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go index d0864da7f7..5904a0f21d 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go @@ -22,11 +22,11 @@ import ( "time" "unsafe" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/pow" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/pow" ) var ( @@ -110,7 +110,7 @@ func (l *Light) Verify(block pow.Block) bool { /* Cannot happen if block header diff is validated prior to PoW, but can happen if PoW is checked first due to parallel PoW checking. We could check the minimum valid difficulty but for SoC we avoid (duplicating) - Ethereum protocol consensus rules here which are not in scope of Ethash + Expanse protocol consensus rules here which are not in scope of Ethash */ if difficulty.Cmp(common.Big0) == 0 { glog.V(logger.Debug).Infof("invalid block difficulty") @@ -308,7 +308,7 @@ func (pow *Full) Search(block pow.Block, stop <-chan struct{}) (nonce uint64, mi ret := C.ethash_full_compute(dag.ptr, hash, C.uint64_t(nonce)) result := h256ToHash(ret.result).Big() - // TODO: disagrees with the spec https://github.com/ethereum/wiki/wiki/Ethash#mining + // TODO: disagrees with the spec https://github.com/expanse-project/wiki/wiki/Ethash#mining if ret.success && result.Cmp(target) <= 0 { mixDigest = C.GoBytes(unsafe.Pointer(&ret.mix_hash), C.int(32)) atomic.AddInt32(&pow.hashRate, -previousHashrate) diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go index 1e1de989d1..4d9cdc11b6 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go @@ -10,8 +10,8 @@ import ( "sync" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) func init() { @@ -69,30 +69,30 @@ var invalidZeroDiffBlock = testBlock{ } func TestEthashVerifyValid(t *testing.T) { - eth := New() + exp := New() for i, block := range validBlocks { - if !eth.Verify(block) { + if !exp.Verify(block) { t.Errorf("block %d (%x) did not validate.", i, block.hashNoNonce[:6]) } } } func TestEthashVerifyInvalid(t *testing.T) { - eth := New() - if eth.Verify(&invalidZeroDiffBlock) { + exp := New() + if exp.Verify(&invalidZeroDiffBlock) { t.Errorf("should not validate - we just ensure it does not panic on this block") } } func TestEthashConcurrentVerify(t *testing.T) { - eth, err := NewForTesting() + exp, err := NewForTesting() if err != nil { t.Fatal(err) } - defer os.RemoveAll(eth.Full.Dir) + defer os.RemoveAll(exp.Full.Dir) block := &testBlock{difficulty: big.NewInt(10)} - nonce, md := eth.Search(block, nil) + nonce, md := exp.Search(block, nil) block.nonce = nonce block.mixDigest = common.BytesToHash(md) @@ -101,7 +101,7 @@ func TestEthashConcurrentVerify(t *testing.T) { wg.Add(100) for i := 0; i < 100; i++ { go func() { - if !eth.Verify(block) { + if !exp.Verify(block) { t.Error("Block could not be verified") } wg.Done() @@ -111,12 +111,12 @@ func TestEthashConcurrentVerify(t *testing.T) { } func TestEthashConcurrentSearch(t *testing.T) { - eth, err := NewForTesting() + exp, err := NewForTesting() if err != nil { t.Fatal(err) } - eth.Turbo(true) - defer os.RemoveAll(eth.Full.Dir) + exp.Turbo(true) + defer os.RemoveAll(exp.Full.Dir) type searchRes struct { n uint64 @@ -135,7 +135,7 @@ func TestEthashConcurrentSearch(t *testing.T) { // launch n searches concurrently. for i := 0; i < nsearch; i++ { go func() { - nonce, md := eth.Search(block, stop) + nonce, md := exp.Search(block, stop) select { case found <- searchRes{n: nonce, md: md}: case <-stop: @@ -152,25 +152,25 @@ func TestEthashConcurrentSearch(t *testing.T) { block.nonce = res.n block.mixDigest = common.BytesToHash(res.md) - if !eth.Verify(block) { + if !exp.Verify(block) { t.Error("Block could not be verified") } } func TestEthashSearchAcrossEpoch(t *testing.T) { - eth, err := NewForTesting() + exp, err := NewForTesting() if err != nil { t.Fatal(err) } - defer os.RemoveAll(eth.Full.Dir) + defer os.RemoveAll(exp.Full.Dir) for i := epochLength - 40; i < epochLength+40; i++ { block := &testBlock{number: i, difficulty: big.NewInt(90)} rand.Read(block.hashNoNonce[:]) - nonce, md := eth.Search(block, nil) + nonce, md := exp.Search(block, nil) block.nonce = nonce block.mixDigest = common.BytesToHash(md) - if !eth.Verify(block) { + if !exp.Verify(block) { t.Fatalf("Block could not be verified") } } diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py b/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py index 18aa20f6db..51ac2e39f5 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py @@ -39,9 +39,9 @@ setup( author_email="matthew.wampler.doty@gmail.com", license='GPL', version='0.1.23', - url='https://github.com/ethereum/ethash', - download_url='https://github.com/ethereum/ethash/tarball/v23', - description=('Python wrappers for ethash, the ethereum proof of work' + url='https://github.com/expanse-project/ethash', + download_url='https://github.com/expanse-project/ethash/tarball/v23', + description=('Python wrappers for ethash, the expanse proof of work' 'hashing function'), ext_modules=[pyethash], ) diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/benchmark.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/benchmark.cpp index 1a648edf42..dae4124824 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/benchmark.cpp +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/benchmark.cpp @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + This file is part of cpp-expanse. - cpp-ethereum is free software: you can redistribute it and/or modify + cpp-expanse is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - cpp-ethereum is distributed in the hope that it will be useful, + cpp-expanse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . + along with cpp-expanse. If not, see . */ /** @file benchmark.cpp * @author Tim Hughes diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h index 9695871cdc..7750ab9b7c 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + This file is part of cpp-expanse. - cpp-ethereum is free software: you can redistribute it and/or modify + cpp-expanse is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - cpp-ethereum is distributed in the hope that it will be useful, + cpp-expanse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . + along with cpp-expanse. If not, see . */ /** @file compiler.h * @date 2014 diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h index 83cc30bcba..4eadea6127 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + This file is part of cpp-expanse. - cpp-ethereum is free software: you can redistribute it and/or modify + cpp-expanse is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software FoundationUUU,either version 3 of the LicenseUUU,or (at your option) any later version. - cpp-ethereum is distributed in the hope that it will be usefulU, + cpp-expanse is distributed in the hope that it will be usefulU, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with cpp-ethereum. If notUUU,see . + along with cpp-expanse. If notUUU,see . */ /** @file data_sizes.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h index d23c4e2474..ee5252b5b3 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + This file is part of cpp-expanse. - cpp-ethereum is free software: you can redistribute it and/or modify + cpp-expanse is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - cpp-ethereum is distributed in the hope that it will be useful, + cpp-expanse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . + along with cpp-expanse. If not, see . */ /** @file fnv.h * @author Matthew Wampler-Doty diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c index 338aa5ecd3..20ef8a9afc 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . + along with cpp-expanse. If not, see . */ /** @file internal.c * @author Tim Hughes diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h index 7a27089c7d..0febbe1b9e 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h @@ -38,7 +38,7 @@ extern "C" { // 10 is for maximum number of digits of a uint32_t (for REVISION) // 1 is for - and 16 is for the first 16 hex digits for first 8 bytes of // the seedhash and last 1 is for the null terminating character -// Reference: https://github.com/ethereum/wiki/wiki/Ethash-DAG +// Reference: https://github.com/expanse-project/wiki/wiki/Ethash-DAG #define DAG_MUTABLE_NAME_MAX_SIZE (6 + 10 + 1 + 16 + 1) /// Possible return values of @see ethash_io_prepare enum ethash_io_rc { @@ -80,7 +80,7 @@ enum ethash_io_rc { * data directory. If it does not exist it's created. * @param[in] seedhash The seedhash of the current block number, used in the * naming of the file as can be seen from the spec at: - * https://github.com/ethereum/wiki/wiki/Ethash-DAG + * https://github.com/expanse-project/wiki/wiki/Ethash-DAG * @param[out] output_file If there was no failure then this will point to an open * file descriptor. User is responsible for closing it. * In the case of memo match then the file is open on read @@ -175,7 +175,7 @@ char* ethash_io_create_filename( /** * Gets the default directory name for the DAG depending on the system * - * The spec defining this directory is here: https://github.com/ethereum/wiki/wiki/Ethash-DAG + * The spec defining this directory is here: https://github.com/expanse-project/wiki/wiki/Ethash-DAG * * @param[out] strbuf A string buffer of sufficient size to keep the * null termninated string of the directory name diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util_win32.c b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util_win32.c index 268e6db056..6f2e69e6d1 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util_win32.c +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util_win32.c @@ -1,18 +1,18 @@ /* - This file is part of cpp-ethereum. + This file is part of cpp-expanse. - cpp-ethereum is free software: you can redistribute it and/or modify + cpp-expanse is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - cpp-ethereum is distributed in the hope that it will be useful, + cpp-expanse is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with cpp-ethereum. If not, see . + along with cpp-expanse. If not, see . */ /** @file util.c * @author Tim Hughes diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c b/Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c index c66e03c549..b84d6c7504 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c @@ -172,7 +172,7 @@ mine(PyObject *self, PyObject *args) { // TODO: Multi threading? do { ethash_full(&out, (void *) full_bytes, ¶ms, (const ethash_h256_t *) header, nonce++); - // TODO: disagrees with the spec https://github.com/ethereum/wiki/wiki/Ethash#mining + // TODO: disagrees with the spec https://github.com/expanse-project/wiki/wiki/Ethash#mining } while (!ethash_check_difficulty(&out.result, (const ethash_h256_t *) difficulty)); return Py_BuildValue("{" PY_CONST_STRING_FORMAT ":" PY_STRING_FORMAT ", " PY_CONST_STRING_FORMAT ":" PY_STRING_FORMAT ", " PY_CONST_STRING_FORMAT ":K}", @@ -233,7 +233,7 @@ static struct PyModuleDef PyethashModule = { PyMODINIT_FUNC PyInit_pyethash(void) { PyObject *module = PyModule_Create(&PyethashModule); - // Following Spec: https://github.com/ethereum/wiki/wiki/Ethash#definitions + // Following Spec: https://github.com/expanse-project/wiki/wiki/Ethash#definitions PyModule_AddIntConstant(module, "REVISION", (long) ETHASH_REVISION); PyModule_AddIntConstant(module, "DATASET_BYTES_INIT", (long) ETHASH_DATASET_BYTES_INIT); PyModule_AddIntConstant(module, "DATASET_BYTES_GROWTH", (long) ETHASH_DATASET_BYTES_GROWTH); @@ -251,7 +251,7 @@ PyMODINIT_FUNC PyInit_pyethash(void) { PyMODINIT_FUNC initpyethash(void) { PyObject *module = Py_InitModule("pyethash", PyethashMethods); - // Following Spec: https://github.com/ethereum/wiki/wiki/Ethash#definitions + // Following Spec: https://github.com/expanse-project/wiki/wiki/Ethash#definitions PyModule_AddIntConstant(module, "REVISION", (long) ETHASH_REVISION); PyModule_AddIntConstant(module, "DATASET_BYTES_INIT", (long) ETHASH_DATASET_BYTES_INIT); PyModule_AddIntConstant(module, "DATASET_BYTES_GROWTH", (long) ETHASH_DATASET_BYTES_GROWTH); diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp index 44e0c385bb..ffcf105186 100644 --- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp +++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp @@ -36,7 +36,7 @@ namespace fs = boost::filesystem; #define our_alloca(param__) alloca((size_t)(param__)) -// some functions taken from eth::dev for convenience. +// some functions taken from exp::dev for convenience. std::string bytesToHexString(const uint8_t *str, const uint64_t s) { std::ostringstream ret; diff --git a/Godeps/_workspace/src/golang.org/x/net/html/entity.go b/Godeps/_workspace/src/golang.org/x/net/html/entity.go index a50c04c60e..f285b78f6d 100644 --- a/Godeps/_workspace/src/golang.org/x/net/html/entity.go +++ b/Godeps/_workspace/src/golang.org/x/net/html/entity.go @@ -975,7 +975,7 @@ var entity = map[string]rune{ "esdot;": '\U00002250', "esim;": '\U00002242', "eta;": '\U000003B7', - "eth;": '\U000000F0', + "exp;": '\U000000F0', "euml;": '\U000000EB', "euro;": '\U000020AC', "excl;": '\U00000021', @@ -2102,7 +2102,7 @@ var entity = map[string]rune{ "eacute": '\U000000E9', "ecirc": '\U000000EA', "egrave": '\U000000E8', - "eth": '\U000000F0', + "exp": '\U000000F0', "euml": '\U000000EB', "frac12": '\U000000BD', "frac14": '\U000000BC', diff --git a/Makefile b/Makefile index 3478b54333..3539c4c965 100644 --- a/Makefile +++ b/Makefile @@ -2,13 +2,13 @@ # with Go source code. If you know what GOPATH is then you probably # don't need to bother with make. -.PHONY: geth evm mist all test travis-test-with-coverage clean +.PHONY: gexp evm mist all test travis-test-with-coverage clean GOBIN = build/bin -geth: - build/env.sh go install -v $(shell build/ldflags.sh) ./cmd/geth +gexp: + build/env.sh go install -v $(shell build/ldflags.sh) ./cmd/gexp @echo "Done building." - @echo "Run \"$(GOBIN)/geth\" to launch geth." + @echo "Run \"$(GOBIN)/gexp\" to launch gexp." evm: build/env.sh $(GOROOT)/bin/go install -v $(shell build/ldflags.sh) ./cmd/evm diff --git a/README.md b/README.md index 717e726e34..842f8238ac 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,74 @@ -## Ethereum Go +## Expanse Go -Official golang implementation of the Ethereum protocol +Expanse Go Client, by Christopher Franko (forked from Jeffrey Wilcke (and some other people)'s Expanse Go client). | Linux | OSX | ARM | Windows | Tests ----------|---------|-----|-----|---------|------ -develop | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/Linux%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/OSX%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20develop%20branch)](https://build.ethdev.com/builders/ARM%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20develop%20branch)](https://build.ethdev.com/builders/Windows%20Go%20develop%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=develop)](https://travis-ci.org/ethereum/go-ethereum) [![codecov.io](http://codecov.io/github/ethereum/go-ethereum/coverage.svg?branch=develop)](http://codecov.io/github/ethereum/go-ethereum?branch=develop) -master | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](https://build.ethdev.com/builders/Linux%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=OSX%20Go%20master%20branch)](https://build.ethdev.com/builders/OSX%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20master%20branch)](https://build.ethdev.com/builders/ARM%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20master%20branch)](https://build.ethdev.com/builders/Windows%20Go%20master%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/ethereum/go-ethereum.svg?branch=master)](https://travis-ci.org/ethereum/go-ethereum) [![codecov.io](http://codecov.io/github/ethereum/go-ethereum/coverage.svg?branch=master)](http://codecov.io/github/ethereum/go-ethereum?branch=master) +develop | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/Linux%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20develop%20branch)](https://build.ethdev.com/builders/OSX%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20develop%20branch)](https://build.ethdev.com/builders/ARM%20Go%20develop%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20develop%20branch)](https://build.ethdev.com/builders/Windows%20Go%20develop%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/expanse/go-expanse.svg?branch=develop)](https://travis-ci.org/expanse/go-expanse) [![Coverage Status](https://coveralls.io/repos/expanse/go-expanse/badge.svg?branch=develop)](https://coveralls.io/r/expanse/go-expanse?branch=develop) +master | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Linux%20Go%20master%20branch)](https://build.ethdev.com/builders/Linux%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=OSX%20Go%20master%20branch)](https://build.ethdev.com/builders/OSX%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=ARM%20Go%20master%20branch)](https://build.ethdev.com/builders/ARM%20Go%20master%20branch/builds/-1) | [![Build+Status](https://build.ethdev.com/buildstatusimage?builder=Windows%20Go%20master%20branch)](https://build.ethdev.com/builders/Windows%20Go%20master%20branch/builds/-1) | [![Buildr+Status](https://travis-ci.org/expanse/go-expanse.svg?branch=master)](https://travis-ci.org/expanse/go-expanse) [![Coverage Status](https://coveralls.io/repos/expanse/go-expanse/badge.svg?branch=master)](https://coveralls.io/r/expanse/go-expanse?branch=master) -[![API Reference]( -https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/68747470733a2f2f676f646f632e6f72672f6769746875622e636f6d2f676f6c616e672f6764646f3f7374617475732e737667 -)](https://godoc.org/github.com/ethereum/go-ethereum) -[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/go-ethereum?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Bugs](https://badge.waffle.io/expanse/go-expanse.png?label=bug&title=Bugs)](https://waffle.io/expanse/go-expanse) +[![Stories in Ready](https://badge.waffle.io/expanse/go-expanse.png?label=ready&title=Ready)](https://waffle.io/expanse/go-expanse) +[![Stories in Progress](https://badge.waffle.io/expanse/go-expanse.svg?label=in%20progress&title=In Progress)](http://waffle.io/expanse/go-expanse) +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/expanse/go-expanse?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) ## Automated development builds -The following builds are build automatically by our build servers after each push to the [develop](https://github.com/ethereum/go-ethereum/tree/develop) branch. +The following builds are build automatically by our build servers after each push to the [develop](https://github.com/expanse-project/go-expanse/tree/develop) branch. -* [Docker](https://registry.hub.docker.com/u/ethereum/client-go/) +* [Docker](https://registry.hub.docker.com/u/expanse/client-go/) * [OS X](http://build.ethdev.com/builds/OSX%20Go%20develop%20branch/Mist-OSX-latest.dmg) * Ubuntu [trusty](https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-trusty/latest/) | [utopic](https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-utopic/latest/) * [Windows 64-bit](https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.zip) -* [ARM](https://build.ethdev.com/builds/ARM%20Go%20develop%20branch/geth-ARM-latest.tar.bz2) +* [ARM](https://build.ethdev.com/builds/ARM%20Go%20develop%20branch/gexp-ARM-latest.tar.bz2) ## Building the source For prerequisites and detailed build instructions please read the -[Installation Instructions](https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum) +[Installation Instructions](https://github.com/expanse-project/go-expanse/wiki/Building-Expanse) on the wiki. -Building geth requires two external dependencies, Go and GMP. +Building gexp requires two external dependencies, Go and GMP. You can install them using your favourite package manager. Once the dependencies are installed, run - make geth + make gexp ## Executables -Go Ethereum comes with several wrappers/executables found in -[the `cmd` directory](https://github.com/ethereum/go-ethereum/tree/develop/cmd): +Go Expanse comes with several wrappers/executables found in +[the `cmd` directory](https://github.com/expanse-project/go-expanse/tree/develop/cmd): - Command | | -----------|---------| -`geth` | Ethereum CLI (ethereum command line interface client) | -`bootnode` | runs a bootstrap node for the Discovery Protocol | -`ethtest` | test tool which runs with the [tests](https://github.com/ethereum/tests) suite: `/path/to/test.json > ethtest --test BlockTests --stdin`. -`evm` | is a generic Ethereum Virtual Machine: `evm -code 60ff60ff -gas 10000 -price 0 -dump`. See `-h` for a detailed description. | -`disasm` | disassembles EVM code: `echo "6001" | disasm` | -`rlpdump` | prints RLP structures | +* `gexp` Expanse CLI (expanse command line interface client) +* `bootnode` runs a bootstrap node for the Discovery Protocol +* `ethtest` test tool which runs with the [tests](https://github.com/expanse-project/tests) suite: + `/path/to/test.json > ethtest --test BlockTests --stdin`. +* `evm` is a generic Expanse Virtual Machine: `evm -code 60ff60ff -gas + 10000 -price 0 -dump`. See `-h` for a detailed description. +* `disasm` disassembles EVM code: `echo "6001" | disasm` +* `rlpdump` prints RLP structures ## Command line options -`geth` can be configured via command line options, environment variables and config files. +`gexp` can be configured via command line options, environment variables and config files. To get the options available: +<<<<<<< HEAD geth help -For further details on options, see the [wiki](https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options) +For further details on options, see the [wiki](https://github.com/expanse-project/go-expanse/wiki/Command-Line-Options) ## Contribution -If you'd like to contribute to go-ethereum please fork, fix, commit and +If you'd like to contribute to go-expanse please fork, fix, commit and send a pull request. Commits who do not comply with the coding standards are ignored (use gofmt!). If you send pull requests make absolute sure that you commit on the `develop` branch and that you do not merge to master. Commits that are directly based on master are simply ignored. -See [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide) +See [Developers' Guide](https://github.com/expanse-project/go-expanse/wiki/Developers'-Guide) for more details on configuring your environment, testing, and dependency management. diff --git a/accounts/abi/abi.go b/accounts/abi/abi.go index de3128902b..d50015707f 100644 --- a/accounts/abi/abi.go +++ b/accounts/abi/abi.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package abi @@ -22,7 +22,7 @@ import ( "io" "strings" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/crypto" ) // Callable method given a `Name` and whether the method is a constant. diff --git a/accounts/abi/abi_test.go b/accounts/abi/abi_test.go index 7706de05d9..42510dbaec 100644 --- a/accounts/abi/abi_test.go +++ b/accounts/abi/abi_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package abi @@ -23,7 +23,7 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/crypto" ) const jsondata = ` diff --git a/accounts/abi/doc.go b/accounts/abi/doc.go index 8242068582..419fb17403 100644 --- a/accounts/abi/doc.go +++ b/accounts/abi/doc.go @@ -1,23 +1,23 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package abi implements the Ethereum ABI (Application Binary +// Package abi implements the Expanse ABI (Application Binary // Interface). // -// The Ethereum ABI is strongly typed, known at compile time +// The Expanse ABI is strongly typed, known at compile time // and static. This ABI will handle basic type casting; unsigned // to signed and visa versa. It does not handle slice casting such // as unsigned slice to signed slice. Bit size type casting is also diff --git a/accounts/abi/numbers.go b/accounts/abi/numbers.go index 2a7049425a..da77e7b9bb 100644 --- a/accounts/abi/numbers.go +++ b/accounts/abi/numbers.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package abi @@ -20,7 +20,7 @@ import ( "math/big" "reflect" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) var big_t = reflect.TypeOf(&big.Int{}) diff --git a/accounts/abi/numbers_test.go b/accounts/abi/numbers_test.go index 78dc57543b..827f2abb37 100644 --- a/accounts/abi/numbers_test.go +++ b/accounts/abi/numbers_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package abi diff --git a/accounts/abi/type.go b/accounts/abi/type.go index b16822d3ba..fc3aa075cd 100644 --- a/accounts/abi/type.go +++ b/accounts/abi/type.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package abi @@ -22,7 +22,7 @@ import ( "regexp" "strconv" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) const ( diff --git a/accounts/account_manager.go b/accounts/account_manager.go index 2781be656f..bffe782ba6 100644 --- a/accounts/account_manager.go +++ b/accounts/account_manager.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package implements a private key management facility. // @@ -31,8 +31,8 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) var ( diff --git a/accounts/accounts_test.go b/accounts/accounts_test.go index d7a8a2b85f..f6df012fb6 100644 --- a/accounts/accounts_test.go +++ b/accounts/accounts_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package accounts @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/crypto" ) var testSigData = make([]byte, 32) @@ -142,7 +142,7 @@ func TestSignRace(t *testing.T) { } func tmpKeyStore(t *testing.T, new func(string) crypto.KeyStore) (string, crypto.KeyStore) { - d, err := ioutil.TempDir("", "eth-keystore-test") + d, err := ioutil.TempDir("", "exp-keystore-test") if err != nil { t.Fatal(err) } diff --git a/build/env.sh b/build/env.sh index 04401a3e17..1ba0936131 100755 --- a/build/env.sh +++ b/build/env.sh @@ -10,23 +10,23 @@ fi # Create fake Go workspace if it doesn't exist yet. workspace="$PWD/build/_workspace" root="$PWD" -ethdir="$workspace/src/github.com/ethereum" -if [ ! -L "$ethdir/go-ethereum" ]; then +ethdir="$workspace/src/github.com/expanse" +if [ ! -L "$ethdir/go-expanse" ]; then mkdir -p "$ethdir" cd "$ethdir" - ln -s ../../../../../. go-ethereum + ln -s ../../../../../. go-expanse cd "$root" fi # Set up the environment to use the workspace. # Also add Godeps workspace so we build using canned dependencies. -GOPATH="$ethdir/go-ethereum/Godeps/_workspace:$workspace" +GOPATH="$ethdir/go-expanse/Godeps/_workspace:$workspace" GOBIN="$PWD/build/bin" export GOPATH GOBIN # Run the command inside the workspace. -cd "$ethdir/go-ethereum" -PWD="$ethdir/go-ethereum" +cd "$ethdir/go-expanse" +PWD="$ethdir/go-expanse" # Launch the arguments with the configured environment. exec "$@" diff --git a/build/test-global-coverage.sh b/build/test-global-coverage.sh index a51b6a9e57..227cd1287d 100755 --- a/build/test-global-coverage.sh +++ b/build/test-global-coverage.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e +<<<<<<< HEAD echo "" > coverage.txt for d in $(find ./* -maxdepth 10 -type d -not -path "./build" -not -path "./Godeps/*" ); do diff --git a/build/update-license.go b/build/update-license.go index e28005cbd7..5c19d50be8 100644 --- a/build/update-license.go +++ b/build/update-license.go @@ -59,13 +59,13 @@ var ( licenseCommentRE = regexp.MustCompile(`^//\s*(Copyright|This file is part of).*?\n(?://.*?\n)*\n*`) // this text appears at the start of AUTHORS - authorsFileHeader = "# This is the official list of go-ethereum authors for copyright purposes.\n\n" + authorsFileHeader = "# This is the official list of go-expanse authors for copyright purposes.\n\n" ) // this template generates the license comment. // its input is an info structure. var licenseT = template.Must(template.New("").Parse(` -// Copyright {{.Year}} The go-ethereum Authors +// Copyright {{.Year}} The go-expanse Authors // This file is part of {{.Whole false}}. // // {{.Whole true}} is free software: you can redistribute it and/or modify @@ -104,12 +104,12 @@ func (i info) ShortLicense() string { func (i info) Whole(startOfSentence bool) string { if i.gpl() { - return "go-ethereum" + return "go-expanse" } if startOfSentence { - return "The go-ethereum library" + return "The go-expanse library" } - return "the go-ethereum library" + return "the go-expanse library" } func (i info) gpl() bool { diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go index 0cad5321b9..d8989b2385 100644 --- a/cmd/bootnode/main.go +++ b/cmd/bootnode/main.go @@ -1,20 +1,20 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . -// bootnode runs a bootstrap node for the Ethereum Discovery Protocol. +// bootnode runs a bootstrap node for the Expanse Discovery Protocol. package main import ( @@ -26,10 +26,10 @@ import ( "log" "os" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/p2p/nat" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/p2p/discover" + "github.com/expanse-project/go-expanse/p2p/nat" ) func main() { diff --git a/cmd/disasm/main.go b/cmd/disasm/main.go index ba1295ba1f..223747f049 100644 --- a/cmd/disasm/main.go +++ b/cmd/disasm/main.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . // disasm is a pretty-printer for EVM bytecode. package main @@ -22,8 +22,8 @@ import ( "io/ioutil" "os" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/vm" ) func main() { diff --git a/cmd/ethtest/.gitignore b/cmd/ethtest/.gitignore index 399b6dc882..6eeba6f0f0 100644 --- a/cmd/ethtest/.gitignore +++ b/cmd/ethtest/.gitignore @@ -10,7 +10,7 @@ *un~ .DS_Store */**/.DS_Store -ethereum/ethereum +expanse/expanse ethereal/ethereal example/js node_modules diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go index 67b9653960..41edb08dbe 100644 --- a/cmd/ethtest/main.go +++ b/cmd/ethtest/main.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2014 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . -// ethtest executes Ethereum JSON tests. +// ethtest executes Expanse JSON tests. package main import ( @@ -205,10 +205,10 @@ func main() { app := cli.NewApp() app.Name = "ethtest" - app.Usage = "go-ethereum test interface" + app.Usage = "go-expanse test interface" app.Action = setupApp app.Version = "0.2.0" - app.Author = "go-ethereum team" + app.Author = "go-expanse team" app.Flags = []cli.Flag{ TestFlag, diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 243dd62669..6c23e785bd 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2014 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . // evm executes EVM code snippets. package main diff --git a/cmd/geth/blocktestcmd.go b/cmd/geth/blocktestcmd.go index 4eff82e3d1..58d3c60e0c 100644 --- a/cmd/geth/blocktestcmd.go +++ b/cmd/geth/blocktestcmd.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package main @@ -21,11 +21,11 @@ import ( "os" "github.com/codegangsta/cli" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/tests" + "github.com/expanse-project/go-expanse/cmd/utils" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/tests" ) var blocktestCommand = cli.Command{ @@ -57,7 +57,7 @@ func runBlockTest(ctx *cli.Context) { file, testname = args[0], args[1] rpc = true default: - utils.Fatalf(`Usage: ethereum blocktest [ [ "rpc" ] ]`) + utils.Fatalf(`Usage: expanse blocktest [ [ "rpc" ] ]`) } bt, err := tests.LoadBlockTests(file) if err != nil { @@ -69,15 +69,15 @@ func runBlockTest(ctx *cli.Context) { ecode := 0 for name, test := range bt { fmt.Printf("----------------- Running Block Test %q\n", name) - ethereum, err := runOneBlockTest(ctx, test) + expanse, err := runOneBlockTest(ctx, test) if err != nil { fmt.Println(err) fmt.Println("FAIL") ecode = 1 } - if ethereum != nil { - ethereum.Stop() - ethereum.WaitForShutdown() + if expanse != nil { + expanse.Stop() + expanse.WaitForShutdown() } } os.Exit(ecode) @@ -88,49 +88,49 @@ func runBlockTest(ctx *cli.Context) { if !ok { utils.Fatalf("Test file does not contain test named %q", testname) } - ethereum, err := runOneBlockTest(ctx, test) + expanse, err := runOneBlockTest(ctx, test) if err != nil { utils.Fatalf("%v", err) } - defer ethereum.Stop() + defer expanse.Stop() if rpc { fmt.Println("Block Test post state validated, starting RPC interface.") - startEth(ctx, ethereum) - utils.StartRPC(ethereum, ctx) - ethereum.WaitForShutdown() + startEth(ctx, expanse) + utils.StartRPC(expanse, ctx) + expanse.WaitForShutdown() } } -func runOneBlockTest(ctx *cli.Context, test *tests.BlockTest) (*eth.Ethereum, error) { +func runOneBlockTest(ctx *cli.Context, test *tests.BlockTest) (*exp.Expanse, error) { cfg := utils.MakeEthConfig(ClientIdentifier, Version, ctx) cfg.NewDB = func(path string) (common.Database, error) { return ethdb.NewMemDatabase() } cfg.MaxPeers = 0 // disable network cfg.Shh = false // disable whisper cfg.NAT = nil // disable port mapping - ethereum, err := eth.New(cfg) + expanse, err := exp.New(cfg) if err != nil { return nil, err } - // if err := ethereum.Start(); err != nil { + // if err := expanse.Start(); err != nil { // return nil, err // } // import the genesis block - ethereum.ResetWithGenesisBlock(test.Genesis) + expanse.ResetWithGenesisBlock(test.Genesis) // import pre accounts - statedb, err := test.InsertPreState(ethereum) + statedb, err := test.InsertPreState(expanse) if err != nil { - return ethereum, fmt.Errorf("InsertPreState: %v", err) + return expanse, fmt.Errorf("InsertPreState: %v", err) } - if err := test.TryBlocksInsert(ethereum.ChainManager()); err != nil { - return ethereum, fmt.Errorf("Block Test load error: %v", err) + if err := test.TryBlocksInsert(expanse.ChainManager()); err != nil { + return expanse, fmt.Errorf("Block Test load error: %v", err) } if err := test.ValidatePostState(statedb); err != nil { - return ethereum, fmt.Errorf("post state validation failed: %v", err) + return expanse, fmt.Errorf("post state validation failed: %v", err) } - return ethereum, nil + return expanse, nil } diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index c420459189..3ba3a5f663 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package main @@ -24,12 +24,12 @@ import ( "time" "github.com/codegangsta/cli" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/cmd/utils" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger/glog" ) var ( @@ -65,7 +65,7 @@ if already existing. Usage: `dump a specific block from storage`, Description: ` The arguments are interpreted as block numbers or hashes. -Use "ethereum dump 0" to dump the genesis block. +Use "expanse dump 0" to dump the genesis block. `, } ) diff --git a/cmd/geth/js.go b/cmd/geth/js.go index c31deefdd9..860cd36faa 100644 --- a/cmd/geth/js.go +++ b/cmd/geth/js.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2014 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package main @@ -28,19 +28,19 @@ import ( "sort" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/docserver" - "github.com/ethereum/go-ethereum/common/natspec" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/eth" - re "github.com/ethereum/go-ethereum/jsre" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/rpc/api" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/comms" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/cmd/utils" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/common/docserver" + "github.com/expanse-project/go-expanse/common/natspec" + "github.com/expanse-project/go-expanse/common/registrar" + "github.com/expanse-project/go-expanse/exp" + re "github.com/expanse-project/go-expanse/jsre" + "github.com/expanse-project/go-expanse/rpc" + "github.com/expanse-project/go-expanse/rpc/api" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/comms" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" "github.com/peterh/liner" "github.com/robertkrimen/otto" ) @@ -76,13 +76,13 @@ func (r dumbterm) AppendHistory(string) {} type jsre struct { ds *docserver.DocServer re *re.JSRE - ethereum *eth.Ethereum + expanse *exp.Expanse xeth *xeth.XEth wait chan *big.Int ps1 string atexit func() corsDomain string - client comms.EthereumClient + client comms.ExpanseClient prompter } @@ -176,19 +176,19 @@ func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive return js } -func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, client comms.EthereumClient, interactive bool, f xeth.Frontend) *jsre { - js := &jsre{ethereum: ethereum, ps1: "> "} +func newJSRE(expanse *exp.Expanse, libPath, corsDomain string, client comms.ExpanseClient, interactive bool, f xeth.Frontend) *jsre { + js := &jsre{expanse: expanse, ps1: "> "} // set default cors domain used by startRpc from CLI flag js.corsDomain = corsDomain if f == nil { f = js } js.ds = docserver.New("/") - js.xeth = xeth.New(ethereum, f) + js.xeth = xeth.New(expanse, f) js.wait = js.xeth.UpdateState() js.client = client if clt, ok := js.client.(*comms.InProcClient); ok { - if offeredApis, err := api.ParseApiString(shared.AllApis, codec.JSON, js.xeth, ethereum); err == nil { + if offeredApis, err := api.ParseApiString(shared.AllApis, codec.JSON, js.xeth, expanse); err == nil { clt.Initialize(api.Merge(offeredApis...)) } } @@ -241,7 +241,7 @@ func (self *jsre) batch(statement string) { self.re.Stop(false) } -// show summary of current geth instance +// show summary of current gexp instance func (self *jsre) welcome() { self.re.Run(` (function () { @@ -277,7 +277,7 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { apiNames = append(apiNames, a) } - apiImpl, err := api.ParseApiString(strings.Join(apiNames, ","), codec.JSON, js.xeth, js.ethereum) + apiImpl, err := api.ParseApiString(strings.Join(apiNames, ","), codec.JSON, js.xeth, js.expanse) if err != nil { utils.Fatalf("Unable to determine supported api's: %v", err) } @@ -295,7 +295,7 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { utils.Fatalf("Error loading bignumber.js: %v", err) } - err = js.re.Compile("ethereum.js", re.Web3_JS) + err = js.re.Compile("expanse.js", re.Web3_JS) if err != nil { utils.Fatalf("Error loading web3.js: %v", err) } @@ -311,7 +311,7 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { } // load only supported API's in javascript runtime - shortcuts := "var eth = web3.eth; " + shortcuts := "var exp = web3.exp; " for _, apiName := range apiNames { if apiName == shared.Web3ApiName { continue // manually mapped @@ -335,7 +335,7 @@ func (js *jsre) apiBindings(f xeth.Frontend) error { } func (self *jsre) ConfirmTransaction(tx string) bool { - if self.ethereum.NatSpec { + if self.expanse.NatSpec { notice := natspec.GetNotice(self.xeth, tx, self.ds) fmt.Println(notice) answer, _ := self.Prompt("Confirm Transaction [y/n]") @@ -352,7 +352,7 @@ func (self *jsre) UnlockAccount(addr []byte) bool { return false } // TODO: allow retry - if err := self.ethereum.AccountManager().Unlock(common.BytesToAddress(addr), pass); err != nil { + if err := self.expanse.AccountManager().Unlock(common.BytesToAddress(addr), pass); err != nil { return false } else { fmt.Println("Account is now unlocked for this session.") @@ -435,8 +435,8 @@ func hidepassword(input string) string { func (self *jsre) withHistory(op func(*os.File)) { datadir := common.DefaultDataDir() - if self.ethereum != nil { - datadir = self.ethereum.DataDir + if self.expanse != nil { + datadir = self.expanse.DataDir } hist, err := os.OpenFile(filepath.Join(datadir, "history"), os.O_RDWR|os.O_CREATE, os.ModePerm) diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go index 67c36dfe71..5772a0beac 100644 --- a/cmd/geth/js_test.go +++ b/cmd/geth/js_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package main @@ -28,18 +28,18 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/compiler" - "github.com/ethereum/go-ethereum/common/docserver" - "github.com/ethereum/go-ethereum/common/natspec" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/comms" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/common/compiler" + "github.com/expanse-project/go-expanse/common/docserver" + "github.com/expanse-project/go-expanse/common/natspec" + "github.com/expanse-project/go-expanse/common/registrar" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/comms" ) const ( @@ -66,7 +66,7 @@ type testjethre struct { } func (self *testjethre) UnlockAccount(acc []byte) bool { - err := self.ethereum.AccountManager().Unlock(common.BytesToAddress(acc), "") + err := self.expanse.AccountManager().Unlock(common.BytesToAddress(acc), "") if err != nil { panic("unable to unlock") } @@ -74,18 +74,18 @@ func (self *testjethre) UnlockAccount(acc []byte) bool { } func (self *testjethre) ConfirmTransaction(tx string) bool { - if self.ethereum.NatSpec { + if self.expanse.NatSpec { self.lastConfirm = natspec.GetNotice(self.xeth, tx, self.ds) } return true } -func testJEthRE(t *testing.T) (string, *testjethre, *eth.Ethereum) { +func testJEthRE(t *testing.T) (string, *testjethre, *exp.Expanse) { return testREPL(t, nil) } -func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *eth.Ethereum) { - tmp, err := ioutil.TempDir("", "geth-test") +func testREPL(t *testing.T, config func(*exp.Config)) (string, *testjethre, *exp.Expanse) { + tmp, err := ioutil.TempDir("", "gexp-test") if err != nil { t.Fatal(err) } @@ -95,7 +95,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *eth core.WriteGenesisBlockForTesting(db, common.HexToAddress(testAddress), common.String2Big(testBalance)) ks := crypto.NewKeyStorePlain(filepath.Join(tmp, "keystore")) am := accounts.NewManager(ks) - conf := ð.Config{ + conf := &exp.Config{ NodeKey: testNodeKey, DataDir: tmp, AccountManager: am, @@ -108,7 +108,7 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *eth if config != nil { config(conf) } - ethereum, err := eth.New(conf) + expanse, err := exp.New(conf) if err != nil { t.Fatal("%v", err) } @@ -128,22 +128,22 @@ func testREPL(t *testing.T, config func(*eth.Config)) (string, *testjethre, *eth t.Fatal(err) } - assetPath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist", "assets", "ext") + assetPath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "expanse", "go-expanse", "cmd", "mist", "assets", "ext") client := comms.NewInProcClient(codec.JSON) ds := docserver.New("/") tf := &testjethre{ds: ds} - repl := newJSRE(ethereum, assetPath, "", client, false, tf) + repl := newJSRE(expanse, assetPath, "", client, false, tf) tf.jsre = repl - return tmp, tf, ethereum + return tmp, tf, expanse } func TestNodeInfo(t *testing.T) { t.Skip("broken after p2p update") - tmp, repl, ethereum := testJEthRE(t) - if err := ethereum.Start(); err != nil { - t.Fatalf("error starting ethereum: %v", err) + tmp, repl, expanse := testJEthRE(t) + if err := expanse.Start(); err != nil { + t.Fatalf("error starting expanse: %v", err) } - defer ethereum.Stop() + defer expanse.Stop() defer os.RemoveAll(tmp) want := `{"DiscPort":0,"IP":"0.0.0.0","ListenAddr":"","Name":"test","NodeID":"4cb2fc32924e94277bf94b5e4c983beedb2eabd5a0bc941db32202735c6625d020ca14a5963d1738af43b6ac0a711d61b1a06de931a499fe2aa0b1a132a902b5","NodeUrl":"enode://4cb2fc32924e94277bf94b5e4c983beedb2eabd5a0bc941db32202735c6625d020ca14a5963d1738af43b6ac0a711d61b1a06de931a499fe2aa0b1a132a902b5@0.0.0.0:0","TCPPort":0,"Td":"131072"}` @@ -151,15 +151,15 @@ func TestNodeInfo(t *testing.T) { } func TestAccounts(t *testing.T) { - tmp, repl, ethereum := testJEthRE(t) - if err := ethereum.Start(); err != nil { - t.Fatalf("error starting ethereum: %v", err) + tmp, repl, expanse := testJEthRE(t) + if err := expanse.Start(); err != nil { + t.Fatalf("error starting expanse: %v", err) } - defer ethereum.Stop() + defer expanse.Stop() defer os.RemoveAll(tmp) - checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`"]`) - checkEvalJSON(t, repl, `eth.coinbase`, `"`+testAddress+`"`) + checkEvalJSON(t, repl, `exp.accounts`, `["`+testAddress+`"]`) + checkEvalJSON(t, repl, `exp.coinbase`, `"`+testAddress+`"`) val, err := repl.re.Run(`personal.newAccount("password")`) if err != nil { t.Errorf("expected no error, got %v", err) @@ -169,26 +169,26 @@ func TestAccounts(t *testing.T) { t.Errorf("address not hex: %q", addr) } - checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`","`+addr+`"]`) + checkEvalJSON(t, repl, `exp.accounts`, `["`+testAddress+`","`+addr+`"]`) } func TestBlockChain(t *testing.T) { - tmp, repl, ethereum := testJEthRE(t) - if err := ethereum.Start(); err != nil { - t.Fatalf("error starting ethereum: %v", err) + tmp, repl, expanse := testJEthRE(t) + if err := expanse.Start(); err != nil { + t.Fatalf("error starting expanse: %v", err) } - defer ethereum.Stop() + defer expanse.Stop() defer os.RemoveAll(tmp) // get current block dump before export/import. - val, err := repl.re.Run("JSON.stringify(debug.dumpBlock(eth.blockNumber))") + val, err := repl.re.Run("JSON.stringify(debug.dumpBlock(exp.blockNumber))") if err != nil { t.Errorf("expected no error, got %v", err) } beforeExport := val.String() // do the export - extmp, err := ioutil.TempDir("", "geth-test-export") + extmp, err := ioutil.TempDir("", "gexp-test-export") if err != nil { t.Fatal(err) } @@ -196,7 +196,7 @@ func TestBlockChain(t *testing.T) { tmpfile := filepath.Join(extmp, "export.chain") tmpfileq := strconv.Quote(tmpfile) - ethereum.ChainManager().Reset() + expanse.ChainManager().Reset() checkEvalJSON(t, repl, `admin.exportChain(`+tmpfileq+`)`, `true`) if _, err := os.Stat(tmpfile); err != nil { @@ -205,57 +205,57 @@ func TestBlockChain(t *testing.T) { // check import, verify that dumpBlock gives the same result. checkEvalJSON(t, repl, `admin.importChain(`+tmpfileq+`)`, `true`) - checkEvalJSON(t, repl, `debug.dumpBlock(eth.blockNumber)`, beforeExport) + checkEvalJSON(t, repl, `debug.dumpBlock(exp.blockNumber)`, beforeExport) } func TestMining(t *testing.T) { - tmp, repl, ethereum := testJEthRE(t) - if err := ethereum.Start(); err != nil { - t.Fatalf("error starting ethereum: %v", err) + tmp, repl, expanse := testJEthRE(t) + if err := expanse.Start(); err != nil { + t.Fatalf("error starting expanse: %v", err) } - defer ethereum.Stop() + defer expanse.Stop() defer os.RemoveAll(tmp) - checkEvalJSON(t, repl, `eth.mining`, `false`) + checkEvalJSON(t, repl, `exp.mining`, `false`) } func TestRPC(t *testing.T) { - tmp, repl, ethereum := testJEthRE(t) - if err := ethereum.Start(); err != nil { - t.Errorf("error starting ethereum: %v", err) + tmp, repl, expanse := testJEthRE(t) + if err := expanse.Start(); err != nil { + t.Errorf("error starting expanse: %v", err) return } - defer ethereum.Stop() + defer expanse.Stop() defer os.RemoveAll(tmp) - checkEvalJSON(t, repl, `admin.startRPC("127.0.0.1", 5004, "*", "web3,eth,net")`, `true`) + checkEvalJSON(t, repl, `admin.startRPC("127.0.0.1", 5004, "*", "web3,exp,net")`, `true`) } func TestCheckTestAccountBalance(t *testing.T) { t.Skip() // i don't think it tests the correct behaviour here. it's actually testing // internals which shouldn't be tested. This now fails because of a change in the core // and i have no means to fix this, sorry - @obscuren - tmp, repl, ethereum := testJEthRE(t) - if err := ethereum.Start(); err != nil { - t.Errorf("error starting ethereum: %v", err) + tmp, repl, expanse := testJEthRE(t) + if err := expanse.Start(); err != nil { + t.Errorf("error starting expanse: %v", err) return } - defer ethereum.Stop() + defer expanse.Stop() defer os.RemoveAll(tmp) repl.re.Run(`primary = "` + testAddress + `"`) - checkEvalJSON(t, repl, `eth.getBalance(primary)`, `"`+testBalance+`"`) + checkEvalJSON(t, repl, `exp.getBalance(primary)`, `"`+testBalance+`"`) } func TestSignature(t *testing.T) { - tmp, repl, ethereum := testJEthRE(t) - if err := ethereum.Start(); err != nil { - t.Errorf("error starting ethereum: %v", err) + tmp, repl, expanse := testJEthRE(t) + if err := expanse.Start(); err != nil { + t.Errorf("error starting expanse: %v", err) return } - defer ethereum.Stop() + defer expanse.Stop() defer os.RemoveAll(tmp) - val, err := repl.re.Run(`eth.sign("` + testAddress + `", "` + testHash + `")`) + val, err := repl.re.Run(`exp.sign("` + testAddress + `", "` + testHash + `")`) // This is a very preliminary test, lacking actual signature verification if err != nil { @@ -275,15 +275,15 @@ func TestSignature(t *testing.T) { func TestContract(t *testing.T) { t.Skip("contract testing is implemented with mining in ethash test mode. This takes about 7seconds to run. Unskip and run on demand") coinbase := common.HexToAddress(testAddress) - tmp, repl, ethereum := testREPL(t, func(conf *eth.Config) { + tmp, repl, expanse := testREPL(t, func(conf *exp.Config) { conf.Etherbase = coinbase conf.PowTest = true }) - if err := ethereum.Start(); err != nil { - t.Errorf("error starting ethereum: %v", err) + if err := expanse.Start(); err != nil { + t.Errorf("error starting expanse: %v", err) return } - defer ethereum.Stop() + defer expanse.Stop() defer os.RemoveAll(tmp) reg := registrar.New(repl.xeth) @@ -321,7 +321,7 @@ func TestContract(t *testing.T) { if err != nil { t.Fatalf("%v", err) } - if checkEvalJSON(t, repl, `primary = eth.accounts[0]`, `"`+testAddress+`"`) != nil { + if checkEvalJSON(t, repl, `primary = exp.accounts[0]`, `"`+testAddress+`"`) != nil { return } if checkEvalJSON(t, repl, `source = "`+source+`"`, `"`+source+`"`) != nil { @@ -346,7 +346,7 @@ func TestContract(t *testing.T) { t.Errorf("%v", err) } } else { - if checkEvalJSON(t, repl, `contract = eth.compile.solidity(source).test`, string(contractInfo)) != nil { + if checkEvalJSON(t, repl, `contract = exp.compile.solidity(source).test`, string(contractInfo)) != nil { return } } @@ -357,7 +357,7 @@ func TestContract(t *testing.T) { if checkEvalJSON( t, repl, - `contractaddress = eth.sendTransaction({from: primary, data: contract.code})`, + `contractaddress = exp.sendTransaction({from: primary, data: contract.code})`, `"0x46d69d55c3c4b86a924a92c9fc4720bb7bce1d74"`, ) != nil { return @@ -368,7 +368,7 @@ func TestContract(t *testing.T) { } callSetup := `abiDef = JSON.parse('[{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"multiply","outputs":[{"name":"d","type":"uint256"}],"type":"function"}]'); -Multiply7 = eth.contract(abiDef); +Multiply7 = exp.contract(abiDef); multiply7 = Multiply7.at(contractaddress); ` _, err = repl.re.Run(callSetup) @@ -443,7 +443,7 @@ multiply7 = Multiply7.at(contractaddress); } func pendingTransactions(repl *testjethre, t *testing.T) (txc int64, err error) { - txs := repl.ethereum.TxPool().GetTransactions() + txs := repl.expanse.TxPool().GetTransactions() return int64(len(txs)), nil } @@ -469,12 +469,12 @@ func processTxs(repl *testjethre, t *testing.T, expTxc int) bool { return false } - err = repl.ethereum.StartMining(runtime.NumCPU()) + err = repl.expanse.StartMining(runtime.NumCPU()) if err != nil { t.Errorf("unexpected error mining: %v", err) return false } - defer repl.ethereum.StopMining() + defer repl.expanse.StopMining() timer := time.NewTimer(100 * time.Second) height := new(big.Int).Add(repl.xeth.CurrentBlock().Number(), big.NewInt(1)) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index ff556c984e..c2f7ad9486 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2014 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . -// geth is the official command-line client for Ethereum. +// gexp is the official command-line client for Expanse. package main import ( @@ -29,21 +29,22 @@ import ( "time" "github.com/codegangsta/cli" - "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/comms" + "github.com/expanse-project/ethash" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/cmd/utils" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/fdtrack" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/metrics" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/comms" + "github.com/mattn/go-colorable" + "github.com/mattn/go-isatty" ) const ( @@ -67,7 +68,7 @@ func init() { nodeNameVersion = Version + "-" + gitCommit[:8] } - app = utils.NewApp(Version, "the go-ethereum command line interface") + app = utils.NewApp(Version, "the go-expanse command line interface") app.Action = run app.HideVersion = true // we have a command to print the version app.Commands = []cli.Command{ @@ -104,7 +105,7 @@ Regular users do not need to execute it. { Action: version, Name: "version", - Usage: "print ethereum version numbers", + Usage: "print expanse version numbers", Description: ` The output of this command is supposed to be machine-readable. `, @@ -112,12 +113,12 @@ The output of this command is supposed to be machine-readable. { Name: "wallet", - Usage: "ethereum presale wallet", + Usage: "expanse presale wallet", Subcommands: []cli.Command{ { Action: importWallet, Name: "import", - Usage: "import ethereum presale wallet", + Usage: "import expanse presale wallet", }, }, Description: ` @@ -152,7 +153,7 @@ Note that exporting your key in unencrypted format is NOT supported. Keys are stored under /keys. It is safe to transfer the entire directory or the individual keys therein -between ethereum nodes by simply copying. +between expanse nodes by simply copying. Make sure you backup your keys regularly. In order to use your account to send transactions, you need to unlock them using the @@ -172,7 +173,7 @@ And finally. DO NOT FORGET YOUR PASSWORD. Usage: "create a new account", Description: ` - ethereum account new + expanse account new Creates a new account. Prints the address. @@ -182,7 +183,7 @@ You must remember this passphrase to unlock your account in the future. For non-interactive use the passphrase can be specified with the --password flag: - ethereum --password account new + expanse --password account new Note, this is meant to be used for testing only, it is a bad idea to save your password to file or expose in any other way. @@ -194,7 +195,7 @@ password to file or expose in any other way. Usage: "update an existing account", Description: ` - ethereum account update
+ expanse account update
Update an existing account. @@ -206,7 +207,7 @@ format to the newest format or change the password for an account. For non-interactive use the passphrase can be specified with the --password flag: - ethereum --password account new + expanse --password account new Since only one password can be given, only format update can be performed, changing your password is only possible interactively. @@ -221,7 +222,7 @@ changes. Usage: "import a private key into a new account", Description: ` - ethereum account import + expanse account import Imports an unencrypted private key from and creates a new account. Prints the address. @@ -234,10 +235,10 @@ You must remember this passphrase to unlock your account in the future. For non-interactive use the passphrase can be specified with the -password flag: - ethereum --password account import + expanse --password account import Note: -As you can directly copy your encrypted accounts to another ethereum instance, +As you can directly copy your encrypted accounts to another expanse instance, this import mechanism is not needed when you transfer an account between nodes. `, @@ -251,7 +252,7 @@ nodes. Description: ` The Geth console is an interactive shell for the JavaScript runtime environment which exposes a node admin interface as well as the Ðapp JavaScript API. -See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console +See https://github.com/expanse-project/go-expanse/wiki/Javascipt-Console `}, { Action: attach, @@ -260,8 +261,8 @@ See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console Description: ` The Geth console is an interactive shell for the JavaScript runtime environment which exposes a node admin interface as well as the Ðapp JavaScript API. -See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console. -This command allows to open a console on a running geth node. +See https://github.com/expanse-project/go-expanse/wiki/Javascipt-Console. +This command allows to open a console on a running gexp node. `, }, { @@ -270,7 +271,7 @@ This command allows to open a console on a running geth node. Usage: `executes the given JavaScript files in the Geth JavaScript VM`, Description: ` The JavaScript VM exposes a node admin interface as well as the Ðapp -JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/Javascipt-Console +JavaScript API. See https://github.com/expanse-project/go-expanse/wiki/Javascipt-Console `, }, } @@ -386,15 +387,27 @@ func run(ctx *cli.Context) { utils.Fatalf("%v", err) } - startEth(ctx, ethereum) + startEth(ctx, expanse) // this blocks the thread - ethereum.WaitForShutdown() + expanse.WaitForShutdown() } func attach(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) +<<<<<<< HEAD var client comms.EthereumClient +======= + // Wrap the standard output with a colorified stream (windows) + if isatty.IsTerminal(os.Stdout.Fd()) { + if pr, pw, err := os.Pipe(); err == nil { + go io.Copy(colorable.NewColorableStdout(), pr) + os.Stdout = pw + } + } + + var client comms.ExpanseClient +>>>>>>> test change lol var err error if ctx.Args().Present() { client, err = comms.ClientFromEndpoint(ctx.Args().First(), codec.JSON) @@ -406,7 +419,7 @@ func attach(ctx *cli.Context) { } if err != nil { - utils.Fatalf("Unable to attach to geth node - %v", err) + utils.Fatalf("Unable to attach to gexp node - %v", err) } repl := newLightweightJSRE( @@ -427,16 +440,16 @@ func console(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx) - ethereum, err := eth.New(cfg) + expanse, err := exp.New(cfg) if err != nil { utils.Fatalf("%v", err) } client := comms.NewInProcClient(codec.JSON) - startEth(ctx, ethereum) + startEth(ctx, expanse) repl := newJSRE( - ethereum, + expanse, ctx.GlobalString(utils.JSpathFlag.Name), ctx.GlobalString(utils.RPCCORSDomainFlag.Name), client, @@ -451,23 +464,23 @@ func console(ctx *cli.Context) { repl.interactive() } - ethereum.Stop() - ethereum.WaitForShutdown() + expanse.Stop() + expanse.WaitForShutdown() } func execJSFiles(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx) - ethereum, err := eth.New(cfg) + expanse, err := exp.New(cfg) if err != nil { utils.Fatalf("%v", err) } client := comms.NewInProcClient(codec.JSON) - startEth(ctx, ethereum) + startEth(ctx, expanse) repl := newJSRE( - ethereum, + expanse, ctx.GlobalString(utils.JSpathFlag.Name), ctx.GlobalString(utils.RPCCORSDomainFlag.Name), client, @@ -478,8 +491,8 @@ func execJSFiles(ctx *cli.Context) { repl.exec(file) } - ethereum.Stop() - ethereum.WaitForShutdown() + expanse.Stop() + expanse.WaitForShutdown() } func unlockAccount(ctx *cli.Context, am *accounts.Manager, addr string, i int) (addrHex, auth string) { @@ -541,11 +554,18 @@ func blockRecovery(ctx *cli.Context) { glog.Infof("Recovery succesful. New HEAD %x\n", block.Hash()) } -func startEth(ctx *cli.Context, eth *eth.Ethereum) { - // Start Ethereum itself - utils.StartEthereum(eth) +func startEth(ctx *cli.Context, exp *exp.Expanse) { + // Start Expanse itself + utils.StartExpanse(exp) +<<<<<<< HEAD am := eth.AccountManager() +======= + // Start logging file descriptor stats. + fdtrack.Start() + + am := exp.AccountManager() +>>>>>>> test change lol account := ctx.GlobalString(utils.UnlockedAccountFlag.Name) accounts := strings.Split(account, " ") for i, account := range accounts { @@ -558,17 +578,17 @@ func startEth(ctx *cli.Context, eth *eth.Ethereum) { } // Start auxiliary services if enabled. if !ctx.GlobalBool(utils.IPCDisabledFlag.Name) { - if err := utils.StartIPC(eth, ctx); err != nil { + if err := utils.StartIPC(exp, ctx); err != nil { utils.Fatalf("Error string IPC: %v", err) } } if ctx.GlobalBool(utils.RPCEnabledFlag.Name) { - if err := utils.StartRPC(eth, ctx); err != nil { + if err := utils.StartRPC(exp, ctx); err != nil { utils.Fatalf("Error starting RPC: %v", err) } } if ctx.GlobalBool(utils.MiningEnabledFlag.Name) { - if err := eth.StartMining(ctx.GlobalInt(utils.MinerThreadsFlag.Name)); err != nil { + if err := exp.StartMining(ctx.GlobalInt(utils.MinerThreadsFlag.Name)); err != nil { utils.Fatalf("%v", err) } } @@ -696,7 +716,7 @@ func makedag(ctx *cli.Context) { args := ctx.Args() wrongArgs := func() { - utils.Fatalf(`Usage: geth makedag `) + utils.Fatalf(`Usage: gexp makedag `) } switch { case len(args) == 2: @@ -728,7 +748,7 @@ func version(c *cli.Context) { if gitCommit != "" { fmt.Println("Git Commit:", gitCommit) } - fmt.Println("Protocol Versions:", eth.ProtocolVersions) + fmt.Println("Protocol Versions:", exp.ProtocolVersions) fmt.Println("Network Id:", c.GlobalInt(utils.NetworkIdFlag.Name)) fmt.Println("Go Version:", runtime.Version()) fmt.Println("OS:", runtime.GOOS) diff --git a/cmd/geth/monitorcmd.go b/cmd/geth/monitorcmd.go index a7c099532c..4634ce5184 100644 --- a/cmd/geth/monitorcmd.go +++ b/cmd/geth/monitorcmd.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package main @@ -26,11 +26,11 @@ import ( "time" "github.com/codegangsta/cli" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/comms" + "github.com/expanse-project/go-expanse/cmd/utils" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/rpc" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/comms" "github.com/gizak/termui" ) @@ -70,13 +70,13 @@ to display multiple metrics simultaneously. // monitor starts a terminal UI based monitoring tool for the requested metrics. func monitor(ctx *cli.Context) { var ( - client comms.EthereumClient + client comms.ExpanseClient err error ) - // Attach to an Ethereum node over IPC or RPC + // Attach to an Expanse node over IPC or RPC endpoint := ctx.String(monitorCommandAttachFlag.Name) if client, err = comms.ClientFromEndpoint(endpoint, codec.JSON); err != nil { - utils.Fatalf("Unable to attach to geth node: %v", err) + utils.Fatalf("Unable to attach to gexp node: %v", err) } defer client.Close() @@ -95,7 +95,7 @@ func monitor(ctx *cli.Context) { if len(list) > 0 { utils.Fatalf("No metrics specified.\n\nAvailable:\n - %s", strings.Join(list, "\n - ")) } else { - utils.Fatalf("No metrics collected by geth (--%s).\n", utils.MetricsEnabledFlag.Name) + utils.Fatalf("No metrics collected by gexp (--%s).\n", utils.MetricsEnabledFlag.Name) } } sort.Strings(monitored) @@ -162,7 +162,7 @@ func monitor(ctx *cli.Context) { } } -// retrieveMetrics contacts the attached geth node and retrieves the entire set +// retrieveMetrics contacts the attached gexp node and retrieves the entire set // of collected system metrics. func retrieveMetrics(xeth *rpc.Xeth) (map[string]interface{}, error) { return xeth.Call("debug_metrics", []interface{}{true}) diff --git a/cmd/rlpdump/main.go b/cmd/rlpdump/main.go index 10eea1fde0..e2dd152be7 100644 --- a/cmd/rlpdump/main.go +++ b/cmd/rlpdump/main.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . // rlpdump is a pretty-printer for RLP data. package main @@ -26,7 +26,7 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/rlp" ) var ( diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go index 983762db8f..a03a50d629 100644 --- a/cmd/utils/cmd.go +++ b/cmd/utils/cmd.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2014 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . -// Package utils contains internal helper functions for go-ethereum commands. +// Package utils contains internal helper functions for go-expanse commands. package utils import ( @@ -28,14 +28,14 @@ import ( "regexp" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/params" + "github.com/expanse-project/go-expanse/rlp" "github.com/peterh/liner" ) @@ -121,10 +121,10 @@ func Fatalf(format string, args ...interface{}) { os.Exit(1) } -func StartEthereum(ethereum *eth.Ethereum) { - glog.V(logger.Info).Infoln("Starting", ethereum.Name()) - if err := ethereum.Start(); err != nil { - Fatalf("Error starting Ethereum: %v", err) +func StartExpanse(expanse *exp.Expanse) { + glog.V(logger.Info).Infoln("Starting", expanse.Name()) + if err := expanse.Start(); err != nil { + Fatalf("Error starting Expanse: %v", err) } go func() { sigc := make(chan os.Signal, 1) @@ -132,7 +132,7 @@ func StartEthereum(ethereum *eth.Ethereum) { defer signal.Stop(sigc) <-sigc glog.V(logger.Info).Infoln("Got interrupt, shutting down...") - go ethereum.Stop() + go expanse.Stop() logger.Flush() for i := 10; i > 0; i-- { <-sigc diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go index 4450065c14..63351bec83 100644 --- a/cmd/utils/customflags.go +++ b/cmd/utils/customflags.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package utils @@ -44,7 +44,7 @@ func (self *DirectoryString) Set(value string) error { } // Custom cli.Flag type which expand the received string to an absolute path. -// e.g. ~/.ethereum -> /home/username/.ethereum +// e.g. ~/.expanse -> /home/username/.expanse type DirectoryFlag struct { cli.GenericFlag Name string diff --git a/cmd/utils/customflags_test.go b/cmd/utils/customflags_test.go index de39ca36a1..24c6cff635 100644 --- a/cmd/utils/customflags_test.go +++ b/cmd/utils/customflags_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package utils diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index af2929d102..bfbc99bf59 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package utils @@ -28,26 +28,24 @@ import ( "runtime" "strconv" + "github.com/expanse-project/go-expanse/metrics" + "github.com/codegangsta/cli" - "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/rpc/api" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/comms" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/rpc/useragent" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/ethash" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p/nat" + "github.com/expanse-project/go-expanse/rpc/api" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/comms" + "github.com/expanse-project/go-expanse/xeth" ) func init() { @@ -105,7 +103,7 @@ var ( NetworkIdFlag = cli.IntFlag{ Name: "networkid", Usage: "Network Id (integer)", - Value: eth.NetworkId, + Value: exp.NetworkId, } BlockchainVersionFlag = cli.IntFlag{ Name: "blockchainversion", @@ -250,7 +248,7 @@ var ( RPCPortFlag = cli.IntFlag{ Name: "rpcport", Usage: "Port on which the JSON-RPC server should listen", - Value: 8545, + Value: 9656, } RPCCORSDomainFlag = cli.StringFlag{ Name: "rpccorsdomain", @@ -294,7 +292,7 @@ var ( ListenPortFlag = cli.IntFlag{ Name: "port", Usage: "Network listening port", - Value: 30303, + Value: 60606, } BootnodesFlag = cli.StringFlag{ Name: "bootnodes", @@ -393,8 +391,8 @@ func MakeNodeKey(ctx *cli.Context) (key *ecdsa.PrivateKey) { return key } -// MakeEthConfig creates ethereum options from set command line flags. -func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { +// MakeEthConfig creates expanse options from set command line flags. +func MakeEthConfig(clientID, version string, ctx *cli.Context) *exp.Config { customName := ctx.GlobalString(IdentityFlag.Name) if len(customName) > 0 { clientID += "/" + customName @@ -405,7 +403,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config { glog.V(logger.Error).Infoln("WARNING: No etherbase set and no accounts found as default") } - return ð.Config{ + return &exp.Config{ Name: common.MakeName(clientID, version), DataDir: ctx.GlobalString(DataDirFlag.Name), GenesisNonce: ctx.GlobalInt(GenesisNonceFlag.Name), @@ -505,7 +503,7 @@ func IpcSocketPath(ctx *cli.Context) (ipcpath string) { } else { ipcpath = common.DefaultIpcPath() if ctx.GlobalIsSet(DataDirFlag.Name) { - ipcpath = filepath.Join(ctx.GlobalString(DataDirFlag.Name), "geth.ipc") + ipcpath = filepath.Join(ctx.GlobalString(DataDirFlag.Name), "gexp.ipc") } if ctx.GlobalIsSet(IPCPathFlag.Name) { ipcpath = ctx.GlobalString(IPCPathFlag.Name) @@ -515,7 +513,7 @@ func IpcSocketPath(ctx *cli.Context) (ipcpath string) { return } -func StartIPC(eth *eth.Ethereum, ctx *cli.Context) error { +func StartIPC(exp *exp.Expanse, ctx *cli.Context) error { config := comms.IpcConfig{ Endpoint: IpcSocketPath(ctx), } @@ -536,17 +534,17 @@ func StartIPC(eth *eth.Ethereum, ctx *cli.Context) error { return comms.StartIpc(config, codec.JSON, initializer) } -func StartRPC(eth *eth.Ethereum, ctx *cli.Context) error { +func StartRPC(exp *exp.Expanse, ctx *cli.Context) error { config := comms.HttpConfig{ ListenAddress: ctx.GlobalString(RPCListenAddrFlag.Name), ListenPort: uint(ctx.GlobalInt(RPCPortFlag.Name)), CorsDomain: ctx.GlobalString(RPCCORSDomainFlag.Name), } - xeth := xeth.New(eth, nil) + xeth := xeth.New(exp, nil) codec := codec.JSON - apis, err := api.ParseApiString(ctx.GlobalString(RpcApiFlag.Name), codec, xeth, eth) + apis, err := api.ParseApiString(ctx.GlobalString(RpcApiFlag.Name), codec, xeth, exp) if err != nil { return err } diff --git a/cmd/utils/legalese.go b/cmd/utils/legalese.go index 09e687c17b..4779849015 100644 --- a/cmd/utils/legalese.go +++ b/cmd/utils/legalese.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of go-ethereum. +// Copyright 2015 The go-expanse Authors +// This file is part of go-expanse. // -// go-ethereum is free software: you can redistribute it and/or modify +// go-expanse is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// go-ethereum is distributed in the hope that it will be useful, +// go-expanse is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with go-ethereum. If not, see . +// along with go-expanse. If not, see . package utils diff --git a/common/README.md b/common/README.md index 1ed56b71ba..a1ddd98cc6 100644 --- a/common/README.md +++ b/common/README.md @@ -1,22 +1,22 @@ # ethutil [![Build -Status](https://travis-ci.org/ethereum/go-ethereum.png?branch=master)](https://travis-ci.org/ethereum/go-ethereum) +Status](https://travis-ci.org/expanse/go-expanse.png?branch=master)](https://travis-ci.org/expanse/go-expanse) -The ethutil package contains the ethereum utility library. +The ethutil package contains the expanse utility library. # Installation -`go get github.com/ethereum/ethutil-go` +`go get github.com/expanse-project/ethutil-go` # Usage ## RLP (Recursive Linear Prefix) Encoding -RLP Encoding is an encoding scheme utilized by the Ethereum project. It +RLP Encoding is an encoding scheme utilized by the Expanse project. It encodes any native value or list to string. -More in depth information about the Encoding scheme see the [Wiki](http://wiki.ethereum.org/index.php/RLP) +More in depth information about the Encoding scheme see the [Wiki](http://wiki.expanse.org/index.php/RLP) article. ```go @@ -31,10 +31,10 @@ fmt.Println(decoded) // => ["dog" "cat"] ## Patricia Trie -Patricie Tree is a merkle trie utilized by the Ethereum project. +Patricie Tree is a merkle trie utilized by the Expanse project. More in depth information about the (modified) Patricia Trie can be -found on the [Wiki](http://wiki.ethereum.org/index.php/Patricia_Tree). +found on the [Wiki](http://wiki.expanse.org/index.php/Patricia_Tree). The patricia trie uses a db as backend and could be anything as long as it satisfies the Database interface found in `ethutil/db.go`. diff --git a/common/big.go b/common/big.go index a5d512d0dc..9dce0d70cb 100644 --- a/common/big.go +++ b/common/big.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/big_test.go b/common/big_test.go index 1eb0c0c1fd..e45c98ff3d 100644 --- a/common/big_test.go +++ b/common/big_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/bytes.go b/common/bytes.go index ba6987a9ec..11dc2665ec 100644 --- a/common/bytes.go +++ b/common/bytes.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package common contains various helper functions. package common diff --git a/common/bytes_test.go b/common/bytes_test.go index 816d2082b8..f2b40e9463 100644 --- a/common/bytes_test.go +++ b/common/bytes_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/compiler/solidity.go b/common/compiler/solidity.go index 56928ac27d..d3d0a2a57b 100644 --- a/common/compiler/solidity.go +++ b/common/compiler/solidity.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package compiler @@ -27,10 +27,10 @@ import ( "regexp" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) const ( diff --git a/common/compiler/solidity_test.go b/common/compiler/solidity_test.go index 3303bc15a1..cf9aec4407 100644 --- a/common/compiler/solidity_test.go +++ b/common/compiler/solidity_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package compiler @@ -23,7 +23,7 @@ import ( "path" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) const solcVersion = "0.9.23" @@ -111,4 +111,4 @@ func TestSaveInfo(t *testing.T) { if cinfohash != infohash { t.Errorf("content hash for info is incorrect. expected %v, got %v", infohash.Hex(), cinfohash.Hex()) } -} \ No newline at end of file +} diff --git a/common/db.go b/common/db.go index 60c090cdce..2aee774304 100644 --- a/common/db.go +++ b/common/db.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/debug.go b/common/debug.go index fa93d7bda5..0ba3e3b303 100644 --- a/common/debug.go +++ b/common/debug.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common @@ -24,7 +24,7 @@ import ( ) func Report(extra ...interface{}) { - fmt.Fprintln(os.Stderr, "You've encountered a sought after, hard to reproduce bug. Please report this to the developers <3 https://github.com/ethereum/go-ethereum/issues") + fmt.Fprintln(os.Stderr, "You've encountered a sought after, hard to reproduce bug. Please report this to the developers <3 https://github.com/expanse-project/go-expanse/issues") fmt.Fprintln(os.Stderr, extra...) _, file, line, _ := runtime.Caller(1) diff --git a/common/docserver/docserver.go b/common/docserver/docserver.go index dac542ba7e..bc865b0a5c 100644 --- a/common/docserver/docserver.go +++ b/common/docserver/docserver.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package docserver @@ -22,8 +22,8 @@ import ( "net/http" "path/filepath" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) type DocServer struct { diff --git a/common/docserver/docserver_test.go b/common/docserver/docserver_test.go index 632603addb..70e20e8bde 100644 --- a/common/docserver/docserver_test.go +++ b/common/docserver/docserver_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package docserver @@ -23,8 +23,8 @@ import ( "path" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) func TestGetAuthContent(t *testing.T) { @@ -74,4 +74,4 @@ func TestRegisterScheme(t *testing.T) { if !ds.HasScheme("scheme") { t.Errorf("expected scheme to be registered") } -} \ No newline at end of file +} diff --git a/common/list.go b/common/list.go index 07b2f17f53..395519b921 100644 --- a/common/list.go +++ b/common/list.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/main_test.go b/common/main_test.go index 149d09928a..95e10f0c3c 100644 --- a/common/main_test.go +++ b/common/main_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/math/dist.go b/common/math/dist.go index 913fbfbd47..5df1fc2d1c 100644 --- a/common/math/dist.go +++ b/common/math/dist.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package math @@ -20,7 +20,7 @@ import ( "math/big" "sort" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) type Summer interface { diff --git a/common/math/dist_test.go b/common/math/dist_test.go index 1eacfbcaf2..41d5175561 100644 --- a/common/math/dist_test.go +++ b/common/math/dist_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package math diff --git a/common/natspec/natspec.go b/common/natspec/natspec.go index 0265c2e13f..7907f21b61 100644 --- a/common/natspec/natspec.go +++ b/common/natspec/natspec.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package natspec @@ -22,11 +22,11 @@ import ( "fmt" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/docserver" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/common/docserver" + "github.com/expanse-project/go-expanse/common/registrar" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/xeth" "github.com/robertkrimen/otto" ) diff --git a/common/natspec/natspec_e2e_test.go b/common/natspec/natspec_e2e_test.go index fc8ca6af2e..8c063f6259 100644 --- a/common/natspec/natspec_e2e_test.go +++ b/common/natspec/natspec_e2e_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package natspec @@ -26,15 +26,15 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/docserver" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethdb" - xe "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/common/docserver" + "github.com/expanse-project/go-expanse/common/registrar" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/ethdb" + xe "github.com/expanse-project/go-expanse/xeth" ) const ( @@ -93,7 +93,7 @@ const ( type testFrontend struct { t *testing.T - ethereum *eth.Ethereum + expanse *exp.Expanse xeth *xe.XEth wait chan *big.Int lastConfirm string @@ -101,7 +101,7 @@ type testFrontend struct { } func (self *testFrontend) UnlockAccount(acc []byte) bool { - self.ethereum.AccountManager().Unlock(common.BytesToAddress(acc), "password") + self.expanse.AccountManager().Unlock(common.BytesToAddress(acc), "password") return true } @@ -113,17 +113,17 @@ func (self *testFrontend) ConfirmTransaction(tx string) bool { return true } -func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { +func testEth(t *testing.T) (expanse *exp.Expanse, err error) { - os.RemoveAll("/tmp/eth-natspec/") + os.RemoveAll("/tmp/exp-natspec/") - err = os.MkdirAll("/tmp/eth-natspec/keystore", os.ModePerm) + err = os.MkdirAll("/tmp/exp-natspec/keystore", os.ModePerm) if err != nil { panic(err) } // create a testAddress - ks := crypto.NewKeyStorePassphrase("/tmp/eth-natspec/keystore") + ks := crypto.NewKeyStorePassphrase("/tmp/exp-natspec/keystore") am := accounts.NewManager(ks) testAccount, err := am.NewAccount("password") if err != nil { @@ -137,8 +137,8 @@ func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { core.WriteGenesisBlockForTesting(db, common.HexToAddress(testAddress), common.String2Big(testBalance)) // only use minimalistic stack with no networking - ethereum, err = eth.New(ð.Config{ - DataDir: "/tmp/eth-natspec", + expanse, err = exp.New(&exp.Config{ + DataDir: "/tmp/exp-natspec", AccountManager: am, MaxPeers: 0, PowTest: true, @@ -154,23 +154,23 @@ func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { } func testInit(t *testing.T) (self *testFrontend) { - // initialise and start minimal ethereum stack - ethereum, err := testEth(t) + // initialise and start minimal expanse stack + expanse, err := testEth(t) if err != nil { - t.Errorf("error creating ethereum: %v", err) + t.Errorf("error creating expanse: %v", err) return } - err = ethereum.Start() + err = expanse.Start() if err != nil { - t.Errorf("error starting ethereum: %v", err) + t.Errorf("error starting expanse: %v", err) return } // mock frontend - self = &testFrontend{t: t, ethereum: ethereum} - self.xeth = xe.New(ethereum, self) + self = &testFrontend{t: t, expanse: expanse} + self.xeth = xe.New(expanse, self) self.wait = self.xeth.UpdateState() - addr, _ := self.ethereum.Etherbase() + addr, _ := self.expanse.Etherbase() // initialise the registry contracts reg := registrar.New(self.xeth) @@ -211,8 +211,8 @@ func TestNatspecE2E(t *testing.T) { t.Skip() tf := testInit(t) - defer tf.ethereum.Stop() - addr, _ := tf.ethereum.Etherbase() + defer tf.expanse.Stop() + addr, _ := tf.expanse.Etherbase() // create a contractInfo file (mock cloud-deployed contract metadocs) // incidentally this is the info for the registry contract itself @@ -280,7 +280,7 @@ func TestNatspecE2E(t *testing.T) { } func pendingTransactions(repl *testFrontend, t *testing.T) (txc int64, err error) { - txs := repl.ethereum.TxPool().GetTransactions() + txs := repl.expanse.TxPool().GetTransactions() return int64(len(txs)), nil } @@ -306,12 +306,12 @@ func processTxs(repl *testFrontend, t *testing.T, expTxc int) bool { return false } - err = repl.ethereum.StartMining(runtime.NumCPU()) + err = repl.expanse.StartMining(runtime.NumCPU()) if err != nil { t.Errorf("unexpected error mining: %v", err) return false } - defer repl.ethereum.StopMining() + defer repl.expanse.StopMining() timer := time.NewTimer(100 * time.Second) height := new(big.Int).Add(repl.xeth.CurrentBlock().Number(), big.NewInt(1)) diff --git a/common/natspec/natspec_e2e_test.go.orig b/common/natspec/natspec_e2e_test.go.orig index ae8e17ad9a..bd89d9c546 100644 --- a/common/natspec/natspec_e2e_test.go.orig +++ b/common/natspec/natspec_e2e_test.go.orig @@ -7,15 +7,15 @@ import ( "strings" "testing" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/docserver" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - xe "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/common/docserver" + "github.com/expanse-project/go-expanse/common/registrar" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/exp" + xe "github.com/expanse-project/go-expanse/xeth" ) const ( @@ -74,7 +74,7 @@ const ( type testFrontend struct { t *testing.T - ethereum *eth.Ethereum + expanse *exp.Expanse xeth *xe.XEth coinbase common.Address stateDb *state.StateDB @@ -84,7 +84,7 @@ type testFrontend struct { } func (self *testFrontend) UnlockAccount(acc []byte) bool { - self.ethereum.AccountManager().Unlock(common.BytesToAddress(acc), "password") + self.expanse.AccountManager().Unlock(common.BytesToAddress(acc), "password") return true } @@ -96,17 +96,17 @@ func (self *testFrontend) ConfirmTransaction(tx string) bool { return true } -func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { +func testEth(t *testing.T) (expanse *exp.Expanse, err error) { - os.RemoveAll("/tmp/eth-natspec/") + os.RemoveAll("/tmp/exp-natspec/") - err = os.MkdirAll("/tmp/eth-natspec/keystore", os.ModePerm) + err = os.MkdirAll("/tmp/exp-natspec/keystore", os.ModePerm) if err != nil { panic(err) } // create a testAddress - ks := crypto.NewKeyStorePassphrase("/tmp/eth-natspec/keystore") + ks := crypto.NewKeyStorePassphrase("/tmp/exp-natspec/keystore") am := accounts.NewManager(ks) testAccount, err := am.NewAccount("password") if err != nil { @@ -120,8 +120,8 @@ func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { }`) // only use minimalistic stack with no networking - ethereum, err = eth.New(ð.Config{ - DataDir: "/tmp/eth-natspec", + expanse, err = exp.New(&exp.Config{ + DataDir: "/tmp/exp-natspec", AccountManager: am, MaxPeers: 0, }) @@ -134,25 +134,25 @@ func testEth(t *testing.T) (ethereum *eth.Ethereum, err error) { } func testInit(t *testing.T) (self *testFrontend) { - // initialise and start minimal ethereum stack - ethereum, err := testEth(t) + // initialise and start minimal expanse stack + expanse, err := testEth(t) if err != nil { - t.Errorf("error creating ethereum: %v", err) + t.Errorf("error creating expanse: %v", err) return } - err = ethereum.Start() + err = expanse.Start() if err != nil { - t.Errorf("error starting ethereum: %v", err) + t.Errorf("error starting expanse: %v", err) return } // mock frontend - self = &testFrontend{t: t, ethereum: ethereum} - self.xeth = xe.New(ethereum, self) + self = &testFrontend{t: t, expanse: expanse} + self.xeth = xe.New(expanse, self) - addr, _ := ethereum.Etherbase() + addr, _ := expanse.Etherbase() self.coinbase = addr - self.stateDb = self.ethereum.ChainManager().State().Copy() + self.stateDb = self.expanse.ChainManager().State().Copy() // initialise the registry contracts reg := registrar.New(self.xeth) @@ -185,7 +185,7 @@ func TestNatspecE2E(t *testing.T) { t.Skip() tf := testInit(t) - defer tf.ethereum.Stop() + defer tf.expanse.Stop() // create a contractInfo file (mock cloud-deployed contract metadocs) // incidentally this is the info for the registry contract itself diff --git a/common/natspec/natspec_js.go b/common/natspec/natspec_js.go index 2b30d31d35..7af296bbe1 100644 --- a/common/natspec/natspec_js.go +++ b/common/natspec/natspec_js.go @@ -1,41 +1,41 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package natspec -const natspecJS = //`require=function t(e,n,r){function i(f,u){if(!n[f]){if(!e[f]){var s="function"==typeof require&&require;if(!u&&s)return s(f,!0);if(o)return o(f,!0);var c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c}var a=n[f]={exports:{}};e[f][0].call(a.exports,function(t){var n=e[f][1][t];return i(n?n:t)},a,a.exports,t,e,n,r)}return n[f].exports}for(var o="function"==typeof require&&require,f=0;fv;v++)d.push(g(e.slice(0,s))),e=e.slice(s);n.push(d)}else r.prefixedType("string")(t[c].type)?(a=a.slice(s),n.push(g(e.slice(0,s))),e=e.slice(s)):(n.push(g(e.slice(0,s))),e=e.slice(s))}),n},g=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(){var e=Array.prototype.slice.call(arguments);return a(t.inputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},m=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(e){return h(t.outputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e};e.exports={inputParser:g,outputParser:m,formatInput:a,formatOutput:h}},{"./const":4,"./formatters":5,"./types":6,"./utils":7}],4:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3}}).call(this,t("_process"))},{_process:2,"bignumber.js":8}],5:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=t("./utils"),o=t("./const"),f=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},u=function(t){var e=2*o.ETH_PADDING;return t instanceof r||"number"==typeof t?("number"==typeof t&&(t=new r(t)),r.config(o.ETH_BIGNUMBER_ROUNDING_MODE),t=t.round(),t.lessThan(0)&&(t=new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?u(new r(t)):(+t).toString(16),f(t,e)},s=function(t){return i.fromAscii(t,o.ETH_PADDING).substr(2)},c=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},a=function(t){return u(new r(t).times(new r(2).pow(128)))},l=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},p=function(t){return t=t||"0",l(t)?new r(t,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(t,16)},h=function(t){return t=t||"0",new r(t,16)},g=function(t){return p(t).dividedBy(new r(2).pow(128))},m=function(t){return h(t).dividedBy(new r(2).pow(128))},d=function(t){return"0x"+t},v=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},w=function(t){return i.toAscii(t)},y=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:u,formatInputString:s,formatInputBool:c,formatInputReal:a,formatOutputInt:p,formatOutputUInt:h,formatOutputReal:g,formatOutputUReal:m,formatOutputHash:d,formatOutputBool:v,formatOutputString:w,formatOutputAddress:y}}).call(this,t("_process"))},{"./const":4,"./utils":7,_process:2,"bignumber.js":8}],6:[function(t,e){var n=t("./formatters"),r=function(t){return function(e){return 0===e.indexOf(t)}},i=function(t){return function(e){return t===e}},o=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("hash"),format:n.formatInputInt},{type:r("string"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:i("address"),format:n.formatInputInt},{type:i("bool"),format:n.formatInputBool}]},f=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("hash"),format:n.formatOutputHash},{type:r("string"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:i("address"),format:n.formatOutputAddress},{type:i("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:i,inputTypes:o,outputTypes:f}},{"./formatters":5}],7:[function(t,e){var n=t("./const"),r=function(t,e){for(var n=!1,r=0;rn;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},o=function(t){for(var e="",n=0;n3e3&&rr?"i":"").test(c))return m(a,c,u,r);u?(a.s=0>1/t?(c=c.slice(1),-1):1,$&&c.replace(/^0\.0*|\./,"").length>15&&U(L,O,t),u=!1):a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,a.s)}else{if(t instanceof e)return a.s=t.s,a.e=t.e,a.c=(t=t.c)?t.slice():t,void(L=0);if((u="number"==typeof t)&&0*t==0){if(a.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,f=t;f>=10;f/=10,o++);return a.e=o,a.c=[t],void(L=0)}c=t+""}else{if(!d.test(c=t+""))return m(a,c,u);a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(f=c.search(/e/i))>0?(0>o&&(o=f),o+=+c.slice(f+1),c=c.substring(0,f)):0>o&&(o=c.length),f=0;48===c.charCodeAt(f);f++);for(s=c.length;48===c.charCodeAt(--s););if(c=c.slice(f,s+1))if(s=c.length,u&&$&&s>15&&U(L,O,a.s*t),o=o-f-1,o>q)a.c=a.e=null;else if(k>o)a.c=[a.e=0];else{if(a.e=o,a.c=[],f=(o+1)%I,0>o&&(f+=I),s>f){for(f&&a.c.push(+c.slice(0,f)),s-=I;s>f;)a.c.push(+c.slice(f,f+=I));c=c.slice(f),f=I-c.length}else f-=s;for(;f--;c+="0");a.c.push(+c)}else a.c=[a.e=0];L=0}function n(t,n,r,i){var f,u,s,a,p,h,g,m=t.indexOf("."),d=B,v=H;for(37>r&&(t=t.toLowerCase()),m>=0&&(s=Y,Y=0,t=t.replace(".",""),g=new e(r),p=g.pow(t.length-m),Y=s,g.c=c(l(o(p.c),p.e),10,n),g.e=g.c.length),h=c(t,r,n),u=s=h.length;0==h[--s];h.pop());if(!h[0])return"0";if(0>m?--u:(p.c=h,p.e=u,p.s=i,p=G(p,g,d,v,n),h=p.c,a=p.r,u=p.e),f=u+d+1,m=h[f],s=n/2,a=a||0>f||null!=h[f+1],a=4>v?(null!=m||a)&&(0==v||v==(p.s<0?3:2)):m>s||m==s&&(4==v||a||6==v&&1&h[f-1]||v==(p.s<0?8:7)),1>f||!h[0])t=a?l("1",-d):"0";else{if(h.length=f,a)for(--n;++h[--f]>n;)h[f]=0,f||(++u,h.unshift(1));for(s=h.length;!h[--s];);for(m=0,t="";s>=m;t+=N.charAt(h[m++]));t=l(t,u)}return t}function h(t,n,r,i){var f,u,s,c,p;if(r=null!=r&&z(r,0,8,i,b)?0|r:H,!t.c)return t.toString();if(f=t.c[0],s=t.e,null==n)p=o(t.c),p=19==i||24==i&&C>=s?a(p,s):l(p,s);else if(t=F(new e(t),n,r),u=t.e,p=o(t.c),c=p.length,19==i||24==i&&(u>=n||C>=u)){for(;n>c;p+="0",c++);p=a(p,u)}else if(n-=s,p=l(p,u),u+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=u-c,n>0)for(u+1==c&&(p+=".");n--;p+="0");return t.s<0&&f?"-"+p:p}function S(t,n){var r,i,o=0;for(s(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&U(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function R(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>q?t.c=t.e=null:k>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function U(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",L=0,r}function F(t,e,n,r){var i,o,f,u,s,c,a,l=t.c,p=_;if(l){t:{for(i=1,u=l[0];u>=10;u/=10,i++);if(o=e-i,0>o)o+=I,f=e,s=l[c=0],a=s/p[i-f-1]%10|0;else if(c=v((o+1)/I),c>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));s=a=0,i=1,o%=I,f=o-I+1}else{for(s=u=l[c],i=1;u>=10;u/=10,i++);o%=I,f=o-I+i,a=0>f?0:s/p[i-f-1]%10|0}if(r=r||0>e||null!=l[c+1]||(0>f?s:s%p[i-f-1]),r=4>n?(a||r)&&(0==n||n==(t.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?f>0?s/p[i-f]:0:l[c-1])%10&1||n==(t.s<0?8:7)),1>e||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=p[e%I],t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=c,u=1,c--):(l.length=c+1,u=p[I-o],l[c]=f>0?w(s/p[i-f]%p[f])*u:0),r)for(;;){if(0==c){for(o=1,f=l[0];f>=10;f/=10,o++);for(f=l[0]+=u,u=1;f>=10;f/=10,u++);o!=u&&(t.e++,l[0]==E&&(l[0]=1));break}if(l[c]+=u,l[c]!=E)break;l[c--]=0,u=1}for(o=l.length;0===l[--o];l.pop());}t.e>q?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return f(e="DECIMAL_PLACES")&&z(t,0,D,2,e)&&(B=0|t),r[e]=B,f(e="ROUNDING_MODE")&&z(t,0,8,2,e)&&(H=0|t),r[e]=H,f(e="EXPONENTIAL_AT")&&(s(t)?z(t[0],-D,0,2,e)&&z(t[1],0,D,2,e)&&(C=0|t[0],j=0|t[1]):z(t,-D,D,2,e)&&(C=-(j=0|(0>t?-t:t)))),r[e]=[C,j],f(e="RANGE")&&(s(t)?z(t[0],-D,-1,2,e)&&z(t[1],1,D,2,e)&&(k=0|t[0],q=0|t[1]):z(t,-D,D,2,e)&&(0|t?k=-(q=0|(0>t?-t:t)):$&&U(2,e+" cannot be zero",t))),r[e]=[k,q],f(e="ERRORS")&&(t===!!t||1===t||0===t?(L=0,z=($=!!t)?A:u):$&&U(2,e+y,t)),r[e]=$,f(e="CRYPTO")&&(t===!!t||1===t||0===t?(V=!(!t||!g||"object"!=typeof g),t&&!V&&$&&U(2,"crypto unavailable",g)):$&&U(2,e+y,t)),r[e]=V,f(e="MODULO_MODE")&&z(t,0,9,2,e)&&(W=0|t),r[e]=W,f(e="POW_PRECISION")&&z(t,0,D,2,e)&&(Y=0|t),r[e]=Y,f(e="FORMAT")&&("object"==typeof t?Z=t:$&&U(2,e+" not an object",t)),r[e]=Z,r},e.max=function(){return S(arguments,M.lt)},e.min=function(){return S(arguments,M.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return w(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,f,u,s=0,c=[],a=new e(P);if(t=null!=t&&z(t,0,D,14)?0|t:B,f=v(t/I),V)if(g&&g.getRandomValues){for(r=g.getRandomValues(new Uint32Array(f*=2));f>s;)u=131072*r[s]+(r[s+1]>>>11),u>=9e15?(i=g.getRandomValues(new Uint32Array(2)),r[s]=i[0],r[s+1]=i[1]):(c.push(u%1e14),s+=2);s=f/2}else if(g&&g.randomBytes){for(r=g.randomBytes(f*=7);f>s;)u=281474976710656*(31&r[s])+1099511627776*r[s+1]+4294967296*r[s+2]+16777216*r[s+3]+(r[s+4]<<16)+(r[s+5]<<8)+r[s+6],u>=9e15?g.randomBytes(7).copy(r,s):(c.push(u%1e14),s+=7);s=f/7}else $&&U(14,"crypto unavailable",g);if(!s)for(;f>s;)u=n(),9e15>u&&(c[s++]=u%1e14);for(f=c[--s],t%=I,f&&t&&(u=_[I-t],c[s]=w(f/u)*u);0===c[s];c.pop(),s--);if(0>s)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(s=1,u=c[0];u>=10;u/=10,s++);I>s&&(o-=I-s)}return a.e=o,a.c=c,a}}(),G=function(){function t(t,e,n){var r,i,o,f,u=0,s=t.length,c=e%T,a=e/T|0;for(t=t.slice();s--;)o=t[s]%T,f=t[s]/T|0,r=a*o+f*c,i=c*o+r%T*T+u,u=(i/n|0)+(r/T|0)+a*f,t[s]=i%n;return u&&t.unshift(u),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,f,u,s,c){var a,l,p,h,g,m,d,v,y,b,O,N,x,_,T,D,S,A=o.s==f.s?1:-1,R=o.c,U=f.c;if(!(R&&R[0]&&U&&U[0]))return new e(o.s&&f.s&&(R?!U||R[0]!=U[0]:U)?R&&0==R[0]||!U?0*A:A/0:0/0);for(v=new e(A),y=v.c=[],l=o.e-f.e,A=u+l+1,c||(c=E,l=i(o.e/I)-i(f.e/I),A=A/I|0),p=0;U[p]==(R[p]||0);p++);if(U[p]>(R[p]||0)&&l--,0>A)y.push(1),h=!0;else{for(_=R.length,D=U.length,p=0,A+=2,g=w(c/(U[0]+1)),g>1&&(U=t(U,g,c),R=t(R,g,c),D=U.length,_=R.length),x=D,b=R.slice(0,D),O=b.length;D>O;b[O++]=0);S=U.slice(),S.unshift(0),T=U[0],U[1]>=c/2&&T++;do g=0,a=n(U,b,D,O),0>a?(N=b[0],D!=O&&(N=N*c+(b[1]||0)),g=w(N/T),g>1?(g>=c&&(g=c-1),m=t(U,g,c),d=m.length,O=b.length,a=n(m,b,d,O),1==a&&(g--,r(m,d>D?S:U,d,c))):(0==g&&(a=g=1),m=U.slice()),d=m.length,O>d&&m.unshift(0),r(b,m,O,c),-1==a&&(O=b.length,a=n(U,b,D,O),1>a&&(g++,r(b,O>D?S:U,O,c))),O=b.length):0===a&&(g++,b=[0]),y[p++]=g,a&&b[0]?b[O++]=R[x]||0:(b=[R[x]],O=1);while((x++<_||null!=b[0])&&A--);h=null!=b[0],y[0]||y.shift()}if(c==E){for(p=1,A=y[0];A>=10;A/=10,p++);F(v,u+(v.e=p+l*I-1)+1,s,h)}else v.e=l,v.r=+h;return v}}(),m==function(){var t=/^(-?)0([xbo])(\w[\w.]*$)/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+([\w.])|^\s+|\s+$/g;return function(f,u,s,c){var a,l=s?u:u.replace(o,"$1");if(i.test(l))f.s=isNaN(l)?null:0>l?-1:1;else{if(!s&&(l=l.replace(t,function(t,e,n){return a="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=a?t:e}),c&&(a=c,l=l.replace(n,"$1").replace(r,"0.$1")),u!=l))return new e(l,a);$&&U(L,"not a"+(c?" base "+c:"")+" number",u),f.s=null}f.c=f.e=null,L=0}}(),M.absoluteValue=M.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},M.ceil=function(){return F(new e(this),this.e+1,2)},M.comparedTo=M.cmp=function(t,n){return L=1,f(this,new e(t,n))},M.decimalPlaces=M.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},M.dividedBy=M.div=function(t,n){return L=3,G(this,new e(t,n),B,H)},M.dividedToIntegerBy=M.divToInt=function(t,n){return L=4,G(this,new e(t,n),0,1)},M.equals=M.eq=function(t,n){return L=5,0===f(this,new e(t,n))},M.floor=function(){return F(new e(this),this.e+1,3)},M.greaterThan=M.gt=function(t,n){return L=6,f(this,new e(t,n))>0},M.greaterThanOrEqualTo=M.gte=function(t,n){return L=7,1===(n=f(this,new e(t,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(t,n){return L=8,f(this,new e(t,n))<0},M.lessThanOrEqualTo=M.lte=function(t,n){return L=9,-1===(n=f(this,new e(t,n)))||0===n},M.minus=M.sub=function(t,n){var r,o,f,u,s=this,c=s.s;if(L=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,s.plus(t);var a=s.e/I,l=t.e/I,p=s.c,h=t.c;if(!a||!l){if(!p||!h)return p?(t.s=-n,t):new e(h?s:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?s:3==H?-0:0)}if(a=i(a),l=i(l),p=p.slice(),c=a-l){for((u=0>c)?(c=-c,f=p):(l=a,f=h),f.reverse(),n=c;n--;f.push(0));f.reverse()}else for(o=(u=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){u=p[n]0)for(;n--;p[r++]=0);for(n=E-1;o>c;){if(p[--o]0?(s=u,r=a):(f=-f,r=c),r.reverse();f--;r.push(0));r.reverse()}for(f=c.length,n=a.length,0>f-n&&(r=a,a=c,c=r,n=f),f=0;n;)f=(c[--n]=c[n]+a[n]+f)/E|0,c[n]%=E;return f&&(c.unshift(f),++s),R(t,c,s)},M.precision=M.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&($&&U(13,"argument"+y,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},M.round=function(t,n){var r=new e(this);return(null==t||z(t,0,D,15))&&F(r,~~t+this.e+1,null!=n&&z(n,0,8,15,b)?0|n:H),r},M.shift=function(t){var n=this;return z(t,-x,x,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-x>t||t>x)?n.s*(0>t?0:1/0):n)},M.squareRoot=M.sqrt=function(){var t,n,r,f,u,s=this,c=s.c,a=s.s,l=s.e,p=B+4,h=new e("0.5");if(1!==a||!c||!c[0])return new e(!a||0>a&&(!c||c[0])?0/0:c?s:1/0);if(a=Math.sqrt(+s),0==a||a==1/0?(n=o(c),(n.length+l)%2==0&&(n+="0"),a=Math.sqrt(n),l=i((l+1)/2)-(0>l||l%2),a==1/0?n="1e"+l:(n=a.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new e(n)):r=new e(a+""),r.c[0])for(l=r.e,a=l+p,3>a&&(a=0);;)if(u=r,r=h.times(u.plus(G(s,u,p,1))),o(u.c).slice(0,a)===(n=o(r.c)).slice(0,a)){if(r.ea&&(d=b,b=O,O=d,f=a,a=h,h=f),f=a+h,d=[];f--;d.push(0));for(v=E,w=T,f=h;--f>=0;){for(r=0,g=O[f]%w,m=O[f]/w|0,s=a,u=f+s;u>f;)l=b[--s]%w,p=b[s]/w|0,c=m*l+p*g,l=g*l+c%w*w+d[u]+r,r=(l/v|0)+(c/w|0)+m*p,d[u--]=l%v;d[u]=r}return r?++o:d.shift(),R(t,d,o)},M.toDigits=function(t,n){var r=new e(this);return t=null!=t&&z(t,1,D,18,"precision")?0|t:null,n=null!=n&&z(n,0,8,18,b)?0|n:H,t?F(r,t,n):r},M.toExponential=function(t,e){return h(this,null!=t&&z(t,0,D,19)?~~t+1:null,e,19)},M.toFixed=function(t,e){return h(this,null!=t&&z(t,0,D,20)?~~t+this.e+1:null,e,20)},M.toFormat=function(t,e){var n=h(this,null!=t&&z(t,0,D,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+Z.groupSize,f=+Z.secondaryGroupSize,u=Z.groupSeparator,s=i[0],c=i[1],a=this.s<0,l=a?s.slice(1):s,p=l.length;if(f&&(r=o,o=f,f=r,p-=r),o>0&&p>0){for(r=p%o||o,s=l.substr(0,r);p>r;r+=o)s+=u+l.substr(r,o);f>0&&(s+=u+l.slice(r)),a&&(s="-"+s)}n=c?s+Z.decimalSeparator+((f=+Z.fractionGroupSize)?c.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+Z.fractionGroupSeparator):c):s}return n},M.toFraction=function(t){var n,r,i,f,u,s,c,a,l,p=$,h=this,g=h.c,m=new e(P),d=r=new e(P),v=c=new e(P);if(null!=t&&($=!1,s=new e(t),$=p,(!(p=s.isInt())||s.lt(P))&&($&&U(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&s.c&&F(s,s.e+1,1).gte(P)?s:null)),!g)return h.toString();for(l=o(g),f=m.e=l.length-h.e-1,m.c[0]=_[(u=f%I)<0?I+u:u],t=!t||s.cmp(m)>0?f>0?m:d:s,u=q,q=1/0,s=new e(l),c.c[0]=0;a=G(s,m,0,1),i=r.plus(a.times(v)),1!=i.cmp(t);)r=v,v=i,d=c.plus(a.times(i=d)),c=i,m=s.minus(a.times(i=m)),s=i;return i=G(t.minus(r),v,0,1),c=c.plus(i.times(d)),r=r.plus(i.times(v)),c.s=d.s=h.s,f*=2,n=G(d,v,f,H).minus(h).abs().cmp(G(c,r,f,H).minus(h).abs())<1?[d.toString(),v.toString()]:[c.toString(),r.toString()],q=u,n},M.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},M.toPower=M.pow=function(t){var n,r,i=w(0>t?-t:+t),o=this;if(!z(t,-x,x,23,"exponent")&&(!isFinite(t)||i>x&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=Y?v(Y/I+2):0,r=new e(P);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=w(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=P.div(r)),n?F(r,Y,H):r},M.toPrecision=function(t,e){return h(this,null!=t&&z(t,1,D,24,"precision")?0|t:null,e,24)},M.toString=function(t){var e,r=this,i=r.s,f=r.e;return null===f?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&z(t,2,64,25,"base")?n(l(e,f),0|t,10,i):C>=f||f>=j?a(e,f):l(e,f),0>i&&r.c[0]&&(e="-"+e)),e},M.truncated=M.trunc=function(){return F(new e(this),this.e+1,1)},M.valueOf=M.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function f(t,e){var n,r,i=t.c,o=e.c,f=t.s,u=e.s,s=t.e,c=e.e;if(!f||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:f;if(f!=u)return f;if(n=0>f,r=s==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return s>c^n?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,f=0;u>f;f++)if(i[f]!=o[f])return i[f]>o[f]^n?1:-1;return s==c?0:s>c^n?1:-1}function u(t,e,n){return(t=p(t))>=e&&n>=t}function s(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],f=0,u=t.length;u>f;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=N.indexOf(t.charAt(f++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function a(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function l(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?v(t):w(t)}var h,g,m,d=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=Math.ceil,w=Math.floor,y=" not a boolean or binary digit",b="rounding mode",O="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",E=1e14,I=14,x=9007199254740991,_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],T=1e7,D=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!g)try{g=t("crypto")}catch(S){}}else n.BigNumber=h}(this)},{crypto:1}],natspec:[function(t,e){var n=t("./node_modules/ethereum.js/lib/abi.js"),r=function(){var t=function(t,e){Object.keys(t).forEach(function(n){e[n]=t[n]})},e=function(t){return Object.keys(t).reduce(function(t,e){return t+"var "+e+" = context['"+e+"'];\n"},"")},r=function(t,e){return t.filter(function(t){return t.name===e})[0]},i=function(t,e){var r=n.formatOutput(t.inputs,"0x"+e.params[0].data.slice(10));return t.inputs.reduce(function(t,e,n){return t[e.name]=r[n],t},{})},o=function(t,e){var n,r="",i=/\` + "`" + `(?:\\.|[^` + "`" + `\\])*\` + "`" + `/gim,o=0;try{for(;null!==(n=i.exec(t));){var f=i.lastIndex-n[0].length,u=n[0].slice(1,n[0].length-1);r+=t.slice(o,f);var s=e(u);r+=s,o=i.lastIndex}r+=t.slice(o)}catch(c){throw new Error("Natspec evaluation failed, wrong input params")}return r},f=function(n,f){var u={};if(f)try{var s=r(f.abi,f.method),c=i(s,f.transaction);t(c,u)}catch(a){throw new Error("Natspec evaluation failed, method does not exist")}var l=e(u),p=o(n,function(t){var e=new Function("context",l+"return "+t+";");return e(u).toString()});return p},u=function(t,e){try{return f(t,e)}catch(n){return n.message}};return{evaluateExpression:f,evaluateExpressionSafe:u}}();e.exports=r},{"./node_modules/ethereum.js/lib/abi.js":3}]},{},[]); +const natspecJS = //`require=function t(e,n,r){function i(f,u){if(!n[f]){if(!e[f]){var s="function"==typeof require&&require;if(!u&&s)return s(f,!0);if(o)return o(f,!0);var c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c}var a=n[f]={exports:{}};e[f][0].call(a.exports,function(t){var n=e[f][1][t];return i(n?n:t)},a,a.exports,t,e,n,r)}return n[f].exports}for(var o="function"==typeof require&&require,f=0;fv;v++)d.push(g(e.slice(0,s))),e=e.slice(s);n.push(d)}else r.prefixedType("string")(t[c].type)?(a=a.slice(s),n.push(g(e.slice(0,s))),e=e.slice(s)):(n.push(g(e.slice(0,s))),e=e.slice(s))}),n},g=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(){var e=Array.prototype.slice.call(arguments);return a(t.inputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},m=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(e){return h(t.outputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e};e.exports={inputParser:g,outputParser:m,formatInput:a,formatOutput:h}},{"./const":4,"./formatters":5,"./types":6,"./utils":7}],4:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3}}).call(this,t("_process"))},{_process:2,"bignumber.js":8}],5:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=t("./utils"),o=t("./const"),f=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},u=function(t){var e=2*o.ETH_PADDING;return t instanceof r||"number"==typeof t?("number"==typeof t&&(t=new r(t)),r.config(o.ETH_BIGNUMBER_ROUNDING_MODE),t=t.round(),t.lessThan(0)&&(t=new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?u(new r(t)):(+t).toString(16),f(t,e)},s=function(t){return i.fromAscii(t,o.ETH_PADDING).substr(2)},c=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},a=function(t){return u(new r(t).times(new r(2).pow(128)))},l=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},p=function(t){return t=t||"0",l(t)?new r(t,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(t,16)},h=function(t){return t=t||"0",new r(t,16)},g=function(t){return p(t).dividedBy(new r(2).pow(128))},m=function(t){return h(t).dividedBy(new r(2).pow(128))},d=function(t){return"0x"+t},v=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},w=function(t){return i.toAscii(t)},y=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:u,formatInputString:s,formatInputBool:c,formatInputReal:a,formatOutputInt:p,formatOutputUInt:h,formatOutputReal:g,formatOutputUReal:m,formatOutputHash:d,formatOutputBool:v,formatOutputString:w,formatOutputAddress:y}}).call(this,t("_process"))},{"./const":4,"./utils":7,_process:2,"bignumber.js":8}],6:[function(t,e){var n=t("./formatters"),r=function(t){return function(e){return 0===e.indexOf(t)}},i=function(t){return function(e){return t===e}},o=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("hash"),format:n.formatInputInt},{type:r("string"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:i("address"),format:n.formatInputInt},{type:i("bool"),format:n.formatInputBool}]},f=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("hash"),format:n.formatOutputHash},{type:r("string"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:i("address"),format:n.formatOutputAddress},{type:i("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:i,inputTypes:o,outputTypes:f}},{"./formatters":5}],7:[function(t,e){var n=t("./const"),r=function(t,e){for(var n=!1,r=0;rn;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},o=function(t){for(var e="",n=0;n3e3&&rr?"i":"").test(c))return m(a,c,u,r);u?(a.s=0>1/t?(c=c.slice(1),-1):1,$&&c.replace(/^0\.0*|\./,"").length>15&&U(L,O,t),u=!1):a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,a.s)}else{if(t instanceof e)return a.s=t.s,a.e=t.e,a.c=(t=t.c)?t.slice():t,void(L=0);if((u="number"==typeof t)&&0*t==0){if(a.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,f=t;f>=10;f/=10,o++);return a.e=o,a.c=[t],void(L=0)}c=t+""}else{if(!d.test(c=t+""))return m(a,c,u);a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(f=c.search(/e/i))>0?(0>o&&(o=f),o+=+c.slice(f+1),c=c.substring(0,f)):0>o&&(o=c.length),f=0;48===c.charCodeAt(f);f++);for(s=c.length;48===c.charCodeAt(--s););if(c=c.slice(f,s+1))if(s=c.length,u&&$&&s>15&&U(L,O,a.s*t),o=o-f-1,o>q)a.c=a.e=null;else if(k>o)a.c=[a.e=0];else{if(a.e=o,a.c=[],f=(o+1)%I,0>o&&(f+=I),s>f){for(f&&a.c.push(+c.slice(0,f)),s-=I;s>f;)a.c.push(+c.slice(f,f+=I));c=c.slice(f),f=I-c.length}else f-=s;for(;f--;c+="0");a.c.push(+c)}else a.c=[a.e=0];L=0}function n(t,n,r,i){var f,u,s,a,p,h,g,m=t.indexOf("."),d=B,v=H;for(37>r&&(t=t.toLowerCase()),m>=0&&(s=Y,Y=0,t=t.replace(".",""),g=new e(r),p=g.pow(t.length-m),Y=s,g.c=c(l(o(p.c),p.e),10,n),g.e=g.c.length),h=c(t,r,n),u=s=h.length;0==h[--s];h.pop());if(!h[0])return"0";if(0>m?--u:(p.c=h,p.e=u,p.s=i,p=G(p,g,d,v,n),h=p.c,a=p.r,u=p.e),f=u+d+1,m=h[f],s=n/2,a=a||0>f||null!=h[f+1],a=4>v?(null!=m||a)&&(0==v||v==(p.s<0?3:2)):m>s||m==s&&(4==v||a||6==v&&1&h[f-1]||v==(p.s<0?8:7)),1>f||!h[0])t=a?l("1",-d):"0";else{if(h.length=f,a)for(--n;++h[--f]>n;)h[f]=0,f||(++u,h.unshift(1));for(s=h.length;!h[--s];);for(m=0,t="";s>=m;t+=N.charAt(h[m++]));t=l(t,u)}return t}function h(t,n,r,i){var f,u,s,c,p;if(r=null!=r&&z(r,0,8,i,b)?0|r:H,!t.c)return t.toString();if(f=t.c[0],s=t.e,null==n)p=o(t.c),p=19==i||24==i&&C>=s?a(p,s):l(p,s);else if(t=F(new e(t),n,r),u=t.e,p=o(t.c),c=p.length,19==i||24==i&&(u>=n||C>=u)){for(;n>c;p+="0",c++);p=a(p,u)}else if(n-=s,p=l(p,u),u+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=u-c,n>0)for(u+1==c&&(p+=".");n--;p+="0");return t.s<0&&f?"-"+p:p}function S(t,n){var r,i,o=0;for(s(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&U(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function R(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>q?t.c=t.e=null:k>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function U(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",L=0,r}function F(t,e,n,r){var i,o,f,u,s,c,a,l=t.c,p=_;if(l){t:{for(i=1,u=l[0];u>=10;u/=10,i++);if(o=e-i,0>o)o+=I,f=e,s=l[c=0],a=s/p[i-f-1]%10|0;else if(c=v((o+1)/I),c>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));s=a=0,i=1,o%=I,f=o-I+1}else{for(s=u=l[c],i=1;u>=10;u/=10,i++);o%=I,f=o-I+i,a=0>f?0:s/p[i-f-1]%10|0}if(r=r||0>e||null!=l[c+1]||(0>f?s:s%p[i-f-1]),r=4>n?(a||r)&&(0==n||n==(t.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?f>0?s/p[i-f]:0:l[c-1])%10&1||n==(t.s<0?8:7)),1>e||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=p[e%I],t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=c,u=1,c--):(l.length=c+1,u=p[I-o],l[c]=f>0?w(s/p[i-f]%p[f])*u:0),r)for(;;){if(0==c){for(o=1,f=l[0];f>=10;f/=10,o++);for(f=l[0]+=u,u=1;f>=10;f/=10,u++);o!=u&&(t.e++,l[0]==E&&(l[0]=1));break}if(l[c]+=u,l[c]!=E)break;l[c--]=0,u=1}for(o=l.length;0===l[--o];l.pop());}t.e>q?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return f(e="DECIMAL_PLACES")&&z(t,0,D,2,e)&&(B=0|t),r[e]=B,f(e="ROUNDING_MODE")&&z(t,0,8,2,e)&&(H=0|t),r[e]=H,f(e="EXPONENTIAL_AT")&&(s(t)?z(t[0],-D,0,2,e)&&z(t[1],0,D,2,e)&&(C=0|t[0],j=0|t[1]):z(t,-D,D,2,e)&&(C=-(j=0|(0>t?-t:t)))),r[e]=[C,j],f(e="RANGE")&&(s(t)?z(t[0],-D,-1,2,e)&&z(t[1],1,D,2,e)&&(k=0|t[0],q=0|t[1]):z(t,-D,D,2,e)&&(0|t?k=-(q=0|(0>t?-t:t)):$&&U(2,e+" cannot be zero",t))),r[e]=[k,q],f(e="ERRORS")&&(t===!!t||1===t||0===t?(L=0,z=($=!!t)?A:u):$&&U(2,e+y,t)),r[e]=$,f(e="CRYPTO")&&(t===!!t||1===t||0===t?(V=!(!t||!g||"object"!=typeof g),t&&!V&&$&&U(2,"crypto unavailable",g)):$&&U(2,e+y,t)),r[e]=V,f(e="MODULO_MODE")&&z(t,0,9,2,e)&&(W=0|t),r[e]=W,f(e="POW_PRECISION")&&z(t,0,D,2,e)&&(Y=0|t),r[e]=Y,f(e="FORMAT")&&("object"==typeof t?Z=t:$&&U(2,e+" not an object",t)),r[e]=Z,r},e.max=function(){return S(arguments,M.lt)},e.min=function(){return S(arguments,M.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return w(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,f,u,s=0,c=[],a=new e(P);if(t=null!=t&&z(t,0,D,14)?0|t:B,f=v(t/I),V)if(g&&g.getRandomValues){for(r=g.getRandomValues(new Uint32Array(f*=2));f>s;)u=131072*r[s]+(r[s+1]>>>11),u>=9e15?(i=g.getRandomValues(new Uint32Array(2)),r[s]=i[0],r[s+1]=i[1]):(c.push(u%1e14),s+=2);s=f/2}else if(g&&g.randomBytes){for(r=g.randomBytes(f*=7);f>s;)u=281474976710656*(31&r[s])+1099511627776*r[s+1]+4294967296*r[s+2]+16777216*r[s+3]+(r[s+4]<<16)+(r[s+5]<<8)+r[s+6],u>=9e15?g.randomBytes(7).copy(r,s):(c.push(u%1e14),s+=7);s=f/7}else $&&U(14,"crypto unavailable",g);if(!s)for(;f>s;)u=n(),9e15>u&&(c[s++]=u%1e14);for(f=c[--s],t%=I,f&&t&&(u=_[I-t],c[s]=w(f/u)*u);0===c[s];c.pop(),s--);if(0>s)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(s=1,u=c[0];u>=10;u/=10,s++);I>s&&(o-=I-s)}return a.e=o,a.c=c,a}}(),G=function(){function t(t,e,n){var r,i,o,f,u=0,s=t.length,c=e%T,a=e/T|0;for(t=t.slice();s--;)o=t[s]%T,f=t[s]/T|0,r=a*o+f*c,i=c*o+r%T*T+u,u=(i/n|0)+(r/T|0)+a*f,t[s]=i%n;return u&&t.unshift(u),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,f,u,s,c){var a,l,p,h,g,m,d,v,y,b,O,N,x,_,T,D,S,A=o.s==f.s?1:-1,R=o.c,U=f.c;if(!(R&&R[0]&&U&&U[0]))return new e(o.s&&f.s&&(R?!U||R[0]!=U[0]:U)?R&&0==R[0]||!U?0*A:A/0:0/0);for(v=new e(A),y=v.c=[],l=o.e-f.e,A=u+l+1,c||(c=E,l=i(o.e/I)-i(f.e/I),A=A/I|0),p=0;U[p]==(R[p]||0);p++);if(U[p]>(R[p]||0)&&l--,0>A)y.push(1),h=!0;else{for(_=R.length,D=U.length,p=0,A+=2,g=w(c/(U[0]+1)),g>1&&(U=t(U,g,c),R=t(R,g,c),D=U.length,_=R.length),x=D,b=R.slice(0,D),O=b.length;D>O;b[O++]=0);S=U.slice(),S.unshift(0),T=U[0],U[1]>=c/2&&T++;do g=0,a=n(U,b,D,O),0>a?(N=b[0],D!=O&&(N=N*c+(b[1]||0)),g=w(N/T),g>1?(g>=c&&(g=c-1),m=t(U,g,c),d=m.length,O=b.length,a=n(m,b,d,O),1==a&&(g--,r(m,d>D?S:U,d,c))):(0==g&&(a=g=1),m=U.slice()),d=m.length,O>d&&m.unshift(0),r(b,m,O,c),-1==a&&(O=b.length,a=n(U,b,D,O),1>a&&(g++,r(b,O>D?S:U,O,c))),O=b.length):0===a&&(g++,b=[0]),y[p++]=g,a&&b[0]?b[O++]=R[x]||0:(b=[R[x]],O=1);while((x++<_||null!=b[0])&&A--);h=null!=b[0],y[0]||y.shift()}if(c==E){for(p=1,A=y[0];A>=10;A/=10,p++);F(v,u+(v.e=p+l*I-1)+1,s,h)}else v.e=l,v.r=+h;return v}}(),m==function(){var t=/^(-?)0([xbo])(\w[\w.]*$)/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+([\w.])|^\s+|\s+$/g;return function(f,u,s,c){var a,l=s?u:u.replace(o,"$1");if(i.test(l))f.s=isNaN(l)?null:0>l?-1:1;else{if(!s&&(l=l.replace(t,function(t,e,n){return a="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=a?t:e}),c&&(a=c,l=l.replace(n,"$1").replace(r,"0.$1")),u!=l))return new e(l,a);$&&U(L,"not a"+(c?" base "+c:"")+" number",u),f.s=null}f.c=f.e=null,L=0}}(),M.absoluteValue=M.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},M.ceil=function(){return F(new e(this),this.e+1,2)},M.comparedTo=M.cmp=function(t,n){return L=1,f(this,new e(t,n))},M.decimalPlaces=M.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},M.dividedBy=M.div=function(t,n){return L=3,G(this,new e(t,n),B,H)},M.dividedToIntegerBy=M.divToInt=function(t,n){return L=4,G(this,new e(t,n),0,1)},M.equals=M.eq=function(t,n){return L=5,0===f(this,new e(t,n))},M.floor=function(){return F(new e(this),this.e+1,3)},M.greaterThan=M.gt=function(t,n){return L=6,f(this,new e(t,n))>0},M.greaterThanOrEqualTo=M.gte=function(t,n){return L=7,1===(n=f(this,new e(t,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(t,n){return L=8,f(this,new e(t,n))<0},M.lessThanOrEqualTo=M.lte=function(t,n){return L=9,-1===(n=f(this,new e(t,n)))||0===n},M.minus=M.sub=function(t,n){var r,o,f,u,s=this,c=s.s;if(L=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,s.plus(t);var a=s.e/I,l=t.e/I,p=s.c,h=t.c;if(!a||!l){if(!p||!h)return p?(t.s=-n,t):new e(h?s:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?s:3==H?-0:0)}if(a=i(a),l=i(l),p=p.slice(),c=a-l){for((u=0>c)?(c=-c,f=p):(l=a,f=h),f.reverse(),n=c;n--;f.push(0));f.reverse()}else for(o=(u=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){u=p[n]0)for(;n--;p[r++]=0);for(n=E-1;o>c;){if(p[--o]0?(s=u,r=a):(f=-f,r=c),r.reverse();f--;r.push(0));r.reverse()}for(f=c.length,n=a.length,0>f-n&&(r=a,a=c,c=r,n=f),f=0;n;)f=(c[--n]=c[n]+a[n]+f)/E|0,c[n]%=E;return f&&(c.unshift(f),++s),R(t,c,s)},M.precision=M.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&($&&U(13,"argument"+y,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},M.round=function(t,n){var r=new e(this);return(null==t||z(t,0,D,15))&&F(r,~~t+this.e+1,null!=n&&z(n,0,8,15,b)?0|n:H),r},M.shift=function(t){var n=this;return z(t,-x,x,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-x>t||t>x)?n.s*(0>t?0:1/0):n)},M.squareRoot=M.sqrt=function(){var t,n,r,f,u,s=this,c=s.c,a=s.s,l=s.e,p=B+4,h=new e("0.5");if(1!==a||!c||!c[0])return new e(!a||0>a&&(!c||c[0])?0/0:c?s:1/0);if(a=Math.sqrt(+s),0==a||a==1/0?(n=o(c),(n.length+l)%2==0&&(n+="0"),a=Math.sqrt(n),l=i((l+1)/2)-(0>l||l%2),a==1/0?n="1e"+l:(n=a.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new e(n)):r=new e(a+""),r.c[0])for(l=r.e,a=l+p,3>a&&(a=0);;)if(u=r,r=h.times(u.plus(G(s,u,p,1))),o(u.c).slice(0,a)===(n=o(r.c)).slice(0,a)){if(r.ea&&(d=b,b=O,O=d,f=a,a=h,h=f),f=a+h,d=[];f--;d.push(0));for(v=E,w=T,f=h;--f>=0;){for(r=0,g=O[f]%w,m=O[f]/w|0,s=a,u=f+s;u>f;)l=b[--s]%w,p=b[s]/w|0,c=m*l+p*g,l=g*l+c%w*w+d[u]+r,r=(l/v|0)+(c/w|0)+m*p,d[u--]=l%v;d[u]=r}return r?++o:d.shift(),R(t,d,o)},M.toDigits=function(t,n){var r=new e(this);return t=null!=t&&z(t,1,D,18,"precision")?0|t:null,n=null!=n&&z(n,0,8,18,b)?0|n:H,t?F(r,t,n):r},M.toExponential=function(t,e){return h(this,null!=t&&z(t,0,D,19)?~~t+1:null,e,19)},M.toFixed=function(t,e){return h(this,null!=t&&z(t,0,D,20)?~~t+this.e+1:null,e,20)},M.toFormat=function(t,e){var n=h(this,null!=t&&z(t,0,D,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+Z.groupSize,f=+Z.secondaryGroupSize,u=Z.groupSeparator,s=i[0],c=i[1],a=this.s<0,l=a?s.slice(1):s,p=l.length;if(f&&(r=o,o=f,f=r,p-=r),o>0&&p>0){for(r=p%o||o,s=l.substr(0,r);p>r;r+=o)s+=u+l.substr(r,o);f>0&&(s+=u+l.slice(r)),a&&(s="-"+s)}n=c?s+Z.decimalSeparator+((f=+Z.fractionGroupSize)?c.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+Z.fractionGroupSeparator):c):s}return n},M.toFraction=function(t){var n,r,i,f,u,s,c,a,l,p=$,h=this,g=h.c,m=new e(P),d=r=new e(P),v=c=new e(P);if(null!=t&&($=!1,s=new e(t),$=p,(!(p=s.isInt())||s.lt(P))&&($&&U(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&s.c&&F(s,s.e+1,1).gte(P)?s:null)),!g)return h.toString();for(l=o(g),f=m.e=l.length-h.e-1,m.c[0]=_[(u=f%I)<0?I+u:u],t=!t||s.cmp(m)>0?f>0?m:d:s,u=q,q=1/0,s=new e(l),c.c[0]=0;a=G(s,m,0,1),i=r.plus(a.times(v)),1!=i.cmp(t);)r=v,v=i,d=c.plus(a.times(i=d)),c=i,m=s.minus(a.times(i=m)),s=i;return i=G(t.minus(r),v,0,1),c=c.plus(i.times(d)),r=r.plus(i.times(v)),c.s=d.s=h.s,f*=2,n=G(d,v,f,H).minus(h).abs().cmp(G(c,r,f,H).minus(h).abs())<1?[d.toString(),v.toString()]:[c.toString(),r.toString()],q=u,n},M.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},M.toPower=M.pow=function(t){var n,r,i=w(0>t?-t:+t),o=this;if(!z(t,-x,x,23,"exponent")&&(!isFinite(t)||i>x&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=Y?v(Y/I+2):0,r=new e(P);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=w(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=P.div(r)),n?F(r,Y,H):r},M.toPrecision=function(t,e){return h(this,null!=t&&z(t,1,D,24,"precision")?0|t:null,e,24)},M.toString=function(t){var e,r=this,i=r.s,f=r.e;return null===f?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&z(t,2,64,25,"base")?n(l(e,f),0|t,10,i):C>=f||f>=j?a(e,f):l(e,f),0>i&&r.c[0]&&(e="-"+e)),e},M.truncated=M.trunc=function(){return F(new e(this),this.e+1,1)},M.valueOf=M.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function f(t,e){var n,r,i=t.c,o=e.c,f=t.s,u=e.s,s=t.e,c=e.e;if(!f||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:f;if(f!=u)return f;if(n=0>f,r=s==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return s>c^n?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,f=0;u>f;f++)if(i[f]!=o[f])return i[f]>o[f]^n?1:-1;return s==c?0:s>c^n?1:-1}function u(t,e,n){return(t=p(t))>=e&&n>=t}function s(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],f=0,u=t.length;u>f;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=N.indexOf(t.charAt(f++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function a(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function l(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?v(t):w(t)}var h,g,m,d=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=Math.ceil,w=Math.floor,y=" not a boolean or binary digit",b="rounding mode",O="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",E=1e14,I=14,x=9007199254740991,_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],T=1e7,D=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!g)try{g=t("crypto")}catch(S){}}else n.BigNumber=h}(this)},{crypto:1}],natspec:[function(t,e){var n=t("./node_modules/expanse.js/lib/abi.js"),r=function(){var t=function(t,e){Object.keys(t).forEach(function(n){e[n]=t[n]})},e=function(t){return Object.keys(t).reduce(function(t,e){return t+"var "+e+" = context['"+e+"'];\n"},"")},r=function(t,e){return t.filter(function(t){return t.name===e})[0]},i=function(t,e){var r=n.formatOutput(t.inputs,"0x"+e.params[0].data.slice(10));return t.inputs.reduce(function(t,e,n){return t[e.name]=r[n],t},{})},o=function(t,e){var n,r="",i=/\` + "`" + `(?:\\.|[^` + "`" + `\\])*\` + "`" + `/gim,o=0;try{for(;null!==(n=i.exec(t));){var f=i.lastIndex-n[0].length,u=n[0].slice(1,n[0].length-1);r+=t.slice(o,f);var s=e(u);r+=s,o=i.lastIndex}r+=t.slice(o)}catch(c){throw new Error("Natspec evaluation failed, wrong input params")}return r},f=function(n,f){var u={};if(f)try{var s=r(f.abi,f.method),c=i(s,f.transaction);t(c,u)}catch(a){throw new Error("Natspec evaluation failed, method does not exist")}var l=e(u),p=o(n,function(t){var e=new Function("context",l+"return "+t+";");return e(u).toString()});return p},u=function(t,e){try{return f(t,e)}catch(n){return n.message}};return{evaluateExpression:f,evaluateExpressionSafe:u}}();e.exports=r},{"./node_modules/expanse.js/lib/abi.js":3}]},{},[]); ` require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o. + along with expanse.js. If not, see . */ /** * @file abi.js @@ -282,20 +282,20 @@ module.exports = { },{"../utils/config":6,"../utils/utils":7,"./formatters":3,"./types":4,"./utils":5}],3:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file formatters.js * @authors: @@ -482,20 +482,20 @@ module.exports = { },{"../utils/config":6,"../utils/utils":7,"bignumber.js":8}],4:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file types.js * @authors: @@ -561,20 +561,20 @@ module.exports = { },{"./formatters":3}],5:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file utils.js @@ -631,20 +631,20 @@ module.exports = { },{}],6:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file config.js * @authors: @@ -702,20 +702,20 @@ module.exports = { },{"bignumber.js":8}],7:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file utils.js * @authors: diff --git a/common/natspec/natspec_test.go b/common/natspec/natspec_test.go index 9ec14829a9..581bdd16f8 100644 --- a/common/natspec/natspec_test.go +++ b/common/natspec/natspec_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package natspec diff --git a/common/number/int.go b/common/number/int.go index 6dab2436de..2fb06fa5eb 100644 --- a/common/number/int.go +++ b/common/number/int.go @@ -1,25 +1,25 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package number import ( "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) var tt256 = new(big.Int).Lsh(big.NewInt(1), 256) diff --git a/common/number/uint_test.go b/common/number/uint_test.go index 3ab9e4c344..0ea54fa8a4 100644 --- a/common/number/uint_test.go +++ b/common/number/uint_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package number @@ -20,7 +20,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) func TestSet(t *testing.T) { diff --git a/common/package.go b/common/package.go index 4e8780c08a..1b2e270e55 100644 --- a/common/package.go +++ b/common/package.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common @@ -93,7 +93,7 @@ func FindFileInArchive(fn string, files []*zip.File) (index int) { // Open package // -// Opens a prepared ethereum package +// Opens a prepared expanse package // Reads the manifest file and determines file contents and returns and // the external package. func OpenPackage(fn string) (*ExtPackage, error) { diff --git a/common/path.go b/common/path.go index 8b3c7d14b8..ecc64ecbfa 100644 --- a/common/path.go +++ b/common/path.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common @@ -27,7 +27,7 @@ import ( "github.com/kardianos/osext" ) -// MakeName creates a node name that follows the ethereum convention +// MakeName creates a node name that follows the expanse convention // for such names. It adds the operation system name and Go runtime version // the name. func MakeName(name, version string) string { @@ -68,9 +68,9 @@ func AbsolutePath(Datadir string, filename string) string { func DefaultAssetPath() string { var assetPath string pwd, _ := os.Getwd() - srcdir := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "cmd", "mist") + srcdir := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "expanse", "go-expanse", "cmd", "mist") - // If the current working directory is the go-ethereum dir + // If the current working directory is the go-expanse dir // assume a debug build and use the source directory as // asset directory. if pwd == srcdir { @@ -102,17 +102,17 @@ func DefaultAssetPath() string { func DefaultDataDir() string { usr, _ := user.Current() if runtime.GOOS == "darwin" { - return filepath.Join(usr.HomeDir, "Library", "Ethereum") + return filepath.Join(usr.HomeDir, "Library", "Expanse") } else if runtime.GOOS == "windows" { - return filepath.Join(usr.HomeDir, "AppData", "Roaming", "Ethereum") + return filepath.Join(usr.HomeDir, "AppData", "Roaming", "Expanse") } else { - return filepath.Join(usr.HomeDir, ".ethereum") + return filepath.Join(usr.HomeDir, ".expanse") } } func DefaultIpcPath() string { if runtime.GOOS == "windows" { - return `\\.\pipe\geth.ipc` + return `\\.\pipe\gexp.ipc` } - return filepath.Join(DefaultDataDir(), "geth.ipc") + return filepath.Join(DefaultDataDir(), "gexp.ipc") } diff --git a/common/path_test.go b/common/path_test.go new file mode 100644 index 0000000000..0929fc50cb --- /dev/null +++ b/common/path_test.go @@ -0,0 +1,52 @@ +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. +// +// The go-expanse library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-expanse library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-expanse library. If not, see . + +package common + +import ( + "os" + // "testing" + + checker "gopkg.in/check.v1" +) + +type CommonSuite struct{} + +var _ = checker.Suite(&CommonSuite{}) + +func (s *CommonSuite) TestOS(c *checker.C) { + expwin := (os.PathSeparator == '\\' && os.PathListSeparator == ';') + res := IsWindows() + + if !expwin { + c.Assert(res, checker.Equals, expwin, checker.Commentf("IsWindows is", res, "but path is", os.PathSeparator)) + } else { + c.Assert(res, checker.Not(checker.Equals), expwin, checker.Commentf("IsWindows is", res, "but path is", os.PathSeparator)) + } +} + +func (s *CommonSuite) TestWindonziePath(c *checker.C) { + iswindowspath := os.PathSeparator == '\\' + path := "/opt/exp/test/file.ext" + res := WindonizePath(path) + ressep := string(res[0]) + + if !iswindowspath { + c.Assert(ressep, checker.Equals, "/") + } else { + c.Assert(ressep, checker.Not(checker.Equals), "/") + } +} diff --git a/common/registrar/contracts.go b/common/registrar/contracts.go index cd80dfcaba..afd6eac4cd 100644 --- a/common/registrar/contracts.go +++ b/common/registrar/contracts.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package registrar diff --git a/common/registrar/ethreg/ethreg.go b/common/registrar/ethreg/ethreg.go index 626ebe1d74..aee131a1f7 100644 --- a/common/registrar/ethreg/ethreg.go +++ b/common/registrar/ethreg/ethreg.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package ethreg import ( "math/big" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/common/registrar" + "github.com/expanse-project/go-expanse/xeth" ) // implements a versioned Registrar on an archiving full node diff --git a/common/registrar/registrar.go b/common/registrar/registrar.go index d891e161e7..9d09d8c6e8 100644 --- a/common/registrar/registrar.go +++ b/common/registrar/registrar.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package registrar @@ -22,15 +22,15 @@ import ( "math/big" "regexp" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) /* -Registrar implements the Ethereum name registrar services mapping -- arbitrary strings to ethereum addresses +Registrar implements the Expanse name registrar services mapping +- arbitrary strings to expanse addresses - hashes to hashes - hashes to arbitrary strings (likely will provide lookup service for all three) diff --git a/common/registrar/registrar_test.go b/common/registrar/registrar_test.go index 63f2835638..2aeb4df52d 100644 --- a/common/registrar/registrar_test.go +++ b/common/registrar/registrar_test.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package registrar import ( "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) type testBackend struct { diff --git a/common/rlp.go b/common/rlp.go index 481b451b1b..5c76413a5d 100644 --- a/common/rlp.go +++ b/common/rlp.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/rlp_test.go b/common/rlp_test.go index 2320ffe3c2..aeb232f605 100644 --- a/common/rlp_test.go +++ b/common/rlp_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common @@ -22,7 +22,7 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/rlp" ) func TestNonInterfaceSlice(t *testing.T) { diff --git a/common/size.go b/common/size.go index 9653b36298..62e4358e86 100644 --- a/common/size.go +++ b/common/size.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/size_test.go b/common/size_test.go index ce19cab69f..60133d0e45 100644 --- a/common/size_test.go +++ b/common/size_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/test_utils.go b/common/test_utils.go index a848642f77..063b696e36 100644 --- a/common/test_utils.go +++ b/common/test_utils.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/types.go b/common/types.go index 624f4b8265..908ed8245d 100644 --- a/common/types.go +++ b/common/types.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/types_template.go b/common/types_template.go index 8048f9cc3f..748e5dea83 100644 --- a/common/types_template.go +++ b/common/types_template.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // +build none //sed -e 's/_N_/Hash/g' -e 's/_S_/32/g' -e '1d' types_template.go | gofmt -w hash.go diff --git a/common/types_test.go b/common/types_test.go index edf8d4d142..9b710a1ead 100644 --- a/common/types_test.go +++ b/common/types_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/common/value.go b/common/value.go index 7abbf67b15..b76d5d1b0b 100644 --- a/common/value.go +++ b/common/value.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common @@ -24,7 +24,7 @@ import ( "reflect" "strconv" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/rlp" ) // Value can hold values of certain basic types and provides ways to diff --git a/common/value_test.go b/common/value_test.go index ac2ef02a70..23d329d263 100644 --- a/common/value_test.go +++ b/common/value_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package common diff --git a/compression/rle/read_write.go b/compression/rle/read_write.go index 19133119b3..b7698ea435 100644 --- a/compression/rle/read_write.go +++ b/compression/rle/read_write.go @@ -1,27 +1,27 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package rle implements the run-length encoding used for Ethereum data. +// Package rle implements the run-length encoding used for Expanse data. package rle import ( "bytes" "errors" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/crypto" ) const ( diff --git a/compression/rle/read_write_test.go b/compression/rle/read_write_test.go index ba39650256..c19fd796d1 100644 --- a/compression/rle/read_write_test.go +++ b/compression/rle/read_write_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package rle diff --git a/core/asm.go b/core/asm.go index a86a2c44c3..acbf6d9372 100644 --- a/core/asm.go +++ b/core/asm.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -20,8 +20,8 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/vm" ) func Disassemble(script []byte) (asm []string) { diff --git a/core/bad_block.go b/core/bad_block.go index cd3fb575a8..1239431b42 100644 --- a/core/bad_block.go +++ b/core/bad_block.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -22,11 +22,11 @@ import ( "io/ioutil" "net/http" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rlp" ) // DisabledBadBlockReporting can be set to prevent blocks being reported. diff --git a/core/bench_test.go b/core/bench_test.go index baae8a7a5e..e9c89fb5ea 100644 --- a/core/bench_test.go +++ b/core/bench_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -23,12 +23,12 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/params" ) func BenchmarkInsertChain_empty_memdb(b *testing.B) { @@ -148,7 +148,7 @@ func benchInsertChain(b *testing.B, disk bool, gen func(int, *BlockGen)) { if !disk { db, _ = ethdb.NewMemDatabase() } else { - dir, err := ioutil.TempDir("", "eth-core-bench") + dir, err := ioutil.TempDir("", "exp-core-bench") if err != nil { b.Fatalf("cannot create temporary directory: %v", err) } diff --git a/core/block_cache.go b/core/block_cache.go index 0fd7114488..6c8a5bf67f 100644 --- a/core/block_cache.go +++ b/core/block_cache.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core import ( "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" ) // BlockCache implements a caching mechanism specifically for blocks and uses FILO to pop diff --git a/core/block_cache_test.go b/core/block_cache_test.go index ef826d5bda..33b76296fc 100644 --- a/core/block_cache_test.go +++ b/core/block_cache_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -20,8 +20,8 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" ) func newChain(size int) (chain []*types.Block) { diff --git a/core/block_processor.go b/core/block_processor.go index 99d27fa717..a47ee24000 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -22,15 +22,15 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/pow" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/params" + "github.com/expanse-project/go-expanse/pow" "gopkg.in/fatih/set.v0" ) diff --git a/core/block_processor_test.go b/core/block_processor_test.go index e0b2d3313f..3af0926bf1 100644 --- a/core/block_processor_test.go +++ b/core/block_processor_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -21,12 +21,12 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/pow/ezp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/pow/ezp" ) func proc() (*BlockProcessor, *ChainManager) { diff --git a/core/blocks.go b/core/blocks.go index ecccc541f0..f01e6f1bf4 100644 --- a/core/blocks.go +++ b/core/blocks.go @@ -1,22 +1,22 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core -import "github.com/ethereum/go-ethereum/common" +import "github.com/expanse-project/go-expanse/common" // Set of manually tracked bad hashes (usually hard forks) var BadHashes = map[common.Hash]bool{ diff --git a/core/canary.go b/core/canary.go index 69db18e582..be853e6acb 100644 --- a/core/canary.go +++ b/core/canary.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" ) var ( diff --git a/core/chain_makers.go b/core/chain_makers.go index b009e0c28c..2a9be36c91 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -1,29 +1,29 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/pow" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/pow" ) // FakePow is a non-validating proof of work implementation. diff --git a/core/chain_makers_test.go b/core/chain_makers_test.go index 1c868624df..807db53d44 100644 --- a/core/chain_makers_test.go +++ b/core/chain_makers_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -20,11 +20,11 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/params" ) func ExampleGenerateChain() { diff --git a/core/chain_manager.go b/core/chain_manager.go index c8127951ea..25515dbd4c 100644 --- a/core/chain_manager.go +++ b/core/chain_manager.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package core implements the Ethereum consensus protocol. +// Package core implements the Expanse consensus protocol. package core import ( @@ -27,14 +27,14 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/metrics" - "github.com/ethereum/go-ethereum/pow" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/metrics" + "github.com/expanse-project/go-expanse/pow" "github.com/hashicorp/golang-lru" ) @@ -103,7 +103,7 @@ func NewChainManager(chainDb common.Database, pow pow.PoW, mux *event.TypeMux) ( if err != nil { return nil, err } - glog.V(logger.Info).Infoln("WARNING: Wrote default ethereum genesis block") + glog.V(logger.Info).Infoln("WARNING: Wrote default expanse genesis block") } if err := bc.setLastState(); err != nil { diff --git a/core/chain_manager_test.go b/core/chain_manager_test.go index 002dcbe446..b33d5dde7f 100644 --- a/core/chain_manager_test.go +++ b/core/chain_manager_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -26,14 +26,14 @@ import ( "strconv" "testing" - "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/pow" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/ethash" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/pow" + "github.com/expanse-project/go-expanse/rlp" "github.com/hashicorp/golang-lru" ) diff --git a/core/chain_util.go b/core/chain_util.go index 84b462ce3d..4412137e33 100644 --- a/core/chain_util.go +++ b/core/chain_util.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -21,12 +21,12 @@ import ( "math/big" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/params" + "github.com/expanse-project/go-expanse/rlp" ) var ( diff --git a/core/chain_util_test.go b/core/chain_util_test.go index 4bbe811942..095e4b2735 100644 --- a/core/chain_util_test.go +++ b/core/chain_util_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -22,7 +22,7 @@ import ( "os" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) type diffTest struct { diff --git a/core/default_genesis.go b/core/default_genesis.go index f8acda9fb6..8d0b70fdc1 100644 --- a/core/default_genesis.go +++ b/core/default_genesis.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core diff --git a/core/error.go b/core/error.go index 09eea22d6d..c7e023733d 100644 --- a/core/error.go +++ b/core/error.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -21,7 +21,7 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) var ( diff --git a/core/events.go b/core/events.go index a487fc51d4..1ca656c5c5 100644 --- a/core/events.go +++ b/core/events.go @@ -1,27 +1,27 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" ) // TxPreEvent is posted when a transaction enters the transaction pool. diff --git a/core/execution.go b/core/execution.go index 3a136515df..91f63d0366 100644 --- a/core/execution.go +++ b/core/execution.go @@ -1,29 +1,29 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/params" ) // Execution is the execution environment for the given call or create action. @@ -61,7 +61,7 @@ func (self *Execution) Create(caller vm.ContextRef) (ret []byte, err error, acco self.input = nil ret, err = self.exec(nil, code, caller) // Here we get an error if we run into maximum stack depth, - // See: https://github.com/ethereum/yellowpaper/pull/131 + // See: https://github.com/expanse-project/yellowpaper/pull/131 // and YP definitions for CREATE instruction if err != nil { return nil, err, nil diff --git a/core/fees.go b/core/fees.go index 0bb26f0552..98adc603d9 100644 --- a/core/fees.go +++ b/core/fees.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -20,4 +20,4 @@ import ( "math/big" ) -var BlockReward *big.Int = big.NewInt(5e+18) +var BlockReward *big.Int = big.NewInt(6e+18) diff --git a/core/filter.go b/core/filter.go index c34d6ff6cc..2a16131a87 100644 --- a/core/filter.go +++ b/core/filter.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -32,7 +32,7 @@ type AccountChange struct { // Filtering interface type Filter struct { - eth Backend + exp Backend earliest int64 latest int64 skip int @@ -47,8 +47,8 @@ type Filter struct { // Create a new filter which uses a bloom filter on blocks to figure out whether a particular block // is interesting or not. -func NewFilter(eth Backend) *Filter { - return &Filter{eth: eth} +func NewFilter(exp Backend) *Filter { + return &Filter{exp: exp} } // Set the earliest and latest block for filtering. @@ -80,7 +80,7 @@ func (self *Filter) SetSkip(skip int) { // Run filters logs with the current parameters set func (self *Filter) Find() state.Logs { - earliestBlock := self.eth.ChainManager().CurrentBlock() + earliestBlock := self.exp.ChainManager().CurrentBlock() var earliestBlockNo uint64 = uint64(self.earliest) if self.earliest == -1 { earliestBlockNo = earliestBlock.NumberU64() @@ -92,7 +92,7 @@ func (self *Filter) Find() state.Logs { var ( logs state.Logs - block = self.eth.ChainManager().GetBlockByNumber(latestBlockNo) + block = self.exp.ChainManager().GetBlockByNumber(latestBlockNo) ) done: @@ -111,7 +111,7 @@ done: // current parameters if self.bloomFilter(block) { // Get the logs of the block - unfiltered, err := self.eth.BlockProcessor().GetLogs(block) + unfiltered, err := self.exp.BlockProcessor().GetLogs(block) if err != nil { glog.V(logger.Warn).Infoln("err: filter get logs ", err) @@ -121,7 +121,7 @@ done: logs = append(logs, self.FilterLogs(unfiltered)...) } - block = self.eth.ChainManager().GetBlock(block.ParentHash()) + block = self.exp.ChainManager().GetBlock(block.ParentHash()) } skip := int(math.Min(float64(len(logs)), float64(self.skip))) diff --git a/core/filter_test.go b/core/filter_test.go index 58e71e305d..693bf7c10a 100644 --- a/core/filter_test.go +++ b/core/filter_test.go @@ -1,17 +1,17 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core diff --git a/core/genesis.go b/core/genesis.go index 7d4e03c990..ac5ddeed3a 100644 --- a/core/genesis.go +++ b/core/genesis.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -24,12 +24,12 @@ import ( "math/big" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/params" ) // WriteGenesisBlock writes the genesis block to the database as block number 0 diff --git a/core/helper_test.go b/core/helper_test.go index b21f31d7c8..1b9fdefe58 100644 --- a/core/helper_test.go +++ b/core/helper_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -20,11 +20,11 @@ import ( "container/list" "fmt" - "github.com/ethereum/go-ethereum/core/types" - // "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" + "github.com/expanse-project/go-expanse/core/types" + // "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" ) // Implement our EthTest Manager diff --git a/core/manager.go b/core/manager.go index 8b0401b031..ce62e63059 100644 --- a/core/manager.go +++ b/core/manager.go @@ -1,25 +1,25 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core import ( - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/event" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/event" ) // TODO move this to types? diff --git a/core/state/dump.go b/core/state/dump.go index 9acb8a0244..a507b1a750 100644 --- a/core/state/dump.go +++ b/core/state/dump.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package state @@ -20,7 +20,7 @@ import ( "encoding/json" "fmt" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) type Account struct { diff --git a/core/state/errors.go b/core/state/errors.go index a08ed2d23d..1d120e8970 100644 --- a/core/state/errors.go +++ b/core/state/errors.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package state diff --git a/core/state/log.go b/core/state/log.go index 5d7d7357dd..9433c4d447 100644 --- a/core/state/log.go +++ b/core/state/log.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package state @@ -20,8 +20,8 @@ import ( "fmt" "io" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/rlp" ) type Log struct { diff --git a/core/state/main_test.go b/core/state/main_test.go index cd9661031f..1d01867c37 100644 --- a/core/state/main_test.go +++ b/core/state/main_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package state diff --git a/core/state/managed_state.go b/core/state/managed_state.go index 4df0479791..38038186b6 100644 --- a/core/state/managed_state.go +++ b/core/state/managed_state.go @@ -1,25 +1,25 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package state import ( "sync" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) type account struct { diff --git a/core/state/managed_state_test.go b/core/state/managed_state_test.go index 58e77d842b..34b32564f7 100644 --- a/core/state/managed_state_test.go +++ b/core/state/managed_state_test.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package state import ( "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/ethdb" ) var addr = common.BytesToAddress([]byte("test")) diff --git a/core/state/state_object.go b/core/state/state_object.go index c76feb7743..62988ae31d 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package state @@ -21,12 +21,12 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rlp" + "github.com/expanse-project/go-expanse/trie" ) type Code []byte diff --git a/core/state/state_test.go b/core/state/state_test.go index 5972d266a9..293ed6cc18 100644 --- a/core/state/state_test.go +++ b/core/state/state_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package state @@ -22,8 +22,8 @@ import ( checker "gopkg.in/check.v1" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/ethdb" ) type StateSuite struct { diff --git a/core/state/statedb.go b/core/state/statedb.go index 577f7162eb..d4f22877ab 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1,33 +1,33 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package state provides a caching layer atop the Ethereum state trie. +// Package state provides a caching layer atop the Expanse state trie. package state import ( "bytes" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/trie" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/trie" ) -// StateDBs within the ethereum protocol are used to store anything +// StateDBs within the expanse protocol are used to store anything // within the merkle trie. StateDBs take care of caching and storing // nested states. It's the general query interface to retrieve: // * Contracts diff --git a/core/state_transition.go b/core/state_transition.go index a5d4fc19b9..b2f305c6cc 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -20,12 +20,12 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/params" ) /* diff --git a/core/transaction_pool.go b/core/transaction_pool.go index 42e26b3b38..0fd1230b76 100644 --- a/core/transaction_pool.go +++ b/core/transaction_pool.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -23,12 +23,12 @@ import ( "sort" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) var ( diff --git a/core/transaction_pool_test.go b/core/transaction_pool_test.go index 7d09847401..edbc1e03c0 100644 --- a/core/transaction_pool_test.go +++ b/core/transaction_pool_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core @@ -21,12 +21,12 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" ) func transaction(nonce uint64, gaslimit *big.Int, key *ecdsa.PrivateKey) *types.Transaction { diff --git a/core/transaction_util.go b/core/transaction_util.go index ce2ceac463..625ffcf158 100644 --- a/core/transaction_util.go +++ b/core/transaction_util.go @@ -1,28 +1,28 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rlp" "github.com/syndtr/goleveldb/leveldb" ) diff --git a/core/types/block.go b/core/types/block.go index 2188e6d4da..7cf9aae5d5 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package types contains data types related to Ethereum consensus. +// Package types contains data types related to Expanse consensus. package types import ( @@ -28,9 +28,9 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto/sha3" + "github.com/expanse-project/go-expanse/rlp" ) // A BlockNonce is a 64-bit hash which proves (combined with the @@ -131,7 +131,7 @@ type Block struct { // of the chain up to and including the block. Td *big.Int - // ReceivedAt is used by package eth to track block propagation time. + // ReceivedAt is used by package exp to track block propagation time. ReceivedAt time.Time } @@ -140,7 +140,7 @@ type Block struct { // would otherwise need to be recomputed. type StorageBlock Block -// "external" block encoding. used for eth protocol, etc. +// "external" block encoding. used for exp protocol, etc. type extblock struct { Header *Header Txs []*Transaction diff --git a/core/types/block_test.go b/core/types/block_test.go index cdd8431f4d..ea2436c02b 100644 --- a/core/types/block_test.go +++ b/core/types/block_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package types @@ -22,8 +22,8 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/rlp" ) // from bcValidBlockTest.json, "SimpleTx" diff --git a/core/types/bloom9.go b/core/types/bloom9.go index 0629b31d45..a02f716c09 100644 --- a/core/types/bloom9.go +++ b/core/types/bloom9.go @@ -1,27 +1,27 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package types import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/crypto" ) type bytesBacked interface { diff --git a/core/types/bloom9_test.go b/core/types/bloom9_test.go index f020670b1c..1691fc89b9 100644 --- a/core/types/bloom9_test.go +++ b/core/types/bloom9_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package types @@ -20,7 +20,7 @@ package types import ( "testing" - "github.com/ethereum/go-ethereum/core/state" + "github.com/expanse-project/go-expanse/core/state" ) func TestBloom9(t *testing.T) { diff --git a/core/types/common.go b/core/types/common.go index de6efcd86b..65a6d4a992 100644 --- a/core/types/common.go +++ b/core/types/common.go @@ -1,26 +1,26 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package types import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" "fmt" ) diff --git a/core/types/derive_sha.go b/core/types/derive_sha.go index 478edb0e81..99bcd1b407 100644 --- a/core/types/derive_sha.go +++ b/core/types/derive_sha.go @@ -1,26 +1,26 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package types import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/trie" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/rlp" + "github.com/expanse-project/go-expanse/trie" ) type DerivableList interface { diff --git a/core/types/receipt.go b/core/types/receipt.go index e01d690052..57e6912e45 100644 --- a/core/types/receipt.go +++ b/core/types/receipt.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package types @@ -22,9 +22,9 @@ import ( "io" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/rlp" ) type Receipt struct { diff --git a/core/types/transaction.go b/core/types/transaction.go index 28a7e02b31..b9246ad456 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package types @@ -24,11 +24,11 @@ import ( "math/big" "sync/atomic" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rlp" ) var ErrInvalidSig = errors.New("invalid v, r, s values") diff --git a/core/types/transaction_test.go b/core/types/transaction_test.go index 1c0e27d9a4..54a417a82b 100644 --- a/core/types/transaction_test.go +++ b/core/types/transaction_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package types @@ -22,13 +22,13 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/rlp" ) // The values in those tests are from the Transaction Tests -// at github.com/ethereum/tests. +// at github.com/expanse-project/tests. var ( emptyTx = NewTransaction( diff --git a/core/vm/analysis.go b/core/vm/analysis.go index a0f6158217..c064d95355 100644 --- a/core/vm/analysis.go +++ b/core/vm/analysis.go @@ -1,25 +1,25 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm import ( "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) var bigMaxUint64 = new(big.Int).SetUint64(^uint64(0)) diff --git a/core/vm/asm.go b/core/vm/asm.go index 639201e50b..a4dddf52d8 100644 --- a/core/vm/asm.go +++ b/core/vm/asm.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm @@ -20,7 +20,7 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) func Disassemble(script []byte) (asm []string) { diff --git a/core/vm/common.go b/core/vm/common.go index 2e03ec80bb..718fd9a9f7 100644 --- a/core/vm/common.go +++ b/core/vm/common.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm @@ -20,8 +20,8 @@ import ( "math" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/logger/glog" ) // Global Debug flag indicating Debug VM (full logging) diff --git a/core/vm/context.go b/core/vm/context.go index d17934ba59..26205f5e0b 100644 --- a/core/vm/context.go +++ b/core/vm/context.go @@ -1,25 +1,25 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm import ( "math/big" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) type ContextRef interface { diff --git a/core/vm/contracts.go b/core/vm/contracts.go index b965fa095c..8d2c74dd03 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -1,29 +1,29 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/params" ) type Address interface { diff --git a/core/vm/disasm.go b/core/vm/disasm.go index 2bfea5cbda..616a4521b8 100644 --- a/core/vm/disasm.go +++ b/core/vm/disasm.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm diff --git a/core/vm/environment.go b/core/vm/environment.go index 916081f513..08ebdc875c 100644 --- a/core/vm/environment.go +++ b/core/vm/environment.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm @@ -20,8 +20,8 @@ import ( "errors" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" ) // Environment is is required by the virtual machine to get information from diff --git a/core/vm/errors.go b/core/vm/errors.go index 24567e9a1e..b9a211b821 100644 --- a/core/vm/errors.go +++ b/core/vm/errors.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm @@ -20,7 +20,7 @@ import ( "errors" "fmt" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/params" ) var OutOfGasError = errors.New("Out of gas") diff --git a/core/vm/gas.go b/core/vm/gas.go index b2f068e6e1..bd52ba43ed 100644 --- a/core/vm/gas.go +++ b/core/vm/gas.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm @@ -20,7 +20,7 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/params" ) var ( diff --git a/core/vm/logger.go b/core/vm/logger.go index 736f595f6b..6d4cb26833 100644 --- a/core/vm/logger.go +++ b/core/vm/logger.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm @@ -21,7 +21,7 @@ import ( "os" "unicode" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) func StdErrFormat(logs []StructLog) { diff --git a/core/vm/memory.go b/core/vm/memory.go index 0109050d7c..7ebd244a19 100644 --- a/core/vm/memory.go +++ b/core/vm/memory.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm diff --git a/core/vm/opcodes.go b/core/vm/opcodes.go index ecced3650b..f7abce5f79 100644 --- a/core/vm/opcodes.go +++ b/core/vm/opcodes.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm diff --git a/core/vm/settings.go b/core/vm/settings.go index f9296f6c8b..1c6d579f92 100644 --- a/core/vm/settings.go +++ b/core/vm/settings.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm diff --git a/core/vm/stack.go b/core/vm/stack.go index 009ac9e1b6..13bd53a5df 100644 --- a/core/vm/stack.go +++ b/core/vm/stack.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm diff --git a/core/vm/virtual_machine.go b/core/vm/virtual_machine.go index 047723744e..4b87e1f731 100644 --- a/core/vm/virtual_machine.go +++ b/core/vm/virtual_machine.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm diff --git a/core/vm/vm.go b/core/vm/vm.go index d9e1a0ce50..73160617ba 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package vm implements the Ethereum Virtual Machine. +// Package vm implements the Expanse Virtual Machine. package vm import ( diff --git a/core/vm/vm_jit.go b/core/vm/vm_jit.go index 339cb8ea8a..103faa8c0b 100644 --- a/core/vm/vm_jit.go +++ b/core/vm/vm_jit.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // +build evmjit @@ -25,7 +25,7 @@ int evmjit_run(void* _jit, void* _data, void* _env); void evmjit_destroy(void* _jit); // Shared library evmjit (e.g. libevmjit.so) is expected to be installed in /usr/local/lib -// More: https://github.com/ethereum/evmjit +// More: https://github.com/expanse-project/evmjit #cgo LDFLAGS: -levmjit */ import "C" @@ -37,9 +37,9 @@ import ( "math/big" "unsafe" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/params" ) type JitVm struct { diff --git a/core/vm/vm_jit_fake.go b/core/vm/vm_jit_fake.go index 456fcb8d4b..ebb382238f 100644 --- a/core/vm/vm_jit_fake.go +++ b/core/vm/vm_jit_fake.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // +build !evmjit diff --git a/core/vm_env.go b/core/vm_env.go index a08f024fe7..77eb5ec012 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -1,28 +1,28 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package core import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/core/vm" ) type VMEnv struct { diff --git a/crypto/crypto.go b/crypto/crypto.go index a474d6f13f..04102e0487 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package crypto @@ -34,11 +34,11 @@ import ( "errors" "code.google.com/p/go-uuid/uuid" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/crypto/secp256k1" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto/ecies" + "github.com/expanse-project/go-expanse/crypto/secp256k1" + "github.com/expanse-project/go-expanse/crypto/sha3" + "github.com/expanse-project/go-expanse/rlp" "golang.org/x/crypto/pbkdf2" "golang.org/x/crypto/ripemd160" ) @@ -68,7 +68,7 @@ func Sha3Hash(data ...[]byte) (h common.Hash) { return h } -// Creates an ethereum address given the bytes and the nonce +// Creates an expanse address given the bytes and the nonce func CreateAddress(b common.Address, nonce uint64) common.Address { data, _ := rlp.EncodeToBytes([]interface{}{b, nonce}) return common.BytesToAddress(Sha3(data)[12:]) @@ -250,7 +250,7 @@ func decryptPreSaleKey(fileContent []byte, password string) (key *Key, err error iv := encSeedBytes[:16] cipherText := encSeedBytes[16:] /* - See https://github.com/ethereum/pyethsaletool + See https://github.com/expanse-project/pyethsaletool pyethsaletool generates the encryption key from password by 2000 rounds of PBKDF2 with HMAC-SHA-256 using password as salt (:(). diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index b891f41a9a..c73c88bb9d 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package crypto @@ -23,8 +23,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/secp256k1" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto/secp256k1" ) // These tests are sanity checks. diff --git a/crypto/encrypt_decrypt_test.go b/crypto/encrypt_decrypt_test.go index fcf40b70fd..d1366cc48f 100644 --- a/crypto/encrypt_decrypt_test.go +++ b/crypto/encrypt_decrypt_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package crypto @@ -21,7 +21,7 @@ import ( "fmt" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) func TestBox(t *testing.T) { diff --git a/crypto/key.go b/crypto/key.go index d80b997598..024266f6ea 100644 --- a/crypto/key.go +++ b/crypto/key.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package crypto @@ -24,7 +24,7 @@ import ( "io" "code.google.com/p/go-uuid/uuid" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) const ( diff --git a/crypto/key_store_passphrase.go b/crypto/key_store_passphrase.go index f21af8dd9f..d1edac838f 100644 --- a/crypto/key_store_passphrase.go +++ b/crypto/key_store_passphrase.go @@ -1,25 +1,25 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . /* This key store behaves as KeyStorePlain with the difference that the private key is encrypted and on disk uses another JSON encoding. -The crypto is documented at https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition +The crypto is documented at https://github.com/expanse-project/wiki/wiki/Web3-Secret-Storage-Definition */ @@ -37,8 +37,8 @@ import ( "reflect" "code.google.com/p/go-uuid/uuid" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/randentropy" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto/randentropy" "golang.org/x/crypto/pbkdf2" "golang.org/x/crypto/scrypt" ) diff --git a/crypto/key_store_plain.go b/crypto/key_store_plain.go index c1c23f8b8b..31cc283baa 100644 --- a/crypto/key_store_plain.go +++ b/crypto/key_store_plain.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package crypto @@ -26,7 +26,7 @@ import ( "path/filepath" "time" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) type KeyStore interface { diff --git a/crypto/key_store_test.go b/crypto/key_store_test.go index fda87ddc87..55d843f7d1 100644 --- a/crypto/key_store_test.go +++ b/crypto/key_store_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package crypto @@ -22,8 +22,8 @@ import ( "reflect" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/randentropy" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto/randentropy" ) func TestKeyStorePlain(t *testing.T) { @@ -117,7 +117,7 @@ func TestImportPreSaleKey(t *testing.T) { } } -// Test and utils for the key store tests in the Ethereum JSON tests; +// Test and utils for the key store tests in the Expanse JSON tests; // tests/KeyStoreTests/basic_tests.json type KeyStoreTestV3 struct { Json encryptedKeyJSONV3 diff --git a/crypto/keypair.go b/crypto/keypair.go new file mode 100644 index 0000000000..913369c7ec --- /dev/null +++ b/crypto/keypair.go @@ -0,0 +1,66 @@ +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. +// +// The go-expanse library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-expanse library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-expanse library. If not, see . + +package crypto + +import ( + "strings" + + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto/secp256k1" +) + +type KeyPair struct { + PrivateKey []byte + PublicKey []byte + address []byte + mnemonic string + // The associated account + // account *StateObject +} + +func GenerateNewKeyPair() *KeyPair { + _, prv := secp256k1.GenerateKeyPair() + keyPair, _ := NewKeyPairFromSec(prv) // swallow error, this one cannot err + return keyPair +} + +func NewKeyPairFromSec(seckey []byte) (*KeyPair, error) { + pubkey, err := secp256k1.GeneratePubKey(seckey) + if err != nil { + return nil, err + } + + return &KeyPair{PrivateKey: seckey, PublicKey: pubkey}, nil +} + +func (k *KeyPair) Address() []byte { + if k.address == nil { + k.address = Sha3(k.PublicKey[1:])[12:] + } + return k.address +} + +func (k *KeyPair) Mnemonic() string { + if k.mnemonic == "" { + k.mnemonic = strings.Join(MnemonicEncode(common.Bytes2Hex(k.PrivateKey)), " ") + } + return k.mnemonic +} + +func (k *KeyPair) AsStrings() (string, string, string, string) { + return k.Mnemonic(), common.Bytes2Hex(k.Address()), common.Bytes2Hex(k.PrivateKey), common.Bytes2Hex(k.PublicKey) +} diff --git a/crypto/mnemonic.go b/crypto/mnemonic.go new file mode 100644 index 0000000000..a1c08dd48c --- /dev/null +++ b/crypto/mnemonic.go @@ -0,0 +1,76 @@ +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. +// +// The go-expanse library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-expanse library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-expanse library. If not, see . + +package crypto + +import ( + "fmt" + "strconv" +) + +// TODO: See if we can refactor this into a shared util lib if we need it multiple times +func IndexOf(slice []string, value string) int64 { + for p, v := range slice { + if v == value { + return int64(p) + } + } + return -1 +} + +func MnemonicEncode(message string) []string { + var out []string + n := int64(len(MnemonicWords)) + + for i := 0; i < len(message); i += (len(message) / 8) { + x := message[i : i+8] + bit, _ := strconv.ParseInt(x, 16, 64) + w1 := (bit % n) + w2 := ((bit / n) + w1) % n + w3 := ((bit / n / n) + w2) % n + out = append(out, MnemonicWords[w1], MnemonicWords[w2], MnemonicWords[w3]) + } + return out +} + +func MnemonicDecode(wordsar []string) string { + var out string + n := int64(len(MnemonicWords)) + + for i := 0; i < len(wordsar); i += 3 { + word1 := wordsar[i] + word2 := wordsar[i+1] + word3 := wordsar[i+2] + w1 := IndexOf(MnemonicWords, word1) + w2 := IndexOf(MnemonicWords, word2) + w3 := IndexOf(MnemonicWords, word3) + + y := (w2 - w1) % n + z := (w3 - w2) % n + + // Golang handles modulo with negative numbers different then most languages + // The modulo can be negative, we don't want that. + if z < 0 { + z += n + } + if y < 0 { + y += n + } + x := w1 + n*(y) + n*n*(z) + out += fmt.Sprintf("%08x", x) + } + return out +} diff --git a/crypto/mnemonic_test.go b/crypto/mnemonic_test.go new file mode 100644 index 0000000000..9a9036f527 --- /dev/null +++ b/crypto/mnemonic_test.go @@ -0,0 +1,90 @@ +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. +// +// The go-expanse library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-expanse library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-expanse library. If not, see . + +package crypto + +import ( + "testing" +) + +func TestMnDecode(t *testing.T) { + words := []string{ + "ink", + "balance", + "gain", + "fear", + "happen", + "melt", + "mom", + "surface", + "stir", + "bottle", + "unseen", + "expression", + "important", + "curl", + "grant", + "fairy", + "across", + "back", + "figure", + "breast", + "nobody", + "scratch", + "worry", + "yesterday", + } + encode := "c61d43dc5bb7a4e754d111dae8105b6f25356492df5e50ecb33b858d94f8c338" + result := MnemonicDecode(words) + if encode != result { + t.Error("We expected", encode, "got", result, "instead") + } +} +func TestMnEncode(t *testing.T) { + encode := "c61d43dc5bb7a4e754d111dae8105b6f25356492df5e50ecb33b858d94f8c338" + result := []string{ + "ink", + "balance", + "gain", + "fear", + "happen", + "melt", + "mom", + "surface", + "stir", + "bottle", + "unseen", + "expression", + "important", + "curl", + "grant", + "fairy", + "across", + "back", + "figure", + "breast", + "nobody", + "scratch", + "worry", + "yesterday", + } + words := MnemonicEncode(encode) + for i, word := range words { + if word != result[i] { + t.Error("Mnenonic does not match:", words, result) + } + } +} diff --git a/crypto/mnemonic_words.go b/crypto/mnemonic_words.go new file mode 100644 index 0000000000..3b412cc35a --- /dev/null +++ b/crypto/mnemonic_words.go @@ -0,0 +1,1646 @@ +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. +// +// The go-expanse library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-expanse library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-expanse library. If not, see . + +package crypto + +var MnemonicWords []string = []string{ + "like", + "just", + "love", + "know", + "never", + "want", + "time", + "out", + "there", + "make", + "look", + "eye", + "down", + "only", + "think", + "heart", + "back", + "then", + "into", + "about", + "more", + "away", + "still", + "them", + "take", + "thing", + "even", + "through", + "long", + "always", + "world", + "too", + "friend", + "tell", + "try", + "hand", + "thought", + "over", + "here", + "other", + "need", + "smile", + "again", + "much", + "cry", + "been", + "night", + "ever", + "little", + "said", + "end", + "some", + "those", + "around", + "mind", + "people", + "girl", + "leave", + "dream", + "left", + "turn", + "myself", + "give", + "nothing", + "really", + "off", + "before", + "something", + "find", + "walk", + "wish", + "good", + "once", + "place", + "ask", + "stop", + "keep", + "watch", + "seem", + "everything", + "wait", + "got", + "yet", + "made", + "remember", + "start", + "alone", + "run", + "hope", + "maybe", + "believe", + "body", + "hate", + "after", + "close", + "talk", + "stand", + "own", + "each", + "hurt", + "help", + "home", + "god", + "soul", + "new", + "many", + "two", + "inside", + "should", + "true", + "first", + "fear", + "mean", + "better", + "play", + "another", + "gone", + "change", + "use", + "wonder", + "someone", + "hair", + "cold", + "open", + "best", + "any", + "behind", + "happen", + "water", + "dark", + "laugh", + "stay", + "forever", + "name", + "work", + "show", + "sky", + "break", + "came", + "deep", + "door", + "put", + "black", + "together", + "upon", + "happy", + "such", + "great", + "white", + "matter", + "fill", + "past", + "please", + "burn", + "cause", + "enough", + "touch", + "moment", + "soon", + "voice", + "scream", + "anything", + "stare", + "sound", + "red", + "everyone", + "hide", + "kiss", + "truth", + "death", + "beautiful", + "mine", + "blood", + "broken", + "very", + "pass", + "next", + "forget", + "tree", + "wrong", + "air", + "mother", + "understand", + "lip", + "hit", + "wall", + "memory", + "sleep", + "free", + "high", + "realize", + "school", + "might", + "skin", + "sweet", + "perfect", + "blue", + "kill", + "breath", + "dance", + "against", + "fly", + "between", + "grow", + "strong", + "under", + "listen", + "bring", + "sometimes", + "speak", + "pull", + "person", + "become", + "family", + "begin", + "ground", + "real", + "small", + "father", + "sure", + "feet", + "rest", + "young", + "finally", + "land", + "across", + "today", + "different", + "guy", + "line", + "fire", + "reason", + "reach", + "second", + "slowly", + "write", + "eat", + "smell", + "mouth", + "step", + "learn", + "three", + "floor", + "promise", + "breathe", + "darkness", + "push", + "earth", + "guess", + "save", + "song", + "above", + "along", + "both", + "color", + "house", + "almost", + "sorry", + "anymore", + "brother", + "okay", + "dear", + "game", + "fade", + "already", + "apart", + "warm", + "beauty", + "heard", + "notice", + "question", + "shine", + "began", + "piece", + "whole", + "shadow", + "secret", + "street", + "within", + "finger", + "point", + "morning", + "whisper", + "child", + "moon", + "green", + "story", + "glass", + "kid", + "silence", + "since", + "soft", + "yourself", + "empty", + "shall", + "angel", + "answer", + "baby", + "bright", + "dad", + "path", + "worry", + "hour", + "drop", + "follow", + "power", + "war", + "half", + "flow", + "heaven", + "act", + "chance", + "fact", + "least", + "tired", + "children", + "near", + "quite", + "afraid", + "rise", + "sea", + "taste", + "window", + "cover", + "nice", + "trust", + "lot", + "sad", + "cool", + "force", + "peace", + "return", + "blind", + "easy", + "ready", + "roll", + "rose", + "drive", + "held", + "music", + "beneath", + "hang", + "mom", + "paint", + "emotion", + "quiet", + "clear", + "cloud", + "few", + "pretty", + "bird", + "outside", + "paper", + "picture", + "front", + "rock", + "simple", + "anyone", + "meant", + "reality", + "road", + "sense", + "waste", + "bit", + "leaf", + "thank", + "happiness", + "meet", + "men", + "smoke", + "truly", + "decide", + "self", + "age", + "book", + "form", + "alive", + "carry", + "escape", + "damn", + "instead", + "able", + "ice", + "minute", + "throw", + "catch", + "leg", + "ring", + "course", + "goodbye", + "lead", + "poem", + "sick", + "corner", + "desire", + "known", + "problem", + "remind", + "shoulder", + "suppose", + "toward", + "wave", + "drink", + "jump", + "woman", + "pretend", + "sister", + "week", + "human", + "joy", + "crack", + "grey", + "pray", + "surprise", + "dry", + "knee", + "less", + "search", + "bleed", + "caught", + "clean", + "embrace", + "future", + "king", + "son", + "sorrow", + "chest", + "hug", + "remain", + "sat", + "worth", + "blow", + "daddy", + "final", + "parent", + "tight", + "also", + "create", + "lonely", + "safe", + "cross", + "dress", + "evil", + "silent", + "bone", + "fate", + "perhaps", + "anger", + "class", + "scar", + "snow", + "tiny", + "tonight", + "continue", + "control", + "dog", + "edge", + "mirror", + "month", + "suddenly", + "comfort", + "given", + "loud", + "quickly", + "gaze", + "plan", + "rush", + "stone", + "town", + "battle", + "ignore", + "spirit", + "stood", + "stupid", + "yours", + "brown", + "build", + "dust", + "hey", + "kept", + "pay", + "phone", + "twist", + "although", + "ball", + "beyond", + "hidden", + "nose", + "taken", + "fail", + "float", + "pure", + "somehow", + "wash", + "wrap", + "angry", + "cheek", + "creature", + "forgotten", + "heat", + "rip", + "single", + "space", + "special", + "weak", + "whatever", + "yell", + "anyway", + "blame", + "job", + "choose", + "country", + "curse", + "drift", + "echo", + "figure", + "grew", + "laughter", + "neck", + "suffer", + "worse", + "yeah", + "disappear", + "foot", + "forward", + "knife", + "mess", + "somewhere", + "stomach", + "storm", + "beg", + "idea", + "lift", + "offer", + "breeze", + "field", + "five", + "often", + "simply", + "stuck", + "win", + "allow", + "confuse", + "enjoy", + "except", + "flower", + "seek", + "strength", + "calm", + "grin", + "gun", + "heavy", + "hill", + "large", + "ocean", + "shoe", + "sigh", + "straight", + "summer", + "tongue", + "accept", + "crazy", + "everyday", + "exist", + "grass", + "mistake", + "sent", + "shut", + "surround", + "table", + "ache", + "brain", + "destroy", + "heal", + "nature", + "shout", + "sign", + "stain", + "choice", + "doubt", + "glance", + "glow", + "mountain", + "queen", + "stranger", + "throat", + "tomorrow", + "city", + "either", + "fish", + "flame", + "rather", + "shape", + "spin", + "spread", + "ash", + "distance", + "finish", + "image", + "imagine", + "important", + "nobody", + "shatter", + "warmth", + "became", + "feed", + "flesh", + "funny", + "lust", + "shirt", + "trouble", + "yellow", + "attention", + "bare", + "bite", + "money", + "protect", + "amaze", + "appear", + "born", + "choke", + "completely", + "daughter", + "fresh", + "friendship", + "gentle", + "probably", + "six", + "deserve", + "expect", + "grab", + "middle", + "nightmare", + "river", + "thousand", + "weight", + "worst", + "wound", + "barely", + "bottle", + "cream", + "regret", + "relationship", + "stick", + "test", + "crush", + "endless", + "fault", + "itself", + "rule", + "spill", + "art", + "circle", + "join", + "kick", + "mask", + "master", + "passion", + "quick", + "raise", + "smooth", + "unless", + "wander", + "actually", + "broke", + "chair", + "deal", + "favorite", + "gift", + "note", + "number", + "sweat", + "box", + "chill", + "clothes", + "lady", + "mark", + "park", + "poor", + "sadness", + "tie", + "animal", + "belong", + "brush", + "consume", + "dawn", + "forest", + "innocent", + "pen", + "pride", + "stream", + "thick", + "clay", + "complete", + "count", + "draw", + "faith", + "press", + "silver", + "struggle", + "surface", + "taught", + "teach", + "wet", + "bless", + "chase", + "climb", + "enter", + "letter", + "melt", + "metal", + "movie", + "stretch", + "swing", + "vision", + "wife", + "beside", + "crash", + "forgot", + "guide", + "haunt", + "joke", + "knock", + "plant", + "pour", + "prove", + "reveal", + "steal", + "stuff", + "trip", + "wood", + "wrist", + "bother", + "bottom", + "crawl", + "crowd", + "fix", + "forgive", + "frown", + "grace", + "loose", + "lucky", + "party", + "release", + "surely", + "survive", + "teacher", + "gently", + "grip", + "speed", + "suicide", + "travel", + "treat", + "vein", + "written", + "cage", + "chain", + "conversation", + "date", + "enemy", + "however", + "interest", + "million", + "page", + "pink", + "proud", + "sway", + "themselves", + "winter", + "church", + "cruel", + "cup", + "demon", + "experience", + "freedom", + "pair", + "pop", + "purpose", + "respect", + "shoot", + "softly", + "state", + "strange", + "bar", + "birth", + "curl", + "dirt", + "excuse", + "lord", + "lovely", + "monster", + "order", + "pack", + "pants", + "pool", + "scene", + "seven", + "shame", + "slide", + "ugly", + "among", + "blade", + "blonde", + "closet", + "creek", + "deny", + "drug", + "eternity", + "gain", + "grade", + "handle", + "key", + "linger", + "pale", + "prepare", + "swallow", + "swim", + "tremble", + "wheel", + "won", + "cast", + "cigarette", + "claim", + "college", + "direction", + "dirty", + "gather", + "ghost", + "hundred", + "loss", + "lung", + "orange", + "present", + "swear", + "swirl", + "twice", + "wild", + "bitter", + "blanket", + "doctor", + "everywhere", + "flash", + "grown", + "knowledge", + "numb", + "pressure", + "radio", + "repeat", + "ruin", + "spend", + "unknown", + "buy", + "clock", + "devil", + "early", + "false", + "fantasy", + "pound", + "precious", + "refuse", + "sheet", + "teeth", + "welcome", + "add", + "ahead", + "block", + "bury", + "caress", + "content", + "depth", + "despite", + "distant", + "marry", + "purple", + "threw", + "whenever", + "bomb", + "dull", + "easily", + "grasp", + "hospital", + "innocence", + "normal", + "receive", + "reply", + "rhyme", + "shade", + "someday", + "sword", + "toe", + "visit", + "asleep", + "bought", + "center", + "consider", + "flat", + "hero", + "history", + "ink", + "insane", + "muscle", + "mystery", + "pocket", + "reflection", + "shove", + "silently", + "smart", + "soldier", + "spot", + "stress", + "train", + "type", + "view", + "whether", + "bus", + "energy", + "explain", + "holy", + "hunger", + "inch", + "magic", + "mix", + "noise", + "nowhere", + "prayer", + "presence", + "shock", + "snap", + "spider", + "study", + "thunder", + "trail", + "admit", + "agree", + "bag", + "bang", + "bound", + "butterfly", + "cute", + "exactly", + "explode", + "familiar", + "fold", + "further", + "pierce", + "reflect", + "scent", + "selfish", + "sharp", + "sink", + "spring", + "stumble", + "universe", + "weep", + "women", + "wonderful", + "action", + "ancient", + "attempt", + "avoid", + "birthday", + "branch", + "chocolate", + "core", + "depress", + "drunk", + "especially", + "focus", + "fruit", + "honest", + "match", + "palm", + "perfectly", + "pillow", + "pity", + "poison", + "roar", + "shift", + "slightly", + "thump", + "truck", + "tune", + "twenty", + "unable", + "wipe", + "wrote", + "coat", + "constant", + "dinner", + "drove", + "egg", + "eternal", + "flight", + "flood", + "frame", + "freak", + "gasp", + "glad", + "hollow", + "motion", + "peer", + "plastic", + "root", + "screen", + "season", + "sting", + "strike", + "team", + "unlike", + "victim", + "volume", + "warn", + "weird", + "attack", + "await", + "awake", + "built", + "charm", + "crave", + "despair", + "fought", + "grant", + "grief", + "horse", + "limit", + "message", + "ripple", + "sanity", + "scatter", + "serve", + "split", + "string", + "trick", + "annoy", + "blur", + "boat", + "brave", + "clearly", + "cling", + "connect", + "fist", + "forth", + "imagination", + "iron", + "jock", + "judge", + "lesson", + "milk", + "misery", + "nail", + "naked", + "ourselves", + "poet", + "possible", + "princess", + "sail", + "size", + "snake", + "society", + "stroke", + "torture", + "toss", + "trace", + "wise", + "bloom", + "bullet", + "cell", + "check", + "cost", + "darling", + "during", + "footstep", + "fragile", + "hallway", + "hardly", + "horizon", + "invisible", + "journey", + "midnight", + "mud", + "nod", + "pause", + "relax", + "shiver", + "sudden", + "value", + "youth", + "abuse", + "admire", + "blink", + "breast", + "bruise", + "constantly", + "couple", + "creep", + "curve", + "difference", + "dumb", + "emptiness", + "gotta", + "honor", + "plain", + "planet", + "recall", + "rub", + "ship", + "slam", + "soar", + "somebody", + "tightly", + "weather", + "adore", + "approach", + "bond", + "bread", + "burst", + "candle", + "coffee", + "cousin", + "crime", + "desert", + "flutter", + "frozen", + "grand", + "heel", + "hello", + "language", + "level", + "movement", + "pleasure", + "powerful", + "random", + "rhythm", + "settle", + "silly", + "slap", + "sort", + "spoken", + "steel", + "threaten", + "tumble", + "upset", + "aside", + "awkward", + "bee", + "blank", + "board", + "button", + "card", + "carefully", + "complain", + "crap", + "deeply", + "discover", + "drag", + "dread", + "effort", + "entire", + "fairy", + "giant", + "gotten", + "greet", + "illusion", + "jeans", + "leap", + "liquid", + "march", + "mend", + "nervous", + "nine", + "replace", + "rope", + "spine", + "stole", + "terror", + "accident", + "apple", + "balance", + "boom", + "childhood", + "collect", + "demand", + "depression", + "eventually", + "faint", + "glare", + "goal", + "group", + "honey", + "kitchen", + "laid", + "limb", + "machine", + "mere", + "mold", + "murder", + "nerve", + "painful", + "poetry", + "prince", + "rabbit", + "shelter", + "shore", + "shower", + "soothe", + "stair", + "steady", + "sunlight", + "tangle", + "tease", + "treasure", + "uncle", + "begun", + "bliss", + "canvas", + "cheer", + "claw", + "clutch", + "commit", + "crimson", + "crystal", + "delight", + "doll", + "existence", + "express", + "fog", + "football", + "gay", + "goose", + "guard", + "hatred", + "illuminate", + "mass", + "math", + "mourn", + "rich", + "rough", + "skip", + "stir", + "student", + "style", + "support", + "thorn", + "tough", + "yard", + "yearn", + "yesterday", + "advice", + "appreciate", + "autumn", + "bank", + "beam", + "bowl", + "capture", + "carve", + "collapse", + "confusion", + "creation", + "dove", + "feather", + "girlfriend", + "glory", + "government", + "harsh", + "hop", + "inner", + "loser", + "moonlight", + "neighbor", + "neither", + "peach", + "pig", + "praise", + "screw", + "shield", + "shimmer", + "sneak", + "stab", + "subject", + "throughout", + "thrown", + "tower", + "twirl", + "wow", + "army", + "arrive", + "bathroom", + "bump", + "cease", + "cookie", + "couch", + "courage", + "dim", + "guilt", + "howl", + "hum", + "husband", + "insult", + "led", + "lunch", + "mock", + "mostly", + "natural", + "nearly", + "needle", + "nerd", + "peaceful", + "perfection", + "pile", + "price", + "remove", + "roam", + "sanctuary", + "serious", + "shiny", + "shook", + "sob", + "stolen", + "tap", + "vain", + "void", + "warrior", + "wrinkle", + "affection", + "apologize", + "blossom", + "bounce", + "bridge", + "cheap", + "crumble", + "decision", + "descend", + "desperately", + "dig", + "dot", + "flip", + "frighten", + "heartbeat", + "huge", + "lazy", + "lick", + "odd", + "opinion", + "process", + "puzzle", + "quietly", + "retreat", + "score", + "sentence", + "separate", + "situation", + "skill", + "soak", + "square", + "stray", + "taint", + "task", + "tide", + "underneath", + "veil", + "whistle", + "anywhere", + "bedroom", + "bid", + "bloody", + "burden", + "careful", + "compare", + "concern", + "curtain", + "decay", + "defeat", + "describe", + "double", + "dreamer", + "driver", + "dwell", + "evening", + "flare", + "flicker", + "grandma", + "guitar", + "harm", + "horrible", + "hungry", + "indeed", + "lace", + "melody", + "monkey", + "nation", + "object", + "obviously", + "rainbow", + "salt", + "scratch", + "shown", + "shy", + "stage", + "stun", + "third", + "tickle", + "useless", + "weakness", + "worship", + "worthless", + "afternoon", + "beard", + "boyfriend", + "bubble", + "busy", + "certain", + "chin", + "concrete", + "desk", + "diamond", + "doom", + "drawn", + "due", + "felicity", + "freeze", + "frost", + "garden", + "glide", + "harmony", + "hopefully", + "hunt", + "jealous", + "lightning", + "mama", + "mercy", + "peel", + "physical", + "position", + "pulse", + "punch", + "quit", + "rant", + "respond", + "salty", + "sane", + "satisfy", + "savior", + "sheep", + "slept", + "social", + "sport", + "tuck", + "utter", + "valley", + "wolf", + "aim", + "alas", + "alter", + "arrow", + "awaken", + "beaten", + "belief", + "brand", + "ceiling", + "cheese", + "clue", + "confidence", + "connection", + "daily", + "disguise", + "eager", + "erase", + "essence", + "everytime", + "expression", + "fan", + "flag", + "flirt", + "foul", + "fur", + "giggle", + "glorious", + "ignorance", + "law", + "lifeless", + "measure", + "mighty", + "muse", + "north", + "opposite", + "paradise", + "patience", + "patient", + "pencil", + "petal", + "plate", + "ponder", + "possibly", + "practice", + "slice", + "spell", + "stock", + "strife", + "strip", + "suffocate", + "suit", + "tender", + "tool", + "trade", + "velvet", + "verse", + "waist", + "witch", + "aunt", + "bench", + "bold", + "cap", + "certainly", + "click", + "companion", + "creator", + "dart", + "delicate", + "determine", + "dish", + "dragon", + "drama", + "drum", + "dude", + "everybody", + "feast", + "forehead", + "former", + "fright", + "fully", + "gas", + "hook", + "hurl", + "invite", + "juice", + "manage", + "moral", + "possess", + "raw", + "rebel", + "royal", + "scale", + "scary", + "several", + "slight", + "stubborn", + "swell", + "talent", + "tea", + "terrible", + "thread", + "torment", + "trickle", + "usually", + "vast", + "violence", + "weave", + "acid", + "agony", + "ashamed", + "awe", + "belly", + "blend", + "blush", + "character", + "cheat", + "common", + "company", + "coward", + "creak", + "danger", + "deadly", + "defense", + "define", + "depend", + "desperate", + "destination", + "dew", + "duck", + "dusty", + "embarrass", + "engine", + "example", + "explore", + "foe", + "freely", + "frustrate", + "generation", + "glove", + "guilty", + "health", + "hurry", + "idiot", + "impossible", + "inhale", + "jaw", + "kingdom", + "mention", + "mist", + "moan", + "mumble", + "mutter", + "observe", + "ode", + "pathetic", + "pattern", + "pie", + "prefer", + "puff", + "rape", + "rare", + "revenge", + "rude", + "scrape", + "spiral", + "squeeze", + "strain", + "sunset", + "suspend", + "sympathy", + "thigh", + "throne", + "total", + "unseen", + "weapon", + "weary", +} diff --git a/crypto/randentropy/rand_entropy.go b/crypto/randentropy/rand_entropy.go index 0c2e3c051d..1282974fb4 100644 --- a/crypto/randentropy/rand_entropy.go +++ b/crypto/randentropy/rand_entropy.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package randentropy @@ -20,7 +20,7 @@ import ( crand "crypto/rand" "io" - "github.com/ethereum/go-ethereum/crypto/sha3" + "github.com/expanse-project/go-expanse/crypto/sha3" ) var Reader io.Reader = &randEntropy{} diff --git a/crypto/secp256k1/notes.go b/crypto/secp256k1/notes.go index 93e6d1902f..2834cc3562 100644 --- a/crypto/secp256k1/notes.go +++ b/crypto/secp256k1/notes.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package secp256k1 diff --git a/crypto/secp256k1/secp256.go b/crypto/secp256k1/secp256.go index 7baa456bff..b7aa97b5ec 100644 --- a/crypto/secp256k1/secp256.go +++ b/crypto/secp256k1/secp256.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package secp256k1 @@ -42,7 +42,7 @@ import ( "errors" "unsafe" - "github.com/ethereum/go-ethereum/crypto/randentropy" + "github.com/expanse-project/go-expanse/crypto/randentropy" ) //#define USE_FIELD_5X64 diff --git a/crypto/secp256k1/secp256_test.go b/crypto/secp256k1/secp256_test.go index deeec98d50..48c5a4bc0d 100644 --- a/crypto/secp256k1/secp256_test.go +++ b/crypto/secp256k1/secp256_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package secp256k1 @@ -22,7 +22,7 @@ import ( "log" "testing" - "github.com/ethereum/go-ethereum/crypto/randentropy" + "github.com/expanse-project/go-expanse/crypto/randentropy" ) const TESTS = 10000 // how many tests diff --git a/docker/Dockerfile b/docker/Dockerfile index b608e4ab6d..b31368c291 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -11,12 +11,12 @@ RUN apt-get dist-upgrade -q -y # Let our containers upgrade themselves RUN apt-get install -q -y unattended-upgrades -# Install Ethereum +# Install Expanse RUN apt-get install -q -y software-properties-common -RUN add-apt-repository ppa:ethereum/ethereum -RUN add-apt-repository ppa:ethereum/ethereum-dev +RUN add-apt-repository ppa:expanse/expanse +RUN add-apt-repository ppa:expanse/expanse-dev RUN apt-get update -RUN apt-get install -q -y geth +RUN apt-get install -q -y gexp # Install supervisor RUN apt-get install -q -y supervisor @@ -24,8 +24,8 @@ RUN apt-get install -q -y supervisor # Add supervisor configs ADD supervisord.conf supervisord.conf -EXPOSE 8545 -EXPOSE 30303 +EXPOSE 9656 +EXPOSE 60606 CMD ["-n", "-c", "/supervisord.conf"] ENTRYPOINT ["/usr/bin/supervisord"] diff --git a/docker/supervisord.conf b/docker/supervisord.conf index 33cba0c140..d5d1da6fd4 100644 --- a/docker/supervisord.conf +++ b/docker/supervisord.conf @@ -1,17 +1,17 @@ [supervisord] nodaemon=false -[program:geth] +[program:gexp] priority=30 directory=/ -command=geth --rpc +command=gexp --rpc user=root autostart=true autorestart=true startsecs=10 stopsignal=QUIT -stdout_logfile=/var/log/geth.log -stderr_logfile=/var/log/geth.err +stdout_logfile=/var/log/gexp.log +stderr_logfile=/var/log/gexp.err [unix_http_server] file=%(here)s/supervisor.sock diff --git a/errs/errors.go b/errs/errors.go index 675649efa2..f77aa96cb0 100644 --- a/errs/errors.go +++ b/errs/errors.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package errs import ( "fmt" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) /* diff --git a/errs/errors_test.go b/errs/errors_test.go index d6d14b45ea..7f22ea15c4 100644 --- a/errs/errors_test.go +++ b/errs/errors_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package errs @@ -20,7 +20,7 @@ import ( "fmt" "testing" - "github.com/ethereum/go-ethereum/logger" + "github.com/expanse-project/go-expanse/logger" ) func testErrors() *Errors { diff --git a/eth/backend.go b/eth/backend.go index 2b21a7c960..e1982794ec 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -1,21 +1,21 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package eth implements the Ethereum protocol. -package eth +// Package exp implements the Expanse protocol. +package exp import ( "crypto/ecdsa" @@ -61,11 +61,10 @@ var ( defaultBootNodes = []*discover.Node{ // ETH/DEV Go Bootnodes - discover.MustParseNode("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303"), // IE - discover.MustParseNode("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303"), // BR - discover.MustParseNode("enode://1118980bf48b0a3640bdba04e0fe78b1add18e1cd99bf22d53daac1fd9972ad650df52176e7c7d89d1114cfef2bc23a2959aa54998a46afcf7d91809f0855082@52.74.57.123:30303"), // SG - // ETH/DEV cpp-ethereum (poc-9.ethdev.com) - discover.MustParseNode("enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303"), + discover.MustParseNode("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:60606"), + discover.MustParseNode("enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:60606"), + // ETH/DEV cpp-expanse (poc-9.ethdev.com) + discover.MustParseNode("enode://487611428e6c99a11a9795a6abe7b529e81315ca6aad66e2a2fc76e3adf263faba0d35466c2f8f68d561dbefa8878d4df5f1f2ddb1fbeab7f42ffb8cd328bd4a@5.1.83.226:60606"), } staticNodes = "static-nodes.json" // Path within to search for the static node list @@ -202,8 +201,8 @@ func (cfg *Config) nodeKey() (*ecdsa.PrivateKey, error) { return key, nil } -type Ethereum struct { - // Channel for shutting down the ethereum +type Expanse struct { + // Channel for shutting down the expanse shutdownChan chan bool // DB interfaces @@ -251,7 +250,7 @@ type Ethereum struct { shhVersionId int } -func New(config *Config) (*Ethereum, error) { +func New(config *Config) (*Expanse, error) { // Bootstrap database logger.New(config.DataDir, config.LogFile, config.Verbosity) if len(config.LogJSON) > 0 { @@ -321,13 +320,13 @@ func New(config *Config) (*Ethereum, error) { b, _ := chainDb.Get([]byte("BlockchainVersion")) bcVersion := int(common.NewValue(b).Uint()) if bcVersion != config.BlockChainVersion && bcVersion != 0 { - return nil, fmt.Errorf("Blockchain DB version mismatch (%d / %d). Run geth upgradedb.\n", bcVersion, config.BlockChainVersion) + return nil, fmt.Errorf("Blockchain DB version mismatch (%d / %d). Run gexp upgradedb.\n", bcVersion, config.BlockChainVersion) } saveBlockchainVersion(chainDb, config.BlockChainVersion) } glog.V(logger.Info).Infof("Blockchain DB Version: %d", config.BlockChainVersion) - eth := &Ethereum{ + exp := &Expanse{ shutdownChan: make(chan bool), databasesClosed: make(chan bool), chainDb: chainDb, @@ -353,15 +352,15 @@ func New(config *Config) (*Ethereum, error) { if config.PowTest { glog.V(logger.Info).Infof("ethash used in test mode") - eth.pow, err = ethash.NewForTesting() + exp.pow, err = ethash.NewForTesting() if err != nil { return nil, err } } else { - eth.pow = ethash.New() + exp.pow = ethash.New() } //genesis := core.GenesisBlock(uint64(config.GenesisNonce), stateDb) - eth.chainManager, err = core.NewChainManager(chainDb, eth.pow, eth.EventMux()) + exp.chainManager, err = core.NewChainManager(chainDb, exp.pow, exp.EventMux()) if err != nil { if err == core.ErrNoGenesis { return nil, fmt.Errorf(`Genesis block not found. Please supply a genesis block with the "--genesis /path/to/file" argument`) @@ -369,30 +368,31 @@ func New(config *Config) (*Ethereum, error) { return nil, err } - eth.txPool = core.NewTxPool(eth.EventMux(), eth.chainManager.State, eth.chainManager.GasLimit) + exp.txPool = core.NewTxPool(exp.EventMux(), exp.chainManager.State, exp.chainManager.GasLimit) - eth.blockProcessor = core.NewBlockProcessor(chainDb, eth.pow, eth.chainManager, eth.EventMux()) - eth.chainManager.SetProcessor(eth.blockProcessor) - eth.protocolManager = NewProtocolManager(config.NetworkId, eth.eventMux, eth.txPool, eth.pow, eth.chainManager) +<<<<<<< HEAD + exp.blockProcessor = core.NewBlockProcessor(chainDb, exp.pow, exp.chainManager, exp.EventMux()) + exp.chainManager.SetProcessor(exp.blockProcessor) + exp.protocolManager = NewProtocolManager(config.NetworkId, exp.eventMux, eth.txPool, exp.pow, exp.chainManager) eth.miner = miner.New(eth, eth.EventMux(), eth.pow) eth.miner.SetGasPrice(config.GasPrice) eth.miner.SetExtra(config.ExtraData) if config.Shh { - eth.whisper = whisper.New() - eth.shhVersionId = int(eth.whisper.Version()) + exp.whisper = whisper.New() + exp.shhVersionId = int(exp.whisper.Version()) } netprv, err := config.nodeKey() if err != nil { return nil, err } - protocols := append([]p2p.Protocol{}, eth.protocolManager.SubProtocols...) + protocols := append([]p2p.Protocol{}, exp.protocolManager.SubProtocols...) if config.Shh { - protocols = append(protocols, eth.whisper.Protocol()) + protocols = append(protocols, exp.whisper.Protocol()) } - eth.net = &p2p.Server{ + exp.net = &p2p.Server{ PrivateKey: netprv, Name: config.Name, MaxPeers: config.MaxPeers, @@ -407,12 +407,12 @@ func New(config *Config) (*Ethereum, error) { NodeDatabase: nodeDb, } if len(config.Port) > 0 { - eth.net.ListenAddr = ":" + config.Port + exp.net.ListenAddr = ":" + config.Port } vm.Debug = config.VmDebug - return eth, nil + return exp, nil } type NodeInfo struct { @@ -426,7 +426,7 @@ type NodeInfo struct { ListenAddr string } -func (s *Ethereum) NodeInfo() *NodeInfo { +func (s *Expanse) NodeInfo() *NodeInfo { node := s.net.Self() return &NodeInfo{ @@ -464,7 +464,7 @@ func newPeerInfo(peer *p2p.Peer) *PeerInfo { } // PeersInfo returns an array of PeerInfo objects describing connected peers -func (s *Ethereum) PeersInfo() (peersinfo []*PeerInfo) { +func (s *Expanse) PeersInfo() (peersinfo []*PeerInfo) { for _, peer := range s.net.Peers() { if peer != nil { peersinfo = append(peersinfo, newPeerInfo(peer)) @@ -473,11 +473,11 @@ func (s *Ethereum) PeersInfo() (peersinfo []*PeerInfo) { return } -func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) { +func (s *Expanse) ResetWithGenesisBlock(gb *types.Block) { s.chainManager.ResetWithGenesisBlock(gb) } -func (s *Ethereum) StartMining(threads int) error { +func (s *Expanse) StartMining(threads int) error { eb, err := s.Etherbase() if err != nil { err = fmt.Errorf("Cannot start mining without etherbase address: %v", err) @@ -489,7 +489,7 @@ func (s *Ethereum) StartMining(threads int) error { return nil } -func (s *Ethereum) Etherbase() (eb common.Address, err error) { +func (s *Expanse) Etherbase() (eb common.Address, err error) { eb = s.etherbase if (eb == common.Address{}) { addr, e := s.AccountManager().AddressByIndex(0) @@ -502,37 +502,37 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) { } // set in js console via admin interface or wrapper from cli flags -func (self *Ethereum) SetEtherbase(etherbase common.Address) { +func (self *Expanse) SetEtherbase(etherbase common.Address) { self.etherbase = etherbase self.miner.SetEtherbase(etherbase) } -func (s *Ethereum) StopMining() { s.miner.Stop() } -func (s *Ethereum) IsMining() bool { return s.miner.Mining() } -func (s *Ethereum) Miner() *miner.Miner { return s.miner } +func (s *Expanse) StopMining() { s.miner.Stop() } +func (s *Expanse) IsMining() bool { return s.miner.Mining() } +func (s *Expanse) Miner() *miner.Miner { return s.miner } -// func (s *Ethereum) Logger() logger.LogSystem { return s.logger } -func (s *Ethereum) Name() string { return s.net.Name } -func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager } -func (s *Ethereum) ChainManager() *core.ChainManager { return s.chainManager } -func (s *Ethereum) BlockProcessor() *core.BlockProcessor { return s.blockProcessor } -func (s *Ethereum) TxPool() *core.TxPool { return s.txPool } -func (s *Ethereum) Whisper() *whisper.Whisper { return s.whisper } -func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux } -func (s *Ethereum) ChainDb() common.Database { return s.chainDb } -func (s *Ethereum) DappDb() common.Database { return s.dappDb } -func (s *Ethereum) IsListening() bool { return true } // Always listening -func (s *Ethereum) PeerCount() int { return s.net.PeerCount() } -func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() } -func (s *Ethereum) MaxPeers() int { return s.net.MaxPeers } -func (s *Ethereum) ClientVersion() string { return s.clientVersion } -func (s *Ethereum) EthVersion() int { return int(s.protocolManager.SubProtocols[0].Version) } -func (s *Ethereum) NetVersion() int { return s.netVersionId } -func (s *Ethereum) ShhVersion() int { return s.shhVersionId } -func (s *Ethereum) Downloader() *downloader.Downloader { return s.protocolManager.downloader } +// func (s *Expanse) Logger() logger.LogSystem { return s.logger } +func (s *Expanse) Name() string { return s.net.Name } +func (s *Expanse) AccountManager() *accounts.Manager { return s.accountManager } +func (s *Expanse) ChainManager() *core.ChainManager { return s.chainManager } +func (s *Expanse) BlockProcessor() *core.BlockProcessor { return s.blockProcessor } +func (s *Expanse) TxPool() *core.TxPool { return s.txPool } +func (s *Expanse) Whisper() *whisper.Whisper { return s.whisper } +func (s *Expanse) EventMux() *event.TypeMux { return s.eventMux } +func (s *Expanse) ChainDb() common.Database { return s.chainDb } +func (s *Expanse) DappDb() common.Database { return s.dappDb } +func (s *Expanse) IsListening() bool { return true } // Always listening +func (s *Expanse) PeerCount() int { return s.net.PeerCount() } +func (s *Expanse) Peers() []*p2p.Peer { return s.net.Peers() } +func (s *Expanse) MaxPeers() int { return s.net.MaxPeers } +func (s *Expanse) ClientVersion() string { return s.clientVersion } +func (s *Expanse) EthVersion() int { return int(s.protocolManager.SubProtocols[0].Version) } +func (s *Expanse) NetVersion() int { return s.netVersionId } +func (s *Expanse) ShhVersion() int { return s.shhVersionId } +func (s *Expanse) Downloader() *downloader.Downloader { return s.protocolManager.downloader } // Start the ethereum -func (s *Ethereum) Start() error { +func (s *Expanse) Start() error { jsonlogger.LogJson(&logger.LogStarting{ ClientString: s.net.Name, ProtocolVersion: s.EthVersion(), @@ -560,7 +560,7 @@ func (s *Ethereum) Start() error { // sync databases every minute. If flushing fails we exit immediatly. The system // may not continue under any circumstances. -func (s *Ethereum) syncDatabases() { +func (s *Expanse) syncDatabases() { ticker := time.NewTicker(1 * time.Minute) done: for { @@ -584,7 +584,7 @@ done: close(s.databasesClosed) } -func (s *Ethereum) StartForTest() { +func (s *Expanse) StartForTest() { jsonlogger.LogJson(&logger.LogStarting{ ClientString: s.net.Name, ProtocolVersion: s.EthVersion(), @@ -594,7 +594,7 @@ func (s *Ethereum) StartForTest() { // AddPeer connects to the given node and maintains the connection until the // server is shut down. If the connection fails for any reason, the server will // attempt to reconnect the peer. -func (self *Ethereum) AddPeer(nodeURL string) error { +func (self *Expanse) AddPeer(nodeURL string) error { n, err := discover.ParseNode(nodeURL) if err != nil { return fmt.Errorf("invalid node URL: %v", err) @@ -603,7 +603,7 @@ func (self *Ethereum) AddPeer(nodeURL string) error { return nil } -func (s *Ethereum) Stop() { +func (s *Expanse) Stop() { s.net.Stop() s.chainManager.Stop() s.protocolManager.Stop() @@ -618,7 +618,7 @@ func (s *Ethereum) Stop() { } // This function will wait for a shutdown and resumes main thread execution -func (s *Ethereum) WaitForShutdown() { +func (s *Expanse) WaitForShutdown() { <-s.databasesClosed <-s.shutdownChan } @@ -632,7 +632,7 @@ func (s *Ethereum) WaitForShutdown() { // stop any number of times. // For any more sophisticated pattern of DAG generation, use CLI subcommand // makedag -func (self *Ethereum) StartAutoDAG() { +func (self *Expanse) StartAutoDAG() { if self.autodagquit != nil { return // already started } @@ -678,7 +678,7 @@ func (self *Ethereum) StartAutoDAG() { } // stopAutoDAG stops automatic DAG pregeneration by quitting the loop -func (self *Ethereum) StopAutoDAG() { +func (self *Expanse) StopAutoDAG() { if self.autodagquit != nil { close(self.autodagquit) self.autodagquit = nil diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index e3e22a7848..bca84cc182 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package downloader contains the manual full chain synchronisation. package downloader @@ -27,12 +27,12 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" "gopkg.in/fatih/set.v0" ) @@ -319,10 +319,10 @@ func (d *Downloader) syncWithPeer(p *peer, hash common.Hash, td *big.Int) (err e } }() - glog.V(logger.Debug).Infof("Synchronizing with the network using: %s, eth/%d", p.id, p.version) + glog.V(logger.Debug).Infof("Synchronizing with the network using: %s, exp/%d", p.id, p.version) switch p.version { case eth60: - // Old eth/60 version, use reverse hash retrieval algorithm + // Old exp/60 version, use reverse hash retrieval algorithm if err = d.fetchHashes60(p, hash); err != nil { return err } @@ -330,7 +330,7 @@ func (d *Downloader) syncWithPeer(p *peer, hash common.Hash, td *big.Int) (err e return err } case eth61: - // New eth/61, use forward, concurrent hash and block retrieval algorithm + // New exp/61, use forward, concurrent hash and block retrieval algorithm number, err := d.findAncestor(p) if err != nil { return err @@ -349,7 +349,7 @@ func (d *Downloader) syncWithPeer(p *peer, hash common.Hash, td *big.Int) (err e default: // Something very wrong, stop right here - glog.V(logger.Error).Infof("Unsupported eth protocol: %d", p.version) + glog.V(logger.Error).Infof("Unsupported exp protocol: %d", p.version) return errBadPeer } glog.V(logger.Debug).Infoln("Synchronization completed") diff --git a/eth/downloader/downloader_test.go b/eth/downloader/downloader_test.go index 61fc7827b6..5b4cb7d994 100644 --- a/eth/downloader/downloader_test.go +++ b/eth/downloader/downloader_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package downloader @@ -25,11 +25,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" ) var ( @@ -215,7 +215,7 @@ func (dl *downloadTester) peerGetRelHashesFn(id string, delay time.Duration) fun // a particular peer in the download tester. The returned function can be used to // retrieve batches of hashes from the particularly requested peer. func (dl *downloadTester) peerGetAbsHashesFn(id string, version int, delay time.Duration) func(uint64, int) error { - // If the simulated peer runs eth/60, this message is not supported + // If the simulated peer runs exp/60, this message is not supported if version == eth60 { return func(uint64, int) error { return nil } } diff --git a/eth/downloader/events.go b/eth/downloader/events.go index 64905b8f2a..8bd052ec91 100644 --- a/eth/downloader/events.go +++ b/eth/downloader/events.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package downloader diff --git a/eth/downloader/peer.go b/eth/downloader/peer.go index 4273b91682..0d23233efe 100644 --- a/eth/downloader/peer.go +++ b/eth/downloader/peer.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the active peer-set of the downloader, maintaining both failures // as well as reputation metrics to prioritize the block retrievals. @@ -27,7 +27,7 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" "gopkg.in/fatih/set.v0" ) @@ -58,7 +58,7 @@ type peer struct { getAbsHashes absoluteHashFetcherFn // Method to retrieve a batch of hashes from an absolute position getBlocks blockFetcherFn // Method to retrieve a batch of blocks - version int // Eth protocol version number to switch strategies + version int // Exp protocol version number to switch strategies } // newPeer create a new downloader peer, with specific hash and block retrieval diff --git a/eth/downloader/queue.go b/eth/downloader/queue.go index 96e08e1440..e35df3eb31 100644 --- a/eth/downloader/queue.go +++ b/eth/downloader/queue.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the block download scheduler to collect download tasks and schedule // them in an ordered, and throttled way. @@ -25,10 +25,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" "gopkg.in/karalabe/cookiejar.v2/collections/prque" ) diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index 55b6c5c1c5..77fdd4c9f6 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package fetcher contains the block announcement based synchonisation. package fetcher @@ -23,11 +23,11 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" "gopkg.in/karalabe/cookiejar.v2/collections/prque" ) diff --git a/eth/fetcher/fetcher_test.go b/eth/fetcher/fetcher_test.go index ecbb3f868c..b994206180 100644 --- a/eth/fetcher/fetcher_test.go +++ b/eth/fetcher/fetcher_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package fetcher @@ -24,11 +24,11 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/params" ) var ( diff --git a/eth/fetcher/metrics.go b/eth/fetcher/metrics.go index 76cc492269..7bb8cd5c4b 100644 --- a/eth/fetcher/metrics.go +++ b/eth/fetcher/metrics.go @@ -1,32 +1,32 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the metrics collected by the fetcher. package fetcher import ( - "github.com/ethereum/go-ethereum/metrics" + "github.com/expanse-project/go-expanse/metrics" ) var ( - announceMeter = metrics.NewMeter("eth/sync/RemoteAnnounces") - announceTimer = metrics.NewTimer("eth/sync/LocalAnnounces") - broadcastMeter = metrics.NewMeter("eth/sync/RemoteBroadcasts") - broadcastTimer = metrics.NewTimer("eth/sync/LocalBroadcasts") - discardMeter = metrics.NewMeter("eth/sync/DiscardedBlocks") - futureMeter = metrics.NewMeter("eth/sync/FutureBlocks") + announceMeter = metrics.NewMeter("exp/sync/RemoteAnnounces") + announceTimer = metrics.NewTimer("exp/sync/LocalAnnounces") + broadcastMeter = metrics.NewMeter("exp/sync/RemoteBroadcasts") + broadcastTimer = metrics.NewTimer("exp/sync/LocalBroadcasts") + discardMeter = metrics.NewMeter("exp/sync/DiscardedBlocks") + futureMeter = metrics.NewMeter("exp/sync/FutureBlocks") ) diff --git a/eth/gasprice.go b/eth/gasprice.go index 3caad73c6c..d3a2185410 100644 --- a/eth/gasprice.go +++ b/eth/gasprice.go @@ -1,31 +1,31 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -package eth +package exp import ( "math/big" "math/rand" "sync" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) const gpoProcessPastBlocks = 100 @@ -35,7 +35,7 @@ type blockPriceInfo struct { } type GasPriceOracle struct { - eth *Ethereum + exp *Expanse chain *core.ChainManager events event.Subscription blocks map[uint64]*blockPriceInfo @@ -44,12 +44,12 @@ type GasPriceOracle struct { lastBase, minBase *big.Int } -func NewGasPriceOracle(eth *Ethereum) (self *GasPriceOracle) { +func NewGasPriceOracle(exp *Expanse) (self *GasPriceOracle) { self = &GasPriceOracle{} self.blocks = make(map[uint64]*blockPriceInfo) - self.eth = eth - self.chain = eth.chainManager - self.events = eth.EventMux().Subscribe( + self.exp = exp + self.chain = exp.chainManager + self.events = exp.EventMux().Subscribe( core.ChainEvent{}, core.ChainSplitEvent{}, ) @@ -105,7 +105,7 @@ func (self *GasPriceOracle) processBlock(block *types.Block) { self.lastProcessed = i } - lastBase := self.eth.GpoMinGasPrice + lastBase := self.exp.GpoMinGasPrice bpl := self.blocks[i-1] if bpl != nil { lastBase = bpl.baseGasPrice @@ -121,9 +121,9 @@ func (self *GasPriceOracle) processBlock(block *types.Block) { } if lastBase.Cmp(lp) < 0 { - corr = self.eth.GpobaseStepUp + corr = self.exp.GpobaseStepUp } else { - corr = -self.eth.GpobaseStepDown + corr = -self.exp.GpobaseStepDown } crand := int64(corr * (900 + rand.Intn(201))) @@ -151,7 +151,7 @@ func (self *GasPriceOracle) processBlock(block *types.Block) { func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { gasUsed := big.NewInt(0) - receipts := self.eth.BlockProcessor().GetBlockReceipts(block.Hash()) + receipts := self.exp.BlockProcessor().GetBlockReceipts(block.Hash()) if len(receipts) > 0 { if cgu := receipts[len(receipts)-1].CumulativeGasUsed; cgu != nil { gasUsed = receipts[len(receipts)-1].CumulativeGasUsed @@ -159,7 +159,7 @@ func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int { } if new(big.Int).Mul(gasUsed, big.NewInt(100)).Cmp(new(big.Int).Mul(block.GasLimit(), - big.NewInt(int64(self.eth.GpoFullBlockRatio)))) < 0 { + big.NewInt(int64(self.exp.GpoFullBlockRatio)))) < 0 { // block is not full, could have posted a tx with MinGasPrice return big.NewInt(0) } @@ -185,21 +185,21 @@ func (self *GasPriceOracle) SuggestPrice() *big.Int { self.lastBaseMutex.Unlock() if base == nil { - base = self.eth.GpoMinGasPrice + base = self.exp.GpoMinGasPrice } if base == nil { return big.NewInt(10000000000000) // apparently MinGasPrice is not initialized during some tests } - baseCorr := new(big.Int).Mul(base, big.NewInt(int64(self.eth.GpobaseCorrectionFactor))) + baseCorr := new(big.Int).Mul(base, big.NewInt(int64(self.exp.GpobaseCorrectionFactor))) baseCorr.Div(baseCorr, big.NewInt(100)) - if baseCorr.Cmp(self.eth.GpoMinGasPrice) < 0 { - return self.eth.GpoMinGasPrice + if baseCorr.Cmp(self.exp.GpoMinGasPrice) < 0 { + return self.exp.GpoMinGasPrice } - if baseCorr.Cmp(self.eth.GpoMaxGasPrice) > 0 { - return self.eth.GpoMaxGasPrice + if baseCorr.Cmp(self.exp.GpoMaxGasPrice) > 0 { + return self.exp.GpoMaxGasPrice } return baseCorr diff --git a/eth/handler.go b/eth/handler.go index 4f3d1f34cf..19826a12c1 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -1,20 +1,20 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -package eth +package exp import ( "fmt" @@ -23,17 +23,17 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/eth/fetcher" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/pow" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/exp/downloader" + "github.com/expanse-project/go-expanse/exp/fetcher" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p" + "github.com/expanse-project/go-expanse/pow" + "github.com/expanse-project/go-expanse/rlp" ) // This is the target maximum size of returned blocks for the @@ -83,8 +83,8 @@ type ProtocolManager struct { quit bool } -// NewProtocolManager returns a new ethereum sub protocol manager. The Ethereum sub protocol manages peers capable -// with the ethereum network. +// NewProtocolManager returns a new expanse sub protocol manager. The Expanse sub protocol manages peers capable +// with the expanse network. func NewProtocolManager(networkId int, mux *event.TypeMux, txpool txPool, pow pow.PoW, chainman *core.ChainManager) *ProtocolManager { // Create the protocol manager with the base fields manager := &ProtocolManager{ @@ -103,7 +103,7 @@ func NewProtocolManager(networkId int, mux *event.TypeMux, txpool txPool, pow po version := ProtocolVersions[i] manager.SubProtocols[i] = p2p.Protocol{ - Name: "eth", + Name: "exp", Version: version, Length: ProtocolLengths[i], Run: func(p *p2p.Peer, rw p2p.MsgReadWriter) error { @@ -135,7 +135,7 @@ func (pm *ProtocolManager) removePeer(id string) { } glog.V(logger.Debug).Infoln("Removing peer", id) - // Unregister the peer from the downloader and Ethereum peer set + // Unregister the peer from the downloader and Expanse peer set pm.downloader.UnregisterPeer(id) if err := pm.peers.Unregister(id); err != nil { glog.V(logger.Error).Infoln("Removal failed:", err) @@ -162,7 +162,7 @@ func (pm *ProtocolManager) Start() { func (pm *ProtocolManager) Stop() { // Showing a log message. During download / process this could actually // take between 5 to 10 seconds and therefor feedback is required. - glog.V(logger.Info).Infoln("Stopping ethereum protocol handler...") + glog.V(logger.Info).Infoln("Stopping expanse protocol handler...") pm.quit = true pm.txSub.Unsubscribe() // quits txBroadcastLoop @@ -172,19 +172,19 @@ func (pm *ProtocolManager) Stop() { // Wait for any process action pm.wg.Wait() - glog.V(logger.Info).Infoln("Ethereum protocol handler stopped") + glog.V(logger.Info).Infoln("Expanse protocol handler stopped") } func (pm *ProtocolManager) newPeer(pv, nv int, p *p2p.Peer, rw p2p.MsgReadWriter) *peer { return newPeer(pv, nv, p, rw) } -// handle is the callback invoked to manage the life cycle of an eth peer. When +// handle is the callback invoked to manage the life cycle of an exp peer. When // this function terminates, the peer is disconnected. func (pm *ProtocolManager) handle(p *peer) error { glog.V(logger.Debug).Infof("%v: peer connected [%s]", p, p.Name()) - // Execute the Ethereum handshake + // Execute the Expanse handshake td, head, genesis := pm.chainman.Status() if err := p.Handshake(td, head, genesis); err != nil { glog.V(logger.Debug).Infof("%v: handshake failed: %v", p, err) diff --git a/eth/metrics.go b/eth/metrics.go index 625b90b671..2bce1e89da 100644 --- a/eth/metrics.go +++ b/eth/metrics.go @@ -1,44 +1,44 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -package eth +package exp import ( - "github.com/ethereum/go-ethereum/metrics" + "github.com/expanse-project/go-expanse/metrics" ) var ( - propTxnInPacketsMeter = metrics.NewMeter("eth/prop/txns/in/packets") - propTxnInTrafficMeter = metrics.NewMeter("eth/prop/txns/in/traffic") - propTxnOutPacketsMeter = metrics.NewMeter("eth/prop/txns/out/packets") - propTxnOutTrafficMeter = metrics.NewMeter("eth/prop/txns/out/traffic") - propHashInPacketsMeter = metrics.NewMeter("eth/prop/hashes/in/packets") - propHashInTrafficMeter = metrics.NewMeter("eth/prop/hashes/in/traffic") - propHashOutPacketsMeter = metrics.NewMeter("eth/prop/hashes/out/packets") - propHashOutTrafficMeter = metrics.NewMeter("eth/prop/hashes/out/traffic") - propBlockInPacketsMeter = metrics.NewMeter("eth/prop/blocks/in/packets") - propBlockInTrafficMeter = metrics.NewMeter("eth/prop/blocks/in/traffic") - propBlockOutPacketsMeter = metrics.NewMeter("eth/prop/blocks/out/packets") - propBlockOutTrafficMeter = metrics.NewMeter("eth/prop/blocks/out/traffic") - reqHashInPacketsMeter = metrics.NewMeter("eth/req/hashes/in/packets") - reqHashInTrafficMeter = metrics.NewMeter("eth/req/hashes/in/traffic") - reqHashOutPacketsMeter = metrics.NewMeter("eth/req/hashes/out/packets") - reqHashOutTrafficMeter = metrics.NewMeter("eth/req/hashes/out/traffic") - reqBlockInPacketsMeter = metrics.NewMeter("eth/req/blocks/in/packets") - reqBlockInTrafficMeter = metrics.NewMeter("eth/req/blocks/in/traffic") - reqBlockOutPacketsMeter = metrics.NewMeter("eth/req/blocks/out/packets") - reqBlockOutTrafficMeter = metrics.NewMeter("eth/req/blocks/out/traffic") + propTxnInPacketsMeter = metrics.NewMeter("exp/prop/txns/in/packets") + propTxnInTrafficMeter = metrics.NewMeter("exp/prop/txns/in/traffic") + propTxnOutPacketsMeter = metrics.NewMeter("exp/prop/txns/out/packets") + propTxnOutTrafficMeter = metrics.NewMeter("exp/prop/txns/out/traffic") + propHashInPacketsMeter = metrics.NewMeter("exp/prop/hashes/in/packets") + propHashInTrafficMeter = metrics.NewMeter("exp/prop/hashes/in/traffic") + propHashOutPacketsMeter = metrics.NewMeter("exp/prop/hashes/out/packets") + propHashOutTrafficMeter = metrics.NewMeter("exp/prop/hashes/out/traffic") + propBlockInPacketsMeter = metrics.NewMeter("exp/prop/blocks/in/packets") + propBlockInTrafficMeter = metrics.NewMeter("exp/prop/blocks/in/traffic") + propBlockOutPacketsMeter = metrics.NewMeter("exp/prop/blocks/out/packets") + propBlockOutTrafficMeter = metrics.NewMeter("exp/prop/blocks/out/traffic") + reqHashInPacketsMeter = metrics.NewMeter("exp/req/hashes/in/packets") + reqHashInTrafficMeter = metrics.NewMeter("exp/req/hashes/in/traffic") + reqHashOutPacketsMeter = metrics.NewMeter("exp/req/hashes/out/packets") + reqHashOutTrafficMeter = metrics.NewMeter("exp/req/hashes/out/traffic") + reqBlockInPacketsMeter = metrics.NewMeter("exp/req/blocks/in/packets") + reqBlockInTrafficMeter = metrics.NewMeter("exp/req/blocks/in/traffic") + reqBlockOutPacketsMeter = metrics.NewMeter("exp/req/blocks/out/packets") + reqBlockOutTrafficMeter = metrics.NewMeter("exp/req/blocks/out/traffic") ) diff --git a/eth/peer.go b/eth/peer.go index ade1f37eaa..0953981a65 100644 --- a/eth/peer.go +++ b/eth/peer.go @@ -1,20 +1,20 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -package eth +package exp import ( "errors" @@ -22,12 +22,12 @@ import ( "math/big" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/exp/downloader" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p" "gopkg.in/fatih/set.v0" ) @@ -195,7 +195,7 @@ func (p *peer) RequestBlocks(hashes []common.Hash) error { return p2p.Send(p.rw, GetBlocksMsg, hashes) } -// Handshake executes the eth protocol handshake, negotiating version number, +// Handshake executes the exp protocol handshake, negotiating version number, // network IDs, difficulties, head and genesis blocks. func (p *peer) Handshake(td *big.Int, head common.Hash, genesis common.Hash) error { // Send out own handshake in a new thread @@ -242,12 +242,12 @@ func (p *peer) Handshake(td *big.Int, head common.Hash, genesis common.Hash) err // String implements fmt.Stringer. func (p *peer) String() string { return fmt.Sprintf("Peer %s [%s]", p.id, - fmt.Sprintf("eth/%2d", p.version), + fmt.Sprintf("exp/%2d", p.version), ) } // peerSet represents the collection of active peers currently participating in -// the Ethereum sub-protocol. +// the Expanse sub-protocol. type peerSet struct { peers map[string]*peer lock sync.RWMutex diff --git a/eth/protocol.go b/eth/protocol.go index b8c9b50d0e..4fe0d920cc 100644 --- a/eth/protocol.go +++ b/eth/protocol.go @@ -1,29 +1,29 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -package eth +package exp import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" ) -// Supported versions of the eth protocol (first is primary). +// Supported versions of the exp protocol (first is primary). var ProtocolVersions = []uint{61, 60} // Number of implemented message corresponding to different protocol versions. @@ -34,7 +34,7 @@ const ( ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message ) -// eth protocol message codes +// exp protocol message codes const ( StatusMsg = iota NewBlockHashesMsg diff --git a/eth/protocol_test.go b/eth/protocol_test.go index 08c9b6a063..ad47d0bb4c 100644 --- a/eth/protocol_test.go +++ b/eth/protocol_test.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -package eth +package exp import ( "crypto/rand" @@ -23,14 +23,14 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/p2p" + "github.com/expanse-project/go-expanse/p2p/discover" ) func init() { diff --git a/eth/sync.go b/eth/sync.go index b4dea4b0ff..4221fcc760 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -1,30 +1,30 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -package eth +package exp import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p/discover" ) const ( diff --git a/ethdb/README.md b/ethdb/README.md index 5bed8eedc6..fbc451595b 100644 --- a/ethdb/README.md +++ b/ethdb/README.md @@ -1,10 +1,10 @@ # ethdb -The ethdb package contains the ethereum database interfaces +The ethdb package contains the expanse database interfaces # Installation -`go get github.com/ethereum/ethdb-go` +`go get github.com/expanse-project/ethdb-go` # Usage diff --git a/ethdb/database.go b/ethdb/database.go index 9e80e54091..144472ff19 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package ethdb @@ -23,9 +23,9 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/metrics" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/metrics" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/errors" "github.com/syndtr/goleveldb/leveldb/iterator" diff --git a/ethdb/database_test.go b/ethdb/database_test.go index ae49061660..38b3eb2769 100644 --- a/ethdb/database_test.go +++ b/ethdb/database_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package ethdb @@ -20,7 +20,7 @@ import ( "os" "path/filepath" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) func newDb() *LDBDatabase { diff --git a/ethdb/memory_database.go b/ethdb/memory_database.go index 70b03dfade..a5445c2c51 100644 --- a/ethdb/memory_database.go +++ b/ethdb/memory_database.go @@ -1,25 +1,25 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package ethdb import ( "fmt" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) /* diff --git a/event/event.go b/event/event.go index ce74e52862..cbbb3ad1bb 100644 --- a/event/event.go +++ b/event/event.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package event implements an event multiplexer. package event diff --git a/event/event_test.go b/event/event_test.go index 465af38cd9..562ee665eb 100644 --- a/event/event_test.go +++ b/event/event_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package event diff --git a/event/example_test.go b/event/example_test.go index d4642ef2f5..e23d0afe2b 100644 --- a/event/example_test.go +++ b/event/example_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package event diff --git a/event/filter/eth_filter.go b/event/filter/eth_filter.go index 6f61e2b608..d1066f1f38 100644 --- a/event/filter/eth_filter.go +++ b/event/filter/eth_filter.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package filter @@ -21,9 +21,9 @@ package filter import ( "sync" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/event" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/event" ) type FilterManager struct { diff --git a/event/filter/filter.go b/event/filter/filter.go index b1fbf30ee4..d985402e2e 100644 --- a/event/filter/filter.go +++ b/event/filter/filter.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package filter implements event filters. package filter diff --git a/event/filter/filter_test.go b/event/filter/filter_test.go index 0cd26bfc9b..c09255b24b 100644 --- a/event/filter/filter_test.go +++ b/event/filter/filter_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package filter diff --git a/event/filter/generic_filter.go b/event/filter/generic_filter.go index 27f35920d4..497176829b 100644 --- a/event/filter/generic_filter.go +++ b/event/filter/generic_filter.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package filter diff --git a/fdtrack/fdtrack.go b/fdtrack/fdtrack.go new file mode 100644 index 0000000000..6a552be6bc --- /dev/null +++ b/fdtrack/fdtrack.go @@ -0,0 +1,112 @@ +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. +// +// The go-expanse library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-expanse library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-expanse library. If not, see . + +// Package fdtrack logs statistics about open file descriptors. +package fdtrack + +import ( + "fmt" + "net" + "sort" + "sync" + "time" + + "github.com/expanse-project/go-expanse/logger/glog" +) + +var ( + mutex sync.Mutex + all = make(map[string]int) +) + +func Open(desc string) { + mutex.Lock() + all[desc] += 1 + mutex.Unlock() +} + +func Close(desc string) { + mutex.Lock() + defer mutex.Unlock() + if c, ok := all[desc]; ok { + if c == 1 { + delete(all, desc) + } else { + all[desc]-- + } + } +} + +func WrapListener(desc string, l net.Listener) net.Listener { + Open(desc) + return &wrappedListener{l, desc} +} + +type wrappedListener struct { + net.Listener + desc string +} + +func (w *wrappedListener) Accept() (net.Conn, error) { + c, err := w.Listener.Accept() + if err == nil { + c = WrapConn(w.desc, c) + } + return c, err +} + +func (w *wrappedListener) Close() error { + err := w.Listener.Close() + if err == nil { + Close(w.desc) + } + return err +} + +func WrapConn(desc string, conn net.Conn) net.Conn { + Open(desc) + return &wrappedConn{conn, desc} +} + +type wrappedConn struct { + net.Conn + desc string +} + +func (w *wrappedConn) Close() error { + err := w.Conn.Close() + if err == nil { + Close(w.desc) + } + return err +} + +func Start() { + go func() { + for range time.Tick(15 * time.Second) { + mutex.Lock() + var sum, tracked = 0, []string{} + for what, n := range all { + sum += n + tracked = append(tracked, fmt.Sprintf("%s:%d", what, n)) + } + mutex.Unlock() + used, _ := fdusage() + sort.Strings(tracked) + glog.Infof("fd usage %d/%d, tracked %d %v", used, fdlimit(), sum, tracked) + } + }() +} diff --git a/fdtrack/fdusage_darwin.go b/fdtrack/fdusage_darwin.go new file mode 100644 index 0000000000..094a2b6c2c --- /dev/null +++ b/fdtrack/fdusage_darwin.go @@ -0,0 +1,72 @@ +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. +// +// The go-expanse library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-expanse library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-expanse library. If not, see . + +// +build darwin + +package fdtrack + +import ( + "os" + "syscall" + "unsafe" +) + +// #cgo CFLAGS: -lproc +// #include +// #include +import "C" + +func fdlimit() int { + var nofile syscall.Rlimit + if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &nofile); err != nil { + return 0 + } + return int(nofile.Cur) +} + +func fdusage() (int, error) { + pid := C.int(os.Getpid()) + // Query for a rough estimate on the amout of data that + // proc_pidinfo will return. + rlen, err := C.proc_pidinfo(pid, C.PROC_PIDLISTFDS, 0, nil, 0) + if rlen <= 0 { + return 0, err + } + // Load the list of file descriptors. We don't actually care about + // the content, only about the size. Since the number of fds can + // change while we're reading them, the loop enlarges the buffer + // until proc_pidinfo says the result fitted. + var buf unsafe.Pointer + defer func() { + if buf != nil { + C.free(buf) + } + }() + for buflen := rlen; ; buflen *= 2 { + buf, err = C.reallocf(buf, C.size_t(buflen)) + if buf == nil { + return 0, err + } + rlen, err = C.proc_pidinfo(pid, C.PROC_PIDLISTFDS, 0, buf, buflen) + if rlen <= 0 { + return 0, err + } else if rlen == buflen { + continue + } + return int(rlen / C.PROC_PIDLISTFD_SIZE), nil + } + panic("unreachable") +} diff --git a/generators/defaults.go b/generators/defaults.go index 386c6743d9..18a0d2fad4 100644 --- a/generators/defaults.go +++ b/generators/defaults.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . //go:generate go run defaults.go default.json defs.go @@ -51,7 +51,7 @@ func main() { m := make(map[string]setting) json.Unmarshal(content, &m) - filepath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "ethereum", "go-ethereum", "params", os.Args[2]) + filepath := filepath.Join(os.Getenv("GOPATH"), "src", "github.com", "expanse", "go-expanse", "params", os.Args[2]) output, err := os.OpenFile(filepath, os.O_RDWR|os.O_CREATE, os.ModePerm /*0777*/) if err != nil { fatal("error opening file for writing %v\n", err) diff --git a/jsre/bignumber_js.go b/jsre/bignumber_js.go index 2e9c74c9f2..8e0fd5f92e 100644 --- a/jsre/bignumber_js.go +++ b/jsre/bignumber_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package jsre diff --git a/jsre/ethereum_js.go b/jsre/ethereum_js.go index f33bb7c25a..e7a8989e73 100644 --- a/jsre/ethereum_js.go +++ b/jsre/ethereum_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package jsre @@ -635,20 +635,20 @@ module.exports = SolidityTypeBytes; },{"./formatters":9,"./type":14}],7:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file coder.js @@ -923,20 +923,20 @@ module.exports = SolidityTypeDynamicBytes; },{"./formatters":9,"./type":14}],9:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file formatters.js @@ -1213,20 +1213,20 @@ module.exports = SolidityTypeInt; },{"./formatters":9,"./type":14}],11:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file param.js @@ -1845,20 +1845,20 @@ module.exports = { },{"bignumber.js":"bignumber.js"}],19:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file sha3.js @@ -1874,7 +1874,7 @@ module.exports = function (str, isNew) { if (str.substr(0, 2) === '0x' && !isNew) { console.warn('requirement of using web3.fromAscii before sha3 is deprecated'); console.warn('new usage: \'web3.sha3("hello")\''); - console.warn('see https://github.com/ethereum/web3.js/pull/205'); + console.warn('see https://github.com/expanse-project/web3.js/pull/205'); console.warn('if you need to hash hex value, you can do \'sha3("0xfff", true)\''); str = utils.toAscii(str); } @@ -1887,20 +1887,20 @@ module.exports = function (str, isNew) { },{"./utils":20,"crypto-js/sha3":47}],20:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file utils.js @@ -2394,20 +2394,20 @@ module.exports={ },{}],22:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file web3.js * @authors: @@ -2420,11 +2420,11 @@ module.exports={ */ var version = require('./version.json'); -var net = require('./web3/methods/net'); -var eth = require('./web3/methods/eth'); -var db = require('./web3/methods/db'); -var shh = require('./web3/methods/shh'); -var watches = require('./web3/methods/watches'); +var net = require('./web3/net'); +var exp = require('./web3/exp'); +var db = require('./web3/db'); +var shh = require('./web3/shh'); +var watches = require('./web3/watches'); var Filter = require('./web3/filter'); var utils = require('./utils/utils'); var formatters = require('./web3/formatters'); @@ -2445,7 +2445,7 @@ var web3Properties = [ inputFormatter: utils.toDecimal }), new Property({ - name: 'version.ethereum', + name: 'version.expanse', getter: 'eth_protocolVersion', inputFormatter: utils.toDecimal }), @@ -2478,11 +2478,11 @@ web3.providers = {}; web3.currentProvider = null; web3.version = {}; web3.version.api = version.version; -web3.eth = {}; +web3.exp = {}; /*jshint maxparams:4 */ -web3.eth.filter = function (fil, callback) { - return new Filter(fil, watches.eth(), formatters.outputLogFormatter, callback); +web3.exp.filter = function (fil, callback) { + return new Filter(fil, watches.exp(), formatters.outputLogFormatter, callback); }; /*jshint maxparams:3 */ @@ -2520,7 +2520,7 @@ web3.createBatch = function () { }; // ADD defaultblock -Object.defineProperty(web3.eth, 'defaultBlock', { +Object.defineProperty(web3.exp, 'defaultBlock', { get: function () { return c.defaultBlock; }, @@ -2530,7 +2530,7 @@ Object.defineProperty(web3.eth, 'defaultBlock', { } }); -Object.defineProperty(web3.eth, 'defaultAccount', { +Object.defineProperty(web3.exp, 'defaultAccount', { get: function () { return c.defaultAccount; }, @@ -2561,8 +2561,8 @@ web3._extend.Property = require('./web3/property'); setupProperties(web3, web3Properties); setupMethods(web3.net, net.methods); setupProperties(web3.net, net.properties); -setupMethods(web3.eth, eth.methods); -setupProperties(web3.eth, eth.properties); +setupMethods(web3.exp, exp.methods); +setupProperties(web3.exp, exp.properties); setupMethods(web3.db, db.methods); setupMethods(web3.shh, shh.methods); @@ -2571,20 +2571,20 @@ module.exports = web3; },{"./utils/config":18,"./utils/sha3":19,"./utils/utils":20,"./version.json":21,"./web3/batch":24,"./web3/filter":28,"./web3/formatters":29,"./web3/method":35,"./web3/methods/db":36,"./web3/methods/eth":37,"./web3/methods/net":38,"./web3/methods/shh":39,"./web3/methods/watches":40,"./web3/property":42,"./web3/requestmanager":43}],23:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file allevents.js @@ -2647,7 +2647,7 @@ AllSolidityEvents.prototype.execute = function (options, callback) { var o = this.encode(options); var formatter = this.decode.bind(this); - return new Filter(o, watches.eth(), formatter, callback); + return new Filter(o, watches.exp(), formatter, callback); }; AllSolidityEvents.prototype.attachToContract = function (contract) { @@ -2660,20 +2660,20 @@ module.exports = AllSolidityEvents; },{"../utils/sha3":19,"../utils/utils":20,"./event":27,"./filter":28,"./formatters":29,"./methods/watches":40}],24:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file batch.js @@ -2728,20 +2728,20 @@ module.exports = Batch; },{"./errors":26,"./jsonrpc":34,"./requestmanager":43}],25:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file contract.js @@ -2838,7 +2838,7 @@ var checkForContractAddress = function(contract, abi, callback){ callbackFired = false; // wait for receipt - var filter = web3.eth.filter('latest', function(e){ + var filter = web3.exp.filter('latest', function(e){ if(!e && !callbackFired) { count++; @@ -2858,10 +2858,10 @@ var checkForContractAddress = function(contract, abi, callback){ } else { - web3.eth.getTransactionReceipt(contract.transactionHash, function(e, receipt){ + web3.exp.getTransactionReceipt(contract.transactionHash, function(e, receipt){ if(receipt && !callbackFired) { - web3.eth.getCode(receipt.contractAddress, function(e, code){ + web3.exp.getCode(receipt.contractAddress, function(e, code){ /*jshint maxcomplexity: 5 */ if(callbackFired) @@ -2945,7 +2945,7 @@ ContractFactory.prototype.new = function () { if(callback) { // wait for the contract address adn check if the code was deployed - web3.eth.sendTransaction(options, function (err, hash) { + web3.exp.sendTransaction(options, function (err, hash) { if (err) { callback(err); } else { @@ -2959,7 +2959,7 @@ ContractFactory.prototype.new = function () { } }); } else { - var hash = web3.eth.sendTransaction(options); + var hash = web3.exp.sendTransaction(options); // add the transaction hash contract.transactionHash = hash; checkForContractAddress(contract, _this.abi); @@ -3007,20 +3007,20 @@ module.exports = contract; },{"../solidity/coder":7,"../utils/utils":20,"../web3":22,"./allevents":23,"./event":27,"./function":30}],26:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file errors.js @@ -3047,20 +3047,20 @@ module.exports = { },{}],27:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file event.js @@ -3253,23 +3253,22 @@ SolidityEvent.prototype.attachToContract = function (contract) { module.exports = SolidityEvent; - },{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./filter":28,"./formatters":29,"./methods/watches":40}],28:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file filter.js * @authors: @@ -3468,20 +3467,20 @@ module.exports = Filter; },{"../utils/utils":20,"./formatters":29,"./requestmanager":43}],29:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file formatters.js @@ -3757,20 +3756,20 @@ module.exports = { },{"../utils/config":18,"../utils/utils":20,"./iban":32}],30:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file function.js @@ -3867,12 +3866,12 @@ SolidityFunction.prototype.call = function () { if (!callback) { - var output = web3.eth.call(payload, defaultBlock); + var output = web3.exp.call(payload, defaultBlock); return this.unpackOutput(output); } var self = this; - web3.eth.call(payload, defaultBlock, function (error, output) { + web3.exp.call(payload, defaultBlock, function (error, output) { callback(error, self.unpackOutput(output)); }); }; @@ -3889,10 +3888,10 @@ SolidityFunction.prototype.sendTransaction = function () { var payload = this.toPayload(args); if (!callback) { - return web3.eth.sendTransaction(payload); + return web3.exp.sendTransaction(payload); } - web3.eth.sendTransaction(payload, callback); + web3.exp.sendTransaction(payload, callback); }; /** @@ -3907,10 +3906,10 @@ SolidityFunction.prototype.estimateGas = function () { var payload = this.toPayload(args); if (!callback) { - return web3.eth.estimateGas(payload); + return web3.exp.estimateGas(payload); } - web3.eth.estimateGas(payload, callback); + web3.exp.estimateGas(payload, callback); }; /** @@ -3994,20 +3993,20 @@ module.exports = SolidityFunction; },{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"../web3":22,"./formatters":29}],31:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file httpprovider.js * @authors: @@ -4041,7 +4040,7 @@ if (typeof Meteor !== 'undefined' && Meteor.isServer) { // jshint ignore: line * HttpProvider should be used to send rpc calls over http */ var HttpProvider = function (host) { - this.host = host || 'http://localhost:8545'; + this.host = host || 'http://localhost:9656'; }; /** @@ -4142,20 +4141,20 @@ module.exports = HttpProvider; },{"./errors":26,"xmlhttprequest":17}],32:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file iban.js @@ -5209,20 +5208,20 @@ module.exports = { },{"../../utils/utils":20,"../formatters":29,"../method":35,"../property":42}],38:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file eth.js * @authors: @@ -5259,20 +5258,20 @@ module.exports = { },{"../../utils/utils":20,"../property":42}],39:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file shh.js * @authors: @@ -5329,20 +5328,20 @@ module.exports = { },{"../formatters":29,"../method":35}],40:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file watches.js * @authors: @@ -5445,20 +5444,20 @@ module.exports = { },{"../method":35}],41:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file namereg.js @@ -5481,20 +5480,20 @@ module.exports = { },{"../contracts/GlobalRegistrar.json":1,"../contracts/ICAPRegistrar.json":2,"./contract":25}],42:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file property.js @@ -5633,20 +5632,20 @@ module.exports = Property; },{"../utils/utils":20,"./requestmanager":43}],43:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file requestmanager.js @@ -5665,7 +5664,7 @@ var errors = require('./errors'); /** * It's responsible for passing messages to providers - * It's also responsible for polling the ethereum node for incoming messages + * It's also responsible for polling the expanse node for incoming messages * Default poll timeout is 1 second * Singleton */ @@ -5895,20 +5894,20 @@ module.exports = RequestManager; },{"../utils/config":18,"../utils/utils":20,"./errors":26,"./jsonrpc":34}],44:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** * @file transfer.js @@ -5991,7 +5990,6 @@ module.exports = transfer; },{"../contracts/SmartExchange.json":3,"../web3":22,"./contract":25,"./iban":32,"./namereg":41}],45:[function(require,module,exports){ - },{}],46:[function(require,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { @@ -7377,11 +7375,11 @@ var namereg = require('./lib/web3/namereg'); web3.providers.HttpProvider = require('./lib/web3/httpprovider'); web3.providers.IpcProvider = require('./lib/web3/ipcprovider'); -web3.eth.contract = require('./lib/web3/contract'); -web3.eth.namereg = namereg.namereg; -web3.eth.ibanNamereg = namereg.ibanNamereg; -web3.eth.sendIBANTransaction = require('./lib/web3/transfer'); -web3.eth.iban = require('./lib/web3/iban'); +web3.exp.contract = require('./lib/web3/contract'); +web3.exp.namereg = namereg.namereg; +web3.exp.ibanNamereg = namereg.ibanNamereg; +web3.exp.sendIBANTransaction = require('./lib/web3/transfer'); +web3.exp.iban = require('./lib/web3/iban'); // dont override global variable if (typeof window !== 'undefined' && typeof window.web3 === 'undefined') { diff --git a/jsre/jsre.go b/jsre/jsre.go index 0db9e33fc5..4efbaa3dce 100644 --- a/jsre/jsre.go +++ b/jsre/jsre.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package jsre provides execution environment for JavaScript. package jsre @@ -23,7 +23,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" "github.com/robertkrimen/otto" ) diff --git a/jsre/jsre_test.go b/jsre/jsre_test.go index 8450f546c3..570e92ed08 100644 --- a/jsre/jsre_test.go +++ b/jsre/jsre_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package jsre diff --git a/jsre/pp_js.go b/jsre/pp_js.go new file mode 100644 index 0000000000..ad07f6c53f --- /dev/null +++ b/jsre/pp_js.go @@ -0,0 +1,137 @@ +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. +// +// The go-expanse library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-expanse library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-expanse library. If not, see . + +package jsre + +const pp_js = ` +function pp(object, indent) { + try { + JSON.stringify(object) + } catch(e) { + return pp(e, indent); + } + + var str = ""; + if(object instanceof Array) { + str += "["; + for(var i = 0, l = object.length; i < l; i++) { + str += pp(object[i], indent); + + if(i < l-1) { + str += ", "; + } + } + str += " ]"; + } else if (object instanceof Error) { + str += "\033[31m" + "Error:\033[0m " + object.message; + } else if (isBigNumber(object)) { + str += "\033[32m'" + object.toString(10) + "'"; + } else if(typeof(object) === "object") { + str += "{\n"; + indent += " "; + + var fields = getFields(object); + var last = fields[fields.length - 1]; + fields.forEach(function (key) { + str += indent + key + ": "; + try { + str += pp(object[key], indent); + } catch (e) { + str += pp(e, indent); + } + if(key !== last) { + str += ","; + } + str += "\n"; + }); + str += indent.substr(2, indent.length) + "}"; + } else if(typeof(object) === "string") { + str += "\033[32m'" + object + "'"; + } else if(typeof(object) === "undefined") { + str += "\033[1m\033[30m" + object; + } else if(typeof(object) === "number") { + str += "\033[31m" + object; + } else if(typeof(object) === "function") { + str += "\033[35m" + object.toString().split(" {")[0]; + } else { + str += object; + } + + str += "\033[0m"; + + return str; +} + +var redundantFields = [ + 'valueOf', + 'toString', + 'toLocaleString', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' +]; + +var getFields = function (object) { + var members = Object.getOwnPropertyNames(object); + if (object.constructor && object.constructor.prototype) { + members = members.concat(Object.getOwnPropertyNames(object.constructor.prototype)); + } + + var fields = members.filter(function (member) { + return !isMemberFunction(object, member) + }).sort() + var funcs = members.filter(function (member) { + return isMemberFunction(object, member) + }).sort() + + var results = fields.concat(funcs); + return results.filter(function (field) { + return redundantFields.indexOf(field) === -1; + }); +}; + +var isMemberFunction = function(object, member) { + try { + return typeof(object[member]) === "function"; + } catch(e) { + return false; + } +} + +var isBigNumber = function (object) { + var result = typeof BigNumber !== 'undefined' && object instanceof BigNumber; + + if (!result) { + if (typeof(object) === "object" && object.constructor != null) { + result = object.constructor.toString().indexOf("function BigNumber(") == 0; + } + } + + return result +}; + +function prettyPrint(/* */) { + var args = arguments; + var ret = ""; + for(var i = 0, l = args.length; i < l; i++) { + ret += pp(args[i], "") + "\n"; + } + return ret; +} + +var print = prettyPrint; +` diff --git a/logger/example_test.go b/logger/example_test.go index ce5f9da67f..d25aec715b 100644 --- a/logger/example_test.go +++ b/logger/example_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package logger diff --git a/logger/log.go b/logger/log.go index 38a6ce1391..9364aac347 100644 --- a/logger/log.go +++ b/logger/log.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package logger @@ -22,7 +22,7 @@ import ( "log" "os" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) func openLogFile(datadir string, filename string) *os.File { diff --git a/logger/loggers.go b/logger/loggers.go index e63355d0bf..4c2be388b5 100644 --- a/logger/loggers.go +++ b/logger/loggers.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . /* Package logger implements a multi-output leveled logger. @@ -47,7 +47,7 @@ const ( ) // A Logger prints messages prefixed by a given tag. It provides named -// Printf and Println style methods for all loglevels. Each ethereum +// Printf and Println style methods for all loglevels. Each expanse // component should have its own logger with a unique prefix. type Logger struct { tag string diff --git a/logger/loggers_test.go b/logger/loggers_test.go index 85564698bc..3dd23a494c 100644 --- a/logger/loggers_test.go +++ b/logger/loggers_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package logger diff --git a/logger/logsystem.go b/logger/logsystem.go index 24f4351d49..e36d1c6953 100644 --- a/logger/logsystem.go +++ b/logger/logsystem.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package logger diff --git a/logger/sys.go b/logger/sys.go index 18d4ea641c..1f5aafd793 100644 --- a/logger/sys.go +++ b/logger/sys.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package logger diff --git a/logger/types.go b/logger/types.go index ee7e845de8..23fd332c6b 100644 --- a/logger/types.go +++ b/logger/types.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package logger @@ -83,7 +83,7 @@ type EthMinerNewBlock struct { } func (l *EthMinerNewBlock) EventName() string { - return "eth.miner.new_block" + return "exp.miner.new_block" } type EthChainReceivedNewBlock struct { @@ -96,7 +96,7 @@ type EthChainReceivedNewBlock struct { } func (l *EthChainReceivedNewBlock) EventName() string { - return "eth.chain.received.new_block" + return "exp.chain.received.new_block" } type EthChainNewHead struct { @@ -108,7 +108,7 @@ type EthChainNewHead struct { } func (l *EthChainNewHead) EventName() string { - return "eth.chain.new_head" + return "exp.chain.new_head" } type EthTxReceived struct { @@ -118,7 +118,7 @@ type EthTxReceived struct { } func (l *EthTxReceived) EventName() string { - return "eth.tx.received" + return "exp.tx.received" } // @@ -212,7 +212,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *P2PEthDisconnectingBadBlock) EventName() string { -// return "p2p.eth.disconnecting.bad_block" +// return "p2p.exp.disconnecting.bad_block" // } // type P2PEthDisconnectingBadTx struct { @@ -223,7 +223,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *P2PEthDisconnectingBadTx) EventName() string { -// return "p2p.eth.disconnecting.bad_tx" +// return "p2p.exp.disconnecting.bad_tx" // } // type EthNewBlockBroadcasted struct { @@ -236,7 +236,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthNewBlockBroadcasted) EventName() string { -// return "eth.newblock.broadcasted" +// return "exp.newblock.broadcasted" // } // type EthNewBlockIsKnown struct { @@ -249,7 +249,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthNewBlockIsKnown) EventName() string { -// return "eth.newblock.is_known" +// return "exp.newblock.is_known" // } // type EthNewBlockIsNew struct { @@ -262,7 +262,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthNewBlockIsNew) EventName() string { -// return "eth.newblock.is_new" +// return "exp.newblock.is_new" // } // type EthNewBlockMissingParent struct { @@ -275,7 +275,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthNewBlockMissingParent) EventName() string { -// return "eth.newblock.missing_parent" +// return "exp.newblock.missing_parent" // } // type EthNewBlockIsInvalid struct { @@ -288,7 +288,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthNewBlockIsInvalid) EventName() string { -// return "eth.newblock.is_invalid" +// return "exp.newblock.is_invalid" // } // type EthNewBlockChainIsOlder struct { @@ -301,7 +301,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthNewBlockChainIsOlder) EventName() string { -// return "eth.newblock.chain.is_older" +// return "exp.newblock.chain.is_older" // } // type EthNewBlockChainIsCanonical struct { @@ -314,7 +314,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthNewBlockChainIsCanonical) EventName() string { -// return "eth.newblock.chain.is_cannonical" +// return "exp.newblock.chain.is_cannonical" // } // type EthNewBlockChainNotCanonical struct { @@ -327,7 +327,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthNewBlockChainNotCanonical) EventName() string { -// return "eth.newblock.chain.not_cannonical" +// return "exp.newblock.chain.not_cannonical" // } // type EthTxCreated struct { @@ -340,7 +340,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthTxCreated) EventName() string { -// return "eth.tx.created" +// return "exp.tx.created" // } // type EthTxBroadcasted struct { @@ -352,7 +352,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthTxBroadcasted) EventName() string { -// return "eth.tx.broadcasted" +// return "exp.tx.broadcasted" // } // type EthTxValidated struct { @@ -364,7 +364,7 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthTxValidated) EventName() string { -// return "eth.tx.validated" +// return "exp.tx.validated" // } // type EthTxIsInvalid struct { @@ -377,5 +377,5 @@ func (l *EthTxReceived) EventName() string { // } // func (l *EthTxIsInvalid) EventName() string { -// return "eth.tx.is_invalid" +// return "exp.tx.is_invalid" // } diff --git a/logger/verbosity.go b/logger/verbosity.go index aa3d59c30d..713ad1c65a 100644 --- a/logger/verbosity.go +++ b/logger/verbosity.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package logger diff --git a/metrics/disk.go b/metrics/disk.go index 25142d2ad1..18bf3879a9 100644 --- a/metrics/disk.go +++ b/metrics/disk.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package metrics diff --git a/metrics/disk_linux.go b/metrics/disk_linux.go index 8967d490e8..8bb19458fe 100644 --- a/metrics/disk_linux.go +++ b/metrics/disk_linux.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the Linux implementation of process disk IO counter retrieval. diff --git a/metrics/disk_nop.go b/metrics/disk_nop.go index 4319f8b277..47c0a0d2e1 100644 --- a/metrics/disk_nop.go +++ b/metrics/disk_nop.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // +build !linux diff --git a/metrics/metrics.go b/metrics/metrics.go index 6d1a065edb..3b865bff99 100644 --- a/metrics/metrics.go +++ b/metrics/metrics.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package metrics provides general system and process level metrics collection. package metrics @@ -23,8 +23,8 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" "github.com/rcrowley/go-metrics" ) diff --git a/miner/agent.go b/miner/agent.go index 2f8d9fee42..f23da4f96d 100644 --- a/miner/agent.go +++ b/miner/agent.go @@ -1,28 +1,28 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package miner import ( "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/pow" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/pow" ) type CpuAgent struct { diff --git a/miner/miner.go b/miner/miner.go index b550ed6d62..1ff3c029da 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package miner implements Ethereum block creation and mining. +// Package miner implements Expanse block creation and mining. package miner import ( @@ -44,15 +44,15 @@ type Miner struct { threads int coinbase common.Address mining int32 - eth core.Backend + exp core.Backend pow pow.PoW canStart int32 // can start indicates whether we can start the mining operation shouldStart int32 // should start indicates whether we should start after sync } -func New(eth core.Backend, mux *event.TypeMux, pow pow.PoW) *Miner { - miner := &Miner{eth: eth, mux: mux, pow: pow, worker: newWorker(common.Address{}, eth), canStart: 1} +func New(exp core.Backend, mux *event.TypeMux, pow pow.PoW) *Miner { + miner := &Miner{exp: exp, mux: mux, pow: pow, worker: newWorker(common.Address{}, exp), canStart: 1} go miner.update() return miner diff --git a/miner/remote_agent.go b/miner/remote_agent.go index 5c672a6e02..61bf181ec6 100644 --- a/miner/remote_agent.go +++ b/miner/remote_agent.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package miner @@ -21,10 +21,10 @@ import ( "sync" "time" - "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/ethash" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) type hashrate struct { diff --git a/miner/worker.go b/miner/worker.go index 86970ec071..9220ae59e3 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package miner @@ -24,15 +24,15 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/pow" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/pow" "gopkg.in/fatih/set.v0" ) @@ -97,7 +97,7 @@ type worker struct { quit chan struct{} pow pow.PoW - eth core.Backend + exp core.Backend chain *core.ChainManager proc *core.BlockProcessor chainDb common.Database @@ -122,15 +122,15 @@ type worker struct { fullValidation bool } -func newWorker(coinbase common.Address, eth core.Backend) *worker { +func newWorker(coinbase common.Address, exp core.Backend) *worker { worker := &worker{ - eth: eth, - mux: eth.EventMux(), - chainDb: eth.ChainDb(), + exp: exp, + mux: exp.EventMux(), + extraDb: exp.ExtraDb(), recv: make(chan *Result, resultQueueSize), gasPrice: new(big.Int), - chain: eth.ChainManager(), - proc: eth.BlockProcessor(), + chain: exp.ChainManager(), + proc: exp.BlockProcessor(), possibleUncles: make(map[common.Hash]*types.Block), coinbase: coinbase, txQueue: make(map[common.Hash]*types.Transaction), @@ -347,7 +347,7 @@ func (self *worker) push(work *Work) { // makeCurrent creates a new environment for the current cycle. func (self *worker) makeCurrent(parent *types.Block, header *types.Header) { - state := state.New(parent.Root(), self.eth.ChainDb()) + state := state.New(parent.Root(), self.exp.ChainDb()) work := &Work{ state: state, ancestors: set.New(), @@ -366,7 +366,7 @@ func (self *worker) makeCurrent(parent *types.Block, header *types.Header) { work.family.Add(ancestor.Hash()) work.ancestors.Add(ancestor.Hash()) } - accounts, _ := self.eth.AccountManager().Accounts() + accounts, _ := self.exp.AccountManager().Accounts() // Keep track of transactions which return errors so they can be removed work.remove = set.New() @@ -461,19 +461,19 @@ func (self *worker) commitNewWork() { work := self.current /* //approach 1 - transactions := self.eth.TxPool().GetTransactions() + transactions := self.exp.TxPool().GetTransactions() sort.Sort(types.TxByNonce{transactions}) */ //approach 2 - transactions := self.eth.TxPool().GetTransactions() + transactions := self.exp.TxPool().GetTransactions() sort.Sort(types.TxByPriceAndNonce{transactions}) /* // approach 3 // commit transactions for this run. txPerOwner := make(map[common.Address]types.Transactions) // Sort transactions by owner - for _, tx := range self.eth.TxPool().GetTransactions() { + for _, tx := range self.exp.TxPool().GetTransactions() { from, _ := tx.From() // we can ignore the sender error txPerOwner[from] = append(txPerOwner[from], tx) } @@ -498,7 +498,7 @@ func (self *worker) commitNewWork() { work.coinbase.SetGasLimit(header.GasLimit) work.commitTransactions(transactions, self.gasPrice, self.proc) - self.eth.TxPool().RemoveTransactions(work.lowGasTxs) + self.exp.TxPool().RemoveTransactions(work.lowGasTxs) // compute uncles for the new block. var ( diff --git a/p2p/dial.go b/p2p/dial.go index 0fd3a4cf52..2ef5c4edaf 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p diff --git a/p2p/dial_test.go b/p2p/dial_test.go index d24e03e292..d9d385807c 100644 --- a/p2p/dial_test.go +++ b/p2p/dial_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p @@ -23,7 +23,7 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/expanse-project/go-expanse/p2p/discover" ) func init() { diff --git a/p2p/discover/database.go b/p2p/discover/database.go index d5c594364f..0c182934f9 100644 --- a/p2p/discover/database.go +++ b/p2p/discover/database.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the node database, storing previously seen nodes and any collected // metadata about them for QoS purposes. @@ -26,10 +26,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rlp" "github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb/errors" "github.com/syndtr/goleveldb/leveldb/iterator" diff --git a/p2p/discover/database_test.go b/p2p/discover/database_test.go index 569585903f..ed1b29a591 100644 --- a/p2p/discover/database_test.go +++ b/p2p/discover/database_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package discover @@ -105,8 +105,8 @@ func TestNodeDBFetchStore(t *testing.T) { node := newNode( MustHexID("0x1dd9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"), net.IP{192, 168, 0, 1}, - 30303, - 30303, + 60606, + 60606, ) inst := time.Now() num := 314 @@ -166,8 +166,8 @@ var nodeDBSeedQueryNodes = []struct { node: newNode( MustHexID("0x01d9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"), net.IP{127, 0, 0, 1}, - 30303, - 30303, + 60606, + 60606, ), pong: time.Now().Add(-2 * time.Second), }, @@ -175,8 +175,8 @@ var nodeDBSeedQueryNodes = []struct { node: newNode( MustHexID("0x02d9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"), net.IP{127, 0, 0, 2}, - 30303, - 30303, + 60606, + 60606, ), pong: time.Now().Add(-3 * time.Second), }, @@ -184,8 +184,8 @@ var nodeDBSeedQueryNodes = []struct { node: newNode( MustHexID("0x03d9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"), net.IP{127, 0, 0, 3}, - 30303, - 30303, + 60606, + 60606, ), pong: time.Now().Add(-1 * time.Second), }, @@ -335,8 +335,8 @@ var nodeDBExpirationNodes = []struct { node: newNode( MustHexID("0x01d9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"), net.IP{127, 0, 0, 1}, - 30303, - 30303, + 60606, + 60606, ), pong: time.Now().Add(-nodeDBNodeExpiration + time.Minute), exp: false, @@ -344,8 +344,8 @@ var nodeDBExpirationNodes = []struct { node: newNode( MustHexID("0x02d9d65c4552b5eb43d5ad55a2ee3f56c6cbc1c64a5c8d659f51fcd51bace24351232b8d7821617d2b29b54b81cdefb9b3e9c37d7fd5f63270bcc9e1a6f6a439"), net.IP{127, 0, 0, 2}, - 30303, - 30303, + 60606, + 60606, ), pong: time.Now().Add(-nodeDBNodeExpiration - time.Minute), exp: true, diff --git a/p2p/discover/node.go b/p2p/discover/node.go index a14f294249..279b48b4a2 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package discover @@ -29,9 +29,9 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/secp256k1" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/crypto/secp256k1" ) const nodeIDBits = 512 @@ -98,10 +98,10 @@ func (n *Node) String() string { // parameter "discport". // // In the following example, the node URL describes -// a node with IP address 10.3.58.6, TCP listening port 30303 +// a node with IP address 10.3.58.6, TCP listening port 60606 // and UDP discovery port 30301. // -// enode://@10.3.58.6:30303?discport=30301 +// enode://@10.3.58.6:60606?discport=30301 func ParseNode(rawurl string) (*Node, error) { var ( id NodeID diff --git a/p2p/discover/node_test.go b/p2p/discover/node_test.go index e523e12d2f..5f02f02296 100644 --- a/p2p/discover/node_test.go +++ b/p2p/discover/node_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package discover @@ -25,8 +25,8 @@ import ( "testing/quick" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) var parseNodeTests = []struct { diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 972bc10777..62c797aa9c 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package discover implements the Node Discovery Protocol. // @@ -30,10 +30,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) const ( diff --git a/p2p/discover/table_test.go b/p2p/discover/table_test.go index 426f4e9ccc..1213d4c277 100644 --- a/p2p/discover/table_test.go +++ b/p2p/discover/table_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package discover @@ -27,8 +27,8 @@ import ( "testing/quick" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) func TestTable_pingReplace(t *testing.T) { diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index afb31ee69d..cba1ccc60c 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package discover @@ -219,7 +219,7 @@ func newUDP(priv *ecdsa.PrivateKey, c conn, natm nat.Interface, nodeDBPath strin realaddr := c.LocalAddr().(*net.UDPAddr) if natm != nil { if !realaddr.IP.IsLoopback() { - go nat.Map(natm, udp.closing, "udp", realaddr.Port, realaddr.Port, "ethereum discovery") + go nat.Map(natm, udp.closing, "udp", realaddr.Port, realaddr.Port, "expanse discovery") } // TODO: react to external IP changes over time. if ext, err := natm.ExternalIP(); err == nil { diff --git a/p2p/discover/udp_test.go b/p2p/discover/udp_test.go index a86d3737bc..f9181d5b4f 100644 --- a/p2p/discover/udp_test.go +++ b/p2p/discover/udp_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package discover @@ -34,8 +34,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" ) func init() { @@ -67,7 +67,7 @@ func newUDPTest(t *testing.T) *udpTest { pipe: newpipe(), localkey: newkey(), remotekey: newkey(), - remoteaddr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 30303}, + remoteaddr: &net.UDPAddr{IP: net.IP{1, 2, 3, 4}, Port: 60606}, } test.table, test.udp = newUDP(test.localkey, test.pipe, nil, "") return test @@ -296,10 +296,10 @@ func TestUDP_findnodeMultiReply(t *testing.T) { // send the reply as two packets. list := []*Node{ - MustParseNode("enode://ba85011c70bcc5c04d8607d3a0ed29aa6179c092cbdda10d5d32684fb33ed01bd94f588ca8f91ac48318087dcb02eaf36773a7a453f0eedd6742af668097b29c@10.0.1.16:30303?discport=30304"), - MustParseNode("enode://81fa361d25f157cd421c60dcc28d8dac5ef6a89476633339c5df30287474520caca09627da18543d9079b5b288698b542d56167aa5c09111e55acdbbdf2ef799@10.0.1.16:30303"), + MustParseNode("enode://ba85011c70bcc5c04d8607d3a0ed29aa6179c092cbdda10d5d32684fb33ed01bd94f588ca8f91ac48318087dcb02eaf36773a7a453f0eedd6742af668097b29c@10.0.1.16:60606?discport=30304"), + MustParseNode("enode://81fa361d25f157cd421c60dcc28d8dac5ef6a89476633339c5df30287474520caca09627da18543d9079b5b288698b542d56167aa5c09111e55acdbbdf2ef799@10.0.1.16:60606"), MustParseNode("enode://9bffefd833d53fac8e652415f4973bee289e8b1a5c6c4cbe70abf817ce8a64cee11b823b66a987f51aaa9fba0d6a91b3e6bf0d5a5d1042de8e9eeea057b217f8@10.0.1.36:30301?discport=17"), - MustParseNode("enode://1b5b4aa662d7cb44a7221bfba67302590b643028197a7d5214790f3bac7aaa4a3241be9e83c09cf1f6c69d007c634faae3dc1b1221793e8446c0b3a09de65960@10.0.1.16:30303"), + MustParseNode("enode://1b5b4aa662d7cb44a7221bfba67302590b643028197a7d5214790f3bac7aaa4a3241be9e83c09cf1f6c69d007c634faae3dc1b1221793e8446c0b3a09de65960@10.0.1.16:60606"), } rpclist := make([]rpcNode, len(list)) for i := range list { diff --git a/p2p/message.go b/p2p/message.go index 1292d21213..30affb780d 100644 --- a/p2p/message.go +++ b/p2p/message.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p @@ -27,7 +27,7 @@ import ( "sync/atomic" "time" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/rlp" ) // Msg defines the structure of a p2p message. diff --git a/p2p/message_test.go b/p2p/message_test.go index 8599b7e87c..1457ea0dc3 100644 --- a/p2p/message_test.go +++ b/p2p/message_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p diff --git a/p2p/metrics.go b/p2p/metrics.go index f98cac2742..9eb6740385 100644 --- a/p2p/metrics.go +++ b/p2p/metrics.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the meters and timers used by the networking layer. @@ -21,7 +21,7 @@ package p2p import ( "net" - "github.com/ethereum/go-ethereum/metrics" + "github.com/expanse-project/go-expanse/metrics" ) var ( diff --git a/p2p/nat/nat.go b/p2p/nat/nat.go index 505a1fc77b..4fbe6c6f35 100644 --- a/p2p/nat/nat.go +++ b/p2p/nat/nat.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package nat provides access to common network port mapping protocols. package nat @@ -25,8 +25,8 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" "github.com/jackpal/go-nat-pmp" ) diff --git a/p2p/nat/nat_test.go b/p2p/nat/nat_test.go index a079e7a22c..420b595fd1 100644 --- a/p2p/nat/nat_test.go +++ b/p2p/nat/nat_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package nat diff --git a/p2p/nat/natpmp.go b/p2p/nat/natpmp.go index c2f9408914..01687d49c0 100644 --- a/p2p/nat/natpmp.go +++ b/p2p/nat/natpmp.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package nat diff --git a/p2p/nat/natupnp.go b/p2p/nat/natupnp.go index 0bcb262bf6..4a46e75d9b 100644 --- a/p2p/nat/natupnp.go +++ b/p2p/nat/natupnp.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package nat diff --git a/p2p/nat/natupnp_test.go b/p2p/nat/natupnp_test.go index 79f6d25ae8..f575c5e42b 100644 --- a/p2p/nat/natupnp_test.go +++ b/p2p/nat/natupnp_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package nat diff --git a/p2p/peer.go b/p2p/peer.go index 1b3b19c798..4af6c8f7e8 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p @@ -25,10 +25,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p/discover" + "github.com/expanse-project/go-expanse/rlp" ) const ( diff --git a/p2p/peer_error.go b/p2p/peer_error.go index 62c7b665dd..1f5a0caf01 100644 --- a/p2p/peer_error.go +++ b/p2p/peer_error.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p diff --git a/p2p/peer_test.go b/p2p/peer_test.go index 6f96a823b4..33908f3115 100644 --- a/p2p/peer_test.go +++ b/p2p/peer_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p diff --git a/p2p/protocol.go b/p2p/protocol.go index ac0c3d9426..d441ef3d5c 100644 --- a/p2p/protocol.go +++ b/p2p/protocol.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p diff --git a/p2p/rlpx.go b/p2p/rlpx.go index aaa7338547..51f3be4434 100644 --- a/p2p/rlpx.go +++ b/p2p/rlpx.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p @@ -32,12 +32,12 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/crypto/secp256k1" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/crypto/ecies" + "github.com/expanse-project/go-expanse/crypto/secp256k1" + "github.com/expanse-project/go-expanse/crypto/sha3" + "github.com/expanse-project/go-expanse/p2p/discover" + "github.com/expanse-project/go-expanse/rlp" ) const ( diff --git a/p2p/rlpx_test.go b/p2p/rlpx_test.go index 900353f0ee..79e33b20a1 100644 --- a/p2p/rlpx_test.go +++ b/p2p/rlpx_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p @@ -30,11 +30,11 @@ import ( "time" "github.com/davecgh/go-spew/spew" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/crypto/ecies" + "github.com/expanse-project/go-expanse/crypto/sha3" + "github.com/expanse-project/go-expanse/p2p/discover" + "github.com/expanse-project/go-expanse/rlp" ) func TestSharedSecret(t *testing.T) { diff --git a/p2p/server.go b/p2p/server.go index 6060adc71d..444faa3e8e 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package p2p implements the Ethereum p2p network protocols. +// Package p2p implements the Expanse p2p network protocols. package p2p import ( @@ -379,7 +379,7 @@ func (srv *Server) startListening() error { if !laddr.IP.IsLoopback() && srv.NAT != nil { srv.loopWG.Add(1) go func() { - nat.Map(srv.NAT, srv.quit, "tcp", laddr.Port, laddr.Port, "ethereum p2p") + nat.Map(srv.NAT, srv.quit, "tcp", laddr.Port, laddr.Port, "expanse p2p") srv.loopWG.Done() }() } diff --git a/p2p/server_test.go b/p2p/server_test.go index 976d5baf59..18c6c0a107 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package p2p @@ -25,9 +25,9 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/crypto/sha3" + "github.com/expanse-project/go-expanse/p2p/discover" ) func init() { diff --git a/params/protocol_params.go b/params/protocol_params.go index dcc17e05d7..665c8b5d99 100755 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // DO NOT EDIT!!! // AUTOGENERATED FROM generators/defaults.go @@ -40,7 +40,7 @@ var ( Sha256WordGas = big.NewInt(12) // MinGasLimit = big.NewInt(5000) // Minimum the gas limit may ever be. - GenesisGasLimit = big.NewInt(3141592) // Gas limit of the Genesis block. + GenesisGasLimit = big.NewInt(31415926) // Gas limit of the Genesis block. Sha3Gas = big.NewInt(30) // Once per SHA3 operation. Sha256Gas = big.NewInt(60) // @@ -59,7 +59,7 @@ var ( Ripemd160WordGas = big.NewInt(120) // MinimumDifficulty = big.NewInt(131072) // The minimum that the difficulty may ever be. CallCreateDepth = big.NewInt(1024) // Maximum depth of call/create stack. - ExpGas = big.NewInt(10) // Once per EXP instuction. + ExpGas = big.NewInt(10) // Once per EXP instruction. LogGas = big.NewInt(375) // Per LOG* operation. CopyGas = big.NewInt(3) // StackLimit = big.NewInt(1024) // Maximum size of VM stack allowed. diff --git a/pow/block.go b/pow/block.go index 11807113dc..d39770e6dd 100644 --- a/pow/block.go +++ b/pow/block.go @@ -1,26 +1,26 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package pow import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" ) type Block interface { diff --git a/pow/dagger/dagger.go b/pow/dagger/dagger.go index f54ba71ca1..9d761e3af0 100644 --- a/pow/dagger/dagger.go +++ b/pow/dagger/dagger.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package dagger @@ -22,9 +22,9 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/logger" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto/sha3" + "github.com/expanse-project/go-expanse/logger" ) var powlogger = logger.NewLogger("POW") diff --git a/pow/dagger/dagger_test.go b/pow/dagger/dagger_test.go index 39b74df306..c66c02c0e0 100644 --- a/pow/dagger/dagger_test.go +++ b/pow/dagger/dagger_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package dagger @@ -20,7 +20,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) func BenchmarkDaggerSearch(b *testing.B) { diff --git a/pow/ezp/pow.go b/pow/ezp/pow.go index 03bb3da291..935913b26d 100644 --- a/pow/ezp/pow.go +++ b/pow/ezp/pow.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package ezp @@ -22,10 +22,10 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto/sha3" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/pow" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto/sha3" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/pow" ) var powlogger = logger.NewLogger("POW") diff --git a/pow/pow.go b/pow/pow.go index 22daf35e4d..be9d8f637f 100644 --- a/pow/pow.go +++ b/pow/pow.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package pow diff --git a/rlp/decode.go b/rlp/decode.go index 1381f5274e..7da365cb00 100644 --- a/rlp/decode.go +++ b/rlp/decode.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package rlp diff --git a/rlp/decode_test.go b/rlp/decode_test.go index d6b0611dd0..9fac81b171 100644 --- a/rlp/decode_test.go +++ b/rlp/decode_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package rlp diff --git a/rlp/doc.go b/rlp/doc.go index 72667416cf..32af758b9b 100644 --- a/rlp/doc.go +++ b/rlp/doc.go @@ -1,27 +1,27 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . /* Package rlp implements the RLP serialization format. The purpose of RLP (Recursive Linear Prefix) qis to encode arbitrarily nested arrays of binary data, and RLP is the main encoding method used -to serialize objects in Ethereum. The only purpose of RLP is to encode +to serialize objects in Expanse. The only purpose of RLP is to encode structure; encoding specific atomic data types (eg. strings, ints, -floats) is left up to higher-order protocols; in Ethereum integers +floats) is left up to higher-order protocols; in Expanse integers must be represented in big endian binary form with no leading zeroes (thus making the integer value zero be equivalent to the empty byte array). diff --git a/rlp/encode.go b/rlp/encode.go index b525ae4e7a..0fa8e4e336 100644 --- a/rlp/encode.go +++ b/rlp/encode.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package rlp diff --git a/rlp/encode_test.go b/rlp/encode_test.go index 60bd956926..0e9b364a8a 100644 --- a/rlp/encode_test.go +++ b/rlp/encode_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package rlp diff --git a/rlp/encoder_example_test.go b/rlp/encoder_example_test.go index 1cffa241c2..80f92528b8 100644 --- a/rlp/encoder_example_test.go +++ b/rlp/encoder_example_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package rlp diff --git a/rlp/typecache.go b/rlp/typecache.go index 0ab096695f..152061b66a 100644 --- a/rlp/typecache.go +++ b/rlp/typecache.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package rlp diff --git a/rpc/api/admin.go b/rpc/api/admin.go index 5e392ae320..ca727e2f92 100644 --- a/rpc/api/admin.go +++ b/rpc/api/admin.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -82,17 +82,17 @@ type adminhandler func(*adminApi, *shared.Request) (interface{}, error) // admin api provider type adminApi struct { xeth *xeth.XEth - ethereum *eth.Ethereum + expanse *exp.Expanse codec codec.Codec coder codec.ApiCoder ds *docserver.DocServer } // create a new admin api instance -func NewAdminApi(xeth *xeth.XEth, ethereum *eth.Ethereum, codec codec.Codec) *adminApi { +func NewAdminApi(xeth *xeth.XEth, expanse *exp.Expanse, codec codec.Codec) *adminApi { return &adminApi{ xeth: xeth, - ethereum: ethereum, + expanse: expanse, codec: codec, coder: codec.New(nil), ds: docserver.New("/"), @@ -133,7 +133,7 @@ func (self *adminApi) AddPeer(req *shared.Request) (interface{}, error) { return nil, shared.NewDecodeParamError(err.Error()) } - err := self.ethereum.AddPeer(args.Url) + err := self.expanse.AddPeer(args.Url) if err == nil { return true, nil } @@ -141,15 +141,15 @@ func (self *adminApi) AddPeer(req *shared.Request) (interface{}, error) { } func (self *adminApi) Peers(req *shared.Request) (interface{}, error) { - return self.ethereum.PeersInfo(), nil + return self.expanse.PeersInfo(), nil } func (self *adminApi) NodeInfo(req *shared.Request) (interface{}, error) { - return self.ethereum.NodeInfo(), nil + return self.expanse.NodeInfo(), nil } func (self *adminApi) DataDir(req *shared.Request) (interface{}, error) { - return self.ethereum.DataDir, nil + return self.expanse.DataDir, nil } func hasAllBlocks(chain *core.ChainManager, bs []*types.Block) bool { @@ -194,10 +194,10 @@ func (self *adminApi) ImportChain(req *shared.Request) (interface{}, error) { break } // Import the batch. - if hasAllBlocks(self.ethereum.ChainManager(), blocks[:i]) { + if hasAllBlocks(self.expanse.ChainManager(), blocks[:i]) { continue } - if _, err := self.ethereum.ChainManager().InsertChain(blocks[:i]); err != nil { + if _, err := self.expanse.ChainManager().InsertChain(blocks[:i]); err != nil { return false, fmt.Errorf("invalid block %d: %v", n, err) } } @@ -215,7 +215,7 @@ func (self *adminApi) ExportChain(req *shared.Request) (interface{}, error) { return false, err } defer fh.Close() - if err := self.ethereum.ChainManager().Export(fh); err != nil { + if err := self.expanse.ChainManager().Export(fh); err != nil { return false, err } @@ -233,7 +233,7 @@ func (self *adminApi) Verbosity(req *shared.Request) (interface{}, error) { } func (self *adminApi) ChainSyncStatus(req *shared.Request) (interface{}, error) { - pending, cached, importing, estimate := self.ethereum.Downloader().Stats() + pending, cached, importing, estimate := self.expanse.Downloader().Stats() return map[string]interface{}{ "blocksAvailable": pending, @@ -268,7 +268,7 @@ func (self *adminApi) StartRPC(req *shared.Request) (interface{}, error) { CorsDomain: args.CorsDomain, } - apis, err := ParseApiString(args.Apis, self.codec, self.xeth, self.ethereum) + apis, err := ParseApiString(args.Apis, self.codec, self.xeth, self.expanse) if err != nil { return false, err } @@ -434,12 +434,12 @@ func (self *adminApi) RegisterUrl(req *shared.Request) (interface{}, error) { } func (self *adminApi) StartNatSpec(req *shared.Request) (interface{}, error) { - self.ethereum.NatSpec = true + self.expanse.NatSpec = true return true, nil } func (self *adminApi) StopNatSpec(req *shared.Request) (interface{}, error) { - self.ethereum.NatSpec = false + self.expanse.NatSpec = false return true, nil } diff --git a/rpc/api/admin_args.go b/rpc/api/admin_args.go index e3a2f72bf9..08e08db02e 100644 --- a/rpc/api/admin_args.go +++ b/rpc/api/admin_args.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( "encoding/json" - "github.com/ethereum/go-ethereum/common/compiler" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/common/compiler" + "github.com/expanse-project/go-expanse/rpc/shared" ) type AddPeerArgs struct { @@ -127,8 +127,8 @@ func (args *StartRPCArgs) UnmarshalJSON(b []byte) (err error) { } args.ListenAddress = "127.0.0.1" - args.ListenPort = 8545 - args.Apis = "net,eth,web3" + args.ListenPort = 9656 + args.Apis = "net,exp,web3" if len(obj) >= 1 && obj[0] != nil { if addr, ok := obj[0].(string); ok { diff --git a/rpc/api/admin_js.go b/rpc/api/admin_js.go index 25dbb4a8d3..fb27e35eeb 100644 --- a/rpc/api/admin_js.go +++ b/rpc/api/admin_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api diff --git a/rpc/api/api.go b/rpc/api/api.go index e03250ec6d..5cbb1402f6 100644 --- a/rpc/api/api.go +++ b/rpc/api/api.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) // Merge multiple API's to a single API instance -func Merge(apis ...shared.EthereumApi) shared.EthereumApi { +func Merge(apis ...shared.ExpanseApi) shared.ExpanseApi { return newMergedApi(apis...) } diff --git a/rpc/api/api_test.go b/rpc/api/api_test.go index 131ef68f81..d1c6c0594c 100644 --- a/rpc/api/api_test.go +++ b/rpc/api/api_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -22,11 +22,11 @@ import ( "encoding/json" "strconv" - "github.com/ethereum/go-ethereum/common/compiler" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/common/compiler" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" ) func TestParseApiString(t *testing.T) { @@ -39,7 +39,7 @@ func TestParseApiString(t *testing.T) { t.Errorf("Expected 0 apis from empty API string") } - apis, err = ParseApiString("eth", codec.JSON, nil, nil) + apis, err = ParseApiString("exp", codec.JSON, nil, nil) if err != nil { t.Errorf("Expected nil err from parsing empty API string but got %v", err) } @@ -48,7 +48,7 @@ func TestParseApiString(t *testing.T) { t.Errorf("Expected 1 apis but got %d - %v", apis, apis) } - apis, err = ParseApiString("eth,eth", codec.JSON, nil, nil) + apis, err = ParseApiString("exp,exp", codec.JSON, nil, nil) if err != nil { t.Errorf("Expected nil err from parsing empty API string but got \"%v\"", err) } @@ -57,7 +57,7 @@ func TestParseApiString(t *testing.T) { t.Errorf("Expected 2 apis but got %d - %v", apis, apis) } - apis, err = ParseApiString("eth,invalid", codec.JSON, nil, nil) + apis, err = ParseApiString("exp,invalid", codec.JSON, nil, nil) if err == nil { t.Errorf("Expected an err but got no err") } @@ -92,9 +92,9 @@ func TestCompileSolidity(t *testing.T) { expLanguageVersion := "0" expSource := source - eth := ð.Ethereum{} - xeth := xeth.NewTest(eth, nil) - api := NewEthApi(xeth, eth, codec.JSON) + exp := &exp.Expanse{} + xeth := xeth.NewTest(exp, nil) + api := NewEthApi(xeth, exp, codec.JSON) var rpcRequest shared.Request json.Unmarshal([]byte(jsonstr), &rpcRequest) diff --git a/rpc/api/args.go b/rpc/api/args.go index 20f073b670..f9cfe50878 100644 --- a/rpc/api/args.go +++ b/rpc/api/args.go @@ -1,25 +1,25 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( "encoding/json" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) type CompileArgs struct { diff --git a/rpc/api/args_test.go b/rpc/api/args_test.go index 23ae2930d0..2661acae50 100644 --- a/rpc/api/args_test.go +++ b/rpc/api/args_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -23,7 +23,7 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) func TestBlockheightInvalidString(t *testing.T) { diff --git a/rpc/api/db.go b/rpc/api/db.go index 0eddc410ed..38917891e9 100644 --- a/rpc/api/db.go +++ b/rpc/api/db.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" ) const ( @@ -43,16 +43,16 @@ type dbhandler func(*dbApi, *shared.Request) (interface{}, error) // db api provider type dbApi struct { xeth *xeth.XEth - ethereum *eth.Ethereum + expanse *exp.Expanse methods map[string]dbhandler codec codec.ApiCoder } // create a new db api instance -func NewDbApi(xeth *xeth.XEth, ethereum *eth.Ethereum, coder codec.Codec) *dbApi { +func NewDbApi(xeth *xeth.XEth, expanse *exp.Expanse, coder codec.Codec) *dbApi { return &dbApi{ xeth: xeth, - ethereum: ethereum, + expanse: expanse, methods: DbMapping, codec: coder.New(nil), } diff --git a/rpc/api/db_args.go b/rpc/api/db_args.go index d61ea77ee0..10faecfe7e 100644 --- a/rpc/api/db_args.go +++ b/rpc/api/db_args.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( "encoding/json" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/rpc/shared" ) type DbArgs struct { diff --git a/rpc/api/db_js.go b/rpc/api/db_js.go index 899f8abd9a..59fff32fef 100644 --- a/rpc/api/db_js.go +++ b/rpc/api/db_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api diff --git a/rpc/api/debug.go b/rpc/api/debug.go index d325b17209..934a1fca2b 100644 --- a/rpc/api/debug.go +++ b/rpc/api/debug.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -21,14 +21,14 @@ import ( "strings" "time" - "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/ethash" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rlp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" "github.com/rcrowley/go-metrics" ) @@ -55,16 +55,16 @@ type debughandler func(*debugApi, *shared.Request) (interface{}, error) // admin api provider type debugApi struct { xeth *xeth.XEth - ethereum *eth.Ethereum + expanse *exp.Expanse methods map[string]debughandler codec codec.ApiCoder } // create a new debug api instance -func NewDebugApi(xeth *xeth.XEth, ethereum *eth.Ethereum, coder codec.Codec) *debugApi { +func NewDebugApi(xeth *xeth.XEth, expanse *exp.Expanse, coder codec.Codec) *debugApi { return &debugApi{ xeth: xeth, - ethereum: ethereum, + expanse: expanse, methods: DebugMapping, codec: coder.New(nil), } @@ -119,7 +119,7 @@ func (self *debugApi) DumpBlock(req *shared.Request) (interface{}, error) { return nil, fmt.Errorf("block #%d not found", args.BlockNumber) } - stateDb := state.New(block.Root(), self.ethereum.ChainDb()) + stateDb := state.New(block.Root(), self.expanse.ChainDb()) if stateDb == nil { return nil, nil } @@ -152,7 +152,7 @@ func (self *debugApi) SetHead(req *shared.Request) (interface{}, error) { return nil, fmt.Errorf("block #%d not found", args.BlockNumber) } - self.ethereum.ChainManager().SetHead(block) + self.expanse.ChainManager().SetHead(block) return nil, nil } @@ -172,7 +172,7 @@ func (self *debugApi) ProcessBlock(req *shared.Request) (interface{}, error) { defer func() { vm.Debug = old }() vm.Debug = true - _, err := self.ethereum.BlockProcessor().RetryProcess(block) + _, err := self.expanse.BlockProcessor().RetryProcess(block) if err == nil { return true, nil } diff --git a/rpc/api/debug_args.go b/rpc/api/debug_args.go index 041ad6b6ad..dee8ae54db 100644 --- a/rpc/api/debug_args.go +++ b/rpc/api/debug_args.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -22,7 +22,7 @@ import ( "math/big" "reflect" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) type WaitForBlockArgs struct { diff --git a/rpc/api/debug_js.go b/rpc/api/debug_js.go index 0eb9f97f15..18b1587823 100644 --- a/rpc/api/debug_js.go +++ b/rpc/api/debug_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api diff --git a/rpc/api/eth.go b/rpc/api/eth.go index 5199bd966d..6f7734b9d4 100644 --- a/rpc/api/eth.go +++ b/rpc/api/eth.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -23,11 +23,11 @@ import ( "fmt" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" "gopkg.in/fatih/set.v0" ) @@ -35,16 +35,16 @@ const ( EthApiVersion = "1.0" ) -// eth api provider -// See https://github.com/ethereum/wiki/wiki/JSON-RPC +// exp api provider +// See https://github.com/expanse-project/wiki/wiki/JSON-RPC type ethApi struct { xeth *xeth.XEth - ethereum *eth.Ethereum + expanse *exp.Expanse methods map[string]ethhandler codec codec.ApiCoder } -// eth callback handler +// exp callback handler type ethhandler func(*ethApi, *shared.Request) (interface{}, error) var ( @@ -100,8 +100,8 @@ var ( ) // create new ethApi instance -func NewEthApi(xeth *xeth.XEth, eth *eth.Ethereum, codec codec.Codec) *ethApi { - return ðApi{xeth, eth, ethMapping, codec.New(nil)} +func NewEthApi(xeth *xeth.XEth, exp *exp.Expanse, codec codec.Codec) *ethApi { + return ðApi{xeth, exp, ethMapping, codec.New(nil)} } // collection with supported methods @@ -591,10 +591,10 @@ func (self *ethApi) Resend(req *shared.Request) (interface{}, error) { from := common.HexToAddress(args.Tx.From) - pending := self.ethereum.TxPool().GetTransactions() + pending := self.expanse.TxPool().GetTransactions() for _, p := range pending { if pFrom, err := p.From(); err == nil && pFrom == from && p.SigHash() == args.Tx.tx.SigHash() { - self.ethereum.TxPool().RemoveTx(common.HexToHash(args.Tx.Hash)) + self.expanse.TxPool().RemoveTx(common.HexToHash(args.Tx.Hash)) return self.xeth.Transact(args.Tx.From, args.Tx.To, args.Tx.Nonce, args.Tx.Value, args.GasLimit, args.GasPrice, args.Tx.Data) } } @@ -603,11 +603,11 @@ func (self *ethApi) Resend(req *shared.Request) (interface{}, error) { } func (self *ethApi) PendingTransactions(req *shared.Request) (interface{}, error) { - txs := self.ethereum.TxPool().GetTransactions() + txs := self.expanse.TxPool().GetTransactions() // grab the accounts from the account manager. This will help with determining which // transactions should be returned. - accounts, err := self.ethereum.AccountManager().Accounts() + accounts, err := self.expanse.AccountManager().Accounts() if err != nil { return nil, err } diff --git a/rpc/api/eth_args.go b/rpc/api/eth_args.go index 8bd077e209..c3c56e366f 100644 --- a/rpc/api/eth_args.go +++ b/rpc/api/eth_args.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -23,10 +23,10 @@ import ( "strconv" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/rpc/shared" ) const ( diff --git a/rpc/api/eth_js.go b/rpc/api/eth_js.go index 393dac22f4..728a20d782 100644 --- a/rpc/api/eth_js.go +++ b/rpc/api/eth_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -21,7 +21,7 @@ package api const Eth_JS = ` web3._extend({ - property: 'eth', + property: 'exp', methods: [ new web3._extend.Method({ diff --git a/rpc/api/mergedapi.go b/rpc/api/mergedapi.go index 8f4ef8e603..79993481e3 100644 --- a/rpc/api/mergedapi.go +++ b/rpc/api/mergedapi.go @@ -1,25 +1,25 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rpc/shared" ) const ( @@ -29,14 +29,14 @@ const ( // combines multiple API's type MergedApi struct { apis map[string]string - methods map[string]shared.EthereumApi + methods map[string]shared.ExpanseApi } // create new merged api instance -func newMergedApi(apis ...shared.EthereumApi) *MergedApi { +func newMergedApi(apis ...shared.ExpanseApi) *MergedApi { mergedApi := new(MergedApi) mergedApi.apis = make(map[string]string, len(apis)) - mergedApi.methods = make(map[string]shared.EthereumApi) + mergedApi.methods = make(map[string]shared.ExpanseApi) for _, api := range apis { mergedApi.apis[api.Name()] = api.ApiVersion() diff --git a/rpc/api/miner.go b/rpc/api/miner.go index 5325a660af..b9df315647 100644 --- a/rpc/api/miner.go +++ b/rpc/api/miner.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -48,15 +48,15 @@ type minerhandler func(*minerApi, *shared.Request) (interface{}, error) // miner api provider type minerApi struct { - ethereum *eth.Ethereum + expanse *exp.Expanse methods map[string]minerhandler codec codec.ApiCoder } // create a new miner api instance -func NewMinerApi(ethereum *eth.Ethereum, coder codec.Codec) *minerApi { +func NewMinerApi(expanse *exp.Expanse, coder codec.Codec) *minerApi { return &minerApi{ - ethereum: ethereum, + expanse: expanse, methods: MinerMapping, codec: coder.New(nil), } @@ -96,11 +96,11 @@ func (self *minerApi) StartMiner(req *shared.Request) (interface{}, error) { return nil, err } if args.Threads == -1 { // (not specified by user, use default) - args.Threads = self.ethereum.MinerThreads + args.Threads = self.expanse.MinerThreads } - self.ethereum.StartAutoDAG() - err := self.ethereum.StartMining(args.Threads) + self.expanse.StartAutoDAG() + err := self.expanse.StartMining(args.Threads) if err == nil { return true, nil } @@ -109,12 +109,12 @@ func (self *minerApi) StartMiner(req *shared.Request) (interface{}, error) { } func (self *minerApi) StopMiner(req *shared.Request) (interface{}, error) { - self.ethereum.StopMining() + self.expanse.StopMining() return true, nil } func (self *minerApi) Hashrate(req *shared.Request) (interface{}, error) { - return self.ethereum.Miner().HashRate(), nil + return self.expanse.Miner().HashRate(), nil } func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) { @@ -136,7 +136,7 @@ func (self *minerApi) SetGasPrice(req *shared.Request) (interface{}, error) { return false, err } - self.ethereum.Miner().SetGasPrice(common.String2Big(args.Price)) + self.expanse.Miner().SetGasPrice(common.String2Big(args.Price)) return true, nil } @@ -145,17 +145,17 @@ func (self *minerApi) SetEtherbase(req *shared.Request) (interface{}, error) { if err := self.codec.Decode(req.Params, &args); err != nil { return false, err } - self.ethereum.SetEtherbase(args.Etherbase) + self.expanse.SetEtherbase(args.Etherbase) return nil, nil } func (self *minerApi) StartAutoDAG(req *shared.Request) (interface{}, error) { - self.ethereum.StartAutoDAG() + self.expanse.StartAutoDAG() return true, nil } func (self *minerApi) StopAutoDAG(req *shared.Request) (interface{}, error) { - self.ethereum.StopAutoDAG() + self.expanse.StopAutoDAG() return true, nil } diff --git a/rpc/api/miner_args.go b/rpc/api/miner_args.go index 5ceb244feb..868304d668 100644 --- a/rpc/api/miner_args.go +++ b/rpc/api/miner_args.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -21,8 +21,8 @@ import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/rpc/shared" ) type StartMinerArgs struct { diff --git a/rpc/api/miner_js.go b/rpc/api/miner_js.go index 0998a9f41c..3a7fcdd9a1 100644 --- a/rpc/api/miner_js.go +++ b/rpc/api/miner_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api diff --git a/rpc/api/net.go b/rpc/api/net.go index 9c63696152..c4a9d4d4f8 100644 --- a/rpc/api/net.go +++ b/rpc/api/net.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" ) const ( @@ -42,16 +42,16 @@ type nethandler func(*netApi, *shared.Request) (interface{}, error) // net api provider type netApi struct { xeth *xeth.XEth - ethereum *eth.Ethereum + expanse *exp.Expanse methods map[string]nethandler codec codec.ApiCoder } // create a new net api instance -func NewNetApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *netApi { +func NewNetApi(xeth *xeth.XEth, exp *exp.Expanse, coder codec.Codec) *netApi { return &netApi{ xeth: xeth, - ethereum: eth, + expanse: exp, methods: netMapping, codec: coder.New(nil), } diff --git a/rpc/api/net_js.go b/rpc/api/net_js.go index 2ee1f0041a..139c01ebd0 100644 --- a/rpc/api/net_js.go +++ b/rpc/api/net_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api diff --git a/rpc/api/parsing.go b/rpc/api/parsing.go index 0698e8dbe7..cd73a60090 100644 --- a/rpc/api/parsing.go +++ b/rpc/api/parsing.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -24,9 +24,9 @@ import ( "math/big" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/rpc/shared" ) type hexdata struct { diff --git a/rpc/api/personal.go b/rpc/api/personal.go index 6c73ac83df..bad4464a30 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -20,11 +20,11 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" ) const ( @@ -47,16 +47,16 @@ type personalhandler func(*personalApi, *shared.Request) (interface{}, error) // net api provider type personalApi struct { xeth *xeth.XEth - ethereum *eth.Ethereum + expanse *exp.Expanse methods map[string]personalhandler codec codec.ApiCoder } // create a new net api instance -func NewPersonalApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *personalApi { +func NewPersonalApi(xeth *xeth.XEth, exp *exp.Expanse, coder codec.Codec) *personalApi { return &personalApi{ xeth: xeth, - ethereum: eth, + expanse: exp, methods: personalMapping, codec: coder.New(nil), } @@ -100,7 +100,7 @@ func (self *personalApi) NewAccount(req *shared.Request) (interface{}, error) { return nil, shared.NewDecodeParamError(err.Error()) } - am := self.ethereum.AccountManager() + am := self.expanse.AccountManager() acc, err := am.NewAccount(args.Passphrase) return acc.Address.Hex(), err } @@ -112,7 +112,7 @@ func (self *personalApi) DeleteAccount(req *shared.Request) (interface{}, error) } addr := common.HexToAddress(args.Address) - am := self.ethereum.AccountManager() + am := self.expanse.AccountManager() if err := am.DeleteAccount(addr, args.Passphrase); err == nil { return true, nil } else { diff --git a/rpc/api/personal_args.go b/rpc/api/personal_args.go index 5a584fb0ce..cf14942489 100644 --- a/rpc/api/personal_args.go +++ b/rpc/api/personal_args.go @@ -1,25 +1,25 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( "encoding/json" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) type NewAccountArgs struct { diff --git a/rpc/api/personal_js.go b/rpc/api/personal_js.go index 81c5d4a366..412c2c120e 100644 --- a/rpc/api/personal_js.go +++ b/rpc/api/personal_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api diff --git a/rpc/api/shh.go b/rpc/api/shh.go index 9ca6f9dda4..747bc9e975 100644 --- a/rpc/api/shh.go +++ b/rpc/api/shh.go @@ -1,28 +1,28 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( "math/big" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" ) const ( @@ -52,16 +52,16 @@ type shhhandler func(*shhApi, *shared.Request) (interface{}, error) // shh api provider type shhApi struct { xeth *xeth.XEth - ethereum *eth.Ethereum + expanse *exp.Expanse methods map[string]shhhandler codec codec.ApiCoder } // create a new whisper api instance -func NewShhApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *shhApi { +func NewShhApi(xeth *xeth.XEth, exp *exp.Expanse, coder codec.Codec) *shhApi { return &shhApi{ xeth: xeth, - ethereum: eth, + expanse: exp, methods: shhMapping, codec: coder.New(nil), } diff --git a/rpc/api/shh_args.go b/rpc/api/shh_args.go index 468a0b98fc..a1300c4e47 100644 --- a/rpc/api/shh_args.go +++ b/rpc/api/shh_args.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -21,7 +21,7 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) type WhisperMessageArgs struct { diff --git a/rpc/api/shh_js.go b/rpc/api/shh_js.go index a92ad1644b..93d90ad985 100644 --- a/rpc/api/shh_js.go +++ b/rpc/api/shh_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api diff --git a/rpc/api/txpool.go b/rpc/api/txpool.go index 27e40cae59..cf92692934 100644 --- a/rpc/api/txpool.go +++ b/rpc/api/txpool.go @@ -1,26 +1,26 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" ) const ( @@ -40,16 +40,16 @@ type txpoolhandler func(*txPoolApi, *shared.Request) (interface{}, error) // txpool api provider type txPoolApi struct { xeth *xeth.XEth - ethereum *eth.Ethereum + expanse *exp.Expanse methods map[string]txpoolhandler codec codec.ApiCoder } // create a new txpool api instance -func NewTxPoolApi(xeth *xeth.XEth, eth *eth.Ethereum, coder codec.Codec) *txPoolApi { +func NewTxPoolApi(xeth *xeth.XEth, exp *exp.Expanse, coder codec.Codec) *txPoolApi { return &txPoolApi{ xeth: xeth, - ethereum: eth, + expanse: exp, methods: txpoolMapping, codec: coder.New(nil), } @@ -84,7 +84,7 @@ func (self *txPoolApi) ApiVersion() string { } func (self *txPoolApi) Status(req *shared.Request) (interface{}, error) { - pending, queue := self.ethereum.TxPool().Stats() + pending, queue := self.expanse.TxPool().Stats() return map[string]int{ "pending": pending, "queued": queue, diff --git a/rpc/api/txpool_js.go b/rpc/api/txpool_js.go index b6c29871a2..355dc2b845 100644 --- a/rpc/api/txpool_js.go +++ b/rpc/api/txpool_js.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api diff --git a/rpc/api/utils.go b/rpc/api/utils.go index 50c607d16b..7857347365 100644 --- a/rpc/api/utils.go +++ b/rpc/api/utils.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api @@ -21,10 +21,10 @@ import ( "fmt" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" ) var ( @@ -64,7 +64,7 @@ var ( "seedHash", "setHead", }, - "eth": []string{ + "exp": []string{ "accounts", "blockNumber", "call", @@ -147,34 +147,34 @@ var ( ) // Parse a comma separated API string to individual api's -func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth.Ethereum) ([]shared.EthereumApi, error) { +func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, exp *exp.Expanse) ([]shared.ExpanseApi, error) { if len(strings.TrimSpace(apistr)) == 0 { return nil, fmt.Errorf("Empty apistr provided") } names := strings.Split(apistr, ",") - apis := make([]shared.EthereumApi, len(names)) + apis := make([]shared.ExpanseApi, len(names)) for i, name := range names { switch strings.ToLower(strings.TrimSpace(name)) { case shared.AdminApiName: - apis[i] = NewAdminApi(xeth, eth, codec) + apis[i] = NewAdminApi(xeth, exp, codec) case shared.DebugApiName: - apis[i] = NewDebugApi(xeth, eth, codec) + apis[i] = NewDebugApi(xeth, exp, codec) case shared.DbApiName: - apis[i] = NewDbApi(xeth, eth, codec) + apis[i] = NewDbApi(xeth, exp, codec) case shared.EthApiName: - apis[i] = NewEthApi(xeth, eth, codec) + apis[i] = NewEthApi(xeth, exp, codec) case shared.MinerApiName: - apis[i] = NewMinerApi(eth, codec) + apis[i] = NewMinerApi(exp, codec) case shared.NetApiName: - apis[i] = NewNetApi(xeth, eth, codec) + apis[i] = NewNetApi(xeth, exp, codec) case shared.ShhApiName: - apis[i] = NewShhApi(xeth, eth, codec) + apis[i] = NewShhApi(xeth, exp, codec) case shared.TxPoolApiName: - apis[i] = NewTxPoolApi(xeth, eth, codec) + apis[i] = NewTxPoolApi(xeth, exp, codec) case shared.PersonalApiName: - apis[i] = NewPersonalApi(xeth, eth, codec) + apis[i] = NewPersonalApi(xeth, exp, codec) case shared.Web3ApiName: apis[i] = NewWeb3Api(xeth, codec) default: diff --git a/rpc/api/web3.go b/rpc/api/web3.go index e2d8543d34..422595b476 100644 --- a/rpc/api/web3.go +++ b/rpc/api/web3.go @@ -1,27 +1,27 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/xeth" ) const ( diff --git a/rpc/api/web3_args.go b/rpc/api/web3_args.go index 9e39f7130f..d520a42a2e 100644 --- a/rpc/api/web3_args.go +++ b/rpc/api/web3_args.go @@ -1,25 +1,25 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package api import ( "encoding/json" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) type Sha3Args struct { diff --git a/rpc/codec/codec.go b/rpc/codec/codec.go index 786080b44a..a252f182db 100644 --- a/rpc/codec/codec.go +++ b/rpc/codec/codec.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package codec @@ -20,7 +20,7 @@ import ( "net" "strconv" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) type Codec int diff --git a/rpc/codec/json.go b/rpc/codec/json.go index cfc449143b..4f8aaa7504 100644 --- a/rpc/codec/json.go +++ b/rpc/codec/json.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package codec @@ -23,7 +23,7 @@ import ( "time" "strings" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/shared" ) const ( diff --git a/rpc/codec/json_test.go b/rpc/codec/json_test.go index 01ef77e57d..40b586c112 100644 --- a/rpc/codec/json_test.go +++ b/rpc/codec/json_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package codec diff --git a/rpc/comms/comms.go b/rpc/comms/comms.go index 731b2f62e4..53c05ed647 100644 --- a/rpc/comms/comms.go +++ b/rpc/comms/comms.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package comms @@ -25,10 +25,10 @@ import ( "strconv" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" ) const ( @@ -48,8 +48,8 @@ var ( }, ",") ) -type EthereumClient interface { - // Close underlying connection +type ExpanseClient interface { + // Close underlaying connection Close() // Send request Send(interface{}) error @@ -59,7 +59,7 @@ type EthereumClient interface { SupportedModules() (map[string]string, error) } -func handle(id int, conn net.Conn, api shared.EthereumApi, c codec.Codec) { +func handle(id int, conn net.Conn, api shared.ExpanseApi, c codec.Codec) { codec := c.New(conn) for { @@ -108,9 +108,9 @@ func handle(id int, conn net.Conn, api shared.EthereumApi, c codec.Codec) { // Endpoint must be in the form of: // ${protocol}:${path} -// e.g. ipc:/tmp/geth.ipc -// rpc:localhost:8545 -func ClientFromEndpoint(endpoint string, c codec.Codec) (EthereumClient, error) { +// e.g. ipc:/tmp/gexp.ipc +// rpc:localhost:9656 +func ClientFromEndpoint(endpoint string, c codec.Codec) (ExpanseClient, error) { if strings.HasPrefix(endpoint, "ipc:") { cfg := IpcConfig{ Endpoint: endpoint[4:], @@ -121,7 +121,7 @@ func ClientFromEndpoint(endpoint string, c codec.Codec) (EthereumClient, error) if strings.HasPrefix(endpoint, "rpc:") { parts := strings.Split(endpoint, ":") addr := "http://localhost" - port := uint(8545) + port := uint(9656) if len(parts) >= 3 { addr = parts[1] + ":" + parts[2] } diff --git a/rpc/comms/http.go b/rpc/comms/http.go index c165aa27e1..dfa0fd5851 100644 --- a/rpc/comms/http.go +++ b/rpc/comms/http.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package comms @@ -66,11 +66,11 @@ type stopServer struct { type handler struct { codec codec.Codec - api shared.EthereumApi + api shared.ExpanseApi } // StartHTTP starts listening for RPC requests sent via HTTP. -func StartHttp(cfg HttpConfig, codec codec.Codec, api shared.EthereumApi) error { +func StartHttp(cfg HttpConfig, codec codec.Codec, api shared.ExpanseApi) error { httpServerMu.Lock() defer httpServerMu.Unlock() diff --git a/rpc/comms/inproc.go b/rpc/comms/inproc.go index e8058e32bf..2c07010969 100644 --- a/rpc/comms/inproc.go +++ b/rpc/comms/inproc.go @@ -1,30 +1,30 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package comms import ( "fmt" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" ) type InProcClient struct { - api shared.EthereumApi + api shared.ExpanseApi codec codec.Codec lastId interface{} lastJsonrpc string @@ -44,7 +44,7 @@ func (self *InProcClient) Close() { } // Need to setup api support -func (self *InProcClient) Initialize(offeredApi shared.EthereumApi) { +func (self *InProcClient) Initialize(offeredApi shared.ExpanseApi) { self.api = offeredApi } diff --git a/rpc/comms/ipc.go b/rpc/comms/ipc.go index 3de659b65c..7c4a25cf8f 100644 --- a/rpc/comms/ipc.go +++ b/rpc/comms/ipc.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package comms @@ -23,8 +23,8 @@ import ( "encoding/json" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" ) type IpcConfig struct { @@ -90,7 +90,7 @@ func NewIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) { } // Start IPC server -func StartIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { +func StartIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.ExpanseApi, error)) error { return startIpc(cfg, codec, initializer) } diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go index 9d90da0719..bbe20765d7 100644 --- a/rpc/comms/ipc_unix.go +++ b/rpc/comms/ipc_unix.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris @@ -68,7 +68,7 @@ func (self *ipcClient) reconnect() error { return err } -func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { +func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.ExpanseApi, error)) error { os.Remove(cfg.Endpoint) // in case it still exists from a previous run l, err := net.ListenUnix("unix", &net.UnixAddr{Name: cfg.Endpoint, Net: "unix"}) diff --git a/rpc/comms/ipc_windows.go b/rpc/comms/ipc_windows.go index 47edd9e5bc..8a539573d6 100644 --- a/rpc/comms/ipc_windows.go +++ b/rpc/comms/ipc_windows.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // +build windows @@ -688,7 +688,7 @@ func (self *ipcClient) reconnect() error { return err } -func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.EthereumApi, error)) error { +func startIpc(cfg IpcConfig, codec codec.Codec, initializer func(conn net.Conn) (shared.ExpanseApi, error)) error { os.Remove(cfg.Endpoint) // in case it still exists from a previous run l, err := Listen(cfg.Endpoint) diff --git a/rpc/jeth.go b/rpc/jeth.go index 757f6b7eb5..68a9f63912 100644 --- a/rpc/jeth.go +++ b/rpc/jeth.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package rpc @@ -33,13 +33,13 @@ import ( ) type Jeth struct { - ethApi shared.EthereumApi + ethApi shared.ExpanseApi re *jsre.JSRE - client comms.EthereumClient + client comms.ExpanseClient fe xeth.Frontend } -func NewJeth(ethApi shared.EthereumApi, re *jsre.JSRE, client comms.EthereumClient, fe xeth.Frontend) *Jeth { +func NewJeth(ethApi shared.ExpanseApi, re *jsre.JSRE, client comms.ExpanseClient, fe xeth.Frontend) *Jeth { return &Jeth{ethApi, re, client, fe} } diff --git a/rpc/shared/errors.go b/rpc/shared/errors.go index 85af1bb2f4..5df8996c30 100644 --- a/rpc/shared/errors.go +++ b/rpc/shared/errors.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package shared diff --git a/rpc/shared/types.go b/rpc/shared/types.go index 659b74bf60..8dba495de4 100644 --- a/rpc/shared/types.go +++ b/rpc/shared/types.go @@ -1,30 +1,30 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package shared import ( "encoding/json" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) -// Ethereum RPC API interface -type EthereumApi interface { +// Expanse RPC API interface +type ExpanseApi interface { // API identifier Name() string diff --git a/rpc/shared/utils.go b/rpc/shared/utils.go index b13e9eb1b4..eb241d0097 100644 --- a/rpc/shared/utils.go +++ b/rpc/shared/utils.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package shared @@ -20,7 +20,7 @@ import "strings" const ( AdminApiName = "admin" - EthApiName = "eth" + EthApiName = "exp" DbApiName = "db" DebugApiName = "debug" MergedApiName = "merged" diff --git a/rpc/useragent/agent.go b/rpc/useragent/agent.go index df0739e659..6f5c195e98 100644 --- a/rpc/useragent/agent.go +++ b/rpc/useragent/agent.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // package user agent provides frontends and agents which can interact with the user package useragent diff --git a/rpc/xeth.go b/rpc/xeth.go index 9527a96c00..df4f6edff6 100644 --- a/rpc/xeth.go +++ b/rpc/xeth.go @@ -1,20 +1,20 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package rpc implements the Ethereum JSON-RPC API. +// Package rpc implements the Expanse JSON-RPC API. package rpc import ( @@ -23,18 +23,18 @@ import ( "reflect" "sync/atomic" - "github.com/ethereum/go-ethereum/rpc/comms" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/comms" + "github.com/expanse-project/go-expanse/rpc/shared" ) // Xeth is a native API interface to a remote node. type Xeth struct { - client comms.EthereumClient + client comms.ExpanseClient reqId uint32 } // NewXeth constructs a new native API interface to a remote node. -func NewXeth(client comms.EthereumClient) *Xeth { +func NewXeth(client comms.ExpanseClient) *Xeth { return &Xeth{ client: client, } diff --git a/tests/block_test.go b/tests/block_test.go index b0db5fe568..80a9f6609c 100644 --- a/tests/block_test.go +++ b/tests/block_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 2090afce71..616f0e26f6 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests @@ -28,16 +28,16 @@ import ( "strings" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rlp" ) // Block Test JSON Format @@ -162,23 +162,23 @@ func runBlockTest(test *BlockTest) error { cfg := test.makeEthConfig() cfg.GenesisBlock = test.Genesis - ethereum, err := eth.New(cfg) + expanse, err := exp.New(cfg) if err != nil { return err } - err = ethereum.Start() + err = expanse.Start() if err != nil { return err } // import pre accounts - statedb, err := test.InsertPreState(ethereum) + statedb, err := test.InsertPreState(expanse) if err != nil { return fmt.Errorf("InsertPreState: %v", err) } - err = test.TryBlocksInsert(ethereum.ChainManager()) + err = test.TryBlocksInsert(expanse.ChainManager()) if err != nil { return err } @@ -189,10 +189,10 @@ func runBlockTest(test *BlockTest) error { return nil } -func (test *BlockTest) makeEthConfig() *eth.Config { +func (test *BlockTest) makeEthConfig() *exp.Config { ks := crypto.NewKeyStorePassphrase(filepath.Join(common.DefaultDataDir(), "keystore")) - return ð.Config{ + return &exp.Config{ DataDir: common.DefaultDataDir(), Verbosity: 5, Etherbase: common.Address{}, @@ -203,8 +203,8 @@ func (test *BlockTest) makeEthConfig() *eth.Config { // InsertPreState populates the given database with the genesis // accounts defined by the test. -func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, error) { - db := ethereum.ChainDb() +func (t *BlockTest) InsertPreState(expanse *exp.Expanse) (*state.StateDB, error) { + db := expanse.ChainDb() statedb := state.New(common.Hash{}, db) for addrString, acct := range t.preAccounts { addr, err := hex.DecodeString(addrString) @@ -227,7 +227,7 @@ func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, erro if acct.PrivateKey != "" { privkey, err := hex.DecodeString(strings.TrimPrefix(acct.PrivateKey, "0x")) err = crypto.ImportBlockTestKey(privkey) - err = ethereum.AccountManager().TimedUnlock(common.BytesToAddress(addr), "", 999999*time.Second) + err = expanse.AccountManager().TimedUnlock(common.BytesToAddress(addr), "", 999999*time.Second) if err != nil { return nil, err } @@ -252,7 +252,7 @@ func (t *BlockTest) InsertPreState(ethereum *eth.Ethereum) (*state.StateDB, erro return statedb, nil } -/* See https://github.com/ethereum/tests/wiki/Blockchain-Tests-II +/* See https://github.com/expanse-project/tests/wiki/Blockchain-Tests-II Whether a block is valid or not is a bit subtle, it's defined by presence of blockHeader, transactions and uncleHeaders fields. If they are missing, the block is diff --git a/tests/files/ansible/roles/common/tasks/main.yml b/tests/files/ansible/roles/common/tasks/main.yml index 6c0c7a1197..df92ba07a3 100755 --- a/tests/files/ansible/roles/common/tasks/main.yml +++ b/tests/files/ansible/roles/common/tasks/main.yml @@ -8,6 +8,6 @@ - name: checkout test repo git: - repo: https://github.com/ethereum/tests.git + repo: https://github.com/expanse-project/tests.git version: develop dest: git diff --git a/tests/files/ansible/roles/ec2/vars/main.yml b/tests/files/ansible/roles/ec2/vars/main.yml index 3166da02cd..0dec1612e0 100755 --- a/tests/files/ansible/roles/ec2/vars/main.yml +++ b/tests/files/ansible/roles/ec2/vars/main.yml @@ -12,6 +12,6 @@ keypair: christoph ip_access_range: 0.0.0.0/0 -project_description: https://github.com/ethereum/tests +project_description: https://github.com/expanse-project/tests total_no_instances: 3 diff --git a/tests/files/ansible/roles/testrunner/tasks/main.yml b/tests/files/ansible/roles/testrunner/tasks/main.yml index 41c195f245..d4b00ebe56 100755 --- a/tests/files/ansible/roles/testrunner/tasks/main.yml +++ b/tests/files/ansible/roles/testrunner/tasks/main.yml @@ -2,7 +2,7 @@ - name: update C++ client docker_image: path: /home/{{ ansible_ssh_user }}/git/ansible/test-files/docker-cppjit - name: ethereum/cppjit-testrunner + name: expanse/cppjit-testrunner state: build async: 1200 poll: 5 @@ -10,7 +10,7 @@ - name: update Go client docker_image: path: /home/{{ ansible_ssh_user }}/git/ansible/test-files/docker-go - name: ethereum/go-testrunner + name: expanse/go-testrunner state: build async: 1200 poll: 5 @@ -18,7 +18,7 @@ - name: update Python client docker_image: path: /home/{{ ansible_ssh_user }}/git/ansible/test-files/docker-python - name: ethereum/python-testrunner + name: expanse/python-testrunner state: build async: 1200 poll: 5 diff --git a/tests/files/ansible/test-files/create-docker-images.sh b/tests/files/ansible/test-files/create-docker-images.sh index 06728c6d72..a6b149a20f 100755 --- a/tests/files/ansible/test-files/create-docker-images.sh +++ b/tests/files/ansible/test-files/create-docker-images.sh @@ -2,6 +2,6 @@ # creates the necessary docker images to run testrunner.sh locally -docker build --tag="ethereum/cppjit-testrunner" docker-cppjit -docker build --tag="ethereum/python-testrunner" docker-python -docker build --tag="ethereum/go-testrunner" docker-go +docker build --tag="expanse/cppjit-testrunner" docker-cppjit +docker build --tag="expanse/python-testrunner" docker-python +docker build --tag="expanse/go-testrunner" docker-go diff --git a/tests/files/ansible/test-files/docker-cpp/Dockerfile b/tests/files/ansible/test-files/docker-cpp/Dockerfile index a3b0e4ca6d..40b5f353a1 100755 --- a/tests/files/ansible/test-files/docker-cpp/Dockerfile +++ b/tests/files/ansible/test-files/docker-cpp/Dockerfile @@ -1,32 +1,32 @@ -# adjusted from https://github.com/ethereum/cpp-ethereum/blob/develop/docker/Dockerfile +# adjusted from https://github.com/expanse-project/cpp-expanse/blob/develop/docker/Dockerfile FROM ubuntu:14.04 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update RUN apt-get upgrade -y -# Ethereum dependencies +# Expanse dependencies RUN apt-get install -qy build-essential g++-4.8 git cmake libboost-all-dev libcurl4-openssl-dev wget RUN apt-get install -qy automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons RUN apt-get install -qy libjsoncpp-dev libargtable2-dev -# NCurses based GUI (not optional though for a succesful compilation, see https://github.com/ethereum/cpp-ethereum/issues/452 ) +# NCurses based GUI (not optional though for a succesful compilation, see https://github.com/expanse-project/cpp-expanse/issues/452 ) RUN apt-get install -qy libncurses5-dev # Qt-based GUI # RUN apt-get install -qy qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev -# Ethereum PPA +# Expanse PPA RUN apt-get install -qy software-properties-common -RUN add-apt-repository ppa:ethereum/ethereum +RUN add-apt-repository ppa:expanse/expanse RUN apt-get update RUN apt-get install -qy libcryptopp-dev libjson-rpc-cpp-dev -# Build Ethereum (HEADLESS) -RUN git clone --depth=1 --branch develop https://github.com/ethereum/cpp-ethereum -RUN mkdir -p cpp-ethereum/build -RUN cd cpp-ethereum/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DHEADLESS=1 && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install +# Build Expanse (HEADLESS) +RUN git clone --depth=1 --branch develop https://github.com/expanse-project/cpp-expanse +RUN mkdir -p cpp-expanse/build +RUN cd cpp-expanse/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DHEADLESS=1 && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install RUN ldconfig -ENTRYPOINT ["/cpp-ethereum/build/test/createRandomTest"] +ENTRYPOINT ["/cpp-expanse/build/test/createRandomTest"] diff --git a/tests/files/ansible/test-files/docker-cppjit/Dockerfile b/tests/files/ansible/test-files/docker-cppjit/Dockerfile index 2b10727f05..fef8e31242 100755 --- a/tests/files/ansible/test-files/docker-cppjit/Dockerfile +++ b/tests/files/ansible/test-files/docker-cppjit/Dockerfile @@ -1,16 +1,16 @@ -# adjusted from https://github.com/ethereum/cpp-ethereum/blob/develop/docker/Dockerfile +# adjusted from https://github.com/expanse-project/cpp-expanse/blob/develop/docker/Dockerfile FROM ubuntu:14.04 ENV DEBIAN_FRONTEND noninteractive RUN apt-get update RUN apt-get upgrade -y -# Ethereum dependencies +# Expanse dependencies RUN apt-get install -qy build-essential g++-4.8 git cmake libboost-all-dev libcurl4-openssl-dev wget RUN apt-get install -qy automake unzip libgmp-dev libtool libleveldb-dev yasm libminiupnpc-dev libreadline-dev scons RUN apt-get install -qy libjsoncpp-dev libargtable2-dev -# NCurses based GUI (not optional though for a succesful compilation, see https://github.com/ethereum/cpp-ethereum/issues/452 ) +# NCurses based GUI (not optional though for a succesful compilation, see https://github.com/expanse-project/cpp-expanse/issues/452 ) RUN apt-get install -qy libncurses5-dev # Qt-based GUI @@ -28,19 +28,19 @@ RUN apt-get install -qy llvm-3.5 libedit-dev RUN mkdir -p /usr/lib/llvm-3.5/share/llvm && ln -s /usr/share/llvm-3.5/cmake /usr/lib/llvm-3.5/share/llvm/cmake -# Ethereum PPA +# Expanse PPA RUN apt-get install -qy software-properties-common -RUN add-apt-repository ppa:ethereum/ethereum +RUN add-apt-repository ppa:expanse/expanse RUN apt-get update RUN apt-get install -qy libcryptopp-dev libjson-rpc-cpp-dev # this is a workaround, to make sure that docker's cache is invalidated whenever the git repo changes -ADD https://api.github.com/repos/ethereum/cpp-ethereum/git/refs/heads/develop unused.txt +ADD https://api.github.com/repos/expanse/cpp-expanse/git/refs/heads/develop unused.txt -# Build Ethereum (HEADLESS) -RUN git clone --depth=1 --branch develop https://github.com/ethereum/cpp-ethereum -RUN mkdir -p cpp-ethereum/build -RUN cd cpp-ethereum/build && cmake .. -DCMAKE_BUILD_TYPE=Debug -DVMTRACE=1 -DPARANOIA=1 -DEVMJIT=1 && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install +# Build Expanse (HEADLESS) +RUN git clone --depth=1 --branch develop https://github.com/expanse-project/cpp-expanse +RUN mkdir -p cpp-expanse/build +RUN cd cpp-expanse/build && cmake .. -DCMAKE_BUILD_TYPE=Debug -DVMTRACE=1 -DPARANOIA=1 -DEVMJIT=1 && make -j $(cat /proc/cpuinfo | grep processor | wc -l) && make install RUN ldconfig -ENTRYPOINT ["/cpp-ethereum/build/test/checkRandomStateTest"] +ENTRYPOINT ["/cpp-expanse/build/test/checkRandomStateTest"] diff --git a/tests/files/ansible/test-files/docker-go/Dockerfile b/tests/files/ansible/test-files/docker-go/Dockerfile index a5a2f0f231..e132659e59 100755 --- a/tests/files/ansible/test-files/docker-go/Dockerfile +++ b/tests/files/ansible/test-files/docker-go/Dockerfile @@ -1,4 +1,4 @@ -# Adjusted from https://github.com/ethereum/go-ethereum/blob/develop/Dockerfile +# Adjusted from https://github.com/expanse-project/go-expanse/blob/develop/Dockerfile FROM ubuntu:14.04 ## Environment setup @@ -31,17 +31,17 @@ RUN git checkout v1 RUN go install -v # this is a workaround, to make sure that docker's cache is invalidated whenever the git repo changes -ADD https://api.github.com/repos/ethereum/go-ethereum/git/refs/heads/develop unused.txt +ADD https://api.github.com/repos/expanse/go-expanse/git/refs/heads/develop unused.txt -## Fetch and install go-ethereum -RUN go get -u -v -d github.com/ethereum/go-ethereum/... -WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum +## Fetch and install go-expanse +RUN go get -u -v -d github.com/expanse-project/go-expanse/... +WORKDIR $GOPATH/src/github.com/expanse-project/go-expanse RUN git checkout develop RUN git pull -RUN ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get $ETH_DEPS; fi +RUN ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/expanse-project/go-expanse/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get $ETH_DEPS; fi RUN go install -v ./cmd/ethtest ENTRYPOINT ["ethtest"] diff --git a/tests/files/ansible/test-files/docker-python/Dockerfile b/tests/files/ansible/test-files/docker-python/Dockerfile index e83faf3d6e..c8e0427f63 100755 --- a/tests/files/ansible/test-files/docker-python/Dockerfile +++ b/tests/files/ansible/test-files/docker-python/Dockerfile @@ -7,16 +7,16 @@ RUN apt-get upgrade -y RUN apt-get install -qy curl git python2.7 python-pip python-dev # this is a workaround, to make sure that docker's cache is invalidated whenever the git repo changes -ADD https://api.github.com/repos/ethereum/pyethereum/git/refs/heads/develop unused.txt +ADD https://api.github.com/repos/expanse/pyethereum/git/refs/heads/develop unused.txt -RUN git clone --branch develop --recursive https://github.com/ethereum/pyethereum.git +RUN git clone --branch develop --recursive https://github.com/expanse-project/pyethereum.git RUN cd pyethereum && curl https://bootstrap.pypa.io/bootstrap-buildout.py | python RUN cd pyethereum && bin/buildout #default port for incoming requests -EXPOSE 30303 +EXPOSE 60606 WORKDIR /pyethereum diff --git a/tests/files/ansible/test-files/testrunner.sh b/tests/files/ansible/test-files/testrunner.sh index c7763b1f12..91f310ba4f 100755 --- a/tests/files/ansible/test-files/testrunner.sh +++ b/tests/files/ansible/test-files/testrunner.sh @@ -7,19 +7,19 @@ cd ~/testout export EVMJIT="-cache=0" while [ 1 ] do - TEST="$(docker run --rm --entrypoint=\"/cpp-ethereum/build/test/createRandomStateTest\" ethereum/cppjit-testrunner)" + TEST="$(docker run --rm --entrypoint=\"/cpp-expanse/build/test/createRandomStateTest\" expanse/cppjit-testrunner)" # echo "$TEST" # test pyethereum - OUTPUT_PYTHON="$(docker run --rm ethereum/python-testrunner --notrace <<< "$TEST")" + OUTPUT_PYTHON="$(docker run --rm expanse/python-testrunner --notrace <<< "$TEST")" RESULT_PYTHON=$? # test go - OUTPUT_GO="$(docker run --rm ethereum/go-testrunner "$TEST")" + OUTPUT_GO="$(docker run --rm expanse/go-testrunner "$TEST")" RESULT_GO=$? # test cpp-jit - OUTPUT_CPPJIT="$(docker run --rm ethereum/cppjit-testrunner "$TEST")" + OUTPUT_CPPJIT="$(docker run --rm expanse/cppjit-testrunner "$TEST")" RESULT_CPPJIT=$? # go fails diff --git a/tests/files/package.json b/tests/files/package.json index 1e0ad9c289..c4050a7a82 100755 --- a/tests/files/package.json +++ b/tests/files/package.json @@ -1,25 +1,25 @@ { - "name": "ethereum-tests", + "name": "expanse-tests", "version": "0.0.6", - "description": "tests for ethereum", + "description": "tests for expanse", "main": "index.js", "scripts": { "test": "echo \"There are no tests for there tests\" && exit 1" }, "repository": { "type": "git", - "url": "https://github.com/ethereum/tests" + "url": "https://github.com/expanse-project/tests" }, "keywords": [ "tests", - "ethereum" + "expanse" ], "author": "", "license": "MIT", "bugs": { - "url": "https://github.com/ethereum/tests/issues" + "url": "https://github.com/expanse-project/tests/issues" }, - "homepage": "https://github.com/ethereum/tests", + "homepage": "https://github.com/expanse-project/tests", "dependencies": { "require-all": "^1.0.0" } diff --git a/tests/init.go b/tests/init.go index 3f8b8c6844..154498554f 100644 --- a/tests/init.go +++ b/tests/init.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package tests implements execution of Ethereum JSON tests. +// Package tests implements execution of Expanse JSON tests. package tests import ( @@ -26,7 +26,7 @@ import ( "os" "path/filepath" - "github.com/ethereum/go-ethereum/core" + "github.com/expanse-project/go-expanse/core" ) var ( diff --git a/tests/rlp_test.go b/tests/rlp_test.go index 2469ce0dbc..77135feb01 100644 --- a/tests/rlp_test.go +++ b/tests/rlp_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests diff --git a/tests/rlp_test_util.go b/tests/rlp_test_util.go index ac53a4f52c..51e3c1e6f6 100644 --- a/tests/rlp_test_util.go +++ b/tests/rlp_test_util.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests @@ -26,7 +26,7 @@ import ( "os" "strings" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/rlp" ) // RLPTest is the JSON structure of a single RLP test. diff --git a/tests/state_test.go b/tests/state_test.go index 7090b05410..da58238544 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests diff --git a/tests/state_test_util.go b/tests/state_test_util.go index def9b0c36d..26cd54181f 100644 --- a/tests/state_test_util.go +++ b/tests/state_test_util.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests @@ -25,13 +25,13 @@ import ( "strconv" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/logger/glog" ) func RunStateTestWithReader(r io.Reader, skipTests []string) error { diff --git a/tests/transaction_test.go b/tests/transaction_test.go index f1dfbd0a7f..2439bf1391 100644 --- a/tests/transaction_test.go +++ b/tests/transaction_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go index 09511acb79..bc633fb717 100644 --- a/tests/transaction_test_util.go +++ b/tests/transaction_test_util.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests @@ -23,10 +23,10 @@ import ( "io" "runtime" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rlp" ) // Transaction Test JSON Format diff --git a/tests/util.go b/tests/util.go index a9b5011a9a..bec06add2b 100644 --- a/tests/util.go +++ b/tests/util.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests @@ -21,12 +21,12 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/crypto" ) func checkLogs(tlog []Log, logs state.Logs) error { diff --git a/tests/vm_test.go b/tests/vm_test.go index 96718db3ce..035f205589 100644 --- a/tests/vm_test.go +++ b/tests/vm_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go index 71a4f5e335..799206f456 100644 --- a/tests/vm_test_util.go +++ b/tests/vm_test_util.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package tests @@ -24,11 +24,11 @@ import ( "strconv" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/logger/glog" ) func RunVmTestWithReader(r io.Reader, skipTests []string) error { diff --git a/trie/cache.go b/trie/cache.go index e475fc861a..12c8e7bbe1 100644 --- a/trie/cache.go +++ b/trie/cache.go @@ -1,24 +1,24 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie import ( - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/logger/glog" "github.com/syndtr/goleveldb/leveldb" ) diff --git a/trie/encoding.go b/trie/encoding.go index 9c862d78fa..631ea399a3 100644 --- a/trie/encoding.go +++ b/trie/encoding.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie diff --git a/trie/encoding_test.go b/trie/encoding_test.go index e49b57ef02..e1daa90d29 100644 --- a/trie/encoding_test.go +++ b/trie/encoding_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie diff --git a/trie/fullnode.go b/trie/fullnode.go index 8ff019ec43..730b602f23 100644 --- a/trie/fullnode.go +++ b/trie/fullnode.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie diff --git a/trie/hashnode.go b/trie/hashnode.go index d4a0bc7ec9..8f8135f2c4 100644 --- a/trie/hashnode.go +++ b/trie/hashnode.go @@ -1,22 +1,22 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie -import "github.com/ethereum/go-ethereum/common" +import "github.com/expanse-project/go-expanse/common" type HashNode struct { key []byte diff --git a/trie/iterator.go b/trie/iterator.go index 9c4c7fbe5b..6691c602b5 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie diff --git a/trie/iterator_test.go b/trie/iterator_test.go index 148f9adf99..ef397b250d 100644 --- a/trie/iterator_test.go +++ b/trie/iterator_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie diff --git a/trie/node.go b/trie/node.go index 9d49029ded..c8b9614ab6 100644 --- a/trie/node.go +++ b/trie/node.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie diff --git a/trie/secure_trie.go b/trie/secure_trie.go index 47c7542bb0..7ac8c2f34b 100644 --- a/trie/secure_trie.go +++ b/trie/secure_trie.go @@ -1,22 +1,22 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie -import "github.com/ethereum/go-ethereum/crypto" +import "github.com/expanse-project/go-expanse/crypto" var keyPrefix = []byte("secure-key-") diff --git a/trie/shortnode.go b/trie/shortnode.go index 569d5f1096..cb72455ad3 100644 --- a/trie/shortnode.go +++ b/trie/shortnode.go @@ -1,22 +1,22 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie -import "github.com/ethereum/go-ethereum/common" +import "github.com/expanse-project/go-expanse/common" type ShortNode struct { trie *Trie diff --git a/trie/slice.go b/trie/slice.go index ccefbd0643..6bf5d46303 100644 --- a/trie/slice.go +++ b/trie/slice.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie diff --git a/trie/trie.go b/trie/trie.go index abf48a8509..fd393461f1 100644 --- a/trie/trie.go +++ b/trie/trie.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Package trie implements Merkle Patricia Tries. package trie @@ -23,8 +23,8 @@ import ( "fmt" "sync" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie) { diff --git a/trie/trie_test.go b/trie/trie_test.go index ae4e5efe40..8b96fe5653 100644 --- a/trie/trie_test.go +++ b/trie/trie_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie @@ -21,8 +21,8 @@ import ( "fmt" "testing" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" ) type Db map[string][]byte diff --git a/trie/valuenode.go b/trie/valuenode.go index 0afa64d54c..86739318e3 100644 --- a/trie/valuenode.go +++ b/trie/valuenode.go @@ -1,22 +1,22 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package trie -import "github.com/ethereum/go-ethereum/common" +import "github.com/expanse-project/go-expanse/common" type ValueNode struct { trie *Trie diff --git a/whisper/doc.go b/whisper/doc.go index cfb0b51175..0ce1541dd2 100644 --- a/whisper/doc.go +++ b/whisper/doc.go @@ -1,23 +1,23 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . /* Package whisper implements the Whisper PoC-1. -(https://github.com/ethereum/wiki/wiki/Whisper-PoC-1-Protocol-Spec) +(https://github.com/expanse-project/wiki/wiki/Whisper-PoC-1-Protocol-Spec) Whisper combines aspects of both DHTs and datagram messaging systems (e.g. UDP). As such it may be likened and compared to both, not dissimilar to the diff --git a/whisper/envelope.go b/whisper/envelope.go index b231c6b44f..a309053521 100644 --- a/whisper/envelope.go +++ b/whisper/envelope.go @@ -1,21 +1,21 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the Whisper protocol Envelope element. For formal details please see -// the specs at https://github.com/ethereum/wiki/wiki/Whisper-PoC-1-Protocol-Spec#envelopes. +// the specs at https://github.com/expanse-project/wiki/wiki/Whisper-PoC-1-Protocol-Spec#envelopes. package whisper @@ -25,10 +25,10 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/crypto/ecies" + "github.com/expanse-project/go-expanse/rlp" ) // Envelope represents a clear-text data packet to transmit through the Whisper diff --git a/whisper/envelope_test.go b/whisper/envelope_test.go index 3bfe527372..5440beae5a 100644 --- a/whisper/envelope_test.go +++ b/whisper/envelope_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package whisper @@ -21,8 +21,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/crypto/ecies" ) func TestEnvelopeOpen(t *testing.T) { diff --git a/whisper/filter.go b/whisper/filter.go index 9f6d6b7817..9e82756b37 100644 --- a/whisper/filter.go +++ b/whisper/filter.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the message filter for fine grained subscriptions. @@ -21,7 +21,7 @@ package whisper import ( "crypto/ecdsa" - "github.com/ethereum/go-ethereum/event/filter" + "github.com/expanse-project/go-expanse/event/filter" ) // Filter is used to subscribe to specific types of whisper messages. diff --git a/whisper/filter_test.go b/whisper/filter_test.go index b805b2baf1..8b1adf6568 100644 --- a/whisper/filter_test.go +++ b/whisper/filter_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package whisper diff --git a/whisper/main.go b/whisper/main.go index be41604890..eca5f942cf 100644 --- a/whisper/main.go +++ b/whisper/main.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // +build none @@ -27,12 +27,12 @@ import ( "os" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/whisper" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/p2p" + "github.com/expanse-project/go-expanse/p2p/nat" + "github.com/expanse-project/go-expanse/whisper" ) func main() { @@ -47,7 +47,7 @@ func main() { name := common.MakeName("whisper-go", "1.0") shh := whisper.New() - // Create an Ethereum peer to communicate through + // Create an Expanse peer to communicate through server := p2p.Server{ PrivateKey: key, MaxPeers: 10, @@ -56,9 +56,9 @@ func main() { ListenAddr: ":30300", NAT: nat.Any(), } - fmt.Println("Starting Ethereum peer...") + fmt.Println("Starting Expanse peer...") if err := server.Start(); err != nil { - fmt.Printf("Failed to start Ethereum peer: %v.\n", err) + fmt.Printf("Failed to start Expanse peer: %v.\n", err) os.Exit(1) } diff --git a/whisper/message.go b/whisper/message.go index 506f142edd..5780b5d8ce 100644 --- a/whisper/message.go +++ b/whisper/message.go @@ -1,21 +1,21 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the Whisper protocol Message element. For formal details please see -// the specs at https://github.com/ethereum/wiki/wiki/Whisper-PoC-1-Protocol-Spec#messages. +// the specs at https://github.com/expanse-project/wiki/wiki/Whisper-PoC-1-Protocol-Spec#messages. package whisper @@ -24,10 +24,10 @@ import ( "math/rand" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) // Message represents an end-user data packet to transmit through the Whisper diff --git a/whisper/message_test.go b/whisper/message_test.go index 6ff95efff5..23f03d8094 100644 --- a/whisper/message_test.go +++ b/whisper/message_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package whisper @@ -22,7 +22,7 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/crypto" + "github.com/expanse-project/go-expanse/crypto" ) // Tests whether a message can be wrapped without any identity or encryption. diff --git a/whisper/peer.go b/whisper/peer.go index ee10e66e79..a6f9b48b3f 100644 --- a/whisper/peer.go +++ b/whisper/peer.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package whisper @@ -20,11 +20,11 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p" + "github.com/expanse-project/go-expanse/rlp" "gopkg.in/fatih/set.v0" ) diff --git a/whisper/peer_test.go b/whisper/peer_test.go index 594671ee14..81dd7f80cb 100644 --- a/whisper/peer_test.go +++ b/whisper/peer_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package whisper @@ -20,8 +20,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/expanse-project/go-expanse/p2p" + "github.com/expanse-project/go-expanse/p2p/discover" ) type testPeer struct { diff --git a/whisper/topic.go b/whisper/topic.go index 7ac3e8dc1d..a47f1bb34b 100644 --- a/whisper/topic.go +++ b/whisper/topic.go @@ -1,25 +1,25 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the Whisper protocol Topic element. For formal details please see -// the specs at https://github.com/ethereum/wiki/wiki/Whisper-PoC-1-Protocol-Spec#topics. +// the specs at https://github.com/expanse-project/wiki/wiki/Whisper-PoC-1-Protocol-Spec#topics. package whisper -import "github.com/ethereum/go-ethereum/crypto" +import "github.com/expanse-project/go-expanse/crypto" // Topic represents a cryptographically secure, probabilistic partial // classifications of a message, determined as the first (left) 4 bytes of the diff --git a/whisper/topic_test.go b/whisper/topic_test.go index 9c45f67408..c70923ed2c 100644 --- a/whisper/topic_test.go +++ b/whisper/topic_test.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package whisper diff --git a/whisper/whisper.go b/whisper/whisper.go index 676d8ae7a3..b38ecc0510 100644 --- a/whisper/whisper.go +++ b/whisper/whisper.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package whisper @@ -21,13 +21,13 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/crypto/ecies" - "github.com/ethereum/go-ethereum/event/filter" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/crypto/ecies" + "github.com/expanse-project/go-expanse/event/filter" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p" "gopkg.in/fatih/set.v0" ) @@ -56,7 +56,7 @@ type MessageEvent struct { Message *Message } -// Whisper represents a dark communication interface through the Ethereum +// Whisper represents a dark communication interface through the Expanse // network, using its very own P2P communication layer. type Whisper struct { protocol p2p.Protocol @@ -74,7 +74,7 @@ type Whisper struct { quit chan struct{} } -// New creates a Whisper client ready to communicate through the Ethereum P2P +// New creates a Whisper client ready to communicate through the Expanse P2P // network. func New() *Whisper { whisper := &Whisper{ diff --git a/whisper/whisper_test.go b/whisper/whisper_test.go index b5a919984b..c036b354e5 100644 --- a/whisper/whisper_test.go +++ b/whisper/whisper_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package whisper @@ -20,8 +20,8 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/expanse-project/go-expanse/p2p" + "github.com/expanse-project/go-expanse/p2p/discover" ) func startTestCluster(n int) []*Whisper { diff --git a/xeth/frontend.go b/xeth/frontend.go index e892822428..d52f4c3063 100644 --- a/xeth/frontend.go +++ b/xeth/frontend.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package xeth diff --git a/xeth/state.go b/xeth/state.go index 981fe63b7e..16c5f1139f 100644 --- a/xeth/state.go +++ b/xeth/state.go @@ -1,24 +1,24 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package xeth import ( - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" ) type State struct { diff --git a/xeth/types.go b/xeth/types.go index 218c8dc7cd..69ef054ad9 100644 --- a/xeth/types.go +++ b/xeth/types.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package xeth @@ -22,13 +22,13 @@ import ( "math/big" "strings" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/p2p" + "github.com/expanse-project/go-expanse/rlp" ) type Object struct { diff --git a/xeth/whisper.go b/xeth/whisper.go index e7130978f2..97eee34a4c 100644 --- a/xeth/whisper.go +++ b/xeth/whisper.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the external API to the whisper sub-protocol. @@ -22,10 +22,10 @@ import ( "fmt" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/whisper" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/whisper" ) var qlogger = logger.NewLogger("XSHH") diff --git a/xeth/whisper_filter.go b/xeth/whisper_filter.go index fdf5cebae1..25dfb730a3 100644 --- a/xeth/whisper_filter.go +++ b/xeth/whisper_filter.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the external API side message filter for watching, pooling and polling // matched whisper messages, also serializing data access to avoid duplications. @@ -23,7 +23,7 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/common" + "github.com/expanse-project/go-expanse/common" ) // whisperFilter is the message cache matching a specific filter, accumulating diff --git a/xeth/whisper_message.go b/xeth/whisper_message.go index b3014a6972..992d5a51b7 100644 --- a/xeth/whisper_message.go +++ b/xeth/whisper_message.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . // Contains the external API representation of a whisper message. @@ -21,9 +21,9 @@ package xeth import ( "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/whisper" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/whisper" ) // WhisperMessage is the external API representation of a whisper.Message. diff --git a/xeth/xeth.go b/xeth/xeth.go index 8bd45998f1..010d528761 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -1,20 +1,20 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . -// Package xeth is the interface to all Ethereum functionality. +// Package xeth is the interface to all Expanse functionality. package xeth import ( @@ -27,19 +27,19 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/compiler" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/event/filter" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/common/compiler" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/exp" + "github.com/expanse-project/go-expanse/event/filter" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/miner" + "github.com/expanse-project/go-expanse/rlp" ) var ( @@ -62,13 +62,13 @@ func DefaultGas() *big.Int { return new(big.Int).Set(defaultGas) } func (self *XEth) DefaultGasPrice() *big.Int { if self.gpo == nil { - self.gpo = eth.NewGasPriceOracle(self.backend) + self.gpo = exp.NewGasPriceOracle(self.backend) } return self.gpo.SuggestPrice() } type XEth struct { - backend *eth.Ethereum + backend *exp.Expanse frontend Frontend state *State @@ -93,12 +93,12 @@ type XEth struct { agent *miner.RemoteAgent - gpo *eth.GasPriceOracle + gpo *exp.GasPriceOracle } -func NewTest(eth *eth.Ethereum, frontend Frontend) *XEth { +func NewTest(exp *exp.Expanse, frontend Frontend) *XEth { return &XEth{ - backend: eth, + backend: exp, frontend: frontend, } } @@ -106,22 +106,22 @@ func NewTest(eth *eth.Ethereum, frontend Frontend) *XEth { // New creates an XEth that uses the given frontend. // If a nil Frontend is provided, a default frontend which // confirms all transactions will be used. -func New(ethereum *eth.Ethereum, frontend Frontend) *XEth { +func New(expanse *exp.Expanse, frontend Frontend) *XEth { xeth := &XEth{ - backend: ethereum, + backend: expanse, frontend: frontend, quit: make(chan struct{}), - filterManager: filter.NewFilterManager(ethereum.EventMux()), + filterManager: filter.NewFilterManager(expanse.EventMux()), logQueue: make(map[int]*logQueue), blockQueue: make(map[int]*hashQueue), transactionQueue: make(map[int]*hashQueue), messages: make(map[int]*whisperFilter), agent: miner.NewRemoteAgent(), } - if ethereum.Whisper() != nil { - xeth.whisper = NewWhisper(ethereum.Whisper()) + if expanse.Whisper() != nil { + xeth.whisper = NewWhisper(expanse.Whisper()) } - ethereum.Miner().Register(xeth.agent) + expanse.Miner().Register(xeth.agent) if frontend == nil { xeth.frontend = dummyFrontend{} } From 1a1d9a14ab4e72675fd85962c7022cbd92af494a Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Fri, 7 Aug 2015 15:38:43 -0400 Subject: [PATCH 69/90] change folder because why not --- {eth => exp}/backend.go | 0 {eth => exp}/downloader/downloader.go | 0 {eth => exp}/downloader/downloader_test.go | 0 {eth => exp}/downloader/events.go | 0 {eth => exp}/downloader/peer.go | 0 {eth => exp}/downloader/queue.go | 0 {eth => exp}/fetcher/fetcher.go | 0 {eth => exp}/fetcher/fetcher_test.go | 0 {eth => exp}/fetcher/metrics.go | 0 {eth => exp}/gasprice.go | 0 {eth => exp}/handler.go | 0 {eth => exp}/metrics.go | 0 {eth => exp}/peer.go | 0 {eth => exp}/protocol.go | 0 {eth => exp}/protocol_test.go | 0 {eth => exp}/sync.go | 0 16 files changed, 0 insertions(+), 0 deletions(-) rename {eth => exp}/backend.go (100%) rename {eth => exp}/downloader/downloader.go (100%) rename {eth => exp}/downloader/downloader_test.go (100%) rename {eth => exp}/downloader/events.go (100%) rename {eth => exp}/downloader/peer.go (100%) rename {eth => exp}/downloader/queue.go (100%) rename {eth => exp}/fetcher/fetcher.go (100%) rename {eth => exp}/fetcher/fetcher_test.go (100%) rename {eth => exp}/fetcher/metrics.go (100%) rename {eth => exp}/gasprice.go (100%) rename {eth => exp}/handler.go (100%) rename {eth => exp}/metrics.go (100%) rename {eth => exp}/peer.go (100%) rename {eth => exp}/protocol.go (100%) rename {eth => exp}/protocol_test.go (100%) rename {eth => exp}/sync.go (100%) diff --git a/eth/backend.go b/exp/backend.go similarity index 100% rename from eth/backend.go rename to exp/backend.go diff --git a/eth/downloader/downloader.go b/exp/downloader/downloader.go similarity index 100% rename from eth/downloader/downloader.go rename to exp/downloader/downloader.go diff --git a/eth/downloader/downloader_test.go b/exp/downloader/downloader_test.go similarity index 100% rename from eth/downloader/downloader_test.go rename to exp/downloader/downloader_test.go diff --git a/eth/downloader/events.go b/exp/downloader/events.go similarity index 100% rename from eth/downloader/events.go rename to exp/downloader/events.go diff --git a/eth/downloader/peer.go b/exp/downloader/peer.go similarity index 100% rename from eth/downloader/peer.go rename to exp/downloader/peer.go diff --git a/eth/downloader/queue.go b/exp/downloader/queue.go similarity index 100% rename from eth/downloader/queue.go rename to exp/downloader/queue.go diff --git a/eth/fetcher/fetcher.go b/exp/fetcher/fetcher.go similarity index 100% rename from eth/fetcher/fetcher.go rename to exp/fetcher/fetcher.go diff --git a/eth/fetcher/fetcher_test.go b/exp/fetcher/fetcher_test.go similarity index 100% rename from eth/fetcher/fetcher_test.go rename to exp/fetcher/fetcher_test.go diff --git a/eth/fetcher/metrics.go b/exp/fetcher/metrics.go similarity index 100% rename from eth/fetcher/metrics.go rename to exp/fetcher/metrics.go diff --git a/eth/gasprice.go b/exp/gasprice.go similarity index 100% rename from eth/gasprice.go rename to exp/gasprice.go diff --git a/eth/handler.go b/exp/handler.go similarity index 100% rename from eth/handler.go rename to exp/handler.go diff --git a/eth/metrics.go b/exp/metrics.go similarity index 100% rename from eth/metrics.go rename to exp/metrics.go diff --git a/eth/peer.go b/exp/peer.go similarity index 100% rename from eth/peer.go rename to exp/peer.go diff --git a/eth/protocol.go b/exp/protocol.go similarity index 100% rename from eth/protocol.go rename to exp/protocol.go diff --git a/eth/protocol_test.go b/exp/protocol_test.go similarity index 100% rename from eth/protocol_test.go rename to exp/protocol_test.go diff --git a/eth/sync.go b/exp/sync.go similarity index 100% rename from eth/sync.go rename to exp/sync.go From bf234c6b821e260bc983427601b6ab58900f0d08 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Fri, 7 Aug 2015 15:40:29 -0400 Subject: [PATCH 70/90] gexp change again --- cmd/{geth => gexp}/blocktestcmd.go | 0 cmd/{geth => gexp}/chaincmd.go | 0 cmd/{geth => gexp}/info_test.json | 0 cmd/{geth => gexp}/js.go | 0 cmd/{geth => gexp}/js_test.go | 0 cmd/{geth => gexp}/main.go | 0 cmd/{geth => gexp}/monitorcmd.go | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename cmd/{geth => gexp}/blocktestcmd.go (100%) rename cmd/{geth => gexp}/chaincmd.go (100%) rename cmd/{geth => gexp}/info_test.json (100%) rename cmd/{geth => gexp}/js.go (100%) rename cmd/{geth => gexp}/js_test.go (100%) rename cmd/{geth => gexp}/main.go (100%) rename cmd/{geth => gexp}/monitorcmd.go (100%) diff --git a/cmd/geth/blocktestcmd.go b/cmd/gexp/blocktestcmd.go similarity index 100% rename from cmd/geth/blocktestcmd.go rename to cmd/gexp/blocktestcmd.go diff --git a/cmd/geth/chaincmd.go b/cmd/gexp/chaincmd.go similarity index 100% rename from cmd/geth/chaincmd.go rename to cmd/gexp/chaincmd.go diff --git a/cmd/geth/info_test.json b/cmd/gexp/info_test.json similarity index 100% rename from cmd/geth/info_test.json rename to cmd/gexp/info_test.json diff --git a/cmd/geth/js.go b/cmd/gexp/js.go similarity index 100% rename from cmd/geth/js.go rename to cmd/gexp/js.go diff --git a/cmd/geth/js_test.go b/cmd/gexp/js_test.go similarity index 100% rename from cmd/geth/js_test.go rename to cmd/gexp/js_test.go diff --git a/cmd/geth/main.go b/cmd/gexp/main.go similarity index 100% rename from cmd/geth/main.go rename to cmd/gexp/main.go diff --git a/cmd/geth/monitorcmd.go b/cmd/gexp/monitorcmd.go similarity index 100% rename from cmd/geth/monitorcmd.go rename to cmd/gexp/monitorcmd.go From b362f1d141e29263a62924601d10b59c6e611834 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Fri, 7 Aug 2015 15:45:17 -0400 Subject: [PATCH 71/90] ethash --- .idea/workspace.xml | 538 +----------------- .../ethash/.gitignore | 0 .../ethash/.travis.yml | 0 .../ethash/CMakeLists.txt | 0 .../ethash/MANIFEST.in | 0 .../ethash/Makefile | 0 .../ethash/README.md | 0 .../ethash/Vagrantfile | 0 .../ethash/appveyor.yml | 0 .../cmake/modules/CMakeParseArguments.cmake | 0 .../ethash/cmake/modules/FindCryptoPP.cmake | 0 .../ethash/cmake/modules/FindOpenCL.cmake | 0 .../FindPackageHandleStandardArgs.cmake | 0 .../cmake/modules/FindPackageMessage.cmake | 0 .../ethash/cryptopp/CMakeLists.txt | 0 .../ethash/ethash.go | 0 .../ethash/ethash_test.go | 0 .../ethash/ethashc.go | 0 .../ethash/js/LICENSE | 0 .../ethash/js/ethash.js | 0 .../ethash/js/keccak.js | 0 .../ethash/js/makekeccak.js | 0 .../ethash/js/test.js | 0 .../ethash/js/util.js | 0 .../ethash/setup.py | 0 .../ethash/src/benchmark/CMakeLists.txt | 0 .../ethash/src/benchmark/benchmark.cpp | 0 .../ethash/src/libethash/CMakeLists.txt | 0 .../ethash/src/libethash/compiler.h | 0 .../ethash/src/libethash/data_sizes.h | 0 .../ethash/src/libethash/endian.h | 0 .../ethash/src/libethash/ethash.h | 0 .../ethash/src/libethash/fnv.h | 0 .../ethash/src/libethash/internal.c | 0 .../ethash/src/libethash/internal.h | 0 .../ethash/src/libethash/io.c | 0 .../ethash/src/libethash/io.h | 0 .../ethash/src/libethash/io_posix.c | 0 .../ethash/src/libethash/io_win32.c | 0 .../ethash/src/libethash/mmap.h | 0 .../ethash/src/libethash/mmap_win32.c | 0 .../ethash/src/libethash/sha3.c | 0 .../ethash/src/libethash/sha3.h | 0 .../ethash/src/libethash/sha3_cryptopp.cpp | 0 .../ethash/src/libethash/sha3_cryptopp.h | 0 .../ethash/src/libethash/util.h | 0 .../ethash/src/libethash/util_win32.c | 0 .../ethash/src/python/core.c | 0 .../ethash/test/c/CMakeLists.txt | 0 .../ethash/test/c/test.cpp | 0 .../ethash/test/c/test.sh | 0 .../ethash/test/python/.gitignore | 0 .../ethash/test/python/requirements.txt | 0 .../ethash/test/python/test.sh | 0 .../ethash/test/python/test_pyethash.py | 0 .../ethash/test/test.sh | 0 56 files changed, 3 insertions(+), 535 deletions(-) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/.gitignore (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/.travis.yml (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/CMakeLists.txt (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/MANIFEST.in (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/Makefile (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/README.md (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/Vagrantfile (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/appveyor.yml (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/cmake/modules/CMakeParseArguments.cmake (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/cmake/modules/FindCryptoPP.cmake (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/cmake/modules/FindOpenCL.cmake (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/cmake/modules/FindPackageHandleStandardArgs.cmake (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/cmake/modules/FindPackageMessage.cmake (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/cryptopp/CMakeLists.txt (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/ethash.go (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/ethash_test.go (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/ethashc.go (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/js/LICENSE (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/js/ethash.js (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/js/keccak.js (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/js/makekeccak.js (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/js/test.js (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/js/util.js (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/setup.py (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/benchmark/CMakeLists.txt (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/benchmark/benchmark.cpp (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/CMakeLists.txt (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/compiler.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/data_sizes.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/endian.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/ethash.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/fnv.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/internal.c (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/internal.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/io.c (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/io.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/io_posix.c (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/io_win32.c (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/mmap.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/mmap_win32.c (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/sha3.c (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/sha3.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/sha3_cryptopp.cpp (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/sha3_cryptopp.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/util.h (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/libethash/util_win32.c (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/src/python/core.c (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/test/c/CMakeLists.txt (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/test/c/test.cpp (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/test/c/test.sh (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/test/python/.gitignore (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/test/python/requirements.txt (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/test/python/test.sh (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/test/python/test_pyethash.py (100%) rename Godeps/_workspace/src/github.com/{ethereum => expanse-project}/ethash/test/test.sh (100%) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b88a882863..651952c7b1 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,385 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -479,26 +101,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -669,11 +271,11 @@ - + - + @@ -801,22 +403,6 @@ - - - - - - - - - - - - - - - - @@ -889,97 +475,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1004,17 +499,6 @@ - - - - - - - - - - - @@ -1061,22 +545,6 @@ - - - - - - - - - - - - - - - - diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/.gitignore b/Godeps/_workspace/src/github.com/expanse-project/ethash/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/.gitignore rename to Godeps/_workspace/src/github.com/expanse-project/ethash/.gitignore diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml b/Godeps/_workspace/src/github.com/expanse-project/ethash/.travis.yml similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/.travis.yml rename to Godeps/_workspace/src/github.com/expanse-project/ethash/.travis.yml diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/CMakeLists.txt b/Godeps/_workspace/src/github.com/expanse-project/ethash/CMakeLists.txt similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/CMakeLists.txt rename to Godeps/_workspace/src/github.com/expanse-project/ethash/CMakeLists.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/MANIFEST.in b/Godeps/_workspace/src/github.com/expanse-project/ethash/MANIFEST.in similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/MANIFEST.in rename to Godeps/_workspace/src/github.com/expanse-project/ethash/MANIFEST.in diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/Makefile b/Godeps/_workspace/src/github.com/expanse-project/ethash/Makefile similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/Makefile rename to Godeps/_workspace/src/github.com/expanse-project/ethash/Makefile diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/README.md b/Godeps/_workspace/src/github.com/expanse-project/ethash/README.md similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/README.md rename to Godeps/_workspace/src/github.com/expanse-project/ethash/README.md diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/Vagrantfile b/Godeps/_workspace/src/github.com/expanse-project/ethash/Vagrantfile similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/Vagrantfile rename to Godeps/_workspace/src/github.com/expanse-project/ethash/Vagrantfile diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/appveyor.yml b/Godeps/_workspace/src/github.com/expanse-project/ethash/appveyor.yml similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/appveyor.yml rename to Godeps/_workspace/src/github.com/expanse-project/ethash/appveyor.yml diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/CMakeParseArguments.cmake b/Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/CMakeParseArguments.cmake similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/CMakeParseArguments.cmake rename to Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/CMakeParseArguments.cmake diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindCryptoPP.cmake b/Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/FindCryptoPP.cmake similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindCryptoPP.cmake rename to Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/FindCryptoPP.cmake diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake b/Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/FindOpenCL.cmake similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindOpenCL.cmake rename to Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/FindOpenCL.cmake diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageHandleStandardArgs.cmake b/Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/FindPackageHandleStandardArgs.cmake similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageHandleStandardArgs.cmake rename to Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/FindPackageHandleStandardArgs.cmake diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageMessage.cmake b/Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/FindPackageMessage.cmake similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/cmake/modules/FindPackageMessage.cmake rename to Godeps/_workspace/src/github.com/expanse-project/ethash/cmake/modules/FindPackageMessage.cmake diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/cryptopp/CMakeLists.txt b/Godeps/_workspace/src/github.com/expanse-project/ethash/cryptopp/CMakeLists.txt similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/cryptopp/CMakeLists.txt rename to Godeps/_workspace/src/github.com/expanse-project/ethash/cryptopp/CMakeLists.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go b/Godeps/_workspace/src/github.com/expanse-project/ethash/ethash.go similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go rename to Godeps/_workspace/src/github.com/expanse-project/ethash/ethash.go diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go b/Godeps/_workspace/src/github.com/expanse-project/ethash/ethash_test.go similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go rename to Godeps/_workspace/src/github.com/expanse-project/ethash/ethash_test.go diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/ethashc.go b/Godeps/_workspace/src/github.com/expanse-project/ethash/ethashc.go similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/ethashc.go rename to Godeps/_workspace/src/github.com/expanse-project/ethash/ethashc.go diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/LICENSE b/Godeps/_workspace/src/github.com/expanse-project/ethash/js/LICENSE similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/js/LICENSE rename to Godeps/_workspace/src/github.com/expanse-project/ethash/js/LICENSE diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/ethash.js b/Godeps/_workspace/src/github.com/expanse-project/ethash/js/ethash.js similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/js/ethash.js rename to Godeps/_workspace/src/github.com/expanse-project/ethash/js/ethash.js diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/keccak.js b/Godeps/_workspace/src/github.com/expanse-project/ethash/js/keccak.js similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/js/keccak.js rename to Godeps/_workspace/src/github.com/expanse-project/ethash/js/keccak.js diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/makekeccak.js b/Godeps/_workspace/src/github.com/expanse-project/ethash/js/makekeccak.js similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/js/makekeccak.js rename to Godeps/_workspace/src/github.com/expanse-project/ethash/js/makekeccak.js diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/test.js b/Godeps/_workspace/src/github.com/expanse-project/ethash/js/test.js similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/js/test.js rename to Godeps/_workspace/src/github.com/expanse-project/ethash/js/test.js diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/js/util.js b/Godeps/_workspace/src/github.com/expanse-project/ethash/js/util.js similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/js/util.js rename to Godeps/_workspace/src/github.com/expanse-project/ethash/js/util.js diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/setup.py b/Godeps/_workspace/src/github.com/expanse-project/ethash/setup.py similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/setup.py rename to Godeps/_workspace/src/github.com/expanse-project/ethash/setup.py diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/CMakeLists.txt b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/benchmark/CMakeLists.txt similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/CMakeLists.txt rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/benchmark/CMakeLists.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/benchmark.cpp b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/benchmark/benchmark.cpp similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/benchmark/benchmark.cpp rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/benchmark/benchmark.cpp diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/CMakeLists.txt b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/CMakeLists.txt similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/CMakeLists.txt rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/CMakeLists.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/compiler.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/compiler.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/compiler.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/data_sizes.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/data_sizes.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/data_sizes.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/endian.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/endian.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/endian.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/endian.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/ethash.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/ethash.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/ethash.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/ethash.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/fnv.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/fnv.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/fnv.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/internal.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.c rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/internal.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/internal.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/internal.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/internal.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.c b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/io.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.c rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/io.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/io.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/io.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_posix.c b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/io_posix.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_posix.c rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/io_posix.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_win32.c b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/io_win32.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/io_win32.c rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/io_win32.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/mmap.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/mmap.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/mmap.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/mmap.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/mmap_win32.c b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/mmap_win32.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/mmap_win32.c rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/mmap_win32.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.c b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/sha3.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.c rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/sha3.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/sha3.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/sha3.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.cpp b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/sha3_cryptopp.cpp similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.cpp rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/sha3_cryptopp.cpp diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/sha3_cryptopp.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/sha3_cryptopp.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/sha3_cryptopp.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.h b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/util.h similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util.h rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/util.h diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util_win32.c b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/util_win32.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/libethash/util_win32.c rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/libethash/util_win32.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c b/Godeps/_workspace/src/github.com/expanse-project/ethash/src/python/core.c similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/src/python/core.c rename to Godeps/_workspace/src/github.com/expanse-project/ethash/src/python/core.c diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/CMakeLists.txt b/Godeps/_workspace/src/github.com/expanse-project/ethash/test/c/CMakeLists.txt similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/test/c/CMakeLists.txt rename to Godeps/_workspace/src/github.com/expanse-project/ethash/test/c/CMakeLists.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp b/Godeps/_workspace/src/github.com/expanse-project/ethash/test/c/test.cpp similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp rename to Godeps/_workspace/src/github.com/expanse-project/ethash/test/c/test.cpp diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.sh b/Godeps/_workspace/src/github.com/expanse-project/ethash/test/c/test.sh similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.sh rename to Godeps/_workspace/src/github.com/expanse-project/ethash/test/c/test.sh diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/.gitignore b/Godeps/_workspace/src/github.com/expanse-project/ethash/test/python/.gitignore similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/test/python/.gitignore rename to Godeps/_workspace/src/github.com/expanse-project/ethash/test/python/.gitignore diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt b/Godeps/_workspace/src/github.com/expanse-project/ethash/test/python/requirements.txt similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt rename to Godeps/_workspace/src/github.com/expanse-project/ethash/test/python/requirements.txt diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh b/Godeps/_workspace/src/github.com/expanse-project/ethash/test/python/test.sh similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh rename to Godeps/_workspace/src/github.com/expanse-project/ethash/test/python/test.sh diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py b/Godeps/_workspace/src/github.com/expanse-project/ethash/test/python/test_pyethash.py similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py rename to Godeps/_workspace/src/github.com/expanse-project/ethash/test/python/test_pyethash.py diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh b/Godeps/_workspace/src/github.com/expanse-project/ethash/test/test.sh similarity index 100% rename from Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh rename to Godeps/_workspace/src/github.com/expanse-project/ethash/test/test.sh From a6ece4799a53172ac1a8018211e2dca1625da472 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Fri, 7 Aug 2015 15:51:32 -0400 Subject: [PATCH 72/90] update env --- build/env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/env.sh b/build/env.sh index 1ba0936131..d2fd786383 100755 --- a/build/env.sh +++ b/build/env.sh @@ -10,7 +10,7 @@ fi # Create fake Go workspace if it doesn't exist yet. workspace="$PWD/build/_workspace" root="$PWD" -ethdir="$workspace/src/github.com/expanse" +ethdir="$workspace/src/github.com/expanse-project" if [ ! -L "$ethdir/go-expanse" ]; then mkdir -p "$ethdir" cd "$ethdir" From 2c3541ea48610efe0dd85520d6a04266842c44a2 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Fri, 7 Aug 2015 19:15:06 -0400 Subject: [PATCH 73/90] add genesis file --- common/registrar/registrar.go | 2 +- expanse_genesis.json | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 expanse_genesis.json diff --git a/common/registrar/registrar.go b/common/registrar/registrar.go index 9d09d8c6e8..d6e28c0cad 100644 --- a/common/registrar/registrar.go +++ b/common/registrar/registrar.go @@ -57,7 +57,7 @@ contracts var ( UrlHintAddr = "0x0" HashRegAddr = "0x0" - GlobalRegistrarAddr = "0x0" + GlobalRegistrarAddr = "0x90c4384bb05d96d2f54b27e0102da5240f7833ae" // GlobalRegistrarAddr = "0xc6d9d2cd449a754c494264e1809c50e34d64562b" zero = regexp.MustCompile("^(0x)?0*$") diff --git a/expanse_genesis.json b/expanse_genesis.json new file mode 100644 index 0000000000..96df5bbb5a --- /dev/null +++ b/expanse_genesis.json @@ -0,0 +1,13 @@ +{ + "nonce": "0xdefaceddefacedcf", + "timestamp": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "extraData": "0x4672616e6b6f497346726565646f6d", + "gasLimit": "0x1388", + "difficulty": "0x400000000", + "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "coinbase": "0x90c4384bb05d96d2f54b27e0102da5240f7833ae", + "alloc": { + "0x90c4384bb05d96d2f54b27e0102da5240f7833ae": { "balance": "1000000000000000000000000" } + } +} \ No newline at end of file From 1cfc9ec1e9a6995b8e7989ebbca475f0d1b8d6ae Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Thu, 13 Aug 2015 09:03:28 -0400 Subject: [PATCH 74/90] ether to expanse --- .gitignore | 2 +- .idea/misc.xml | 4 + .idea/workspace.xml | 330 ++++++++---------- README.md | 6 +- cmd/ethtest/main.go | 4 +- cmd/gexp/main.go | 33 +- cmd/gexp/monitorcmd.go | 4 +- common/natspec/natspec_js.go | 66 ++-- common/size_test.go | 4 +- core/bench_test.go | 2 +- core/chain_makers_test.go | 4 +- crypto/mnemonic_words.go | 4 + jsre/ethereum_js.go | 108 +++--- tests/files/TrieTests/trietest.json | 4 +- .../files/TrieTests/trietest_secureTrie.json | 4 +- .../ansible/test-files/docker-go/Dockerfile | 4 +- trie/iterator_test.go | 2 +- trie/trie_test.go | 26 +- 18 files changed, 280 insertions(+), 331 deletions(-) create mode 100644 .idea/misc.xml diff --git a/.gitignore b/.gitignore index 48077ede1c..4c12be4a81 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ *un~ .DS_Store */**/.DS_Store -.ethtest +.exptest */**/*tx_database* */**/*dapps* Godeps/_workspace/pkg diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000000..8662aa97f9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 651952c7b1..4f054aeb80 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,25 @@ - + + + + + + + + + + + + + + + + + + + @@ -25,87 +43,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - - + + + + + - - + + + + + + + + + + + + + + + @@ -119,12 +87,6 @@ @@ -206,6 +174,7 @@ + @@ -226,7 +195,6 @@ - @@ -248,10 +216,16 @@ - + + + + + + true + - + @@ -270,28 +244,28 @@ - + - - - - - - + + - - + + + + + - + + @@ -315,11 +289,26 @@ + + + + + + + + + + + + + + + + - @@ -327,7 +316,6 @@ - @@ -335,7 +323,6 @@ - @@ -343,7 +330,6 @@ - @@ -351,7 +337,6 @@ - @@ -359,7 +344,6 @@ - @@ -367,7 +351,6 @@ - @@ -375,15 +358,6 @@ - - - - - - - - - @@ -391,7 +365,6 @@ - @@ -399,7 +372,6 @@ - @@ -407,7 +379,6 @@ - @@ -415,7 +386,6 @@ - @@ -423,7 +393,6 @@ - @@ -431,7 +400,6 @@ - @@ -439,7 +407,6 @@ - @@ -455,7 +422,6 @@ - @@ -463,7 +429,6 @@ - @@ -471,7 +436,6 @@ - @@ -479,7 +443,6 @@ - @@ -487,7 +450,6 @@ - @@ -495,26 +457,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -525,7 +467,6 @@ - @@ -533,15 +474,6 @@ - - - - - - - - - @@ -553,56 +485,80 @@ - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/README.md b/README.md index 842f8238ac..06557fe3be 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The following builds are build automatically by our build servers after each pus * Ubuntu [trusty](https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-trusty/latest/) | [utopic](https://build.ethdev.com/builds/Linux%20Go%20develop%20deb%20i386-utopic/latest/) -* [Windows 64-bit](https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Geth-Win64-latest.zip) +* [Windows 64-bit](https://build.ethdev.com/builds/Windows%20Go%20develop%20branch/Gexp-Win64-latest.zip) * [ARM](https://build.ethdev.com/builds/ARM%20Go%20develop%20branch/gexp-ARM-latest.tar.bz2) ## Building the source @@ -43,8 +43,8 @@ Go Expanse comes with several wrappers/executables found in * `gexp` Expanse CLI (expanse command line interface client) * `bootnode` runs a bootstrap node for the Discovery Protocol -* `ethtest` test tool which runs with the [tests](https://github.com/expanse-project/tests) suite: - `/path/to/test.json > ethtest --test BlockTests --stdin`. +* `exptest` test tool which runs with the [tests](https://github.com/expanse-project/tests) suite: + `/path/to/test.json > exptest --test BlockTests --stdin`. * `evm` is a generic Expanse Virtual Machine: `evm -code 60ff60ff -gas 10000 -price 0 -dump`. See `-h` for a detailed description. * `disasm` disassembles EVM code: `echo "6001" | disasm` diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go index 41edb08dbe..516da01297 100644 --- a/cmd/ethtest/main.go +++ b/cmd/ethtest/main.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with go-expanse. If not, see . -// ethtest executes Expanse JSON tests. +// exptest executes Expanse JSON tests. package main import ( @@ -204,7 +204,7 @@ func main() { glog.SetToStderr(true) app := cli.NewApp() - app.Name = "ethtest" + app.Name = "exptest" app.Usage = "go-expanse test interface" app.Action = setupApp app.Version = "0.2.0" diff --git a/cmd/gexp/main.go b/cmd/gexp/main.go index c2f7ad9486..7cd70a02ed 100644 --- a/cmd/gexp/main.go +++ b/cmd/gexp/main.go @@ -48,7 +48,7 @@ import ( ) const ( - ClientIdentifier = "Geth" + ClientIdentifier = "Gexp" Version = "1.1.0" VersionMajor = 1 VersionMinor = 1 @@ -125,7 +125,7 @@ The output of this command is supposed to be machine-readable. get wallet import /path/to/my/presale.wallet -will prompt for your password and imports your ether presale account. +will prompt for your password and imports your expanse presale account. It can be used non-interactively with the --password option taking a passwordfile as argument containing the wallet password in plaintext. @@ -248,18 +248,18 @@ nodes. { Action: console, Name: "console", - Usage: `Geth Console: interactive JavaScript environment`, + Usage: `Gexp Console: interactive JavaScript environment`, Description: ` -The Geth console is an interactive shell for the JavaScript runtime environment +The Gexp console is an interactive shell for the JavaScript runtime environment which exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/expanse-project/go-expanse/wiki/Javascipt-Console `}, { Action: attach, Name: "attach", - Usage: `Geth Console: interactive JavaScript environment (connect to node)`, + Usage: `Gexp Console: interactive JavaScript environment (connect to node)`, Description: ` -The Geth console is an interactive shell for the JavaScript runtime environment +The Gexp console is an interactive shell for the JavaScript runtime environment which exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/expanse-project/go-expanse/wiki/Javascipt-Console. This command allows to open a console on a running gexp node. @@ -268,7 +268,7 @@ This command allows to open a console on a running gexp node. { Action: execJSFiles, Name: "js", - Usage: `executes the given JavaScript files in the Geth JavaScript VM`, + Usage: `executes the given JavaScript files in the Gexp JavaScript VM`, Description: ` The JavaScript VM exposes a node admin interface as well as the Ðapp JavaScript API. See https://github.com/expanse-project/go-expanse/wiki/Javascipt-Console @@ -395,19 +395,7 @@ func run(ctx *cli.Context) { func attach(ctx *cli.Context) { utils.CheckLegalese(ctx.GlobalString(utils.DataDirFlag.Name)) -<<<<<<< HEAD - var client comms.EthereumClient -======= - // Wrap the standard output with a colorified stream (windows) - if isatty.IsTerminal(os.Stdout.Fd()) { - if pr, pw, err := os.Pipe(); err == nil { - go io.Copy(colorable.NewColorableStdout(), pr) - os.Stdout = pw - } - } - var client comms.ExpanseClient ->>>>>>> test change lol var err error if ctx.Args().Present() { client, err = comms.ClientFromEndpoint(ctx.Args().First(), codec.JSON) @@ -558,14 +546,7 @@ func startEth(ctx *cli.Context, exp *exp.Expanse) { // Start Expanse itself utils.StartExpanse(exp) -<<<<<<< HEAD - am := eth.AccountManager() -======= - // Start logging file descriptor stats. - fdtrack.Start() - am := exp.AccountManager() ->>>>>>> test change lol account := ctx.GlobalString(utils.UnlockedAccountFlag.Name) accounts := strings.Split(account, " ") for i, account := range accounts { diff --git a/cmd/gexp/monitorcmd.go b/cmd/gexp/monitorcmd.go index 4634ce5184..945eab5beb 100644 --- a/cmd/gexp/monitorcmd.go +++ b/cmd/gexp/monitorcmd.go @@ -53,9 +53,9 @@ var ( monitorCommand = cli.Command{ Action: monitor, Name: "monitor", - Usage: `Geth Monitor: node metrics monitoring and visualization`, + Usage: `Gexp Monitor: node metrics monitoring and visualization`, Description: ` -The Geth monitor is a tool to collect and visualize various internal metrics +The Gexp monitor is a tool to collect and visualize various internal metrics gathered by the node, supporting different chart types as well as the capacity to display multiple metrics simultaneously. `, diff --git a/common/natspec/natspec_js.go b/common/natspec/natspec_js.go index 7af296bbe1..dd1ceee16e 100644 --- a/common/natspec/natspec_js.go +++ b/common/natspec/natspec_js.go @@ -16,7 +16,7 @@ package natspec -const natspecJS = //`require=function t(e,n,r){function i(f,u){if(!n[f]){if(!e[f]){var s="function"==typeof require&&require;if(!u&&s)return s(f,!0);if(o)return o(f,!0);var c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c}var a=n[f]={exports:{}};e[f][0].call(a.exports,function(t){var n=e[f][1][t];return i(n?n:t)},a,a.exports,t,e,n,r)}return n[f].exports}for(var o="function"==typeof require&&require,f=0;fv;v++)d.push(g(e.slice(0,s))),e=e.slice(s);n.push(d)}else r.prefixedType("string")(t[c].type)?(a=a.slice(s),n.push(g(e.slice(0,s))),e=e.slice(s)):(n.push(g(e.slice(0,s))),e=e.slice(s))}),n},g=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(){var e=Array.prototype.slice.call(arguments);return a(t.inputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},m=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(e){return h(t.outputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e};e.exports={inputParser:g,outputParser:m,formatInput:a,formatOutput:h}},{"./const":4,"./formatters":5,"./types":6,"./utils":7}],4:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=["wei","Kwei","Mwei","Gwei","szabo","finney","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3}}).call(this,t("_process"))},{_process:2,"bignumber.js":8}],5:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=t("./utils"),o=t("./const"),f=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},u=function(t){var e=2*o.ETH_PADDING;return t instanceof r||"number"==typeof t?("number"==typeof t&&(t=new r(t)),r.config(o.ETH_BIGNUMBER_ROUNDING_MODE),t=t.round(),t.lessThan(0)&&(t=new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?u(new r(t)):(+t).toString(16),f(t,e)},s=function(t){return i.fromAscii(t,o.ETH_PADDING).substr(2)},c=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},a=function(t){return u(new r(t).times(new r(2).pow(128)))},l=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},p=function(t){return t=t||"0",l(t)?new r(t,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(t,16)},h=function(t){return t=t||"0",new r(t,16)},g=function(t){return p(t).dividedBy(new r(2).pow(128))},m=function(t){return h(t).dividedBy(new r(2).pow(128))},d=function(t){return"0x"+t},v=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},w=function(t){return i.toAscii(t)},y=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:u,formatInputString:s,formatInputBool:c,formatInputReal:a,formatOutputInt:p,formatOutputUInt:h,formatOutputReal:g,formatOutputUReal:m,formatOutputHash:d,formatOutputBool:v,formatOutputString:w,formatOutputAddress:y}}).call(this,t("_process"))},{"./const":4,"./utils":7,_process:2,"bignumber.js":8}],6:[function(t,e){var n=t("./formatters"),r=function(t){return function(e){return 0===e.indexOf(t)}},i=function(t){return function(e){return t===e}},o=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("hash"),format:n.formatInputInt},{type:r("string"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:i("address"),format:n.formatInputInt},{type:i("bool"),format:n.formatInputBool}]},f=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("hash"),format:n.formatOutputHash},{type:r("string"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:i("address"),format:n.formatOutputAddress},{type:i("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:i,inputTypes:o,outputTypes:f}},{"./formatters":5}],7:[function(t,e){var n=t("./const"),r=function(t,e){for(var n=!1,r=0;rn;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},o=function(t){for(var e="",n=0;n3e3&&rr?"i":"").test(c))return m(a,c,u,r);u?(a.s=0>1/t?(c=c.slice(1),-1):1,$&&c.replace(/^0\.0*|\./,"").length>15&&U(L,O,t),u=!1):a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,a.s)}else{if(t instanceof e)return a.s=t.s,a.e=t.e,a.c=(t=t.c)?t.slice():t,void(L=0);if((u="number"==typeof t)&&0*t==0){if(a.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,f=t;f>=10;f/=10,o++);return a.e=o,a.c=[t],void(L=0)}c=t+""}else{if(!d.test(c=t+""))return m(a,c,u);a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(f=c.search(/e/i))>0?(0>o&&(o=f),o+=+c.slice(f+1),c=c.substring(0,f)):0>o&&(o=c.length),f=0;48===c.charCodeAt(f);f++);for(s=c.length;48===c.charCodeAt(--s););if(c=c.slice(f,s+1))if(s=c.length,u&&$&&s>15&&U(L,O,a.s*t),o=o-f-1,o>q)a.c=a.e=null;else if(k>o)a.c=[a.e=0];else{if(a.e=o,a.c=[],f=(o+1)%I,0>o&&(f+=I),s>f){for(f&&a.c.push(+c.slice(0,f)),s-=I;s>f;)a.c.push(+c.slice(f,f+=I));c=c.slice(f),f=I-c.length}else f-=s;for(;f--;c+="0");a.c.push(+c)}else a.c=[a.e=0];L=0}function n(t,n,r,i){var f,u,s,a,p,h,g,m=t.indexOf("."),d=B,v=H;for(37>r&&(t=t.toLowerCase()),m>=0&&(s=Y,Y=0,t=t.replace(".",""),g=new e(r),p=g.pow(t.length-m),Y=s,g.c=c(l(o(p.c),p.e),10,n),g.e=g.c.length),h=c(t,r,n),u=s=h.length;0==h[--s];h.pop());if(!h[0])return"0";if(0>m?--u:(p.c=h,p.e=u,p.s=i,p=G(p,g,d,v,n),h=p.c,a=p.r,u=p.e),f=u+d+1,m=h[f],s=n/2,a=a||0>f||null!=h[f+1],a=4>v?(null!=m||a)&&(0==v||v==(p.s<0?3:2)):m>s||m==s&&(4==v||a||6==v&&1&h[f-1]||v==(p.s<0?8:7)),1>f||!h[0])t=a?l("1",-d):"0";else{if(h.length=f,a)for(--n;++h[--f]>n;)h[f]=0,f||(++u,h.unshift(1));for(s=h.length;!h[--s];);for(m=0,t="";s>=m;t+=N.charAt(h[m++]));t=l(t,u)}return t}function h(t,n,r,i){var f,u,s,c,p;if(r=null!=r&&z(r,0,8,i,b)?0|r:H,!t.c)return t.toString();if(f=t.c[0],s=t.e,null==n)p=o(t.c),p=19==i||24==i&&C>=s?a(p,s):l(p,s);else if(t=F(new e(t),n,r),u=t.e,p=o(t.c),c=p.length,19==i||24==i&&(u>=n||C>=u)){for(;n>c;p+="0",c++);p=a(p,u)}else if(n-=s,p=l(p,u),u+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=u-c,n>0)for(u+1==c&&(p+=".");n--;p+="0");return t.s<0&&f?"-"+p:p}function S(t,n){var r,i,o=0;for(s(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&U(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function R(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>q?t.c=t.e=null:k>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function U(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",L=0,r}function F(t,e,n,r){var i,o,f,u,s,c,a,l=t.c,p=_;if(l){t:{for(i=1,u=l[0];u>=10;u/=10,i++);if(o=e-i,0>o)o+=I,f=e,s=l[c=0],a=s/p[i-f-1]%10|0;else if(c=v((o+1)/I),c>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));s=a=0,i=1,o%=I,f=o-I+1}else{for(s=u=l[c],i=1;u>=10;u/=10,i++);o%=I,f=o-I+i,a=0>f?0:s/p[i-f-1]%10|0}if(r=r||0>e||null!=l[c+1]||(0>f?s:s%p[i-f-1]),r=4>n?(a||r)&&(0==n||n==(t.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?f>0?s/p[i-f]:0:l[c-1])%10&1||n==(t.s<0?8:7)),1>e||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=p[e%I],t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=c,u=1,c--):(l.length=c+1,u=p[I-o],l[c]=f>0?w(s/p[i-f]%p[f])*u:0),r)for(;;){if(0==c){for(o=1,f=l[0];f>=10;f/=10,o++);for(f=l[0]+=u,u=1;f>=10;f/=10,u++);o!=u&&(t.e++,l[0]==E&&(l[0]=1));break}if(l[c]+=u,l[c]!=E)break;l[c--]=0,u=1}for(o=l.length;0===l[--o];l.pop());}t.e>q?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return f(e="DECIMAL_PLACES")&&z(t,0,D,2,e)&&(B=0|t),r[e]=B,f(e="ROUNDING_MODE")&&z(t,0,8,2,e)&&(H=0|t),r[e]=H,f(e="EXPONENTIAL_AT")&&(s(t)?z(t[0],-D,0,2,e)&&z(t[1],0,D,2,e)&&(C=0|t[0],j=0|t[1]):z(t,-D,D,2,e)&&(C=-(j=0|(0>t?-t:t)))),r[e]=[C,j],f(e="RANGE")&&(s(t)?z(t[0],-D,-1,2,e)&&z(t[1],1,D,2,e)&&(k=0|t[0],q=0|t[1]):z(t,-D,D,2,e)&&(0|t?k=-(q=0|(0>t?-t:t)):$&&U(2,e+" cannot be zero",t))),r[e]=[k,q],f(e="ERRORS")&&(t===!!t||1===t||0===t?(L=0,z=($=!!t)?A:u):$&&U(2,e+y,t)),r[e]=$,f(e="CRYPTO")&&(t===!!t||1===t||0===t?(V=!(!t||!g||"object"!=typeof g),t&&!V&&$&&U(2,"crypto unavailable",g)):$&&U(2,e+y,t)),r[e]=V,f(e="MODULO_MODE")&&z(t,0,9,2,e)&&(W=0|t),r[e]=W,f(e="POW_PRECISION")&&z(t,0,D,2,e)&&(Y=0|t),r[e]=Y,f(e="FORMAT")&&("object"==typeof t?Z=t:$&&U(2,e+" not an object",t)),r[e]=Z,r},e.max=function(){return S(arguments,M.lt)},e.min=function(){return S(arguments,M.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return w(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,f,u,s=0,c=[],a=new e(P);if(t=null!=t&&z(t,0,D,14)?0|t:B,f=v(t/I),V)if(g&&g.getRandomValues){for(r=g.getRandomValues(new Uint32Array(f*=2));f>s;)u=131072*r[s]+(r[s+1]>>>11),u>=9e15?(i=g.getRandomValues(new Uint32Array(2)),r[s]=i[0],r[s+1]=i[1]):(c.push(u%1e14),s+=2);s=f/2}else if(g&&g.randomBytes){for(r=g.randomBytes(f*=7);f>s;)u=281474976710656*(31&r[s])+1099511627776*r[s+1]+4294967296*r[s+2]+16777216*r[s+3]+(r[s+4]<<16)+(r[s+5]<<8)+r[s+6],u>=9e15?g.randomBytes(7).copy(r,s):(c.push(u%1e14),s+=7);s=f/7}else $&&U(14,"crypto unavailable",g);if(!s)for(;f>s;)u=n(),9e15>u&&(c[s++]=u%1e14);for(f=c[--s],t%=I,f&&t&&(u=_[I-t],c[s]=w(f/u)*u);0===c[s];c.pop(),s--);if(0>s)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(s=1,u=c[0];u>=10;u/=10,s++);I>s&&(o-=I-s)}return a.e=o,a.c=c,a}}(),G=function(){function t(t,e,n){var r,i,o,f,u=0,s=t.length,c=e%T,a=e/T|0;for(t=t.slice();s--;)o=t[s]%T,f=t[s]/T|0,r=a*o+f*c,i=c*o+r%T*T+u,u=(i/n|0)+(r/T|0)+a*f,t[s]=i%n;return u&&t.unshift(u),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,f,u,s,c){var a,l,p,h,g,m,d,v,y,b,O,N,x,_,T,D,S,A=o.s==f.s?1:-1,R=o.c,U=f.c;if(!(R&&R[0]&&U&&U[0]))return new e(o.s&&f.s&&(R?!U||R[0]!=U[0]:U)?R&&0==R[0]||!U?0*A:A/0:0/0);for(v=new e(A),y=v.c=[],l=o.e-f.e,A=u+l+1,c||(c=E,l=i(o.e/I)-i(f.e/I),A=A/I|0),p=0;U[p]==(R[p]||0);p++);if(U[p]>(R[p]||0)&&l--,0>A)y.push(1),h=!0;else{for(_=R.length,D=U.length,p=0,A+=2,g=w(c/(U[0]+1)),g>1&&(U=t(U,g,c),R=t(R,g,c),D=U.length,_=R.length),x=D,b=R.slice(0,D),O=b.length;D>O;b[O++]=0);S=U.slice(),S.unshift(0),T=U[0],U[1]>=c/2&&T++;do g=0,a=n(U,b,D,O),0>a?(N=b[0],D!=O&&(N=N*c+(b[1]||0)),g=w(N/T),g>1?(g>=c&&(g=c-1),m=t(U,g,c),d=m.length,O=b.length,a=n(m,b,d,O),1==a&&(g--,r(m,d>D?S:U,d,c))):(0==g&&(a=g=1),m=U.slice()),d=m.length,O>d&&m.unshift(0),r(b,m,O,c),-1==a&&(O=b.length,a=n(U,b,D,O),1>a&&(g++,r(b,O>D?S:U,O,c))),O=b.length):0===a&&(g++,b=[0]),y[p++]=g,a&&b[0]?b[O++]=R[x]||0:(b=[R[x]],O=1);while((x++<_||null!=b[0])&&A--);h=null!=b[0],y[0]||y.shift()}if(c==E){for(p=1,A=y[0];A>=10;A/=10,p++);F(v,u+(v.e=p+l*I-1)+1,s,h)}else v.e=l,v.r=+h;return v}}(),m==function(){var t=/^(-?)0([xbo])(\w[\w.]*$)/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+([\w.])|^\s+|\s+$/g;return function(f,u,s,c){var a,l=s?u:u.replace(o,"$1");if(i.test(l))f.s=isNaN(l)?null:0>l?-1:1;else{if(!s&&(l=l.replace(t,function(t,e,n){return a="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=a?t:e}),c&&(a=c,l=l.replace(n,"$1").replace(r,"0.$1")),u!=l))return new e(l,a);$&&U(L,"not a"+(c?" base "+c:"")+" number",u),f.s=null}f.c=f.e=null,L=0}}(),M.absoluteValue=M.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},M.ceil=function(){return F(new e(this),this.e+1,2)},M.comparedTo=M.cmp=function(t,n){return L=1,f(this,new e(t,n))},M.decimalPlaces=M.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},M.dividedBy=M.div=function(t,n){return L=3,G(this,new e(t,n),B,H)},M.dividedToIntegerBy=M.divToInt=function(t,n){return L=4,G(this,new e(t,n),0,1)},M.equals=M.eq=function(t,n){return L=5,0===f(this,new e(t,n))},M.floor=function(){return F(new e(this),this.e+1,3)},M.greaterThan=M.gt=function(t,n){return L=6,f(this,new e(t,n))>0},M.greaterThanOrEqualTo=M.gte=function(t,n){return L=7,1===(n=f(this,new e(t,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(t,n){return L=8,f(this,new e(t,n))<0},M.lessThanOrEqualTo=M.lte=function(t,n){return L=9,-1===(n=f(this,new e(t,n)))||0===n},M.minus=M.sub=function(t,n){var r,o,f,u,s=this,c=s.s;if(L=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,s.plus(t);var a=s.e/I,l=t.e/I,p=s.c,h=t.c;if(!a||!l){if(!p||!h)return p?(t.s=-n,t):new e(h?s:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?s:3==H?-0:0)}if(a=i(a),l=i(l),p=p.slice(),c=a-l){for((u=0>c)?(c=-c,f=p):(l=a,f=h),f.reverse(),n=c;n--;f.push(0));f.reverse()}else for(o=(u=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){u=p[n]0)for(;n--;p[r++]=0);for(n=E-1;o>c;){if(p[--o]0?(s=u,r=a):(f=-f,r=c),r.reverse();f--;r.push(0));r.reverse()}for(f=c.length,n=a.length,0>f-n&&(r=a,a=c,c=r,n=f),f=0;n;)f=(c[--n]=c[n]+a[n]+f)/E|0,c[n]%=E;return f&&(c.unshift(f),++s),R(t,c,s)},M.precision=M.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&($&&U(13,"argument"+y,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},M.round=function(t,n){var r=new e(this);return(null==t||z(t,0,D,15))&&F(r,~~t+this.e+1,null!=n&&z(n,0,8,15,b)?0|n:H),r},M.shift=function(t){var n=this;return z(t,-x,x,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-x>t||t>x)?n.s*(0>t?0:1/0):n)},M.squareRoot=M.sqrt=function(){var t,n,r,f,u,s=this,c=s.c,a=s.s,l=s.e,p=B+4,h=new e("0.5");if(1!==a||!c||!c[0])return new e(!a||0>a&&(!c||c[0])?0/0:c?s:1/0);if(a=Math.sqrt(+s),0==a||a==1/0?(n=o(c),(n.length+l)%2==0&&(n+="0"),a=Math.sqrt(n),l=i((l+1)/2)-(0>l||l%2),a==1/0?n="1e"+l:(n=a.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new e(n)):r=new e(a+""),r.c[0])for(l=r.e,a=l+p,3>a&&(a=0);;)if(u=r,r=h.times(u.plus(G(s,u,p,1))),o(u.c).slice(0,a)===(n=o(r.c)).slice(0,a)){if(r.ea&&(d=b,b=O,O=d,f=a,a=h,h=f),f=a+h,d=[];f--;d.push(0));for(v=E,w=T,f=h;--f>=0;){for(r=0,g=O[f]%w,m=O[f]/w|0,s=a,u=f+s;u>f;)l=b[--s]%w,p=b[s]/w|0,c=m*l+p*g,l=g*l+c%w*w+d[u]+r,r=(l/v|0)+(c/w|0)+m*p,d[u--]=l%v;d[u]=r}return r?++o:d.shift(),R(t,d,o)},M.toDigits=function(t,n){var r=new e(this);return t=null!=t&&z(t,1,D,18,"precision")?0|t:null,n=null!=n&&z(n,0,8,18,b)?0|n:H,t?F(r,t,n):r},M.toExponential=function(t,e){return h(this,null!=t&&z(t,0,D,19)?~~t+1:null,e,19)},M.toFixed=function(t,e){return h(this,null!=t&&z(t,0,D,20)?~~t+this.e+1:null,e,20)},M.toFormat=function(t,e){var n=h(this,null!=t&&z(t,0,D,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+Z.groupSize,f=+Z.secondaryGroupSize,u=Z.groupSeparator,s=i[0],c=i[1],a=this.s<0,l=a?s.slice(1):s,p=l.length;if(f&&(r=o,o=f,f=r,p-=r),o>0&&p>0){for(r=p%o||o,s=l.substr(0,r);p>r;r+=o)s+=u+l.substr(r,o);f>0&&(s+=u+l.slice(r)),a&&(s="-"+s)}n=c?s+Z.decimalSeparator+((f=+Z.fractionGroupSize)?c.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+Z.fractionGroupSeparator):c):s}return n},M.toFraction=function(t){var n,r,i,f,u,s,c,a,l,p=$,h=this,g=h.c,m=new e(P),d=r=new e(P),v=c=new e(P);if(null!=t&&($=!1,s=new e(t),$=p,(!(p=s.isInt())||s.lt(P))&&($&&U(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&s.c&&F(s,s.e+1,1).gte(P)?s:null)),!g)return h.toString();for(l=o(g),f=m.e=l.length-h.e-1,m.c[0]=_[(u=f%I)<0?I+u:u],t=!t||s.cmp(m)>0?f>0?m:d:s,u=q,q=1/0,s=new e(l),c.c[0]=0;a=G(s,m,0,1),i=r.plus(a.times(v)),1!=i.cmp(t);)r=v,v=i,d=c.plus(a.times(i=d)),c=i,m=s.minus(a.times(i=m)),s=i;return i=G(t.minus(r),v,0,1),c=c.plus(i.times(d)),r=r.plus(i.times(v)),c.s=d.s=h.s,f*=2,n=G(d,v,f,H).minus(h).abs().cmp(G(c,r,f,H).minus(h).abs())<1?[d.toString(),v.toString()]:[c.toString(),r.toString()],q=u,n},M.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},M.toPower=M.pow=function(t){var n,r,i=w(0>t?-t:+t),o=this;if(!z(t,-x,x,23,"exponent")&&(!isFinite(t)||i>x&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=Y?v(Y/I+2):0,r=new e(P);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=w(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=P.div(r)),n?F(r,Y,H):r},M.toPrecision=function(t,e){return h(this,null!=t&&z(t,1,D,24,"precision")?0|t:null,e,24)},M.toString=function(t){var e,r=this,i=r.s,f=r.e;return null===f?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&z(t,2,64,25,"base")?n(l(e,f),0|t,10,i):C>=f||f>=j?a(e,f):l(e,f),0>i&&r.c[0]&&(e="-"+e)),e},M.truncated=M.trunc=function(){return F(new e(this),this.e+1,1)},M.valueOf=M.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function f(t,e){var n,r,i=t.c,o=e.c,f=t.s,u=e.s,s=t.e,c=e.e;if(!f||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:f;if(f!=u)return f;if(n=0>f,r=s==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return s>c^n?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,f=0;u>f;f++)if(i[f]!=o[f])return i[f]>o[f]^n?1:-1;return s==c?0:s>c^n?1:-1}function u(t,e,n){return(t=p(t))>=e&&n>=t}function s(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],f=0,u=t.length;u>f;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=N.indexOf(t.charAt(f++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function a(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function l(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?v(t):w(t)}var h,g,m,d=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=Math.ceil,w=Math.floor,y=" not a boolean or binary digit",b="rounding mode",O="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",E=1e14,I=14,x=9007199254740991,_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],T=1e7,D=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!g)try{g=t("crypto")}catch(S){}}else n.BigNumber=h}(this)},{crypto:1}],natspec:[function(t,e){var n=t("./node_modules/expanse.js/lib/abi.js"),r=function(){var t=function(t,e){Object.keys(t).forEach(function(n){e[n]=t[n]})},e=function(t){return Object.keys(t).reduce(function(t,e){return t+"var "+e+" = context['"+e+"'];\n"},"")},r=function(t,e){return t.filter(function(t){return t.name===e})[0]},i=function(t,e){var r=n.formatOutput(t.inputs,"0x"+e.params[0].data.slice(10));return t.inputs.reduce(function(t,e,n){return t[e.name]=r[n],t},{})},o=function(t,e){var n,r="",i=/\` + "`" + `(?:\\.|[^` + "`" + `\\])*\` + "`" + `/gim,o=0;try{for(;null!==(n=i.exec(t));){var f=i.lastIndex-n[0].length,u=n[0].slice(1,n[0].length-1);r+=t.slice(o,f);var s=e(u);r+=s,o=i.lastIndex}r+=t.slice(o)}catch(c){throw new Error("Natspec evaluation failed, wrong input params")}return r},f=function(n,f){var u={};if(f)try{var s=r(f.abi,f.method),c=i(s,f.transaction);t(c,u)}catch(a){throw new Error("Natspec evaluation failed, method does not exist")}var l=e(u),p=o(n,function(t){var e=new Function("context",l+"return "+t+";");return e(u).toString()});return p},u=function(t,e){try{return f(t,e)}catch(n){return n.message}};return{evaluateExpression:f,evaluateExpressionSafe:u}}();e.exports=r},{"./node_modules/expanse.js/lib/abi.js":3}]},{},[]); +const natspecJS = //`require=function t(e,n,r){function i(f,u){if(!n[f]){if(!e[f]){var s="function"==typeof require&&require;if(!u&&s)return s(f,!0);if(o)return o(f,!0);var c=new Error("Cannot find module '"+f+"'");throw c.code="MODULE_NOT_FOUND",c}var a=n[f]={exports:{}};e[f][0].call(a.exports,function(t){var n=e[f][1][t];return i(n?n:t)},a,a.exports,t,e,n,r)}return n[f].exports}for(var o="function"==typeof require&&require,f=0;fv;v++)d.push(g(e.slice(0,s))),e=e.slice(s);n.push(d)}else r.prefixedType("string")(t[c].type)?(a=a.slice(s),n.push(g(e.slice(0,s))),e=e.slice(s)):(n.push(g(e.slice(0,s))),e=e.slice(s))}),n},g=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(){var e=Array.prototype.slice.call(arguments);return a(t.inputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e},m=function(t){var e={};return t.forEach(function(t){var r=n.extractDisplayName(t.name),i=n.extractTypeName(t.name),o=function(e){return h(t.outputs,e)};void 0===e[r]&&(e[r]=o),e[r][i]=o}),e};e.exports={inputParser:g,outputParser:m,formatInput:a,formatOutput:h}},{"./const":4,"./formatters":5,"./types":6,"./utils":7}],4:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=["wei","Kwei","Mwei","Gwei","szabo","finney","expanse","grand","Mexpanse","Gexpanse","Texpanse","Pexpanse","Eexpanse","Zexpanse","Yexpanse","Nexpanse","Dexpanse","Vexpanse","Uexpanse"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3}}).call(this,t("_process"))},{_process:2,"bignumber.js":8}],5:[function(t,e){(function(n){if("build"!==n.env.NODE_ENV)var r=t("bignumber.js");var i=t("./utils"),o=t("./const"),f=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},u=function(t){var e=2*o.ETH_PADDING;return t instanceof r||"number"==typeof t?("number"==typeof t&&(t=new r(t)),r.config(o.ETH_BIGNUMBER_ROUNDING_MODE),t=t.round(),t.lessThan(0)&&(t=new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16).plus(t).plus(1)),t=t.toString(16)):t=0===t.indexOf("0x")?t.substr(2):"string"==typeof t?u(new r(t)):(+t).toString(16),f(t,e)},s=function(t){return i.fromAscii(t,o.ETH_PADDING).substr(2)},c=function(t){return"000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0")},a=function(t){return u(new r(t).times(new r(2).pow(128)))},l=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},p=function(t){return t=t||"0",l(t)?new r(t,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(t,16)},h=function(t){return t=t||"0",new r(t,16)},g=function(t){return p(t).dividedBy(new r(2).pow(128))},m=function(t){return h(t).dividedBy(new r(2).pow(128))},d=function(t){return"0x"+t},v=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t?!0:!1},w=function(t){return i.toAscii(t)},y=function(t){return"0x"+t.slice(t.length-40,t.length)};e.exports={formatInputInt:u,formatInputString:s,formatInputBool:c,formatInputReal:a,formatOutputInt:p,formatOutputUInt:h,formatOutputReal:g,formatOutputUReal:m,formatOutputHash:d,formatOutputBool:v,formatOutputString:w,formatOutputAddress:y}}).call(this,t("_process"))},{"./const":4,"./utils":7,_process:2,"bignumber.js":8}],6:[function(t,e){var n=t("./formatters"),r=function(t){return function(e){return 0===e.indexOf(t)}},i=function(t){return function(e){return t===e}},o=function(){return[{type:r("uint"),format:n.formatInputInt},{type:r("int"),format:n.formatInputInt},{type:r("hash"),format:n.formatInputInt},{type:r("string"),format:n.formatInputString},{type:r("real"),format:n.formatInputReal},{type:r("ureal"),format:n.formatInputReal},{type:i("address"),format:n.formatInputInt},{type:i("bool"),format:n.formatInputBool}]},f=function(){return[{type:r("uint"),format:n.formatOutputUInt},{type:r("int"),format:n.formatOutputInt},{type:r("hash"),format:n.formatOutputHash},{type:r("string"),format:n.formatOutputString},{type:r("real"),format:n.formatOutputReal},{type:r("ureal"),format:n.formatOutputUReal},{type:i("address"),format:n.formatOutputAddress},{type:i("bool"),format:n.formatOutputBool}]};e.exports={prefixedType:r,namedType:i,inputTypes:o,outputTypes:f}},{"./formatters":5}],7:[function(t,e){var n=t("./const"),r=function(t,e){for(var n=!1,r=0;rn;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},o=function(t){for(var e="",n=0;n3e3&&rr?"i":"").test(c))return m(a,c,u,r);u?(a.s=0>1/t?(c=c.slice(1),-1):1,$&&c.replace(/^0\.0*|\./,"").length>15&&U(L,O,t),u=!1):a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,a.s)}else{if(t instanceof e)return a.s=t.s,a.e=t.e,a.c=(t=t.c)?t.slice():t,void(L=0);if((u="number"==typeof t)&&0*t==0){if(a.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,f=t;f>=10;f/=10,o++);return a.e=o,a.c=[t],void(L=0)}c=t+""}else{if(!d.test(c=t+""))return m(a,c,u);a.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(f=c.search(/e/i))>0?(0>o&&(o=f),o+=+c.slice(f+1),c=c.substring(0,f)):0>o&&(o=c.length),f=0;48===c.charCodeAt(f);f++);for(s=c.length;48===c.charCodeAt(--s););if(c=c.slice(f,s+1))if(s=c.length,u&&$&&s>15&&U(L,O,a.s*t),o=o-f-1,o>q)a.c=a.e=null;else if(k>o)a.c=[a.e=0];else{if(a.e=o,a.c=[],f=(o+1)%I,0>o&&(f+=I),s>f){for(f&&a.c.push(+c.slice(0,f)),s-=I;s>f;)a.c.push(+c.slice(f,f+=I));c=c.slice(f),f=I-c.length}else f-=s;for(;f--;c+="0");a.c.push(+c)}else a.c=[a.e=0];L=0}function n(t,n,r,i){var f,u,s,a,p,h,g,m=t.indexOf("."),d=B,v=H;for(37>r&&(t=t.toLowerCase()),m>=0&&(s=Y,Y=0,t=t.replace(".",""),g=new e(r),p=g.pow(t.length-m),Y=s,g.c=c(l(o(p.c),p.e),10,n),g.e=g.c.length),h=c(t,r,n),u=s=h.length;0==h[--s];h.pop());if(!h[0])return"0";if(0>m?--u:(p.c=h,p.e=u,p.s=i,p=G(p,g,d,v,n),h=p.c,a=p.r,u=p.e),f=u+d+1,m=h[f],s=n/2,a=a||0>f||null!=h[f+1],a=4>v?(null!=m||a)&&(0==v||v==(p.s<0?3:2)):m>s||m==s&&(4==v||a||6==v&&1&h[f-1]||v==(p.s<0?8:7)),1>f||!h[0])t=a?l("1",-d):"0";else{if(h.length=f,a)for(--n;++h[--f]>n;)h[f]=0,f||(++u,h.unshift(1));for(s=h.length;!h[--s];);for(m=0,t="";s>=m;t+=N.charAt(h[m++]));t=l(t,u)}return t}function h(t,n,r,i){var f,u,s,c,p;if(r=null!=r&&z(r,0,8,i,b)?0|r:H,!t.c)return t.toString();if(f=t.c[0],s=t.e,null==n)p=o(t.c),p=19==i||24==i&&C>=s?a(p,s):l(p,s);else if(t=F(new e(t),n,r),u=t.e,p=o(t.c),c=p.length,19==i||24==i&&(u>=n||C>=u)){for(;n>c;p+="0",c++);p=a(p,u)}else if(n-=s,p=l(p,u),u+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=u-c,n>0)for(u+1==c&&(p+=".");n--;p+="0");return t.s<0&&f?"-"+p:p}function S(t,n){var r,i,o=0;for(s(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&U(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function R(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>q?t.c=t.e=null:k>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function U(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",L=0,r}function F(t,e,n,r){var i,o,f,u,s,c,a,l=t.c,p=_;if(l){t:{for(i=1,u=l[0];u>=10;u/=10,i++);if(o=e-i,0>o)o+=I,f=e,s=l[c=0],a=s/p[i-f-1]%10|0;else if(c=v((o+1)/I),c>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));s=a=0,i=1,o%=I,f=o-I+1}else{for(s=u=l[c],i=1;u>=10;u/=10,i++);o%=I,f=o-I+i,a=0>f?0:s/p[i-f-1]%10|0}if(r=r||0>e||null!=l[c+1]||(0>f?s:s%p[i-f-1]),r=4>n?(a||r)&&(0==n||n==(t.s<0?3:2)):a>5||5==a&&(4==n||r||6==n&&(o>0?f>0?s/p[i-f]:0:l[c-1])%10&1||n==(t.s<0?8:7)),1>e||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=p[e%I],t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=c,u=1,c--):(l.length=c+1,u=p[I-o],l[c]=f>0?w(s/p[i-f]%p[f])*u:0),r)for(;;){if(0==c){for(o=1,f=l[0];f>=10;f/=10,o++);for(f=l[0]+=u,u=1;f>=10;f/=10,u++);o!=u&&(t.e++,l[0]==E&&(l[0]=1));break}if(l[c]+=u,l[c]!=E)break;l[c--]=0,u=1}for(o=l.length;0===l[--o];l.pop());}t.e>q?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return f(e="DECIMAL_PLACES")&&z(t,0,D,2,e)&&(B=0|t),r[e]=B,f(e="ROUNDING_MODE")&&z(t,0,8,2,e)&&(H=0|t),r[e]=H,f(e="EXPONENTIAL_AT")&&(s(t)?z(t[0],-D,0,2,e)&&z(t[1],0,D,2,e)&&(C=0|t[0],j=0|t[1]):z(t,-D,D,2,e)&&(C=-(j=0|(0>t?-t:t)))),r[e]=[C,j],f(e="RANGE")&&(s(t)?z(t[0],-D,-1,2,e)&&z(t[1],1,D,2,e)&&(k=0|t[0],q=0|t[1]):z(t,-D,D,2,e)&&(0|t?k=-(q=0|(0>t?-t:t)):$&&U(2,e+" cannot be zero",t))),r[e]=[k,q],f(e="ERRORS")&&(t===!!t||1===t||0===t?(L=0,z=($=!!t)?A:u):$&&U(2,e+y,t)),r[e]=$,f(e="CRYPTO")&&(t===!!t||1===t||0===t?(V=!(!t||!g||"object"!=typeof g),t&&!V&&$&&U(2,"crypto unavailable",g)):$&&U(2,e+y,t)),r[e]=V,f(e="MODULO_MODE")&&z(t,0,9,2,e)&&(W=0|t),r[e]=W,f(e="POW_PRECISION")&&z(t,0,D,2,e)&&(Y=0|t),r[e]=Y,f(e="FORMAT")&&("object"==typeof t?Z=t:$&&U(2,e+" not an object",t)),r[e]=Z,r},e.max=function(){return S(arguments,M.lt)},e.min=function(){return S(arguments,M.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return w(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,f,u,s=0,c=[],a=new e(P);if(t=null!=t&&z(t,0,D,14)?0|t:B,f=v(t/I),V)if(g&&g.getRandomValues){for(r=g.getRandomValues(new Uint32Array(f*=2));f>s;)u=131072*r[s]+(r[s+1]>>>11),u>=9e15?(i=g.getRandomValues(new Uint32Array(2)),r[s]=i[0],r[s+1]=i[1]):(c.push(u%1e14),s+=2);s=f/2}else if(g&&g.randomBytes){for(r=g.randomBytes(f*=7);f>s;)u=281474976710656*(31&r[s])+1099511627776*r[s+1]+4294967296*r[s+2]+16777216*r[s+3]+(r[s+4]<<16)+(r[s+5]<<8)+r[s+6],u>=9e15?g.randomBytes(7).copy(r,s):(c.push(u%1e14),s+=7);s=f/7}else $&&U(14,"crypto unavailable",g);if(!s)for(;f>s;)u=n(),9e15>u&&(c[s++]=u%1e14);for(f=c[--s],t%=I,f&&t&&(u=_[I-t],c[s]=w(f/u)*u);0===c[s];c.pop(),s--);if(0>s)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(s=1,u=c[0];u>=10;u/=10,s++);I>s&&(o-=I-s)}return a.e=o,a.c=c,a}}(),G=function(){function t(t,e,n){var r,i,o,f,u=0,s=t.length,c=e%T,a=e/T|0;for(t=t.slice();s--;)o=t[s]%T,f=t[s]/T|0,r=a*o+f*c,i=c*o+r%T*T+u,u=(i/n|0)+(r/T|0)+a*f,t[s]=i%n;return u&&t.unshift(u),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,f,u,s,c){var a,l,p,h,g,m,d,v,y,b,O,N,x,_,T,D,S,A=o.s==f.s?1:-1,R=o.c,U=f.c;if(!(R&&R[0]&&U&&U[0]))return new e(o.s&&f.s&&(R?!U||R[0]!=U[0]:U)?R&&0==R[0]||!U?0*A:A/0:0/0);for(v=new e(A),y=v.c=[],l=o.e-f.e,A=u+l+1,c||(c=E,l=i(o.e/I)-i(f.e/I),A=A/I|0),p=0;U[p]==(R[p]||0);p++);if(U[p]>(R[p]||0)&&l--,0>A)y.push(1),h=!0;else{for(_=R.length,D=U.length,p=0,A+=2,g=w(c/(U[0]+1)),g>1&&(U=t(U,g,c),R=t(R,g,c),D=U.length,_=R.length),x=D,b=R.slice(0,D),O=b.length;D>O;b[O++]=0);S=U.slice(),S.unshift(0),T=U[0],U[1]>=c/2&&T++;do g=0,a=n(U,b,D,O),0>a?(N=b[0],D!=O&&(N=N*c+(b[1]||0)),g=w(N/T),g>1?(g>=c&&(g=c-1),m=t(U,g,c),d=m.length,O=b.length,a=n(m,b,d,O),1==a&&(g--,r(m,d>D?S:U,d,c))):(0==g&&(a=g=1),m=U.slice()),d=m.length,O>d&&m.unshift(0),r(b,m,O,c),-1==a&&(O=b.length,a=n(U,b,D,O),1>a&&(g++,r(b,O>D?S:U,O,c))),O=b.length):0===a&&(g++,b=[0]),y[p++]=g,a&&b[0]?b[O++]=R[x]||0:(b=[R[x]],O=1);while((x++<_||null!=b[0])&&A--);h=null!=b[0],y[0]||y.shift()}if(c==E){for(p=1,A=y[0];A>=10;A/=10,p++);F(v,u+(v.e=p+l*I-1)+1,s,h)}else v.e=l,v.r=+h;return v}}(),m==function(){var t=/^(-?)0([xbo])(\w[\w.]*$)/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+([\w.])|^\s+|\s+$/g;return function(f,u,s,c){var a,l=s?u:u.replace(o,"$1");if(i.test(l))f.s=isNaN(l)?null:0>l?-1:1;else{if(!s&&(l=l.replace(t,function(t,e,n){return a="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=a?t:e}),c&&(a=c,l=l.replace(n,"$1").replace(r,"0.$1")),u!=l))return new e(l,a);$&&U(L,"not a"+(c?" base "+c:"")+" number",u),f.s=null}f.c=f.e=null,L=0}}(),M.absoluteValue=M.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},M.ceil=function(){return F(new e(this),this.e+1,2)},M.comparedTo=M.cmp=function(t,n){return L=1,f(this,new e(t,n))},M.decimalPlaces=M.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},M.dividedBy=M.div=function(t,n){return L=3,G(this,new e(t,n),B,H)},M.dividedToIntegerBy=M.divToInt=function(t,n){return L=4,G(this,new e(t,n),0,1)},M.equals=M.eq=function(t,n){return L=5,0===f(this,new e(t,n))},M.floor=function(){return F(new e(this),this.e+1,3)},M.greaterThan=M.gt=function(t,n){return L=6,f(this,new e(t,n))>0},M.greaterThanOrEqualTo=M.gte=function(t,n){return L=7,1===(n=f(this,new e(t,n)))||0===n},M.isFinite=function(){return!!this.c},M.isInteger=M.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isZero=function(){return!!this.c&&0==this.c[0]},M.lessThan=M.lt=function(t,n){return L=8,f(this,new e(t,n))<0},M.lessThanOrEqualTo=M.lte=function(t,n){return L=9,-1===(n=f(this,new e(t,n)))||0===n},M.minus=M.sub=function(t,n){var r,o,f,u,s=this,c=s.s;if(L=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,s.plus(t);var a=s.e/I,l=t.e/I,p=s.c,h=t.c;if(!a||!l){if(!p||!h)return p?(t.s=-n,t):new e(h?s:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?s:3==H?-0:0)}if(a=i(a),l=i(l),p=p.slice(),c=a-l){for((u=0>c)?(c=-c,f=p):(l=a,f=h),f.reverse(),n=c;n--;f.push(0));f.reverse()}else for(o=(u=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){u=p[n]0)for(;n--;p[r++]=0);for(n=E-1;o>c;){if(p[--o]0?(s=u,r=a):(f=-f,r=c),r.reverse();f--;r.push(0));r.reverse()}for(f=c.length,n=a.length,0>f-n&&(r=a,a=c,c=r,n=f),f=0;n;)f=(c[--n]=c[n]+a[n]+f)/E|0,c[n]%=E;return f&&(c.unshift(f),++s),R(t,c,s)},M.precision=M.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&($&&U(13,"argument"+y,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},M.round=function(t,n){var r=new e(this);return(null==t||z(t,0,D,15))&&F(r,~~t+this.e+1,null!=n&&z(n,0,8,15,b)?0|n:H),r},M.shift=function(t){var n=this;return z(t,-x,x,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-x>t||t>x)?n.s*(0>t?0:1/0):n)},M.squareRoot=M.sqrt=function(){var t,n,r,f,u,s=this,c=s.c,a=s.s,l=s.e,p=B+4,h=new e("0.5");if(1!==a||!c||!c[0])return new e(!a||0>a&&(!c||c[0])?0/0:c?s:1/0);if(a=Math.sqrt(+s),0==a||a==1/0?(n=o(c),(n.length+l)%2==0&&(n+="0"),a=Math.sqrt(n),l=i((l+1)/2)-(0>l||l%2),a==1/0?n="1e"+l:(n=a.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new e(n)):r=new e(a+""),r.c[0])for(l=r.e,a=l+p,3>a&&(a=0);;)if(u=r,r=h.times(u.plus(G(s,u,p,1))),o(u.c).slice(0,a)===(n=o(r.c)).slice(0,a)){if(r.ea&&(d=b,b=O,O=d,f=a,a=h,h=f),f=a+h,d=[];f--;d.push(0));for(v=E,w=T,f=h;--f>=0;){for(r=0,g=O[f]%w,m=O[f]/w|0,s=a,u=f+s;u>f;)l=b[--s]%w,p=b[s]/w|0,c=m*l+p*g,l=g*l+c%w*w+d[u]+r,r=(l/v|0)+(c/w|0)+m*p,d[u--]=l%v;d[u]=r}return r?++o:d.shift(),R(t,d,o)},M.toDigits=function(t,n){var r=new e(this);return t=null!=t&&z(t,1,D,18,"precision")?0|t:null,n=null!=n&&z(n,0,8,18,b)?0|n:H,t?F(r,t,n):r},M.toExponential=function(t,e){return h(this,null!=t&&z(t,0,D,19)?~~t+1:null,e,19)},M.toFixed=function(t,e){return h(this,null!=t&&z(t,0,D,20)?~~t+this.e+1:null,e,20)},M.toFormat=function(t,e){var n=h(this,null!=t&&z(t,0,D,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+Z.groupSize,f=+Z.secondaryGroupSize,u=Z.groupSeparator,s=i[0],c=i[1],a=this.s<0,l=a?s.slice(1):s,p=l.length;if(f&&(r=o,o=f,f=r,p-=r),o>0&&p>0){for(r=p%o||o,s=l.substr(0,r);p>r;r+=o)s+=u+l.substr(r,o);f>0&&(s+=u+l.slice(r)),a&&(s="-"+s)}n=c?s+Z.decimalSeparator+((f=+Z.fractionGroupSize)?c.replace(new RegExp("\\d{"+f+"}\\B","g"),"$&"+Z.fractionGroupSeparator):c):s}return n},M.toFraction=function(t){var n,r,i,f,u,s,c,a,l,p=$,h=this,g=h.c,m=new e(P),d=r=new e(P),v=c=new e(P);if(null!=t&&($=!1,s=new e(t),$=p,(!(p=s.isInt())||s.lt(P))&&($&&U(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&s.c&&F(s,s.e+1,1).gte(P)?s:null)),!g)return h.toString();for(l=o(g),f=m.e=l.length-h.e-1,m.c[0]=_[(u=f%I)<0?I+u:u],t=!t||s.cmp(m)>0?f>0?m:d:s,u=q,q=1/0,s=new e(l),c.c[0]=0;a=G(s,m,0,1),i=r.plus(a.times(v)),1!=i.cmp(t);)r=v,v=i,d=c.plus(a.times(i=d)),c=i,m=s.minus(a.times(i=m)),s=i;return i=G(t.minus(r),v,0,1),c=c.plus(i.times(d)),r=r.plus(i.times(v)),c.s=d.s=h.s,f*=2,n=G(d,v,f,H).minus(h).abs().cmp(G(c,r,f,H).minus(h).abs())<1?[d.toString(),v.toString()]:[c.toString(),r.toString()],q=u,n},M.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},M.toPower=M.pow=function(t){var n,r,i=w(0>t?-t:+t),o=this;if(!z(t,-x,x,23,"exponent")&&(!isFinite(t)||i>x&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=Y?v(Y/I+2):0,r=new e(P);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=w(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=P.div(r)),n?F(r,Y,H):r},M.toPrecision=function(t,e){return h(this,null!=t&&z(t,1,D,24,"precision")?0|t:null,e,24)},M.toString=function(t){var e,r=this,i=r.s,f=r.e;return null===f?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&z(t,2,64,25,"base")?n(l(e,f),0|t,10,i):C>=f||f>=j?a(e,f):l(e,f),0>i&&r.c[0]&&(e="-"+e)),e},M.truncated=M.trunc=function(){return F(new e(this),this.e+1,1)},M.valueOf=M.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function f(t,e){var n,r,i=t.c,o=e.c,f=t.s,u=e.s,s=t.e,c=e.e;if(!f||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:f;if(f!=u)return f;if(n=0>f,r=s==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return s>c^n?1:-1;for(u=(s=i.length)<(c=o.length)?s:c,f=0;u>f;f++)if(i[f]!=o[f])return i[f]>o[f]^n?1:-1;return s==c?0:s>c^n?1:-1}function u(t,e,n){return(t=p(t))>=e&&n>=t}function s(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],f=0,u=t.length;u>f;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=N.indexOf(t.charAt(f++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function a(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function l(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?v(t):w(t)}var h,g,m,d=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,v=Math.ceil,w=Math.floor,y=" not a boolean or binary digit",b="rounding mode",O="number type has more than 15 significant digits",N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",E=1e14,I=14,x=9007199254740991,_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],T=1e7,D=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!g)try{g=t("crypto")}catch(S){}}else n.BigNumber=h}(this)},{crypto:1}],natspec:[function(t,e){var n=t("./node_modules/expanse.js/lib/abi.js"),r=function(){var t=function(t,e){Object.keys(t).forEach(function(n){e[n]=t[n]})},e=function(t){return Object.keys(t).reduce(function(t,e){return t+"var "+e+" = context['"+e+"'];\n"},"")},r=function(t,e){return t.filter(function(t){return t.name===e})[0]},i=function(t,e){var r=n.formatOutput(t.inputs,"0x"+e.params[0].data.slice(10));return t.inputs.reduce(function(t,e,n){return t[e.name]=r[n],t},{})},o=function(t,e){var n,r="",i=/\` + "`" + `(?:\\.|[^` + "`" + `\\])*\` + "`" + `/gim,o=0;try{for(;null!==(n=i.exec(t));){var f=i.lastIndex-n[0].length,u=n[0].slice(1,n[0].length-1);r+=t.slice(o,f);var s=e(u);r+=s,o=i.lastIndex}r+=t.slice(o)}catch(c){throw new Error("Natspec evaluation failed, wrong input params")}return r},f=function(n,f){var u={};if(f)try{var s=r(f.abi,f.method),c=i(s,f.transaction);t(c,u)}catch(a){throw new Error("Natspec evaluation failed, method does not exist")}var l=e(u),p=o(n,function(t){var e=new Function("context",l+"return "+t+";");return e(u).toString()});return p},u=function(t,e){try{return f(t,e)}catch(n){return n.message}};return{evaluateExpression:f,evaluateExpressionSafe:u}}();e.exports=r},{"./node_modules/expanse.js/lib/abi.js":3}]},{},[]); ` require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o Date: Tue, 1 Sep 2015 18:59:44 -0400 Subject: [PATCH 75/90] update backend --- exp/backend.go | 1 - 1 file changed, 1 deletion(-) diff --git a/exp/backend.go b/exp/backend.go index fe607f64ec..a2b50efebf 100644 --- a/exp/backend.go +++ b/exp/backend.go @@ -370,7 +370,6 @@ func New(config *Config) (*Expanse, error) { } exp.txPool = core.NewTxPool(exp.EventMux(), exp.chainManager.State, exp.chainManager.GasLimit) -<<<<<<< HEAD:exp/backend.go exp.blockProcessor = core.NewBlockProcessor(chainDb, exp.pow, exp.chainManager, exp.EventMux()) exp.chainManager.SetProcessor(exp.blockProcessor) exp.protocolManager = NewProtocolManager(config.NetworkId, exp.eventMux, eth.txPool, exp.pow, exp.chainManager) From 64ced6629afdc24c7833d807aad6c11046f4b71f Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 19:41:15 -0400 Subject: [PATCH 76/90] github update --- CONTRIBUTING.md | 2 +- cmd/ethtest/main.go | 6 +++--- cmd/evm/main.go | 16 +++++++-------- core/filter.go | 10 +++++----- core/vm/instructions.go | 8 ++++---- core/vm/jit.go | 8 ++++---- core/vm/jit_test.go | 8 ++++---- core/vm/vm.go | 12 +++++------ exp/backend.go | 34 ++++++++++++++++---------------- miner/miner.go | 20 +++++++++---------- p2p/dial.go | 6 +++--- p2p/discover/udp.go | 10 +++++----- p2p/server.go | 8 ++++---- rpc/api/admin.go | 32 +++++++++++++++--------------- rpc/api/miner.go | 8 ++++---- rpc/comms/http.go | 8 ++++---- rpc/comms/ipc_unix.go | 10 +++++----- rpc/comms/ipc_windows.go | 10 +++++----- rpc/jeth.go | 16 +++++++-------- rpc/useragent/remote_frontend.go | 10 +++++----- tests/state_test.go | 2 +- 21 files changed, 122 insertions(+), 122 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 918a2c1546..be139a29c9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,6 +4,6 @@ are ignored (use gofmt!). If you send pull requests make absolute sure that you commit on the `develop` branch and that you do not merge to master. Commits that are directly based on master are simply ignored. -See [Developers' Guide](https://github.com/ethereum/go-ethereum/wiki/Developers'-Guide) +See [Developers' Guide](https://github.com/expanse-project/go-expanse/wiki/Developers'-Guide) for more details on configuring your environment, testing, and dependency management. diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go index 516da01297..8f6e92e9b8 100644 --- a/cmd/ethtest/main.go +++ b/cmd/ethtest/main.go @@ -26,9 +26,9 @@ import ( "strings" "github.com/codegangsta/cli" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/tests" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/tests" ) var ( diff --git a/cmd/evm/main.go b/cmd/evm/main.go index 6c23e785bd..b9353bacd8 100644 --- a/cmd/evm/main.go +++ b/cmd/evm/main.go @@ -25,14 +25,14 @@ import ( "time" "github.com/codegangsta/cli" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/cmd/utils" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/logger/glog" ) var ( diff --git a/core/filter.go b/core/filter.go index 2a16131a87..26889973ab 100644 --- a/core/filter.go +++ b/core/filter.go @@ -19,11 +19,11 @@ package core import ( "math" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" ) type AccountChange struct { diff --git a/core/vm/instructions.go b/core/vm/instructions.go index aa0117cc85..c74febc183 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -19,10 +19,10 @@ package vm import ( "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/params" ) type instrFn func(instr instruction, env Environment, context *Context, memory *Memory, stack *stack) diff --git a/core/vm/jit.go b/core/vm/jit.go index 084d2a3f33..df05554791 100644 --- a/core/vm/jit.go +++ b/core/vm/jit.go @@ -21,10 +21,10 @@ import ( "math/big" "sync/atomic" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/params" "github.com/hashicorp/golang-lru" ) diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go index d8e4426379..5ef501040a 100644 --- a/core/vm/jit_test.go +++ b/core/vm/jit_test.go @@ -20,10 +20,10 @@ import ( "testing" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/ethdb" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/ethdb" ) const maxRun = 1000 diff --git a/core/vm/vm.go b/core/vm/vm.go index 73160617ba..66ff122075 100644 --- a/core/vm/vm.go +++ b/core/vm/vm.go @@ -21,12 +21,12 @@ import ( "fmt" "math/big" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/params" ) // Vm implements VirtualMachine diff --git a/exp/backend.go b/exp/backend.go index a2b50efebf..ec1fab6d5e 100644 --- a/exp/backend.go +++ b/exp/backend.go @@ -29,23 +29,23 @@ import ( "time" "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/compiler" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/core/vm" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/whisper" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/common/compiler" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/core/vm" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/eth/downloader" + "github.com/expanse-project/go-expanse/ethdb" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/miner" + "github.com/expanse-project/go-expanse/p2p" + "github.com/expanse-project/go-expanse/p2p/discover" + "github.com/expanse-project/go-expanse/p2p/nat" + "github.com/expanse-project/go-expanse/whisper" ) const ( diff --git a/miner/miner.go b/miner/miner.go index 1ff3c029da..41203dbba8 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -22,16 +22,16 @@ import ( "math/big" "sync/atomic" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/event" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/pow" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/state" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/eth/downloader" + "github.com/expanse-project/go-expanse/event" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/params" + "github.com/expanse-project/go-expanse/pow" ) type Miner struct { diff --git a/p2p/dial.go b/p2p/dial.go index 2ef5c4edaf..ab711d0ca9 100644 --- a/p2p/dial.go +++ b/p2p/dial.go @@ -23,9 +23,9 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p/discover" ) const ( diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index cba1ccc60c..2bf2faaa33 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -25,11 +25,11 @@ import ( "net" "time" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/rlp" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p/nat" + "github.com/expanse-project/go-expanse/rlp" ) const Version = 4 diff --git a/p2p/server.go b/p2p/server.go index 444faa3e8e..690e58daa7 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -25,10 +25,10 @@ import ( "sync" "time" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/p2p/discover" - "github.com/ethereum/go-ethereum/p2p/nat" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/p2p/discover" + "github.com/expanse-project/go-expanse/p2p/nat" ) const ( diff --git a/rpc/api/admin.go b/rpc/api/admin.go index ca727e2f92..ee007a8ee8 100644 --- a/rpc/api/admin.go +++ b/rpc/api/admin.go @@ -23,22 +23,22 @@ import ( "os" "time" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/compiler" - "github.com/ethereum/go-ethereum/common/docserver" - "github.com/ethereum/go-ethereum/common/natspec" - "github.com/ethereum/go-ethereum/common/registrar" - "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rlp" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/comms" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/rpc/useragent" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/common/compiler" + "github.com/expanse-project/go-expanse/common/docserver" + "github.com/expanse-project/go-expanse/common/natspec" + "github.com/expanse-project/go-expanse/common/registrar" + "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/types" + "github.com/expanse-project/go-expanse/crypto" + "github.com/expanse-project/go-expanse/eth" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rlp" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/comms" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/useragent" + "github.com/expanse-project/go-expanse/xeth" ) const ( diff --git a/rpc/api/miner.go b/rpc/api/miner.go index b9df315647..d1dbd53c9a 100644 --- a/rpc/api/miner.go +++ b/rpc/api/miner.go @@ -18,10 +18,10 @@ package api import ( "github.com/ethereum/ethash" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/eth" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/eth" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" ) const ( diff --git a/rpc/comms/http.go b/rpc/comms/http.go index dfa0fd5851..26fcde11c4 100644 --- a/rpc/comms/http.go +++ b/rpc/comms/http.go @@ -29,10 +29,10 @@ import ( "io" "io/ioutil" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" "github.com/rs/cors" ) diff --git a/rpc/comms/ipc_unix.go b/rpc/comms/ipc_unix.go index bbe20765d7..9badc7e02f 100644 --- a/rpc/comms/ipc_unix.go +++ b/rpc/comms/ipc_unix.go @@ -22,11 +22,11 @@ import ( "net" "os" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/rpc/useragent" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/useragent" ) func newIpcClient(cfg IpcConfig, codec codec.Codec) (*ipcClient, error) { diff --git a/rpc/comms/ipc_windows.go b/rpc/comms/ipc_windows.go index 8a539573d6..48b20664f9 100644 --- a/rpc/comms/ipc_windows.go +++ b/rpc/comms/ipc_windows.go @@ -28,11 +28,11 @@ import ( "time" "unsafe" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rpc/codec" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/rpc/useragent" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rpc/codec" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/useragent" ) var ( diff --git a/rpc/jeth.go b/rpc/jeth.go index 68a9f63912..f9429e7294 100644 --- a/rpc/jeth.go +++ b/rpc/jeth.go @@ -20,14 +20,14 @@ import ( "encoding/json" "fmt" - "github.com/ethereum/go-ethereum/cmd/utils" - "github.com/ethereum/go-ethereum/jsre" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rpc/comms" - "github.com/ethereum/go-ethereum/rpc/shared" - "github.com/ethereum/go-ethereum/rpc/useragent" - "github.com/ethereum/go-ethereum/xeth" + "github.com/expanse-project/go-expanse/cmd/utils" + "github.com/expanse-project/go-expanse/jsre" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rpc/comms" + "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/useragent" + "github.com/expanse-project/go-expanse/xeth" "github.com/robertkrimen/otto" ) diff --git a/rpc/useragent/remote_frontend.go b/rpc/useragent/remote_frontend.go index 0dd4a60497..56a1008ae1 100644 --- a/rpc/useragent/remote_frontend.go +++ b/rpc/useragent/remote_frontend.go @@ -21,11 +21,11 @@ import ( "fmt" "net" - "github.com/ethereum/go-ethereum/accounts" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/rpc/shared" + "github.com/expanse-project/go-expanse/accounts" + "github.com/expanse-project/go-expanse/common" + "github.com/expanse-project/go-expanse/logger" + "github.com/expanse-project/go-expanse/logger/glog" + "github.com/expanse-project/go-expanse/rpc/shared" ) // remoteFrontend implements xeth.Frontend and will communicate with an external diff --git a/tests/state_test.go b/tests/state_test.go index da58238544..b450f5e742 100644 --- a/tests/state_test.go +++ b/tests/state_test.go @@ -21,7 +21,7 @@ import ( "path/filepath" "testing" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/expanse-project/go-expanse/core/vm" ) func init() { From 1f6c8ebb0ef443bbeeb1163c25f4c6ee32251095 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 19:42:33 -0400 Subject: [PATCH 77/90] github update 2 --- exp/backend.go | 2 +- rpc/api/miner.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exp/backend.go b/exp/backend.go index ec1fab6d5e..2e6d02c93a 100644 --- a/exp/backend.go +++ b/exp/backend.go @@ -28,7 +28,7 @@ import ( "strings" "time" - "github.com/ethereum/ethash" + "github.com/expanse-project/ethash" "github.com/expanse-project/go-expanse/accounts" "github.com/expanse-project/go-expanse/common" "github.com/expanse-project/go-expanse/common/compiler" diff --git a/rpc/api/miner.go b/rpc/api/miner.go index d1dbd53c9a..0f0a5fff89 100644 --- a/rpc/api/miner.go +++ b/rpc/api/miner.go @@ -17,7 +17,7 @@ package api import ( - "github.com/ethereum/ethash" + "github.com/expanse-project/ethash" "github.com/expanse-project/go-expanse/common" "github.com/expanse-project/go-expanse/eth" "github.com/expanse-project/go-expanse/rpc/codec" From 7daa31973726ecf309fe64f59cf816dee367a9ae Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 19:57:32 -0400 Subject: [PATCH 78/90] last github update --- exp/backend.go | 2 +- miner/miner.go | 2 +- rpc/api/admin.go | 2 +- rpc/api/miner.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exp/backend.go b/exp/backend.go index 2e6d02c93a..c55cdd868f 100644 --- a/exp/backend.go +++ b/exp/backend.go @@ -36,7 +36,7 @@ import ( "github.com/expanse-project/go-expanse/core/types" "github.com/expanse-project/go-expanse/core/vm" "github.com/expanse-project/go-expanse/crypto" - "github.com/expanse-project/go-expanse/eth/downloader" + "github.com/expanse-project/go-expanse/exp/downloader" "github.com/expanse-project/go-expanse/ethdb" "github.com/expanse-project/go-expanse/event" "github.com/expanse-project/go-expanse/logger" diff --git a/miner/miner.go b/miner/miner.go index 41203dbba8..56dff1d9b3 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -26,7 +26,7 @@ import ( "github.com/expanse-project/go-expanse/core" "github.com/expanse-project/go-expanse/core/state" "github.com/expanse-project/go-expanse/core/types" - "github.com/expanse-project/go-expanse/eth/downloader" + "github.com/expanse-project/go-expanse/exp/downloader" "github.com/expanse-project/go-expanse/event" "github.com/expanse-project/go-expanse/logger" "github.com/expanse-project/go-expanse/logger/glog" diff --git a/rpc/api/admin.go b/rpc/api/admin.go index ee007a8ee8..15ff1f96a0 100644 --- a/rpc/api/admin.go +++ b/rpc/api/admin.go @@ -31,7 +31,7 @@ import ( "github.com/expanse-project/go-expanse/core" "github.com/expanse-project/go-expanse/core/types" "github.com/expanse-project/go-expanse/crypto" - "github.com/expanse-project/go-expanse/eth" + "github.com/expanse-project/go-expanse/exp" "github.com/expanse-project/go-expanse/logger/glog" "github.com/expanse-project/go-expanse/rlp" "github.com/expanse-project/go-expanse/rpc/codec" diff --git a/rpc/api/miner.go b/rpc/api/miner.go index 0f0a5fff89..05befeb520 100644 --- a/rpc/api/miner.go +++ b/rpc/api/miner.go @@ -19,7 +19,7 @@ package api import ( "github.com/expanse-project/ethash" "github.com/expanse-project/go-expanse/common" - "github.com/expanse-project/go-expanse/eth" + "github.com/expanse-project/go-expanse/exp" "github.com/expanse-project/go-expanse/rpc/codec" "github.com/expanse-project/go-expanse/rpc/shared" ) From 9f661cc3dd4e76e4249e5b35a945670f140d07b5 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 20:04:17 -0400 Subject: [PATCH 79/90] good by colorable --- cmd/gexp/main.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/gexp/main.go b/cmd/gexp/main.go index 8143a124da..af6d398307 100644 --- a/cmd/gexp/main.go +++ b/cmd/gexp/main.go @@ -43,8 +43,6 @@ import ( "github.com/expanse-project/go-expanse/metrics" "github.com/expanse-project/go-expanse/rpc/codec" "github.com/expanse-project/go-expanse/rpc/comms" - "github.com/mattn/go-colorable" - "github.com/mattn/go-isatty" ) const ( From ae27c2eb7d3953d8a136f95d8e9364f5b1351370 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 20:07:37 -0400 Subject: [PATCH 80/90] update worker.go --- miner/worker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index 9220ae59e3..1068402e10 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -126,7 +126,7 @@ func newWorker(coinbase common.Address, exp core.Backend) *worker { worker := &worker{ exp: exp, mux: exp.EventMux(), - extraDb: exp.ExtraDb(), + chainDb: exp.ChainDb(), recv: make(chan *Result, resultQueueSize), gasPrice: new(big.Int), chain: exp.ChainManager(), @@ -278,7 +278,7 @@ func (self *worker) wait() { glog.V(logger.Error).Infoln("Invalid block found during mining") continue } - if err := core.ValidateHeader(self.eth.BlockProcessor().Pow, block.Header(), parent, true, false); err != nil && err != core.BlockFutureErr { + if err := core.ValidateHeader(self.exp.BlockProcessor().Pow, block.Header(), parent, true, false); err != nil && err != core.BlockFutureErr { glog.V(logger.Error).Infoln("Invalid header on mined block:", err) continue } From 4dab840f71c802e46330cd0123dda699a6f5d496 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 20:42:36 -0400 Subject: [PATCH 81/90] expanse --- CONTRIBUTING.md | 2 +- cmd/gexp/js.go | 6 +++--- cmd/gexp/main.go | 2 +- cmd/utils/flags.go | 2 +- core/vm/instructions.go | 10 +++++----- core/vm/jit.go | 10 +++++----- core/vm/jit_test.go | 10 +++++----- exp/backend.go | 2 +- exp/gasprice.go | 4 ++-- jsre/ethereum_js.go | 18 +++++++++--------- jsre/pretty.go | 10 +++++----- rpc/api/miner.go | 2 +- rpc/api/personal.go | 2 +- rpc/useragent/remote_frontend.go | 10 +++++----- 14 files changed, 45 insertions(+), 45 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index be139a29c9..5f0f129eb8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -If you'd like to contribute to go-ethereum please fork, fix, commit and +If you'd like to contribute to go-expanse please fork, fix, commit and send a pull request. Commits who do not comply with the coding standards are ignored (use gofmt!). If you send pull requests make absolute sure that you commit on the `develop` branch and that you do not merge to master. diff --git a/cmd/gexp/js.go b/cmd/gexp/js.go index 65a1c28b39..4707d732bf 100644 --- a/cmd/gexp/js.go +++ b/cmd/gexp/js.go @@ -247,9 +247,9 @@ func (self *jsre) welcome() { (function () { console.log('instance: ' + web3.version.client); console.log(' datadir: ' + admin.datadir); - console.log("coinbase: " + eth.coinbase); - var ts = 1000 * eth.getBlock(eth.blockNumber).timestamp; - console.log("at block: " + eth.blockNumber + " (" + new Date(ts) + ")"); + console.log("coinbase: " + exp.coinbase); + var ts = 1000 * exp.getBlock(exp.blockNumber).timestamp; + console.log("at block: " + exp.blockNumber + " (" + new Date(ts) + ")"); })(); `) if modules, err := self.supportedApis(); err == nil { diff --git a/cmd/gexp/main.go b/cmd/gexp/main.go index af6d398307..339489d43c 100644 --- a/cmd/gexp/main.go +++ b/cmd/gexp/main.go @@ -381,7 +381,7 @@ func run(ctx *cli.Context) { cfg := utils.MakeEthConfig(ClientIdentifier, nodeNameVersion, ctx) cfg.ExtraData = makeDefaultExtra() - ethereum, err := eth.New(cfg) + expanse, err := exp.New(cfg) if err != nil { utils.Fatalf("%v", err) } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 4e583d56c5..207c83a080 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -519,7 +519,7 @@ func StartIPC(exp *exp.Expanse, ctx *cli.Context) error { } initializer := func(conn net.Conn) (shared.ExpanseApi, error) { - fe := useragent.NewRemoteFrontend(conn, eth.AccountManager()) + fe := useragent.NewRemoteFrontend(conn, exp.AccountManager()) xeth := xeth.New(exp, fe) codec := codec.JSON diff --git a/core/vm/instructions.go b/core/vm/instructions.go index c74febc183..dd570ead3f 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm diff --git a/core/vm/jit.go b/core/vm/jit.go index df05554791..4d55d1fed5 100644 --- a/core/vm/jit.go +++ b/core/vm/jit.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go index 5ef501040a..9afc85a55d 100644 --- a/core/vm/jit_test.go +++ b/core/vm/jit_test.go @@ -1,18 +1,18 @@ -// Copyright 2014 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2014 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package vm import ( diff --git a/exp/backend.go b/exp/backend.go index c55cdd868f..400e633e79 100644 --- a/exp/backend.go +++ b/exp/backend.go @@ -372,7 +372,7 @@ func New(config *Config) (*Expanse, error) { exp.blockProcessor = core.NewBlockProcessor(chainDb, exp.pow, exp.chainManager, exp.EventMux()) exp.chainManager.SetProcessor(exp.blockProcessor) - exp.protocolManager = NewProtocolManager(config.NetworkId, exp.eventMux, eth.txPool, exp.pow, exp.chainManager) + exp.protocolManager = NewProtocolManager(config.NetworkId, exp.eventMux, exp.txPool, exp.pow, exp.chainManager) exp.miner = miner.New(eth, exp.EventMux(), exp.pow) exp.miner.SetGasPrice(config.GasPrice) diff --git a/exp/gasprice.go b/exp/gasprice.go index d3a2185410..994e72397c 100644 --- a/exp/gasprice.go +++ b/exp/gasprice.go @@ -54,8 +54,8 @@ func NewGasPriceOracle(exp *Expanse) (self *GasPriceOracle) { core.ChainSplitEvent{}, ) - minbase := new(big.Int).Mul(self.eth.GpoMinGasPrice, big.NewInt(100)) - minbase = minbase.Div(minbase, big.NewInt(int64(self.eth.GpobaseCorrectionFactor))) + minbase := new(big.Int).Mul(self.exp.GpoMinGasPrice, big.NewInt(100)) + minbase = minbase.Div(minbase, big.NewInt(int64(self.exp.GpobaseCorrectionFactor))) self.minBase = minbase self.processPastBlocks() diff --git a/jsre/ethereum_js.go b/jsre/ethereum_js.go index ab77132d60..ddda640a58 100644 --- a/jsre/ethereum_js.go +++ b/jsre/ethereum_js.go @@ -1764,20 +1764,20 @@ if (typeof XMLHttpRequest === 'undefined') { },{}],18:[function(require,module,exports){ /* - This file is part of ethereum.js. + This file is part of expanse.js. - ethereum.js is free software: you can redistribute it and/or modify + expanse.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - ethereum.js is distributed in the hope that it will be useful, + expanse.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License - along with ethereum.js. If not, see . + along with expanse.js. If not, see . */ /** @file config.js * @authors: @@ -4231,7 +4231,7 @@ var Iban = function (iban) { }; /** - * This method should be used to create iban object from ethereum address + * This method should be used to create iban object from expanse address * * @method fromAddress * @param {String} address @@ -4935,7 +4935,7 @@ module.exports = { along with expanse.js. If not, see . */ /** - * @file eth.js + * @file exp.js * @author Marek Kotewicz * @author Fabian Vogelsteller * @date 2015 @@ -5227,7 +5227,7 @@ module.exports = { You should have received a copy of the GNU Lesser General Public License along with expanse.js. If not, see . */ -/** @file eth.js +/** @file exp.js * @authors: * Marek Kotewicz * @date 2015 @@ -5355,7 +5355,7 @@ module.exports = { var Method = require('../method'); -/// @returns an array of objects describing web3.eth.filter api methods +/// @returns an array of objects describing web3.exp.filter api methods var eth = function () { var newFilterCall = function (args) { var type = args[0]; @@ -5965,7 +5965,7 @@ var transfer = function (from, to, value, callback) { * @param {Function} callback, callback */ var transferToAddress = function (from, to, value, callback) { - return web3.eth.sendTransaction({ + return web3.exp.sendTransaction({ address: to, from: from, value: value diff --git a/jsre/pretty.go b/jsre/pretty.go index 99aa9b33e5..07f414f5d7 100644 --- a/jsre/pretty.go +++ b/jsre/pretty.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package jsre diff --git a/rpc/api/miner.go b/rpc/api/miner.go index 05befeb520..d35558de07 100644 --- a/rpc/api/miner.go +++ b/rpc/api/miner.go @@ -123,7 +123,7 @@ func (self *minerApi) SetExtra(req *shared.Request) (interface{}, error) { return nil, err } - if err := self.ethereum.Miner().SetExtra([]byte(args.Data)); err != nil { + if err := self.expanse.Miner().SetExtra([]byte(args.Data)); err != nil { return false, err } diff --git a/rpc/api/personal.go b/rpc/api/personal.go index bad4464a30..40ba0ab830 100644 --- a/rpc/api/personal.go +++ b/rpc/api/personal.go @@ -134,7 +134,7 @@ func (self *personalApi) UnlockAccount(req *shared.Request) (interface{}, error) return fe.UnlockAccount(common.HexToAddress(args.Address).Bytes()), nil } - am := self.ethereum.AccountManager() + am := self.expanse.AccountManager() addr := common.HexToAddress(args.Address) err := am.TimedUnlock(addr, args.Passphrase, time.Duration(args.Duration)*time.Second) diff --git a/rpc/useragent/remote_frontend.go b/rpc/useragent/remote_frontend.go index 56a1008ae1..63f50d2f75 100644 --- a/rpc/useragent/remote_frontend.go +++ b/rpc/useragent/remote_frontend.go @@ -1,18 +1,18 @@ -// Copyright 2015 The go-ethereum Authors -// This file is part of the go-ethereum library. +// Copyright 2015 The go-expanse Authors +// This file is part of the go-expanse library. // -// The go-ethereum library is free software: you can redistribute it and/or modify +// The go-expanse library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // -// The go-ethereum library is distributed in the hope that it will be useful, +// The go-expanse library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . +// along with the go-expanse library. If not, see . package useragent From 72538db99c843ff09cd8323b0232071967f3bdef Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 20:45:40 -0400 Subject: [PATCH 82/90] hopefully last find replace --- exp/backend.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exp/backend.go b/exp/backend.go index 400e633e79..b6fef908f1 100644 --- a/exp/backend.go +++ b/exp/backend.go @@ -374,7 +374,7 @@ func New(config *Config) (*Expanse, error) { exp.chainManager.SetProcessor(exp.blockProcessor) exp.protocolManager = NewProtocolManager(config.NetworkId, exp.eventMux, exp.txPool, exp.pow, exp.chainManager) - exp.miner = miner.New(eth, exp.EventMux(), exp.pow) + exp.miner = miner.New(exp, exp.EventMux(), exp.pow) exp.miner.SetGasPrice(config.GasPrice) exp.miner.SetExtra(config.ExtraData) @@ -685,7 +685,7 @@ func (self *Expanse) StopAutoDAG() { glog.V(logger.Info).Infof("Automatic pregeneration of ethash DAG OFF (ethash dir: %s)", ethash.DefaultDir) } -func (self *Ethereum) Solc() (*compiler.Solidity, error) { +func (self *Expanse) Solc() (*compiler.Solidity, error) { var err error if self.solc == nil { self.solc, err = compiler.New(self.SolcPath) @@ -694,7 +694,7 @@ func (self *Ethereum) Solc() (*compiler.Solidity, error) { } // set in js console via admin interface or wrapper from cli flags -func (self *Ethereum) SetSolc(solcPath string) (*compiler.Solidity, error) { +func (self *Expanse) SetSolc(solcPath string) (*compiler.Solidity, error) { self.SolcPath = solcPath self.solc = nil return self.Solc() From 0f1fe4847ba67fb4d61a39cabb716fbab71f4f30 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 20:50:20 -0400 Subject: [PATCH 83/90] missing deps --- cmd/utils/flags.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 207c83a080..c0d2dda7fd 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -35,6 +35,7 @@ import ( "github.com/expanse-project/go-expanse/accounts" "github.com/expanse-project/go-expanse/common" "github.com/expanse-project/go-expanse/core" + "github.com/expanse-project/go-expanse/core/vm" "github.com/expanse-project/go-expanse/crypto" "github.com/expanse-project/go-expanse/exp" "github.com/expanse-project/go-expanse/ethdb" @@ -45,6 +46,7 @@ import ( "github.com/expanse-project/go-expanse/rpc/api" "github.com/expanse-project/go-expanse/rpc/codec" "github.com/expanse-project/go-expanse/rpc/comms" + "github.com/expanse-project/go-expanse/rpc/shared" "github.com/expanse-project/go-expanse/xeth" ) From 197961ba66a48b380fc1e005da4faec1e5a30749 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 20:51:47 -0400 Subject: [PATCH 84/90] another dep --- cmd/utils/flags.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index c0d2dda7fd..63b97970f0 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -47,6 +47,7 @@ import ( "github.com/expanse-project/go-expanse/rpc/codec" "github.com/expanse-project/go-expanse/rpc/comms" "github.com/expanse-project/go-expanse/rpc/shared" + "github.com/expanse-project/go-expanse/rpc/useragent" "github.com/expanse-project/go-expanse/xeth" ) From 82b3b599932a001977ddd902d702d893b5f08cc4 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Tue, 1 Sep 2015 20:54:41 -0400 Subject: [PATCH 85/90] update main.go deps --- cmd/gexp/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/gexp/main.go b/cmd/gexp/main.go index 339489d43c..fe4cd3d639 100644 --- a/cmd/gexp/main.go +++ b/cmd/gexp/main.go @@ -37,10 +37,11 @@ import ( "github.com/expanse-project/go-expanse/core/types" "github.com/expanse-project/go-expanse/exp" "github.com/expanse-project/go-expanse/ethdb" - "github.com/expanse-project/go-expanse/fdtrack" "github.com/expanse-project/go-expanse/logger" "github.com/expanse-project/go-expanse/logger/glog" "github.com/expanse-project/go-expanse/metrics" + "github.com/expanse-project/go-expanse/params" + "github.com/expanse-project/go-expanse/rlp" "github.com/expanse-project/go-expanse/rpc/codec" "github.com/expanse-project/go-expanse/rpc/comms" ) From fc3941d1fdfdea1b6c6e3053dea05979be3555e4 Mon Sep 17 00:00:00 2001 From: Christoph Jentzsch Date: Wed, 2 Sep 2015 23:24:17 +0200 Subject: [PATCH 86/90] fix block time issue currently, under normal circumstances, you always set the timestamp to previous.Time() + 1. credits to https://www.reddit.com/r/ethereum/comments/3jcs5r/code_avg_block_time_vs_difficulty_adjustment/cuoi4op style --- miner/worker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miner/worker.go b/miner/worker.go index 86970ec071..16a16931d7 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -434,7 +434,7 @@ func (self *worker) commitNewWork() { tstart := time.Now() parent := self.chain.CurrentBlock() tstamp := tstart.Unix() - if parent.Time().Cmp(new(big.Int).SetInt64(tstamp)) != 1 { + if parent.Time().Cmp(new(big.Int).SetInt64(tstamp)) >= 0 { tstamp = parent.Time().Int64() + 1 } // this will ensure we're not going off too far in the future From 587669215b878566c4a7b91fbf88a6fd2ec4f46a Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Thu, 3 Sep 2015 00:52:42 +0200 Subject: [PATCH 87/90] cmd/geth: bump 1.1.2 --- cmd/geth/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index c821e3bc20..1b720ac379 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -48,10 +48,10 @@ import ( const ( ClientIdentifier = "Geth" - Version = "1.1.1" + Version = "1.1.2" VersionMajor = 1 VersionMinor = 1 - VersionPatch = 1 + VersionPatch = 2 ) var ( From c93acd8030fc2323c215bb3b79f658f9480f986d Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Wed, 2 Sep 2015 22:35:53 -0400 Subject: [PATCH 88/90] update --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4c12be4a81..28b3dc4ff7 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ cmd/mist/assets/ext/expanse.js/ profile.tmp profile.cov +.idea/workspace.xml From 161bcec8c3e92f2ccd4975ab1ac6a807a5093a26 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Wed, 2 Sep 2015 22:36:37 -0400 Subject: [PATCH 89/90] remove idea again --- .idea/.name | 1 - .idea/encodings.xml | 4 ---- .idea/go-expanse.iml | 8 -------- .idea/misc.xml | 4 ---- .idea/modules.xml | 8 -------- .idea/scopes/scope_settings.xml | 5 ----- .idea/vcs.xml | 6 ------ 7 files changed, 36 deletions(-) delete mode 100644 .idea/.name delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/go-expanse.iml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/scopes/scope_settings.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 2adf87fbaf..0000000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -go-expanse \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index d82104827f..0000000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/go-expanse.iml b/.idea/go-expanse.iml deleted file mode 100644 index c956989b29..0000000000 --- a/.idea/go-expanse.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 8662aa97f9..0000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 2318fdd1a3..0000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b843..0000000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4c..0000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From b59f825c9314b71c965f6f0824f724b588a66153 Mon Sep 17 00:00:00 2001 From: Christopher Franko Date: Wed, 2 Sep 2015 22:38:59 -0400 Subject: [PATCH 90/90] bye --- .idea/workspace.xml | 567 -------------------------------------------- 1 file changed, 567 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 4f054aeb80..0000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,567 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - - - 1438971860269 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file