-
Notifications
You must be signed in to change notification settings - Fork 335
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
Introduce Weight v2 support for EVM (frontier) #2316
Conversation
Fixed parameter in execute is_precompile_or_fail check format
# Conflicts: # Cargo.lock # Cargo.toml
Coverage generated "Tue Jun 6 10:52:23 UTC 2023": Master coverage: 71.19% |
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.
I lelft some comments, there is also some TODO that should be fixed before merge
thank you @librelois , done |
4d304e9
to
f402f12
Compare
let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks< | ||
fc_mapping_sync::EthereumBlockNotification<Block>, | ||
> = Default::default(); | ||
let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks); |
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.
A question about the channel, if this is created per-subscription is it possible to OOM kill the client via flooding it with subscriptions?
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.
If the connection is kept open in the client end, the limit of channels is the number of websocket connections the server supports. Each time a new ethereum block is produced, channels associated to closed connections are removed from the pool.
What does it do?
This PR introduces support for external cost recording in evm execution.
The goal is to add additional metric(s) capacity that will result in an
OutOfGas
when exhausted. When theevm
is compiled with awith-substrate
feature, adds two additionalPrecompileHandle
methods -record_external_cost
andrefund_external_cost
- which are called onpre_validate
, that is, before anOpCode
is executed. This way we make sure each OpCode can be executed not only taking native remaininggas
into consideration, but also any other metric that the execution is bounded with. In the case of Moonbeam there is only one metric for now -pov_size
- but it will also supportref_time
soon™. This keeps behavioural changes in the evm to bare minimum while adding the virtual gasometer dimension in the Substrate backend.Runtime Changes
GasLimitPovRatio
, which is set to 1/4 - 4 gas unit per byte.call
runtime api now supports external cost recording in non-transactional context as well.Client Changes
The concept of
OutOfGas
and refunds is expanded, and might break some Dapp asumptions.OutOfGas
can now be thrown transaction-wide if any of the configured metrics' capacity is reached - in other words, the evm can OOG with remaining legacy gas in the gasometer.Refunds are based on the more consumed resource after the execution - in other words, if more
pov_size
has been consumed proportionally than legacy gas, the refund will be calculated usingpov_size
.