vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.85k stars 791 forks source link

fix[tool]: compile multiple files #4053

Closed charles-cooper closed 4 months ago

charles-cooper commented 4 months ago

What I did

fix compilation for multiple files where they initialize the same module. the analysis was getting cached between compilations, leading to a compiler panic on allocating the storage layout (because the module was previously touched by the allocator).

this was not caught in previous testing because the pattern in the test suite is to run a single compilation per test, with a fresh input bundle.

How I did it

How to verify it

Commit message

fix compilation for multiple files where they initialize the same
module. the analysis was getting cached between compilations, leading to
a compiler panic on allocating the storage layout (because the module
was previously touched by the allocator).

this was not caught in previous testing because the pattern in the test
suite is to run a single compilation per test, with a fresh input
bundle.

Description for the changelog

Cute Animal Picture

![Put a link to a cute animal picture inside the parenthesis-->]()

charles-cooper commented 4 months ago

depends on https://github.com/vyperlang/vyper/pull/3789 for the storage layout test updates

cyberthirst commented 4 months ago

very interesting issue. putting stuff to cache across separate compilation runs seems pretty dangerous. are we sure there isn't another instance of this pattern?

charles-cooper commented 4 months ago

very interesting issue. putting stuff to cache across separate compilation runs seems pretty dangerous. are we sure there isn't another instance of this pattern?

none come to mind. it's actually not supposed to cache across compilation runs, assigning _ast_of to the input bundle lifetime instead of the CompilerData lifetime was probably the mistake here