Commit graph

1290 commits

Author SHA1 Message Date
Péter Szilágyi
8e998ecabe core/forkid: implement the forkid EIP, announce via ENR (#19738)
* eth: chain config (genesis + fork) ENR entry

* core/forkid, eth: protocol independent fork ID, update to CRC32 spec

* core/forkid, eth: make forkid a struct, next uint64, enr struct, RLP

* core/forkid: change forkhash rlp encoding from int to [4]byte

* eth: fixup eth entry a bit and update it every block

* eth: fix lint

* eth: fix crash in ethclient tests
2024-06-28 11:30:31 +04:00
Felix Lange
1bdf53662e all: new p2p node representation (#17643)
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.
2024-06-28 11:30:16 +04:00
Daniel Liu
76ab0b5115 eth/downloader: fix issue #277 2024-06-27 12:51:47 +08:00
Guillaume Ballet
b3e0f70a33 eth/downloader: minor typo fixes in comments (#21035) 2024-06-27 11:28:40 +08:00
Boqin Qin
0673fa1176 eth/downloader: fix possible data race by inconsistent field protection (#20690) 2024-06-27 11:23:49 +08:00
Daniel Liu
f445196dcf eth/gasprice: add configurable threshold to gas price oracle (#22752) 2024-06-20 15:52:32 +08:00
Daniel Liu
2b365e8112 eth/gasprice: improve stability of estimated price (#22722) 2024-06-20 15:52:32 +08:00
Daniel Liu
1521b8a663 eth: move eth.Config to a common package (#22205) 2024-06-20 15:52:32 +08:00
Daniel Liu
2125a1afaa eth/gasprice: offer maxprice flag for overwritting price cap (#21531) 2024-06-20 15:52:32 +08:00
Daniel Liu
56591d37e1 eth/gasprice: lighter gas price oracle for light client (#20409) 2024-06-20 15:52:32 +08:00
Daniel Liu
0063c14ed3 cmd, eth, internal, les: add gasprice cap (#21212) 2024-06-20 15:52:32 +08:00
JukLee0ira
2d89951e5b all: use errrors.New instead of empty fmt.Errorf 2024-06-14 19:19:21 +08:00
JukLee0ira
0aab4ced98 common: add binary variables for system contract 2024-06-06 19:33:59 +08:00
Daniel Liu
025213fb1e
Merge pull request #551 from JukLee0ira/nil
remove redundant error check in function getValidators
2024-05-31 17:13:32 +08:00
JukLee0ira
08432b8a0f hook: remove redundant error check in function getValidators 2024-05-29 15:11:01 +08:00
Gary
0245344338 add TraceCall, backend.StateAtBlock(), RPCGasCap
update gen_config.go by tool `gencodec`
2024-05-17 21:34:34 +08:00
Daniel Liu
7a95b4f907 core, eth, internal/ethapi: create access list RPC API (#22550) 2024-05-14 23:27:23 +08:00
Daniel Liu
5cb014b60f core, eth/tracer: initialize tracer statedb in CaptureStart (#22333) 2024-05-14 23:27:23 +08:00
Daniel Liu
b8974be16e eth/state, les/state, et/tracers: properly init statedb accesslist (#22480) 2024-05-14 23:15:35 +08:00
Daniel Liu
01e1728a94 all: add support for EIP-2718, EIP-2930 transactions (#21502) 2024-05-14 23:15:35 +08:00
Daniel Liu
48f9bbed50 core: types: less allocations when hashing and tx handling (#21265) 2024-05-13 22:07:03 +08:00
Daniel Liu
6338a4195b core: kill off managed state, use own tiny noncer for txpool (#19810) 2024-05-10 19:48:10 +08:00
Daniel Liu
ec50ca36d9 core, eth, trie: use common/prque (#17508) 2024-05-09 18:38:27 +08:00
Daniel Liu
56d9a6e39c core, filters: not set log.BlockHash 2024-04-20 16:27:21 +08:00
Daniel Liu
1c9f1d8279 all: change TxPreEvent to TxsPreEvent (#16720) 2024-03-28 11:16:21 +08:00
Daniel Liu
7cffa1d0aa eth/filters: replace fmt.Println with b.Log in tests (#19670) 2024-03-18 10:08:25 +08:00
gary rong
65b48159d1 eth/filters: fix the block range assignment for log filter (#17284) 2024-03-18 10:08:25 +08:00
Daniel Liu
43f038dbac eth/filters: simplify switches (#17267) 2024-03-18 10:08:25 +08:00
Ian Macalinao
40ee6f87f0 eth/filters: improve error message for invalid filter topics (#17234) 2024-03-18 10:08:25 +08:00
Daniel Liu
a4b557b062 accounts, eth, les: blockhash based filtering on all code paths (#16734) 2024-03-18 10:08:25 +08:00
knarfeh
19b84ff36c eth/filters: make filterLogs func more readable (#16920) 2024-03-18 10:08:25 +08:00
Daniel Liu
7197172b09 eth/filter: check nil pointer when unsubscribe (#16682)
* eth/filter: check nil pointer when unsubscribe

* eth/filters, accounts, rpc: abort system if subscribe failed

* eth/filter: add crit log before exit

* eth/filter, event: minor fixes
2024-03-18 10:08:25 +08:00
Liam
bbab326e22
after we use time.Ticker it didn't allow to have 0 time duration (#493)
* after we use time.Ticker it didn't allow to have 0 time duration
2024-03-15 19:07:05 +11:00
Domino Valdano
69b4383528 eth/filters, ethereum: EIP-234 add blockHash param for eth_getLogs 2024-03-14 11:52:42 +08:00
Daniel Liu
b2a767e660 eth: let function HeaderByNumber return error when header is nil 2024-03-12 10:40:03 +08:00
Daniel Liu
f34087534d eth: check err before return in function StateAndHeaderByNumber 2024-03-12 10:40:03 +08:00
Daniel Liu
4616d59935 internal/ethapi: support block number or hash on state-related methods (#19491)
* Support for EIP-1898.
2024-03-12 10:40:03 +08:00
Andrei Maiboroda
b022ba2c5d core/vm: make INVALID a defined opcode (#24017)
* core/vm: Define 0xfe opcode as INVALID

* core/vm: Remove opInvalid as opUndefined handles it

Co-authored-by: Alex Beregszaszi <alex@rtfs.hu>
2024-03-01 14:13:24 +08:00
Daniel Liu
7a55b9f788 core/state: remove unused methods ReturnGas (#23092) 2024-03-01 14:13:23 +08:00
Paweł Bylica
192edc0c63 core/vm: use uint256 in EVM implementation (#20787)
* core/vm: use fixed uint256 library instead of big

* core/vm: remove intpools

* core/vm: upgrade uint256, fixes uint256.NewFromBig

* core/vm: use uint256.Int by value in Stack

* core/vm: upgrade uint256 to v1.0.0

* core/vm: don't preallocate space for 1024 stack items (only 16)

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-03-01 14:13:23 +08:00
Wanwiset Peerapatanapokin
aaa246f60e
PDF-01 (#397)
* replace deprecated ioutil lib calls

* fix for FileInfo type required

* fix for ioutil.Discard

* fix .Discard

* fix for go-bindata generated files
2024-01-19 15:05:03 +04:00
Liam
c7a42fd7c9
resolve sync issue by passing right round number (#384) 2023-12-27 22:14:13 +11:00
Daniel Liu
bd3e2600fd eth/downloader: make Broadcast run after Wait (#264) 2023-12-18 10:49:40 +08:00
Liam
b4bd070837
Improve log (#368)
* improve log
2023-11-26 22:04:08 +11:00
Banana-J
92689943a0
Revisit the solution from PR-260, try keep the API consistent by not incrementing the nonce for trading&lending tx (#371) 2023-11-25 00:04:59 +11:00
Liam Lai
824d7b232f resolve conflict 2023-11-20 23:53:49 +11:00
Liam
84994df759
Merge pull request #351 from XinFinOrg/bump-golang-1.21
Bump golang 1.21
2023-11-07 10:35:42 +11:00
Liam
75661b488b
add notification script (#350)
* add notification script

* skip always test
2023-11-06 20:54:16 +11:00
Daniel Liu
e2359d9b8c filter zero address in function GetCandidates 2023-10-24 12:15:24 +08:00
Daniel Liu
320b358830 replace package sort with common/sort 2023-10-23 22:51:06 +08:00