@@ -2471,15 +2471,20 @@ public Transaction triggerContract(TriggerSmartContract
24712471 Return .Builder retBuilder )
24722472 throws ContractValidateException , ContractExeException , HeaderNotFound , VMIllegalException {
24732473
2474- AbiStore abiStore = chainBaseManager .getAbiStore ();
24752474 byte [] contractAddress = triggerSmartContract .getContractAddress ()
24762475 .toByteArray ();
2477- AbiCapsule abiCapsule = abiStore .get (contractAddress );
2478- if (abiCapsule == null ) {
2476+ ContractCapsule contractCapsule = chainBaseManager . getContractStore () .get (contractAddress );
2477+ if (contractCapsule == null ) {
24792478 throw new ContractValidateException (
24802479 "No contract or not a valid smart contract" );
24812480 }
2482- SmartContract .ABI abi = abiCapsule .getInstance ();
2481+ AbiCapsule abiCapsule = chainBaseManager .getAbiStore ().get (contractAddress );
2482+ SmartContract .ABI abi ;
2483+ if (abiCapsule == null || abiCapsule .getData () == null ) {
2484+ abi = SmartContract .ABI .getDefaultInstance ();
2485+ } else {
2486+ abi = abiCapsule .getInstance ();
2487+ }
24832488
24842489 byte [] selector = WalletUtil .getSelector (
24852490 triggerSmartContract .getData ().toByteArray ());
@@ -2580,7 +2585,7 @@ public SmartContract getContract(GrpcAPI.BytesMessage bytesMessage) {
25802585 ContractCapsule contractCapsule = chainBaseManager .getContractStore ().get (address );
25812586 if (Objects .nonNull (contractCapsule )) {
25822587 AbiCapsule abiCapsule = chainBaseManager .getAbiStore ().get (address );
2583- if (Objects . nonNull ( abiCapsule ) ) {
2588+ if (abiCapsule != null && abiCapsule . getInstance () != null ) {
25842589 contractCapsule = new ContractCapsule (
25852590 contractCapsule .getInstance ().toBuilder ().setAbi (abiCapsule .getInstance ()).build ());
25862591 }
@@ -2609,7 +2614,7 @@ public SmartContractDataWrapper getContractInfo(GrpcAPI.BytesMessage bytesMessag
26092614 ContractCapsule contractCapsule = chainBaseManager .getContractStore ().get (address );
26102615 if (Objects .nonNull (contractCapsule )) {
26112616 AbiCapsule abiCapsule = chainBaseManager .getAbiStore ().get (address );
2612- if (Objects . nonNull ( abiCapsule ) ) {
2617+ if (abiCapsule != null && abiCapsule . getInstance () != null ) {
26132618 contractCapsule = new ContractCapsule (
26142619 contractCapsule .getInstance ().toBuilder ().setAbi (abiCapsule .getInstance ()).build ());
26152620 }
0 commit comments