Skip to content

Commit

Permalink
Merge branch 'develop' into fix/constant_call
Browse files Browse the repository at this point in the history
  • Loading branch information
huzhenyuan authored Sep 6, 2018
2 parents b36a8b7 + 987f99a commit 20c9b8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/tron/common/runtime/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ private void create()
byte[] code = newSmartContract.getBytecode().toByteArray();
byte[] contractAddress = Wallet.generateContractAddress(trx);
byte[] ownerAddress = contract.getOwnerAddress().toByteArray();
byte[] contractName = newSmartContract.getName().getBytes();

if (contractName.length > 200) {
logger.error("contractName's length mustn't greater than 200");
throw new ContractValidateException("contractName's length mustn't greater than 200");
}

long percent = contract.getNewContract().getConsumeUserResourcePercent();
if (percent < 0 || percent > 100) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/tron/core/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,9 @@ public Transaction triggerContract(TriggerSmartContract triggerSmartContract,
runtime.finalization();
// TODO exception
if (runtime.getResult().getException() != null) {
// runtime.getResult().getException().printStackTrace();
throw new RuntimeException(runtime.getResult().getException().getMessage());
RuntimeException e = runtime.getResult().getException();
logger.warn(e);
throw new RuntimeException(e.getMessage());
}

ProgramResult result = runtime.getResult();
Expand Down

0 comments on commit 20c9b8d

Please sign in to comment.