Skip to content

Conversation

yihuang
Copy link
Contributor

@yihuang yihuang commented Aug 26, 2025

Description

Closes: #505

Re-design bank precompile to avoid dynamic precompiles.

e2e tests

Notes

  • Single byte method index, instead of 4bytes hash based selector.
  • Packed ABI format.
  • Manual encode/decode code instead of go-ethereum/accounts/abi library.

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • tackled an existing issue or discussed with a team member
  • left instructions on how to review the changes
  • targeted the main branch

@yihuang yihuang changed the title Problem: dynamic ERC20 precompiles are heavy feat: erc20 precompile redesign Aug 28, 2025
@yihuang yihuang changed the title feat: erc20 precompile redesign feat: ERC20 precompile redesign Aug 28, 2025
@yihuang yihuang marked this pull request as ready for review August 30, 2025 02:07
@yihuang yihuang requested review from a team as code owners August 30, 2025 02:07
Solution:
- refactor the precompiles code with (hopefully) equivalent transformations.

changelog

cleanup

handle balance handler error return

cleanup

avoid naked return

fix lint

fix werc20

fix staking precompile

fix panic recovery return error

fix staking test case

NewPrecompile don't return error
@aljo242
Copy link
Contributor

aljo242 commented Sep 15, 2025

We need some more time to review this.

But my initial thoughts are that I like the init pattern for loading the precompiles. That seems like it should be its own separate PR that we can review first

@yihuang
Copy link
Contributor Author

yihuang commented Sep 16, 2025

We need some more time to review this.

But my initial thoughts are that I like the init pattern for loading the precompiles. That seems like it should be its own separate PR that we can review first

those things are part of another PR: #577

this PR should only be merged after that one.

Closes: cosmos#505

re-design bank precompile to support solidity erc20 contract.

solc optimize

fix readonly

comment

solc version

add to app

basic mock test framework

test transfer

test precompile through erc20 contract

more failure test cases

cleanup

fix go lint

use decimals from Display denom

add to AvailableStaticPrecompiles

add boilerplates

use new precompile base

fix executor

fix test

fix lint

gas cost changed after register new precompile

use cosmos-sdk gas config
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.

Problem: dynamic erc20 precompiles are heavy
2 participants