hiero-ledger / hiero-ledger/hiero-sdk-java

Clean up ContractFunctionResult construction HACK in TransactionRecord.fromProtobuf

Open Beginner friendly
#2,874 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
264
Forks
192
Avg merge
2d
Merged PRs (30d)
39

Description

`TransactionRecord.fromProtobuf` still carries this marker (`sdk/src/main/java/com/hedera/hashgraph/sdk/TransactionRecord.java:317`):

```java
// HACK: This is a bit bad, any takers to clean this up
var contractFunctionResult = transactionRecord.hasContractCallResult()
? new ContractFunctionResult(transactionRecord.getContractCallResult())
: transactionRecord.hasContractCreateResult()
? new ContractFunctionResult(transactionRecord.getContractCreateResult())
: null;
```

Replace the nested ternary with a small explicit helper (or an if/else chain) that picks the call vs. create result, and drop the HACK comment. No behavior change intended — keep both the contract-call and contract-create paths covered by unit tests.

Contributor guide

Open the contributing guide

Research direction

Start in sdk/src/main/java/com/hedera/hashgraph/sdk/TransactionRecord.java at TransactionRecord.fromProtobuf, where the HACK and nested ternary are located. Check the existing unit tests covering contract-call and contract-create results before making the small construction cleanup. Done means both paths remain covered and the HACK comment is removed without behavior changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.