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

Added support for eth_createAccessList and sendTransaction support fo… #19798

Closed
wants to merge 1 commit into from

Conversation

BelfordZ
Copy link
Contributor

@BelfordZ BelfordZ commented Jun 28, 2023

…r it

Explanation

Problem:
At the moment, we don't support accessList in transactions. This is a feature added by eip-2930, and in certain cases leads to gas used savings.

Solution:
At the very least, we should allow proxying eth_createAccessList calls to the connected network, and pass the transaction field accessList to be passed in for signing. We also allow accessList to be passed into estimate gas.

Future considerations:
We can determine, for most cases, if providing an access list will amount to gas savings. There are however some cases where we wont know until after the transaction is added to a block, since the transaction and associated access list might be dependant on the state of a particular block, and become suboptimal in the next. We could explore ways of detecting these situations, but it would be pretty elaborate and so automatically creating accessLists was left out of the scope of this PR.

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/870

Screenshots/Screencaps

Before

After

Manual Testing Steps

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@BelfordZ BelfordZ requested a review from a team as a code owner June 28, 2023 02:00
@BelfordZ BelfordZ marked this pull request as draft June 28, 2023 02:00
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #19798 (2964536) into develop (343cde9) will decrease coverage by 0.02%.
The diff coverage is 66.67%.

@@             Coverage Diff             @@
##           develop   #19798      +/-   ##
===========================================
- Coverage    69.41%   69.39%   -0.02%     
===========================================
  Files          990      990              
  Lines        37418    37432      +14     
  Branches     10039    10043       +4     
===========================================
+ Hits         25973    25975       +2     
- Misses       11445    11457      +12     
Impacted Files Coverage Δ
.../scripts/controllers/permissions/specifications.js 70.97% <ø> (ø)
...p/scripts/controllers/transactions/tx-gas-utils.js 75.51% <44.44%> (-10.20%) ⬇️
app/scripts/controllers/transactions/lib/util.js 79.73% <100.00%> (-3.37%) ⬇️
...ripts/controllers/transactions/tx-state-manager.js 92.34% <100.00%> (+0.04%) ⬆️

@metamaskbot
Copy link
Collaborator

Builds ready [0246556]
Page Load Metrics (1635 ± 51 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1171901412110
domContentLoaded14861893163510651
load14861893163510651
domInteractive14861893163510651
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 493 bytes
  • ui: 0 bytes
  • common: 0 bytes

@@ -242,6 +242,7 @@ export default class TransactionStateManager extends EventEmitter {
if (txMeta.txParams) {
txMeta.txParams = normalizeAndValidateTxParams(txMeta.txParams, false);
}
console.log('add transaction, post normalization', txMeta.txParams);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to keep this log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope!

// dont use ethjs-query here because it will blow up about accessList
if (txParams.accessList) {
return await new Promise((resolve, reject) => {
this.query.rpc.currentProvider.sendAsync(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just update ethjs-query? What will be the difference by using the provider directly vs. using ethjs-query?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pr for updating it

ethjs/ethjs-schema#13

@BelfordZ BelfordZ force-pushed the transaction-access-lists branch from 7d04d32 to 2964536 Compare July 17, 2023 18:29
@metamaskbot
Copy link
Collaborator

Builds ready [2964536]
Page Load Metrics (1624 ± 56 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint117171137167
domContentLoaded15161940162411656
load15161940162411656
domInteractive15161940162411656
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 493 bytes
  • ui: 0 bytes
  • common: 0 bytes

@github-actions
Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity in the last 60 days. It will be closed in 14 days. Thank you for your contributions.

@github-actions github-actions bot added the stale issues and PRs marked as stale label Sep 16, 2023
@github-actions
Copy link
Contributor

This PR was closed because there has been no follow up activity in the last 14 days. Thank you for your contributions.

@github-actions github-actions bot closed this Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale issues and PRs marked as stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants