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: Symbiotic network module #542

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
15 changes: 14 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@
gasestimatekeeper "github.com/ojo-network/ojo/x/gasestimate/keeper"
gasestimatetypes "github.com/ojo-network/ojo/x/gasestimate/types"

symbiotickeeper "github.com/ojo-network/ojo/x/symbiotic/keeper"
symbiotictypes "github.com/ojo-network/ojo/x/symbiotic/types"

"github.com/ojo-network/ojo/x/airdrop"
airdropkeeper "github.com/ojo-network/ojo/x/airdrop/keeper"
airdroptypes "github.com/ojo-network/ojo/x/airdrop/types"
Expand Down Expand Up @@ -150,6 +153,7 @@
oracletypes.ModuleName: {authtypes.Minter},
gmptypes.ModuleName: {authtypes.Minter},
gasestimatetypes.ModuleName: {authtypes.Burner},
symbiotictypes.ModuleName: {authtypes.Minter},
airdroptypes.ModuleName: {authtypes.Minter},
}
)
Expand Down Expand Up @@ -208,6 +212,7 @@
GmpKeeper gmpkeeper.Keeper
GasEstimateKeeper gasestimatekeeper.Keeper
AirdropKeeper airdropkeeper.Keeper
SymbioticKeeper symbiotickeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper

// make scoped keepers public for test purposes
Expand Down Expand Up @@ -270,7 +275,7 @@
govtypes.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey,
feegrant.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey, capabilitytypes.StoreKey,
consensusparamtypes.StoreKey, group.StoreKey, oracletypes.StoreKey, gmptypes.StoreKey,
gasestimatetypes.ModuleName, airdroptypes.StoreKey,
gasestimatetypes.ModuleName, airdroptypes.StoreKey, symbiotictypes.StoreKey,
)
tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
Expand Down Expand Up @@ -395,7 +400,7 @@
app.GroupKeeper = groupkeeper.NewKeeper(
keys[group.StoreKey],
appCodec,
app.MsgServiceRouter(),

Check failure on line 403 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

app.MsgServiceRouter undefined (type *App has no field or method MsgServiceRouter) (typecheck)
app.AccountKeeper,
groupConfig,
)
Expand All @@ -421,6 +426,13 @@
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.SymbioticKeeper = symbiotickeeper.NewKeeper(
appCodec,
keys[symbiotictypes.ModuleName],
app.StakingKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.OracleKeeper = oraclekeeper.NewKeeper(
appCodec,
keys[oracletypes.ModuleName],
Expand All @@ -430,6 +442,7 @@
app.DistrKeeper,
app.StakingKeeper,
app.GasEstimateKeeper,
app.SymbioticKeeper,
distrtypes.ModuleName,
cast.ToBool(appOpts.Get("telemetry.enabled")),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
Expand Down Expand Up @@ -462,7 +475,7 @@
app.AuthzKeeper = authzkeeper.NewKeeper(
runtime.NewKVStoreService(keys[authzkeeper.StoreKey]),
appCodec,
app.MsgServiceRouter(),

Check failure on line 478 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

app.MsgServiceRouter undefined (type *App has no field or method MsgServiceRouter) (typecheck)
app.AccountKeeper,
)

Expand Down Expand Up @@ -537,7 +550,7 @@
govKeeper := govkeeper.NewKeeper(
appCodec, runtime.NewKVStoreService(keys[govtypes.StoreKey]),
app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.DistrKeeper,
app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(),

Check failure on line 553 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

app.MsgServiceRouter undefined (type *App has no field or method MsgServiceRouter) (typecheck)
)
// Set legacy router for backwards compatibility with gov v1beta1
govKeeper.SetLegacyRouter(govRouter)
Expand Down Expand Up @@ -700,7 +713,7 @@
// app.mm.SetOrderMigrations(custom order)

app.mm.RegisterInvariants(app.CrisisKeeper)
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())

Check failure on line 716 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

app.MsgServiceRouter undefined (type *App has no field or method MsgServiceRouter) (typecheck)
err := app.mm.RegisterServices(app.configurator)
if err != nil {
panic(err)
Expand All @@ -710,13 +723,13 @@
// Make sure it's called after `app.mm` and `app.configurator` are set.
app.RegisterUpgradeHandlers()

autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules))

Check failure on line 726 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

app.GRPCQueryRouter undefined (type *App has no field or method GRPCQueryRouter) (typecheck)

reflectionSvc, err := runtimeservices.NewReflectionService()
if err != nil {
panic(err)
}
reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc)

Check failure on line 732 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

app.GRPCQueryRouter undefined (type *App has no field or method GRPCQueryRouter) (typecheck)

// create the simulation manager and define the order of the modules for deterministic simulations
//
Expand Down Expand Up @@ -747,11 +760,11 @@
app.StateSimulationManager.RegisterStoreDecoders()

proposalHandler := oracleabci.NewProposalHandler(
app.Logger(),

Check failure on line 763 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

app.Logger undefined (type *App has no field or method Logger) (typecheck)
app.OracleKeeper,
app.StakingKeeper,
)
app.SetPrepareProposal(proposalHandler.PrepareProposalHandler())

Check failure on line 767 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

app.SetPrepareProposal undefined (type *App has no field or method SetPrepareProposal) (typecheck)
app.SetProcessProposal(proposalHandler.ProcessProposalHandler())

voteExtensionsHandler := oracleabci.NewVoteExtensionHandler(
Expand Down
8 changes: 8 additions & 0 deletions app/preblocker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ojo-network/ojo/x/oracle/types"

gasestimatetypes "github.com/ojo-network/ojo/x/gasestimate/types"
symbiotictypes "github.com/ojo-network/ojo/x/symbiotic/types"
)

// PreBlocker is run before finalize block to update the aggregrate exchange rate votes on the oracle module
Expand Down Expand Up @@ -67,6 +68,13 @@ func (app *App) PreBlocker(ctx sdk.Context, req *cometabci.RequestFinalizeBlock)
})
}
app.Logger().Info("gas estimates updated", "gasestimates", injectedVoteExtTx.GasEstimateMedians)

currentBlockHash := app.OracleKeeper.SymbioticKeeper.TallyBlockHashVotes(ctx, injectedVoteExtTx.BlockHashVotes)
cachedBlockHash := symbiotictypes.CachedBlockHash{
BlockHash: currentBlockHash,
Height: req.Height,
}
app.OracleKeeper.SymbioticKeeper.SetCachedBlockHash(ctx, cachedBlockHash)
}

app.Logger().Info(
Expand Down
30 changes: 23 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/cosmos/gogoproto v1.4.12
github.com/cosmos/ibc-go/modules/capability v1.0.0
github.com/cosmos/ibc-go/v8 v8.2.1
github.com/ethereum/go-ethereum v1.14.2
github.com/ethereum/go-ethereum v1.14.11
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.4
github.com/golangci/golangci-lint v1.60.3
Expand Down Expand Up @@ -85,9 +85,10 @@ require (
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/alecthomas/go-check-sumtype v0.1.4 // indirect
github.com/alexkohler/nakedret/v2 v2.0.4 // indirect
github.com/alexkohler/prealloc v1.0.0 // indirect
Expand All @@ -99,13 +100,13 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/bkielbasa/cyclop v1.2.1 // indirect
github.com/blizzy78/varnamelen v0.8.0 // indirect
github.com/bombsimon/wsl/v4 v4.4.1 // indirect
github.com/breml/bidichk v0.2.7 // indirect
github.com/breml/errchkjson v0.3.6 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect
github.com/bufbuild/protocompile v0.9.0 // indirect
github.com/bufbuild/protovalidate-go v0.6.2 // indirect
Expand All @@ -122,12 +123,15 @@ require (
github.com/chzyer/readline v1.5.1 // indirect
github.com/ckaznocha/intrange v0.1.2 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.0 // indirect
github.com/cockroachdb/pebble v1.1.2 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.11.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/containerd/continuity v0.4.1 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
Expand All @@ -136,12 +140,15 @@ require (
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/creachadair/atomicfile v0.3.1 // indirect
github.com/creachadair/tomledit v0.0.24 // indirect
github.com/curioswitch/go-reassign v0.2.0 // indirect
github.com/daixiang0/gci v0.13.4 // indirect
github.com/danieljoos/wincred v1.2.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/deckarep/golang-set/v2 v2.6.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/denis-tingaikin/go-header v0.5.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
Expand All @@ -158,6 +165,8 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
github.com/emicklei/dot v1.6.1 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect
github.com/ettle/strcase v0.2.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
Expand All @@ -177,6 +186,7 @@ require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.0 // indirect
Expand Down Expand Up @@ -238,7 +248,7 @@ require (
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/holiman/uint256 v1.3.1 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
Expand Down Expand Up @@ -284,6 +294,7 @@ require (
github.com/minio/highwayhash v1.0.2 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/moricho/tparallel v0.3.2 // indirect
Expand Down Expand Up @@ -333,6 +344,7 @@ require (
github.com/sashamelentyev/usestdlibvars v1.27.0 // indirect
github.com/securego/gosec/v2 v2.20.1-0.20240822074752-ab3f6c1c83a0 // indirect
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sivchari/tenv v1.10.0 // indirect
Expand All @@ -346,13 +358,16 @@ require (
github.com/stoewer/go-strcase v1.3.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.13 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tdakkota/asciicheck v0.2.0 // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tetafro/godot v1.4.16 // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect
github.com/timonwong/loggercheck v0.9.4 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tomarrell/wrapcheck/v2 v2.9.0 // indirect
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
Expand Down Expand Up @@ -404,6 +419,7 @@ require (
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect
nhooyr.io/websocket v1.8.7 // indirect
pgregory.net/rapid v1.1.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

Expand Down
Loading
Loading