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: /{runtime}/accounts/{addr}: Show contract runtime bytecode, show eth address of originating tx #452

Merged
merged 2 commits into from Jun 16, 2023

Conversation

mitjat
Copy link
Collaborator

@mitjat mitjat commented Jun 15, 2023

This PR exposes two new fields in the contracts API:

Testing: Manually ran the new analyzer, then visited a contract address and a non-contract address and verified that the new field is as expected.

api/spec/v1.yaml Outdated
format: byte
description: |
The runtime bytecode of the smart contract. This is the code stored on-chain that
descibes a smart contract. This field is normally present, except for contracts
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing line?

Also, since the runtime bytecode analyzer might be behind/stalled, the field will be missing for contract accounts that haven't been processed yet. Do you think it's worth checking the evm_contract_analysis table and providing something akin to pending if is_contract == NULL? Or perhaps amending the description is sufficient in this case

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you, finished the sentence now. What I wanted to say there was essentially what you wrote. I don't think we need an explicit pending; null essentially takes that role.

csillag referenced this pull request Jun 15, 2023
[analyzer] store contract address and tx

[openapi] add contract information to /runtime/accounts/{addr}

[api] add contract fields to /runtime/accounts/{addr}

[analyzer] store contract creation bytecode

[api] show contract creation bytecode

[db] add creation/runtime bytecode for evm contract accounts

nit

[db] standardize pkey format; remove evm contract fields

[openapi] address comments

address comments; simplify fields

fix bad rebase

linter

update description
@csillag
Copy link
Contributor

csillag commented Jun 15, 2023

@mitjat can you please consider this? 7e2fa47#r118274739

@mitjat mitjat changed the title api: /{runtime}/accounts/{addr}: Show contract runtime bytecode api: /{runtime}/accounts/{addr}: Show contract runtime bytecode, show eth address of originating tx Jun 16, 2023
type: string
description: |
The Ethereum transaction hash of the transaction in `creation_tx`.
Encoded as a lowercase hex string.
Copy link
Member

Choose a reason for hiding this comment

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

I guess the "Can be omitted for contracts..." note is naturally implied by the descrption of creation_tx so it can be omitted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

😁 yeah I figured this is better than repeating the whole description of when it can be omitted, especially since the condition might change in the (far-ish) future if we implement contract execution tracing.

@mitjat mitjat force-pushed the mitjat/evm-contract-code-analyzer branch from 2e5a620 to 746a171 Compare June 16, 2023 17:41
Base automatically changed from mitjat/evm-contract-code-analyzer to main June 16, 2023 17:47
@mitjat mitjat enabled auto-merge June 16, 2023 17:58
@mitjat mitjat merged commit dca1d02 into main Jun 16, 2023
5 of 6 checks passed
@mitjat mitjat deleted the mitjat/api-contract-info branch June 16, 2023 18:02
mitjat added a commit that referenced this pull request Jun 16, 2023
mitjat added a commit that referenced this pull request Jun 16, 2023
mitjat added a commit that referenced this pull request Jun 16, 2023
mitjat added a commit that referenced this pull request Jun 16, 2023
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.

None yet

4 participants