ftsrg / blockchain-benchmarks-tpcc

TPC-C benchmark implementations for blockchain platforms
Apache License 2.0
0 stars 0 forks source link

Java chaincode review for enhanced code-base #22

Open aklenik opened 1 year ago

aklenik commented 1 year ago

Legend: πŸ”΄: High priority. 🟑: Medium priority. 🟒: Low priority. πŸ”΅: Discussion.

General

Delivery

New Order

Order Status

Payment

LGTM

Stock Level

Other components

TBD

bzp99 commented 1 year ago

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 πŸ˜„).

I would consider this a very low-priority issue, but I slightly disagree. This is subjective, but I think serialize(doSomething(deserialize(params))) is still within the realms of readability. But maybe I just like Lisp too much :laughing:.

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.

[other points]

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 Registry#select. This is what we could afford in the available time, but it’s a clear point of improvement with surely significant performance gain effects.

bzp99 commented 1 year ago

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.

bzp99 commented 5 months ago

Fixed some of the issues in https://github.com/ftsrg/blockchain-benchmarks-tpcc/pull/23 , marking them here…

bzp99 commented 5 months ago

We still have the issue of the select implementation being inefficient. IIRC it has been implemented this way because of some OpenJML problems – we just went with this β€˜brute-force’ approach for now. I will come back to it later, for now I did not attempt to play with fire again :)

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.