XRPL-Labs / xrpld-hooks

ISC License
94 stars 28 forks source link

Emitted transaction fee math error [v1 testnet] #40

Closed wojake closed 2 years ago

wojake commented 2 years ago

Every time my Hook emits a transaction, the emitted transaction's fee is very high compared to what I expected.

The fee math seems to be alright, every computation seems to be optimized. The computation used wasn't that extreme, it's just a simple calculation (%).

The code can be found here (carbon off-set hook): https://gist.github.com/muzam1l/43925143fa19735d8c6505c34d3a6a47

Sample tx: https://hooks.bithomp.com/explorer/8560723B1CF575E3B491E299091A6C3D404101C37B76BB6F252FBE2E200C847E

Every time my Hook emits a transaction, the fee is always 81.46875 XRP.

I've also seen this happen to another Hook's emitted txs as well (not mine, I was just browsing the network)

wojake commented 2 years ago

It seems like the fee is heavily impacted when the etxn_reserve() is called, in which: 1 etxn_reserve will cost the Hook around ~81.468 XRP

The computation used in my Hook doesn't effect the fee but the transaction itself is, as the more emitted transaction I expect my Hook to execute, the more the fee is: 1 etxn_reserve = 81.46875 XRP (tx here) 10 etxn_reserve = 814.6875 XRP (tx here) 100 etxn_reserve = 8146.56 XRP (tx here)

This is my analysis, I tried my best, I hope this helps my current issue. I think my math fee is in the wrong here.

RichardAH commented 2 years ago

This was fixed with v2. Please reopen if you find further issues with fees