-
Notifications
You must be signed in to change notification settings - Fork 29
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
Introduce EIP-7702 (Set EOA account code) #106
Comments
We have found some additional changes that we need to make. Points
|
There is another option.
Adding optional RLP fields allows legacy structs keep its RLP encoding while new structs can attach new fields. e.g. kaia/blockchain/types/block.go Lines 68 to 69 in de62451
This way we can keep the existing EOA/SCA separation that has existed for whatever reason. But if we keep the SetCode'd account as EOA type, we may need to modify some conditions such as IsProgramAccount. The EOA/SCA separation affects how some transaction types behave (e.g. SmartContractExecution can only target an SCA). I personally don't think that the explicit separation (type byte) is better than implicit separation (codehash == 0x0), but they are already in place. |
I accidentally deleted my comment so I'll restore it. I'm sorry. |
On reflection, changing the Type doesn't seem like a good idea since it affects the address prefix.
In Ethereum, there was a debate about whether it was OK to return true for isContract for a set coded EOA, and since this has already been broken, it is considered not to be a big problem. |
I agree that type change is unrealistic. But let me correct that the account type prefix is NOT on the address, it's inside the StateDB's leaf node. It only affects the Merkle Hash (i.e. header.stateRoot). The But the thing with Lines 283 to 289 in de62451
|
Thank you for correcting me. |
ConsiderationTreating EOA as a In this case, the objectives are separated into two:
1 is not a big problem because the purpose is only to obtain the New ChangesTaking the above issues into consideration, I propose the following changes.
|
@Mdaiki0730 @blukat29
This is because SetCode is called at the following point based on the genesis data. https://github.com/kaiachain/kaia/blob/feat/eip-7702/blockchain/genesis.go#L313 The current implementation plan assumes that SetCode will be called only when tx is called.
Any other opinions? |
If we limit the discussion into Genesis only, The GenesisAlloc with nonempty If we only think about Mainnet, "Do not consider adding such an EOA to genesis (SetCode will only be called through tx)" should suffice. But for the sake of easier testing, we may have a option that "allows genesis EOA to have Code". e.g. (any better suggestions are welcome) type GenesisAccount struct {
Code []byte `json:"code,omitempty"`
Storage map[common.Hash]common.Hash `json:"storage,omitempty"`
Balance *big.Int `json:"balance" gencodec:"required"`
Nonce uint64 `json:"nonce,omitempty"`
ForceEOA bool `json:"forceEoa,omitempty"` // for tests
PrivateKey []byte `json:"secretKey,omitempty"` // for tests
} |
If I am allowed to add fields to the GenesisAccount struct for testing purposes, I think your suggestion is so good. I'll try adding @Mdaiki0730 |
@shiki-tak Absolutely! there is already a "for tests" field after all. |
When SetCode is sent from SetCodeTx to EOA, if the account does not exist in the state, an object will be created as SCA. |
@Mdaiki0730 Would that end up being something I should include in my current work? |
Is your request related to a problem? Please describe.
Kaia has an account abstraction in the form of ERC-4337.
We can receive the benefits of AA through this, but if you already have an EOA account, you will need to create a new contract account and transfer assets.
Describe the solution you'd like
Introducing EIP-7702 can solve this problem.
EIP-7702 allows you to treat an EOA like a contract account by setting a contract in the code field of the EOA.
A new
SET_CODE_TX_TYPE
is going to be defined, which will work as follows:Describe alternatives you've considered
Additional context
The following changes are expected:
Add Objects
Changes
SetCodeTxType
StateTransition.TransitionDb
TxTypeSetCode
StateDB
interface (for validation)validateTx
ResolveCode
inStateDB
(also resolveStateObject)GetCode
toResolveCode
in evm and instructions (If code is requested)StateDB
enable7702
in jump_tableoperations_acl
The text was updated successfully, but these errors were encountered: