Skip to content
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

合约权限问题 #63

Open
userInner opened this issue Jul 1, 2023 · 4 comments
Open

合约权限问题 #63

userInner opened this issue Jul 1, 2023 · 4 comments

Comments

@userInner
Copy link

EVM

1.使用bin/xchain-cli 生成合约账号
2.并且使用这个合约账号部署合约
3.使用java-sdk调用一个合约方法,需要使用到部署合约的合约账号,出现了权限不足(这个合约方法做了一个modifier),也就是说我使用account.create()加载的用户,设置的合约账号,是错误的

部署账号: XC4944044147631208@xuper

sdk设置的合约账号:

image

终端返回的错误

2023-07-01T15:11:21.975+08:00 ERROR 16128 --- [nio-8888-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.RuntimeException: io.grpc.StatusRuntimeException: UNKNOWN: Err:500-50501-contract invoke failed+error 17 - Error 17: execution reverted: execution reverted] with root cause

io.grpc.StatusRuntimeException: UNKNOWN: Err:500-50501-contract invoke failed+error 17 - Error 17: execution reverted: execution reverted
@superlitian
Copy link

为什么不用 getAccountFromFile 方法获取账号呢?https://github.com/xuperchain/xuper-java-sdk/blob/master/src/main/java/com/baidu/xuper/api/Account.java#L123

@userInner
Copy link
Author

我测试了Account.create()和getAccountFromFile加载的用户,他们地址是一样的

@userInner
Copy link
Author

这个问题是因为我用bin/xchain-cli部署导致的,导致构造函数使用了合约账号转换的evm地址。
但是我合约账号部署,我如何用sdk调用呢,使用account.setContractAccount() 还是没有用。

@superlitian
Copy link

java sdk 现在存在一个bug,具体详情可以看下这个 issues: #64

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

No branches or pull requests

2 participants