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

[API] Interleaved state override to EstimateGas #86

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

hyunsooda
Copy link
Contributor

@hyunsooda hyunsooda commented Sep 12, 2024

Proposed changes

Overwrite state if the overrides fields is given in kaia_estimateGas and eth_estimateGas APIs.

Geth has updated the override.Apply() function, a new feature that modifies the precompiled contract address, but it is not imported in this PR. (also, this feature is not triggered against EstimateGas API)

Example usage:

#!/bin/bash

curl -X 'POST' \
  'http://localhost:8551' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "method": "kaia_estimateGas",
  "id": 1,
  "jsonrpc": "2.0",
  "params": [
    {
      "from": "0x9a8d1dfdad4806605e3c63067897e4f13b06a5b4",
      "to": "0x10235AC9fCb213e1B229f636913637CD35Bf4031",
      "gas": "0x1cbf1",
      "value": "0x0",
      "gasPrice":"0x5d21dba00",
      "input": "0xe3dc878300000000000000000000000000000000000000000000000000000000000004d2"
    },
    "0x7bd",                                                                       # block number
    {                                                                                    # state override
      "0x9a8d1dfdad4806605e3c63067897e4f13b06a5b4": {
        "balance": "0xde0b6b3a7640000"
      }
    }
  ]
}'

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have read the CLA and signed by comment I have read the CLA Document and I hereby sign the CLA in first time contribute
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@blukat29 blukat29 mentioned this pull request Sep 12, 2024
8 tasks
@blukat29 blukat29 merged commit 312ad3a into kaiachain:dev Sep 12, 2024
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants