Skip to content

Commit

Permalink
feat(genesis_bridge): revised genesis bridge impl (#1288)
Browse files Browse the repository at this point in the history
Co-authored-by: Itzhak Bokris <[email protected]>
  • Loading branch information
mtsitrin and ItzhakBokris authored Oct 9, 2024
1 parent ada3fa2 commit c7c6883
Show file tree
Hide file tree
Showing 58 changed files with 3,588 additions and 1,770 deletions.
6 changes: 3 additions & 3 deletions app/ante/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

delayedack "github.com/dymensionxyz/dymension/v3/x/delayedack"
lightclientante "github.com/dymensionxyz/dymension/v3/x/lightclient/ante"
"github.com/dymensionxyz/dymension/v3/x/rollapp/transfergenesis"
"github.com/dymensionxyz/dymension/v3/x/rollapp/genesisbridge"
)

func newEthAnteHandler(options HandlerOptions) sdk.AnteHandler {
Expand Down Expand Up @@ -75,7 +75,7 @@ func newLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
delayedack.NewIBCProofHeightDecorator(),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
transfergenesis.NewTransferEnabledDecorator(options.RollappKeeper.GetRollapp, options.IBCKeeper.ChannelKeeper),
genesisbridge.NewTransferEnabledDecorator(options.RollappKeeper.GetRollapp, options.IBCKeeper.ChannelKeeper),
)
}

Expand Down Expand Up @@ -111,6 +111,6 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
lightclientante.NewIBCMessagesDecorator(*options.LightClientKeeper, options.IBCKeeper.ClientKeeper, options.IBCKeeper.ChannelKeeper, options.RollappKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),
transfergenesis.NewTransferEnabledDecorator(options.RollappKeeper.GetRollapp, options.IBCKeeper.ChannelKeeper),
genesisbridge.NewTransferEnabledDecorator(options.RollappKeeper.GetRollapp, options.IBCKeeper.ChannelKeeper),
)
}
6 changes: 4 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ import (
lockupkeeper "github.com/dymensionxyz/dymension/v3/x/lockup/keeper"
lockuptypes "github.com/dymensionxyz/dymension/v3/x/lockup/types"
rollappmodule "github.com/dymensionxyz/dymension/v3/x/rollapp"
"github.com/dymensionxyz/dymension/v3/x/rollapp/genesisbridge"
rollappmodulekeeper "github.com/dymensionxyz/dymension/v3/x/rollapp/keeper"
"github.com/dymensionxyz/dymension/v3/x/rollapp/transfergenesis"
rollappmoduletypes "github.com/dymensionxyz/dymension/v3/x/rollapp/types"
sequencermodulekeeper "github.com/dymensionxyz/dymension/v3/x/sequencer/keeper"
sequencermoduletypes "github.com/dymensionxyz/dymension/v3/x/sequencer/types"
Expand Down Expand Up @@ -351,6 +351,7 @@ func (a *AppKeepers) InitKeepers(
appCodec,
a.keys[rollappmoduletypes.StoreKey],
a.GetSubspace(rollappmoduletypes.ModuleName),
a.AccountKeeper,
a.IBCKeeper.ChannelKeeper,
a.IBCKeeper.ClientKeeper,
nil,
Expand Down Expand Up @@ -391,6 +392,7 @@ func (a *AppKeepers) InitKeepers(
a.IROKeeper = irokeeper.NewKeeper(
appCodec,
a.keys[irotypes.StoreKey],
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
&a.AccountKeeper,
a.BankKeeper,
a.RollappKeeper,
Expand Down Expand Up @@ -528,7 +530,7 @@ func (a *AppKeepers) InitTransferStack() {
delayedackmodule.WithRollappKeeper(a.RollappKeeper),
)
a.TransferStack = a.delayedAckMiddleware
a.TransferStack = transfergenesis.NewIBCModule(a.TransferStack, a.RollappKeeper, a.TransferKeeper, a.DenomMetadataKeeper, a.IROKeeper)
a.TransferStack = genesisbridge.NewIBCModule(a.TransferStack, a.RollappKeeper, a.TransferKeeper, a.DenomMetadataKeeper)

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := ibcporttypes.NewRouter()
Expand Down
6 changes: 2 additions & 4 deletions ibctesting/delayed_ack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ func (s *delayedAckSuite) TestTransferRollappToHubNotFinalized() {

// relay send
err = path.RelayPacket(packet)
// expecting error as no AcknowledgePacket expected
s.Require().Error(err) // relay committed
s.Require().Error(err) // expecting error as no AcknowledgePacket expected
found := hubIBCKeeper.ChannelKeeper.HasPacketAcknowledgement(s.hubCtx(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
s.Require().False(found)
}
Expand Down Expand Up @@ -164,8 +163,7 @@ func (s *delayedAckSuite) TestTransferRollappToHubFinalization() {

// relay send
err = path.RelayPacket(packet)
// expecting error as no AcknowledgePacket expected to return
s.Require().Error(err) // relay committed
s.Require().Error(err) // expecting error as no AcknowledgePacket expected to return

found = hubIBCKeeper.ChannelKeeper.HasPacketAcknowledgement(s.hubCtx(), packet.GetDestPort(), packet.GetDestChannel(), packet.GetSequence())
s.Require().False(found)
Expand Down
Loading

0 comments on commit c7c6883

Please sign in to comment.