update docker files

This commit is contained in:
CaiHQ 2024-12-23 16:19:11 +08:00
parent 8e07feb733
commit cdf94fc50d
2 changed files with 37 additions and 31 deletions

View File

@ -133,21 +133,24 @@ public class ContractClient {
} }
private void initProps() { private void initProps() {
// LOGGER.info("initProps ---- position-----1"); LOGGER.info("initProps ---- position-----1");
contractMeta.name = get.syncGet("", "getContractName", ""); contractMeta.name = get.syncGet("", "getContractName", "");
// LOGGER.info("initProps ---- position-----2"); LOGGER.info("initProps ---- position-----2");
String strEvent = get.syncGet("", "getDeclaredEvents", ""); String strEvent = get.syncGet("", "getDeclaredEvents", "");
LOGGER.debug("event: " + strEvent); LOGGER.debug("event: " + strEvent);
contractMeta.declaredEvents = JsonUtil.fromJson(strEvent, contractMeta.declaredEvents = JsonUtil.fromJson(strEvent,
new TypeToken<Map<String, REventSemantics>>() {}.getType()); new TypeToken<Map<String, REventSemantics>>() {
// LOGGER.info("initProps ---- position-----3"); }.getType());
LOGGER.info("initProps ---- position-----3");
contractMeta.dependentContracts = contractMeta.dependentContracts =
JsonUtil.fromJson(get.syncGet("", "getDependentContracts", ""), JsonUtil.fromJson(get.syncGet("", "getDependentContracts", ""),
new TypeToken<Set<String>>() {}.getType()); new TypeToken<Set<String>>() {
// LOGGER.info("initProps ---- position-----4"); }.getType());
LOGGER.info("initProps ---- position-----4");
contractMeta.exportedFunctions = contractMeta.exportedFunctions =
JsonUtil.fromJson(get.syncGet("", "getExportedFunctions", ""), JsonUtil.fromJson(get.syncGet("", "getExportedFunctions", ""),
new TypeToken<List<FunctionDesp>>() {}.getType()); new TypeToken<List<FunctionDesp>>() {
}.getType());
contractMeta.logDetail = new HashMap<>(); contractMeta.logDetail = new HashMap<>();
for (FunctionDesp func : contractMeta.exportedFunctions) { for (FunctionDesp func : contractMeta.exportedFunctions) {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
@ -172,24 +175,25 @@ public class ContractClient {
} }
contractMeta.logDetail.put(func.functionName, str.toString()); contractMeta.logDetail.put(func.functionName, str.toString());
} }
// LOGGER.info("initProps ---- position-----5"); LOGGER.info("initProps ---- position-----5");
try { try {
String anno = get.syncGet("", "getAnnotations", ""); String anno = get.syncGet("", "getAnnotations", "");
contractMeta.annotations = contractMeta.annotations =
JsonUtil.fromJson(anno, new TypeToken<List<AnnotationNode>>() {}.getType()); JsonUtil.fromJson(anno, new TypeToken<List<AnnotationNode>>() {
}.getType());
} catch (Exception e) { } catch (Exception e) {
// supoort contract process before version 0.70 // supoort contract process before version 0.70
contractMeta.annotations = new ArrayList<>(); contractMeta.annotations = new ArrayList<>();
} }
// LOGGER.info("initProps ---- position-----6"); LOGGER.info("initProps ---- position-----6");
contractMeta.sigRequired = Boolean.parseBoolean(get.syncGet("", "isSigRequired", "")); contractMeta.sigRequired = Boolean.parseBoolean(get.syncGet("", "isSigRequired", ""));
// LOGGER.info("initProps ---- position-----7"); LOGGER.info("initProps ---- position-----7");
contractMeta.thisPermission = get.syncGet("", "showPermission", ""); contractMeta.thisPermission = get.syncGet("", "showPermission", "");
// LOGGER.info("initProps ---- position-----8"); LOGGER.info("initProps ---- position-----8");
isRunning = true; isRunning = true;
// LOGGER.info("initProps ---- position-----9"); LOGGER.info("initProps ---- position-----9");
get.syncGet("", "registerMangerPort", ContractManager.cPort.getCMPort() + ""); get.syncGet("", "registerMangerPort", ContractManager.cPort.getCMPort() + "");
contractMeta.contract = contractMeta.contract =
JsonUtil.fromJson(get.syncGet("", "getContract", ""), Contract.class); JsonUtil.fromJson(get.syncGet("", "getContract", ""), Contract.class);
@ -204,8 +208,7 @@ public class ContractClient {
} }
}); });
loadTimesAndTraffic(); loadTimesAndTraffic();
// LOGGER.info("initProps ---- position-----10"); LOGGER.info("initProps ---- position-----10 DONE!");
// LOGGER.debug("======= registerPort:" + ret + "-->" + ContractManager.startPort);
} }
public String startProcess(PrintStream ps) throws Exception { public String startProcess(PrintStream ps) throws Exception {
@ -335,7 +338,7 @@ public class ContractClient {
} else { } else {
status = get.syncGet("", "setContract", JsonUtil.toJson(contractMeta.contract)); status = get.syncGet("", "setContract", JsonUtil.toJson(contractMeta.contract));
} }
LOGGER.debug("port:" + port + " status:" + status); LOGGER.info("start status, port:" + port + " status:" + status);
ContractResult r = JsonUtil.fromJson(status, ContractResult.class); ContractResult r = JsonUtil.fromJson(status, ContractResult.class);
if (r.status == Status.Success) { if (r.status == Status.Success) {
initProps(); initProps();

View File

@ -404,7 +404,9 @@ public class ContractManager {
c.setType(ContractExecType.Sole); c.setType(ContractExecType.Sole);
SM2KeyPair pair = SM2Util.generateSM2KeyPair(); SM2KeyPair pair = SM2Util.generateSM2KeyPair();
c.setOwner(pair.getPublicKeyStr()); c.setOwner(pair.getPublicKeyStr());
c.setScript("contract analysis_client{}"); String content = "contract analysis_client{}";
c.setID(content.hashCode() + "");
c.setScript(content);
analysisClient = new ContractClient(c); analysisClient = new ContractClient(c);
try { try {
analysisClient.startProcess(System.out); analysisClient.startProcess(System.out);
@ -1800,7 +1802,8 @@ public class ContractManager {
logsDB.put(contractName, sb); logsDB.put(contractName, sb);
} }
public void changePermission(String contractFileName, String pmList) {} public void changePermission(String contractFileName, String pmList) {
}
// public String getSyncType(String contractName) { // public String getSyncType(String contractName) {
// ContractClient client = getByName(contractName); // ContractClient client = getByName(contractName);