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

Add file id and init bytecode in ContractCallContext #9799

Draft
wants to merge 1 commit into
base: 09791-init-mirror-node-state-and-subcomponents
Choose a base branch
from

Conversation

bilyana-gospodinova
Copy link
Contributor

Description:
During the implementation of the reusable services integration it turns out that now the contracts are deployed in 2 steps:

  1. The initcode is uploaded and saved as a file using a FileCreateTransactionBody.
  2. The returned file id from step 1 is then passed to a ContractCreateTransactionBody.
    Each step performs a separate transaction.
    For step 2 even if we pass the correct file id, since the mirror node data is readonly, the FileReadableKVState is not able to populate the contract's bytecode from the DB since it was never explicitly persisted in the DB.

This PR add 2 new fields in the ContractCallContext that preserve the file id and the contract's bytecode. If they are available when we call FileReadableKVState#readFromDataSource then we return them with priority.

These two fields might need to be cleared up at some point but this will probably added later when the correct place is found during testing.

Fixes #9798

Signed-off-by: Bilyana Gospodinova <[email protected]>
@bilyana-gospodinova bilyana-gospodinova added enhancement Type: New feature web3 Area: Web3 API labels Nov 22, 2024
@bilyana-gospodinova bilyana-gospodinova self-assigned this Nov 22, 2024
@bilyana-gospodinova bilyana-gospodinova changed the title Add file id and init bytecode in context Add file id and init bytecode in ContractCallContext Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type: New feature web3 Area: Web3 API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant