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

Proxy initialization reentrancy fix #34

Open
gabririgo opened this issue Mar 3, 2024 · 1 comment
Open

Proxy initialization reentrancy fix #34

gabririgo opened this issue Mar 3, 2024 · 1 comment

Comments

@gabririgo
Copy link
Contributor

gabririgo commented Mar 3, 2024

Summary

Pool initialization can be reentered.

Motivation

Since during proxy initialization an arbitrary external contract is called, the method could potentially be reentered.

Specification

A non-reentrant modifier should be added to the proxy factory contracts to avoid potential side effects. Since this requires upgrading the factories, we could alternatively apply the modifier to the initialize method in the implementations, where the external contract is called.
The new modifier should use EIP-1553 - transient storage.

Should also check if we want to just use a low-level staticcall when calling an untrusted external contract to read data, as during the initialization.

@gabririgo gabririgo changed the title fix: proxy initialization reentrancy Proxy initialization reentrancy fix Mar 6, 2024
@gabririgo
Copy link
Contributor Author

view methods to an external contract execute a staticcall and therefore pool initialization cannot be reentered in the context of rigoblock. Although adding a non-reentrant modifier would future-proof the proxy initialization, there is no apparent need for a non-view call to an external contract during pool initialization, therefore it is pointless to add gas cost to pool deployment.

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

No branches or pull requests

1 participant