Skip to content
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

feat(genesis bridge): genesis transfers #933

Merged
merged 459 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
459 commits
Select commit Hold shift + click to select a range
eb4ee65
cp
danwt Jun 7, 2024
75488a1
pre ripout the dispute period
danwt Jun 10, 2024
00272b6
go a long way to ripping out the dispute period
danwt Jun 10, 2024
6a54cf6
event renames
danwt Jun 10, 2024
59b953b
confirms make install works
danwt Jun 10, 2024
93a932f
refac logger
danwt Jun 10, 2024
e9ba39b
rename receiveer to w
danwt Jun 10, 2024
5aa65a8
log change
danwt Jun 10, 2024
8734e23
pre link
danwt Jun 10, 2024
f8ec151
add a comment
danwt Jun 10, 2024
6d383bc
before add old link
danwt Jun 10, 2024
5eb2812
adjust the comment
danwt Jun 10, 2024
55bc7be
gonna check main
danwt Jun 10, 2024
f23accf
pre del GetClientState
danwt Jun 10, 2024
4ee8898
del get client state
danwt Jun 10, 2024
8a7ec3d
inlines get rollapp
danwt Jun 10, 2024
88d987e
pre check main
danwt Jun 10, 2024
986d51c
pre push
danwt Jun 10, 2024
5ed22b8
adds a link
danwt Jun 10, 2024
83dccdf
ready to fix my middleware
danwt Jun 10, 2024
b2f19bd
gerr adjust
danwt Jun 10, 2024
d1ce992
cp
danwt Jun 10, 2024
bd2844c
gonna check errors
danwt Jun 10, 2024
2828c1f
extract a util
danwt Jun 10, 2024
1f241d1
need to refac a bit
danwt Jun 10, 2024
b6660c1
going to extract a valid rollapp and channel id func
danwt Jun 10, 2024
0666a68
pre major refac
danwt Jun 10, 2024
722bba5
gonna use get valid transfer in the transfer genesis middleware
danwt Jun 10, 2024
cb41cc2
need to integrate setting the canonical channel ID somewhere else
danwt Jun 10, 2024
3d9a99c
regen some proto
danwt Jun 10, 2024
b2b8bae
impl the canonical channel mapping in a hacky way
danwt Jun 10, 2024
26e3fb3
implemented the canonical mapping setting
danwt Jun 10, 2024
9a00a10
refac
danwt Jun 10, 2024
ebbc802
bump create rollapp
danwt Jun 10, 2024
ff6ef8f
bump create rollapp pb
danwt Jun 10, 2024
de3a700
add transfers enabled to the msg create rollapp
danwt Jun 10, 2024
65b555d
fix flags n that
danwt Jun 10, 2024
78c39aa
going to add the fraud routing
danwt Jun 10, 2024
6ab88a9
pre fix utils
danwt Jun 10, 2024
1c987f1
pre fix utils more
danwt Jun 10, 2024
17f7d65
refac utils
danwt Jun 10, 2024
ee75fd5
pre add a has to register meta
danwt Jun 10, 2024
e8f7bbf
confirms install
danwt Jun 10, 2024
863036c
more fixes
danwt Jun 10, 2024
6e6591f
lfg
danwt Jun 10, 2024
2f996ff
pre change memos
danwt Jun 10, 2024
b66e9c7
write the get memo test, now need to impl
danwt Jun 10, 2024
145999f
makes sure the memo is solid
danwt Jun 10, 2024
3c92ad7
adds back the test skipper
danwt Jun 10, 2024
68f75f6
comments
danwt Jun 10, 2024
8631573
gpush
danwt Jun 10, 2024
d0fb08b
adds issue link
danwt Jun 10, 2024
d97b079
going to impl the bridge block
danwt Jun 10, 2024
e6a18a3
start to impl the other side of the bridge block
danwt Jun 10, 2024
d4774c6
working on the transfers enabled ante handler
danwt Jun 10, 2024
6c04a83
cp
danwt Jun 10, 2024
1524f0b
cp
danwt Jun 10, 2024
5033255
comment
danwt Jun 11, 2024
0f7ec46
gonna fill the deps
danwt Jun 11, 2024
c3e5df4
passes through the rollapp keeper
danwt Jun 11, 2024
c9a757d
the message
danwt Jun 11, 2024
e8b1a91
use type url in decorator
danwt Jun 11, 2024
706c65c
fix ante decorator comment
danwt Jun 11, 2024
30d34b4
del genesis proto
danwt Jun 11, 2024
ec5beb7
del some old stuff
danwt Jun 11, 2024
646bb41
pre merge main (the merge from hell)
danwt Jun 11, 2024
daf30cd
pre merge from hell
danwt Jun 11, 2024
bf68175
merge main theirs, everything gonna be broken
danwt Jun 11, 2024
ec41cdf
deletes the old bridge middleware
danwt Jun 11, 2024
ad81df0
fix some obvious merge problems
danwt Jun 11, 2024
8ca98e7
fix receiver
danwt Jun 11, 2024
14b4dfe
regen protos
danwt Jun 11, 2024
4cdb2b6
fix a couple basic build errors
danwt Jun 11, 2024
f6f88cd
it installs, somehow
danwt Jun 11, 2024
3047823
del utils, pre try to fix denom middleware
danwt Jun 11, 2024
6380cf9
partial, going to have to refac
danwt Jun 11, 2024
134c091
refac delayed ack keeper
danwt Jun 11, 2024
d88f3e0
mightve broken something
danwt Jun 11, 2024
6c3edfe
fix naming
danwt Jun 11, 2024
994401d
gonna move stuff across
danwt Jun 11, 2024
7025d21
refac
danwt Jun 11, 2024
9f34277
on the way
danwt Jun 11, 2024
8d5156f
half fix the denom middleware
danwt Jun 11, 2024
c9e6f18
fix transfer inject
danwt Jun 11, 2024
c98777d
pre move a type
danwt Jun 11, 2024
408a35c
installs
danwt Jun 11, 2024
9fc38fd
fix
danwt Jun 11, 2024
97eade0
ti refac
danwt Jun 11, 2024
29a47df
I can probably simplify to a module
danwt Jun 11, 2024
f869bc8
fix the bridgeing fee
danwt Jun 11, 2024
4a8c353
pre check casting behavior
danwt Jun 11, 2024
738ba59
pre link to fraud in issue
danwt Jun 11, 2024
869bd62
repairs the transfer genesis module
danwt Jun 11, 2024
99e559b
small repairs, ready for another test
danwt Jun 11, 2024
debff31
confirms installs
danwt Jun 11, 2024
a92b670
need to fix the hack
danwt Jun 11, 2024
f998aaf
swap line in app.go
danwt Jun 11, 2024
d70a812
needs to add the hack
danwt Jun 11, 2024
951f3af
make hack clear
danwt Jun 11, 2024
63c53fd
fix nil deref, hopefully
danwt Jun 11, 2024
75f61c0
build
danwt Jun 11, 2024
6f15c33
adds a bunch of debugs
danwt Jun 11, 2024
d38c5f8
unmarshal to inner directly
danwt Jun 11, 2024
bb30174
fix stupid typo
danwt Jun 11, 2024
22988b0
only set canonical channel once
danwt Jun 11, 2024
e7e9f33
fix stupid denom meta bug
danwt Jun 11, 2024
d6ca709
fix stupid denom meta bug
danwt Jun 12, 2024
d0ee310
new branch
danwt Jun 12, 2024
473caf5
merge main theirs just to get all commits
danwt Jun 12, 2024
559feca
use contents of 1 commit
danwt Jun 12, 2024
9a0de41
deletes memo package
danwt Jun 12, 2024
5d66449
adds a todo for using ctx more
danwt Jun 12, 2024
b4b0288
working to use a separate transfersEnabled middleware
danwt Jun 12, 2024
390b0d3
adds transfer enabled ibc module
danwt Jun 12, 2024
aba6767
tweak transfers genesis
danwt Jun 12, 2024
0f20f98
wire in the transfers enabled middleware
danwt Jun 12, 2024
7585bd6
docstrings
danwt Jun 12, 2024
6e0283a
pre change the transfer data to include the rollapp
danwt Jun 12, 2024
9ff5270
del two wrong git files
danwt Jun 12, 2024
cfbd2dd
straight up return the rollapp in the convenience method
danwt Jun 12, 2024
567f652
deletes unused utils
danwt Jun 12, 2024
e89c2da
removes minter capability
danwt Jun 12, 2024
185ddcf
changelog
danwt Jun 12, 2024
2f621c2
confirms with manual test that the genesis accounts do receive their …
danwt Jun 12, 2024
9199711
adds a debug log
danwt Jun 12, 2024
939845b
pre inline validtransfer utils
danwt Jun 12, 2024
da1705e
removes useless extra utils
danwt Jun 12, 2024
e9ec69e
deletes loads of expected keepers
danwt Jun 12, 2024
f6a4c0a
installs again - might have done something weird to simulation
danwt Jun 12, 2024
bf4d366
pre fix all the tests 😫
danwt Jun 12, 2024
6615b38
fix a stub
danwt Jun 12, 2024
3aac3e8
del rollapp_genesis_token_test
danwt Jun 12, 2024
eff26b8
fix one build err
danwt Jun 12, 2024
ec23a57
fix validation test
danwt Jun 12, 2024
c50baec
pre replace assert equal
danwt Jun 12, 2024
7a3f442
replace assert equal
danwt Jun 12, 2024
1a3f05c
removes Assert()
danwt Jun 12, 2024
b365b0f
camel
danwt Jun 12, 2024
e3f76f6
tweak
danwt Jun 12, 2024
c4e238f
pre rename udym
danwt Jun 12, 2024
383eda4
dels bridging fee
danwt Jun 12, 2024
776fb85
pre simplify app .go transfer stack wiring
danwt Jun 12, 2024
324f6f9
simplify app wiring
danwt Jun 12, 2024
2bcd643
simplify app go more
danwt Jun 12, 2024
3e38dc3
pre try to hamfist rollapp mock
danwt Jun 12, 2024
5d14f0a
lefg
danwt Jun 12, 2024
9511b49
lets test again
danwt Jun 12, 2024
0b64d8e
fix an already exists error
danwt Jun 12, 2024
65b4cb2
fix errorsmod usages
danwt Jun 12, 2024
21d138b
ready for another test run
danwt Jun 12, 2024
1374d43
set transfers enabled
danwt Jun 12, 2024
c8a516c
test again
danwt Jun 12, 2024
c942908
adds a skip ctx to the bridging fee
danwt Jun 12, 2024
8e143a3
need t fix test
danwt Jun 12, 2024
e16218c
test again
danwt Jun 12, 2024
b34ffa8
spelling
danwt Jun 12, 2024
5a4c641
set the canonical channel in the test suite
danwt Jun 12, 2024
917b70c
renames test util genesi event func
danwt Jun 12, 2024
97fd358
fix chain ctx
danwt Jun 12, 2024
6ab915a
pre del the app swap
danwt Jun 12, 2024
c5c5476
del the app swap
danwt Jun 12, 2024
13fc1da
lets come back to this one
danwt Jun 12, 2024
615a4d2
rethink
danwt Jun 12, 2024
6c8b2a3
lets do an experiment
danwt Jun 12, 2024
0eaa673
revert changes to x/rollapp/keeper/block_height_to_finalization_queue.go
danwt Jun 12, 2024
99fdf59
fix x/rollapp/keeper/block_height_to_finalization_queue.go
danwt Jun 12, 2024
1321afe
why are there both fields and args
danwt Jun 12, 2024
cdd2dec
sort out the test
danwt Jun 12, 2024
a815928
trying to figure the denom test
danwt Jun 12, 2024
e250e9d
fix panics, now need to fix the test
danwt Jun 12, 2024
f4caa6d
fix some tests
danwt Jun 12, 2024
46021b7
smallthings
danwt Jun 13, 2024
f0eee81
pause to fix relayer
danwt Jun 13, 2024
eb95f81
renames denom meta ibc test to transfer genesis
danwt Jun 13, 2024
d2aaf8c
still gonna fail, but lets check something
danwt Jun 13, 2024
ba32836
partial refac, pre del SetCanonicalRollappChannel
danwt Jun 13, 2024
a88a960
refactors and keeps things working
danwt Jun 13, 2024
a3ffdbc
trying to sort out
danwt Jun 13, 2024
ce32edb
everything still working
danwt Jun 13, 2024
1f72d54
make some stuff private
danwt Jun 13, 2024
61b1088
simplifications
danwt Jun 13, 2024
f78401a
replace message server
danwt Jun 13, 2024
df7c6a3
factor out with regression
danwt Jun 13, 2024
ee7763e
confirms passing
danwt Jun 13, 2024
709b845
bridging fee
danwt Jun 13, 2024
c4f3142
shorten and still working
danwt Jun 13, 2024
e01d9b3
ready to impl transfer gensis test
danwt Jun 13, 2024
12f7e49
adds context utils
danwt Jun 13, 2024
0571052
adds ctx helpers
danwt Jun 13, 2024
812b723
fg
danwt Jun 13, 2024
f39caad
inline app?
danwt Jun 13, 2024
114a5cd
working on the test, need to check something
danwt Jun 13, 2024
f5a05a7
refac, test is still failijng
danwt Jun 13, 2024
d6b1a94
get the test working with vfc with a hack
danwt Jun 13, 2024
774fbc6
lfg
danwt Jun 13, 2024
9693fbc
gonna split over the transfers enabled test
danwt Jun 13, 2024
bbe6813
going to have to resturcture
danwt Jun 13, 2024
cd07651
finish the test
danwt Jun 13, 2024
5d89386
moves skip
danwt Jun 13, 2024
f068e17
fix test
danwt Jun 13, 2024
6ba10b6
tests
danwt Jun 13, 2024
c25b1c1
fix go mod
danwt Jun 13, 2024
3a96a66
fix naming of app testing suite
danwt Jun 14, 2024
bbc466c
pre fix !!
danwt Jun 14, 2024
ffd49d7
fix weird double !1
danwt Jun 14, 2024
67a424e
adds a protocol description
danwt Jun 14, 2024
874d34d
one line shuffle
danwt Jun 14, 2024
91e73a8
fixing genesis test
danwt Jun 14, 2024
2a74e82
fixing genesis test
danwt Jun 14, 2024
6c42541
fixes genesis test
danwt Jun 14, 2024
b5058eb
linters
danwt Jun 14, 2024
e615632
delete empty file
danwt Jun 17, 2024
49f143c
del util
danwt Jun 17, 2024
86beeb3
renames method
danwt Jun 17, 2024
0bff69d
fix collapsed lines
danwt Jun 17, 2024
5b0af56
refac transfer inject test
danwt Jun 17, 2024
2fd20ba
pr comments
danwt Jun 17, 2024
6a58954
pr comments
danwt Jun 17, 2024
8f33d3e
del unused method
danwt Jun 17, 2024
46b3a46
pre move const
danwt Jun 17, 2024
0d484a1
del stuff
danwt Jun 17, 2024
637eb23
del token meta
danwt Jun 17, 2024
3fcce8d
regen protos
danwt Jun 17, 2024
77ab2fa
del
danwt Jun 17, 2024
8d46526
fix test
danwt Jun 17, 2024
64cef52
renames GetAllFinalizationQueueUntilHeightInclusive
danwt Jun 17, 2024
a888fa1
force ibctransfer module in brdiging fee
danwt Jun 17, 2024
5345ad7
pre merge main fix(eIBC): bridging_fee taken from original recipient …
danwt Jun 18, 2024
e49974f
merge main fix(eIBC): bridging_fee taken from original recipient and …
danwt Jun 18, 2024
40bde93
fixes build issues, but tests fail
danwt Jun 18, 2024
4e896e3
tests pass
danwt Jun 18, 2024
3789d8e
pre merge feat(eibc): update demand order (#915) and feat(eibc): auto…
danwt Jun 18, 2024
f29d11a
merge main - broken
danwt Jun 18, 2024
a37e1d3
fixes build issues, tests passing
danwt Jun 18, 2024
3babb87
moves file
danwt Jun 18, 2024
19c0c57
fix imports
danwt Jun 18, 2024
397ccec
fix comment
danwt Jun 18, 2024
3095651
skipctx
danwt Jun 18, 2024
12aec61
pre simplify transfer genesis memo
danwt Jun 19, 2024
390f832
rips out concept of memo this transfer ix
danwt Jun 19, 2024
e384e92
renames get saved packet -> save packet
danwt Jun 19, 2024
bdec7e4
removes debug log from save packet
danwt Jun 19, 2024
35a100c
removes debug log from save packet - fix signature
danwt Jun 19, 2024
5e8efca
del BlockedAddr from delayed ack keepr
danwt Jun 19, 2024
538e107
fix codec regression
danwt Jun 19, 2024
ff82b1e
handle error in hack
danwt Jun 19, 2024
961625f
improve doc for create rollapp genesis transfers enabled
danwt Jun 19, 2024
e9ac4b0
removes log and validates memo
danwt Jun 19, 2024
3feb016
use a common skip rollapp middleware ctx func
danwt Jun 19, 2024
260d7a6
deletes rapid testdata
danwt Jun 19, 2024
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
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

- (genesisbridge) [#932](https://github.com/dymensionxyz/dymension/issues/932) Adds ibc module and ante handler to stop transfers to/from rollapp that has an incomplete genesis bridge (transfersEnabled)
- (genesisbridge) [#932](https://github.com/dymensionxyz/dymension/issues/932) Adds a new temporary ibc module to set the canonical channel id, since we no longer do that using a whitelisted addr
- (genesisbridge) [#932](https://github.com/dymensionxyz/dymension/issues/932) Adds a new ibc module to handle incoming 'genesis transfers'. It validates the special memo and registers a denom. It will not allow any regular transfers if transfers are not enabled
- (rollapp) [#932](https://github.com/dymensionxyz/dymension/issues/932) Renames is_genesis_event on the rollapp genesis state to 'transfers_enabled' this is backwards compatible
- (rollapp) [#932](https://github.com/dymensionxyz/dymension/issues/932) Removes concept of passing genesis accounts and denoms in the create rollapp message
- (rollapp) [#932](https://github.com/dymensionxyz/dymension/issues/932) Adds a transfersenabled flag to createRollapp (might be changed in future)
- (delayedack) [#932](https://github.com/dymensionxyz/dymension/issues/932) Adds the notion of skipctx, to skip it with a special sdk context value
- (code standards) [#932](https://github.com/dymensionxyz/dymension/issues/932) Adds a gerr (google error ) and derr (dymension error) packages for idiomatic error handling. (In future we will consolidate across dymint/rdk)
- (denommetadata) [#907](https://github.com/dymensionxyz/dymension/issues/907) Add IBC middleware to migrate denom metadata to rollappp, remove `CreateDenomMetadata` and `UpdateDenomMetadata` tx handlers
- (delayedack) [#849](https://github.com/dymensionxyz/dymension/issues/849) Add demand order filters: type, rollapp id and limit
- (delayedack) [#850](https://github.com/dymensionxyz/dymension/issues/850) Add type filter for delayedack
Expand Down Expand Up @@ -79,6 +87,11 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

- (code standards) [#932](https://github.com/dymensionxyz/dymension/issues/932) Dry out existing middlewares to make use of new .GetValidTransfer* functions which take care of parsing and validating the fungible packet, and querying and validating any associated rollapp and finalizations
- (code standards) [#932](https://github.com/dymensionxyz/dymension/issues/932) Removes the obsolete ValidateRollappId func and sub routines
- (code standards) [#932](https://github.com/dymensionxyz/dymension/issues/932) Simplify GetAllBlockHeightToFinalizationQueue
- (code standards) [#932](https://github.com/dymensionxyz/dymension/issues/932) Fixes naming for our 'middlewares' to make them clearly one of ibc module / ics4 wrapper / middleware
- (code standards) [#932](https://github.com/dymensionxyz/dymension/issues/932) Moves our various utils to properly namespaced packages under utils/
- (rollapp) [#839](https://github.com/dymensionxyz/dymension/issues/839) Remove rollapp deprecated fields
- (eibc) [#836](https://github.com/dymensionxyz/dymension/issues/836) Improve eibc memo error handling
- (eibc) [#830](https://github.com/dymensionxyz/dymension/issues/830) Invalid tx should return ackErr
Expand Down
2 changes: 2 additions & 0 deletions app/ante/ante_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
rollappkeeper "github.com/dymensionxyz/dymension/v3/x/rollapp/keeper"
ethante "github.com/evmos/ethermint/app/ante"

errorsmod "cosmossdk.io/errors"
Expand All @@ -24,6 +25,7 @@ type HandlerOptions struct {
SignModeHandler authsigning.SignModeHandler
MaxTxGasWanted uint64
ExtensionOptionChecker ante.ExtensionOptionChecker
RollappKeeper rollappkeeper.Keeper
}

func (options HandlerOptions) validate() error {
Expand Down
6 changes: 6 additions & 0 deletions app/ante/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
ante "github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
"github.com/dymensionxyz/dymension/v3/x/rollapp/transfersenabled"
ethante "github.com/evmos/ethermint/app/ante"
txfeesante "github.com/osmosis-labs/osmosis/v15/x/txfees/ante"

Expand Down Expand Up @@ -72,6 +73,8 @@ func newLegacyCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
delayedack.NewIBCProofHeightDecorator(),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),

transfersenabled.NewDecorator(options.RollappKeeper.GetRollapp, options.IBCKeeper.ChannelKeeper.GetChannelClientState),
)
}

Expand All @@ -80,6 +83,7 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
deductFeeDecorator := txfeesante.NewDeductFeeDecorator(*options.TxFeesKeeper, options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper)

return sdk.ChainAnteDecorators(

NewRejectMessagesDecorator(), // reject MsgEthereumTxs and vesting msgs
ethante.NewAuthzLimiterDecorator([]string{ // disable the Msg types that cannot be included on an authz.MsgExec msgs field
sdk.MsgTypeURL(&evmtypes.MsgEthereumTx{}),
Expand All @@ -105,5 +109,7 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
delayedack.NewIBCProofHeightDecorator(),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
ethante.NewGasWantedDecorator(options.EvmKeeper, options.FeeMarketKeeper),

transfersenabled.NewDecorator(options.RollappKeeper.GetRollapp, options.IBCKeeper.ChannelKeeper.GetChannelClientState),
)
}
57 changes: 20 additions & 37 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import (
"os"
"path/filepath"

"github.com/dymensionxyz/dymension/v3/x/bridging_fee"
"github.com/dymensionxyz/dymension/v3/x/rollapp/transfersenabled"

"github.com/dymensionxyz/dymension/v3/x/rollapp/transfergenesis"

"github.com/dymensionxyz/dymension/v3/x/bridgingfee"

vfchooks "github.com/dymensionxyz/dymension/v3/x/vfc/hooks"

"github.com/gorilla/mux"
Expand Down Expand Up @@ -279,7 +284,7 @@ var (
govtypes.ModuleName: {authtypes.Burner},
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
sequencermoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
rollappmoduletypes.ModuleName: {authtypes.Minter},
rollappmoduletypes.ModuleName: {},
streamermoduletypes.ModuleName: nil,
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account.
evmtypes.ModuleVirtualFrontierContractDeployerName: nil, // used for deploying virtual frontier bank contract.
Expand Down Expand Up @@ -546,7 +551,7 @@ func New(
app.AccountKeeper,
)

txfeeskeeper := txfeeskeeper.NewKeeper(
txFeesKeeper := txfeeskeeper.NewKeeper(
app.keys[txfeestypes.StoreKey],
app.GetSubspace(txfeestypes.ModuleName),
app.AccountKeeper,
Expand All @@ -555,7 +560,7 @@ func New(
app.PoolManagerKeeper,
app.GAMMKeeper,
)
app.TxFeesKeeper = &txfeeskeeper
app.TxFeesKeeper = &txFeesKeeper
app.GAMMKeeper.SetPoolManager(app.PoolManagerKeeper)
app.GAMMKeeper.SetTxFees(app.TxFeesKeeper)

Expand Down Expand Up @@ -609,32 +614,21 @@ func New(
),
)

app.RollappKeeper = *rollappmodulekeeper.NewKeeper(
appCodec,
keys[rollappmoduletypes.StoreKey],
keys[rollappmoduletypes.MemStoreKey],
app.GetSubspace(rollappmoduletypes.ModuleName),
app.IBCKeeper.ClientKeeper,
app.IBCKeeper.ChannelKeeper,
app.BankKeeper,
app.DenomMetadataKeeper,
)
app.RollappKeeper = *rollappmodulekeeper.NewKeeper(appCodec, keys[rollappmoduletypes.StoreKey], app.GetSubspace(rollappmoduletypes.ModuleName), app.IBCKeeper.ChannelKeeper)

// Create Transfer Keepers
app.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec,
keys[ibctransfertypes.StoreKey],
app.GetSubspace(ibctransfertypes.ModuleName),
transferinject.NewIBCSendMiddleware(app.IBCKeeper.ChannelKeeper, app.RollappKeeper, app.BankKeeper),
transferinject.NewICS4Wrapper(app.IBCKeeper.ChannelKeeper, app.RollappKeeper, app.BankKeeper),
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
app.BankKeeper,
scopedTransferKeeper,
)

app.RollappKeeper.SetTransferKeeper(app.TransferKeeper)

app.SequencerKeeper = *sequencermodulekeeper.NewKeeper(
appCodec,
keys[sequencermoduletypes.StoreKey],
Expand All @@ -649,11 +643,8 @@ func New(
keys[delayedacktypes.StoreKey],
app.GetSubspace(delayedacktypes.ModuleName),
app.RollappKeeper,
app.SequencerKeeper,
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ConnectionKeeper,
app.IBCKeeper.ClientKeeper,
&app.EIBCKeeper,
app.BankKeeper,
)
Expand Down Expand Up @@ -742,27 +733,18 @@ func New(
)

transferModule := ibctransfer.NewAppModule(app.TransferKeeper)
transferMiddleware := ibctransfer.NewIBCModule(app.TransferKeeper)

var transferStack ibcporttypes.IBCModule
transferStack = bridging_fee.NewIBCMiddleware(
transferMiddleware,
app.IBCKeeper.ChannelKeeper,
app.DelayedAckKeeper,
app.RollappKeeper,
app.TransferKeeper,
app.AccountKeeper.GetModuleAddress(txfeestypes.ModuleName),
)
transferStack = ibctransfer.NewIBCModule(app.TransferKeeper)
transferStack = bridgingfee.NewIBCModule(transferStack.(ibctransfer.IBCModule), app.DelayedAckKeeper, app.TransferKeeper, app.AccountKeeper.GetModuleAddress(txfeestypes.ModuleName), app.RollappKeeper)
transferStack = packetforwardmiddleware.NewIBCMiddleware(transferStack, app.PacketForwardMiddlewareKeeper, 0, packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp, packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp)

transferStack = packetforwardmiddleware.NewIBCMiddleware(
transferStack,
app.PacketForwardMiddlewareKeeper,
0,
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)
delayedAckMiddleware := delayedackmodule.NewIBCMiddleware(transferStack, app.DelayedAckKeeper, app.RollappKeeper)
transferStack = transferinject.NewIBCAckMiddleware(delayedAckMiddleware, app.RollappKeeper)
transferStack = delayedAckMiddleware
transferStack = transferinject.NewIBCModule(transferStack, app.RollappKeeper)
transferStack = transfersenabled.NewIBCModule(transferStack, app.RollappKeeper, app.DelayedAckKeeper)
transferStack = transfergenesis.NewIBCModule(transferStack, app.DelayedAckKeeper, app.RollappKeeper, app.TransferKeeper, app.DenomMetadataKeeper)
transferStack = transfergenesis.NewIBCModuleCanonicalChannelHack(transferStack, app.RollappKeeper, app.IBCKeeper.ChannelKeeper.GetChannelClientState)

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := ibcporttypes.NewRouter()
Expand Down Expand Up @@ -976,6 +958,7 @@ func New(
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
MaxTxGasWanted: maxGasWanted,
ExtensionOptionChecker: nil, // uses default
RollappKeeper: app.RollappKeeper,
})
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion app/apptesting/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ func (s *KeeperTestHelper) ExtractAttributes(event sdk.Event) map[string]string
func (s *KeeperTestHelper) AssertAttributes(event sdk.Event, eventAttributes []sdk.Attribute) {
attrs := s.ExtractAttributes(event)
for _, attr := range eventAttributes {
s.Assert().Equal(attr.Value, attrs[attr.Key])
s.Equal(attr.Value, attrs[attr.Key])
}
}
4 changes: 3 additions & 1 deletion app/apptesting/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"testing"
"time"

errorsmod "cosmossdk.io/errors"

"cosmossdk.io/math"

"github.com/dymensionxyz/dymension/v3/app/params"
Expand Down Expand Up @@ -453,7 +455,7 @@ func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) {
panic(err)
}
if len(pkBytes) != ed25519.PubKeySize {
panic(errors.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size"))
panic(errorsmod.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size"))
}
return &ed25519.PubKey{Key: pkBytes}
}
Expand Down
28 changes: 14 additions & 14 deletions app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,32 @@ type KeeperTestHelper struct {
Ctx sdk.Context
}

func (suite *KeeperTestHelper) CreateDefaultRollapp() string {
return suite.CreateRollappWithName(rand.Str(8))
func (s *KeeperTestHelper) CreateDefaultRollapp() string {
return s.CreateRollappWithName(rand.Str(8))
}

func (suite *KeeperTestHelper) CreateRollappWithName(name string) string {
func (s *KeeperTestHelper) CreateRollappWithName(name string) string {
msgCreateRollapp := rollapptypes.MsgCreateRollapp{
Creator: alice,
RollappId: name,
MaxSequencers: 5,
}

msgServer := rollappkeeper.NewMsgServerImpl(suite.App.RollappKeeper)
_, err := msgServer.CreateRollapp(suite.Ctx, &msgCreateRollapp)
suite.Require().NoError(err)
msgServer := rollappkeeper.NewMsgServerImpl(s.App.RollappKeeper)
_, err := msgServer.CreateRollapp(s.Ctx, &msgCreateRollapp)
s.Require().NoError(err)
return name
}

func (suite *KeeperTestHelper) CreateDefaultSequencer(ctx sdk.Context, rollappId string) string {
func (s *KeeperTestHelper) CreateDefaultSequencer(ctx sdk.Context, rollappId string) string {
pubkey1 := secp256k1.GenPrivKey().PubKey()
addr1 := sdk.AccAddress(pubkey1.Address())
pkAny1, err := codectypes.NewAnyWithValue(pubkey1)
suite.Require().Nil(err)
s.Require().Nil(err)

// fund account
err = bankutil.FundAccount(suite.App.BankKeeper, ctx, addr1, sdk.NewCoins(bond))
suite.Require().Nil(err)
err = bankutil.FundAccount(s.App.BankKeeper, ctx, addr1, sdk.NewCoins(bond))
s.Require().Nil(err)

sequencerMsg1 := sequencertypes.MsgCreateSequencer{
Creator: addr1.String(),
Expand All @@ -62,13 +62,13 @@ func (suite *KeeperTestHelper) CreateDefaultSequencer(ctx sdk.Context, rollappId
Description: sequencertypes.Description{},
}

msgServer := sequencerkeeper.NewMsgServerImpl(suite.App.SequencerKeeper)
msgServer := sequencerkeeper.NewMsgServerImpl(s.App.SequencerKeeper)
_, err = msgServer.CreateSequencer(ctx, &sequencerMsg1)
suite.Require().Nil(err)
s.Require().Nil(err)
return addr1.String()
}

func (suite *KeeperTestHelper) PostStateUpdate(ctx sdk.Context, rollappId, seqAddr string, startHeight, numOfBlocks uint64) (lastHeight uint64, err error) {
func (s *KeeperTestHelper) PostStateUpdate(ctx sdk.Context, rollappId, seqAddr string, startHeight, numOfBlocks uint64) (lastHeight uint64, err error) {
var bds rollapptypes.BlockDescriptors
bds.BD = make([]rollapptypes.BlockDescriptor, numOfBlocks)
for k := 0; k < int(numOfBlocks); k++ {
Expand All @@ -84,7 +84,7 @@ func (suite *KeeperTestHelper) PostStateUpdate(ctx sdk.Context, rollappId, seqAd
Version: 0,
BDs: bds,
}
msgServer := rollappkeeper.NewMsgServerImpl(suite.App.RollappKeeper)
msgServer := rollappkeeper.NewMsgServerImpl(s.App.RollappKeeper)
_, err = msgServer.UpdateState(ctx, &updateState)
return startHeight + numOfBlocks, err
}
7 changes: 4 additions & 3 deletions app/params/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package params

import (
errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down Expand Up @@ -52,15 +53,15 @@ func SetAddressPrefixes() {

config.SetAddressVerifier(func(bytes []byte) error {
if len(bytes) == 0 {
return sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, "addresses cannot be empty")
return errorsmod.Wrap(sdkerrors.ErrUnknownAddress, "addresses cannot be empty")
}

if len(bytes) > address.MaxAddrLen {
return sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "address max length is %d, got %d", address.MaxAddrLen, len(bytes))
return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "address max length is %d, got %d", address.MaxAddrLen, len(bytes))
}

if len(bytes) != 20 && len(bytes) != 32 {
return sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "address length must be 20 or 32 bytes, got %d", len(bytes))
return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "address length must be 20 or 32 bytes, got %d", len(bytes))
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ require (
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/osmosis-labs/osmosis/v15 v15.2.0
github.com/pkg/errors v0.9.1
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
Expand Down Expand Up @@ -160,7 +161,6 @@ require (
github.com/osmosis-labs/osmosis/osmomath v0.0.4 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
Expand Down
Loading
Loading