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

[gen]update golang gen code #3007

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[gen]update golang gen code #3007

wants to merge 2 commits into from

Conversation

ssyuan
Copy link
Member

@ssyuan ssyuan commented Nov 2, 2021

No description provided.

@@ -621,14 +700,24 @@ func decode_{0}_argument(arg diemtypes.TransactionArgument) (value {1}, err erro
Address => "diemtypes.AccountAddress".into(),
Vector(type_tag) => match type_tag.as_ref() {
U8 => "[]byte".into(),
U128 => "diemtypes.VecU128".into(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diemtypes 这个 prefix 是不是也可以考虑改一下?要不就改成 movetypes ?

Comment on lines +626 to +630
Bool => format!("TransactionArgument__Bool(value={})", name),
U8 => format!("TransactionArgument__U8(value={})", name),
U64 => format!("TransactionArgument__U64(value={})", name),
U128 => format!("TransactionArgument__U128(value={})", name),
Address => format!("TransactionArgument__Address(value={})", name),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个改了也会影响 python3 的生成代码吧?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fikgol python sdk 现在用了代码生成了吗?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用了,为啥要改python3的


#[ignore]
#[test]
fn test_that_golang_code_compiles_and_demo_runs() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是我们考虑在 ci 上安装环境,把这个 test 打开,保证每次修改都能正常生成代码

@@ -515,6 +584,9 @@ var script_function_decoder_map = map[string]func(diemtypes.TransactionPayload)
Address => ("Address", "value = arg.Value".into()),
Vector(type_tag) => match type_tag.as_ref() {
U8 => ("U8Vector", default_stmt),
U128 => ("VecU128", default_stmt),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

每支持一种 vector 就要增加一个新类型,感觉有点笨,但貌似暂时也没很好的办法。以后考虑支持泛型的语言可以用更优雅一些的办法。提过一个 issue diem/diem#8628

Comment on lines +626 to +630
Bool => format!("TransactionArgument__Bool(value={})", name),
U8 => format!("TransactionArgument__U8(value={})", name),
U64 => format!("TransactionArgument__U64(value={})", name),
U128 => format!("TransactionArgument__U128(value={})", name),
Address => format!("TransactionArgument__Address(value={})", name),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用了,为啥要改python3的

@jolestar
Copy link
Member

jolestar commented Nov 2, 2021

starcoin_types.yml 文件会自动重新生成

@jolestar jolestar added the help wanted Extra attention is needed label Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants