paritytech/wasm-instrument

Update debug information when injecting gas metering

Closed this issue · 4 comments

Injecting the gas metering causes the function indices to shift. This causes any stacktraces using the name section to be wrong for any function with an index higher than the injected gas meter functions.

athei commented

This should be optional. When using this on chain like pallet-contracts does we certainly don't want to deal with strings.

changing the signature would be a breaking change, is it worth having a second inject_with_debug sort of thing?

Just to be clear, on my previous comment I'm assuming a scenario where there is debug information but by default it would not be changed. If those have no debug information then nothing happens.

@athei alternatively I can remove the parse_names() from the inject fn and add a comment explaining that if you need the name section to be updated then parse_names needs to be called beforehand. It's not great but it solves the problem with less code