Sitelet https://github.com/exonum/exonum-java-binding/pull/1307
Skip to content

Migrate service runtime and services to transaction methods [ECR-3994] - #1307

Merged
dmitry-timofeev merged 58 commits into
masterfrom
ECR-3994
Dec 24, 2019
Merged

dmitry-timofeev merged 58 commits into
masterfrom
ECR-3994

Conversation

@MakarovS

@MakarovS MakarovS commented Dec 19, 2019 •

Copy link
Copy Markdown
Contributor

Overview

Migrate service runtime and services to transaction methods.


See: https://jira.bf.local/browse/ECR-3994

Definition of Done

  • There are no TODOs left in the code
  • Change is covered by automated tests
  • The coding guidelines are followed
  • Public API has Javadoc
  • Method preconditions are checked and documented in the Javadoc of the method
  • Changelog is updated if needed (in case of notable or breaking changes)
  • The continuous integration build passes

@MakarovS MakarovS added the work-in-progress 👷‍♂️ Do not expect reviewers to provide any feedback on WIP PRs — please ask for it explicitly! label Dec 19, 2019

List<HistoryEntity> getWalletHistory(PublicKey ownerKey);

void createWalletTx(TxMessageProtos.CreateWalletTx arguments, TransactionContext context)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Here and in similar cases)
I'd drop "Tx" suffix (just createWallet — a service operation).

new CryptocurrencySchema(context.getFork(), context.getServiceName());
MapIndex<PublicKey, Wallet> wallets = schema.wallets();

if (wallets.containsKey(ownerPublicKey)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May also use checkExecution(!wallets.containsKey(ownerPublicKey), WALLET_ALREADY_EXISTS.errorCode), just as the next method.


private static final Logger logger = LogManager.getLogger(QaService.class);

private static int CREATE_COUNTER_TX_ID = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constants duplicate the values in QaTransaction enum — shall probably re-use (or one of them shall be deleted)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, was going to delete the enum

package com.exonum.binding.cryptocurrency.transactions;

enum TransactionError {
public enum TransactionError {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the last remaining class in this package — may move to its parent package and keep package-private.

-1,
0
})
void fromRawTransactionRejectsNonPositiveBalance(long transferAmount) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the condition was moved from the constructor to execute, I'd keep the test as executeTransferNegativeBalance

@dmitry-timofeev

Copy link
Copy Markdown
Contributor

The trend with removing code (and keeping functionality) in recent PRs is very good 🙃 :

зображення

It temporarily has to use 'runtime' error code.
@dmitry-timofeev dmitry-timofeev added the work-in-progress 👷‍♂️ Do not expect reviewers to provide any feedback on WIP PRs — please ask for it explicitly! label Dec 23, 2019
@dmitry-timofeev dmitry-timofeev self-assigned this Dec 23, 2019
@dmitry-timofeev

Copy link
Copy Markdown
Contributor

b01ad54 passes all tests locally. I specifically didn't merged master with #1302 as it breaks tx-result based tests, but Travis won't build this PR as there are conflicts.

@vitvakatu, @bondar If you don't feel like reviewing the whole thing, please review 2687530...b01ad54 with various fixes and improvements.

The remaining thing — is @Disableing tx-result based tests.

@dmitry-timofeev dmitry-timofeev removed the work-in-progress 👷‍♂️ Do not expect reviewers to provide any feedback on WIP PRs — please ask for it explicitly! label Dec 23, 2019
@dmitry-timofeev
dmitry-timofeev changed the base branch from ECR-3991 to master December 24, 2019 07:17
@coveralls

coveralls commented Dec 24, 2019 •

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.3%) to 86.404% when pulling 70707ad on ECR-3994 into 2349dc5 on master.

@dmitry-timofeev
dmitry-timofeev merged commit a7d34c9 into master Dec 24, 2019
@dmitry-timofeev
dmitry-timofeev deleted the ECR-3994 branch December 24, 2019 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants