Skip to content

Commit

Permalink
feature(tvm): optimize signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeNinjaEvan committed Feb 24, 2023
1 parent 7b90c6b commit 662959d
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@
import org.tron.common.utils.BIUtil;
import org.tron.common.utils.ByteArray;
import org.tron.common.utils.ByteUtil;
import org.tron.common.utils.ForkController;
import org.tron.common.utils.Sha256Hash;
import org.tron.common.zksnark.JLibrustzcash;
import org.tron.common.zksnark.LibrustzcashParam;
import org.tron.core.capsule.AccountCapsule;
import org.tron.core.capsule.TransactionCapsule;
import org.tron.core.capsule.WitnessCapsule;
import org.tron.core.config.Parameter;
import org.tron.core.db.TransactionTrace;
import org.tron.core.exception.ZksnarkException;
import org.tron.core.vm.config.VMConfig;
Expand Down Expand Up @@ -944,10 +946,14 @@ public Pair<Boolean, byte[]> execute(byte[] rawData) {
long totalWeight = 0L;
List<byte[]> executedSignList = new ArrayList<>();
for (byte[] sign : signatures) {
byte[] recoveredAddr = recoverAddrBySign(sign, hash);

if (ForkController.instance().pass(Parameter.ForkBlockVersionEnum.VERSION_4_7_1)) {
sign = recoveredAddr;
}
if (ByteArray.matrixContains(executedSignList, sign)) {
continue;
}
byte[] recoveredAddr = recoverAddrBySign(sign, hash);
long weight = TransactionCapsule.getWeight(permission, recoveredAddr);
if (weight == 0) {
//incorrect sign
Expand Down

0 comments on commit 662959d

Please sign in to comment.