Commit Graph

225 Commits

Author SHA1 Message Date
catbref
a49e3f7a4e auto update 2019-07-18 18:28:56 +01:00
catbref
20aa49a1f1 Another attempt at auto-update 2019-07-18 15:50:05 +01:00
catbref
63a36073ec Work on auto-update + repository path + Settings bugfixes
AutoUpdate needs separate logfiles for its process as
log4j2's rolling appender doesn't support locking.
So we create AU_LOGGER in AutoUpdate and set it up
using static { } block.

Added support for starting/querying/stopping auto-update
Windows service.

Changed Controller's public connectionUrl field to
getRepositoryUrl() public static method so it
can incorporate repositoryPath from Settings.

Controller has added support for auto-update on startup.

Fix bugs with Settings not using userPath properly.

Removed obsolete standalone binary classes:
* blockgenerator
* txhex
* v1feeder
2019-07-18 15:26:41 +01:00
catbref
e4482c5ade Initial auto-update support, API improvements, arbitrary tx improvements
Removed all @Produces from API resources as response content type is
sorted by Swagger.

Added API /admin/info for generic node info.

Added API /arbitrary/ endpoints.

Moved arbitrary data storage from ArbitraryTransaction to ArbitraryRepository.

V4 arbitrary transaction signature is based on data's hash.

Original commit was d02f282, and commit message was:
Initial auto-update support, network MAGIC change, arbitrary tx improvements
2019-07-18 14:53:19 +01:00
catbref
06e6802d97 More work on synchronization
Various fixes to synchronization

Added missing code for processing incoming block summaries in Network.

Fixed block summaries serialization and removed references to BlockData.

Fixed bug in transaction transformation where base transaction length
didn't include reference or fee lengths.

Original commit was ebbab7b
2019-07-18 13:59:49 +01:00
catbref
57b982d2fb Block summaries (repository/data/message/synchronizer) + BlockGenerator
Also refactored some tests.

Original commit was 06fe8fc, with commit message:
Initial implementation of random block generator, etc.
2019-07-18 12:15:11 +01:00
catbref
747f5e41cf Bump Jetty to 9.4.17.v20190418 due to CVE-2019-10247
+ remove older version of package-info-maven-plugin
2019-04-30 09:00:30 +01:00
catbref
882d910631 Remove unneeded HSQLDB debugging and tidy some comments 2019-04-30 08:33:33 +01:00
catbref
a316b8a810 Potential HSQLDB deadlock fix
After opening repository connection with RepositoryManager.getRepostory(),
any 'read' from repository (e.g. SELECT) starts the transaction
even though HSQLDB documentation states there are no shared/read locks
in MVCC concurrency model.

The work-around for this is to 'reset' HSQLDB's in-transaction flag
by performing a ROLLBACK (Repository.discardChanges) immediately
after acquiring the blockchain lock (which is used to ringfence
changes that might collide like these).

Also adding an extra check to prevent payments to nonexistent AT
addresses as it touches Transaction.
2019-04-29 15:18:44 +01:00
catbref
b21ef18533 More HSQLDB deadlock debugging 2019-04-29 12:54:34 +01:00
catbref
ea913ad90e Bump HSQLDB to r5970 2019-04-29 11:04:19 +01:00
catbref
db77901026 grab latest block directly instead of via height 2019-04-26 15:01:57 +01:00
catbref
b4d0f9ab68 Allow multiple txType in API GET /transactions/search 2019-04-26 09:23:44 +01:00
catbref
b0b74eb48d Fix JAXB annotations for transactions with creatorPublicKey 2019-04-26 09:04:58 +01:00
catbref
d4ce797241 More HSQLDB debugging 2019-04-26 08:31:10 +01:00
catbref
b7687bf326 More HSQLDB debugging 2019-04-26 08:07:57 +01:00
catbref
0296c4bbb1 HSQLDB debugging & optimization for Transaction.isValidUnconfirmed 2019-04-25 18:29:01 +01:00
catbref
51fd029e22 Access to log entries from API & checks for some transaction-based API calls. 2019-04-24 15:02:37 +01:00
catbref
126e651f27 Change sync consensus to favour lower-value block sigs + other changes
API /addresses/{address} now returns lastReference taking unconfirmed into account.

Added DELETE /peers/known to remove all known peers from repository.

Added blockchain locking around Transaction methods like isValidUnconfirmed
as they (temporarily) update account lastReference.

Ditto getInvalidTransactions, etc.
2019-04-24 12:46:50 +01:00
catbref
d33ffee3ba Work on granting forging rights
Move hard-coded forging tiers to blockchain config.
Tests for granting forging rights.

Added API call to list top block forgers.

Fixed typo with Reward[s]ByHeight class name.
2019-04-19 09:55:04 +01:00
catbref
93230e9704 Add API call to list blocks with given generator. +more tests +pad genesis public key 2019-04-17 18:11:16 +01:00
catbref
d1c547f24a Refactor to use BouncyCastle Ed25519/X25519, and more...
Remove old whispersystems, etc. *25519 and use new v1.61 BouncyCastle.

Fix proxy forging private key derivation from X25519 shared secret.
Also include Javascript test version for comparison.

Fix block rewards for proxy forging.

Add extra useful info to API call GET /admin/forgingaccounts.
Fix API response to POST/DELETE /admin/forgingaccounts when
passed invalid private keys.

Added block rewards and account flags to testchain config.

Tests to cover changes above.
2019-04-17 12:32:03 +01:00
catbref
8e74884536 Fixes after rebase from master 2019-04-12 14:41:59 +01:00
catbref
2f6ef32f35 Replace settings-based generator private keys with DB table and API calls 2019-04-12 13:01:26 +01:00
catbref
c9035edd2c Interim proxy minting commit
Added /addresses/proxying to find proxy forging mappings.

Added /addresses/proxykey/{genprivkey}/{recipientpubkey} to calculate proxy private key.

New Block.regenerate factory method to create new Blocks
 but without having to reprocess ATs, etc.

Added support for proxied generator in Block.calcGeneratorsTarget

BlockGenerator now generates and checks new blocks for various generators,
 including proxy generators.

BlockGenerator now uses generator private keys supplied by Settings.
Corresponding changes to Settings to load base58-encoded private keys.

+ minor stuff
2019-04-12 12:57:21 +01:00
catbref
9b859f3efd Interim minting commit with block rewards (untested)
+ minting long-term simulator
+ Maven pom.xml changes for Eclipse IDE
2019-04-12 12:56:12 +01:00
catbref
3c06d358b7 interim commit with proxy forging repository/transaction support
no block validity/generator support yet
2019-04-12 12:53:44 +01:00
catbref
2dc1720af8 Initial support for account flags + tx (genesis account use only atm) 2019-04-12 12:50:10 +01:00
catbref
85acc4d9df Fix incorrect refunds when cancelling asset orders
Also improved asset tests in that they don't use QORA any more
which takes fees/block rewards out of the picture.

More test assets are issued in the genesis block to
accomplish this:

1m TEST issued to Alice
1m OTHER issued to Bob
1m GOLD issued to Alice
2019-04-12 10:38:25 +01:00
catbref
2f51ced5c0 Fix incorrectly applied price improvement refund.
Also fix broken tests which contributed to this bug slipping by.
2019-04-12 08:44:13 +01:00
catbref
c23f55e6a6 Asset trading: refund saving due to price improvement back to initiator
Added test case to cover the above.

Also improve test harness to properly check balances after orphan back to genesis.
2019-04-11 17:47:12 +01:00
catbref
16dab6972c Fix some asset orders incorrectly matching worse prices. 2019-04-10 15:25:16 +01:00
catbref
cfbf5c12bf Supply extra information fields to various asset-related API calls.
e.g. supply "assetName" in JSON for TRANSFER_ASSET transactions

Also supply have/want asset names, amount asset ID/name, price-pair
and creator address in asset orders.

Show CREATE_ASSET_ORDER amount ID/name & price-pair in correct
format depending on whether transaction was placed before/after
'new' asset pricing took effect. (Orders are always in 'new' form).

Change API call /assets/transfers/{assetid}/{address} to
/assets/transfers/{assetid} with optional "address" query param.
2019-04-10 13:09:30 +01:00
catbref
d5a2e5be19 Bump Eclipse Jetty version to 9.4.12.v20180830 due to CVE 2019-04-10 07:41:46 +01:00
catbref
ed3065f145
Merge pull request #8 from catbref/new-asset-pricing2
New asset pricing scheme (take 2)
2019-04-10 07:19:59 +01:00
catbref
a5e963911d New asset pricing scheme (take 2)
Orders are back to having "amount" and "price".
(No more "unitPrice" or "wantAmount").

Order "amount" is expressed in terms of asset with highest
assetID.
"price" is expressed in (lowest-assetID)/(highest-assetID).

Given an order with two assets, e.g. QORA (0) and GOLD (31),
"amount" is in GOLD (31), "price" is in QORA/GOLD (0/31).

Order's "fulfilled" is in the same asset as "amount".

Yet more tests and debugging.

For simplicity's sake, the change to HSQLDB repository is
assumed to take place when 'new' pricing switch also
occurs.

Don't forget to change "newAssetPricingTimestamp" in
blockchain config JSON file.
2019-04-10 07:18:50 +01:00
catbref
1b45ee85e7 Fix handling of CORS preflight OPTIONS requests.
Typical log entry would be:

2019-04-05 09:47:08 ERROR WadlGeneratorJAXBGrammarGenerator:401 - Failed to generate the schema for the JAX-B elements
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions
        at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91) ~[?:1.8.0_191]
2019-04-05 10:56:38 +01:00
catbref
7026c35e73 For API "GET /assets" add optional query param "includeData" 2019-04-04 12:33:12 +01:00
catbref
97142fdde8 Return HTTP 400 code with useful message when a ParamException occurs from API call. 2019-04-04 12:30:28 +01:00
catbref
315ebff61d Add optional API request logging via "apiLoggingEnabled" entry in Settings 2019-04-04 11:33:13 +01:00
catbref
ed94c3c5b3 Fix Crypto.isValidAddress to return false when passed empty string 2019-04-04 10:41:04 +01:00
catbref
d9be12e62f
Merge pull request #7 from catbref/assets
Merge "assets" branch into master
2019-04-04 09:15:28 +01:00
catbref
26e3adb92b Completing work on new asset trading changes
Changed API call GET /assets to NOT return asset "data" fields
as they can be huge. If need be, call GET /assets/info to fetch
a specific asset's data field.

Improve asset trade amount granularity, especially for indivisible
assets, under "new" pricing scheme only.

Added corresponding tests for granularity adjustments.

Fix/unify asset order logging text under "old" and "new"
pricing schemes.

Change asset order related API data models so that old "price" is
now "unitPrice" and add new "return" as in amount of want-asset
to receive if have-asset "amount" was fully matched.
(Affects OrderData, CreateAssetOrderTransactionData)

Some changes to the HSQLDB tables.

Don't forget to add "newAssetPricingTimestamp" to your blockchain config's
"featureTriggers" map.
2019-04-03 18:00:20 +01:00
catbref
60e562566e Interim commit on new asset trading schema
Better order matching, especially in situations
where inexact fractional representations (e.g. 1/12)
or rounding issues might occur. Also better matching
with indivisible assets.

Essentially change ordering from have-amount & price
to have-amount and want-return, leaving unit price
to be calculated internally to a finer degree (in
some cases to 48 decimal points).

Corresponding unit tests to cover both legacy and new
scenarios. Support for tests to switch between
blockchain configs.

"New" pricing schema is its own 'feature trigger'
independent from general qorav2 switch.

Safety checks added during trading process.

HSQLDB schema changes (will probably need
careful conflict resolution on merge).

Still to do:

API changes
etc.
2019-04-02 21:10:16 +01:00
catbref
031657878e Added safety feature to prevent negative balances 2019-03-29 10:56:46 +00:00
catbref
789b311984 Interim commit with newer asset order "price" arg
+ unit test
+ newer unit test harness

but still needs:

BlockChain config support for activating newer "price" arg
New unit test to check old "price" arg usage

Rework existing asset-related unit tests

Check API inputs/output pre/post "price" arg crossover
2019-03-28 16:28:31 +00:00
catbref
d3c1602d9b Adjust Asset data max size to reflect HSQLDB CLOB size
+ fix incorrect logic when calculating issue-asset transaction
data length
2019-03-26 14:36:47 +00:00
catbref
d741580ccf Restore missing minimum fee checks & ValidationResult 2019-03-26 14:36:06 +00:00
catbref
c69f84afab Added ApiExceptionManager to try to trace IllegalAnnotationExceptions 2019-03-26 14:34:45 +00:00
catbref
870646fec8 Correct min/max block times for testing blockchain config 2019-03-26 14:32:51 +00:00