question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory-Safe Assembly

See original GitHub issue

🧐 Motivation Solidity 0.8.13 marked the production readiness of the Yul IR pipeline. This, amongst other things, helps to alleviate stack too deep errors by allowing the compiler to move items to memory as and when needed.

📝 Details One requirement of the pipeline is that any assembly sections be memory-safe, such that they only use memory that has been previously allocated either by high-level Solidity code or by reading from the free memory pointer at 0x40.

Any memory-safe assembly can be marked as such by annotating it assembly ("memory-safe") { ... }. However, this is only possible for code that uses 0.8.13 and above. For code that needs to be backward-compatible, the assembly block can be annotated:

/// @solidity memory-safe-assembly
assembly {
    ...
}

Details about what constitutes memory-safe code is available at https://docs.soliditylang.org/en/v0.8.13/assembly.html#memory-safety.

Would it be possible to review and annotate any uses of assembly within the OpenZeppelin libraries where it is determined to be memory-safe, and to modify then annotate when not?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
frangiocommented, Apr 18, 2022

Multiple PRs are okay but please try to minimize them. Feel free to continue to coordinate in this issue.

1reaction
Kartik0099commented, May 7, 2022

Hey @nathan-lapinski I have complete below files

contracts/utils/cryptography/ECDSA.sol, contracts/utils/cryptography/MerkleProof.sol, contracts/utils/Create2.sol.

Please update the status it’s merged

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ο χρήστης Solidity στο Twitter: "Inline assembly is "memory ...
Inline assembly is "memory-safe" when it only uses memory that has been previously allocated either by high-level Solidity code or by reading from...
Read more >
Inline Assembly - Solidity Programming Language
No information is available for this page.
Read more >
What is memory safety and why does it matter? - Prossimo
Memory safe languages include Rust, Go, C#, Java, Swift, Python, and JavaScript. Languages that are not memory safe include C, C++, and assembly....
Read more >
Assembly safety with Solidity 0.8.13 - OpenZeppelin Forum
However, one requirement of the pipeline is that any assembly sections be memory-safe, such that they only use memory that has been ...
Read more >
Setting up Belkin router's Memory Safe function
To back up and restore files through Memory Safe, follow the instructions below: i. Backing up data ii. Restoring data from backup.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found