Commit Graph

349 Commits

Author SHA1 Message Date
catbref
6a969f9473 Add limit to number of proxy forging relationships per generator account.
For testing, current limit is 4 as set in blockchain.json
2019-07-23 16:05:21 +01:00
catbref
de96e8347d Move handling of GET_PEERS from Controller to Network. On sync fail, only update outbound peer info in repository to help prevent useless 'known peer' entries. 2019-07-23 16:02:32 +01:00
catbref
dcb8d67236 Don't allow new transactions to be submitted if not up to date 2019-07-23 15:59:01 +01:00
catbref
491a6ecd67 Fix incorrect declared transaction length for create-group transactions 2019-07-23 15:46:42 +01:00
catbref
9ac52f6a86 Fix missing network-related repository.saveChanges() 2019-07-23 15:45:04 +01:00
catbref
7993c3e594 Change node UI start URL to index.html 2019-07-23 15:43:08 +01:00
catbref
921953d304 Clean up inbound peer entries from repository & fix sending peer lists 2019-07-23 15:36:14 +01:00
catbref
912ec22417 Minor warning fix 2019-07-23 15:26:52 +01:00
catbref
a2cc4983a0 Add "involved" optional query param to API call GET /address/proxying, for convenience 2019-07-23 15:26:26 +01:00
catbref
e42c3e60bc Added mock-up of node management UI 2019-07-23 15:24:36 +01:00
catbref
ab9fd681f3 Fix synchronizer so incoming block's transactions have approval status set 2019-07-23 15:13:59 +01:00
catbref
4667b768df Added tests for each group-approval outcome + fixes 2019-07-23 15:13:28 +01:00
catbref
c9f226cf88 group approval tests and fixes 2019-07-23 15:12:35 +01:00
catbref
8af761c1c3 Updated orphaning code of Block and Transaction subclasses 2019-07-23 15:10:43 +01:00
catbref
4b3f877dc0 Interim commit - refactored transaction transformers and fixed unit test compiler errors 2019-07-23 15:06:28 +01:00
catbref
06ba004238 Interim commit - refactored HSQLDBTransactionRepository, and subclasses. Also added approval_height to transactions, renaming height to block_height. 2019-07-23 14:50:56 +01:00
catbref
431e15c7ae interim commit after refactoring TransactionData, and subclasses 2019-07-23 14:49:41 +01:00
catbref
da1bd82c19 Minor integration progress
Remove fetching unconfirmed from Synchronizer

Add extra validity/reference/processable checks to
Transaction.isValidUnconfirmed

Update TransactionUtils to use Transaction.importAsUnconfirmed
for unit tests.
2019-07-23 14:48:49 +01:00
catbref
9bb673ba82 Interim commit of *Transaction refactoring
Transaction subclass isValid methods have last reference checks removed.
(Now handled by Transaction.hasValidReference)

Some checks in subclass' isValid moved to isProcessable, typically
for transaction types that require group-approval.

Removed fee extraction and last-reference update code from
subclass' process() method to Transaction.processReferencesAndFees.

Other changes to transaction/block processing.
2019-07-23 14:46:44 +01:00
catbref
c9968b3dd2 Interim commit of *TransactionData classes for safety 2019-07-23 14:42:02 +01:00
catbref
041773cf41 Synchronizer asks for approval-pending transaction from peer if needed 2019-07-23 12:49:38 +01:00
catbref
c83d888a7d Demo HTML/JS page to show encrypted local storage of private key 2019-07-23 12:48:47 +01:00
catbref
3f2453e404 ApiError zh locale (but untranslated) 2019-07-23 12:47:52 +01:00
catbref
414f9679c8 Synchronizer logging improvements 2019-07-23 12:47:20 +01:00
catbref
cd5f9a1e6c Convert ClassLoader.getSystemResource* calls to class.getResource* variant for OSGi, etc. safety 2019-07-23 12:46:27 +01:00
catbref
94fceeb34a Move default blockchain.json into resources 2019-07-23 12:46:05 +01:00
catbref
a4f2cf50b0 Updated node management UI (was previously "bundled ui")
Fix root path redirects for node management UI and API documentation servlets.
2019-07-23 12:44:10 +01:00
catbref
f4022dd243 initial work on adding bundled node-management UI 2019-07-23 12:37:42 +01:00
catbref
99024ee2ef Synchronization improvements
Don't attempt to sync, or generate blocks, if we think we're not up to date.

Notify Controller of newly generated block AFTER releasing blockchain lock.

Loads of changes to synchronizer.

Added missing GET_PEERS handling to Controller.onNetworkMessage.

More detailed peer information (last block sig, last generator sig, last block timestamp, ...)
New HEIGHT_V2 network message to help support above.

More, and improved, logging.

Fix for HSQLDB serialization failure caused by trying to save the same new transaction
received by more than one peer/thread simultaneously.
2019-07-23 12:22:17 +01:00
catbref
23bcba1650 HSQLDBRepository.toOffsetDateTime now returns null if passed null 2019-07-23 12:10:47 +01:00
catbref
58afb53be9 Rename getReferenceGeneratorSignature to getGeneratorSignatureFromReference 2019-07-23 11:46:16 +01:00
catbref
0cb54abb79 Fix bug in checking transaction group-approval threshold 2019-07-23 11:30:07 +01:00
catbref
8b949dc1a1 Added simplistic blockchain validation on startup 2019-07-23 11:29:35 +01:00
catbref
f167d0c831 Add JAXB discriminator to GROUP_INVITE transactions. 2019-07-23 11:25:36 +01:00
catbref
b2f235f7a5 Changes to API regarding proxy forging calls 2019-07-23 11:24:25 +01:00
catbref
f3c588d90f Fix sometimes erroneous Ed25519 public key to X25519 public key conversion.
Added mass (x1000) testing of key conversion and shared secret calculations.

Fix incorrect proxy private key test that has expected result from previous
algorithm.

Added another test HTML/JS file.
2019-07-23 11:22:23 +01:00
catbref
1b4369e5e8 Default settings changes
Use IPv6 wildcard address "::" for P2P bind address as null
seems to make listen socket bind to 127.0.0.1

Increase target minimum outbound connections from 3 to 10.

Increate maximum connection limit from 10 to 30.
2019-07-23 11:17:31 +01:00
catbref
c917191df2 Send network broadcasts over all handshake-completed peers.
Previously we preferred the outbound connection but actually
this leaves our info about inbound connection peers out of date.

Synchronizer still prefers outbound.
2019-07-23 11:17:06 +01:00
catbref
1046f72e7b Slightly better logging for synchronizer 2019-07-23 11:16:02 +01:00
catbref
8f7c954f5a Proxy private keys are now SHA256(shared secret only) instead of SHA256(shared secret + public keys).
HTML/JS in src/test/resources/proxy-key-example.html updated accordingly.

Add handshake status to output of API call GET /peers

Add/correct @ApiErrors annotations on some API calls.

Add API call POST /admin/orphan (target height as body)
to force blockchain orphaning for when node is wildly out of sync.
Added support for above to BlockChain class.

BlockGenerator now requires a minimum number of peers
before it will generate any new blocks.
See "minBlockchainPeers" in settings.

Controller now requires a minimum number of peers
before it will consider synchronizing.
See "minBlockchainPeers" in settings.

Old "minPeers" entry in settings.json no longer valid!

Networking now allows both an outbound and inbound connection
to a peer although will use the outbound connection in preference.

Networking checks peer ID of inbound connections to detect,
and resolve, peer ID clashes/theft.
2019-07-23 11:09:25 +01:00
catbref
40d6190265 API tidy up
GET /addresses/proxykey/{privkey}/{pubkey} now POST /addresses/proxykey

GET /utils/fromBase58 now GET /utils/frombase58
GET /utils/fromBase64 now GET /utils/frombase64

GET /utils/toBase58/{hex} now GET /utils/tobase58/{hex}
GET /utils/toBase64/{hex} now GET /utils/tobase64/{hex}

GET /utils/privateKey/{entropy} now POST /utils/privatekey
GET /utils/publicKey/{privateKey} now POST /utils/publickey
2019-07-23 10:42:23 +01:00
catbref
a3d4cf2900 MAJOR: Don't delete transactions when orphaning - make them unconfirmed again
Lots of edits to Transaction subclasses to change/remove 'delete'.

Corresponding extra changes to help reset some transaction fields to pre-process
state during orphaning.

Changed Block, GenesisBlock & Synchronizer to save transactions where appropriate.

Added enhanced GET_SIGNATURES_V2 network message to reduce the number of
block signatures sent over network.

Peers are now version 2 if they send a new-style build version string,
instead of using first digit from build version.
2019-07-23 10:37:37 +01:00
catbref
07e8e01865 Add check to PROXY_FORGING so that proxy public key always maps to same forger-recipient combo 2019-07-23 10:30:17 +01:00
catbref
d0b45cb696 Proxy forging share to recipient can now be zero 2019-07-23 10:29:53 +01:00
catbref
0259702df2 Fix generating X25519 shared secret.
X25519 shared secrets now match those generated by libsodium.

New tests show that shared secrets are the same using either set
of private+public key combinations.

Changed proxy private key generation from using simple SHA256
of shared secret to using SHA256(shared secret + both public keys).

Added a temporary "BouncyCastle25519" shim class to provide missing
key conversion from Ed25519 to X25519.
2019-07-23 10:29:18 +01:00
catbref
4279ad0673 Fix Javascript shared-secret & proxy forging private key code 2019-07-23 10:20:20 +01:00
catbref
748dddcc32 Add checks to API call POST /admin/forgingaccounts.
Now only accepts private keys for accounts with minting rights
or derives to known proxy forging public key.
2019-07-23 10:15:17 +01:00
catbref
7409c024f6 Include proxy-forged blocks in BlockRepository.countForgedBlocks.
As used during validity check for ENABLE_FORGING transaction.
2019-07-23 10:11:51 +01:00
catbref
ae6b41a893 Improve API call showing block forger summaries to include proxy info 2019-07-23 10:11:21 +01:00
catbref
92e60e2531 Add method to prune old peers from database 2019-07-23 10:10:21 +01:00