Skip to content

Commit

Permalink
fix: error on duplicate event processors
Browse files Browse the repository at this point in the history
  • Loading branch information
chmllr committed Dec 10, 2024
1 parent 0e80a0f commit 620c9d3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions octane/evmengine/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/omni-network/omni/octane/evmengine/types"

"github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/common"

ormv1alpha1 "cosmossdk.io/api/cosmos/orm/v1alpha1"
"cosmossdk.io/core/store"
Expand Down Expand Up @@ -71,6 +72,22 @@ func NewKeeper(
return nil, errors.Wrap(err, "create evmengine store")
}

names := make(map[string]bool)
addresses := make(map[common.Address]bool)
for _, proc := range eventProcs {
for _, address := range proc.Addresses() {
if found := addresses[address]; found {
return nil, errors.New("duplicate event processors", "address", address)
}
addresses[address] = true
}
name := proc.Name()
if found := names[name]; found {
return nil, errors.New("duplicate event processors", "name", name)
}
names[name] = true
}

return &Keeper{
cdc: cdc,
storeService: storeService,
Expand Down

0 comments on commit 620c9d3

Please sign in to comment.