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

New Opcode: SSTORE_COUNT #119

Closed
pirapira opened this issue Jun 20, 2016 · 7 comments
Closed

New Opcode: SSTORE_COUNT #119

pirapira opened this issue Jun 20, 2016 · 7 comments
Labels

Comments

@pirapira
Copy link
Member

Opcode 0x3d will be assigned a mnemonic SSTORE_COUNT. This instruction pushes the number of SSTORE executions by the currently executing account so far during the current transaction. The instruction takes no arguments.

The SSTORE counter is shared by all recursive invocations of an account. The counter is reset for each transaction. The gas cost of SSTORE_COUNT should be G_step as other 0x30s instructions.

USAGE

A contract can call this instruction twice to check if its storage has possibly changed. For instance, a contract can use this instruction before and after a call, to see if its storage has not been altered in a recursive-call to itself. The contract can use SSTORE_COUNT optionally together with BALANCE to make sure that its state is the same as before.

The SSTORE counter is separate for each account, preventing side-channel information leakage.

SCHEDULE

This is relatively easy to implement, so we can aim at: METROPOLIS_FORK_NUM.

ALTERNATIVE

An instruction returning storageRoot can serve the same purpose but is computationally more expensive.

@vbuterin
Copy link
Contributor

What would this provide that a simple mutex lock (ie. prefacing the entire code with if self.mutex: ~invalid() and then wrapping mutexed calls like so seq(self.mutex = 1, foo.bar(baz), self.mutex = 0)?

@pirapira
Copy link
Member Author

pirapira commented Jun 21, 2016

This instruction allows an execution to protect itself from untrusted executions of the same account. Mutex requires cooperation between multiple executions of the same account (in case of re-entrance). With this instruction, only the original execution needs to follow a protocol to ensure its integrity.

Setting&resetting a mutex also consumes 4 times more gas than the usage presented.

@chriseth
Copy link
Contributor

chriseth commented Jul 5, 2016

Having access to the storage root of an account can also enable other use-cases. It is more general than the SSTORE_COUNT because it also allows the case that storage content is re-set.

On the other hand, if we give the EVM access to the storage root, any change in the storage trie structure would be a breaking change for the EVM.

@vbuterin
Copy link
Contributor

On the other hand, if we give the EVM access to the storage root, any change in the storage trie structure would be a breaking change for the EVM.

It would also make caching much more difficult.

@axic
Copy link
Member

axic commented Sep 14, 2016

I think this could also be used by view / pure functions in Solidity when they call an outside library method which is not inlined (internal).

@github-actions
Copy link

There has been no activity on this issue for two months. It will be closed in a week if no further activity occurs. If you would like to move this EIP forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

@github-actions github-actions bot added the stale label Jan 16, 2022
@github-actions
Copy link

This issue was closed due to inactivity. If you are still pursuing it, feel free to reopen it and respond to any feedback or request a review in a comment.

drortirosh added a commit to drortirosh/EIPs that referenced this issue Dec 29, 2022
Update the EIP to the working version from
https://github.com/eth-infinitism/account-abstraction/blob/develop/eip/EIPS/eip-4337.md

Changes:

    AA-94 update keccak rules.
    AA-93 Adding debug RPC APIs for the Bundler to use (ethereum#153)
    AA 92 simulate execution (ethereum#152)
    AA 73 unify reputation (ethereum#144)
    AA-68 rpc calls (ethereum#132)
    AA-61 rename wallet to account (ethereum#134)
    AA-69 wallet support for simulation without signing (ethereum#133)
    AA-70 rename requestId to userOpHash (ethereum#138)
    AA-67 relax storage rules in opcode banning (ethereum#121)
    AA-63 remove paymaster stake value from EntryPoint (ethereum#119)
    AA-51 simpler simulation api, including aggregation
    AA-60 validate timestamp (ethereum#117)
Clarify wallet factory behavior when the wallet already exists
(ethereum#118)
drortirosh added a commit to drortirosh/EIPs that referenced this issue Dec 29, 2022
Update the EIP to the working version from
https://github.com/eth-infinitism/account-abstraction/blob/develop/eip/EIPS/eip-4337.md

Changes:

    AA-94 update keccak rules.
    AA-93 Adding debug RPC APIs for the Bundler to use (ethereum#153)
    AA 92 simulate execution (ethereum#152)
    AA 73 unify reputation (ethereum#144)
    AA-68 rpc calls (ethereum#132)
    AA-61 rename wallet to account (ethereum#134)
    AA-69 wallet support for simulation without signing (ethereum#133)
    AA-70 rename requestId to userOpHash (ethereum#138)
    AA-67 relax storage rules in opcode banning (ethereum#121)
    AA-63 remove paymaster stake value from EntryPoint (ethereum#119)
    AA-51 simpler simulation api, including aggregation
    AA-60 validate timestamp (ethereum#117)
Clarify wallet factory behavior when the wallet already exists
(ethereum#118)
drortirosh added a commit to drortirosh/EIPs that referenced this issue Dec 29, 2022
Update the EIP to the working version from
https://github.com/eth-infinitism/account-abstraction/blob/develop/eip/EIPS/eip-4337.md

Changes:

    AA-94 update keccak rules.
    AA-93 Adding debug RPC APIs for the Bundler to use (ethereum#153)
    AA 92 simulate execution (ethereum#152)
    AA 73 unify reputation (ethereum#144)
    AA-68 rpc calls (ethereum#132)
    AA-61 rename wallet to account (ethereum#134)
    AA-69 wallet support for simulation without signing (ethereum#133)
    AA-70 rename requestId to userOpHash (ethereum#138)
    AA-67 relax storage rules in opcode banning (ethereum#121)
    AA-63 remove paymaster stake value from EntryPoint (ethereum#119)
    AA-51 simpler simulation api, including aggregation
    AA-60 validate timestamp (ethereum#117)
Clarify wallet factory behavior when the wallet already exists
(ethereum#118)
eth-bot pushed a commit that referenced this issue Dec 29, 2022
* Update to latest working version

Update the EIP to the working version from
https://github.com/eth-infinitism/account-abstraction/blob/develop/eip/EIPS/eip-4337.md

Changes:

    AA-94 update keccak rules.
    AA-93 Adding debug RPC APIs for the Bundler to use (#153)
    AA 92 simulate execution (#152)
    AA 73 unify reputation (#144)
    AA-68 rpc calls (#132)
    AA-61 rename wallet to account (#134)
    AA-69 wallet support for simulation without signing (#133)
    AA-70 rename requestId to userOpHash (#138)
    AA-67 relax storage rules in opcode banning (#121)
    AA-63 remove paymaster stake value from EntryPoint (#119)
    AA-51 simpler simulation api, including aggregation
    AA-60 validate timestamp (#117)
Clarify wallet factory behavior when the wallet already exists
(#118)

* lint fixes
RaphaelHardFork pushed a commit to RaphaelHardFork/EIPs that referenced this issue Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants