GenesisBlock (v4) now supports various transaction types (issue-asset, etc.)
with generated signatures (like genesis transaction signature) and
missing references inserted.
JUnit reverted back to v4 for Eclipse support (for now).
Some dev/testing API calls are now turned off by default in production mode,
see "restrictApi" settings entry, returning NON_PRODUCTION API error.
Corrections to how account's defaultGroupId works, removing "effective groupID"
which overly complicated matters.
In relation to above, DEFAULT_GROUP (0) no longer exists and NO_GROUP(-1) now has
the value 0 instead.
So transactions can no longer have txGroupId of DEFAULT_GROUP, which in turn
required all the erroneous "effective groupID" code.
API call /addresses/{address} now supplies blockchain-wide defaultGroupId if
account doesn't exist or if account's default not set and NO-GROUP not allowed.
API /transactions/pending now offloaded to repository instead of Java-based
processing and filtering.
Transaction approval checks added to Block.isValid
Groups now have min/max approval block delays.
Checks added to incoming unconfirmed, block generator, block.isValid, etc.
'needing approval' and 'meets approval threshold' now split into separate calls.
NB: settings.json no longer part of git repo
log4j2.properties now has debugging entries removed.
log4j2-test.properties (not in repo) takes priority
so using that in development instead.
Unconfirmed transactions no longer wiped on start-up
by default - see Settings
Reworking of {Public,Private,Genesis}Accounts as it seemed
possible to silently lose public key in repository.
The use of AccountData didn't work and so field-specific
repository calls have been made instead
(e.g. setLastReference) that try to opportunistically
store public key too, if available (i.e. caller is
PublicKeyAccount subclass, or better).
Added API call GET /addresses/{address} to return
general account info in one go. (Essentially the
AccountData object as fetched from repository).
Initial work on adding default groupID to accounts,
along with corresponding SET_GROUP transaction type.
In additional, added blockchain-wide default groupID
and flag to allow/disallow no-group/groupless
transactions.
Initial work on group-admin approval of transactions
tied to a specific group via txGroupId.
More work needed on transaction's "effective txGroupId"!
API call /transactions/pending to list transactions
pending group-admin approval. However, this needs more
work (see effective txGroupId above) and potentially
offloading to HSQLDB repository if possible.
Minor CIYAM AT renames to help static reflection initializers.
Block.orphan() no longer adds orphaned transactions back to
unconfirmed pile as they are themselves deleted during
Transaction.orphan(). Maybe the answer is to NOT delete
them during Transaction.orphan() but to add them to
unconfirmed pile at that point? Very old transactions
leftover from major resync would simply expire, whereas
recently transactions leftover from minor resync could
still make it into a new block on synced chain fork.
Changes/tidying/improvements to block generator regarding
removing invalid transactions and dealing with transactions
pending group approval.
Approval threshold added to groups.
Mass refactoring of transaction-related classes to unify
constructors, particularly field ordering, to fall in line
with raw transaction layout.
e.g. constructors now reflect that raw transactions mostly
start with type, timestamp, txGroupId, publicKey, reference
e.g. JAXB afterUnmarshal methods added where needed and corresponding
nasty code in Transaction subclass constructors ripped out.
e.g. TransactionTransformer subclasses contain less duplicated code.
Fixed bug with repository save points thanks to swapping to Deque.
Some fixes to do with missing transaction types being passed to JAXB
TransactionData subclass constructors.
Ripped out obsolete toJSON in TransactionTransformers as this
is all nicely taken care of by Swagger/OpenAPI (thanks @Kc)
Added short sleep() to GET /admin/stop to allow time for HTTP response body to be sent back.
Improved documentation for /peers API resources. Added examples, tidied API output models.
Fixed issue where IPv6 literals with port couldn't be parsed. Now uses RFC5952/RFC3986 style
literal IPv6 addresses with ports, e.g. [::1]:9084
Fixed NPE in Controller.potentiallySynchronize() where peer might not have sent height yet.
Improved Handshake to discard inbound connections if we already have an outbound connection
to a peer with that ID. This prevents us from having two connections to the same peer, one
in each direction.
Network.mergePeers() now runs in a separate thread as acquiring the lock might block.
Network.creationConnection() exits fast based on number of outbound connections, instead of
number of total connections.
Network no longer sends 'local' peer addresses to non-local peers.
e.g. it won't send localhost:9084 to node4.qora.org:9084
Added try-catch to Network.broadcast for when we try to broadcast while shutting down.
Added PeerAddress class to deal with the whole hostname/IPv4/IPv6 address situation.
Reworked PEERS_V2 message type to only send sized-strings instead of separate port,
and potentially IPv6 byte arrays.
Change to HSQLDB database shape.
Corresponding changes to HSQLDBNetworkRepository.
Peers now broadcast height after successful synchronization.
Added support for sending unconfirmed transactions to other peers.
This is done on connect and also after a new unconfirmed transaction is submitted via API.
Fixed synchronizer to handle blocks with transactions correctly.
Fixed network-related PoW to not use class-global SHA256 message digester!
(It was being corrupted by simulataneous access by different threads - whoops)
Surrounded Network.mergePeers with a lock to prevent HSQLDB deadlocks.
Also changed HSQLDB concurrency model to MVCC (only takes effect if DB rebuilt).
Added support for logging other HSQLDB sessions in the event of exception.
(Currently only used by HSQLDBSaver)
Transaction transformer modifications to help deserialize TransactionMessages.
Some pom.xml changes to reduce maven-shade-plugin conflicting classes warnings.
Repository now supports SAVEPOINT and ROLLBACK TO SAVEPOINT.
HSQLDB concurrency/transaction model changed from LOCKS to MVCC to help with
transaction deadlocks/rollbacks.
More XXXs and TODOs added to Block.java for investigation/fix/improvements.
Also used new repository SAVEPOINT feature when validating transactions
instead of rolling back entire transaction. This fixes problem during
synchronization where the rollback would undo previously synchronized,
but not yet committed, blocks!
Transactions orphaned by Block.orphan ARE now added to unconfirmed pile,
unlike before.
Concurrent lock now prevents simultaneous block generation and synchronization,
including synchronization via multiple peers.
Lots of new networking code: peer lists, block signatures, blocks,
blockchain synchronization.
PEERS_V2 message now supports hostnames, IPv6 and port numbers.
Fixed bug with block serialization for transport over network.
DB shape change from v29 to add peer info.
New NetworkRepository to handle above.
Peer handshaking with v2 anti-DoS PoW code.
Handshaking refactored into a state-machine-like enum.
Some peer-related API calls added.
Peers exchange pings, heights, peers.
No actual peer sync yet.
Other changes:
Peer version info taken from Maven build properties/resource file.
AnnotationPostProcessor more resilient when fetching PathItems.
Per-repository session debugging flag that can be toggled at will.
HSQLDBRepository.delete() now returns int so callers can detect
whether anything was actually deleted.
Some renaming to settings.
Moved as much reflection out to class-static initializers as possible.
Renamed some classes to fall in line with transaction type name
to class name conversion, e.g. DEPLOY_AT -> DeployAt
API calls that return lists now take limit, offset and reverse params.
API calls that used to return data & optional list (e.g. blockWithTransactions)
now only return base data. The optional lists can be fetched via
a different API call.
Also: SLF4J now routes logging to log4j2 so start up output cleaned up.
Suppressed extraneous Jersey warning about Providers during start-up injection.
Account group join for a group that is closed/invite-only
and has no corresponding invite is now turned into a "join request".
This can be accepted by an admin sending a corresponding invite tx.
(Also minor fix for orphan.java).
Note use of afterUnmarshal() in TransactionData-subclass to replace trash code in Transaction-subclass constructor.
See UpdateGroupTransactionData.afterUnmarshal() compared to RegisterNameTransaction constructor.
Added POST /names/update for building an UPDATE-NAME transaction.
BlockGenerator now tries to validate new block after adding each
unconfirmed transaction in turn. If block becomes invalid then
that transaction is removed/skipped. This should further prevent
block jams. Skipped transactions might be deleted as the next block
is forged when unconfirmed transactions are collated/filtered/expired.
Add Block.deleteTransaction() for use during block generation above.
Block.addTransaction() and Block.deleteTransaction() use transaction
signatures to test for presence in Block's existing transactions.
Names shouldn't have stored registrant's public key!
"registrantPublicKey" removed from NameData Java object/bean.
Corresponding column removed from HSQLDB using ALTER TABLE but
also from the original CREATE TABLE definition. Remove the ALTER
TABLE statement just prior to rebuilding database!
(This needs to be applied to Polls too as some point).
Also, UpdateNameTransactions and BuyNameTransactions tables now
allow name_reference to be NULL as this column value isn't set
until the corresponding transactions are processed/added to a
block. (name_reference is a link to previous name-related
transaction that altered Name data like "owner" or "data" so
that name-related transactions can be orphaned/undone).
Added GET /names to list all registered name.
Added GET /names/{name} for more info on a specific name.
Added GET /names/address/{address} for names owned by address.
Renamed GET /assets/all to GET /assets in line with above.
Fixed edge cases with AnnotationPostProcessor.
Fixed incorrectly exposed "blockHeight" in API UI examples/values.
Changed example transaction timestamp.
Added checks on building/signing/processing new transactions via API
so that they are not too old (older than latest block's timestamp),
too new (more than 24 hours in the future) or the tx creator doesn't
already have a lot of existing unconfirmed transactions (default 100).
Configurable via settings.json properties maxUnconfirmedPerAccount
and maxTransactionTimestampFuture.
Improved /transactions/search to not return unconfirmed transactions
and to order by timestamp.
Transaction.getCreator() now returns PublicKeyAccount, not Account.
Now uses working RIPE-MD160 by default but can be switched to broken MD160 using flag in blockchain config,
e.g. for Qora v1 blockchain.
Replaced API signature/reference examples with descriptive text as they weren't very useful.
Replaced API address examples with ones generated using working MD160.
Added GET /transactions/signature/{signature}/raw that returns raw transaction in base58 encoding.
Added "ignoreValidityChecks" query param to POST /transactions/decode to bypass INVALID_REFERENCE errors
if supplying an old/speculative transaction that can't be added to unconfirmed transaction pile.
Finally fixed creating inital assets in BlockChain.
Controller now inserts BouncyCastle as highest priority Security Provider.
TransactionData & transaction repository now tries to return transaction's block height in data when possible.
Also added test for missing creator public key on API-submitted
transaction creation calls, like /payments/pay or /asset/issue.
(Needs to be an OpenAPI validator added at some point).
Invalid/expired unconfirmed transactions are cleaned during various calls,
e.g. requesting list of unconfirmed transactions,
or requesting account's last reference (including considering unconfirmed),
or generating a new block.
BlockGenerator now calls repository.discardChanges before sleep to
release any repository-level locks.
Added settings.json toggle "wipeUnconfirmedOnStart" (default: true)
to aid testing.
REMOVED API call /addresses/lastreference/{address}/unconfirmed as
/addresses/lastreference/{address} now considers unconfirmed
transactions regardless.
Added useful error to /transactions/sign if an invalid private key
is supplied.
Improved API "invalid transaction" error to include actual apsect
that caused validity check to fail (e.g. invalid reference)
Refactored to standard Maven layout:
src/main/java
src/main/resources
src/test/java
etc.
New translation code that uses locale-specific ResourceBundles
to load translations on demand.
Reworked API error/exceptions code to a shorter, simpler
@ApiErrors annotation. Processing of @ApiErrors annotations
produces an example for each possible API error and includes
API error string in HTTP response code, e.g.
400 INVALID_SIGNATURE
Missing API error cases added to each API call.
Translation of openAPI.json removed (for now).
block-explorer.html and BIP39 wordlists now read as resources
instead of direct from disk.
Java compile warnings fixed.
Some runtime warnings remain:
WARNING: A provider api.resource.ApiDefinition registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime.
WARNING: A provider api.resource.AnnotationPostProcessor registered in SERVER runtime does not implement any provider interfaces applicable in the SERVER runtime.
WARN org.reflections.Reflections - given scan urls are empty. set urls in the configuration
Added slow query check to HSQLDB repository to help
isolate cases where transaction searching takes too long.
Added BigDecimalTypeAdapter for normalizing API inputs
but doesn't seem to get reliably called so also added
.setScale(8) to BigDecimal serialization method.
API-built transactions are now validated before emitting
base58 raw transaction to help callers.
API's transaction decoder accepts signed/unsigned raw transactions.
XmlJavaTypeAdapter api.Base58TypeAdapter converts byte[] to Base58.
This XmlAdapter is applied at package-level to all packages inside data and api.models.
So no need to annotate every byte[] property!
Added package-info-maven-plugin to pom.xml to do this.
block-explorer.html fixed to show/use base58 again
Some data objects (e.g. TransactionData) have added XmlElements that
convert public keys to addresses, for convenience.
Several API calls updated to return specifically text/plain instead
of ambiguous application/json and/or text/plain. (Typically
API calls that return a single value, e.g. an integer, like /blocks/height).
Cleaned up responses from /addresses/* endpoints
in that some return text/plain instead of application/json.
Removed need for class-local copy of ApiErrorFactory in
AddressesResource - using getInstance() instead.
Some work still needs to be done on annotating API errors.
API error examples in API UI rendered incorrectly - swagger-ui issue?
Removed repository-accessing code from api.models.*
Added /assets/order/{orderId} for fetching info on specific asset order.
NOTE: AssetRepository.getOrdersTrades() now returns trades where order is
initiating or target. (Previously was initiating order only).
qora.assets.Order.orphan() updated to reflect above change.
block-explorer.html fixed to use new API output.
Added more global parameters to /admin/unused API endpoint (formally /admin/dud)
and also managed to remove /admin/unused from API documentation UI.
Added results slicing to /assets/all
Added /assets/orderbook API call that returns open asset orders
Added /assets/trades that returns successful asset trades
Added POST /assets/issue stub
Unified HSQLDB connectionUrl to public variable inside Controller class.
Can't deploy v1 ATs with isFinished=true flag as that prevents later
transactions sending messages (during import of v1 chain).
Some future hard-fork code will need to set all v1 ATs to "finished".
Changed DB's "TransactionRecipients" to "TransactionParticipants" to
properly support API call to find all transactions 'involving' a
specific address. Support code needed in Block and Transaction with
some transaction-specific overrides for Genesis and AT transactions.
Removed old, deprecated calls from Transaction/TransactionRepository
Moved HSQLDB database properties from connection URL to explicit
SQL statements in HSQLDBDatabaseUpdates. They didn't work in
connection URL during DB creation anyway.
Retrofitted HSQLDB Accounts table with public_key column instead of
rebuilding it later.
Fixed incorrect comments in IssueAssetTransactionTransformer regarding
v1 serialization for signing.
Re-imported v1 chain to test latest changes.
Converted AddressesResource to full base64, removing base58.
Narrowed range of API errors returnable while there.
Added support for looking up public key of address.
Added support for converting public key TO address.
Added API endpoint for returning a range of block signatures,
to aid block explorers.
Added API support for fetching unconfirmed transactions.
Added API endpoint for searching transactions to meet criteria like:
- participating address (only recipients supported ATM)
- block height range
- transaction type
- result count limit/offset
---
Added storage of account's public key in repository
along with supporting code in AccountData and Account
business object to save public key where possible.
Rejigged pom.xml, extracting common dependency versions as properties.
Removed extraneous HSQLDB dependency (v2.4.1) as we're using svn r5836 for now.
Removed calls to Security.checkApiCallAllowed() for all API calls EXCEPT /admin/stop.
Throws error if remote IP is not localhost.
Added 'global' OpenAPI parameters to fake /admin/dud endpoint to save copy&pasting.
This will need more tidying in the future, or at least future support from swagger-core.
Code added in AnnotationPostProcessor to insert global parameters in top-level
OpenAPI components section.
/block-explorer.html hidden from API UI
BlocksResource now expects Base64 block signatures instead of Base58.
Endpoints that return block data also accept optional "includeTransactions"
query param which does exactly that.
BlockWithTransactions API model added for above.
Some attempt to get transaction-specific data returned but no luck as yet.
(TransactionData, GenesisTransactionData, PaymentTransactionData touched).
See https://github.com/swagger-api/swagger-core/issues/3046
TransactionsResource now has support for optional query params "limit" and "offset"
so that only a subset of large results can be requested.
UtilsResource added to provide convenient Base64<->Base58 conversions.
/admin/uptime fixed to return uptime from application launch instead of
instantiation of AdminResource class!
Controller improved to detect repository and API startup failures.
HSQLDBRepositoryFactory now detects when it can't open database and throws.
(Before it would simply hang).
Removed extraneous import from qora.account.Account