Skip to content

Commit fcd6d1f

Browse files
committed
Merge remote-tracking branch 'origin/main' into cosmos_override
2 parents b5a55d6 + 79089fe commit fcd6d1f

29 files changed

+2776
-54
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- [\#727](https://github.com/cosmos/evm/pull/727) Avoid nil pointer for `tx evm raw` due to uninitialized EVM coin info.
3030
- [\#730](https://github.com/cosmos/evm/pull/730) Fix panic if evm mempool not used.
3131
- [\#733](https://github.com/cosmos/evm/pull/733) Avoid rejecting tx with unsupported extension option for ExtensionOptionDynamicFeeTx.
32+
- [\#736](https://github.com/cosmos/evm/pull/736) Add InitEvmCoinInfo upgrade to avoid panic when denom is not registered.
3233

3334
### IMPROVEMENTS
3435

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package contracts
2+
3+
import (
4+
_ "embed"
5+
6+
contractutils "github.com/cosmos/evm/contracts/utils"
7+
evmtypes "github.com/cosmos/evm/x/vm/types"
8+
)
9+
10+
var (
11+
//go:embed solidity/DebugPrecompileCaller.json
12+
DebugPrecompileCallerJSON []byte
13+
14+
// GreeterContract is the compiled Greeter contract
15+
DebugPrecompileCallerContract evmtypes.CompiledContract
16+
)
17+
18+
func init() {
19+
var err error
20+
if DebugPrecompileCallerContract, err = contractutils.ConvertHardhatBytesToCompiledContract(
21+
DebugPrecompileCallerJSON,
22+
); err != nil {
23+
panic(err)
24+
}
25+
}
26+
27+
// LoadGreeter loads the Greeter contract
28+
func LoadDebugPrecompileCaller() (evmtypes.CompiledContract, error) {
29+
return DebugPrecompileCallerContract, nil
30+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package contracts
2+
3+
import (
4+
contractutils "github.com/cosmos/evm/contracts/utils"
5+
evmtypes "github.com/cosmos/evm/x/vm/types"
6+
)
7+
8+
func LoadERC20RecursiveNonReverting() (evmtypes.CompiledContract, error) {
9+
return contractutils.LoadContractFromJSONFile("solidity/ERC20RecursiveNonRevertingPrecompileCall.json")
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package contracts
2+
3+
import (
4+
contractutils "github.com/cosmos/evm/contracts/utils"
5+
evmtypes "github.com/cosmos/evm/x/vm/types"
6+
)
7+
8+
func LoadERC20RecursiveReverting() (evmtypes.CompiledContract, error) {
9+
return contractutils.LoadContractFromJSONFile("solidity/ERC20RecursiveRevertingPrecompileCall.json")
10+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"_format": "hh-sol-artifact-1",
3+
"contractName": "DebugPrecompileCaller",
4+
"sourceName": "solidity/DebugPrecompileCaller.sol",
5+
"abi": [
6+
{
7+
"inputs": [
8+
{
9+
"internalType": "bytes",
10+
"name": "data",
11+
"type": "bytes"
12+
}
13+
],
14+
"name": "CallFailed",
15+
"type": "error"
16+
},
17+
{
18+
"inputs": [
19+
{
20+
"internalType": "uint256",
21+
"name": "counter",
22+
"type": "uint256"
23+
}
24+
],
25+
"name": "callback",
26+
"outputs": [],
27+
"stateMutability": "nonpayable",
28+
"type": "function"
29+
}
30+
],
31+
"bytecode": "0x608080604052346100165761023e908161001c8239f35b600080fdfe6080604052600436101561001257600080fd5b6000803560e01c63ff585caf1461002857600080fd5b34610047576020366003190112610047576100446004356100f4565b80f35b80fd5b3d156100a65767ffffffffffffffff903d8281116100905760405192601f8201601f19908116603f01168401908111848210176100905760405282523d6000602084013e565b634e487b7160e01b600052604160045260246000fd5b606090565b6020808252825181830181905290939260005b8281106100e057505060409293506000838284010152601f8019910116010190565b8181018601518482016040015285016100be565b60005b81811061017a5750600381116101775760405190602082019060008252602183015260218252606082019082821067ffffffffffffffff8311176100905760009283926040525190826107995af161014d61004a565b90156101565750565b60405163a5fa8d2b60e01b815290819061017390600483016100ab565b0390fd5b50565b60408051600160f81b60208201908152600182528183019067ffffffffffffffff82118383101761009057600092839285525190826107995af1906101bd61004a565b91156101ec57505060001981146101d6576001016100f7565b634e487b7160e01b600052601160045260246000fd5b5163a5fa8d2b60e01b81529150819061017390600483016100ab56fea2646970667358221220f0ddd005e729c0bf54b8295a483a2d7c84c3948a24b42ea5b8f906cf9b1c361f64736f6c63430008140033",
32+
"deployedBytecode": "0x6080604052600436101561001257600080fd5b6000803560e01c63ff585caf1461002857600080fd5b34610047576020366003190112610047576100446004356100f4565b80f35b80fd5b3d156100a65767ffffffffffffffff903d8281116100905760405192601f8201601f19908116603f01168401908111848210176100905760405282523d6000602084013e565b634e487b7160e01b600052604160045260246000fd5b606090565b6020808252825181830181905290939260005b8281106100e057505060409293506000838284010152601f8019910116010190565b8181018601518482016040015285016100be565b60005b81811061017a5750600381116101775760405190602082019060008252602183015260218252606082019082821067ffffffffffffffff8311176100905760009283926040525190826107995af161014d61004a565b90156101565750565b60405163a5fa8d2b60e01b815290819061017390600483016100ab565b0390fd5b50565b60408051600160f81b60208201908152600182528183019067ffffffffffffffff82118383101761009057600092839285525190826107995af1906101bd61004a565b91156101ec57505060001981146101d6576001016100f7565b634e487b7160e01b600052601160045260246000fd5b5163a5fa8d2b60e01b81529150819061017390600483016100ab56fea2646970667358221220f0ddd005e729c0bf54b8295a483a2d7c84c3948a24b42ea5b8f906cf9b1c361f64736f6c63430008140033",
33+
"linkReferences": {},
34+
"deployedLinkReferences": {}
35+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.4;
3+
4+
contract DebugPrecompileCaller {
5+
address constant debugPrecompile = 0x0000000000000000000000000000000000000799;
6+
error CallFailed(bytes data);
7+
function callback(uint256 counter) public {
8+
bool result;
9+
bytes memory data;
10+
11+
// emit events
12+
for (uint i = 0; i < counter; i++) {
13+
(result, data) = debugPrecompile.call(abi.encodePacked(uint8(1)));
14+
if (!result) {
15+
revert CallFailed(data);
16+
}
17+
}
18+
19+
if (counter > 3) {
20+
// stop the recursion
21+
return;
22+
}
23+
24+
// recursive call
25+
(result, data) = debugPrecompile.call(abi.encodePacked(uint8(0), counter));
26+
if (!result) {
27+
revert CallFailed(data);
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)