Skip to content

Commit

Permalink
<fix>(codec,filter): fix event abi codec bug, when overload event. (F…
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay authored Aug 30, 2024
1 parent 686b86a commit 5b3647c
Show file tree
Hide file tree
Showing 14 changed files with 130 additions and 127 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@

### 新增

- 新增[FISCO BCOS 3.9.0](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.9.0) 版本新增的获取合约事件接口,用户可用主动获取的方式自定义查询合约事件、区块事件等。详情见:[#920](https://github.com/FISCO-BCOS/java-sdk/pull/920)
- 新增[FISCO BCOS 3.9.0](https://github.com/FISCO-BCOS/FISCO-BCOS/releases/tag/v3.9.0) 版本新增的获取合约事件接口,用户可用主动获取的方式自定义查询合约事件、区块事件等**目前仍是体验版**。详情见:[#920](https://github.com/FISCO-BCOS/java-sdk/pull/920)
- 在Client类中新增获取当前链上所有配置项的接口,用户可以通过该接口获取链上所有配置项的信息。详情见:[#922](https://github.com/FISCO-BCOS/java-sdk/pull/922)
- 在配置文件中新增 `enableSsl` 的配置字段,该字段的设置将会覆盖旧的 `disabalSsl` 的设置。原先 `disabalSsl` 的配置字段仍然支持,保持配置文件兼容。详情见:[#922](https://github.com/FISCO-BCOS/java-sdk/pull/923)

### 修复

- 修复 `TransactionManager` 在设置`extension`字段时会清除版本号,导致交易哈希计算错误不能上链的问题。详情见:[#922](https://github.com/FISCO-BCOS/java-sdk/pull/922)
- 修复在大整数负数编解码场景中ABI和Scale编解码错误的问题。详情见:[#922](https://github.com/FISCO-BCOS/java-sdk/pull/925)
- 修复存在重载事件时,ABI编解码错误的问题。
- 修复在使用 `ContractCodec` 类中事件解析时没有解析事件中 `indexed` 值的问题。详情见:[#922](https://github.com/FISCO-BCOS/java-sdk/pull/925)
- 修复在 `Contract` 类以及继承类中,订阅事件的接口没有返回订阅ID的问题。详情见:[#922](https://github.com/FISCO-BCOS/java-sdk/pull/925)

Expand Down
39 changes: 18 additions & 21 deletions src/main/java/org/fisco/bcos/sdk/v3/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Optional;
import java.util.Set;
import org.fisco.bcos.sdk.jni.BcosSDKJniObj;
import org.fisco.bcos.sdk.v3.client.protocol.request.LogFilterRequest;
import org.fisco.bcos.sdk.v3.client.protocol.request.Transaction;
import org.fisco.bcos.sdk.v3.client.protocol.response.Abi;
import org.fisco.bcos.sdk.v3.client.protocol.response.BcosBlock;
Expand All @@ -34,10 +35,9 @@
import org.fisco.bcos.sdk.v3.client.protocol.response.Call;
import org.fisco.bcos.sdk.v3.client.protocol.response.Code;
import org.fisco.bcos.sdk.v3.client.protocol.response.ConsensusStatus;
import org.fisco.bcos.sdk.v3.client.protocol.response.EthFilter;
import org.fisco.bcos.sdk.v3.client.protocol.response.EthLog;
import org.fisco.bcos.sdk.v3.client.protocol.response.EthUninstallFilter;
import org.fisco.bcos.sdk.v3.client.protocol.response.GroupPeers;
import org.fisco.bcos.sdk.v3.client.protocol.response.LogFilterResponse;
import org.fisco.bcos.sdk.v3.client.protocol.response.LogWrapper;
import org.fisco.bcos.sdk.v3.client.protocol.response.ObserverList;
import org.fisco.bcos.sdk.v3.client.protocol.response.PbftView;
import org.fisco.bcos.sdk.v3.client.protocol.response.Peers;
Expand All @@ -46,6 +46,7 @@
import org.fisco.bcos.sdk.v3.client.protocol.response.SyncStatus;
import org.fisco.bcos.sdk.v3.client.protocol.response.SystemConfig;
import org.fisco.bcos.sdk.v3.client.protocol.response.TotalTransactionCount;
import org.fisco.bcos.sdk.v3.client.protocol.response.UninstallLogFilter;
import org.fisco.bcos.sdk.v3.config.ConfigOption;
import org.fisco.bcos.sdk.v3.crypto.CryptoSuite;
import org.fisco.bcos.sdk.v3.model.EnumNodeVersion;
Expand Down Expand Up @@ -1043,37 +1044,33 @@ void getChainCompatibilityVersionAsync(
*/
int getNegotiatedProtocol();

EthFilter newFilter(org.fisco.bcos.sdk.v3.client.protocol.request.EthFilter filter);
LogFilterResponse newFilter(LogFilterRequest filter);

void newFilterAsync(
org.fisco.bcos.sdk.v3.client.protocol.request.EthFilter filter,
RespCallback<EthFilter> callback);
void newFilterAsync(LogFilterRequest filter, RespCallback<LogFilterResponse> callback);

EthFilter newBlockFilter();
LogFilterResponse newBlockFilter();

void newBlockFilterAsync(RespCallback<EthFilter> callback);
void newBlockFilterAsync(RespCallback<LogFilterResponse> callback);

EthFilter newPendingTransactionFilter();
LogFilterResponse newPendingTransactionFilter();

void newPendingTransactionFilterAsync(RespCallback<EthFilter> callback);
void newPendingTransactionFilterAsync(RespCallback<LogFilterResponse> callback);

EthLog getFilterChanges(EthFilter filter);
LogWrapper getFilterChanges(LogFilterResponse filter);

void getFilterChangesAsync(EthFilter filter, RespCallback<EthLog> callback);
void getFilterChangesAsync(LogFilterResponse filter, RespCallback<LogWrapper> callback);

EthUninstallFilter uninstallFilter(EthFilter filter);
UninstallLogFilter uninstallFilter(LogFilterResponse filter);

void uninstallFilterAsync(EthFilter filter, RespCallback<EthUninstallFilter> callback);
void uninstallFilterAsync(LogFilterResponse filter, RespCallback<UninstallLogFilter> callback);

EthLog getLogs(org.fisco.bcos.sdk.v3.client.protocol.request.EthFilter filter);
LogWrapper getLogs(LogFilterRequest filter);

void getLogsAsync(
org.fisco.bcos.sdk.v3.client.protocol.request.EthFilter filter,
RespCallback<EthLog> callback);
void getLogsAsync(LogFilterRequest filter, RespCallback<LogWrapper> callback);

EthLog getFilterLogs(EthFilter filter);
LogWrapper getFilterLogs(LogFilterResponse filter);

void getFilterLogsAsync(EthFilter filter, RespCallback<EthLog> callback);
void getFilterLogsAsync(LogFilterResponse filter, RespCallback<LogWrapper> callback);

void start();

Expand Down
68 changes: 33 additions & 35 deletions src/main/java/org/fisco/bcos/sdk/v3/client/ClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.fisco.bcos.sdk.v3.client.protocol.model.GroupNodeIniInfo;
import org.fisco.bcos.sdk.v3.client.protocol.request.JsonRpcMethods;
import org.fisco.bcos.sdk.v3.client.protocol.request.JsonRpcRequest;
import org.fisco.bcos.sdk.v3.client.protocol.request.LogFilterRequest;
import org.fisco.bcos.sdk.v3.client.protocol.request.Transaction;
import org.fisco.bcos.sdk.v3.client.protocol.response.Abi;
import org.fisco.bcos.sdk.v3.client.protocol.response.BcosBlock;
Expand All @@ -53,10 +54,9 @@
import org.fisco.bcos.sdk.v3.client.protocol.response.Call;
import org.fisco.bcos.sdk.v3.client.protocol.response.Code;
import org.fisco.bcos.sdk.v3.client.protocol.response.ConsensusStatus;
import org.fisco.bcos.sdk.v3.client.protocol.response.EthFilter;
import org.fisco.bcos.sdk.v3.client.protocol.response.EthLog;
import org.fisco.bcos.sdk.v3.client.protocol.response.EthUninstallFilter;
import org.fisco.bcos.sdk.v3.client.protocol.response.GroupPeers;
import org.fisco.bcos.sdk.v3.client.protocol.response.LogFilterResponse;
import org.fisco.bcos.sdk.v3.client.protocol.response.LogWrapper;
import org.fisco.bcos.sdk.v3.client.protocol.response.ObserverList;
import org.fisco.bcos.sdk.v3.client.protocol.response.PbftView;
import org.fisco.bcos.sdk.v3.client.protocol.response.Peers;
Expand All @@ -65,6 +65,7 @@
import org.fisco.bcos.sdk.v3.client.protocol.response.SyncStatus;
import org.fisco.bcos.sdk.v3.client.protocol.response.SystemConfig;
import org.fisco.bcos.sdk.v3.client.protocol.response.TotalTransactionCount;
import org.fisco.bcos.sdk.v3.client.protocol.response.UninstallLogFilter;
import org.fisco.bcos.sdk.v3.config.ConfigOption;
import org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigFeature;
import org.fisco.bcos.sdk.v3.contract.precompiled.sysconfig.SystemConfigService;
Expand Down Expand Up @@ -1443,155 +1444,152 @@ public int getNegotiatedProtocol() {
}

@Override
public EthFilter newFilter(org.fisco.bcos.sdk.v3.client.protocol.request.EthFilter params) {
public LogFilterResponse newFilter(LogFilterRequest params) {
return this.callRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.NEW_FILTER, Arrays.asList(this.groupID, params)),
EthFilter.class);
LogFilterResponse.class);
}

@Override
public void newFilterAsync(
org.fisco.bcos.sdk.v3.client.protocol.request.EthFilter params,
RespCallback<EthFilter> callback) {
public void newFilterAsync(LogFilterRequest params, RespCallback<LogFilterResponse> callback) {
this.asyncCallRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(JsonRpcMethods.NEW_FILTER, Arrays.asList(groupID, params)),
EthFilter.class,
LogFilterResponse.class,
callback);
}

@Override
public EthFilter newBlockFilter() {
public LogFilterResponse newBlockFilter() {
return this.callRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(JsonRpcMethods.NEW_BLOCK_FILTER, Arrays.asList(this.groupID)),
EthFilter.class);
LogFilterResponse.class);
}

@Override
public void newBlockFilterAsync(RespCallback<EthFilter> callback) {
public void newBlockFilterAsync(RespCallback<LogFilterResponse> callback) {
this.asyncCallRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(JsonRpcMethods.NEW_BLOCK_FILTER, Arrays.asList(this.groupID)),
EthFilter.class,
LogFilterResponse.class,
callback);
}

@Override
public EthFilter newPendingTransactionFilter() {
public LogFilterResponse newPendingTransactionFilter() {
return this.callRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.NEW_PENDING_TX_FILTER, Arrays.asList(this.groupID)),
EthFilter.class);
LogFilterResponse.class);
}

@Override
public void newPendingTransactionFilterAsync(RespCallback<EthFilter> callback) {
public void newPendingTransactionFilterAsync(RespCallback<LogFilterResponse> callback) {
this.asyncCallRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.NEW_PENDING_TX_FILTER, Arrays.asList(this.groupID)),
EthFilter.class,
LogFilterResponse.class,
callback);
}

@Override
public EthLog getFilterChanges(EthFilter filter) {
public LogWrapper getFilterChanges(LogFilterResponse filter) {
return this.callRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.GET_FILTER_CHANGES,
Arrays.asList(this.groupID, filter.getResult())),
EthLog.class);
LogWrapper.class);
}

@Override
public void getFilterChangesAsync(EthFilter filter, RespCallback<EthLog> callback) {
public void getFilterChangesAsync(LogFilterResponse filter, RespCallback<LogWrapper> callback) {
this.asyncCallRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.GET_FILTER_CHANGES,
Arrays.asList(this.groupID, filter.getResult())),
EthLog.class,
LogWrapper.class,
callback);
}

@Override
public EthUninstallFilter uninstallFilter(EthFilter filter) {
public UninstallLogFilter uninstallFilter(LogFilterResponse filter) {
return this.callRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.UNINSTALL_FILTER,
Arrays.asList(this.groupID, filter.getResult())),
EthUninstallFilter.class);
UninstallLogFilter.class);
}

@Override
public void uninstallFilterAsync(EthFilter filter, RespCallback<EthUninstallFilter> callback) {
public void uninstallFilterAsync(
LogFilterResponse filter, RespCallback<UninstallLogFilter> callback) {
this.asyncCallRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.UNINSTALL_FILTER,
Arrays.asList(this.groupID, filter.getResult())),
EthUninstallFilter.class,
UninstallLogFilter.class,
callback);
}

@Override
public EthLog getLogs(org.fisco.bcos.sdk.v3.client.protocol.request.EthFilter params) {
public LogWrapper getLogs(LogFilterRequest params) {
return this.callRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(JsonRpcMethods.GET_LOGS, Arrays.asList(this.groupID, params)),
EthLog.class);
LogWrapper.class);
}

@Override
public void getLogsAsync(
org.fisco.bcos.sdk.v3.client.protocol.request.EthFilter params,
RespCallback<EthLog> callback) {
public void getLogsAsync(LogFilterRequest params, RespCallback<LogWrapper> callback) {
this.asyncCallRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(JsonRpcMethods.GET_LOGS, Arrays.asList(this.groupID, params)),
EthLog.class,
LogWrapper.class,
callback);
}

@Override
public EthLog getFilterLogs(EthFilter filter) {
public LogWrapper getFilterLogs(LogFilterResponse filter) {
return this.callRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.GET_FILTER_LOGS,
Arrays.asList(this.groupID, filter.getResult())),
EthLog.class);
LogWrapper.class);
}

@Override
public void getFilterLogsAsync(EthFilter filter, RespCallback<EthLog> callback) {
public void getFilterLogsAsync(LogFilterResponse filter, RespCallback<LogWrapper> callback) {

this.asyncCallRemoteMethod(
this.groupID,
"",
new JsonRpcRequest<>(
JsonRpcMethods.GET_FILTER_LOGS,
Arrays.asList(this.groupID, filter.getResult())),
EthLog.class,
LogWrapper.class,
callback);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ public ListTopic(String... optionalTopics) {
}
}

public ListTopic(List<String> topics) {
this.topics = new ArrayList<>();
for (String topic : topics) {
if (topic != null) {
this.topics.add(new SingleTopic(topic));
} else {
this.topics.add(new SingleTopic());
}
}
}

@Override
public List<SingleTopic> getValue() {
return topics;
Expand Down
Loading

0 comments on commit 5b3647c

Please sign in to comment.