Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static List<Actuator> createActuator(TransactionCapsule transactionCapsul
actuatorList
.add(getActuatorByContract(contract, chainBaseManager, transactionCapsule));
} catch (IllegalAccessException | InstantiationException e) {
e.printStackTrace();
logger.error("Failed to create actuator for contract {}.", contract.getType(), e);
}
});
return actuatorList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import lombok.extern.slf4j.Slf4j;
import org.tron.common.utils.ByteArray;
import org.tron.common.zksnark.JLibrustzcash;
import org.tron.common.zksnark.LibrustzcashParam.MerkleHashParams;
import org.tron.core.exception.ZksnarkException;
Expand Down Expand Up @@ -55,26 +54,6 @@ public static PedersenHashCapsule uncommitted() throws ZksnarkException {
return compressCapsule;
}

public static void main(String[] args) {
try {
byte[] a =
ByteArray
.fromHexString("05655316a07e6ec8c9769af54ef98b30667bfb6302b32987d552227dae86a087");
byte[] b =
ByteArray
.fromHexString("06041357de59ba64959d1b60f93de24dfe5ea1e26ed9e8a73d35b225a1845ba7");

PedersenHash sa = PedersenHash.newBuilder().setContent(ByteString.copyFrom(a)).build();
PedersenHash sb = PedersenHash.newBuilder().setContent(ByteString.copyFrom(b)).build();

PedersenHash result = combine(sa, sb, 25).getInstance();
// 61a50a5540b4944da27cbd9b3d6ec39234ba229d2c461f4d719bc136573bf45b
System.out.println(ByteArray.toHexString(result.getContent().toByteArray()));
} catch (ZksnarkException e) {
e.printStackTrace();
}
}

public ByteString getContent() {
return this.pedersenHash.getContent();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ public String toString() {
toStringBuff.append("transfer amount=").append(transferContract.getAmount())
.append("\n");
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
logger.debug("Failed to unpack transfer contract.", e);
}
} else if (contract.getType().equals(ContractType.TransferAssetContract)) {
TransferAssetContract transferAssetContract;
Expand All @@ -808,7 +808,7 @@ public String toString() {
toStringBuff.append("transfer amount=").append(transferAssetContract.getAmount())
.append("\n");
} catch (InvalidProtocolBufferException e) {
e.printStackTrace();
logger.debug("Failed to unpack transfer asset contract.", e);
}
}
if (this.transaction.getSignatureList().size() >= i.get() + 1) {
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/org/tron/common/utils/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public static int readData(String filePath, char[] buf) {
try (BufferedReader bufRead = new BufferedReader(new FileReader(file))) {
len = bufRead.read(buf, 0, buf.length);
} catch (IOException ex) {
ex.printStackTrace();
logger.warn("Failed to read data from file.", ex);
return 0;
}
return len;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
try {
super.doPost(request, response);
} catch (IOException e) {
e.printStackTrace();
logger.error("Failed to process JSON-RPC request.", e);
throw new RuntimeException(e);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
try {
super.doPost(request, response);
} catch (IOException e) {
e.printStackTrace();
logger.error("Failed to process JSON-RPC request.", e);
throw new RuntimeException(e);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public static List<ByteString> getTo(Transaction transaction) {
}
return list;
} catch (Exception ex) {
ex.printStackTrace();
logger.warn("Failed to extract transaction addresses.", ex);
}
return list;
}
Expand Down Expand Up @@ -361,7 +361,7 @@ public static long getAmountFromTransactionInfo(String hash, ContractType contra
logger.warn("Exception happens when get amount from transactionInfo. Exception = [{}]",
Throwables.getStackTraceAsString(e));
} catch (Throwable t) {
t.printStackTrace();
logger.warn("Unexpected error when getting amount from transaction info.", t);
}
return amount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,39 +251,6 @@ public static String generateOccupationConstantPrivateKey() {
return privateKey.toString();
}

public static void main(String[] args) {
String method = "test(string,int2,string)";
String params = "asdf,3123,adf";

String arrayMethod1 = "test(uint,uint256[3])";
String arrayMethod2 = "test(uint,uint256[])";
String arrayMethod3 = "test(uint,address[])";
String byteMethod1 = "test(bytes32,bytes11)";
String tokenMethod = "test(trcToken,uint256)";
String tokenParams = "\"nmb\",111";

System.out.println("token:" + parseMethod(tokenMethod, tokenParams));

String method1 = "test(uint256,string,string,uint256[])";
String expected1 = "db103cf30000000000000000000000000000000000000000000000000000000000000005000"
+ "0000000000000000000000000000000000000000000000000000000000080000000000000000000000000000"
+ "00000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000"
+ "0000000000100000000000000000000000000000000000000000000000000000000000000000142000000000"
+ "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000143000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000000000000000000000000030000000000000000000"
+ "0000000000000000000000000000000000000000000010000000000000000000000000000000000000000000"
+ "0000000000000000000020000000000000000000000000000000000000000000000000000000000000003";
String method2 = "test(uint256,string,string,uint256[3])";
String listString = "1 ,\"B\",\"C\", [1, 2, 3]";
System.out.println(parseMethod(method1, listString));
System.out.println(parseMethod(method2, listString));

String bytesValue1 = "\"0112313\",112313";

System.out.println(parseMethod(byteMethod1, bytesValue1));
}

abstract static class Coder {

boolean dynamic = false;
Expand Down

This file was deleted.

Loading