-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No need to deposit event each block #604
No need to deposit event each block #604
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. The base fee can be fetched easily through the access function.
// IIRC, using `try_mutate` will avoid unnecessary writing OP.
<BaseFeePerGas<T>>::try_mutate(|bf| {
let new_bf = ...;
if bf != new_bf {
*bf = new_bf;
deposit_event(new_bf);
Ok(())
} else {
Err(())
}
}); |
In the current implementation of the base fee pallet, the fee update almost every block, the usage blow or above the target fullness. That means only emit when it changes similar to emit each block. This way only works when many consecutive empty blocks, the fee decrease to the minimal value, then no adjustment happened, no more event. @crystalin if usage > target {
// increase
} else {
// decreate
}
See:
Maybe we should introduce a |
I agree with Wei, I see no harm in just removing the event. |
It is not a good idea to deposit this event so frequently(each block).