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 EIP: HASCODE instruction #8838

Merged
merged 7 commits into from
Sep 9, 2024
Merged

Add EIP: HASCODE instruction #8838

merged 7 commits into from
Sep 9, 2024

Conversation

pdobacz
Copy link
Contributor

@pdobacz pdobacz commented Aug 29, 2024

Allow EOF contracts to discriminate between EOA (Externally Owned Accounts) and smart contract accounts by introducing an IS_CONTRACT instruction.

This EIP responds to a community request to keep a way to distinguish between EOA and smart contract accounts in EOF, c.f. ACDE #195

@pdobacz pdobacz requested a review from eth-bot as a code owner August 29, 2024 16:40
@github-actions github-actions bot added c-new Creates a brand new proposal s-draft This EIP is a Draft t-core labels Aug 29, 2024
@eth-bot
Copy link
Collaborator

eth-bot commented Aug 29, 2024

✅ All reviewers have approved.

@eth-bot eth-bot added e-consensus Waiting on editor consensus e-review Waiting on editor to review labels Aug 29, 2024
@github-actions github-actions bot added the w-ci Waiting on CI to pass label Aug 29, 2024
EIPS/eip-is-contract.md Outdated Show resolved Hide resolved
EIPS/eip-is-contract.md Outdated Show resolved Hide resolved

## Abstract

Allow EOF contracts to discriminate between EOA (Externally Owned Accounts) and smart contract accounts by introducing an `IS_CONTRACT` instruction.
Copy link
Contributor

@abcoathup abcoathup Aug 30, 2024

Choose a reason for hiding this comment

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

Suggested change
Allow EOF contracts to discriminate between EOA (Externally Owned Accounts) and smart contract accounts by introducing an `IS_CONTRACT` instruction.
Allow EOF contracts to discriminate between EOA (Externally Owned Accounts) and contracts (including smart contract accounts) by introducing an `IS_CONTRACT` instruction.

ERC-721/1155 transfer checks are required for contracts, irrespective of whether they are contract accounts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@abcoathup Actually, we'd like a clarification of your suggestion. "smart contract accounts" was a mental shortcut intending to mean "EVM state accounts with code", and probably that wording is clearer and more specific. Next, maybe we change "smart contract accounts" to "smart contract wallets" to avoid confusion. Would this work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what I have in mind: 2be26b3 - I think "contract account" is a well established and simple term, hope this works.

Co-authored-by: Andrew B Coathup <[email protected]>
Copy link

github-actions bot commented Sep 2, 2024

The commit 17ac984 (as a parent of 7458c67) contains errors.
Please inspect the Run Summary for details.

@github-actions github-actions bot removed the w-ci Waiting on CI to pass label Sep 2, 2024
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

This would address my concerns and I would love to see it adopted.

EIPS/eip-7761.md Outdated

### Keep code introspection banned

Removing code introspection is one of the tenets of EOF and `IS_CONTRACT` would be an exception from the principle. Without `IS_CONTRACT`, ERC-721 and ERC-1155 standard implementations have to resort to either:
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that the purpose of removing code introspection is to enable future semantics-preserving transformations of code already deployed on chain. In this sense IS_CONTRACT would not be an obstacle at all, so I think it's debatable whether it would be an exception to that principle.

EIPS/eip-7761.md Show resolved Hide resolved
@pdobacz pdobacz changed the title Add EIP: IS_CONTRACT instruction Add EIP: ISCONTRACT instruction Sep 3, 2024
EIPS/eip-7761.md Outdated Show resolved Hide resolved
EIPS/eip-7761.md Outdated Show resolved Hide resolved
EIPS/eip-7761.md Outdated Show resolved Hide resolved
EIPS/eip-7761.md Outdated Show resolved Hide resolved
@frangio
Copy link
Contributor

frangio commented Sep 5, 2024

I think we should consider naming this opcode HASCODE.

ISCONTRACT may cause more confusion around cases such as contracts during deployment or counterfactual contracts. Arguable those are contracts too, just pathological cases that don't have code at a particular moment on chain. Whether an account has code is a more straightforward thing to answer.

@pdobacz pdobacz changed the title Add EIP: ISCONTRACT instruction Add EIP: HASCODE instruction Sep 9, 2024
Copy link
Contributor

@g11tech g11tech left a comment

Choose a reason for hiding this comment

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

lgtm seeing all issues have been addressed

@eth-bot eth-bot enabled auto-merge (squash) September 9, 2024 08:40
Copy link
Collaborator

@eth-bot eth-bot left a comment

Choose a reason for hiding this comment

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

All Reviewers Have Approved; Performing Automatic Merge...

@eth-bot eth-bot merged commit 72f871d into ethereum:master Sep 9, 2024
10 of 16 checks passed
@pdobacz pdobacz deleted the is-contract branch September 9, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-new Creates a brand new proposal e-consensus Waiting on editor consensus e-review Waiting on editor to review s-draft This EIP is a Draft t-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants