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

Unfork CosmosSDK, CometBFT, ibc-go #539

Merged
merged 52 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2a634d1
init
hoank101 Nov 2, 2024
9962526
add PreBlocker
hoank101 Nov 2, 2024
7a918a8
add abci test
TropicalDog17 Nov 4, 2024
079e813
add custom mempool
hoank101 Nov 9, 2024
c66a6f7
add mempool_priority
hoank101 Nov 16, 2024
ae69440
add more test
hoank101 Nov 16, 2024
b9f8a09
update test
hoank101 Nov 16, 2024
9fe05ff
update test
hoank101 Nov 18, 2024
a2b2dbb
update test
hoank101 Nov 18, 2024
7c9655c
add fifo mempool by sender nonce
hoank101 Nov 22, 2024
348b0b1
update mempool
hoank101 Nov 22, 2024
e4c99bd
update test
hoank101 Nov 22, 2024
17edbff
bet
hoank101 Nov 22, 2024
3b91598
bet
hoank101 Nov 22, 2024
a0e8ff5
bet
hoank101 Nov 22, 2024
9698f6c
test(interchaintest): add basic test case and helper for testing tx o…
TropicalDog17 Nov 23, 2024
0c23b00
update the mempool
hoank101 Nov 23, 2024
8f9aacc
update the mempool
hoank101 Nov 23, 2024
bd6a56f
update mempool
hoank101 Nov 24, 2024
54ead04
update mempool
hoank101 Nov 24, 2024
f3fdb95
bet
hoank101 Nov 24, 2024
c02272d
bet
hoank101 Nov 24, 2024
7289b31
feat: unfork cosmos sdk (#17)
kien6034 Nov 24, 2024
16a79b2
upgrade cometbft to v0.37.13
hoank101 Nov 24, 2024
7a6027a
Merge branch 'develop' of https://github.com/orbitorg/core into feat/…
hoank101 Nov 25, 2024
760062b
bet
hoank101 Nov 25, 2024
1875d99
test: add test override config cache size (#30)
tnv1 Nov 27, 2024
077e7e9
fix: handle totalPower is zero (#31)
tnv1 Nov 28, 2024
2ac4141
[ibc] move check memo and receiver length logic to antehandler (#28)
kien6034 Nov 28, 2024
fb782fb
test: add test BlockHeightMiddleware (#34)
tnv1 Nov 28, 2024
668e387
update script
hoank101 Nov 28, 2024
aa7fe0e
bet
hoank101 Nov 28, 2024
35311c2
downgrade to go1.20
TropicalDog17 Nov 28, 2024
0775a78
pin taskgroup 0.6.0 for go < 1.21
TropicalDog17 Nov 28, 2024
2433f89
fix
TropicalDog17 Nov 28, 2024
3e4a438
lint
TropicalDog17 Nov 28, 2024
ae86d70
bet
TropicalDog17 Nov 28, 2024
05f1392
fix test
TropicalDog17 Nov 28, 2024
343479f
feat: add upgrade handle (#35)
hoank101 Nov 28, 2024
508dfb9
update script
hoank101 Dec 1, 2024
1039e51
bet
TropicalDog17 Dec 2, 2024
68438e7
Merge pull request #16 from orbitorg/feat/unfork-cosmossdk-cometbft
kien6034 Dec 5, 2024
3c57048
merge main
kien6034 Dec 5, 2024
3389613
fix oracle tx
kien6034 Dec 5, 2024
2c7d861
update upgrade handler
kien6034 Dec 5, 2024
bc72db4
chore: enable runner
kien6034 Dec 5, 2024
a411525
fix lint
kien6034 Dec 5, 2024
219d12e
bet
kien6034 Dec 5, 2024
5c3372f
perf: return error instead of panicking
kien6034 Dec 6, 2024
719eaf5
validator limit: fix test to assert err
kien6034 Dec 6, 2024
2c6b614
bet
hoank101 Dec 7, 2024
bd95ce0
bet
hoank101 Dec 7, 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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ ictest-ibc-pfm: ictest-build
ictest-ibc-pfm-terra: ictest-build
@cd tests/interchaintest && go test -race -v -run TestTerraPFM .

ictest-oracle: ictest-build
@cd tests/interchaintest && go test -race -v -run TestOracle .

ictest-build:
@DOCKER_BUILDKIT=1 docker build -t core:local -f ictest.Dockerfile .

Expand Down
38 changes: 34 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"

appmempool "github.com/classic-terra/core/v3/app/mempool"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
Expand All @@ -33,7 +34,6 @@ import (
servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand All @@ -43,6 +43,7 @@ import (

"github.com/classic-terra/core/v3/app/keepers"
terraappparams "github.com/classic-terra/core/v3/app/params"
customserver "github.com/classic-terra/core/v3/server"

// upgrades
"github.com/classic-terra/core/v3/app/upgrades"
Expand All @@ -61,6 +62,7 @@ import (

// v9 had been used by tax2gas and has to be skipped
v10_1 "github.com/classic-terra/core/v3/app/upgrades/v10_1"
v11 "github.com/classic-terra/core/v3/app/upgrades/v11"

customante "github.com/classic-terra/core/v3/custom/auth/ante"
custompost "github.com/classic-terra/core/v3/custom/auth/post"
Expand Down Expand Up @@ -95,6 +97,7 @@ var (
v8_2.Upgrade,
v8_3.Upgrade,
v10_1.Upgrade,
v11.Upgrade,
}

// Forks defines forks to be applied to the network
Expand Down Expand Up @@ -142,7 +145,7 @@ func init() {

// NewTerraApp returns a reference to an initialized TerraApp.
func NewTerraApp(
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
logger log.Logger, db dbm.DB, _ io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,
homePath string, encodingConfig terraappparams.EncodingConfig, appOpts servertypes.AppOptions,
wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp),
) *TerraApp {
Expand All @@ -152,10 +155,29 @@ func NewTerraApp(
txConfig := encodingConfig.TxConfig

invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod))
iavlCacheSize := cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))
iavlDisableFastNode := cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))

// option for cosmos sdk
baseAppOptions = append(baseAppOptions, baseapp.SetIAVLCacheSize(iavlCacheSize))
baseAppOptions = append(baseAppOptions, baseapp.SetIAVLDisableFastNode(iavlDisableFastNode))

// option for mempool
baseAppOptions = append(baseAppOptions, func(app *baseapp.BaseApp) {
var mempool *appmempool.FifoMempool
if maxTxs := cast.ToInt(appOpts.Get(server.FlagMempoolMaxTxs)); maxTxs >= 0 {
mempool = appmempool.NewFifoMempool(appmempool.FifoMaxTxOpt(maxTxs))
} else {
mempool = appmempool.NewFifoMempool()
}
handler := baseapp.NewDefaultProposalHandler(mempool, app)
app.SetMempool(mempool)
app.SetTxEncoder(txConfig.TxEncoder())
app.SetPrepareProposal(handler.PrepareProposalHandler())
app.SetProcessProposal(handler.ProcessProposalHandler())
})

bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
bApp.SetVersion(version.Version)
bApp.SetInterfaceRegistry(interfaceRegistry)

app := &TerraApp{
Expand Down Expand Up @@ -406,6 +428,9 @@ func (app *TerraApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIC
if apiConfig.Swagger {
RegisterSwaggerAPI(apiSvr.Router)
}

// Apply custom middleware
apiSvr.Router.Use(customserver.BlockHeightMiddleware)
}

// RegisterTxService implements the Application.RegisterTxService method.
Expand Down Expand Up @@ -478,3 +503,8 @@ func (app *TerraApp) setupUpgradeHandlers() {
)
}
}

// GetTxConfig for testing
func (app *TerraApp) GetTxConfig() client.TxConfig {
return app.txConfig
}
24 changes: 24 additions & 0 deletions app/helper/helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package helper

import (
oracleexported "github.com/classic-terra/core/v3/x/oracle/exported"
sdk "github.com/cosmos/cosmos-sdk/types"
)

func IsOracleTx(msgs []sdk.Msg) bool {
if len(msgs) == 0 {
return false
}
for _, msg := range msgs {
switch msg.(type) {
case *oracleexported.MsgAggregateExchangeRatePrevote:
continue
case *oracleexported.MsgAggregateExchangeRateVote:
continue
default:
return false
}
}

return true
}
4 changes: 2 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
customstaking "github.com/classic-terra/core/v3/custom/staking"
customwasmkeeper "github.com/classic-terra/core/v3/custom/wasm/keeper"
terrawasm "github.com/classic-terra/core/v3/wasmbinding"

dyncommkeeper "github.com/classic-terra/core/v3/x/dyncomm/keeper"
dyncommtypes "github.com/classic-terra/core/v3/x/dyncomm/types"
marketkeeper "github.com/classic-terra/core/v3/x/market/keeper"
Expand Down Expand Up @@ -277,7 +277,7 @@ func NewAppKeepers(
// register the staking hooks
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
appKeepers.StakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(appKeepers.DistrKeeper.Hooks(), appKeepers.SlashingKeeper.Hooks()),
stakingtypes.NewMultiStakingHooks(customstaking.NewTerraStakingHooks(*appKeepers.StakingKeeper), appKeepers.DistrKeeper.Hooks(), appKeepers.SlashingKeeper.Hooks()),
)

// Create IBC Keeper
Expand Down
Loading
Loading