Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [#3818](https://github.com/sei-protocol/sei-chain/pull/3818) feat(evmrpc): extend HTTP admission control (`max_request_body_bytes`, `max_concurrent_request_bytes`, `ws_admission_timeout`) to the WebSocket plane (:8546). WS oversize frames close with WebSocket close code 1009; budget-wait timeouts return JSON-RPC error `-32005` before the connection closes. `evmrpc_requests_rejected_total` gains a `protocol` label (`http` / `ws`).

### Upgrade guide
* **Capability removal.** Removes the capability module and its IBC, transfer, and CosmWasm integrations. The capability store remains mounted for historical state access in freeze mode.
* [#3958](https://github.com/sei-protocol/sei-chain/pull/3958) **Feegrant removal.** Removes feegrant execution, module APIs, and the unreleased feegrant EVM precompile. The feegrant store remains mounted for historical state access. Transactions with a fee granter different from the payer are rejected.
* **WebSocket frame size default drops from 10 MiB to 5 MiB.** Before this release, :8546 used a hardcoded 10 MiB frame cap. Both HTTP and WebSocket now share `[evm].max_request_body_bytes`, whose default is 5 MiB (`5242880`). WS clients that send frames in the 5-10 MiB range (large `eth_sendRawTransaction` batches, wide filter payloads, etc.) will be disconnected after upgrade unless the limit is raised. **Operators who relied on the old 10 MiB WS cap should set `max_request_body_bytes = 10485760` in `app.toml` before upgrading.** This also raises the HTTP body limit to 10 MiB. The exported `DefaultWebsocketMaxMessageSize` constant was removed; use the config knob instead.
* [#3927](https://github.com/sei-protocol/sei-chain/pull/3927) **Legacy Sei JSON-RPC and CLI removal.** Removes `sei_associate`, `sei_getBlockByHash`, `sei_getBlockByHashExcludeTraceFail`, `sei_getBlockTransactionCountByHash`, `sei_getBlockTransactionCountByNumber`, `sei_getEvmTx`, `sei_getFilterChanges`, `sei_getFilterLogs`, `sei_getLogs`, `sei_getTransactionByBlockHashAndIndex`, `sei_getTransactionByBlockNumberAndIndex`, `sei_getTransactionByHash`, `sei_getTransactionCount`, `sei_getTransactionErrorByHash`, `sei_getTransactionReceiptExcludeTraceFail`, `sei_getVMError`, `sei_newBlockFilter`, `sei_newFilter`, `sei_sign`, and `sei_uninstallFilter`. Use standard `eth_*` methods for EVM-originated data and `seid tx evm native-associate <custom-message> -y` for address association. There is no block- or filter-level replacement for discovering Cosmos-originated synthetic logs; clients that know the synthetic transaction hash can enable `sei_getTransactionReceipt`.
Expand Down
98 changes: 32 additions & 66 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ import (
"github.com/sei-protocol/sei-chain/sei-cosmos/x/bank"
bankkeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/bank/keeper"
banktypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/bank/types"
"github.com/sei-protocol/sei-chain/sei-cosmos/x/capability"
capabilitykeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/keeper"
capabilitytypes "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/types"
distr "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution"
distrclient "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/client"
distrkeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution/keeper"
Expand Down Expand Up @@ -214,7 +211,6 @@ var (
authzmodule.AppModuleBasic{},
genutil.AppModuleBasic{},
bank.AppModuleBasic{},
capability.AppModuleBasic{},
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distr.AppModuleBasic{},
Expand Down Expand Up @@ -264,7 +260,7 @@ var (
authtypes.StoreKey, authzkeeper.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey, upgradetypes.StoreKey, feegrantModuleName,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey, oracletypes.StoreKey,
evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilityModuleName, oracletypes.StoreKey,
evmtypes.StoreKey, wasm.StoreKey,
epochmoduletypes.StoreKey,
tokenfactorytypes.StoreKey,
Expand Down Expand Up @@ -299,8 +295,9 @@ var (
)

const (
MinGasEVMTx = 21000
feegrantModuleName = "feegrant"
MinGasEVMTx = 21000
capabilityModuleName = "capability"
feegrantModuleName = "feegrant"

// NewHeadsNotifierCapacity bounds the in-process eth_newHeads
// notifier buffer. Capacity 1 pairs with the notifier's
Expand Down Expand Up @@ -385,30 +382,24 @@ type App struct {
memKeys map[string]*sdk.MemoryStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
AuthzKeeper authzkeeper.Keeper
BankKeeper bankkeeper.Keeper
GigaBankKeeper *gigabankkeeper.BaseKeeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
WasmKeeper wasm.Keeper
OracleKeeper oraclekeeper.Keeper
EvmKeeper evmkeeper.Keeper
GigaEvmKeeper gigaevmkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
ScopedWasmKeeper capabilitykeeper.ScopedKeeper
AccountKeeper authkeeper.AccountKeeper
AuthzKeeper authzkeeper.Keeper
BankKeeper bankkeeper.Keeper
GigaBankKeeper *gigabankkeeper.BaseKeeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.Keeper
DistrKeeper distrkeeper.Keeper
GovKeeper govkeeper.Keeper
UpgradeKeeper upgradekeeper.Keeper
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
WasmKeeper wasm.Keeper
OracleKeeper oraclekeeper.Keeper
EvmKeeper evmkeeper.Keeper
GigaEvmKeeper gigaevmkeeper.Keeper

EpochKeeper epochmodulekeeper.Keeper

Expand Down Expand Up @@ -521,7 +512,7 @@ func New(

keys := sdk.NewKVStoreKeys(kvStoreKeyNames...)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientStoreKey)
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, banktypes.DeferredCacheStoreKey, oracletypes.MemStoreKey)
memKeys := sdk.NewMemoryStoreKeys(banktypes.DeferredCacheStoreKey, oracletypes.MemStoreKey)

app := &App{
BaseApp: bApp,
Expand Down Expand Up @@ -558,15 +549,6 @@ func New(
// set the BaseApp's parameter store
bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()))

// add capability keeper and ScopeToModule for ibc module
app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])

// grant capabilities for the ibc and ibc-transfer modules
scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName)
// this line is used by starport scaffolding # stargate/app/scopedKeeper

// add keepers
app.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms,
Expand Down Expand Up @@ -606,7 +588,7 @@ func New(

// Create IBC Keeper
app.IBCKeeper = ibckeeper.NewKeeper(
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper,
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper,
)

// Create Transfer Keepers
Expand All @@ -616,10 +598,8 @@ func New(
app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
app.BankKeeper,
scopedTransferKeeper,
evmkeeper.NewEvmAddressHandler(&app.EvmKeeper),
)
transferModule := transfer.NewAppModule(app.TransferKeeper)
Expand Down Expand Up @@ -671,7 +651,6 @@ func New(
&app.AccountKeeper,
app.MsgServiceRouter(),
app.IBCKeeper.ChannelKeeper,
scopedWasmKeeper,
app.BankKeeper,
appCodec,
app.TransferKeeper,
Expand All @@ -690,8 +669,6 @@ func New(
app.StakingKeeper,
app.DistrKeeper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
scopedWasmKeeper,
app.UpgradeKeeper,
app.TransferKeeper,
app.MsgServiceRouter(),
Expand Down Expand Up @@ -873,7 +850,6 @@ func New(
auth.NewAppModule(appCodec, app.AccountKeeper, nil),
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper, app.UpgradeKeeper),
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
capability.NewAppModule(appCodec, *app.CapabilityKeeper),
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
Expand All @@ -894,15 +870,14 @@ func New(
)

app.BeginBlockKeepers = legacyabci.BeginBlockKeepers{
EpochKeeper: &app.EpochKeeper,
UpgradeKeeper: &app.UpgradeKeeper,
CapabilityKeeper: app.CapabilityKeeper,
DistrKeeper: &app.DistrKeeper,
SlashingKeeper: &app.SlashingKeeper,
EvidenceKeeper: &app.EvidenceKeeper,
StakingKeeper: &app.StakingKeeper,
IBCKeeper: app.IBCKeeper,
EvmKeeper: &app.EvmKeeper,
EpochKeeper: &app.EpochKeeper,
UpgradeKeeper: &app.UpgradeKeeper,
DistrKeeper: &app.DistrKeeper,
SlashingKeeper: &app.SlashingKeeper,
EvidenceKeeper: &app.EvidenceKeeper,
StakingKeeper: &app.StakingKeeper,
IBCKeeper: app.IBCKeeper,
EvmKeeper: &app.EvmKeeper,
}
app.EndBlockKeepers = legacyabci.EndBlockKeepers{
GovKeeper: &app.GovKeeper,
Expand Down Expand Up @@ -932,13 +907,9 @@ func New(

// NOTE: The genutils module must occur after staking so that pools are
// properly initialized with tokens from genesis accounts.
// NOTE: Capability module must occur first so that it can initialize any capabilities
// so that other modules that want to create or claim capabilities afterwards in InitChain
// can do so safely.
app.mm.SetOrderInitGenesis(
upgradetypes.ModuleName,
paramstypes.ModuleName,
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
Expand Down Expand Up @@ -968,7 +939,6 @@ func New(
app.sm = module.NewSimulationManager(
auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts),
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper),
capability.NewAppModule(appCodec, *app.CapabilityKeeper),
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
Expand Down Expand Up @@ -1069,10 +1039,6 @@ func New(
panic(err)
}

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper
app.ScopedWasmKeeper = scopedWasmKeeper

// Create hard fork manager and register all hard fork upgrade handlers. Note,
// when creating the manager, BaseApp must already be instantiated.
//
Expand Down
20 changes: 8 additions & 12 deletions app/legacyabci/begin_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (

"github.com/sei-protocol/sei-chain/sei-cosmos/telemetry"
sdk "github.com/sei-protocol/sei-chain/sei-cosmos/types"
"github.com/sei-protocol/sei-chain/sei-cosmos/x/capability"
capabilitykeeper "github.com/sei-protocol/sei-chain/sei-cosmos/x/capability/keeper"
abci "github.com/sei-protocol/sei-chain/sei-tendermint/abci/types"

"github.com/sei-protocol/sei-chain/sei-cosmos/x/distribution"
Expand All @@ -29,15 +27,14 @@ import (
)

type BeginBlockKeepers struct {
EpochKeeper *epochmodulekeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
DistrKeeper *distrkeeper.Keeper
SlashingKeeper *slashingkeeper.Keeper
EvidenceKeeper *evidencekeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
EvmKeeper *evmkeeper.Keeper
EpochKeeper *epochmodulekeeper.Keeper
UpgradeKeeper *upgradekeeper.Keeper
DistrKeeper *distrkeeper.Keeper
SlashingKeeper *slashingkeeper.Keeper
EvidenceKeeper *evidencekeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
EvmKeeper *evmkeeper.Keeper
}

func BeginBlock(
Expand All @@ -56,7 +53,6 @@ func BeginBlock(

keepers.EpochKeeper.BeginBlock(ctx)
upgrade.BeginBlocker(*keepers.UpgradeKeeper, ctx)
capability.BeginBlocker(ctx, *keepers.CapabilityKeeper)
distribution.BeginBlocker(ctx, votes, *keepers.DistrKeeper)
slashing.BeginBlocker(ctx, votes, *keepers.SlashingKeeper)
evidence.BeginBlocker(ctx, byzantineValidators, *keepers.EvidenceKeeper)
Expand Down
10 changes: 10 additions & 0 deletions app/store_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ func TestFeegrantStoreRemainsMounted(t *testing.T) {
store.Set([]byte("allowance"), []byte("retained"))
require.Equal(t, []byte("retained"), store.Get([]byte("allowance")))
}

func TestCapabilityStoreRemainsMounted(t *testing.T) {
require.Contains(t, kvStoreKeyNames, keys.CapabilityStoreKey)

testApp := Setup(t, false, false, false)
ctx := testApp.NewContext(false, tmproto.Header{})
store := ctx.KVStore(testApp.GetKey(keys.CapabilityStoreKey))
store.Set([]byte("owner"), []byte("retained"))
require.Equal(t, []byte("retained"), store.Get([]byte("owner")))
}
4 changes: 3 additions & 1 deletion app/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ func TestDistributionCommunityTaxParamMigration(t *testing.T) {
testWrapper.Require().Equal(params.CommunityTax, sdk.NewDec(0))
}

func TestV67RemovesFeegrantModuleVersion(t *testing.T) {
func TestV67RemovesRetiredModuleVersions(t *testing.T) {
t.Setenv("UPGRADE_VERSION_LIST", "v6.7")
tm := time.Now().UTC()
valPub := secp256k1.GenPrivKey().PubKey()
testWrapper := app.NewTestWrapper(t, tm, valPub, false)
testWrapper.App.RegisterUpgradeHandlers()

versionMap := testWrapper.App.UpgradeKeeper.GetModuleVersionMap(testWrapper.Ctx)
versionMap["capability"] = 1
versionMap["feegrant"] = 1
testWrapper.App.UpgradeKeeper.SetModuleVersionMap(testWrapper.Ctx, versionMap)

Expand All @@ -47,6 +48,7 @@ func TestV67RemovesFeegrantModuleVersion(t *testing.T) {
})

versionMap = testWrapper.App.UpgradeKeeper.GetModuleVersionMap(testWrapper.Ctx)
require.NotContains(t, versionMap, "capability")
require.NotContains(t, versionMap, "feegrant")
}

Expand Down
1 change: 1 addition & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (app *App) RegisterUpgradeHandlers() {
if err != nil {
return nil, err
}
app.UpgradeKeeper.DeleteModuleVersion(ctx, capabilityModuleName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

curious why we want to delete this (and feegrant) from ModuleVersion vs letting it stay as the last value it was?

app.UpgradeKeeper.DeleteModuleVersion(ctx, feegrantModuleName)
return newVM, nil
}
Expand Down
2 changes: 1 addition & 1 deletion evmrpc/tests/mock_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func mockStateFromJson(ctx sdk.Context, a *app.App, stateRaw json.RawMessage) {
}
}
for moduleName, data := range typed {
if moduleName == "evm_transient" {
if moduleName == "evm_transient" || moduleName == "mem_capability" {
continue
}
var storeKey sdk.StoreKey
Expand Down
5 changes: 2 additions & 3 deletions occ_tests/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ import (

// ignoreStoreKeys are store keys that are not compared
var ignoredStoreKeys = map[string]struct{}{
"mem_capability": {},
"epoch": {},
"deferredcache": {},
"epoch": {},
"deferredcache": {},
}

type TestMessage struct {
Expand Down
30 changes: 0 additions & 30 deletions sei-cosmos/proto/cosmos/capability/v1beta1/capability.proto

This file was deleted.

29 changes: 0 additions & 29 deletions sei-cosmos/proto/cosmos/capability/v1beta1/genesis.proto

This file was deleted.

Loading
Loading