-
Notifications
You must be signed in to change notification settings - Fork 0
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
Java chaincode review for enhanced code-base #22
Comments
I would consider this a very low-priority issue, but I slightly disagree. This is subjective, but I think Anyway, my main point is that from a debugging perspective, I think decent debuggers (which are available for Java) let you step into statements even if they are inlined like this. So this is a non-issue. Which makes all this a matter of preference, so if others prefer the expanded form, I don’t mind. Just wanted to add my 2c.
I agree with everything else, thanks for the insights! The mentioned method names are indeed misleading and most importantly, I am well aware of the poor implementation of |
A sidenote regarding misleading method names: the javadoc comments above some of the methods indicate that there are side effects, but there are some methods that are missing these comments. Furthermore, just because the comments warn of the side effects, this is still just bad practice. |
Fixed some of the issues in #23 , marking them here… |
We still have the issue of the Regarding propagating the minimum constraint back to the JS implementation: I did not do this yet because first I would like to find out why we are checking the last 5 items in the Java version and not the last 20. The spec says 20. I think this also may have been a shortcut to deal with some OpenJML problems or just some simplification for testing, but I am not sure. |
Legend:
🔴: High priority.
🟡: Medium priority.
🟢: Low priority.
🔵: Discussion.
General
TPCC
class could be namedTPCCContractAPI
(orTpccContractApi
, not sure about the commonly used casing), and the strongly typed methods could be extracted into aTpccBusinessApi
class, which now deals purely with business-level objects, not Fabric API-enforced strings.blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 49 in 385c149
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 76 in 385c149
Delivery
getOldestNewOrderForDistrict
method is misleading. It doesn't return the oldest new order, but actually "performs" the delivery. It should either be renamed to something likedeliverOldestNewOrderForDistrict
to reflect its functionality or its contents should be inlined into the shortdelivery
method, except for thegetOldestNewOrder
functionality (just like in the JS version) since that's the "abstraction border" between the business-level and registry-level functionality.blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 349 in 385c149
select
implementation now reads every entry of a given type, then it's filtered inside the chaincode usingmatching
:blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1201 in 385c149
This is really wasteful if it works that way and could cause a lot of MVCC conflicts. The original
select
supported a partial iterator and early-break functionality for such scenarios (we only need the first/earliest new order of a given warehouse and district). The implementation is functionally correct, but not robust enough extra-functionally.getOrderLineAmount
function also does more than its name suggests:blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1264 in 385c149
New Order
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 490 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Lines 1446 to 1447 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1427 in 119b79f
See here:
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v1/javascript/lib/tpcc.js
Line 287 in 119b79f
dist_info
attribute must be assigned the value of the requireds_dist_xx
attribute from theStock
instance.blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1504 in 119b79f
See here:
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v1/javascript/lib/tpcc.js
Line 361 in 119b79f
Order Status
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Lines 1568 to 1569 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Lines 1583 to 1584 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Lines 1585 to 1586 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1589 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1617 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1621 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Lines 1622 to 1623 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1588 in 119b79f
See here:
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v1/javascript/lib/ledgerUtils.js
Line 347 in 119b79f
Payment
LGTM
Stock Level
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v1/javascript/lib/tpcc.js
Line 637 in 119b79f
blockchain-benchmarks-tpcc/smart-contract/hyperledger-fabric/v2/java/src/main/java/hu/bme/mit/ftsrg/chaincode/tpcc/TPCC.java
Line 1677 in 119b79f
Other components
TBD
The text was updated successfully, but these errors were encountered: