Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

[DO NOT MERGE] swarm-network-rewrite merge to master #171

Closed
wants to merge 959 commits into from
Closed
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
959 commits
Select commit Hold shift + click to select a range
97c4b61
swarm: propagate networkid to Bzz protocol
nonsense May 11, 2018
9a14629
swarm/network: unregister peer from Kademlia when handshake fails
nonsense May 11, 2018
5315159
swarm/network: use OverlayAddr. remove Node.Address()
nonsense May 22, 2018
8a67e7d
swarm/network: get rid of Unregister when Handshake fails.
nonsense May 22, 2018
bede043
swarm/pss: Add GetPeer, GetPeerAddress api method
nolash May 22, 2018
09c3ac4
root dir bug
acud May 23, 2018
dc11bad
test pass
acud May 23, 2018
3cf9384
test green on mac again
acud May 23, 2018
15d7cca
and on linux
acud May 23, 2018
ac1ece2
minor refinements
acud May 23, 2018
fc3bb8d
copyright year
acud May 23, 2018
d68fa66
Merge pull request #557 from ethersphere/test-newswarm
zelig May 23, 2018
8a0e671
core/types: avoid duplicating transactions on changing signer (#16435)
countvonzero Apr 24, 2018
c1f1418
core/state: cache missing storage entries (#16584)
fjl Apr 27, 2018
5b77344
cmd/utils: point users to --syncmode under DEPRECATED (#16572)
martinklepsch Apr 27, 2018
ad5bcb3
trie: remove unused `buf` parameter (#16583)
xincaosu Apr 27, 2018
4ba3fe3
core, eth: fix tracer dirty finalization
karalabe Apr 27, 2018
a9d8b74
travis.yml: remove obsolete brew-cask install
reductionista May 1, 2018
d636d86
whisper: Golint fixes in whisper packages (#16637)
roveneliah May 2, 2018
66f4b9c
vendor: fix leveldb crash when bigger than 1 TiB
May 1, 2018
992cfa5
core: ensure local transactions aren't discarded as underpriced
Apr 26, 2018
43a0665
evm/main: use blocknumber from genesis
holiman Apr 26, 2018
268a734
accounts: golint updates for this or self warning (#16627)
kielbarry May 2, 2018
66e23ce
tests: golint fixes for tests directory (#16640)
roveneliah May 2, 2018
c6cd831
trie: golint iterator fixes (#16639)
roveneliah May 2, 2018
5bf6d94
internal: golint updates for this or self warning (#16634)
kielbarry May 2, 2018
012d10b
core: golint updates for this or self warning (#16633)
kielbarry May 2, 2018
de9a332
build: Add ldflags -s -w when building aar
ligi May 2, 2018
8bd57f6
cmd/clef: documentation about setup (#16568)
holiman May 2, 2018
61a805b
params: release geth 1.8.7
karalabe May 2, 2018
b8c08f5
VERSION, params: begin v1.8.8 release cycle
karalabe May 2, 2018
16f683a
log: changed if-else blocks to conform with golint (#16661)
GagziW May 3, 2018
2751f05
p2p: changed if-else blocks to conform with golint (#16660)
GagziW May 3, 2018
548147e
les: changed if-else blocks to conform with golint (#16658)
GagziW May 3, 2018
e878863
accounts: changed if-else blocks to conform with golint (#16654)
GagziW May 3, 2018
a52d5c8
rpc: golint error with context as last parameter (#16657)
kielbarry May 3, 2018
eccbb26
metrics: golint updates for this or self warning (#16635)
kielbarry May 3, 2018
7aa4995
consensus/ethash: fixed typo (#16665)
YH-Zhou May 3, 2018
559dd07
event: golint updates for this or self warning (#16631)
kielbarry May 3, 2018
0fbb878
eth: golint updates for this or self warning (#16632)
kielbarry May 3, 2018
69d72ba
signer: fix golint errors (#16653)
roveneliah May 4, 2018
7183d05
whisper/mailserver: pass init error to the caller (#16671)
divan May 4, 2018
ea1b62c
common: changed if-else blocks to conform with golint (#16656)
GagziW May 7, 2018
12bd9f5
mobile: add GetStatus Method for Receipt (#16598)
erichin May 7, 2018
17a85bd
core/rawdb: separate raw database access to own package (#16666)
karalabe May 7, 2018
4cf8a05
rlp: fix some golint warnings (#16659)
kielbarry May 8, 2018
3cbf767
p2p: fix some golint warnings (#16577)
kielbarry May 8, 2018
48e3261
eth/filters: derive FilterCriteria from ethereum.FilterQuery (#16629)
reductionista May 8, 2018
8f6e4f3
p2p/simulations/adapters: fix websocket log line parsing in exec adap…
divan May 8, 2018
7f0d144
build: specify the key to use when invoking gpg:sign-and-deploy-file …
ligi May 8, 2018
2fbe9dd
crypto: fix golint warnings (#16710)
kielbarry May 8, 2018
f036627
p2p: don't discard reason set by Disconnect (#16559)
gsalgado May 8, 2018
ca3dddc
cmd: various golint fixes (#16700)
kielbarry May 9, 2018
bea6caa
eth: golint fixes to variable names (#16711)
kielbarry May 9, 2018
bc19559
eth/filter: check nil pointer when unsubscribe (#16682)
rjl493456442 May 9, 2018
dca0b9a
whisper/shhclient: update call to shh_generateSymKeyFromPassword to p…
gravityblast May 9, 2018
2b2130b
all: get rid of error when creating memory database (#16716)
rjl493456442 May 9, 2018
7638956
event: document select case slice use and add edge case test (#16680)
fjl May 10, 2018
88524a5
travis: use Android NDK 16b (#16562)
ligi May 10, 2018
ea40876
bmt: golint updates for this or self warning (#16628)
kielbarry May 10, 2018
cd6d63a
light: new CHT for mainnet and ropsten (#16736)
zsfelfoldi May 14, 2018
21d929a
params: release go-ethereum v1.8.8
karalabe May 14, 2018
70d96c4
VERSION, params: start 1.8.9 release cycle
karalabe May 14, 2018
afee1c6
accounts/abi: allow abi: tags when unpacking structs
gballet May 14, 2018
caf7944
travis: try to upgrade android builder to trusty
karalabe May 14, 2018
80a7dd3
p2p/enr: updates for discovery v4 compatibility (#16679)
fjl May 17, 2018
7ebea3d
all: collate new transaction events together
rjl493456442 May 10, 2018
2af7ddf
core, eth: minor txpool event cleanups
karalabe May 18, 2018
5ea8a88
travis, appveyor: bump Go release to 1.10.2
karalabe May 18, 2018
0e96ae8
core, consensus: fix some typos in comment code and output log
hadv May 19, 2018
4aad778
eth: propagate blocks and transactions async
karalabe May 21, 2018
c91a062
trie: fixes to comply with golint (#16771)
kielbarry May 21, 2018
5a313c0
log: fixes for golint warnings (#16775)
kielbarry May 22, 2018
8fdd35f
node: all golint warnings fixed (#16773)
kielbarry May 22, 2018
3e16ed6
vendor, ethdb: print warning log if leveldb is performing compaction …
rjl493456442 May 22, 2018
e795c92
core/types: convert status type from uint to uint64 (#16784)
rjl493456442 May 23, 2018
6f923f6
swarm: Correct ResourceParams instantiation in testutils
nolash May 23, 2018
e80a7fa
swarm/pss: Rename method to GetPeerTopics
nolash May 23, 2018
5448749
receiver name should be a reflection of its identity; don't use gener…
May 23, 2018
ded786b
swarm/pss: Rename GetPeer to GetPublickeyEntries
nolash May 23, 2018
7bc4c8c
pr changes
acud May 23, 2018
4f98c5b
exported method should have comment or be unexported
May 23, 2018
84ee424
fixed logs
acud May 24, 2018
d6264f7
swarm/pss: Refactor to direct api method test
nolash May 24, 2018
74ddda6
swarm/network: fix bzz handshake tests
nonsense May 24, 2018
939ec38
Merge pull request #558 from ethersphere/resource-owner-validator
nolash May 24, 2018
60cf5f7
p2p, swarm: measure number of p2p.Send calls and time them; measure n…
nonsense May 24, 2018
c560b02
fixed log messages
acud May 24, 2018
2aa0c6d
swarm/storage: Change Lookup from name(hash) to key
nolash May 13, 2018
cdb7089
swarm/storage: Revert to name lookup, export LoadResource (takes key)
nolash May 13, 2018
4024f7e
swarm/api, swarm/storage: Rewrite resource api for content addr key
nolash May 13, 2018
5eb4130
swarm/storage: Add function comments
nolash May 14, 2018
d7cbeb1
swarm/api: Consolidate manifest key as entry point for mutable resource
nolash May 14, 2018
3e64c83
swarm/api, swarm/storage: Comment update
nolash May 16, 2018
587d4ef
swarm/api: Delint + typo
nolash May 18, 2018
1c9fbb0
swarm/storage: Add BinaryUnmarshaler to resource
nolash May 20, 2018
cd0dd2e
swarm/storage: Update validator to correct metadata chunk check
nolash May 24, 2018
6ece30c
swarm/storage: Rename indexSize, edit comments
nolash May 24, 2018
afcb96f
Merge pull request #590 from ethersphere/measurements_len_peers_p2p_send
nonsense May 24, 2018
5685cc2
Merge pull request #538 from ethersphere/bzz_networkid_fix
nonsense May 24, 2018
3f166c4
swarm/network/simulations: Skip TestOverlaySim
gbalint May 24, 2018
b262996
p2p, swarm: use different names for counter and timer
nonsense May 24, 2018
52ad151
Merge pull request #597 from ethersphere/fix_counter_timer_naming
nonsense May 24, 2018
2aec12e
Merge pull request #596 from ethersphere/disable-test-overlay-sim
nonsense May 24, 2018
6f2d560
swarm-network-rewrite conflicts with master (#589)
nonsense May 24, 2018
80a29d2
resolved conflicts with master
nonsense May 24, 2018
3565149
Merge pull request #599 from ethersphere/conflicts_with_snr
nonsense May 24, 2018
370e67f
loglevel
acud May 24, 2018
3d7e57b
Merge pull request #541 from ethersphere/resource-rootchunk-refactor
zelig May 24, 2018
3520723
Merge branch 'swarm-network-rewrite' into swarm-network-rewrite-golin…
May 24, 2018
8f584c8
implement recommendation from @nonsense
May 24, 2018
9386c44
Merge pull request #587 from dleonard00/swarm-network-rewrite-golint-…
nonsense May 24, 2018
5ad2d33
Merge pull request #575 from ethersphere/pss-havepeer
nolash May 24, 2018
90b7fb7
Merge pull request #543 from ethersphere/cli-add-fuse
zelig May 25, 2018
1a44f0a
bmt, pot: move into swarm package (#603)
acud May 26, 2018
f9811d2
swarm/network/stream/delivery: byte comparison on error nil (#622)
acud May 26, 2018
e3a63d1
swarm/fuse: do not support relative path for fuse mounting (#629)
acud May 26, 2018
e46cce1
swarm: do not set nil resolver for interface types
janos May 28, 2018
7ceb685
p2p/simulations: Log if watchPeerEvents can't find node
gbalint May 28, 2018
67c3491
Merge pull request #636 from ethersphere/fix-p2psim-panic
zelig May 29, 2018
9d0a463
Rename storage.Key to storage.Address (#643)
gbalint May 29, 2018
2e63d02
swarm: grafana dashboards under vc
nonsense May 29, 2018
9b90911
swarm/storage: Separate mutable resources into separate package
nolash May 21, 2018
02f5d35
swarm/storage: Rename resource to mru
nolash May 23, 2018
1640eff
swarm/storage: godoc
nolash May 24, 2018
e10d359
swarm: Rebase of mru package separate onto resource rootchunk refactor
nolash May 25, 2018
e450099
swarm: Remove "Resource" from mru method and type names
nolash May 29, 2018
9c330a6
Revert "Rename storage.Key to storage.Address (#643)" (#650)
gbalint May 29, 2018
08e35e9
Merge pull request #561 from ethersphere/resource-separate
nolash May 29, 2018
ef4ea15
swarm/storage: Rename storage.Key to storage.Address (#643)
nolash May 29, 2018
7736a44
Merge pull request #651 from ethersphere/swarm-network-rewrite-addrnew
nolash May 29, 2018
63a334f
Merge pull request #635 from ethersphere/fix-resolver-panic
zelig May 30, 2018
374e767
Merge pull request #646 from ethersphere/grafana_dashboards
nonsense May 30, 2018
c35aa32
make topic readable in error messages (#540)
vmaark May 31, 2018
a4487d8
merge master to swarm-network-rewrite (#655)
nonsense Jun 1, 2018
c09a246
swarm/pss: Rename "self" receivers to reflect better their identity
skylenet Jun 3, 2018
af043f7
Rename DPA to FileStore (#660)
gbalint Jun 4, 2018
f2fd16c
Merge pull request #662 from skylenet/pss-self-receivers-refactor
nonsense Jun 4, 2018
20870eb
swarm/api: fix linter error
nonsense Jun 4, 2018
8f706b2
Merge pull request #664 from ethersphere/fix_linter_err
zelig Jun 4, 2018
3e49fde
swarm, swarm/storage: pyramid spilt fix (#661)
janos Jun 5, 2018
bff4657
swarm/pss: Pssmsg flags (#637)
nolash Jun 5, 2018
6ffbfb2
swarm: added copyright headers (#669)
acud Jun 5, 2018
4870d43
swarm/network: scale down test - TestFileRetrieval
nonsense Jun 5, 2018
1093d59
swarm/network: fewer data chunks for tests
nonsense Jun 5, 2018
ca733ef
swarm/storage: fewer tests for chunker
nonsense Jun 5, 2018
131524b
swarm/network: change snapshot to 16 nodes, as there is no snapshot f…
nonsense Jun 5, 2018
be2512c
swarm: TestLocalStoreAndRetrieve optimization with longrunning flag
janos Jun 6, 2018
66b8612
Merge pull request #674 from ethersphere/scale_down_test
nonsense Jun 6, 2018
99ef857
Merge pull request #676 from ethersphere/testlocalstoreandretrieve-lo…
nonsense Jun 6, 2018
6e758ed
swarm/storage: debug for closed channel
nonsense Jun 6, 2018
89eee16
Merge pull request #683 from ethersphere/debug_line_closing_channel
nonsense Jun 6, 2018
620a31c
p2p, swarm: do not log shutting down as error (#679)
nonsense Jun 6, 2018
e5ae94a
swarm/network: disable TestSuggestPeerRetries (#677)
nonsense Jun 6, 2018
40b6017
swarm/pss: add error logging ; amend timeouts (#653)
nonsense Jun 6, 2018
148fe04
swarm/store: ldbstore quit channel to terminate running loops
janos Jun 6, 2018
6cedb53
swarm/storage: ulock LDBStore.lock on quit chan break in writeBatches
janos Jun 6, 2018
6386433
swarm: wrap logger with stats for Warn, Crit and Error
nonsense Jun 6, 2018
f10cb2c
swarm/log: log more useful logline
nonsense Jun 6, 2018
6a659c3
swarm: revert wrapping of logger in tests
nonsense Jun 6, 2018
d934367
swarm/storage: remove spammy log line (#687)
nonsense Jun 7, 2018
86cd38f
swarm/network: Log unexpected db error
gbalint Jun 7, 2018
09ef09e
swarm/network: Add logging to see if chunks to delivered are too shor…
gbalint Jun 7, 2018
0d065f4
swarm/storage: Let's not panic on db error, just log it
gbalint Jun 7, 2018
b81b444
Merge pull request #689 from ethersphere/log-db-error
nonsense Jun 7, 2018
1c945bf
Merge pull request #680 from ethersphere/wrap_logger_with_stats
nonsense Jun 7, 2018
f3ea311
swarm/api/http: implement bufferedReadSeeker and use it in HandleGetF…
janos Jun 7, 2018
27c33bb
p2p/protocols: do not log EOF error
nonsense Jun 8, 2018
eb1550b
Merge pull request #693 from ethersphere/ignore_eof_log
nonsense Jun 8, 2018
65623b1
swarm/storage: close channel only after we have replaced chunk in mem…
nonsense Jun 8, 2018
2e102cb
swarm/storage: get rid of go-routine that waits on <-dbStoredC
nonsense Jun 8, 2018
a96f347
swarm/pss: Increment pss message version
nolash Jun 8, 2018
9d46f81
Merge pull request #686 from ethersphere/ldbstore-quit
zelig Jun 9, 2018
2d9dbed
Merge pull request #695 from ethersphere/fix-panic-closed-channel
zelig Jun 9, 2018
3acc595
swarm/hash: Custom multihash implementation (#633)
nolash Jun 9, 2018
221e5b4
Swarm network rewrite golint warnings (#656)
dleonard00 Jun 11, 2018
d472be2
Merge pull request #698 from ethersphere/pss-version-bump
nonsense Jun 11, 2018
3579fb2
swarm/fuse: disable fuse tests (#692)
nonsense Jun 11, 2018
613436f
swarm/storage: do not close rh.chunkstore
nonsense Jun 11, 2018
f8a65c1
Merge pull request #700 from ethersphere/do_not_close_rh_chunkstore
nonsense Jun 11, 2018
a26b174
swarm/bmt: major braking change in hash
zelig Jun 7, 2018
18992f3
swarm/storage: rename bmt constants referenced
zelig Jun 8, 2018
e4a9351
swarm/api/http: change expected hashes
zelig Jun 9, 2018
3906663
swarm/bmt: fixes, optimisations, comments
zelig Jun 9, 2018
9aa6056
swarm/storage: branches argument is not used, so remove it
nonsense Jun 11, 2018
25afc17
swarm/storage: remove NewTreeSplitterParams as it is just indirection
nonsense Jun 11, 2018
12884f1
swarm/storage: less aritmetics and more explicit initialisation
nonsense Jun 11, 2018
3b10ece
swarm/bmt: address review comments
zelig Jun 11, 2018
9da4f8e
Merge pull request #701 from ethersphere/remove_redundant_argument
nonsense Jun 11, 2018
f239d0d
swarm: cleanup created resources for fuse
holisticode May 30, 2018
5e84607
swarm: refactoring fuse tests
holisticode Jun 1, 2018
80f3cb6
swarm: refactored fuse tests
holisticode Jun 6, 2018
b8580a6
swarm: Sleep after fs.Serve in fuse;avoids deadlocks
holisticode Jun 7, 2018
1f27b44
Merge pull request #691 from ethersphere/bmt
zelig Jun 11, 2018
26762ed
swarm/api/config.go:62:2: struct field NetworkId should be NetworkID
dleonard00 Jun 11, 2018
eb3dd15
swarm/api/config.go:67:2: struct field SwapApi should be SwapAPI
dleonard00 Jun 11, 2018
32bce11
swarm/api/config.go:103:1: receiver name should be a reflection of it…
dleonard00 Jun 11, 2018
bd3e660
swarm/api/filesystem.go:50:1: receiver name should be a reflection of…
dleonard00 Jun 11, 2018
b240650
swarm/api/manifest.go:263:1: receiver name should be a reflection of …
dleonard00 Jun 11, 2018
618aa99
swarm/api/manifest.go:149:5: error var SkipManifest should have name …
dleonard00 Jun 11, 2018
3c75cae
swarm/api/storage.go:48:1: receiver name should be a reflection of it…
dleonard00 Jun 11, 2018
3eafe78
swarm/api/testapi.go:44:1: receiver name should be a reflection of it…
dleonard00 Jun 11, 2018
4067701
swarm/api/http/server.go:88:1: comment on exported function StartHttp…
dleonard00 Jun 11, 2018
cafd0f8
swarm/api/http/error.go:197:9: if block ends with a return statement,…
dleonard00 Jun 11, 2018
6eb7f9e
swarm/api/http/error.go:178:6: func respondHtml should be respondHTML
dleonard00 Jun 11, 2018
fd427f7
swarm/pss/pss.go:932:10: if block ends with a return statement, so dr…
dleonard00 Jun 11, 2018
24865f7
swarm/pss/handshake.go:429:9: if block ends with a return statement, …
dleonard00 Jun 11, 2018
701ef47
swarm/pss/handshake.go:63:2: struct field symKeyId should be symKeyID
dleonard00 Jun 11, 2018
4197023
swarm/storage/types.go:128:1: receiver name addr should be consistent…
dleonard00 Jun 11, 2018
2baad9d
swarm/storage/swarmhasher.go:38:1: receiver name should be a reflecti…
dleonard00 Jun 11, 2018
d7d3d95
swarm/storage/pyramid.go:238:1: receiver name should be a reflection …
dleonard00 Jun 11, 2018
3db2e74
swarm/storage/netstore.go:179:1: receiver name should be a reflection…
dleonard00 Jun 11, 2018
214c36d
swarm/storage/localstore.go:158:1: receiver name should be a reflecti…
dleonard00 Jun 11, 2018
4d30d3b
swarm/storage/hasherstore.go:150:1: receiver name p should be consist…
dleonard00 Jun 11, 2018
40bb0be
swarm/storage/filestore.go:90:1: receiver name should be a reflection…
dleonard00 Jun 11, 2018
8d0b6fe
swarm/storage/dbapi.go:50:1: receiver name should be a reflection of …
dleonard00 Jun 11, 2018
85dadfb
swarm/storage/database.go:72:1: receiver name should be a reflection …
dleonard00 Jun 11, 2018
14183e9
swarm/storage/chunker.go:534:1: receiver name should be a reflection …
dleonard00 Jun 11, 2018
e949a22
swarm/storage/mru/resource.go:935:1: receiver name should be a reflec…
dleonard00 Jun 11, 2018
22ce5d0
swarm/network: bump up bzz protocol version to 4, because of BMT hashes
nonsense Jun 12, 2018
030bdeb
swarm/network: increase protocol version for `stream` and `hive`
nonsense Jun 12, 2018
ab4a8d0
swarm: removed flag for mac fuse unmount
holisticode Jun 12, 2018
ec10755
Fix storage benchmark tests (#708)
gbalint Jun 12, 2018
7977387
Merge pull request #706 from MainframeHQ/swarm-network-rewrite-golint2
nonsense Jun 12, 2018
39ddeeb
Merge pull request #707 from ethersphere/bump_up_bzz_proto_version
nonsense Jun 12, 2018
735749c
swarm/pss: move EnableMetrics away from testutil
nonsense Jun 12, 2018
babe5a2
Merge pull request #652 from holisticode/fuse-stall
holisticode Jun 12, 2018
169b2b1
swarm/storage: detect potential panics on short chunk data (#711)
janos Jun 12, 2018
bda34fe
swarm/api/http: set ETag header with correct syntax
janos Jun 13, 2018
e554dd6
Merge pull request #714 from ethersphere/etag-fix
zelig Jun 13, 2018
ba22f7f
Merge pull request #712 from ethersphere/move_enablemetrics_to_pss
nonsense Jun 14, 2018
12735ca
resolved conflicts
nonsense Jun 14, 2018
fec74a7
swarm/pss: replace ToECDSAPub with error-checking func UnmarshalPubkey
nonsense Jun 14, 2018
b01b363
swarm/storage: downgrade 'invalid content address' error to trace log…
janos Jun 14, 2018
d151d9e
Merge pull request #716 from ethersphere/master_to_snrw
nonsense Jun 14, 2018
3ad9d21
vendor: remove unused libraries
nonsense Jun 14, 2018
a71046c
Merge pull request #717 from ethersphere/sync_snr_with_master
nonsense Jun 14, 2018
9d35ceb
swarm, swarm/storage: handle compress edge cases in pyramid chunker (…
janos Jun 14, 2018
bb26ae1
swarm/api: update log.Output to report meaningful log line
nonsense Jun 15, 2018
be1516f
swarm/storage: fix lint warning in Validate function (#721)
janos Jun 15, 2018
f4d0128
Merge pull request #720 from ethersphere/correct_calldepth_for_output
zelig Jun 15, 2018
11c5cbd
swarm/pss: Update benchmark tests
nolash Jun 15, 2018
2ba153e
just change the background color as per the suggestion by @homotopyco…
dleonard00 Jun 15, 2018
86c5515
Merge pull request #724 from MainframeHQ/redesign-error-page
zelig Jun 16, 2018
d1de7b7
swarm/api/http: add tests for buffered http get for both bzz and bzz-raw
janos Jun 18, 2018
ee666bf
swarm/api/http: raise the tolerance for buffered get tests results
janos Jun 18, 2018
3c3731f
Merge branch 'master' into swarm-network-rewrite
gbalint Jun 19, 2018
1039a4b
Merge pull request #725 from ethersphere/bufferedget-test
zelig Jun 19, 2018
303966c
Merge pull request #723 from ethersphere/pss-benchmark-frenzy
zelig Jun 19, 2018
66ff122
Merge branch 'master' into swarm-network-rewrite
gbalint Jun 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 57 additions & 14 deletions cmd/swarm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"reflect"
"strconv"
"strings"
"time"
"unicode"

cli "gopkg.in/urfave/cli.v1"
Expand Down Expand Up @@ -58,19 +59,25 @@ var (

//constants for environment variables
const (
SWARM_ENV_CHEQUEBOOK_ADDR = "SWARM_CHEQUEBOOK_ADDR"
SWARM_ENV_ACCOUNT = "SWARM_ACCOUNT"
SWARM_ENV_LISTEN_ADDR = "SWARM_LISTEN_ADDR"
SWARM_ENV_PORT = "SWARM_PORT"
SWARM_ENV_NETWORK_ID = "SWARM_NETWORK_ID"
SWARM_ENV_SWAP_ENABLE = "SWARM_SWAP_ENABLE"
SWARM_ENV_SWAP_API = "SWARM_SWAP_API"
SWARM_ENV_SYNC_ENABLE = "SWARM_SYNC_ENABLE"
SWARM_ENV_ENS_API = "SWARM_ENS_API"
SWARM_ENV_ENS_ADDR = "SWARM_ENS_ADDR"
SWARM_ENV_CORS = "SWARM_CORS"
SWARM_ENV_BOOTNODES = "SWARM_BOOTNODES"
GETH_ENV_DATADIR = "GETH_DATADIR"
SWARM_ENV_CHEQUEBOOK_ADDR = "SWARM_CHEQUEBOOK_ADDR"
SWARM_ENV_ACCOUNT = "SWARM_ACCOUNT"
SWARM_ENV_LISTEN_ADDR = "SWARM_LISTEN_ADDR"
SWARM_ENV_PORT = "SWARM_PORT"
SWARM_ENV_NETWORK_ID = "SWARM_NETWORK_ID"
SWARM_ENV_SWAP_ENABLE = "SWARM_SWAP_ENABLE"
SWARM_ENV_SWAP_API = "SWARM_SWAP_API"
SWARM_ENV_SYNC_ENABLE = "SWARM_SYNC_ENABLE"
SWARM_ENV_SYNC_UPDATE_DELAY = "SWARM_ENV_SYNC_UPDATE_DELAY"
SWARM_ENV_ENS_API = "SWARM_ENS_API"
SWARM_ENV_ENS_ADDR = "SWARM_ENS_ADDR"
SWARM_ENV_CORS = "SWARM_CORS"
SWARM_ENV_BOOTNODES = "SWARM_BOOTNODES"
SWARM_ENV_PSS_ENABLE = "SWARM_PSS_ENABLE"
SWARM_ENV_STORE_PATH = "SWARM_STORE_PATH"
SWARM_ENV_STORE_CAPACITY = "SWARM_STORE_CAPACITY"
SWARM_ENV_STORE_CACHE_CAPACITY = "SWARM_STORE_CACHE_CAPACITY"
SWARM_ENV_STORE_RADIUS = "SWARM_STORE_RADIUS"
GETH_ENV_DATADIR = "GETH_DATADIR"
)

// These settings ensure that TOML keys use the same names as Go struct fields.
Expand All @@ -95,7 +102,7 @@ func buildConfig(ctx *cli.Context) (config *bzzapi.Config, err error) {
//check for deprecated flags
checkDeprecated(ctx)
//start by creating a default config
config = bzzapi.NewDefaultConfig()
config = bzzapi.NewConfig()
//first load settings from config file (if provided)
config, err = configFileOverride(config, ctx)
if err != nil {
Expand Down Expand Up @@ -195,6 +202,10 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con
currentConfig.SyncEnabled = true
}

if d := ctx.GlobalDuration(SwarmSyncUpdateDelay.Name); d > 0 {
currentConfig.SyncUpdateDelay = d
}

currentConfig.SwapApi = ctx.GlobalString(SwarmSwapAPIFlag.Name)
if currentConfig.SwapEnabled && currentConfig.SwapApi == "" {
utils.Fatalf(SWARM_ERR_SWAP_SET_NO_API)
Expand All @@ -221,6 +232,26 @@ func cmdLineOverride(currentConfig *bzzapi.Config, ctx *cli.Context) *bzzapi.Con
currentConfig.BootNodes = ctx.GlobalString(utils.BootnodesFlag.Name)
}

if ctx.GlobalIsSet(SwarmPssEnabledFlag.Name) {
currentConfig.PssEnabled = true
}

if storePath := ctx.GlobalString(SwarmStorePath.Name); storePath != "" {
currentConfig.StoreParams.ChunkDbPath = storePath
}

if storeCapacity := ctx.GlobalUint64(SwarmStoreCapacity.Name); storeCapacity != 0 {
currentConfig.StoreParams.DbCapacity = storeCapacity
}

if storeCacheCapacity := ctx.GlobalUint(SwarmStoreCacheCapacity.Name); storeCacheCapacity != 0 {
currentConfig.StoreParams.CacheCapacity = storeCacheCapacity
}

if storeRadius := ctx.GlobalInt(SwarmStoreRadius.Name); storeRadius != 0 {
currentConfig.StoreParams.Radius = storeRadius
}

return currentConfig

}
Expand Down Expand Up @@ -268,6 +299,12 @@ func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) {
}
}

if v := os.Getenv(SWARM_ENV_SYNC_UPDATE_DELAY); v != "" {
if d, err := time.ParseDuration(v); err != nil {
currentConfig.SyncUpdateDelay = d
}
}

if swapapi := os.Getenv(SWARM_ENV_SWAP_API); swapapi != "" {
currentConfig.SwapApi = swapapi
}
Expand All @@ -292,6 +329,12 @@ func envVarsOverride(currentConfig *bzzapi.Config) (config *bzzapi.Config) {
currentConfig.BootNodes = bootnodes
}

if pssenable := os.Getenv(SWARM_ENV_PSS_ENABLE); pssenable != "" {
if ps, err := strconv.ParseBool(pssenable); err != nil {
currentConfig.PssEnabled = ps
}
}

return currentConfig
}

Expand Down
65 changes: 43 additions & 22 deletions cmd/swarm/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (

func TestDumpConfig(t *testing.T) {
swarm := runSwarm(t, "dumpconfig")
defaultConf := api.NewDefaultConfig()
defaultConf := api.NewConfig()
out, err := tomlSettings.Marshal(&defaultConf)
if err != nil {
t.Fatal(err)
Expand All @@ -43,7 +43,7 @@ func TestDumpConfig(t *testing.T) {
swarm.ExpectExit()
}

func TestFailsSwapEnabledNoSwapApi(t *testing.T) {
func TestConfigFailsSwapEnabledNoSwapApi(t *testing.T) {
flags := []string{
fmt.Sprintf("--%s", SwarmNetworkIdFlag.Name), "42",
fmt.Sprintf("--%s", SwarmPortFlag.Name), "54545",
Expand All @@ -55,7 +55,7 @@ func TestFailsSwapEnabledNoSwapApi(t *testing.T) {
swarm.ExpectExit()
}

func TestFailsNoBzzAccount(t *testing.T) {
func TestConfigFailsNoBzzAccount(t *testing.T) {
flags := []string{
fmt.Sprintf("--%s", SwarmNetworkIdFlag.Name), "42",
fmt.Sprintf("--%s", SwarmPortFlag.Name), "54545",
Expand All @@ -66,7 +66,7 @@ func TestFailsNoBzzAccount(t *testing.T) {
swarm.ExpectExit()
}

func TestCmdLineOverrides(t *testing.T) {
func TestConfigCmdLineOverrides(t *testing.T) {
dir, err := ioutil.TempDir("", "bzztest")
if err != nil {
t.Fatal(err)
Expand All @@ -86,6 +86,7 @@ func TestCmdLineOverrides(t *testing.T) {
fmt.Sprintf("--%s", SwarmNetworkIdFlag.Name), "42",
fmt.Sprintf("--%s", SwarmPortFlag.Name), httpPort,
fmt.Sprintf("--%s", SwarmSyncEnabledFlag.Name),
fmt.Sprintf("--%s", SwarmPssEnabledFlag.Name),
fmt.Sprintf("--%s", CorsStringFlag.Name), "*",
fmt.Sprintf("--%s", SwarmAccountFlag.Name), account.Address.String(),
fmt.Sprintf("--%s", EnsAPIFlag.Name), "",
Expand Down Expand Up @@ -128,14 +129,18 @@ func TestCmdLineOverrides(t *testing.T) {
t.Fatal("Expected Sync to be enabled, but is false")
}

if !info.PssEnabled {
t.Fatal("Expected Pss to be enabled, but is false")
}

if info.Cors != "*" {
t.Fatalf("Expected Cors flag to be set to %s, got %s", "*", info.Cors)
}

node.Shutdown()
}

func TestFileOverrides(t *testing.T) {
func TestConfigFileOverrides(t *testing.T) {

// assign ports
httpPort, err := assignTCPPort()
Expand All @@ -145,16 +150,17 @@ func TestFileOverrides(t *testing.T) {

//create a config file
//first, create a default conf
defaultConf := api.NewDefaultConfig()
defaultConf := api.NewConfig()
//change some values in order to test if they have been loaded
defaultConf.SyncEnabled = true
defaultConf.PssEnabled = true
defaultConf.NetworkId = 54
defaultConf.Port = httpPort
defaultConf.StoreParams.DbCapacity = 9000000
defaultConf.ChunkerParams.Branches = 64
defaultConf.HiveParams.CallInterval = 6000000000
defaultConf.HiveParams.KeepAliveInterval = 6000000000
defaultConf.Swap.Params.Strategy.AutoCashInterval = 600 * time.Second
defaultConf.SyncParams.KeyBufferSize = 512
//defaultConf.SyncParams.KeyBufferSize = 512
//create a TOML string
out, err := tomlSettings.Marshal(&defaultConf)
if err != nil {
Expand Down Expand Up @@ -223,6 +229,10 @@ func TestFileOverrides(t *testing.T) {
t.Fatal("Expected Sync to be enabled, but is false")
}

if !info.PssEnabled {
t.Fatal("Expected Pss to be enabled, but is false")
}

if info.StoreParams.DbCapacity != 9000000 {
t.Fatalf("Expected network ID to be %d, got %d", 54, info.NetworkId)
}
Expand All @@ -231,22 +241,22 @@ func TestFileOverrides(t *testing.T) {
t.Fatalf("Expected chunker params branches to be %d, got %d", 64, info.ChunkerParams.Branches)
}

if info.HiveParams.CallInterval != 6000000000 {
t.Fatalf("Expected HiveParams CallInterval to be %d, got %d", uint64(6000000000), uint64(info.HiveParams.CallInterval))
if info.HiveParams.KeepAliveInterval != 6000000000 {
t.Fatalf("Expected HiveParams KeepAliveInterval to be %d, got %d", uint64(6000000000), uint64(info.HiveParams.KeepAliveInterval))
}

if info.Swap.Params.Strategy.AutoCashInterval != 600*time.Second {
t.Fatalf("Expected SwapParams AutoCashInterval to be %ds, got %d", 600, info.Swap.Params.Strategy.AutoCashInterval)
}

if info.SyncParams.KeyBufferSize != 512 {
t.Fatalf("Expected info.SyncParams.KeyBufferSize to be %d, got %d", 512, info.SyncParams.KeyBufferSize)
}
// if info.SyncParams.KeyBufferSize != 512 {
// t.Fatalf("Expected info.SyncParams.KeyBufferSize to be %d, got %d", 512, info.SyncParams.KeyBufferSize)
// }

node.Shutdown()
}

func TestEnvVars(t *testing.T) {
func TestConfigEnvVars(t *testing.T) {
// assign ports
httpPort, err := assignTCPPort()
if err != nil {
Expand All @@ -258,6 +268,7 @@ func TestEnvVars(t *testing.T) {
envVars = append(envVars, fmt.Sprintf("%s=%s", SwarmNetworkIdFlag.EnvVar, "999"))
envVars = append(envVars, fmt.Sprintf("%s=%s", CorsStringFlag.EnvVar, "*"))
envVars = append(envVars, fmt.Sprintf("%s=%s", SwarmSyncEnabledFlag.EnvVar, "true"))
envVars = append(envVars, fmt.Sprintf("%s=%s", SwarmPssEnabledFlag.EnvVar, "true"))

dir, err := ioutil.TempDir("", "bzztest")
if err != nil {
Expand Down Expand Up @@ -338,11 +349,15 @@ func TestEnvVars(t *testing.T) {
t.Fatal("Expected Sync to be enabled, but is false")
}

if !info.PssEnabled {
t.Fatal("Expected Pss to be enabled, but is false")
}

node.Shutdown()
cmd.Process.Kill()
}

func TestCmdLineOverridesFile(t *testing.T) {
func TestConfigCmdLineOverridesFile(t *testing.T) {

// assign ports
httpPort, err := assignTCPPort()
Expand All @@ -352,16 +367,17 @@ func TestCmdLineOverridesFile(t *testing.T) {

//create a config file
//first, create a default conf
defaultConf := api.NewDefaultConfig()
defaultConf := api.NewConfig()
//change some values in order to test if they have been loaded
defaultConf.SyncEnabled = false
defaultConf.PssEnabled = false
defaultConf.NetworkId = 54
defaultConf.Port = "8588"
defaultConf.StoreParams.DbCapacity = 9000000
defaultConf.ChunkerParams.Branches = 64
defaultConf.HiveParams.CallInterval = 6000000000
defaultConf.HiveParams.KeepAliveInterval = 6000000000
defaultConf.Swap.Params.Strategy.AutoCashInterval = 600 * time.Second
defaultConf.SyncParams.KeyBufferSize = 512
//defaultConf.SyncParams.KeyBufferSize = 512
//create a TOML file
out, err := tomlSettings.Marshal(&defaultConf)
if err != nil {
Expand Down Expand Up @@ -393,6 +409,7 @@ func TestCmdLineOverridesFile(t *testing.T) {
fmt.Sprintf("--%s", SwarmNetworkIdFlag.Name), "77",
fmt.Sprintf("--%s", SwarmPortFlag.Name), httpPort,
fmt.Sprintf("--%s", SwarmSyncEnabledFlag.Name),
fmt.Sprintf("--%s", SwarmPssEnabledFlag.Name),
fmt.Sprintf("--%s", SwarmTomlConfigPathFlag.Name), f.Name(),
fmt.Sprintf("--%s", SwarmAccountFlag.Name), account.Address.String(),
"--ens-api", "",
Expand Down Expand Up @@ -443,18 +460,22 @@ func TestCmdLineOverridesFile(t *testing.T) {
t.Fatalf("Expected chunker params branches to be %d, got %d", 64, info.ChunkerParams.Branches)
}

if info.HiveParams.CallInterval != 6000000000 {
t.Fatalf("Expected HiveParams CallInterval to be %d, got %d", uint64(6000000000), uint64(info.HiveParams.CallInterval))
if info.HiveParams.KeepAliveInterval != 6000000000 {
t.Fatalf("Expected HiveParams KeepAliveInterval to be %d, got %d", uint64(6000000000), uint64(info.HiveParams.KeepAliveInterval))
}

if info.Swap.Params.Strategy.AutoCashInterval != 600*time.Second {
t.Fatalf("Expected SwapParams AutoCashInterval to be %ds, got %d", 600, info.Swap.Params.Strategy.AutoCashInterval)
}

if info.SyncParams.KeyBufferSize != 512 {
t.Fatalf("Expected info.SyncParams.KeyBufferSize to be %d, got %d", 512, info.SyncParams.KeyBufferSize)
if !info.PssEnabled {
t.Fatal("Expected Pss to be enabled, but is false")
}

// if info.SyncParams.KeyBufferSize != 512 {
// t.Fatalf("Expected info.SyncParams.KeyBufferSize to be %d, got %d", 512, info.SyncParams.KeyBufferSize)
// }

node.Shutdown()
}

Expand Down
23 changes: 12 additions & 11 deletions cmd/swarm/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ import (
"path/filepath"

"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/swarm/storage"
"gopkg.in/urfave/cli.v1"
)

func dbExport(ctx *cli.Context) {
args := ctx.Args()
if len(args) != 2 {
utils.Fatalf("invalid arguments, please specify both <chunkdb> (path to a local chunk database) and <file> (path to write the tar archive to, - for stdout)")
if len(args) != 3 {
utils.Fatalf("invalid arguments, please specify both <chunkdb> (path to a local chunk database), <file> (path to write the tar archive to, - for stdout) and the base key")
}

store, err := openDbStore(args[0])
store, err := openLDBStore(args[0], common.Hex2Bytes(args[2]))
if err != nil {
utils.Fatalf("error opening local chunk database: %s", err)
}
Expand Down Expand Up @@ -62,11 +63,11 @@ func dbExport(ctx *cli.Context) {

func dbImport(ctx *cli.Context) {
args := ctx.Args()
if len(args) != 2 {
utils.Fatalf("invalid arguments, please specify both <chunkdb> (path to a local chunk database) and <file> (path to read the tar archive from, - for stdin)")
if len(args) != 3 {
utils.Fatalf("invalid arguments, please specify both <chunkdb> (path to a local chunk database), <file> (path to read the tar archive from, - for stdin) and the base key")
}

store, err := openDbStore(args[0])
store, err := openLDBStore(args[0], common.Hex2Bytes(args[2]))
if err != nil {
utils.Fatalf("error opening local chunk database: %s", err)
}
Expand Down Expand Up @@ -94,11 +95,11 @@ func dbImport(ctx *cli.Context) {

func dbClean(ctx *cli.Context) {
args := ctx.Args()
if len(args) != 1 {
utils.Fatalf("invalid arguments, please specify <chunkdb> (path to a local chunk database)")
if len(args) != 2 {
utils.Fatalf("invalid arguments, please specify <chunkdb> (path to a local chunk database) and the base key")
}

store, err := openDbStore(args[0])
store, err := openLDBStore(args[0], common.Hex2Bytes(args[1]))
if err != nil {
utils.Fatalf("error opening local chunk database: %s", err)
}
Expand All @@ -107,10 +108,10 @@ func dbClean(ctx *cli.Context) {
store.Cleanup()
}

func openDbStore(path string) (*storage.DbStore, error) {
func openLDBStore(path string, basekey []byte) (*storage.LDBStore, error) {
if _, err := os.Stat(filepath.Join(path, "CURRENT")); err != nil {
return nil, fmt.Errorf("invalid chunkdb path: %s", err)
}
hash := storage.MakeHashFunc("SHA3")
return storage.NewDbStore(path, hash, 10000000, 0)
return storage.NewLDBStore(path, hash, 10000000, func(k storage.Key) (ret uint8) { return uint8(storage.Proximity(basekey[:], k[:])) })
}
Loading