node icon indicating copy to clipboard operation
node copied to clipboard

Integrate Stateful Precompiled Contracts v1

Open lumtis opened this issue 1 year ago • 0 comments

Integrate first version of Stateful Precompiled Contracts into the protocol.

A PoC has been developed, the object of the epic is to track issues to complete the PoC into production.

Example of expected interactions: staking ZETA from smart contracts, vote on governance, etc..

PoC work:

  • go-ethereum: https://github.com/b-harvest/go-ethereum/compare/v1.10.26...v1.10.26-spc
  • ethermint: https://github.com/b-harvest/ethermint/compare/zeta-ethermint-based-0.47...b-harvest:ethermint:stateful-precompiled-contract-poc-on-zeta
  • node: https://github.com/b-harvest/zeta-node/compare/develop...b-harvest:zeta-node:zeta-spc-codereview-1

High-level view of work to move to production:

Additional Functionality

  • Gas calculating precisely as Evmos does. current PoC, Cronos does pre-define a constant gas per call
  • Event Emit: Establish standards and interfaces for special events or cosmos state events emitted by stateful precompiled contracts and implement emit functionality
  • Beyond the simple view, static, pure function, or contract calls invoked in the first depth, implement, test, and verify deeper and complex call depth scenarios such as delegate calls or system contract calls

Enhance Completeness

  • Refactor to a better directory and package structure considering the addition of various precompiled contracts, and interfaces
  • Provide scripts and makefile commands or tools for easy wiring
  • Enhance the overall code quality, maintainability, and integration with existing ZetaChain modules to ensure smooth and reliable operations in a production environment.

Develop Integration, E2E Tests Without Evmos License Dependencies

  • Develop integration test codes for precompiled contracts while avoiding any dependencies on Evmos commercial licensed code
  • not only Integration tests but also E2E tests to ensure all functionalities are thoroughly tested to maintain reliability

Rebase Upstream

  • Reflect changes and rebase work in line with the rapidly updating upstream develop branch of ZetaChain.

Integration and Implement Precompiled Contracts with ZetaChain Modules, Features

  • Identify and prioritize required use cases that would benefit from precompiled contracts.
  • Develop and integrate precompiled contracts to address these specific needs with existing ZetaChain such as crosschain, cctx and new features like ibc-crosschain and multichain staking
  • Perform rigorous testing to validate the integration and functionality across various modules, system contracts, and major 3rd party contracts.
### Tasks
- [ ] https://github.com/zeta-chain/go-ethereum/issues/3
- [ ] https://github.com/zeta-chain/ethermint/issues/65
- [ ] https://github.com/zeta-chain/node/issues/2511
- [ ] https://github.com/zeta-chain/node/issues/2512
- [ ] https://github.com/zeta-chain/ethermint/issues/85
- [ ] https://github.com/zeta-chain/ethermint/pull/81
- [ ] https://github.com/zeta-chain/ethermint/pull/82
- [ ] https://github.com/zeta-chain/ethermint/pull/90
- [ ] https://github.com/zeta-chain/node/issues/2744
- [ ] https://github.com/zeta-chain/node/issues/2754

lumtis avatar Jul 01 '24 08:07 lumtis