apps icon indicating copy to clipboard operation
apps copied to clipboard

Uploaded contracts are sometimes not added to the tables

Open cmichi opened this issue 4 years ago • 3 comments

Sometimes when I upload and deploy a contract via https://polkadot.js.org/apps/#/contracts the extrinsic succeeds, I see all the green notification boxes, but no new contract entry is added to the "code hashes" table, nor to the "contracts" table in the UI.

My Chromium console then displays this:

other.00.c53ebd37.js:2 Uncaught DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of 'contract:0xe8d5706e56280010a1d762679736f39e6ec278a3cbbcd9a71611bf2375a6edc2' exceeded the quota.
    at Object.write (https://polkadot.js.org/apps/other.00.c53ebd37.js:2:401966)
    at Object.set (https://polkadot.js.org/apps/other.00.c53ebd37.js:2:397254)
    at He.set (https://polkadot.js.org/apps/polkadot.02.222bfb80.js:1:194185)
    at Object.add (https://polkadot.js.org/apps/polkadot.02.222bfb80.js:1:193925)
    at Object.saveAddress (https://polkadot.js.org/apps/polkadot.02.222bfb80.js:1:203484)
    at Object.saveContract (https://polkadot.js.org/apps/polkadot.02.222bfb80.js:1:203537)
    at https://polkadot.js.org/apps/main.d03c5f64.js:19:373235
    at https://polkadot.js.org/apps/main.d03c5f64.js:19:148903
    at Array.forEach (<anonymous>)
    at https://polkadot.js.org/apps/main.d03c5f64.js:19:148820

I haven't used any other browsers for polkadot-js.

I'm not 100% sure, but I have the feeling that this mostly happens when there are already contract entries in the tables. It usually works if I remove all contracts and reload the page.

cmichi avatar Nov 11 '21 16:11 cmichi

From the above, it seems that you are above 5MB localStorage - that is the limit. So I'm guessing compression may be in order here.

jacogr avatar Nov 11 '21 18:11 jacogr

From the above, it seems that you are above 5MB localStorage - that is the limit. So I'm guessing compression may be in order here.

Ah yeah, it happens when I already have some contracts in there. Still 5MB seems a high threshold to reach for just my vanilla local chain and a handful contracts.

Hmm, the .contract bundle contains the Wasm as well, could it be that this is also kept in local storage with the metadata?

cmichi avatar Nov 11 '21 19:11 cmichi

Yes, everything is stored as-is. So it adds up quickly. There is certainly room for optimisation, just needs some thought. (And migration or old/new support)

jacogr avatar Nov 11 '21 19:11 jacogr