You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Legend:
🔴: High priority.
🟡: Medium priority.
🟢: Low priority.
🔵: Discussion.
General
🟢 Since the TPC-C methods are overloaded based on their parameter types (string or strongly typed/parsed object), a more explicit separation of such methods would make sense. Accordingly, the current TPCC class could be named TPCCContractAPI (or TpccContractApi, not sure about the commonly used casing), and the strongly typed methods could be extracted into a TpccBusinessApi class, which now deals purely with business-level objects, not Fabric API-enforced strings.
🟢 The following and similar nested statements should be split into multiple statements using variable assignments, so it's easier to read (and would facilitate step-by-step debugging if we could set that up 😄).
🟡 The name of the getOldestNewOrderForDistrict method is misleading. It doesn't return the oldest new order, but actually "performs" the delivery. It should either be renamed to something like deliverOldestNewOrderForDistrict to reflect its functionality or its contents should be inlined into the short delivery method, except for the getOldestNewOrder functionality (just like in the JS version) since that's the "abstraction border" between the business-level and registry-level functionality.
🔴 🔵 If I understand correctly, the select implementation now reads every entry of a given type, then it's filtered inside the chaincode using matching:
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.
🟡 The getOrderLineAmount function also does more than its name suggests:
this.getOrderLineAmount(ctx, w_id, d_id, order.getO_id(), i, ol_delivery_d);
New Order
🟡 I find single-statement for/if/etc blocks without curly brackets really error-prone. We should always use them for clarity, and in the name of defensive programming. The following is just an example
Legend:
🔴: High priority.
🟡: Medium priority.
🟢: Low priority.
🔵: Discussion.
General
TPCCclass could be namedTPCCContractAPI(orTpccContractApi, not sure about the commonly used casing), and the strongly typed methods could be extracted into aTpccBusinessApiclass, 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
getOldestNewOrderForDistrictmethod is misleading. It doesn't return the oldest new order, but actually "performs" the delivery. It should either be renamed to something likedeliverOldestNewOrderForDistrictto reflect its functionality or its contents should be inlined into the shortdeliverymethod, except for thegetOldestNewOrderfunctionality (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
selectimplementation 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
selectsupported 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.getOrderLineAmountfunction 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_infoattribute must be assigned the value of the requireds_dist_xxattribute from theStockinstance.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