Open conr2d opened 3 years ago
Hey @conr2d - we were working on the preexecution hook, but it created a significant performance degradation since it required us to instantiate the WASM engine (which is extremely expensive) twice per transaction. Would your approach introduce a similar issue?
@b1bart @victorj8
I found preexecution_hook is under development. I implemented post_transaction_hook feature for applying different transaction fee mechanism. https://github.com/turnpike/eos/commits/feature/post_transaction_hook
In enterprise environment (private/consortium network), there was a request for fixed (reference fee table by
contract::action
name combination) or flexible (similar to Ethereum Gas instead of CPU/NET/RAM, CPU/NET/RAM usage can be used to calculate fee amount) transaction fee system. The current design of post_transaction_hook is callingeosio::ontx
in the end of transaction execution, and CPU/NET/RAM usage will be passed as payload. (The list of action name can be passed to find fixed fee rate from table instead of deserializing transaction in wasm). CPU/NET will not be charged during post_transaction_hook execution, so the target contract of post_transaction_hook should be managed carefully. It woud be possible to makeeosio::setcode
for the target contract of post_transaction_hook requires BP multi-sig, or restrict changing RAM usage during post_transaction_hook execution.Code diff makes things difficult, so if it is allowed, I would implement post_transaction_hook feature to fit the current design of preexecution_hook. Can you share any schedule or plan about transaction hook feature?