Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Mark assembly as memory safe #107

Merged
merged 3 commits into from
Feb 27, 2023
Merged

Mark assembly as memory safe #107

merged 3 commits into from
Feb 27, 2023

Conversation

scnale
Copy link
Collaborator

@scnale scnale commented Feb 22, 2023

This separates out changes that don't significantly alter the code of BytesLib from #81.

This improves codegen in the compiler and reduces the chance of untraceable internal codegen errors when dealing with stack variables that can't be referenced with an instruction.

I've been running into these codegen errors quite a bit while tweaking forge tests but this seems to eliminate them.

In other news, this shaves off 1KB from the contract bytecode so that's a good thing.

The bad news is that marking these sections as memory safe is unsafe to do if they don't actually respect Solidity's memory model. Both me and @nonergodic have taken a look at the assembly code being used and we think that it's memory safe.

This improves codegen in the compiler and reduces the chance of
untraceable internal codegen errors when dealing with stack variables
that can't be referenced with an instruction.

Also, it removes unused functions in `BytesLib` to reduce code surface.
@JoeHowarth JoeHowarth merged commit 24d682b into main Feb 27, 2023
@scnale scnale deleted the mark-memory-safe-asm branch February 28, 2023 00:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants