Skip to content

fix(api): enhance contract trigger success criteria#5688

Merged
317787106 merged 7 commits into
tronprotocol:release_v4.7.4from
317787106:hotfix/get_scale_factor
Jan 23, 2024
Merged

fix(api): enhance contract trigger success criteria#5688
317787106 merged 7 commits into
tronprotocol:release_v4.7.4from
317787106:hotfix/get_scale_factor

Conversation

@317787106
Copy link
Copy Markdown
Collaborator

@317787106 317787106 commented Jan 22, 2024

What does this PR do?

  • fix the bug of determine if triggerConstantContract succeeds in two shielded api.

Why are these changes required?

  • If given a random parameter contractAddress to getShieldedContractScalingFactor, transaction's result of triggerConstantContract will be revert, upon that, getShieldedContractScalingFactor mistakenly believes the transaction successful. The issue also occurs in method isShieldedTRC20NoteSpent.
  • This issue only affects fetching error feedback, has no impact on interaction with contracts.

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details
There are logs as following in version 4.7.3:

08:35:47.595 ERROR [rpc-full-executor-0] [API](RpcApiService.java:2485) createShieldedContractParameters: 
java.lang.ArithmeticException: BigInteger: modulus not positive
        at java.math.BigInteger.mod(BigInteger.java:2458)
        at org.tron.core.Wallet.checkPublicAmount(Wallet.java:4090)
        at org.tron.core.Wallet.createShieldedContractParameters(Wallet.java:3504)
        at org.tron.core.Wallet$$FastClassBySpringCGLIB$$3f6b5781.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
        at org.tron.common.prometheus.MetricAspect.walletAroundAdvice(MetricAspect.java:43)
        at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
        at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
        at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
        at org.tron.core.Wallet$$EnhancerBySpringCGLIB$$be58bc4b.createShieldedContractParameters(<generated>)
        at org.tron.core.services.RpcApiService$WalletApi.createShieldedContractParameters(RpcApiService.java:2477)
        at org.tron.api.WalletGrpc$MethodHandlers.invoke(WalletGrpc.java:11234)
        at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
        at io.grpc.PartialForwardingServerCallListener.onHalfClose(PartialForwardingServerCallListener.java:35)
        at io.grpc.ForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:23)
        at io.grpc.ForwardingServerCallListener$SimpleForwardingServerCallListener.onHalfClose(ForwardingServerCallListener.java:40)
        at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:355)
        at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:867)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Comment thread framework/src/main/java/org/tron/core/Wallet.java
@317787106 317787106 changed the title fix(api): fix the bug of determine if getting scalingFactor succeeds fix(api): fix the bug of determine if triggerConstantContract succeeds Jan 22, 2024
@317787106 317787106 merged commit f0a46ff into tronprotocol:release_v4.7.4 Jan 23, 2024
@317787106 317787106 changed the title fix(api): fix the bug of determine if triggerConstantContract succeeds fix(api): enhance contract trigger success criteria Jan 29, 2024
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.7.4 milestone Jan 30, 2024
@317787106 317787106 deleted the hotfix/get_scale_factor branch April 17, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants