-
Notifications
You must be signed in to change notification settings - Fork 258
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
[mpm] add some integration test #3635
Conversation
DAO Proposal集成测试时遇到了一些问题,call-api state.get_with_proof_by_root_raw 有两个参数 [access_path, state_root],有两个问题: 2)另一个参数access_path也不是固定的,已经实现了Move合约里依据DAO动态生成access_path的逻辑,但move生成的如何传参给call-api又是个问题。 整体的测试代码放到下面了: //# init -n dev //# faucet --addr creator --amount 100000000000 //# call-api chain.info //# call-api state.get_with_proof_by_root_raw ["0x6bfb460477adf9dd0455d3de2fc7f211/1/0x00000000000000000000000000000001::IdentifierNFT::IdentifierNFT<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::DaoMember<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::SbtTestDAO>,0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::DaoMemberBody<0x6bfb460477adf9dd0455d3de2fc7f211::SBTModule::SbtTestDAO>>",{{$.call-api[0].head.state_root}}] |
后面的参数少了引号。可以在 init 中加入
|
另一个参数access_path也不是固定的,已经实现了Move合约里依据DAO动态生成access_path的逻辑,但move生成的如何传参给call-api又是个问题。 这个感觉需要在命令行里拼接出来。你在 Move 里是怎么拼的? |
继续回来测试这块了。这段执行后打印的日志里没有第二条call-api日志,加了个方法打印第二个call-api的结果,也报错了。 mpm integration-test test-call-api.move running 1 tests test result: ok. 1 passed; 0 failed; 143 filtered out |
@baichuan3 第二个 api 调用出错了,出错现在不会打印 debug 信息,可以先生成 exp 文件,出错信息会和 exp 比较,就会打印出来。出错的问题在 #3664 修复了。 |
验证ok了 |
Move里实现了一个方法,传入DAOT类型和用户的address,返回对应的access_path,原始方法签名: 看mpm fork版本里,除了支持call-api外,还支持call调用. 能否通过call或者其它命令,调用以下方法,然后在call-api使用其返回值? 如果上述方式可行,会比较优雅。 同时尝试了另外一种相对tricky的思路,在faucet里执行address,遇到的问题是,指定address后不能使用alias别名,例如执行creator的地址,该思路可以预先拼好access path,但不够灵活。 @jolestar @0xpause |
可以的,任何命令的输出都可以作为后面命令的输入 |
这个 feature 是已经实现了吗? |
最后一个卡点,解决了整个DAO的集成测试就能跑通了。 @jolestar @0xpause 写了个简单的直接call的例子,能跑通:
不过上述的场景,遇到两个问题:
|
对,实现了。 |
1)泛型参数可以通过 -t / --type-args 指定 一个通过的 case:
|
@baichuan3 @0xpause
starcoin/vm/starcoin-transactional-test-harness/src/lib.rs Lines 706 to 718 in 5ad8a48
另外一个 workaround 的办法是部署一个 module 然后提供一个方法返回 creator 的地址,然后在后面的命令里 call |
返回 faucet 的交易信息这个方式也符合 mpm 现在的模式,我按这个思路改一下。 |
Pull request type
Please check the type of change your PR introduces:
test
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Other information