Commit Graph

5399 Commits

Author SHA1 Message Date
Felix Lange
c14de2e973 p2p/nat: tweak port mapping log messages and levels
People stil get confused about the messages. This commit changes
the levels so that the only thing printed at the default level (info)
is a successful mapping.
2015-05-14 12:54:59 +02:00
Felix Lange
e7c7b54b82 Godeps: bump github.com/huin/goupnp to c57ae84 2015-05-14 12:29:41 +02:00
Felix Lange
663d4e0aff p2p/nat: add test for UPnP auto discovery via SSDP
The test listens for multicast UDP packets on the default interface
because I couldn't get it to work reliably on loopback without massive
changes to goupnp. This means that the test might fail when there is a
UPnP-enabled router attached on that interface. I checked that locally
by looping the test and it passes reliably because the local SSDP server
always responds faster.
2015-05-14 12:13:19 +02:00
Felix Lange
983f5a717a p2p/nat: fix concurrent access to autodisc Interface
Concurrent calls to Interface methods on autodisc could return a "not
discovered" error if the discovery did not finish before the call.
autodisc.wait expected the done channel to carry the found Interface
but it was closed instead.

The fix is to use sync.Once for now, which is easier to get right.
And there is a test. Finally.

This will have to change again when we introduce re-discovery.
2015-05-14 03:53:11 +02:00
Felix Lange
f7fdb4dfbe Merge pull request #966 from fjl/fixup-discover-chunked-neighbors
p2p/discover: fix out-of-bounds slicing for chunked neighbors packets
2015-05-13 21:52:58 +02:00
Felix Lange
251846d65a p2p/discover: fix out-of-bounds slicing for chunked neighbors packets
The code assumed that Table.closest always returns at least 13 nodes.
This is not true for small tables (e.g. during bootstrap).
2015-05-13 21:49:04 +02:00
Jeffrey Wilcke
fad21fb4a5 Merge pull request #963 from Gustav-Simonsson/fix_keystore_crypto_comments
Update keystore code comments
2015-05-13 11:51:02 -07:00
Felix Lange
b2119d8931 Merge pull request #965 from subtly/patch-1
Better UDP & interop. Limit all received datagrams to 1280bytes.
2015-05-13 20:34:10 +02:00
subtly
8eef2b765a fix test. 2015-05-13 20:15:01 +02:00
subtly
a32693770c Manual send of multiple neighbours packets. Test receiving multiple neighbours packets. 2015-05-13 20:03:17 +02:00
subtly
7473c93668 UDP Interop. Limit datagrams to 1280bytes.
We don't have a UDP which specifies any messages that will be 4KB. Aside from being implemented for months and a necessity for encryption and piggy-backing packets, 1280bytes is ideal, and, means this TODO can be completed!

Why 1280 bytes?
* It's less than the default MTU for most WAN/LAN networks. That means fewer fragmented datagrams (esp on well-connected networks).
* Fragmented datagrams and dropped packets suck and add latency while OS waits for a dropped fragment to never arrive (blocking readLoop())
* Most of our packets are < 1280 bytes.
* 1280 bytes is minimum datagram size and MTU for IPv6 -- on IPv6, a datagram < 1280bytes will *never* be fragmented.

UDP datagrams are dropped. A lot! And fragmented datagrams are worse. If a datagram has a 30% chance of being dropped, then a fragmented datagram has a 60% chance of being dropped. More importantly, we have signed packets and can't do anything with a packet unless we receive the entire datagram because the signature can't be verified. The same is true when we have encrypted packets.

So the solution here to picking an ideal buffer size for receiving datagrams is a number under 1400bytes. And the lower-bound value for IPv6 of 1280 bytes make's it a non-decision. On IPv4 most ISPs and 3g/4g/let networks have an MTU just over 1400 -- and *never* over 1500. Never -- that means packets over 1500 (in reality: ~1450) bytes are fragmented. And probably dropped a lot.

Just to prove the point, here are pings sending non-fragmented packets over wifi/ISP, and a second set of pings via cell-phone tethering. It's important to note that, if *any* router between my system and the EC2 node has a lower MTU, the message would not go through:

On wifi w/normal ISP:
localhost:Debug $ ping -D -s 1450 52.6.250.242
PING 52.6.250.242 (52.6.250.242): 1450 data bytes
1458 bytes from 52.6.250.242: icmp_seq=0 ttl=42 time=104.831 ms
1458 bytes from 52.6.250.242: icmp_seq=1 ttl=42 time=119.004 ms
^C
--- 52.6.250.242 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 104.831/111.918/119.004/7.087 ms
localhost:Debug $ ping -D -s 1480 52.6.250.242
PING 52.6.250.242 (52.6.250.242): 1480 data bytes
ping: sendto: Message too long
ping: sendto: Message too long
Request timeout for icmp_seq 0
ping: sendto: Message too long
Request timeout for icmp_seq 1


Tethering to O2:
localhost:Debug $ ping -D -s 1480 52.6.250.242
PING 52.6.250.242 (52.6.250.242): 1480 data bytes
ping: sendto: Message too long
ping: sendto: Message too long
Request timeout for icmp_seq 0
^C
--- 52.6.250.242 ping statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss
localhost:Debug $ ping -D -s 1450 52.6.250.242
PING 52.6.250.242 (52.6.250.242): 1450 data bytes
1458 bytes from 52.6.250.242: icmp_seq=0 ttl=42 time=107.844 ms
1458 bytes from 52.6.250.242: icmp_seq=1 ttl=42 time=105.127 ms
1458 bytes from 52.6.250.242: icmp_seq=2 ttl=42 time=120.483 ms
1458 bytes from 52.6.250.242: icmp_seq=3 ttl=42 time=102.136 ms
2015-05-13 19:03:00 +02:00
Gustav Simonsson
56a5592ea0 Update keystore code comments 2015-05-13 18:33:31 +02:00
Péter Szilágyi
3edc4698fe Merge pull request #954 from karalabe/fix-downloader-nil-panic
eth/downloader: fix nil panic caused by wrong variable use
2015-05-13 18:15:18 +02:00
Péter Szilágyi
910a6d4e46 eth/downloader: fix nil panic caused by wrong variable use 2015-05-13 17:25:01 +03:00
Jeffrey Wilcke
7cb0e24245 Merge pull request #948 from karalabe/fix-downlaoder-activepeer-shadow
eth/downloader: fix active peer shadowing, polish func names
2015-05-13 03:46:29 -07:00
Péter Szilágyi
d2d5dbc6fb eth/downloader: fix active peer shadowing, polish func names 2015-05-13 13:13:43 +03:00
Jeffrey Wilcke
6dec90464d Merge pull request #946 from Gustav-Simonsson/fix_geth_unlock_account
Fix hex conversion in --unlock and log when successful
2015-05-13 01:58:32 -07:00
Gustav Simonsson
b5b53d8b32 Fix hex conversion in --unlock and log when successful 2015-05-13 01:11:17 +02:00
obscuren
28d6b30c0f Merge branch 'release/0.9.20' into develop 2015-05-12 19:05:51 +02:00
obscuren
8fe01b4bfa eth: 100% tx propagation 2015-05-12 19:01:01 +02:00
obscuren
36ce54e5dc cmd/geth: bump version to 0.9.20 2015-05-12 19:01:01 +02:00
Jeffrey Wilcke
d6357aa616 Merge pull request #631 from Gustav-Simonsson/improve_key_store_crypto
Improve key store crypto
2015-05-12 10:00:35 -07:00
Gustav Simonsson
e389585f1f Change default keystore dir 2015-05-12 18:33:04 +02:00
Gustav Simonsson
231fe04f03 Fix address type in js test 2015-05-12 17:48:21 +02:00
Jeffrey Wilcke
58d6ec689f Merge pull request #933 from bas-vk/issue928
replaced path with platform aware filepath module
2015-05-12 08:23:46 -07:00
Gustav Simonsson
037772fc07 fix hex conversion bug in RPC for byte slices 2015-05-12 17:22:17 +02:00
Gustav Simonsson
8001e48115 Fix natspec test (again x2) types 2015-05-12 17:22:17 +02:00
Gustav Simonsson
2c1b0ff17e Update key store to new spec but keep address field for now
* Also fix address types post-rebase
2015-05-12 17:22:17 +02:00
Gustav Simonsson
fe9e95a3fd Fix natspec e2e test accounts type (again) 2015-05-12 17:22:17 +02:00
Gustav Simonsson
940952f757 Fix HEX hack in xeth accounts() 2015-05-12 17:22:17 +02:00
Gustav Simonsson
f98e002d98 Address pull request comments; key header and hex encoding
* Remove key header from unencrypted key file format and replace
  it with a version field
* Change encoding of bytes in key files from base64 to hex
2015-05-12 17:22:17 +02:00
Gustav Simonsson
313eec33ad Revert "Add key header to unencrypted key file"
This reverts commit a94d4ba0b53c4558ab838aaed635a2ff66ddfa53.
2015-05-12 17:19:39 +02:00
Gustav Simonsson
8754f2b768 Fix common.Address / []byte type conversions 2015-05-12 17:19:39 +02:00
Gustav Simonsson
cd88295f5a Add key header to unencrypted key file 2015-05-12 17:19:39 +02:00
Gustav Simonsson
29a5a92d13 Add key header to encrypted keys
* Add key header containing key version, kdf and kdf params
* Store key header as JSON in the key file
* Read in KDF params from key header
* Include key header in MAC calculation and MAC verification
2015-05-12 17:19:39 +02:00
Gustav Simonsson
ac3371bcb6 Correct accounts hex in XETH API 2015-05-12 17:19:39 +02:00
Gustav Simonsson
da9fe951da Use common.Address type for accounts.Address 2015-05-12 17:19:39 +02:00
Gustav Simonsson
6b23094cff Improve key store passphrase crypto
* Change MAC-then-Encrypt to Encrypt-then-MAC
* Change AES256 to AES128
* Use first 16 bytes of KDF derived key for AES and
  remaining 16 for MAC
2015-05-12 17:18:30 +02:00
Gustav Simonsson
9918b6c84e Remove the awesome, ever misunderstood entropy mixing 2015-05-12 17:18:30 +02:00
Jeffrey Wilcke
f87094b660 Merge pull request #932 from obscuren/develop
xeth, rpc: implement eth_estimateGas. Closes #930
2015-05-12 07:26:38 -07:00
obscuren
dca290d525 sol: skipped source checking step 2015-05-12 16:19:14 +02:00
obscuren
ff99752ddd xeth: use same semantics as block processer for transient calls 2015-05-12 15:53:00 +02:00
Bas van Kervel
899df30c24 fixed identing 2015-05-12 15:23:19 +02:00
Bas van Kervel
95773b9673 removed redundant newlines in import block 2015-05-12 15:20:53 +02:00
obscuren
260536a729 rpc: hexData => hexNum 2015-05-12 15:02:44 +02:00
Bas van Kervel
b79dd188d9 replaced several path.* with filepath.* which is platform independent 2015-05-12 14:24:11 +02:00
obscuren
66de3f0aa8 xeth, rpc: implement eth_estimateGas. Closes #930 2015-05-12 14:21:43 +02:00
obscuren
96d4a7d087 eth, ethdb: lower the amount of open files & improve err messages for db
Closes #880
2015-05-12 14:14:56 +02:00
Jeffrey Wilcke
d82caa5ce3 Merge pull request #899 from ethersphere/solc-test-fix
compiler, cli/js: fix solidity compiler tests
2015-05-12 04:16:49 -07:00
zelig
03bf902b92 compiler, cli/js: fix solidity compiler tests failing when a different version of solc installed 2015-05-12 12:36:54 +02:00