-
Notifications
You must be signed in to change notification settings - Fork 623
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
Evm gas estimation #3299
Evm gas estimation #3299
Conversation
runtime/near-evm-runner/src/lib.rs
Outdated
} | ||
Err(VMLogicError::EvmError(err)) => { | ||
(None, Some(VMError::FunctionCallError(FunctionCallError::EvmError(err)))) | ||
(Some(outcome), None, context.evm_gas_counter.used_gas) |
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.
Hm, I'm curious how is this done in other places? Seems like this is wrong level where evm gas should be surfaced.
And the normal gas is in the VMOutcome
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.
run_evm is only called at two places, one is actual call evm in vm runner:
where i'm going to convert evm gas and add into near gas (it could be also add somewhere else, in that case, this return arg is ignored)
Another is in runtime_param_estimator:
where we're only interested in evm_gas used, and are measuring number of cpu instructions and calculate a relationship between evm_gas used vs cpu instructions (cost).
how is this done in other places?
In near gas estimator, there is a feature costs_counting
turn on measure mode and it's turned off in production, turned on in param estimator. but it's not necessary here, because evm crate will always calculate you evm gas used, and it's not expensive to return one more argument. In the case you don't need, you can ignore it.
@ilblackdragon @nearmax @evgenykuzyakov done in finalizeing numbers, volatility, 200K accounts: #3495 #3396 #3502, and updated the numbers, I think it's ready, please review again @evgenykuzyakov for counting action receipt cost i had a new approach now. by inspecting every step of txn outcome/receipt, gas_used, gas_burnt, I found:
|
Implements near/NEPs#106 - [x] PR for Ethereum chain_id - [x] Return deterministic errors - [x] evm accounts are EVM. - [x] Create sub-account from evm are removed and we don't plan to support it originally. - [x] Integrate gas usage #3299 - [x] Meta transaction calls are currently disabled - <s>Precompile in EVM to call outside to NEAR</s> Moved to separate issue - [x] Protocol version upgrade to 42 from which `evm` accounts activate. - [ ] Add a check that the `evm` account doesn't have access keys. Reviews ---- - [ ] @bowenwang1996 please review changes around genesis/protocol, so we don't leak this feature accidentally. - [ ] @nearmax if you want to take a second look at runtime changes. - [ ] @frol do we need to do something from the RPC/indexer perspective? - [ ] @ilblackdragon In case you want to take a look as well. Test plan ---- * Set of Solidity contracts that can be run inside EVM (see runtime/near-evm-runner/tests/contracts) * Interact with CryptoZombies contract via runtime & RPC test * <s>Nightly test that will leverage full e2e tooling to deploy & test a full fledged contract(s)</s> Moved to separate issue * http://nayduck.eastus.cloudapp.azure.com:3000/#/run/764 * To the moon
Mostly done, comments by @ilblackdragon isn't addressed, some clean ups needed. Didn't have a proper way to pre-cap evm gas limit from near gas limit, but this should be possible. Please review regarding how number is calculated. From my machine, it's a very stable number that change 3% or less.