Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#61: Implement payment taxes to remote nodes. #72

Merged
merged 5 commits into from Dec 4, 2018

Conversation

paulodamaso
Copy link
Contributor

For #61: Implement payment taxes to remote nodes:

  • Added FkTransaction class to fake transaction in tests;
  • Updated puzzle in Taxes
  • Added test basic implementation for Taxes.exec()
  • Added puzzle for Transaction matcher implementation
  • Added puzzle for payToRightNodes implementation

@codecov-io
Copy link

codecov-io commented Aug 9, 2018

Codecov Report

Merging #72 into master will decrease coverage by 4.55%.
The diff coverage is 56.25%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #72      +/-   ##
============================================
- Coverage     93.71%   89.16%   -4.56%     
- Complexity       52       58       +6     
============================================
  Files            11       12       +1     
  Lines           191      240      +49     
  Branches         16       23       +7     
============================================
+ Hits            179      214      +35     
- Misses           11       22      +11     
- Partials          1        4       +3
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/zold/api/Taxes.java 100% <ø> (ø) 2 <0> (ø) ⬇️
src/main/java/io/zold/api/Transaction.java 56.25% <56.25%> (ø) 0 <0> (?)
src/main/java/io/zold/api/CpTransaction.java 0% <0%> (-100%) 0% <0%> (-1%)
src/main/java/io/zold/api/Wallet.java 80.85% <0%> (-8.52%) 0% <0%> (ø)
src/main/java/io/zold/api/RtTransaction.java 98.76% <0%> (-1.24%) 26% <0%> (+1%)
src/main/java/io/zold/api/Copies.java 85.71% <0%> (+7.93%) 6% <0%> (+5%) ⬆️
src/main/java/io/zold/api/RtNetwork.java 100% <0%> (+10%) 6% <0%> (+1%) ⬆️
src/main/java/io/zold/api/Remote.java 87.5% <0%> (+12.5%) 0% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c86827...3aca978. Read the comment docs.

@0crat 0crat added the scope label Aug 9, 2018
@0crat
Copy link
Collaborator

0crat commented Aug 9, 2018

Job #72 is now in scope, role is REV

@paulodamaso
Copy link
Contributor Author

@llorllale Is 0crat having problems in assigning REV tasks? This task is five days old, it's rotting and 0crat does not assign it to anyone.

@llorllale
Copy link
Collaborator

@paulodamaso funding issue - let me try to fix

@paulodamaso
Copy link
Contributor Author

@llorllale Would you please review and merge this one? This task is preventing me from receiving new tasks, and I've made this PR more than two months ago.

pom.xml Outdated
@@ -113,7 +113,7 @@ SOFTWARE.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso why are we bumping this version?

* @checkstyle ParameterNumberCheck (500 lines)
*/
@SuppressWarnings("PMD.AvoidFieldNameMatchingMethodName")
public final class FkTransaction implements Transaction {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso let's define this one inside Transaction and just call it Fake

* Fake {@link Transaction} for usasge in tests.
*
* @since 1.0
* @checkstyle JavadocMethodCheck (500 lines)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso let's enable this and add javadocs to methods

*
* @since 1.0
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle ParameterNumberCheck (500 lines)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso let's enable this check and figure out how to fix that ctor with all those parameters. There's just too many of them for a single ctor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale Considering that it is just a fake implementation of Transaction meant for using in tests I don't see this issue as being so grave. Besides, I've already spent too much on this ticket previously so I'll left a todo for this fix.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso please leave a puzzle

).value();
final List<Transaction> ledger = new ArrayList<>(5);
// @checkstyle AvoidInstantiatingObjectsInLoops (26 lines)
for (int index = 0; index < 5; index = index + 1) {
Copy link
Collaborator

@llorllale llorllale Dec 2, 2018

Choose a reason for hiding this comment

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

@paulodamaso you can just index++ on the post-iteration operation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale Static checks fail if we use ++: Checkstyle: C:\git\zold-java-api\src\test\java\io\zold\api\TaxesTest.java[62]: Using '++' is not allowed. (IllegalTokenCheck)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso huh???!? wow

Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso pre-increment should work

"2017-07-19T21:24:51Z",
DateTimeFormatter.ISO_OFFSET_DATE_TIME
).value();
final List<Transaction> ledger = new ArrayList<>(5);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso why are we specifying capacity on this list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale see comment below

)
);
}
final List<Remote> remotes = new ArrayList<>(5);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso why are we specifying capacity on this list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale Checkstyle fails if we do not so: Checkstyle: C:\git\zold-java-api\src\test\java\io\zold\api\TaxesTest.java[83]: ArrayList should be initialized with a size parameter (ConditionalRegexpMultilineCheck)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso Christ.... wow. Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

);
}
final List<Remote> remotes = new ArrayList<>(5);
for (int counter = 0; counter < 5; counter = counter + 1) {
Copy link
Collaborator

@llorllale llorllale Dec 2, 2018

Choose a reason for hiding this comment

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

@paulodamaso just use counter++ to increment counter.

Also, I think the loop's exit condition should be rewritten as counter < ledger.size()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale Please see above about ++ operator.

Copy link
Contributor Author

@paulodamaso paulodamaso left a comment

Choose a reason for hiding this comment

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

@llorllale Thanks for the review, made some corrections and comments, please take a look

).value();
final List<Transaction> ledger = new ArrayList<>(5);
// @checkstyle AvoidInstantiatingObjectsInLoops (26 lines)
for (int index = 0; index < 5; index = index + 1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale Static checks fail if we use ++: Checkstyle: C:\git\zold-java-api\src\test\java\io\zold\api\TaxesTest.java[62]: Using '++' is not allowed. (IllegalTokenCheck)

);
}
final List<Remote> remotes = new ArrayList<>(5);
for (int counter = 0; counter < 5; counter = counter + 1) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale Please see above about ++ operator.

)
);
}
final List<Remote> remotes = new ArrayList<>(5);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale Checkstyle fails if we do not so: Checkstyle: C:\git\zold-java-api\src\test\java\io\zold\api\TaxesTest.java[83]: ArrayList should be initialized with a size parameter (ConditionalRegexpMultilineCheck)

"2017-07-19T21:24:51Z",
DateTimeFormatter.ISO_OFFSET_DATE_TIME
).value();
final List<Transaction> ledger = new ArrayList<>(5);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale see comment below

*
* @since 1.0
* @checkstyle JavadocMethodCheck (500 lines)
* @checkstyle ParameterNumberCheck (500 lines)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@llorllale Considering that it is just a fake implementation of Transaction meant for using in tests I don't see this issue as being so grave. Besides, I've already spent too much on this ticket previously so I'll left a todo for this fix.

MatcherAssert.assertThat(
"Didn't paid anything",
wallet.ledger(),
new IsCollectionContaining<Transaction>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

@paulodamaso is explicit generic type parameter necessary?

@paulodamaso
Copy link
Contributor Author

@llorllale Done take a look now

@llorllale
Copy link
Collaborator

@rultor merge

@rultor
Copy link
Contributor

rultor commented Dec 4, 2018

@rultor merge

@llorllale OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 3aca978 into zold-io:master Dec 4, 2018
@rultor
Copy link
Contributor

rultor commented Dec 4, 2018

@rultor merge

@llorllale Done! FYI, the full log is here (took me 11min)

@0crat 0crat removed the scope label Dec 4, 2018
@0crat
Copy link
Collaborator

0crat commented Dec 4, 2018

Job gh:zold-io/java-api#72 is not assigned, can't get performer

@0crat
Copy link
Collaborator

0crat commented Dec 4, 2018

The job #72 is now out of scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants