sol2ink tool
I want to develop a sol2ink tool, but I’m not sure whether there is actual demand for it in the industry. Therefore, I have a few questions:
Does the industry need to translate Solidity into Rust, instead of simply developing directly in Rust?
Are there any significant vulnerabilities in Solidity that are difficult to address, but can be easily solved in Rust? If so, would this justify translating Solidity into Rust to ensure the security of smart contracts?
Does the industry need to translate Solidity into Rust, instead of simply developing directly in Rust?
I think it would be helpful for learning purposes to see a ink! contract equivalent of a solidity contract. Or, a solidity contract is not performing well enough or has any security concerns, that are better in ink! (aka Rust).
Not sure what the best approach would be but I think using AI is not a crazy idea
Are there any significant vulnerabilities in Solidity that are difficult to address, but can be easily solved in Rust? If so, would this justify translating Solidity into Rust to ensure the security of smart contracts?
Not sure if you have seen but take a look at these resources and let us know if you still have questions:
- https://use.ink/docs/v6/background/why-rust-for-smart-contracts
- https://use.ink/docs/v6/background/ink-vs-solidity
Thank you for your reply. However, these documents do not explain what specific vulnerabilities Solidity struggles to handle but Rust can address effectively. For example, the reentrancy vulnerability: in Solidity, an additional reentrancy lock is needed, but in Rust, a reentrancy lock is also required to handle it properly.
The documents highlight that Rust provides type safety, memory safety, and freedom from undefined behavior. However, although Solidity lacks these features, it has not resulted in critical vulnerabilities. This greatly weakens the motivation for migrating Solidity contracts to Rust.
So I would be very interested to hear what to your view are the biggest solidity vulnerabilities
@Subway2023 It would be an interesting project. If you want to dive deeper into this, you could take a look at the OWASP Smart Contract Top 10 vulnerabilities and check how those would behave for Rust/ink!.
I'm not sure how far Solidity has catched up with Rust in terms of language safety features nowadays. Last I checked (a year or so ago) the Solidity roadmap still had things like Rust's Borrow Checker listed. So I would expect that this is an issue in current Solidity, but not in Rust/ink!.
It used to be the case that we had the advantage of Rust supporting panic on arithmetic overflows (https://github.com/use-ink/ink/pull/2631), but Solidity supports that now too (https://solidity-by-example.org/hacks/overflow/).