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

feat: use toner for TL-B #857

Merged
merged 1 commit into from
May 31, 2024
Merged

Conversation

mitinarseny
Copy link
Contributor

Hey @akostylev0,

Thank you again for your great work!

I've noticed you've started to implement TL-B (de)serialization in ton-types crate lately. I have a proposal of using existing toner implementation for that. I had been working on it actively for last couple of months. I've actually used it for my personal project alongside with tonlibjson-client and it was a great fit!

Here is a PR that adds a new dependency for toner and illustrates how easy it can be to write Rust bindings for your smart-contracts and use already existing TL-B types and (de)serialization implementation written in a very modular and idiomatic way. In particular, it heavily utilizes Rust type system and allows to avoid writing wrapper types for (de)serialization thanks to BitPackAs/BitUnpackAs/CellSerializeAs/CellDeserializeAs traits (the idea was borrowed from serde_with crate)

Please, ping me if you have any questions and feel free to add issues to toner repo.

PS: toner doesn't have an extensive documentation at the moment, but I'd be happy to add one, especially if you decide to use it in this project.

Hope you'll find it useful!

@mitinarseny mitinarseny changed the title feat: use toner for TL-B feat: use toner for TL-B May 27, 2024
@akostylev0
Copy link
Member

Hello, @mitinarseny!
Thanks for your amazing work.
My current goal is to support query routing in ton-liteserver-client, similar to how it works in tonlibjson-client. To achieve this, I need to learn how to parse ShardHashes. The main blocker right now is handling hashmaps in TL-B. I have already made some progress in #851, but I'm still far from having a fully working and elegant solution.

I will try to implement the hashmap using toner and will get back to you with some feedback and some decision.

@mitinarseny
Copy link
Contributor Author

I've added the initial implementation for HashmapE in toner 0.2.19.

It lacks documentation and most of methods (such as set(key, value)) but still can be a good place to start. Please, check it out at let me know what you think. Feel free to create issues/PRs, I'd be happy to think together

@akostylev0 akostylev0 merged commit d1fa5e5 into getgems-io:master May 31, 2024
7 checks passed
@akostylev0
Copy link
Member

Thanks!

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.

2 participants