Skip to content
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] feat/security: Consume the full gas limit of a failed signing.Tx in the case it has multiple EthereumTx messages #2178

Open
Unique-Divine opened this issue Jan 24, 2025 · 0 comments
Labels
S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5

Comments

@Unique-Divine
Copy link
Member

Unique-Divine commented Jan 24, 2025

Context

Note

Non-blocking for Nibiru V2 on mainnet

Originally posted by @Unique-Divine in #4

I think this works as a nice-to-have feature ticket but wouldn't consider it a blocker for launch. We can work on this later and put it in one of the upgrades post v2.0

Original Ticket

Target

evmResp, err = k.ApplyEvmMsg(ctx, evmMsg, evmObj, nil /*tracer*/, true /*commit*/, txConfig.TxHash, false /*fullRefundLeftoverGas*/)
if err != nil {
return nil, errors.Wrap(err, "error applying ethereum core message")
}

Severity:

  • Impact: Low
  • Likelihood: Medium

Description:

In EthereumTx(..), which handles the MsgEthereumTx message, if a Cosmos tx contains a batch of multiple MsgEthereumTx EVM messages, and one of it errors in ApplyEvmMsg(..) (i.e., err != nil), the full gas limit (e.g. ctx.GasMeter().GasLimit()) is not consumed. This also differs from Ethereum, where all gas is consumed in case of an unexpected error.

64: 	evmResp, err = k.ApplyEvmMsg(ctx, evmMsg, evmObj, nil /*tracer*/, true /*commit*/, txConfig.TxHash, false /*fullRefundLeftoverGas*/)
65: 	if err != nil {
66: 		return nil, errors.Wrap(err, "error applying ethereum core message")
67: 	}

Recommendation:

Consume all of the remaining and unused Cosmos tx's gas limit.

@github-project-automation github-project-automation bot moved this to ⚡ Building 🧱 in ⚛️ Nibiru (Hougyoku) Jan 24, 2025
@github-actions github-actions bot added the S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5 label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-triage Status: This issue is waiting on initial triage. More Info: https://tinyurl.com/25uty9w5
Projects
Status: ⚡ Building 🧱
Development

No branches or pull requests

1 participant