Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

May org.json.JSONObject used in org.hyperledger.fabric.contract.execution.JSONTransactionSerializer lead submit payloads not matching?

未關閉
#361 7 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
25/100
Issue 類型
缺陷
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
java

研究方向

從 org.hyperledger.fabric.contract.execution.JSONTransactionSerializer 和堆疊追蹤中顯示的 GatewayClient.endorse 呼叫開始。使用泛型回傳型別 Response 以及提供的 Asset 和合約介面定義,重現 endorsement 不一致問題。完成的標準是確定是否支援泛型回傳型別,並記錄或修正該行為。

由索引模型根據 Issue 內容生成。

描述

bug help wanted

When I call a submit method from application via gateway, I received an Exception below.

Caused by: org.hyperledger.fabric.client.EndorseException: io.grpc.StatusRuntimeException: ABORTED: failed to collect enough transaction endorsements, see attached details for more info
        at org.hyperledger.fabric.client.GatewayClient.endorse(GatewayClient.java:74)
        at org.hyperledger.fabric.client.ProposalImpl.endorse(ProposalImpl.java:76)
        at org.hyperledger.fabric.client.Proposal.endorse(Proposal.java:64)
        at pers.u8f23.fabric.app.api.AbstractAssetContractSubmit.createAsset(AbstractAssetContractSubmit.java:13)
        at pers.u8f23.fabric.app.Main.chaincodeOperations(Main.java:84)
        at pers.u8f23.fabric.app.Main.main(Main.java:65)
Caused by: io.grpc.StatusRuntimeException: ABORTED: failed to collect enough transaction endorsements, see attached details for more info
        at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)
        at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)
        at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)
        at org.hyperledger.fabric.protos.gateway.GatewayGrpc$GatewayBlockingStub.endorse(GatewayGrpc.java:455)
        at org.hyperledger.fabric.client.GatewayClient.endorse(GatewayClient.java:72)
        ... 5 more

Detail message attached to this Exception is ProposalResponsePayloads do not match.

Returned type is a generic class. Both the generic type and the type argument are defined as type in fabric demo .

public interface AbstractAssetContractSubmit {
  Response<Asset> createAsset(Context context, String value);

  Response<Void> deleteAsset(Context context, String assetId);

  Response<Void> updateAsset(Context context, String assetId, String value);
}

@DataType
public final class Response<T> {
  @Property
  private final T body;

  @Property
  private final int code;

  @Property
  private final String msg;

  public Response(@JsonProperty("body") T body, @JsonProperty("code") int code,
      @JsonProperty("msg") String msg) {
    this.body = body;
    this.code = code;
    this.msg = msg;
  }

  public T getBody() {
    return this.body;
  }

  public int getCode() {
    return this.code;
  }

  public String getMsg() {
    return this.msg;
  }
}



@DataType
public final class Asset {
  @Property
  private final String id;

  @Property
  private final String creatorId;

  @Property
  private final String ownerId;

  @Property
  private final long createTime;

  @Property
  private final long lastTransferTime;

  @Property
  private final long lastUpdateTime;

  @Property
  private final String assetValue;

  public Asset(@JsonProperty("id") String id, @JsonProperty("creatorId") String creatorId,
      @JsonProperty("ownerId") String ownerId, @JsonProperty("createTime") long createTime,
      @JsonProperty("lastTransferTime") long lastTransferTime,
      @JsonProperty("lastUpdateTime") long lastUpdateTime,
      @JsonProperty("assetValue") String assetValue) {
    this.id = id;
    this.creatorId = creatorId;
    this.ownerId = ownerId;
    this.createTime = createTime;
    this.lastTransferTime = lastTransferTime;
    this.lastUpdateTime = lastUpdateTime;
    this.assetValue = assetValue;
  }

  public String getId() {
    return this.id;
  }

  public String getCreatorId() {
    return this.creatorId;
  }

  public String getOwnerId() {
    return this.ownerId;
  }

  public long getCreateTime() {
    return this.createTime;
  }

  public long getLastTransferTime() {
    return this.lastTransferTime;
  }

  public long getLastUpdateTime() {
    return this.lastUpdateTime;
  }

  public String getAssetValue() {
    return this.assetValue;
  }
}

Does this chaincode api support java generic type as method return type?
Anyone is welcome to answer this question.

主要語言
Java
星號
322
分支
210
平均合併
15 小時 16 分鐘
30 天內合併 PR
29

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

hyperledger/fabric-chaincode-java 的其他 Issue

查看 hyperledger/fabric-chaincode-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。