-
Notifications
You must be signed in to change notification settings - Fork 2.6k
put_code takes too much time #3885
Comments
I've done some benchmarking on the wasm file in #3819 and (as expected) the hot functions are |
Oh, thanks for looking into this! Good to know. I think we can't rely on an early return since we always have to take into account the worst case (e.g. an attacker can always put |
A little update on this: I just ran into the same issue with:
with a more than reasonably sized contract (52k). The problem persists and might be worse than expected. It has already been reported in #4153, that deploying contracts much smaller than 240k will bring block production to halt. The compiled ERC20 example in the So this might need some more investigation. |
@Stefie I might try and write some benchmarks for this so we can examine why it's taking so long. |
Note that if I understand correctly this additional time to produce the block is under certain circumstances:
So even if indeed with our testing chain that does nothing it seems we have this additional time, in production we can't actually use on it really. |
additional idea that pop-up with @expenses maybe we can split the work in multiple extrinsics: instead of having only put_code that put the code and do the check we could do that in multiple extrinsic such as:
|
Should not be relevant anymore. |
#3819 reports that
put_code
can take a lot of time for a big-but-still-reasonable-sized (IMO, 240k, see the issue) contract. While, integration of wasmtime can fix that, the situation can imply that put_code requires some optimization.One clue how to improve this might be in the insight that we are doing multiple iterations over the wasm binary. We could try to leverage the streaming approach to read, check and instrument binary in one go. This however would require quite some refactorings of the wasm-utils side.
The text was updated successfully, but these errors were encountered: