Skip to content

feat: remove x/authz dependency from precompiles #62

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
1 change: 0 additions & 1 deletion evmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ func NewExampleApp(
app.DistrKeeper,
app.BankKeeper,
app.Erc20Keeper,
app.AuthzKeeper,
app.TransferKeeper,
app.IBCKeeper.ChannelKeeper,
app.EVMKeeper,
Expand Down
6 changes: 4 additions & 2 deletions evmd/config_testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import (
"fmt"
"strings"

"cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
testconstants "github.com/cosmos/evm/testutil/constants"
evmtypes "github.com/cosmos/evm/x/vm/types"

"cosmossdk.io/math"

sdk "github.com/cosmos/cosmos-sdk/types"
)

// ChainsCoinInfo is a map of the chain id and its corresponding EvmCoinInfo
Expand Down
12 changes: 4 additions & 8 deletions evmd/precompiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (

evidencekeeper "cosmossdk.io/x/evidence/keeper"

authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
Expand All @@ -41,7 +40,6 @@ func NewAvailableStaticPrecompiles(
distributionKeeper distributionkeeper.Keeper,
bankKeeper bankkeeper.Keeper,
erc20Keeper erc20Keeper.Keeper,
authzKeeper authzkeeper.Keeper,
transferKeeper transferkeeper.Keeper,
channelKeeper channelkeeper.Keeper,
evmKeeper *evmkeeper.Keeper,
Expand All @@ -60,15 +58,14 @@ func NewAvailableStaticPrecompiles(
panic(fmt.Errorf("failed to instantiate bech32 precompile: %w", err))
}

stakingPrecompile, err := stakingprecompile.NewPrecompile(stakingKeeper, authzKeeper)
stakingPrecompile, err := stakingprecompile.NewPrecompile(stakingKeeper)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the arguments of NewAvailableStaticPrecompiles, it also seems possible to remove authzKeeper.

Additionally, I noticed that dependencies on Erc20Keeper, werc20 and erc20 precompiles (which are planned to be removed later as they will have their own state) still remain, so I’m leaving a note just in case it was overlooked.

FYI: temporary removed for IBC v2 test on this commit

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for feedback.

  1. In case of NewAvailableStaticPrecompiles, I missed it, I'll fix it.
  2. In case of erc20 and werc20, I intended that the task order that 1) add allowance state in x/erc20 module, 2) modify erc20 precompile, 3) modify werc20 precompile.
  3. And I will consider commit.

if err != nil {
panic(fmt.Errorf("failed to instantiate staking precompile: %w", err))
}

distributionPrecompile, err := distprecompile.NewPrecompile(
distributionKeeper,
stakingKeeper,
authzKeeper,
evmKeeper,
)
if err != nil {
Expand All @@ -79,7 +76,6 @@ func NewAvailableStaticPrecompiles(
stakingKeeper,
transferKeeper,
channelKeeper,
authzKeeper,
evmKeeper,
)
if err != nil {
Expand All @@ -91,17 +87,17 @@ func NewAvailableStaticPrecompiles(
panic(fmt.Errorf("failed to instantiate bank precompile: %w", err))
}

govPrecompile, err := govprecompile.NewPrecompile(govKeeper, authzKeeper)
govPrecompile, err := govprecompile.NewPrecompile(govKeeper)
if err != nil {
panic(fmt.Errorf("failed to instantiate gov precompile: %w", err))
}

slashingPrecompile, err := slashingprecompile.NewPrecompile(slashingKeeper, authzKeeper)
slashingPrecompile, err := slashingprecompile.NewPrecompile(slashingKeeper)
if err != nil {
panic(fmt.Errorf("failed to instantiate slashing precompile: %w", err))
}

evidencePrecompile, err := evidenceprecompile.NewPrecompile(evidenceKeeper, authzKeeper)
evidencePrecompile, err := evidenceprecompile.NewPrecompile(evidenceKeeper)
if err != nil {
panic(fmt.Errorf("failed to instantiate evidence precompile: %w", err))
}
Expand Down
101 changes: 0 additions & 101 deletions precompiles/authorization/AuthorizationI.sol

This file was deleted.

70 changes: 0 additions & 70 deletions precompiles/authorization/IICS20Authorization.sol

This file was deleted.

22 changes: 0 additions & 22 deletions precompiles/authorization/errors.go

This file was deleted.

Loading