Upgradable library.. supported?

Hi guys

I am just writing to see if Zeppelin had discontinued support for upgradable Libraries in Solidity or if not, whether they would even solve my use case :smile:

Right now, we would just love a sub-set of our contracts functionality to be isolated.

The functionality will ideally accept a storage struct as an arg so we can access an internal mapping. A library seems like a perfect use case for this - however we would love for it to be upgradable. Past the blog post (https://medium.com/zeppelin-blog/proxy-libraries-in-solidity-79fbe4b970fd) in 2017.. I can't see anything from Zeppelin on this. Is it possible? Does it function just the same as a regular solidity lib? Would some special delegateCall needed on the sending side to access storage, or is it even possible through a proxy contract?

Thanks!
Alex

1 Like

Hi @alsco77 welcome to the community forum :wave: I hope all is well settling in to Berlin life.

Could you isolate the functionality into a contract that can be upgradeable using OpenZeppelin SDK (ā€œunstructured storageā€ proxy pattern)?

As for using a library, hopefully someone in the community can give some input on making this upgradeable.

Hey there @alsco77! Welcome!

After that 2017 post by @maraoz we didn’t develop the idea any further, so we don’t have an offering that you would be able to use out of the box.

Note that any implementation of an upgradeable library requires a CALL operation in order to find out which is the current library address, because of the way storage and DELEGATECALL interact. This implies that there will be a base cost of 700 (the cost of a CALL) in any such implementation, which makes the gas overhead comparable to a normal proxy contract.

I agree though that the gas savings of passing storage args might be greater.

1 Like

I don’t believe it’s possible. :worried:

1 Like

I was looking for this too. Closest I came across was this article and this example

1 Like