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

standardise storage cost per byte #61

Merged
merged 10 commits into from Jun 9, 2022

Conversation

frisitano
Copy link
Member

@frisitano frisitano commented Apr 26, 2022

This PR standardises the cost of storage (per byte) across the different pallets that charge for storage usage in the reef runtime. This includes transactions, evm and multisig. The cost per byte has been standardised at 10 mREEF.

closes: #62

runtime/src/lib.rs Outdated Show resolved Hide resolved
@Netherdrake
Copy link
Member

For EVM, some backwards compatibility testing is required (ie. will the contract terminations refund storage deposit correctly).

@frisitano
Copy link
Member Author

frisitano commented Apr 28, 2022

I am currently in the process of exploring contract terminations. Contract termination via evm.selfdestruct extrinsic seems reasonable. My main concern is when a selfdestruct OPCODE is sent via an evm.call extrinsic as in this instance the destruction is handled by the EVM handler rather then the extrinsic logic. Will report back with findings.

@frisitano
Copy link
Member Author

frisitano commented May 2, 2022

TODO:

  • Add tests for self destruct event emission via evm.call SUICIDE opcode
  • refactor selfdestuct method such that evm.call (SUICIDE OPCODE) + evm.selfdestruct use the same contract destruction logic (https://github.com/reef-defi/reef-chain/blob/master/modules/evm/src/lib.rs#L890-L924). Currently evm.call (SUICIDE) does not update CodeInfos and hence it could result in stale data being left behind which contributes to state bloat. Additionally evm.call uses a different storage refund mechanic.

@frisitano
Copy link
Member Author

TODO:

  • Investigate failure to estimate evm costs in certain situations
  • End to end testing

@Netherdrake Netherdrake merged commit 5961ec0 into reef-defi:master Jun 9, 2022
@frisitano
Copy link
Member Author

This was not ready for merge - still had bugs relating to event queue not being purged properly.

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.

Contract self destruct should always emit a evm.ContractSelfdestructed event
2 participants