Repository: foundry-rs/foundry (language: rust)

Issue:
bug: invalid gas estimation on Metis
### Component

Cast

### Have you ensured that all of these are up to date?

- [x] Foundry
- [x] Foundryup

### What version of Foundry are you on?

forge 0.3.0 (5a8bd89 2024-12-20T08:46:21.555250780Z)

### What version of Foundryup are you on?

foundryup: 0.3.3

### What command(s) is the bug in?

cast send

### Operating System

Linux

### Describe the bug

Sending transactions on Metis fails due to bad gas estimation. E.g. my wallet holds 0.5 metis and running
```
 cast send $WALLET_ARGS --value 0.0000001ether $(cast wallet address $WALLET_ARGS)
```
(which is just sending some metis to self) yields:
```
Error: server returned an error response: error code -32000: insufficient balance to pay for gas
```
Checked with `https://andromeda.metis.io/`, `https://metis-rpc.publicnode.com` and `https://metis.drpc.org`, so it's consistent.

Using `--gas-limit` to override estimation solves the issue, transactions work fine. Using `forge script` also solves the problem, probably because simulation is done locally. It seems that metis RPCs may be returning something exotic when estimating gas.


Discussion / hints:

Fix patch:
diff --git a/crates/cli/src/utils/cmd.rs b/crates/cli/src/utils/cmd.rs
index eca7a7a3998a..c226054dd731 100644
--- a/crates/cli/src/utils/cmd.rs
+++ b/crates/cli/src/utils/cmd.rs
@@ -175,7 +175,8 @@ pub fn has_different_gas_calc(chain_id: u64) -> bool {
                     NamedChain::Moonbase |
                     NamedChain::Moonbeam |
                     NamedChain::MoonbeamDev |
-                    NamedChain::Moonriver
+                    NamedChain::Moonriver |
+                    NamedChain::Metis
             );
     }
     false


Test patch: