Skip to content

feat(log): catch ContractExeException in createShieldedContractParameter #5660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
1 change: 1 addition & 0 deletions framework/src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,7 @@ private void postSolidityLogContractTrigger(Long blockNum, Long lastSolidityNum)
triggerCapsule.setTriggerName(Trigger.SOLIDITYLOG_TRIGGER_NAME);
EventPluginLoader.getInstance().postSolidityLogTrigger(triggerCapsule);
} else {
// when switch fork, block will be post to triggerCapsuleQueue, transaction may be not found
logger.error("PostSolidityLogContractTrigger txId = {} not contains transaction.",
triggerCapsule.getTransactionId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
import org.tron.core.config.args.Args;
import org.tron.core.db.Manager;
import org.tron.core.exception.BadItemException;
import org.tron.core.exception.ContractExeException;
import org.tron.core.exception.ContractValidateException;
import org.tron.core.exception.ItemNotFoundException;
import org.tron.core.exception.NonUniqueObjectException;
Expand Down Expand Up @@ -2475,7 +2476,7 @@ public void createShieldedContractParameters(
ShieldedTRC20Parameters shieldedTRC20Parameters = wallet
.createShieldedContractParameters(request);
responseObserver.onNext(shieldedTRC20Parameters);
} catch (ZksnarkException | ContractValidateException e) {
} catch (ZksnarkException | ContractValidateException | ContractExeException e) {
responseObserver.onError(getRunTimeException(e));
logger.info("createShieldedContractParameters: {}", e.getMessage());
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.tron.core.capsule.utils;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.junit.Assert;
import org.junit.Test;

Expand All @@ -23,4 +25,14 @@ public void testGetRLPData() {
Assert.assertEquals(new String(rlpList.getRLPData()), "rlpData");
}

@Test
public void testToBytes()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Method method = RLP.class.getDeclaredMethod("toBytes", Object.class);
method.setAccessible(true);

byte[] aBytes = new byte[10];
byte[] bBytes = (byte[]) method.invoke(RLP.class, aBytes);
Assert.assertArrayEquals(aBytes, bBytes);
}
}