Open matthiaszimmermann opened 2 months ago
https://amoy.polygonscan.com/tx/0x647f221b0ceab43b9738ecbbce4893866a8a822e0d17037feaeb3425a9950993
https://amoy.polygonscan.com/tx/0x721253038b3024cd2f887200bae68fae84cb22a20921eeda02891ff47eee6d30
https://amoy.polygonscan.com/tx/0xa0ebceaec8e509376ac89daa184ffc6c12bfd2a1dc6fb7fca734f83c900cf74c
https://amoy.polygonscan.com/tx/0xd9a458b70654ee7425a0229a0cc086b568fcb63ed24d27ab59fc03ac7f266309
https://amoy.polygonscan.com/tx/0x7d29421275c26a001eb6f7f5619bc65f775134886ba3f1a5b64ca47b10d2ce5c
https://amoy.polygonscan.com/tx/0x44c4be16ddad5275c1b4cc1c5da32daeedc436cdde37019fb1b5e2a2e538c376
fire usd - https://amoy.polygonscan.com/address/0xC9a9e75A180391f2643C9ce46eefa3563789ef73#code fire product - https://amoy.polygonscan.com/address/0x39e1f7234cA06749983B7Ac6eAD3977831a2D1db#code fire pool - https://amoy.polygonscan.com/address/0x10d0491AFaf08322859F0712cD7aa9E8f1B580df#code
instance - https://amoy.polygonscan.com/address/0xD1db593FafA4E108Ff64338bc3e2ADFC0DdE0668 instance reader - https://amoy.polygonscan.com/address/0x852A5327bB5218CB3B63eEb8e73d77846F762476
https://amoy.polygonscan.com/tx/0x1b9c1917e67acca0eb7cfbe3a83c0ffab6ee7fcf2ad0b0ed21a0b246e9aed95b
product - https://amoy.polygonscan.com/tx/0x35ca630007f7f1073593a8717d0f5b7f663bbd37f82b789bec83c30a029193bf pool - https://amoy.polygonscan.com/tx/0x02001c1218649bb3306ae1ce0803f44cb88b3db43b899f3f4f33f79cdfdafe1b
https://amoy.polygonscan.com/tx/0x4a925aadbe88b0d871fd63f8825d446e162d0146dea47a08dc2aaa577bc1eec2
https://amoy.polygonscan.com/tx/0xc85256c6980d7c30ec633892906c51d38d800e24b18a1c7704cc63b2f9e25cd5
https://amoy.polygonscan.com/tx/0x1f7f18ee553de36c84676bac6f4f2409aa3829e63115262bc4de3767c19aa189
instance service proxy - https://amoy.polygonscan.com/address/0x141135DCaB74922Bcc13fF0c8F6c522eB061307f instance - https://amoy.polygonscan.com/address/0x63887C3Bf9253034eC9FbDfe25bE907259015376 fireproduct - https://amoy.polygonscan.com/address/0xAA4378020C903fa62f7938F14cAc90DbE1aE6c64 firepool - https://amoy.polygonscan.com/address/0xF8fAF97E79Fb1637814DbDa7749713d7ccE682E9 fireusd - https://amoy.polygonscan.com/address/0x089BC04FC7Bfe090E2B2eaD708Dc5E8993081Ad1
create application
transactioncomparing the two transactions before and after the storage slot optimisation reveals almost no change in tx gas consumption. Further analysis revealed that the culprit is the abi.encode(...)
in the KeyValueStore which pads each field to 32 bytes (https://medium.com/@scourgedev/deep-dive-into-abi-encode-types-padding-and-disassembly-84472f1b4543). So a crucial look at how to store the infos in necessary as currently storing costs a lot of gas.
Also we think it might be worth trying to further gas optimize the authz methods. They are not expensive, but called often.
Update: directly storing IPolicy as struct instead of encoded bytes will reduce gas consumption for createApplication by ~50%. Same for fees (both are large objects that use less slots than they have fields).
Ideas: