Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cb2bf58
refactor: use solidity error
nowooj Apr 3, 2026
b6dd566
chore: make contracts-compile
nowooj Apr 3, 2026
3d845f2
tests: enhance error handling with specific solidity error
nowooj Apr 3, 2026
d91178b
feat: use openzepplin v5
nowooj Apr 3, 2026
c7d3fcd
refactor: erc20 use ERC20I and improve error handling
nowooj Apr 3, 2026
805b541
chore: make contracts-compile
nowooj Apr 3, 2026
18f5f25
tests: enhance error handling with specific solidity error in erc20
nowooj Apr 3, 2026
e9fc6b7
fix: error handling in ApplyTransaction by using errors.As for Revert…
nowooj May 6, 2026
f3ab669
fix: improve error handling for insufficient funds in ERC20 transfer
nowooj May 6, 2026
5ce5acd
fix: unknown solidity custom errors and packing failures
nowooj May 6, 2026
65274bc
Merge branch 'main' into refactor/sol-error
nowooj May 29, 2026
4640346
chore: update CHANGELOG and add Precompile ABI Check workflow
nowooj May 29, 2026
5bf4b63
feat: add custom error handling for precompiles and enhance tests
nowooj May 29, 2026
5eafec8
Merge branch 'main' into refactor/sol-error
nowooj Jul 13, 2026
e2eaade
Merge branch 'main' into refactor/sol-error
nowooj Jul 14, 2026
87b5503
Merge branch 'main' into refactor/sol-error
nowooj Jul 21, 2026
5419825
feat(precompiles): map Cosmos errors to Solidity reverts
nowooj Jul 23, 2026
9ce475d
chore: regenerate Solidity contract artifacts
nowooj Jul 23, 2026
bd3210d
test(precompiles): cover typed Solidity revert mappings
nowooj Jul 23, 2026
f000ce0
docs(precompiles): document error mapping source of truth
nowooj Jul 23, 2026
53974ff
Merge branch 'main' into refactor/sol-error
nowooj Jul 23, 2026
c34de80
Merge branch 'main' into refactor/sol-error
nowooj Jul 30, 2026
0a1ecb5
Merge branch 'main' into refactor/sol-error
nowooj Aug 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/abi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Precompile ABI Check

on:
merge_group:
pull_request:
push:
branches:
- main
- release/**

permissions: read-all

jobs:
check-abis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
precompiles/**/*.sol
precompiles/**/abi.json
- name: Check generated ABIs
run: |
make contracts-compile
git diff --exit-code -- ':(glob)precompiles/**/abi.json'
if: env.GIT_DIFF
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

### API-BREAKING

- [\#1146](https://github.com/cosmos/evm/pull/1146) Remove `EndBlocker` based mempool updates, use `PrepareCheckStater` instead.
- [\#1146](https://github.com/cosmos/evm/pull/1146) Remove `EndBlocker` based mempool updates, use `PrepareCheckStater` instead.
- [\#1099](https://github.com/cosmos/evm/pull/1099) Precompile reverts now use Solidity custom errors instead of `Error(string)` revert data.

### IMPROVEMENTS

Expand Down
3 changes: 2 additions & 1 deletion contracts/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ export default {
solidity: {
compilers: [
{
version: "0.8.20",
version: "0.8.26",
settings: {
evmVersion: "cancun",
optimizer: {
enabled: true,
runs: 100,
Expand Down
8 changes: 4 additions & 4 deletions contracts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.0.0",
"description": "A collection of smart contracts used in the development of the Cosmos EVM blockchain.",
"devDependencies": {
"@openzeppelin/contracts": "^4.9.6",
"@openzeppelin/contracts": "^5.3.0",
"hardhat": "^3.0.15"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions contracts/solidity/ContractCreationTester.json

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions contracts/solidity/DebugPrecompileCaller.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_format": "hh-sol-artifact-1",
"_format": "hh3-artifact-1",
"contractName": "DebugPrecompileCaller",
"sourceName": "solidity/DebugPrecompileCaller.sol",
"abi": [
Expand Down Expand Up @@ -28,8 +28,11 @@
"type": "function"
}
],
"bytecode": "0x608080604052346100165761023e908161001c8239f35b600080fdfe6080604052600436101561001257600080fd5b6000803560e01c63ff585caf1461002857600080fd5b34610047576020366003190112610047576100446004356100f4565b80f35b80fd5b3d156100a65767ffffffffffffffff903d8281116100905760405192601f8201601f19908116603f01168401908111848210176100905760405282523d6000602084013e565b634e487b7160e01b600052604160045260246000fd5b606090565b6020808252825181830181905290939260005b8281106100e057505060409293506000838284010152601f8019910116010190565b8181018601518482016040015285016100be565b60005b81811061017a5750600381116101775760405190602082019060008252602183015260218252606082019082821067ffffffffffffffff8311176100905760009283926040525190826107995af161014d61004a565b90156101565750565b60405163a5fa8d2b60e01b815290819061017390600483016100ab565b0390fd5b50565b60408051600160f81b60208201908152600182528183019067ffffffffffffffff82118383101761009057600092839285525190826107995af1906101bd61004a565b91156101ec57505060001981146101d6576001016100f7565b634e487b7160e01b600052601160045260246000fd5b5163a5fa8d2b60e01b81529150819061017390600483016100ab56fea2646970667358221220f0ddd005e729c0bf54b8295a483a2d7c84c3948a24b42ea5b8f906cf9b1c361f64736f6c63430008140033",
"deployedBytecode": "0x6080604052600436101561001257600080fd5b6000803560e01c63ff585caf1461002857600080fd5b34610047576020366003190112610047576100446004356100f4565b80f35b80fd5b3d156100a65767ffffffffffffffff903d8281116100905760405192601f8201601f19908116603f01168401908111848210176100905760405282523d6000602084013e565b634e487b7160e01b600052604160045260246000fd5b606090565b6020808252825181830181905290939260005b8281106100e057505060409293506000838284010152601f8019910116010190565b8181018601518482016040015285016100be565b60005b81811061017a5750600381116101775760405190602082019060008252602183015260218252606082019082821067ffffffffffffffff8311176100905760009283926040525190826107995af161014d61004a565b90156101565750565b60405163a5fa8d2b60e01b815290819061017390600483016100ab565b0390fd5b50565b60408051600160f81b60208201908152600182528183019067ffffffffffffffff82118383101761009057600092839285525190826107995af1906101bd61004a565b91156101ec57505060001981146101d6576001016100f7565b634e487b7160e01b600052601160045260246000fd5b5163a5fa8d2b60e01b81529150819061017390600483016100ab56fea2646970667358221220f0ddd005e729c0bf54b8295a483a2d7c84c3948a24b42ea5b8f906cf9b1c361f64736f6c63430008140033",
"bytecode": "0x608080604052346015576101cb908161001a8239f35b5f80fdfe60806040526004361015610011575f80fd5b5f3560e01c63ff585caf14610024575f80fd5b34610042576020366003190112610042576100406004356100e5565b005b5f80fd5b90601f8019910116810190811067ffffffffffffffff82111761006857604052565b634e487b7160e01b5f52604160045260245ffd5b3d156100b6573d9067ffffffffffffffff821161006857604051916100ab601f8201601f191660200184610046565b82523d5f602084013e565b606090565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b5f5b818110610156575060038111610153575f80916040516020810191838352602182015260218152610119604182610046565b5190826107995af161012961007c565b90156101325750565b60405163a5fa8d2b60e01b815290819061014f90600483016100bb565b0390fd5b50565b5f806040516020810190600160f81b825260018152610176602182610046565b5190826107995af161018661007c565b901561013257506001016100e756fea26469706673582212202f638d31db47c70af56fb87ec32a469c88e0e5c42572d081fc011b9c0370c04564736f6c634300081a0033",
"deployedBytecode": "0x60806040526004361015610011575f80fd5b5f3560e01c63ff585caf14610024575f80fd5b34610042576020366003190112610042576100406004356100e5565b005b5f80fd5b90601f8019910116810190811067ffffffffffffffff82111761006857604052565b634e487b7160e01b5f52604160045260245ffd5b3d156100b6573d9067ffffffffffffffff821161006857604051916100ab601f8201601f191660200184610046565b82523d5f602084013e565b606090565b602060409281835280519182918282860152018484015e5f828201840152601f01601f1916010190565b5f5b818110610156575060038111610153575f80916040516020810191838352602182015260218152610119604182610046565b5190826107995af161012961007c565b90156101325750565b60405163a5fa8d2b60e01b815290819061014f90600483016100bb565b0390fd5b50565b5f806040516020810190600160f81b825260018152610176602182610046565b5190826107995af161018661007c565b901561013257506001016100e756fea26469706673582212202f638d31db47c70af56fb87ec32a469c88e0e5c42572d081fc011b9c0370c04564736f6c634300081a0033",
"linkReferences": {},
"deployedLinkReferences": {}
}
"deployedLinkReferences": {},
"immutableReferences": {},
"inputSourceName": "project/solidity/DebugPrecompileCaller.sol",
"buildInfoId": "solc-0_8_26-a1967f2a9b51b5d07c81bb121d63b0a10051d2d1"
}
209 changes: 150 additions & 59 deletions contracts/solidity/ERC20MinterBurnerDecimals.json

Large diffs are not rendered by default.

18 changes: 7 additions & 11 deletions contracts/solidity/ERC20MinterBurnerDecimals.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol";
import "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/Context.sol";

/**
Expand Down Expand Up @@ -37,11 +37,11 @@ contract ERC20MinterBurnerDecimals is Context, AccessControlEnumerable, ERC20Bur
*/
constructor(string memory name, string memory symbol, uint8 decimals_)
ERC20(name, symbol) {
_setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
_grantRole(DEFAULT_ADMIN_ROLE, _msgSender());

_setupRole(MINTER_ROLE, _msgSender());
_setupRole(PAUSER_ROLE, _msgSender());
_setupRole(BURNER_ROLE, _msgSender());
_grantRole(MINTER_ROLE, _msgSender());
_grantRole(PAUSER_ROLE, _msgSender());
_grantRole(BURNER_ROLE, _msgSender());
_setupDecimals(decimals_);
}

Expand Down Expand Up @@ -115,11 +115,7 @@ contract ERC20MinterBurnerDecimals is Context, AccessControlEnumerable, ERC20Bur
_unpause();
}

function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override(ERC20, ERC20Pausable) {
super._beforeTokenTransfer(from, to, amount);
function _update(address from, address to, uint256 value) internal virtual override(ERC20, ERC20Pausable) {
super._update(from, to, value);
}
}
Loading