Commit Graph

205 Commits

Author SHA1 Message Date
gluk256 a9e4a90d57 whisper: change the whisper message format so as to add the payload size (#15870)
* whisper: message format changed

* whisper: tests fixed

* whisper: style fixes

* whisper: fixed names, fixed failing tests

* whisper: fix merge issue in #15870

Occured while using the github online merge tool. Lesson learned.

* whisper: fix a gofmt error for #15870
2018-01-30 10:55:08 +02:00
Guillaume Ballet 367c329b88 whisper: remove linter warnings (#15972)
* whisper: fixes warnings from the code linter

* whisper: more non-API-breaking changes

The remaining lint errors are because of auto-generated
files and one is because an exported function has a non-
exported return type. Changing this would break the API,
and will be part of another commit for easier reversal.

* whisper: un-export NewSentMessage to please the linter

This is an API change, which is why it's in its own commit.
This change was initiated after the linter complained that
the returned type wasn't exported. I chose to un-export
the function instead of exporting the type, because that
type is an implementation detail that I would like to
change in the near future to make the code more
readable and with an increased coverage.

* whisper: update gencodec output after upgrading it to new lint standards
2018-01-26 13:45:10 +02:00
b00ris 2ef3815af4 whisper: fix empty topic (#15811)
* whisper: fix empty topic

* whisper: add check to matchSingleTopic

* whisper: add tests

* whisper: fix gosimple

* whisper: added lastTopicByte const
2018-01-26 13:41:53 +02:00
gluk256 fd869dc839 whisper/whisperv6: implement pow/bloom exchange protocol (#15802)
This is the main feature of v6.
2018-01-12 12:11:22 +01:00
Felix Lange 9d06026c19 all: regenerate codecs with gencodec commit 90983d99de (#15830)
Fixes #15777 because null is now allowed for hexutil.Bytes.
2018-01-08 15:13:22 +02:00
Furkan KAMACI b8caba9709 various: remove redundant parentheses (#15793) 2018-01-03 14:14:47 +02:00
Péter Szilágyi b98aa3b4f1 whisper/whisper2: fix Go 1.10 vet issues on type mismatches (#15783) 2018-01-02 11:13:24 +01:00
gluk256 38b1e8ee20 whisper/whisperv6: PoW requirement (#15701)
New Whisper-level message introduced (PoW requirement),
corresponding logic added, plus some tests.
2017-12-21 15:17:27 +01:00
gluk256 9f1007e554 whisper/whisperv6: message bundling (#15666)
Changed the communication protocol for ordinary message,
according to EIP 627. Messages will be send in bundles, i.e.
array of messages will be sent instead of single message.
2017-12-21 10:31:44 +01:00
Zach 3da1bf8ca1 all: use gometalinter.v2, fix new gosimple issues (#15650) 2017-12-12 19:05:47 +01:00
Guillaume Ballet e7610eadfe whisper: sym encryption message padding includes salt (#15631)
Now that the AES salt has been moved to the payload, padding must
be adjusted to hide it, lest an attacker guesses that the packet
uses symmetric encryption.
2017-12-11 12:32:58 +01:00
Guillaume Ballet bf62acf033 whisper/whisperv6: remove Version from the envelope (#15621) 2017-12-08 16:08:56 +01:00
Guillaume Ballet d95962cd5d whisper/whisperv6: remove aesnonce (#15578)
As per EIP-627, the salt for symmetric encryption is now
part of the payload. This commit does that.
2017-12-08 11:40:59 +01:00
Guillaume Ballet 20fe928914 whisper: rename EnvNonce to Nonce in the v6 Envelope (#15579) 2017-12-01 12:50:19 +01:00
ferhat elmas 86f6568f66 build: enable unconvert linter (#15456)
* build: enable unconvert linter

 - fixes #15453
 - update code base for failing cases

* cmd/puppeth: replace syscall.Stdin with os.Stdin.Fd() for unconvert linter
2017-11-10 19:06:45 +02:00
gluk256 9f7cd75682 whisper/whisperv6: initial commit (clone of v5) (#15324) 2017-11-03 21:29:49 +01:00
baizhenxuan eea996e4e1 whisper/shhclient: fix Version return type (#15306) 2017-10-18 11:16:12 +02:00
Guillaume Ballet 7a045af05b whisper/whisperv5: set filter SymKeyHash on creation (#15165) 2017-10-06 16:04:21 +02:00
Noman e311bb520a whisper: Fix spelling and grammar in error (#15009)
* whisper: Fix spelling and grammar in error

* whisper: Fix grammar in comments
2017-08-21 12:22:00 +03:00
Egon Elbre d375193797 whisper: fix megacheck warnings (#14925)
* whisper: fix megacheck warnings

* whisper/whisperv5: regenerate json codec to fix unused override type
2017-08-08 14:48:06 +03:00
Bas van Kervel b6e99deee9 whisper: renamed Info#Message to Info#Messages 2017-06-23 09:18:02 +02:00
Bas van Kervel c62d5422bb whisper: use hexutil.UnmarshalFixedText for topic parsing 2017-06-21 12:58:00 +02:00
Bas van Kervel a4e4c76cb3 whisper: use syncmap for dynamic configuration options 2017-06-21 11:15:47 +02:00
Bas van Kervel 7a11e86442 whisper: move flags from whisper package to utils 2017-06-21 10:49:14 +02:00
Bas van Kervel 4a1d516d78 whisper: renamed errors 2017-06-21 10:32:36 +02:00
Bas van Kervel b6b0e00198 whisper: fallback to default config if none is specified 2017-06-21 10:24:34 +02:00
Bas van Kervel 3d66ba56ef whisper: remove obsolete api tests 2017-06-21 10:23:45 +02:00
Bas van Kervel 767dc6c73d whisper: remove gencodec override for config 2017-06-21 10:11:54 +02:00
Bas van Kervel 36e7963467 whisper: move ShhClient to its own package 2017-06-21 10:11:46 +02:00
Bas van Kervel b58a501673 whisperv5: integrate whisper and add whisper RPC simulator 2017-06-15 11:53:15 +02:00
gluk256 f9be9a2302 whisper: switching to v5 + minor refactoring (#14387) 2017-04-28 11:57:15 +02:00
gluk256 95f0bd0acf whisper: message format refactoring (#14335)
* whisper: salt removed from AES encryption
* whisper: padding format updated
* whisper: padding test added
* whisper: padding refactored, tests fixed
* whisper: padding test updated
* whisper: wnode bugfix
* whisper: send/receive protocol updated
* whisper: minor update
* whisper: bugfix in test
* whisper: updated parameter names and comments
* whisper: functions renamed
* whisper: minor refactoring
2017-04-26 21:05:48 +02:00
Felix Lange 0cc492f815 all: update license information 2017-04-14 10:29:00 +02:00
gluk256 9cd7135516 whisper: big refactoring (#13852)
* whisper: GetMessages fixed; size restriction updated
* whisper: made PoW and MaxMsgSize customizable
* whisper: test added
* whisper: sym key management changed
* whisper: identity management refactored
* whisper: API refactoring (Post and Filter)
* whisper: big refactoring complete
* whisper: spelling fix
* whisper: variable topic size allowed for a filter
* whisper: final update
* whisper: formatting
* whisper: file exchange introduced in wnode
* whisper: bugfix
* whisper: API updated + new tests
* whisper: statistics updated
* whisper: wnode server updated
* whisper: allowed filtering for variable topic size
* whisper: tests added
* whisper: resolving merge conflicts
* whisper: refactoring (documenting mostly)
* whsiper: tests fixed
* whisper: down cased error messages
* whisper: documenting the API functions
* whisper: logging fixed
* whisper: fixed wnode parameters
* whisper: logs fixed (typos)
2017-04-09 23:49:22 +02:00
Felix Lange f1534f5797 trie, whisper/whisperv5: use math/rand Read function 2017-03-22 20:49:15 +01:00
Felix Lange 5c8fe28b72 common: move big integer math to common/math (#3699)
* 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
2017-02-26 22:21:51 +01:00
gluk256 562ccff822 whisper: fixed temporary directory for tests (#3707) 2017-02-24 09:21:01 +01:00
gluk256 11539030cd whisper: expiry refactoring (#3706) 2017-02-23 18:46:32 +01:00
Péter Szilágyi 1ca20a2697
cmd, whisper/mailserver: revert to utils.Fatalf 2017-02-23 12:16:46 +02:00
Péter Szilágyi d4fd06c3dc
all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00
gluk256 29fac7de44 Whisper API fixed (#3687)
* whisper: wnode updated for tests with geth

* whisper: updated processing of incoming messages

* whisper: symmetric encryption updated

* whisper: filter id type changed to enhance security

* whisper: allow filter without topic for asymmetric encryption

* whisper: POW updated

* whisper: logging updated

* whisper: spellchecker update

* whisper: error handling changed

* whisper: JSON field names fixed
2017-02-23 09:41:47 +01:00
Felix Lange 9b0af51386 crypto: add btcec fallback for sign/recover without cgo (#3680)
* vendor: add github.com/btcsuite/btcd/btcec

* crypto: add btcec fallback for sign/recover without cgo

This commit adds a non-cgo fallback implementation of secp256k1
operations.

* crypto, core/vm: remove wrappers for sha256, ripemd160
2017-02-18 09:24:12 +01:00
gluk256 15a609d5d6 whisper: interface changed to simplify the transition to v5
* whisper: mailserver test introduced, refactoring

* whisper: validation test updated

* whisper: max number of peers fixed

* whisper: verification bug fixed

* whisper: esthetic fix

* whisper: interface changed to simplify the transition to v5

* whisper: preparation for version switch
2017-02-14 16:44:47 +02:00
gluk256 65ed6a9def whisper: add tests for mailserver (#3631) 2017-02-13 13:15:20 +01:00
gluk256 690f6ea1d7 cmd/wnode, whisper: add whisper CLI tool and mail server (#3580) 2017-01-31 11:16:20 +01:00
Felix Lange b9b3efb09f all: fix ineffectual assignments and remove uses of crypto.Sha3
go get github.com/gordonklaus/ineffassign
ineffassign .
2017-01-09 16:24:42 +01:00
Péter Szilágyi 18c77744ff
all: fix spelling errors 2017-01-06 19:44:35 +02:00
Felix Lange f2da6581ba all: fix issues reported by honnef.co/go/simple/cmd/gosimple 2017-01-06 18:18:07 +01:00
Felix Lange 35a7dcb162 all: gofmt -w -s 2017-01-06 15:52:03 +01:00
Felix Lange cf71f5cd60 rpc: remove HexNumber, replace all uses with hexutil types
This change couldn't be automated because HexNumber was used for numbers
of all sizes.
2016-12-20 14:41:58 +01:00
Felix Lange adab2e16bd rpc: remove HexBytes, replace all uses with hexutil.Bytes 2016-12-20 14:35:26 +01:00
gluk256 ba996f5e27 whisper: refactoring (#3411)
* whisper: refactored message processing
* whisper: final polishing
* whisper: logging updated
* whisper: moved the check, changed the default PoW
* whisper: refactoring of message queuing
* whisper: refactored parameters
2016-12-20 00:58:01 +01:00
gluk256 2dcf75a722 whisper/shhapi, whisper/whisperv5: refactoring (#3364)
* Filter refactoring
* API tests added + bugfix
* fixed the error logs
* FilterID fixed
* test cases fixed
* key generation updated
* POW updated
* got rid of redundant stuff
2016-12-01 20:09:22 +01:00
gluk256 79789af2e7 whisper: project restructured, version 5 introduced (#3022)
whisper: project restructured, version 5 introduced

This commits adds a draft version of the new shh v5 protocol.
The new version is not on by default, --shh still selects version 2.
2016-10-29 14:11:37 +02:00
Felix Lange 6197fbf8d7 Merge pull request #2458 from fjl/go-vet
all: fix go vet warnings
2016-04-15 13:45:15 +02:00
Felix Lange 3a5bdef962 whisper: deflake Test*MessageExpiration
These tests have become a common annoyance on CI. Fix them by allowing
messages with expiration == now into the cache and delaying the check
for expired message handling slightly.
2016-04-15 13:28:46 +02:00
Felix Lange 6fdd0893c3 all: fix go vet warnings 2016-04-15 11:17:27 +02:00
Felix Lange d04a2e7557 all: update license information 2016-04-15 09:48:05 +02:00
Bas van Kervel aa9fff3e68 rpc: various fixes/enhancements
rpc: be less restrictive on the request id
rpc: improved documentation
console: upgrade web3.js to version 0.16.0
rpc: cache http connections
rpc: rename wsDomains parameter to wsOrigins
2016-04-12 11:02:39 +02:00
Ricardo Catalinas Jiménez 436fc8d76a all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()
As we aren't really using the standarized SHA-3
2016-02-21 22:34:34 +00:00
Bas van Kervel 19b2640e89 rpc: migrated the RPC insterface to a new reflection based RPC layer 2016-01-26 13:51:50 +01:00
Felix Lange fa187a366d Merge pull request #2035 from bas-vk/rcp-v2-rebase
rpc: new RPC implementation with pub/sub support
2015-12-14 17:38:10 +01:00
Bas van Kervel eae81465c1 rpc: new RPC implementation with pub/sub support 2015-12-14 16:34:05 +01:00
Gustav Simonsson c8ad64f33c crypto, crypto/ecies, crypto/secp256k1: libsecp256k1 scalar mult
thanks to Felix Lange (fjl) for help with design & impl
2015-11-30 13:43:32 +01:00
Péter Szilágyi 1e806c4c77 cmd, common, core, eth, node, rpc, tests, whisper, xeth: use protocol stacks 2015-11-27 11:06:12 +02:00
Jeffrey Wilcke 5f0a4416db whisper: fixed broadcast race
Whisper's expire and broadcast loops happen in two separate go routines.
Whenever an envelope is being expired it's removed from the set of
envelopes and it looses all information about the envelope, including
the "known hash". After the envelope has been removed it can be
re-accepted by a broadcasting peer putting back the envelope in the set
of envelopes. Since the envelope broadcast loop is separate of the
expire loop expired messages may be broadcast to other peer, resulting
in messages **never** being dropped.

This PR includes an expire check before adding new messages to the set
of envelopes.
2015-11-25 12:10:47 +01:00
Péter Szilágyi 60e0abb595 whisper: fix datarace in expiration test 2015-11-05 13:36:25 +02:00
Felix Lange bfbcfbe4a9 all: fix license headers one more time
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
2015-07-23 18:35:11 +02:00
Felix Lange 3f047be5aa all: update license headers to distiguish GPL/LGPL
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
2015-07-22 18:51:45 +02:00
Felix Lange ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Felix Lange 6a2fec5309 p2p, whisper: use glog for peer-level logging 2015-05-06 23:19:14 +02:00
Péter Szilágyi 2b9fd6b40a whisper: add full filter test suite 2015-04-28 10:49:05 +03:00
Péter Szilágyi 406e74e2af whisper: fix a small data race duirng peer connection 2015-04-28 10:49:05 +03:00
Péter Szilágyi db615a85ec ui/qt/qwhisper, whisper, xeth: polish topic filter, fix wildcards 2015-04-28 10:49:04 +03:00
Péter Szilágyi ae4bfc3cfb rpc, ui/qt/qwhisper, whisper, xeth: introduce complex topic filters 2015-04-28 10:49:04 +03:00
Péter Szilágyi 15586368e5 whisper: fix spurious From identity with untargeted messages 2015-04-28 10:49:04 +03:00
Péter Szilágyi 87447f9f3f whisper: fix payload loss in case of plaintext decrypt 2015-04-28 10:49:04 +03:00
Péter Szilágyi 7f48eb8737 whisper, xeth/whisper: surface TTL and hash to the API 2015-04-28 10:49:04 +03:00
Péter Szilágyi 7948cc0029 rpc, whisper, xeth: fix RPC message retrieval data race 2015-04-28 10:47:35 +03:00
Péter Szilágyi 5aa523e32b whisper: fix send timestamp omission during envelope opening 2015-04-28 10:47:35 +03:00
Péter Szilágyi 3563c59b12 rpc, whisper, xeth: polish whisper RPC interface 2015-04-28 10:47:35 +03:00
Felix Lange 509d0a8d78 whisper: fix comment for rlpenv 2015-04-17 14:45:09 +02:00
Felix Lange 56a48101dc cmd/rlpdump, cmd/utils, eth, p2p, whisper: use rlp input limit 2015-04-17 14:45:09 +02:00
Péter Szilágyi 4afc22ba6e whisper: cleanup lefover scoping 2015-04-17 14:11:46 +03:00
Péter Szilágyi bd14bd6c5b whisper: hide some internal types 2015-04-17 13:25:18 +03:00
Péter Szilágyi e5a03eb066 whisper: don't issue signature warning if none present 2015-04-16 18:24:39 +03:00
Péter Szilágyi e5e91e9eb3 whisper: track active peers, add peer cache expiry test 2015-04-16 13:05:35 +03:00
Péter Szilágyi ee6531c5ff whisper: remove dead code, rename a few constants 2015-04-16 11:20:01 +03:00
Péter Szilágyi 6ceb253f74 whisper: use async handshakes to handle blocking peers 2015-04-15 13:01:22 +03:00
Péter Szilágyi 46ea193a49 whisper: remove some unneeded testing complexity 2015-04-15 12:50:10 +03:00
Péter Szilágyi bcf41797ca whisper: global message expiration tests, polishes 2015-04-15 10:50:31 +03:00
Péter Szilágyi 4fb7ab5d09 whisper: mock tests to use simulated peers 2015-04-14 19:00:57 +03:00
Péter Szilágyi 86372b20c0 whisper: add basic tests for the whiper peers 2015-04-14 18:21:56 +03:00
Péter Szilágyi f6efdd8aad whisper: shorten constants to TTL and PoW 2015-04-14 15:16:02 +03:00
Péter Szilágyi 1a4cfc173e whisper, xeth/whisper, ui/qt/qwhispe: fix API polish breakages 2015-04-14 15:02:31 +03:00
Péter Szilágyi e2b7498c9d whisper: add known message expiration to peers, cleanup 2015-04-14 14:28:59 +03:00
Péter Szilágyi 59bff46505 whisper: general cleanups, documentation 2015-04-14 13:24:43 +03:00
Péter Szilágyi 5205b2f19b whisper: fix anonymous broadcast drop, add broadcast tests 2015-04-14 12:12:47 +03:00
Péter Szilágyi 4af7743663 whisper: add utility functions for creating topics 2015-04-14 11:12:09 +03:00
Péter Szilágyi cb707ba50c whisper: push work in progress for bug report 2015-04-13 16:19:34 +03:00