Skip to content

Commit

Permalink
feat: update slinky => connect/v2 (#269)
Browse files Browse the repository at this point in the history
* update slinky => connect/v2

* bump lint version

* fix test

* bump OPinit to v0.5.0
  • Loading branch information
beer-1 authored Sep 25, 2024
1 parent 3aa6176 commit 624ce30
Show file tree
Hide file tree
Showing 26 changed files with 289 additions and 313 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ concurrency:
jobs:
golangci:
env:
GOLANGCI_LINT_VERSION: v1.59.1
GOLANGCI_LINT_VERSION: v1.61.0
name: golangci-lint
runs-on: ubuntu-latest
steps:
Expand Down
10 changes: 5 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ import (

blockchecktx "github.com/skip-mev/block-sdk/v2/abci/checktx"

// slinky oracle dependencies
// connect oracle dependencies

oracleconfig "github.com/skip-mev/slinky/oracle/config"
oracleclient "github.com/skip-mev/slinky/service/clients/oracle"
oracleconfig "github.com/skip-mev/connect/v2/oracle/config"
oracleclient "github.com/skip-mev/connect/v2/service/clients/oracle"

// unnamed import of statik for swagger UI support
_ "github.com/initia-labs/initia/client/docs/statik"
Expand Down Expand Up @@ -114,7 +114,7 @@ type InitiaApp struct {
txConfig client.TxConfig
interfaceRegistry types.InterfaceRegistry

// slinky oracle client
// connect oracle client
oracleClient oracleclient.OracleClient

// the module manager
Expand Down Expand Up @@ -278,7 +278,7 @@ func NewInitiaApp(
app.SetAnteHandler(anteHandler)
app.SetCheckTx(checkTx)

// setup slinky
// setup connect

oracleClient, prepareProposalHandler, processProposalHandler, preBlocker, extendedVoteHandler, verifyVoteExtensionHandler, err := setupSlinky(
app,
Expand Down
2 changes: 1 addition & 1 deletion app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
staking "github.com/initia-labs/initia/x/mstaking"
"github.com/initia-labs/initia/x/reward"

oracleconfig "github.com/skip-mev/slinky/oracle/config"
oracleconfig "github.com/skip-mev/connect/v2/oracle/config"
)

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
Expand Down
28 changes: 14 additions & 14 deletions app/slinky.go → app/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import (

stakingkeeper "github.com/initia-labs/initia/x/mstaking/keeper"

// slinky oracle dependencies
oraclepreblock "github.com/skip-mev/slinky/abci/preblock/oracle"
oracleproposals "github.com/skip-mev/slinky/abci/proposals"
"github.com/skip-mev/slinky/abci/strategies/aggregator"
compression "github.com/skip-mev/slinky/abci/strategies/codec"
"github.com/skip-mev/slinky/abci/strategies/currencypair"
"github.com/skip-mev/slinky/abci/ve"
oracleconfig "github.com/skip-mev/slinky/oracle/config"
"github.com/skip-mev/slinky/pkg/math/voteweighted"
oracleclient "github.com/skip-mev/slinky/service/clients/oracle"
servicemetrics "github.com/skip-mev/slinky/service/metrics"
oracleservertypes "github.com/skip-mev/slinky/service/servers/oracle/types"
// connect oracle dependencies
oraclepreblock "github.com/skip-mev/connect/v2/abci/preblock/oracle"
oracleproposals "github.com/skip-mev/connect/v2/abci/proposals"
"github.com/skip-mev/connect/v2/abci/strategies/aggregator"
compression "github.com/skip-mev/connect/v2/abci/strategies/codec"
"github.com/skip-mev/connect/v2/abci/strategies/currencypair"
"github.com/skip-mev/connect/v2/abci/ve"
oracleconfig "github.com/skip-mev/connect/v2/oracle/config"
"github.com/skip-mev/connect/v2/pkg/math/voteweighted"
oracleclient "github.com/skip-mev/connect/v2/service/clients/oracle"
servicemetrics "github.com/skip-mev/connect/v2/service/metrics"
oracleservertypes "github.com/skip-mev/connect/v2/service/servers/oracle/types"

// OPinit dependencies
l2slinky "github.com/initia-labs/OPinit/x/opchild/l2slinky"
l2connect "github.com/initia-labs/OPinit/x/opchild/l2connect"
)

func setupSlinky(
Expand Down Expand Up @@ -166,7 +166,7 @@ func (oc oracleClientWithTimestamp) Prices(ctx context.Context, req *oracleserve
}

if resp != nil {
resp.Prices[l2slinky.ReservedCPTimestamp] = strconv.FormatInt(resp.Timestamp.UTC().UnixNano(), 10)
resp.Prices[l2connect.ReservedCPTimestamp] = strconv.FormatInt(resp.Timestamp.UTC().UnixNano(), 10)
}
return resp, err
}
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/initia-labs/initia/app/params"
moveconfig "github.com/initia-labs/initia/x/move/config"

oracleconfig "github.com/skip-mev/slinky/oracle/config"
oracleconfig "github.com/skip-mev/connect/v2/oracle/config"
)

func MakeEncodingConfig() params.EncodingConfig {
Expand Down
14 changes: 6 additions & 8 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

l2slinky "github.com/initia-labs/OPinit/x/opchild/l2slinky"
l2connect "github.com/initia-labs/OPinit/x/opchild/l2connect"
"github.com/initia-labs/initia/app/genesis_markets"
customdistrtypes "github.com/initia-labs/initia/x/distribution/types"
customgovtypes "github.com/initia-labs/initia/x/gov/types"
Expand All @@ -25,9 +25,9 @@ import (
rewardtypes "github.com/initia-labs/initia/x/reward/types"

auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types"
slinkytypes "github.com/skip-mev/slinky/pkg/types"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
connecttypes "github.com/skip-mev/connect/v2/pkg/types"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"
)

// GenesisState - The genesis state of the blockchain is represented here as a map of raw json
Expand Down Expand Up @@ -107,24 +107,22 @@ func (genState GenesisState) AddMarketData(cdc codec.JSONCodec, ac address.Codec
marketGenState.MarketMap = genesis_markets.ToMarketMap(markets)

// Skip Admin account.
adminAddrBz, err := hex.DecodeString("51B89E89D58FFB3F9DB66263FF10A216CF388A0E")
adminAddrBz, err := hex.DecodeString("35E60D5E2C2EDC43EED911A4F9930CD9E899DE7C")
if err != nil {
panic(err)
}

adminAddr, err := ac.BytesToString(adminAddrBz)
if err != nil {
panic(err)
}

marketGenState.Params.MarketAuthorities = []string{adminAddr}
marketGenState.Params.Admin = adminAddr

var id uint64

// Initialize all markets plus ReservedCPTimestamp
currencyPairGenesis := make([]oracletypes.CurrencyPairGenesis, len(markets)+1)
cp, err := slinkytypes.CurrencyPairFromString(l2slinky.ReservedCPTimestamp)
cp, err := connecttypes.CurrencyPairFromString(l2connect.ReservedCPTimestamp)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion app/genesis_markets/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"

marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
)

// ReadMarketsFromFile reads a market map configuration from a file at the given path.
Expand Down
12 changes: 6 additions & 6 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ import (
auctionkeeper "github.com/skip-mev/block-sdk/v2/x/auction/keeper"
auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types"

// slinky oracle dependencies
// connect oracle dependencies

marketmapkeeper "github.com/skip-mev/slinky/x/marketmap/keeper"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
marketmapkeeper "github.com/skip-mev/connect/v2/x/marketmap/keeper"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
oraclekeeper "github.com/skip-mev/connect/v2/x/oracle/keeper"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"

ophostkeeper "github.com/initia-labs/OPinit/x/ophost/keeper"
ophosttypes "github.com/initia-labs/OPinit/x/ophost/types"
Expand Down Expand Up @@ -144,7 +144,7 @@ type AppKeepers struct {
IBCHooksKeeper *ibchookskeeper.Keeper
AuctionKeeper *auctionkeeper.Keeper // x/auction keeper used to process bids for TOB auctions
OPHostKeeper *ophostkeeper.Keeper
OracleKeeper *oraclekeeper.Keeper // x/oracle keeper used for the slinky oracle
OracleKeeper *oraclekeeper.Keeper // x/oracle keeper used for the connect oracle
MarketMapKeeper *marketmapkeeper.Keeper
ForwardingKeeper *forwardingkeeper.Keeper
RatelimitKeeper *ratelimitkeeper.Keeper
Expand Down
4 changes: 2 additions & 2 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ import (

// skip-mev dependencies
auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"

// noble forwarding keeper
forwardingtypes "github.com/noble-assets/forwarding/v2/x/forwarding/types"
Expand Down
14 changes: 7 additions & 7 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ import (
"github.com/skip-mev/block-sdk/v2/x/auction"
auctiontypes "github.com/skip-mev/block-sdk/v2/x/auction/types"

// slinky oracle dependencies
// connect oracle dependencies

marketmap "github.com/skip-mev/slinky/x/marketmap"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"
"github.com/skip-mev/slinky/x/oracle"
oracletypes "github.com/skip-mev/slinky/x/oracle/types"
marketmap "github.com/skip-mev/connect/v2/x/marketmap"
marketmaptypes "github.com/skip-mev/connect/v2/x/marketmap/types"
"github.com/skip-mev/connect/v2/x/oracle"
oracletypes "github.com/skip-mev/connect/v2/x/oracle/types"

"github.com/initia-labs/OPinit/x/ophost"
ophosttypes "github.com/initia-labs/OPinit/x/ophost/types"
Expand All @@ -101,7 +101,7 @@ var maccPerms = map[string][]string{
// x/auction's module account must be instantiated upon genesis to accrue auction rewards not
// distributed to proposers
auctiontypes.ModuleName: nil,
// slinky oracle permissions
// connect oracle permissions
oracletypes.ModuleName: nil,
marketmaptypes.ModuleName: nil,

Expand Down Expand Up @@ -133,7 +133,7 @@ func appModules(
move.NewAppModule(app.appCodec, *app.MoveKeeper, app.vc, maps.Keys(maccPerms)),
auction.NewAppModule(app.appCodec, *app.AuctionKeeper),
ophost.NewAppModule(app.appCodec, *app.OPHostKeeper),
// slinky modules
// connect modules
oracle.NewAppModule(app.appCodec, *app.OracleKeeper),
marketmap.NewAppModule(app.appCodec, app.MarketMapKeeper),
// ibc modules
Expand Down
2 changes: 1 addition & 1 deletion app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

moveconfig "github.com/initia-labs/initia/x/move/config"

oracleconfig "github.com/skip-mev/slinky/oracle/config"
oracleconfig "github.com/skip-mev/connect/v2/oracle/config"
)

// defaultConsensusParams defines the default Tendermint consensus params used in
Expand Down
4 changes: 2 additions & 2 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@
}
},
{
"url": "./tmp-swagger-gen/slinky/oracle/v1/query.swagger.json"
"url": "./tmp-swagger-gen/connect/oracle/v2/query.swagger.json"
},
{
"url": "./tmp-swagger-gen/slinky/marketmap/v1/query.swagger.json",
"url": "./tmp-swagger-gen/connect/marketmap/v2/query.swagger.json",
"operationIds": {
"rename": {
"Params": "MarketMapParams"
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading

0 comments on commit 624ce30

Please sign in to comment.