You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I have included Frontier in my runtime and I am trying to correctly measure the gas and weights of my precompiles. I have some questions about using the functions that Frontier provides.
What is the reasoning behind performing a record and then a refund? Why not do a record directly after the call? UPDATE: I have understood that record+refund is the way to charge computation costs even in the case of dispatch errors. But shouldn't record_cost follow the same approach as record_external_cost, where the cost is first recorded and then refunded?
Within the refund function, a record_cost is also performed. I do not understand the difference between record_cost and record_external_cost. From my understanding, the cost is being recorded twice, causing my call to cost double the gas it should.
Within the refund function, if we are already using the proof_size of the weight, why not also use it to measure the ref_time? There is a comment that explains: TODO: refund ref time when precompile will be benchmarked, but I do not understand what this means.
I am using record_external_cost directly instead of using try_dispatch, which indirectly calls it. My surprise is that this function has no effect on the costs of my call. Investigating the pallet-evm code, I see that in the call there are two parameters set to None which are the ones that later in the code cause the cost not to be recorded. What is the reasoning behind that?
The text was updated successfully, but these errors were encountered:
Question
Hello, I have included Frontier in my runtime and I am trying to correctly measure the gas and weights of my precompiles. I have some questions about using the functions that Frontier provides.
record
and then arefund
? Why not do arecord
directly after the call?UPDATE: I have understood that record+refund is the way to charge computation costs even in the case of dispatch errors. But shouldn't
record_cost
follow the same approach asrecord_external_cost
, where the cost is first recorded and then refunded?refund
function, arecord_cost
is also performed. I do not understand the difference betweenrecord_cost
andrecord_external_cost
. From my understanding, the cost is being recorded twice, causing my call to cost double the gas it should.refund
function, if we are already using the proof_size of the weight, why not also use it to measure theref_time
? There is a comment that explains: TODO: refund ref time when precompile will be benchmarked, but I do not understand what this means.record_external_cost
directly instead of usingtry_dispatch
, which indirectly calls it. My surprise is that this function has no effect on the costs of my call. Investigating the pallet-evm code, I see that in the call there are two parameters set toNone
which are the ones that later in the code cause the cost not to be recorded. What is the reasoning behind that?The text was updated successfully, but these errors were encountered: