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

Gas Savings Upon Market Creation #70

Open
code423n4 opened this issue Oct 6, 2021 · 1 comment
Open

Gas Savings Upon Market Creation #70

code423n4 opened this issue Oct 6, 2021 · 1 comment
Labels
bug Warden finding G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Handle

leastwood

Vulnerability details

Impact

The owner is able to deploy new markets by interacting with MarketPlace.sol and calling createMarket(). A corresponding ZcToken and vault are deployed at a fixed cost which is rather high due to the associated bytecode storage costs. Openzeppelin's Clones library offers a cheap alternative to standard deployment setups by cloning the contract functionality while still utilising the same bytecode. This is made possible by delegating all calls to a base contract

Proof of Concept

https://github.com/Swivel-Finance/gost/blob/v2/test/marketplace/MarketPlace.sol#L53-L70
https://docs.openzeppelin.com/contracts/3.x/api/proxy#minimal_clones
https://eips.ethereum.org/EIPS/eip-1167

Tools Used

Manual code review

Recommended Mitigation Steps

Consider utilising Openzeppelin's Clones library to considerably reduce market deployment costs.

code423n4 added a commit that referenced this issue Oct 6, 2021
@JTraversa JTraversa added the sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons label Oct 7, 2021
@JTraversa
Copy link
Collaborator

Will review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Warden finding G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

2 participants