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

RBuilder rpc #7985

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

RBuilder rpc #7985

wants to merge 4 commits into from

Conversation

asdacap
Copy link
Contributor

@asdacap asdacap commented Dec 31, 2024

Fixes Closes Resolves #

Please choose one of the keywords above to refer to the issue this PR solves followed by the issue number (e.g. Fixes #000). If no issue number, remove the line. Also, remove everything marked optional that is not applicable. Remove this note after reading.

Changes

  • List the changes

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

@mralj
Copy link

mralj commented Dec 31, 2024

@asdacap I've just realised that we'll probably have to update the RPC call for the rbuilder_getCodeByHash to accept the BlockParameter param.

When constructing rbuilder provider, the provider can be specified per block (so basically we are dealing with the state at some block in history). So this scenario should be possible:

  1. EOA deploys contract at some address in block no. 100
  2. On rbuilder we create provider for block no. 99
  3. Since we don't provide the BlockParameter to the RPC call, the call will refer to the latest state where contract exists and rbuilder_getCodeByHash will return code
  4. Expected behaviour was to return not found

Am I correct?

@asdacap
Copy link
Contributor Author

asdacap commented Dec 31, 2024

Hmm... that is true. In that case you'll need to change rbuilder to use eth_getCode as internally, there is no way of knowing which block does a code get inserted.

@asdacap
Copy link
Contributor Author

asdacap commented Dec 31, 2024

The address would know the right code hash at which block, so it would have the history.

@mralj
Copy link

mralj commented Dec 31, 2024

Sorry I'm not sure I 100% understood you. So to double-check:
If you receive both code_hash AND BlockParameter from rbuilder - this is still not enough, you'll need the address as well?
Or I misunderstood you and having code_hash and BlockParameter is enough for this call to work properly?

@asdacap
Copy link
Contributor Author

asdacap commented Dec 31, 2024

There is no way to know when a code_hash is set. In fact, a lot of the time many account share the same code hash, so who knows which contract set it first. However, the account contains the code hash. It is possible to know the state of the account at a particular block, so if the code_hash of the account change, we could know it.

@mralj
Copy link

mralj commented Dec 31, 2024

There is no way to know when a code_hash is set. In fact, a lot of the time many account share the same code hash, so who knows which contract set it first. However, the account contains the code hash. It is possible to know the state of the account at a particular block, so if the code_hash of the account change, we could know it.

Ok, let's then leave this as is, and if it provides problematic in practice, we'll tackle it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants