aboutsummaryrefslogtreecommitdiffstats
path: root/les
Commit message (Collapse)AuthorAgeFilesLines
* les: implement ultralight client (#16904)b00ris2019-01-2414-160/+1156
| | | | For more information about this light client mode, read https://hackmd.io/s/HJy7jjZpm
* cmd/geth, core, eth: implement Constantinople override flag (#18273)Martin Holst Swende2018-12-111-1/+1
| | | | | | | | * geth/core/eth: implement constantinople override flag * les: implemnent constantinople override flag for les clients * cmd/geth, eth, les: fix typo, move flag to experimentals
* core, internal, eth, miner, les: Take VM config from BlockChain (#17955)Paweł Bylica2018-12-061-2/+2
| | | | | | | | | | | Until this commit, when sending an RPC request that called `NewEVM`, a blank `vm.Config` would be taken so as to set some options, based on the default configuration. If some extra configuration switches were passed to the blockchain, those would be ignored. This PR adds a function to get the config from the blockchain, and this is what is now used for RPC calls. Some subsequent changes need to be made, see https://github.com/ethereum/go-ethereum/pull/17955#pullrequestreview-182237244 for the details of the discussion.
* remove a no-op line in the code (#17760)zah2018-11-291-1/+0
|
* les: fix fetcher syncing logic (#18072)Felföldi Zsolt2018-11-261-27/+29
|
* les: fix pubkey index typo (#18093)Sheldon2018-11-151-1/+1
|
* les, light: reduce les testing stress (#17867)gary rong2018-10-081-1/+1
|
* les: limit state ODR retrievals to the last 100 blocks (#17744)Felföldi Zsolt2018-10-015-19/+26
|
* all: new p2p node representation (#17643)Felix Lange2018-09-256-61/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Package p2p/enode provides a generalized representation of p2p nodes which can contain arbitrary information in key/value pairs. It is also the new home for the node database. The "v4" identity scheme is also moved here from p2p/enr to remove the dependency on Ethereum crypto from that package. Record signature handling is changed significantly. The identity scheme registry is removed and acceptable schemes must be passed to any method that needs identity. This means records must now be validated explicitly after decoding. The enode API is designed to make signature handling easy and safe: most APIs around the codebase work with enode.Node, which is a wrapper around a valid record. Going from enr.Record to enode.Node requires a valid signature. * p2p/discover: port to p2p/enode This ports the discovery code to the new node representation in p2p/enode. The wire protocol is unchanged, this can be considered a refactoring change. The Kademlia table can now deal with nodes using an arbitrary identity scheme. This requires a few incompatible API changes: - Table.Lookup is not available anymore. It used to take a public key as argument because v4 protocol requires one. Its replacement is LookupRandom. - Table.Resolve takes *enode.Node instead of NodeID. This is also for v4 protocol compatibility because nodes cannot be looked up by ID alone. - Types Node and NodeID are gone. Further commits in the series will be fixes all over the the codebase to deal with those removals. * p2p: port to p2p/enode and discovery changes This adapts package p2p to the changes in p2p/discover. All uses of discover.Node and discover.NodeID are replaced by their equivalents from p2p/enode. New API is added to retrieve the enode.Node instance of a peer. The behavior of Server.Self with discovery disabled is improved. It now tries much harder to report a working IP address, falling back to 127.0.0.1 if no suitable address can be determined through other means. These changes were needed for tests of other packages later in the series. * p2p/simulations, p2p/testing: port to p2p/enode No surprises here, mostly replacements of discover.Node, discover.NodeID with their new equivalents. The 'interesting' API changes are: - testing.ProtocolSession tracks complete nodes, not just their IDs. - adapters.NodeConfig has a new method to create a complete node. These changes were needed to make swarm tests work. Note that the NodeID change makes the code incompatible with old simulation snapshots. * whisper/whisperv5, whisper/whisperv6: port to p2p/enode This port was easy because whisper uses []byte for node IDs and URL strings in the API. * eth: port to p2p/enode Again, easy to port because eth uses strings for node IDs and doesn't care about node information in any way. * les: port to p2p/enode Apart from replacing discover.NodeID with enode.ID, most changes are in the server pool code. It now deals with complete nodes instead of (Pubkey, IP, Port) triples. The database format is unchanged for now, but we should probably change it to use the node database later. * node: port to p2p/enode This change simply replaces discover.Node and discover.NodeID with their new equivalents. * swarm/network: port to p2p/enode Swarm has its own node address representation, BzzAddr, containing both an overlay address (the hash of a secp256k1 public key) and an underlay address (enode:// URL). There are no changes to the BzzAddr format in this commit, but certain operations such as creating a BzzAddr from a node ID are now impossible because node IDs aren't public keys anymore. Most swarm-related changes in the series remove uses of NewAddrFromNodeID, replacing it with NewAddr which takes a complete node as argument. ToOverlayAddr is removed because we can just use the node ID directly.
* les: fix invalid delivery handling in retriever (#17727)Felföldi Zsolt2018-09-211-1/+8
|
* Merge pull request #17719 from karalabe/update-chtsPéter Szilágyi2018-09-202-20/+20
|\ | | | | les, light, params: update light client CHTs
| * les, light, params: update light client CHTsPéter Szilágyi2018-09-202-20/+20
| |
* | all: protect self-mined block during reorg (#17656)gary rong2018-09-201-1/+1
|/
* les: fix retriever logic (#17705)Felföldi Zsolt2018-09-201-2/+6
|
* les: fix distReq.sentChn double close bug (#17639)Felföldi Zsolt2018-09-151-1/+3
|
* consensus, miner: stale block mining support (#17506)gary rong2018-08-281-1/+1
| | | | | | | | | | * consensus, miner: stale block supporting * consensus, miner: refactor seal signature * cmd, consensus, eth: add miner noverify flag * cmd, consensus, miner: polish
* all: make indexer configurable (#17188)gary rong2018-08-2813-211/+332
|
* cmd, eth, miner: make recommit configurable (#17444)gary rong2018-08-221-1/+1
| | | | | | | | | | | | * cmd, eth, miner: make recommit configurable * cmd, eth, les, miner: polish a bit * miner: filter duplicate sealing work * cmd: remove uncessary conversion * miner: avoid microptimization in favor of cleaner code
* les: fix CHT field in nodeInfo (#17465)Felföldi Zsolt2018-08-211-4/+16
|
* les: fix crasher in NodeInfo when running as server (#17419)Felix Lange2018-08-175-152/+178
| | | | | | | | | | | | | | | | | * les: fix crasher in NodeInfo when running as server The ProtocolManager computes CHT and Bloom trie roots by asking the indexers for their current head. It tried to get the indexers from LesOdr, but no LesOdr instance is created in server mode. Attempt to fix this by moving the indexers, protocol creation and NodeInfo to a new lesCommons struct which is embedded into both server and client. All this setup code should really be cleaned up, but this is just a hotfix so we have to do that some other time. * les: fix commons protocol maker
* light: CHT and bloom trie indexers working in light mode (#16534)Felföldi Zsolt2018-08-169-44/+70
| | | | | | | This PR enables the indexers to work in light client mode by downloading a part of these tries (the Merkle proofs of the last values of the last known section) in order to be able to add new values and recalculate subsequent hashes. It also adds CHT data to NodeInfo.
* les: implement client connection logic (#16899)Felföldi Zsolt2018-08-153-1/+438
| | | | | | | | | | | | | | | | | | | | | | | This PR implements les.freeClientPool. It also adds a simulated clock in common/mclock, which enables time-sensitive tests to run quickly and still produce accurate results, and package common/prque which is a generalised variant of prque that enables removing elements other than the top one from the queue. les.freeClientPool implements a client database that limits the connection time of each client and manages accepting/rejecting incoming connections and even kicking out some connected clients. The pool calculates recent usage time for each known client (a value that increases linearly when the client is connected and decreases exponentially when not connected). Clients with lower recent usage are preferred, unknown nodes have the highest priority. Already connected nodes receive a small bias in their favor in order to avoid accepting and instantly kicking out clients. Note: the pool can use any string for client identification. Using signature keys for that purpose would not make sense when being known has a negative value for the client. Currently the LES protocol manager uses IP addresses (without port address) to identify clients.
* cmd, consensus/ethash, eth: miner push notificationsPéter Szilágyi2018-08-101-1/+1
|
* consensus/ethash: move remote agent logic to ethash internal (#15853)gary rong2018-08-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * consensus/ethash: start remote ggoroutine to handle remote mining * consensus/ethash: expose remote miner api * consensus/ethash: expose submitHashrate api * miner, ethash: push empty block to sealer without waiting execution * consensus, internal: add getHashrate API for ethash * consensus: add three method for consensus interface * miner: expose consensus engine running status to miner * eth, miner: specify etherbase when miner created * miner: commit new work when consensus engine is started * consensus, miner: fix some logics * all: delete useless interfaces * consensus: polish a bit
* all: simplify switches (#17267)Oleg Kovalov2018-07-301-2/+1
| | | | | | * all: simplify switches * silly mistake
* accounts, eth, les: blockhash based filtering on all code pathsPéter Szilágyi2018-07-121-1/+4
|
* les: add announcement safety check to light fetcher (#17034)Felföldi Zsolt2018-07-041-2/+9
|
* les: handle conn/disc/reg logic in the eventloop (#16981)gary rong2018-06-251-74/+135
| | | | | | | | | | * les: handle conn/disc/reg logic in the eventloop * les: try to dial before start eventloop * les: handle disconnect logic more safely * les: grammar fix
* les: fix retriever logic (#16776)Felföldi Zsolt2018-06-121-13/+17
| | | | | | | | | | | This PR fixes a retriever logic bug. When a peer had a soft timeout and then a response arrived, it always assumed it was the same peer even though it could have been a later requested one that did not time out at all yet. In this case the logic went to an illegal state and deadlocked, causing a goroutine leak. Fixes #16243 and replaces #16359. Thanks to @riceke for finding the bug in the logic.
* core, eth, les: more efficient hash-based header chain retrieval (#16946)Felföldi Zsolt2018-06-121-13/+22
|
* les: pass server pool to protocol manager (#16947)Felföldi Zsolt2018-06-124-4/+5
|
* les: add Skip overflow check to GetBlockHeadersMsg handler (#16891)Felföldi Zsolt2018-06-051-7/+18
|
* trie: fixes to comply with golint (#16771)kiel barry2018-05-221-5/+5
|
* core, eth: minor txpool event cleanupsPéter Szilágyi2018-05-181-2/+2
|
* all: collate new transaction events togetherrjl4934564422018-05-181-1/+1
|
* all: get rid of error when creating memory database (#16716)gary rong2018-05-093-15/+12
| | | | | | | | * all: get rid of error when create mdb * core: clean up variables definition * all: inline mdb definition
* core/rawdb: separate raw database access to own package (#16666)Péter Szilágyi2018-05-0711-76/+111
|
* les: changed if-else blocks to conform with golint (#16658)GagziW2018-05-034-19/+13
|
* build: enable goimports and varcheck linters (#16446)thomasmodeneis2018-04-183-19/+0
|
* les: add ps.lock.Unlock() before return (#16360)cpusoft2018-04-111-0/+2
|
* eth, les: allow exceeding maxPeers for trusted peers (#16189)Andrey Petrov2018-02-271-1/+2
| | | Fixes #3326, #14472
* metrics: pull library and introduce ResettingTimer and InfluxDB reporter ↵Anton Evangelatov2018-02-231-4/+4
| | | | | | | | | | | | | | | | | | | | (#15910) * go-metrics: fork library and introduce ResettingTimer and InfluxDB reporter. * vendor: change nonsense/go-metrics to ethersphere/go-metrics * go-metrics: add tests. move ResettingTimer logic from reporter to type. * all, metrics: pull in metrics package in go-ethereum * metrics/test: make sure metrics are enabled for tests * metrics: apply gosimple rules * metrics/exp, internal/debug: init expvar endpoint when starting pprof server * internal/debug: tiny comment formatting fix
* eth, les, light: filter on logs only, derive receipts on demandPéter Szilágyi2018-02-231-0/+4
|
* les: fix light fetcher database race (#16103)Felföldi Zsolt2018-02-191-9/+21
| | | | | | * les: fix light fetcher database race * les: lightFetcher comments
* les: add missing lock around peer accessPéter Szilágyi2018-02-151-0/+3
|
* all: update license information (#16089)Felix Lange2018-02-141-1/+1
|
* les, light: fix CHT trie retrievals (#16039)Péter Szilágyi2018-02-116-95/+174
| | | | | | | | | | | | * les, light: fix CHT trie retrievals * les, light: minor polishes, test remote CHT retrievals * les, light: deterministic nodeset rlp, bloombits test skeleton * les: add an event emission to the les bloombits test * les: drop dead tester code
* les: fix server panic when discovery disabled (#16055)Felföldi Zsolt2018-02-101-9/+11
|
* core, trie: intermediate mempool between trie and database (#15857)Péter Szilágyi2018-02-064-85/+113
| | | This commit reduces database I/O by not writing every state trie to disk.
* les: limit LES peer count and improve peer configuration logic (#16010)Felföldi Zsolt2018-02-054-4/+16
| | | | | | * les: limit number of LES connections * eth, cmd/utils: light vs max peer configuration logic
* core, eth, les, light: get rid of redundant methodsPéter Szilágyi2018-01-312-11/+20
|
* les: fix TxStatusMsg RLP coding (#15974)Felföldi Zsolt2018-01-273-5/+5
|
* p2p, p2p/discover, p2p/discv5: implement UDP port sharing (#15200)Felföldi Zsolt2018-01-223-7/+7
| | | | | | | | | | | | | | | This commit affects p2p/discv5 "topic discovery" by running it on the same UDP port where the old discovery works. This is realized by giving an "unhandled" packet channel to the old v4 discovery packet handler where all invalid packets are sent. These packets are then processed by v5. v5 packets are always invalid when interpreted by v4 and vice versa. This is ensured by adding one to the first byte of the packet hash in v5 packets. DiscoveryV5Bootnodes is also changed to point to new bootnodes that are implementing the changed packet format with modified hash. Existing and new v5 bootnodes are both running on different ports ATM.
* les: fix les/1 CHT compatibility issue (#15692)Felföldi Zsolt2018-01-092-3/+3
|
* all: switch gas limits from big.Int to uint64Péter Szilágyi2018-01-033-16/+14
|
* various: remove redundant parentheses (#15793)Furkan KAMACI2018-01-032-3/+3
|
* eth, les, light: expose chain config in les node info too (#15732)Péter Szilágyi2017-12-281-3/+14
|
* accounts, consensus, core, eth: make chain maker consensus agnostic (#15497)gary rong2017-12-222-3/+4
| | | | | | | | | | * accounts, consensus, core, eth: make chain maker consensus agnostic * consensus, core: move CalcDifficulty to Engine interface * consensus: add docs for calcDifficulty function * consensus, core: minor comment fixups
* cmd, consensus, eth: split ethash related config to it own (#15520)gary rong2017-11-241-1/+1
| | | | | | | | | | * cmd, consensus, eth: split ethash related config to it own * eth, consensus: minor polish * eth, consenus, console: compress pow testing config field to single one * consensus, eth: document pow mode
* les: use modified default txpool config to avoid creating journal filerjl4934564422017-11-211-1/+3
|
* build: enable unconvert linter (#15456)ferhat elmas2017-11-111-1/+1
| | | | | | | | | * build: enable unconvert linter - fixes #15453 - update code base for failing cases * cmd/puppeth: replace syscall.Stdin with os.Stdin.Fd() for unconvert linter
* les: fix channel assignment data race (#15441)b00ris2017-11-091-3/+3
|
* les: fix misuse of WaitGroup (#15365)Evgeny Danilenko2017-11-091-3/+3
|
* all: gofmt -w -s (#15419)ferhat elmas2017-11-084-12/+12
|
* les, core/bloombits: post-LES/2 fixes (#15391)Felföldi Zsolt2017-10-271-1/+1
| | | | | | * les: fix topic ID * core/bloombits: fix interface conversion
* core, eth, les: fix messy code (#15367)Péter Szilágyi2017-10-254-51/+73
| | | | | | | | * core, eth, les: fix messy code * les: fixed tx status test and rlp encoding * core: add a workaround for light sync
* les, light: LES/2 protocol version (#14970)Felföldi Zsolt2017-10-2414-274/+1202
| | | | | | | | | | | | | | | | | | This PR implements the new LES protocol version extensions: * new and more efficient Merkle proofs reply format (when replying to a multiple Merkle proofs request, we just send a single set of trie nodes containing all necessary nodes) * BBT (BloomBitsTrie) works similarly to the existing CHT and contains the bloombits search data to speed up log searches * GetTxStatusMsg returns the inclusion position or the pending/queued/unknown state of a transaction referenced by hash * an optional signature of new block data (number/hash/td) can be included in AnnounceMsg to provide an option for "very light clients" (mobile/embedded devices) to skip expensive Ethash check and accept multiple signatures of somewhat trusted servers (still a lot better than trusting a single server completely and retrieving everything through RPC). The new client mode is not implemented in this PR, just the protocol extension.
* core, eth/downloader: commit block data using batches (#15115)Felix Lange2017-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ethdb: add Putter interface and Has method * ethdb: improve docs and add IdealBatchSize * ethdb: remove memory batch lock Batches are not safe for concurrent use. * core: use ethdb.Putter for Write* functions This covers the easy cases. * core/state: simplify StateSync * trie: optimize local node check * ethdb: add ValueSize to Batch * core: optimize HasHeader check This avoids one random database read get the block number. For many uses of HasHeader, the expectation is that it's actually there. Using Has avoids a load + decode of the value. * core: write fast sync block data in batches Collect writes into batches up to the ideal size instead of issuing many small, concurrent writes. * eth/downloader: commit larger state batches Collect nodes into a batch up to the ideal size instead of committing whenever a node is received. * core: optimize HasBlock check This avoids a random database read to get the number. * core: use numberCache in HasHeader numberCache has higher capacity, increasing the odds of finding the header without a database lookup. * core: write imported block data using a batch Restore batch writes of state and add blocks, tx entries, receipts to the same batch. The change also simplifies the miner. This commit also removes posting of logs when a forked block is imported. * core: fix DB write error handling * ethdb: use RLock for Has * core: fix HasBlock comment
* core, eth: clean up bloom filtering, add some testsPéter Szilágyi2017-09-062-15/+5
|
* core, eth: add bloombit indexer, filter based on itZsolt Felfoldi2017-09-062-1/+19
|
* core: implement Metropolis EIP 658, receipt status byterjl4934564422017-08-221-2/+2
|
* core, light: send chain events using event.Feed (#14865)Miya Chen2017-08-185-8/+34
|
* les: fix megacheck warnings (#14941)Felföldi Zsolt2017-08-098-96/+6
| | | | | | * les: fix megacheck warnings * les: fixed testGetProofs
* Merge pull request #14737 from holiman/txpool_localaccountsPéter Szilágyi2017-07-101-3/+3
|\ | | | | Txpool localaccounts
| * core, eth, les: polish txpool API around local/remote txsPéter Szilágyi2017-07-051-3/+3
| |
* | eth/downloader, les, light: Changes in response to reviewNick Johnson2017-07-031-14/+1
| |
* | eth, les: Refactor downloader peer to use structsNick Johnson2017-06-291-47/+73
| |
* | eth, les, light: Refactor downloader to use blockchain interfaceNick Johnson2017-06-281-3/+1
|/
* core/state: access trie through Database interface, track errors (#14589)Felix Lange2017-06-273-46/+29
| | | | | | | | | With this commit, core/state's access to the underlying key/value database is mediated through an interface. Database errors are tracked in StateDB and returned by CommitTo or the new Error method. Motivation for this change: We can remove the light client's duplicated copy of core/state. The light client now supports node iteration, so tracing and storage enumeration can work with the light client (not implemented in this commit).
* les: code refactoring (#14416)Felföldi Zsolt2017-06-2115-441/+699
| | | | | | | | | | | | This commit does various code refactorings: - generalizes and moves the request retrieval/timeout/resend logic out of LesOdr (will be used by a subsequent PR) - reworks the peer management logic so that all services can register with peerSet to get notified about added/dropped peers (also gets rid of the ugly getAllPeers callback in requestDistributor) - moves peerSet, LesOdr, requestDistributor and retrieveManager initialization out of ProtocolManager because I believe they do not really belong there and the whole init process was ugly and ad-hoc
* les: fix goroutine leak in execQueue (#14480)Felix Lange2017-05-172-30/+118
| | | | | | | | | | | execQueue used an atomic counter to track whether the queue had been closed, but the checking the counter didn't happen because the queue was blocked on its channel. Fix it by using a condition variable instead of sync/atomic. I tried an implementation based on channels first, but it was hard to make it reliable. quit now waits for the queue loop to exit.
* cmd, eth, les, mobile: make networkid uint64 everywherePéter Szilágyi2017-04-253-10/+10
|
* all: update license informationFelix Lange2017-04-142-2/+2
|
* cmd/utils, node: remove unused solc references and improve RPC config (#14324)bas-vk2017-04-131-5/+1
| | | | | Currently http cors and websocket origins are a comma separated string in the config object. These are replaced with string arrays that are more expressive in case of a config file.
* cmd/geth: add --config file flag (#13875)Felix Lange2017-04-121-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * p2p/discover, p2p/discv5: add marshaling methods to Node * p2p/netutil: make Netlist decodable from TOML * common/math: encode nil HexOrDecimal256 as 0x0 * cmd/geth: add --config file flag * cmd/geth: add missing license header * eth: prettify Config again, fix tests * eth: use gasprice.Config instead of duplicating its fields * eth/gasprice: hide nil default from dumpconfig output * cmd/geth: hide genesis block in dumpconfig output * node: make tests compile * console: fix tests * cmd/geth: make TOML keys look exactly like Go struct fields * p2p: use discovery by default This makes the zero Config slightly more useful. It also fixes package node tests because Node detects reuse of the datadir through the NodeDatabase. * cmd/geth: make ethstats URL settable through config file * cmd/faucet: fix configuration * cmd/geth: dedup attach tests * eth: add comment for DefaultConfig * eth: pass downloader.SyncMode in Config This removes the FastSync, LightSync flags in favour of a more general SyncMode flag. * cmd/utils: remove jitvm flags * cmd/utils: make mutually exclusive flag error prettier It now reads: Fatal: flags --dev, --testnet can't be used at the same time * p2p: fix typo * node: add DefaultConfig, use it for geth * mobile: add missing NoDiscovery option * cmd/utils: drop MakeNode This exposed a couple of places that needed to be updated to use node.DefaultConfig. * node: fix typo * eth: make fast sync the default mode * cmd/utils: remove IPCApiFlag (unused) * node: remove default IPC path Set it in the frontends instead. * cmd/geth: add --syncmode * cmd/utils: make --ipcdisable and --ipcpath mutually exclusive * cmd/utils: don't enable WS, HTTP when setting addr * cmd/utils: fix --identity
* consensus, core, ethstats: use engine specific block beneficiary (#14318)Péter Szilágyi2017-04-123-3/+4
| | | | | | * consensus, core, ethstats: use engine specific block beneficiary * core, eth, les, miner: use explicit beneficiary during mining
* les: allow LES connection to other servers (#13889)Felföldi Zsolt2017-04-111-2/+3
|
* Merge pull request #13870 from karalabe/miners-fixesPéter Szilágyi2017-04-071-1/+2
|\ | | | | all: clean up various error handling in core and the miner
| * consensus, core: drop all the legacy custom core error typesPéter Szilágyi2017-04-061-1/+2
| |
* | cmd, les, eth, eth/gasprice: using new gas price oracle (#13853)Felföldi Zsolt2017-04-062-2/+7
|/ | | | | | | | | | | | * cmd, les, eth, eth/gasprice: using new gas price oracle * eth/gasprice: renamed source file * eth/gasprice: added security checks for gpo params * eth/gasprice: fixed naming issues * eth/gasprice: max limit, maxEmpty
* core, consensus: pluggable consensus engines (#3817)Péter Szilágyi2017-04-054-18/+16
| | | | | This commit adds pluggable consensus engines to go-ethereum. In short, it introduces a generic consensus interface, and refactors the entire codebase to use this interface.
* core: refactor genesis handlingFelix Lange2017-03-233-22/+27
| | | | | | | | | | | | | | | | | | | | | | | | This commit solves several issues concerning the genesis block: * Genesis/ChainConfig loading was handled by cmd/geth code. This left library users in the cold. They could specify a JSON-encoded string and overwrite the config, but didn't get any of the additional checks performed by geth. * Decoding and writing of genesis JSON was conflated in WriteGenesisBlock. This made it a lot harder to embed the genesis block into the forthcoming config file loader. This commit changes things so there is a single Genesis type that represents genesis blocks. All uses of Write*Genesis* are changed to use the new type instead. * If the chain config supplied by the user was incompatible with the current chain (i.e. the chain had already advanced beyond a scheduled fork), it got overwritten. This is not an issue in practice because previous forks have always had the highest total difficulty. It might matter in the future though. The new code reverts the local chain to the point of the fork when upgrading configuration. The change to genesis block data removes compression library dependencies from package core.
* all: import "context" instead of "golang.org/x/net/context"Felix Lange2017-03-235-9/+14
| | | | | | | | | | There is no need to depend on the old context package now that the minimum Go version is 1.7. The move to "context" eliminates our weird vendoring setup. Some vendored code still uses golang.org/x/net/context and it is now vendored in the normal way. This change triggered new vet checks around context.WithTimeout which didn't fire with golang.org/x/net/context.
* les: implement request distributor, fix blocking issues (#3660)Felföldi Zsolt2017-03-2315-306/+839
| | | | | * les: implement request distributor, fix blocking issues * core: moved header validation before chain mutex lock
* core, eth, les: support resuming fast sync on heavy rollback (#3743)Péter Szilágyi2017-03-221-0/+1
|
* cmd, eth, les, node, pow: disk caching and progress reportsPéter Szilágyi2017-03-091-6/+1
|
* all: swap out the C++ ethash to the pure Go one (mining todo)Péter Szilágyi2017-03-091-1/+2
|
* all: update light logs (and a few others) to the new modelPéter Szilágyi2017-03-038-214/+211
|
* eth, les: shorten genesis block mismatch error messageFelix Lange2017-02-281-1/+1
|
* common: move big integer math to common/math (#3699)Felix Lange2017-02-272-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common: remove CurrencyToString Move denomination values to params instead. * common: delete dead code * common: move big integer operations to common/math This commit consolidates all big integer operations into common/math and adds tests and documentation. There should be no change in semantics for BigPow, BigMin, BigMax, S256, U256, Exp and their behaviour is now locked in by tests. The BigD, BytesToBig and Bytes2Big functions don't provide additional value, all uses are replaced by new(big.Int).SetBytes(). BigToBytes is now called PaddedBigBytes, its minimum output size parameter is now specified as the number of bytes instead of bits. The single use of this function is in the EVM's MSTORE instruction. Big and String2Big are replaced by ParseBig, which is slightly stricter. It previously accepted leading zeros for hexadecimal inputs but treated decimal inputs as octal if a leading zero digit was present. ParseUint64 is used in places where String2Big was used to decode a uint64. The new functions MustParseBig and MustParseUint64 are now used in many places where parsing errors were previously ignored. * common: delete unused big integer variables * accounts/abi: replace uses of BytesToBig with use of encoding/binary * common: remove BytesToBig * common: remove Bytes2Big * common: remove BigTrue * cmd/utils: add BigFlag and use it for error-checked integer flags While here, remove environment variable processing for DirectoryFlag because we don't use it. * core: add missing error checks in genesis block parser * common: remove String2Big * cmd/evm: use utils.BigFlag * common/math: check for 256 bit overflow in ParseBig This is supposed to prevent silent overflow/truncation of values in the genesis block JSON. Without this check, a genesis block that set a balance larger than 256 bits would lead to weird behaviour in the VM. * cmd/utils: fixup import
* eth, les, swarm: fix go vet issues sufraced by log15Péter Szilágyi2017-02-231-1/+1
|
* all: blidly swap out glog to our log15, logs need reworkPéter Szilágyi2017-02-238-124/+121
|
* params: core, core/vm, miner: 64bit gas instructionsJeffrey Wilcke2017-02-142-5/+7
| | | | | | | | | | | | | | | | | Reworked the EVM gas instructions to use 64bit integers rather than arbitrary size big ints. All gas operations, be it additions, multiplications or divisions, are checked and guarded against 64 bit integer overflows. In additon, most of the protocol paramaters in the params package have been converted to uint64 and are now constants rather than variables. * common/math: added overflow check ops * core: vmenv, env renamed to evm * eth, internal/ethapi, les: unmetered eth_call and cancel methods * core/vm: implemented big.Int pool for evm instructions * core/vm: unexported intPool methods & verification methods * core/vm: added memoryGasCost overflow check and test
* Revert "params: core, core/vm, miner: 64bit gas instructions (#3514)"Jeffrey Wilcke2017-02-132-7/+5
| | | | This reverts commit 8b57c494908637a5c0e74f8f7a13b3218e026757.
* params: core, core/vm, miner: 64bit gas instructions (#3514)Jeffrey Wilcke2017-02-022-5/+7
| | | | | | | | | | | | | | | | Reworked the EVM gas instructions to use 64bit integers rather than arbitrary size big ints. All gas operations, be it additions, multiplications or divisions, are checked and guarded against 64 bit integer overflows. In additon, most of the protocol paramaters in the params package have been converted to uint64 and are now constants rather than variables. * common/math: added overflow check ops * core: vmenv, env renamed to evm * eth, internal/ethapi, les: unmetered eth_call and cancel methods * core/vm: implemented big.Int pool for evm instructions * core/vm: unexported intPool methods & verification methods * core/vm: added memoryGasCost overflow check and test
* les, cmd/util: disable topic discovery with --nodiscoverZsolt Felfoldi2017-01-271-3/+9
|
* les: remove delayed les server startingZsolt Felfoldi2017-01-261-27/+3
|
* les: add unknown peers to server pool instead of rejecting themZsolt Felfoldi2017-01-262-38/+45
|
* Merge pull request #3579 from bas-vk/natspecPéter Szilágyi2017-01-171-2/+0
|\ | | | | cmd,eth,les,internal: remove natspec support
| * cmd,eth,les,internal: remove natspec supportBas van Kervel2017-01-171-2/+0
| |
* | cmd/geth, core: add support for recording SHA3 preimages (#3543)Nick Johnson2017-01-171-1/+2
|/
* les: fixed transaction sending deadlock (#3568)Felföldi Zsolt2017-01-161-1/+0
|
* Merge pull request #3535 from fjl/all-ineffassignPéter Szilágyi2017-01-101-2/+1
|\ | | | | all: fix ineffectual assignments
| * all: fix ineffectual assignments and remove uses of crypto.Sha3Felix Lange2017-01-091-2/+1
| | | | | | | | | | go get github.com/gordonklaus/ineffassign ineffassign .
* | Merge pull request #3519 from zsfelfoldi/light-topic5Péter Szilágyi2017-01-0910-121/+271
|\ \ | |/ |/| les: fixed selectPeer deadlock, improved request distribution
| * les: fixed selectPeer deadlock, improved request distributionZsolt Felfoldi2017-01-0610-121/+271
| | | | | | | | les/flowcontrol: using proper types for relative and absolute times
* | all: fix spelling errorsPéter Szilágyi2017-01-071-1/+1
| |
* | all: gofmt -w -sFelix Lange2017-01-068-21/+21
| |
* | Merge pull request #3516 from fjl/types-drop-sign-ecdsaPéter Szilágyi2017-01-061-7/+7
|\ \ | | | | | | core/types: remove redundant SignECDSA wrappers, rename to SignTx
| * | core/types: remove redundant SignECDSA wrappers, rename to SignTxFelix Lange2017-01-051-7/+7
| |/
* / core/vm: move Log to core/typesFelix Lange2017-01-061-1/+1
|/ | | | | | | | This significantly reduces the dependency closure of ethclient, which no longer depends on core/vm as of this change. All uses of vm.Logs are replaced by []*types.Log. NewLog is gone too, the constructor simply returned a literal.
* core/vm: improved EVM run loop & instruction calling (#3378)Jeffrey Wilcke2017-01-052-4/+4
| | | | | | | | | | | | | | | The run loop, which previously contained custom opcode executes have been removed and has been simplified to a few checks. Each operation consists of 4 elements: execution function, gas cost function, stack validation function and memory size function. The execution function implements the operation's runtime behaviour, the gas cost function implements the operation gas costs function and greatly depends on the memory and stack, the stack validation function validates the stack and makes sure that enough items can be popped off and pushed on and the memory size function calculates the memory required for the operation and returns it. This commit also allows the EVM to go unmetered. This is helpful for offline operations such as contract calls.
* cmd/utils, eth, les: bubble --fakepow flag into eth/les tooPéter Szilágyi2017-01-041-4/+2
|
* rpc: remove HexNumber, replace all uses with hexutil typesFelix Lange2016-12-201-2/+3
| | | | | This change couldn't be automated because HexNumber was used for numbers of all sizes.
* Merge pull request #3413 from zsfelfoldi/light-topic4Felix Lange2016-12-1313-472/+1778
|\ | | | | les, p2p/discv5: implement server pool, improve peer selection, light fetcher and topic searching
| * les, light: add block availability check for ODR requestsZsolt Felfoldi2016-12-105-6/+59
| |
| * eth, les: defer starting LES service until ETH initial sync is finishedZsolt Felfoldi2016-12-102-3/+29
| |
| * les: using random request IDsZsolt Felfoldi2016-12-103-11/+10
| |
| * les: improved header fetcher and server statisticsZsolt Felfoldi2016-12-109-481/+801
| |
| * les: fixed light fetcher request ID matchingZsolt Felfoldi2016-12-082-5/+11
| |
| * les: implement light server poolZsolt Felfoldi2016-12-085-45/+947
| |
* | core: bugfix state change race condition in txpool (#3412)bas-vk2016-12-112-3/+7
|/ | | | | | | | The transaction pool keeps track of the current nonce in its local pendingState. When a new block comes in the pendingState is reset. During the reset it fetches multiple times the current state through the use of the currentState callback. When a second block comes in during the reset its possible that the state changes during the reset. If that block holds transactions that are currently in the pool the local pendingState that is used to determine nonces can get out of sync.
* core, core/vm: implemented a generic environment (#3348)Jeffrey Wilcke2016-12-062-6/+17
| | | | | | | | Environment is now a struct (not an interface). This reduces a lot of tech-debt throughout the codebase where a virtual machine environment had to be implemented in order to test or run it. The new environment is suitable to be used en the json tests, core consensus and light client.
* cmd, ethstats, les, mobile, params: native netstats (#3336)Péter Szilágyi2016-11-251-0/+1
|
* common/httpclient, les: removed httpclientJeffrey Wilcke2016-11-251-3/+0
|
* les: fixed loggingJeffrey Wilcke2016-11-161-1/+1
|
* core/types: turn off nonce checking for Call messagesZsolt Felfoldi2016-11-141-2/+2
|
* p2p/discv5: fixed bootnode connect issuesZsolt Felfoldi2016-11-141-2/+3
|
* les/flowcontrol: fixed locking schemeZsolt Felfoldi2016-11-141-4/+7
|
* Merge pull request #3179 from obscuren/eip-158Felix Lange2016-11-145-80/+41
|\ | | | | EIP158 & 160 Hardfork
| * core/types, params: EIP#155Jeffrey Wilcke2016-11-133-62/+24
| |
| * core, core/state, trie: EIP158, reprice & skip empty account writeJeffrey Wilcke2016-11-135-18/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements EIP158 part 1, 2, 3 & 4 1. If an account is empty it's no longer written to the trie. An empty account is defined as (balance=0, nonce=0, storage=0, code=0). 2. Delete an empty account if it's touched 3. An empty account is redefined as either non-existent or empty. 4. Zero value calls and zero value suicides no longer consume the 25k reation costs. params: moved core/config to params Signed-off-by: Jeffrey Wilcke <jeffrey@ethereum.org>
* | les: cleaned up logging (#3256)Jeffrey Wilcke2016-11-132-24/+29
|/
* les: add missing nil check and handle quit in findServersZsolt Felfoldi2016-11-111-2/+5
|
* les: print 'experimental feature' warning on startupFelix Lange2016-11-091-0/+3
|
* all: update license informationFelix Lange2016-11-0919-22/+89
|
* core/types: remove header accessorsFelix Lange2016-11-094-7/+7
| | | | | | These accessors were introduced by light client changes, but the only method that is actually used is GetNumberU64. This commit replaces all uses of .GetNumberU64 with .Number.Uint64.
* p2p/discv5: added new topic discovery packageZsolt Felfoldi2016-11-094-5/+53
|
* les: light client protocol and APIZsolt Felfoldi2016-11-0919-0/+5087