Exonum Java Binding 0.10.0
Pre-releaseOverview
The main feature of Exonum Java 0.10.0 is enhanced support of dynamic services and
their lifetime. Service instances might be stopped and resumed now. While
stopped, the service does not process transactions and its API endpoints are
unavailable.
Most of the user-facing interfaces were reworked to facilitate access to the
database and transaction execution context, and more distinction between
storage access abstractions were added to enforce services isolation.
Finally, the support of Protobuf-serialized proofs has been re-enabled and
expanded since the last release.
If you are upgrading an existing Java service, consult the migration guide. If you are new to Exonum — see the new tutorial on service development.
This release is based on Exonum 1.0.0, the first
stable Exonum release. See release notes for details.
Added
-
Support of creation of various blockchain proofs:
- Block Proof
- Transaction Execution Proof
- Call Result Proof
- Service Data Proof.
See
BlockchainBlockProofandIndexProof
for details. (#1355)- Proofs for executing service can be created with
BlockchainData#createIndexProofdirectly by the index simple name.
-
Support of creation of Protobuf-based proofs for maps and lists.
Such proofs can be easily serialized using Protocol Buffers
and sent to the light clients.
See:ProofMapIndexProxy#getProofandMapProof;ProofListIndexProxy.getProof,ProofListIndexProxy.getRangeProofand
ListProof;Blockchain.
-
ProofEntryIndexcollection andEntryIndexinterface.EntryIndex#orElsemethod.
-
Execution preconditions utility methods,
seecom.exonum.binding.core.service.ExecutionPreconditions. (#1351) -
supervisor-modeCLI parameter added forgenerate-templatecommand. It
allows to configure the mode of the Supervisor service. Possible values are
"simple" and "decentralized". (#1361) -
Support of service instances lifecycle: they can be activated, stopped and resumed now.
Also, service instance artifacts can be upgraded before resuming which allows services
API update, add new service transactions, synchronous data migration etc. (#1358, #1372) -
BlockchainData— an object providing access to all categories of persistent data
stored in the database: the executing service data, other services’ data,
Exonum Core data. BlockchainData is a service-specific object — it remembers
the service to which it is provided and allows modification only to the data
of that service. The service data is automatically isolated via namespaces,
with a service name followed by a dot as a prefix
(seeBlockchainData#getExecutingServiceData). (#1393) -
Service#beforeTransactions. -
KeyPair#newInstance(PrivateKey, PublicKey) -
Blockchain#getNumTransactions, returning the total number of committed
to the blockchain transactions. -
Blockchain#getNextHeight, returning the height of the next committed block. -
Configurationcan be passed in several text-based formats: JSON, Java
properties, plain text.
The configuration parameters are transferred using a standard protobuf message
ServiceConfiguration.
exonum-launchercomes with built-in support for text-based configuration
formats.
Changed
- Transactions are now implemented as service methods annotated with
@Transaction(TX_ID), instead of classes implementing
Transactioninterface. (#1274, #1307) - Any exceptions thrown from the
Transactionmethods
butExecutionExceptionare saved with the error kind
"unexpected" intoBlockchain#getCallErrors. - Redefined
TransactionExecutionException:- Renamed into
ExecutionExceptionand moved to package
com.exonum.binding.core.service - Made
TransactionExecutionExceptionan unchecked (runtime) exception - Specified it as the exception to communicate execution errors
ofServicemethods:@Transactions;Service#afterTransactions,
#initialize;Configurablemethods.
- Renamed into
- Similarly, redefined
TransactionContext:- Renamed into
ExecutionContextand moved to package
com.exonum.binding.core.service - Replaced
BlockchainDataargument in transaction-likeServiceand
Configurablemethods withExecutionContext. TheBlockchainData
remains accessible viaTransactionContext#getBlockchainData,
and service data viaTransactionContext#getServiceData. - Made
getTransactionMessageHashreturnOptional<HashCode;
andgetAuthorPkreturnOptional<PublicKey>because the context
is also used for non-transaction methods. (#1462)
- Renamed into
- Renamed
Service#beforeCommitintoService#afterTransactions. - Allowed throwing execution exceptions from
Service#afterTransactions
(ex.beforeCommit).
Any exceptions thrown in these methods are saved in the blockchain
inBlockchain#getCallErrorsand can be retrieved by any services or
light clients. Blockchain#getTxResultsis replaced byBlockchain#getCallErrors.- Use
CallInBlocksto concisely createCallInBlocks.
- Use
- The specification of
Configurableoperations andService#initialize
to require throwingExecutionExceptioninstead of
IllegalArgumentException. - Transaction index in block type changed from
longtoint. (#1348) - Extracted artifact version to the separate field from the artifact name.
Artifact name format isgroupId/artifactIdnow.
PluginId format isruntimeId:artifactName:artifactVersionnow. (#1349) - Extracted
#getIndexHashintoHashableIndexinterface. (#1366) - Made
Views (ForkandSnapshot) index factories. An index factory
implementsAccessinterface.Accessallows instantiating various
MerkleDB indexes, aka "collections" (e.g.,Access#getList -> ListIndex).
Accessmethods must be used to create indexes in service code.
Factory methods in indexes must no longer be used (see also 'Removed'
section below).- Use
Accessinstead ofView(which is renamed toAbstractAccess). IndexAddresses are resolved relatively toAccesses (#1374)
- Use
- Exonum protobuf messages are moved from
exonum-java-binding-common
to a new modulecom.exonum.messages:exonum-messages. - Java 11 is the minimum required version to run Exonum services.
Client libraries:exonum-messagesandexonum-java-binding-commonremain
Java 8 compatible. - The service archetype to produce a multi-module service template project,
with a separate module for Protocol Buffers messages, so that they
can be re-used in light clients; and a module for service code. (#1461) - ServiceArtifactId and RuntimeId are moved to
com.exonum.binding.common.runtimepackage. (#1452) - Renamed the
KeyPairfactory methods tonewInstance.
Removed
- Classes supporting no longer used tree-like list proof representation.
Schema#getStateHashesandService#getStateHashesmethods. Framework
automatically aggregates state hashes of the Merkelized collections.TransactionConverter— it is no longer needed with transactions
asServicemethods annotated with@Transaction. Such methods may accept
arbitrary protobuf messages as their argument. (#1304, #1307)ExecutionStatusesfactory methods (serviceError) as they are no longer
useful to create expected transaction execution statuses in tests —
anExecutionErrornow has a lot of other properties.
ExecutionStatuses.successis replaced withExecutionStatuses.SUCCESSconstant.newInstancemethods in all the indexes are made internal:- Use
Accessmethods instead. E.g., instead ofProofListIndexProxy.newInstance
useAccess.getProofList. - Instead of using overloads accepting protobuf classes, create a serializer
explicitly withStandardSerializers.protobuf. - To create index groups (aka families), pass a group address:
IndexAddress.valueOf(String, byte[]). (#1374)
- Use
AbstractService#createDataSchema— just use the schema constructor/factory
method, as passing the instance name is no longer required with thePrefixed
DB Access. (#1393)
Known Issues
- Java 14 is not supported as the runtime for Exonum Java services — see #1509.
JDK 11 through 13 work fine.