MetaMask / MetaMask/metamask-mobile

[Bug] `eth_createAccessList` method is not supported whenever sending a transaction

Open
#7,001 3 comments 1 reaction 0 assignees View on GitHub
feature-request INVALID-ISSUE-TEMPLATE team-confirmations Transactions
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

**Describe the bug**
Sending a transaction with an access list in MetaMask does not cause any effect. Transaction is broadcasted without the access list.

**Some context**
Broadcasting a transaction with an access list can significantly lower the gas (this applies to contract interactions). The reason is that accessing addresses or storage keys for the first time is way more expensive than accessing it a second, third or x's time. This was changed on the Berlin upgrade, where [gas was increased due a DDOS attack](https://eips.ethereum.org/EIPS/eip-2929). The access list is a way to "mitigate" a bit, the increase on gas.

With the access list you can declare beforehand which addresses and slots (for storage keys) can be considered accessed, reducing then the gas for that transaction.

**Note:** there is the same issue in Extension [here](https://github.com/MetaMask/metamask-extension/issues/11863).

**Screenshots**
See the table comparing the gas costs and how gas is decreased whenever the address/key is accessed already.
![Screenshot from 2023-08-16 17-08-34](https://github.com/MetaMask/metamask-mobile/assets/54408225/a8022f71-e8cf-40fa-9014-f9e2f896da06)
Src: https://hackmd.io/@fvictorio/gas-costs-after-berlin

**To Reproduce**
Use the following HTML:
```html




(async function() {
const signer = await new ethers.providers.Web3Provider(
window.ethereum
).getSigner()

let tx = await signer.sendTransaction({
to: signer.getAddress(),
data: "0x1234",
type: 2,
accessList: [
{
address: "0x8ba1f109551bD432803012645Ac136ddd64DBA72",
storageKeys: [ "0x0000000000000000000000000000000000000000000000000000000000001234" ]
}
]
});
})();

```

**Expected behavior**
Access list should be sent

**Smartphone (please complete the following information):**
- Device: any
- OS: Android / iOS
- App Version: all versions affected (prod)

-------------------------------------------------------------
_to be added after bug submission by internal support / PM_
**Severity**

- How critical is the impact of this bug on a user?
- Add stats if available on % of customers impacted
- Is this visible to all users?
- Is this tech debt?

Contributor guide

Open the contributing guide

Research direction

Start by tracing the mobile transaction flow exercised by signer.sendTransaction with type 2 and an accessList, then inspect how the eth_createAccessList capability is handled. Reproduce with the provided HTML and verify that the access list is preserved when the transaction is broadcast.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
api, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.