From 5f1aa26b663d60405152bdaffc892ba5dce1a47a Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 12:17:38 -0600 Subject: [PATCH 01/16] manually call Validate on the genesis states --- app/upgrades/v7/upgrades.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index c229cabb..7b512fb5 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -1,6 +1,7 @@ package v7 import ( + "fmt" "time" sdk "github.com/cosmos/cosmos-sdk/types" @@ -136,6 +137,10 @@ func auctionInitGenesis(ctx sdk.Context, auctionKeeper auctionkeeper.Keeper) { &wbtcPrice, } + if err := genesisState.Validate(); err != nil { + panic(fmt.Errorf("auction genesis state invalid: %s", err)) + } + auctionkeeper.InitGenesis(ctx, auctionKeeper, genesisState) } @@ -186,6 +191,10 @@ func axelarcorkInitGenesis(ctx sdk.Context, axelarcorkKeeper axelarcorkkeeper.Ke }, } + if err := genesisState.Validate(); err != nil { + panic(fmt.Errorf("axelarcork genesis state invalid: %s", err)) + } + axelarcorkkeeper.InitGenesis(ctx, axelarcorkKeeper, genesisState) } @@ -268,6 +277,10 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { genesisState.Subscribers = subscribers genesisState.SubscriberIntents = subscriberIntents + if err := genesisState.Validate(); err != nil { + panic(fmt.Errorf("pubsub genesis state invalid: %s", err)) + } + pubsubkeeper.InitGenesis(ctx, pubsubKeeper, genesisState) } From 3fa72fd555f16ba094708ec8d4a3a0f50a02c7f0 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 12:18:40 -0600 Subject: [PATCH 02/16] point to gravity v4.0.0 release --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 6e7653c6..b5ad5ff1 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/miguelmota/go-ethereum-hdwallet v0.1.1 github.com/ory/dockertest/v3 v3.10.0 - github.com/peggyjv/gravity-bridge/module/v4 v4.0.0-20231211214131-bf2a31eb986f + github.com/peggyjv/gravity-bridge/module/v4 v4.0.0 github.com/rakyll/statik v0.1.7 github.com/regen-network/cosmos-proto v0.3.1 github.com/spf13/cast v1.5.0 diff --git a/go.sum b/go.sum index 762108e5..7eb30ae3 100644 --- a/go.sum +++ b/go.sum @@ -846,6 +846,8 @@ github.com/peggyjv/gravity-bridge/module/v4 v4.0.0-20231130211750-e1fa9902c9d9 h github.com/peggyjv/gravity-bridge/module/v4 v4.0.0-20231130211750-e1fa9902c9d9/go.mod h1:biwoVDKWggMYtzuUZOuqaJD8B40XHrXg3zOJjeAhT78= github.com/peggyjv/gravity-bridge/module/v4 v4.0.0-20231211214131-bf2a31eb986f h1:xaVjypGpS3+VUXzEb2YFaTK632Id6jVWY1ViS4nljJs= github.com/peggyjv/gravity-bridge/module/v4 v4.0.0-20231211214131-bf2a31eb986f/go.mod h1:n8Jj3X+w6q0Xz19w8feRRl2sfIGV+3FGU4anzXBQGbA= +github.com/peggyjv/gravity-bridge/module/v4 v4.0.0 h1:jH10FodlMxzGdbxAxeNpsql9qhYDlmwqciwOuwuU0LQ= +github.com/peggyjv/gravity-bridge/module/v4 v4.0.0/go.mod h1:n8Jj3X+w6q0Xz19w8feRRl2sfIGV+3FGU4anzXBQGbA= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= From 56e8218abbd0aa47fecf15ff338b2a898c845bc3 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 12:56:35 -0600 Subject: [PATCH 03/16] fix casing for some cellars, add Turbo EETH --- app/upgrades/v7/upgrades.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index 7b512fb5..5133f131 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -216,8 +216,8 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { "0x7bAD5DF5E11151Dc5Ee1a648800057C5c934c0d5", // Aave V2 "0x03df2A53Cbed19B824347D6a45d09016C2D1676a", // DeFi Stars "0x6c51041A91C91C86f3F08a72cB4D3F67f1208897", // ETH Trend Growth - "0x6b7f87279982d919bbf85182ddeab179b366d8f2", // ETH-BTC Trend - "0x6e2dac3b9e9adc0cbbae2d0b9fd81952a8d33872", // ETH-BTC Momentum + "0x6b7f87279982d919Bbf85182DDeAB179B366D8f2", // ETH-BTC Trend + "0x6E2dAc3b9E9ADc0CbbaE2D0B9Fd81952a8D33872", // ETH-BTC Momentum "0xDBe19d1c3F21b1bB250ca7BDaE0687A97B5f77e6", // Fraximal "0xC7b69E15D86C5c1581dacce3caCaF5b68cd6596F", // Real Yield 1INCH "0x0274a704a6D9129F90A62dDC6f6024b33EcDad36", // Real Yield BTC @@ -230,7 +230,8 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { "0x3F07A84eCdf494310D397d24c1C78B041D2fa622", // Steady ETH "0x4986fD36b6b16f49b43282Ee2e24C5cF90ed166d", // Steady BTC "0x05641a27C82799AaF22b436F20A3110410f29652", // Steady MATIC - "0x6f069f711281618467dae7873541ecc082761b33", // Steady UNI + "0x6F069F711281618467dAe7873541EcC082761B33", // Steady UNI + "0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e", // Turbo EETH "0x0C190DEd9Be5f512Bd72827bdaD4003e9Cc7975C", // Turbo GHO "0x5195222f69c5821f8095ec565E71e18aB6A2298f", // Turbo SOMM "0xc7372Ab5dd315606dB799246E8aA112405abAeFf", // Turbo stETH (stETH deposit) From 141c3cba243e817c49bd430100b86c478ae186ea Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 12:58:27 -0600 Subject: [PATCH 04/16] update slices sizes with new cellar added --- app/upgrades/v7/upgrades.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index 5133f131..f36305f4 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -240,7 +240,7 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { } // Set 7seas publisher intents for existing cellars - publisherIntents := make([]*pubsubtypes.PublisherIntent, 23) + publisherIntents := make([]*pubsubtypes.PublisherIntent, 24) for _, cellar := range cellars { publisherIntents = append(publisherIntents, &pubsubtypes.PublisherIntent{ SubscriptionId: cellar, @@ -251,7 +251,7 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { } // Set default subscriptions for 7seas as the publisher for existing cellars - defaultSubscriptions := make([]*pubsubtypes.DefaultSubscription, 23) + defaultSubscriptions := make([]*pubsubtypes.DefaultSubscription, 24) for _, cellar := range cellars { defaultSubscriptions = append(defaultSubscriptions, &pubsubtypes.DefaultSubscription{ SubscriptionId: cellar, @@ -261,7 +261,7 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { // Create subscribers and intents for existing validators subscribers := createSubscribers() - subscriberIntents := make([]*pubsubtypes.SubscriberIntent, 805) + subscriberIntents := make([]*pubsubtypes.SubscriberIntent, 840) for _, subscriber := range subscribers { for _, cellar := range cellars { subscriberIntents = append(subscriberIntents, &pubsubtypes.SubscriberIntent{ From 5af480a78faf147c2b9cc19bbfe758eeb2f9e890 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 13:01:37 -0600 Subject: [PATCH 05/16] log the ICA host param update --- app/upgrades/v7/upgrades.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index f36305f4..33549697 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -34,6 +34,7 @@ func CreateUpgradeHandler( // Now that we're on IBC V6, we can update the ICA host module to allow all message types rather than // the list we specified in the v6 upgrade -- a default of HostEnabled: true and the string "*" for messages + ctx.Logger().Info("v7 upgrade: setting ICA host params to allow all messages") icaParams := icahosttypes.DefaultParams() icaHostKeeper.SetParams(ctx, icaParams) From ae07718c08c0847971f6b636ea9eb3144d92c069 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 13:08:04 -0600 Subject: [PATCH 06/16] actually validate the minimum USD value parameter --- x/auction/types/params.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/auction/types/params.go b/x/auction/types/params.go index 7338b5f4..c6d35537 100644 --- a/x/auction/types/params.go +++ b/x/auction/types/params.go @@ -54,6 +54,10 @@ func (p *Params) ValidateBasic() error { return err } + if err := validateMinimumSaleTokensUSDValue(p.MinimumSaleTokensUsdValue); err != nil { + return err + } + if err := validateAuctionMaxBlockAge(p.AuctionMaxBlockAge); err != nil { return err } From 52533a2590cf7c733fbe7b03675143c4df5bded7 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 13:09:02 -0600 Subject: [PATCH 07/16] normalize cellars with eth mainnet chain ID prefix --- app/upgrades/v7/upgrades.go | 48 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index 33549697..7f9f4646 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -214,30 +214,30 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { publishers := []*pubsubtypes.Publisher{&publisher} cellars := []string{ - "0x7bAD5DF5E11151Dc5Ee1a648800057C5c934c0d5", // Aave V2 - "0x03df2A53Cbed19B824347D6a45d09016C2D1676a", // DeFi Stars - "0x6c51041A91C91C86f3F08a72cB4D3F67f1208897", // ETH Trend Growth - "0x6b7f87279982d919Bbf85182DDeAB179B366D8f2", // ETH-BTC Trend - "0x6E2dAc3b9E9ADc0CbbaE2D0B9Fd81952a8D33872", // ETH-BTC Momentum - "0xDBe19d1c3F21b1bB250ca7BDaE0687A97B5f77e6", // Fraximal - "0xC7b69E15D86C5c1581dacce3caCaF5b68cd6596F", // Real Yield 1INCH - "0x0274a704a6D9129F90A62dDC6f6024b33EcDad36", // Real Yield BTC - "0x18ea937aba6053bC232d9Ae2C42abE7a8a2Be440", // Real Yield ENS - "0xb5b29320d2Dde5BA5BAFA1EbcD270052070483ec", // Real Yield ETH - "0x4068BDD217a45F8F668EF19F1E3A1f043e4c4934", // Real Yield LINK - "0xcBf2250F33c4161e18D4A2FA47464520Af5216b5", // Real Yield SNX - "0x6A6AF5393DC23D7e3dB28D28Ef422DB7c40932B6", // Real Yield UNI - "0x97e6E0a40a3D02F12d1cEC30ebfbAE04e37C119E", // Real Yield USD - "0x3F07A84eCdf494310D397d24c1C78B041D2fa622", // Steady ETH - "0x4986fD36b6b16f49b43282Ee2e24C5cF90ed166d", // Steady BTC - "0x05641a27C82799AaF22b436F20A3110410f29652", // Steady MATIC - "0x6F069F711281618467dAe7873541EcC082761B33", // Steady UNI - "0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e", // Turbo EETH - "0x0C190DEd9Be5f512Bd72827bdaD4003e9Cc7975C", // Turbo GHO - "0x5195222f69c5821f8095ec565E71e18aB6A2298f", // Turbo SOMM - "0xc7372Ab5dd315606dB799246E8aA112405abAeFf", // Turbo stETH (stETH deposit) - "0xfd6db5011b171B05E1Ea3b92f9EAcaEEb055e971", // Turbo stETH (WETH deposit) - "0xd33dAd974b938744dAC81fE00ac67cb5AA13958E", // Turbo swETH + "1:0x7bAD5DF5E11151Dc5Ee1a648800057C5c934c0d5", // Aave V2 + "1:0x03df2A53Cbed19B824347D6a45d09016C2D1676a", // DeFi Stars + "1:0x6c51041A91C91C86f3F08a72cB4D3F67f1208897", // ETH Trend Growth + "1:0x6b7f87279982d919Bbf85182DDeAB179B366D8f2", // ETH-BTC Trend + "1:0x6E2dAc3b9E9ADc0CbbaE2D0B9Fd81952a8D33872", // ETH-BTC Momentum + "1:0xDBe19d1c3F21b1bB250ca7BDaE0687A97B5f77e6", // Fraximal + "1:0xC7b69E15D86C5c1581dacce3caCaF5b68cd6596F", // Real Yield 1INCH + "1:0x0274a704a6D9129F90A62dDC6f6024b33EcDad36", // Real Yield BTC + "1:0x18ea937aba6053bC232d9Ae2C42abE7a8a2Be440", // Real Yield ENS + "1:0xb5b29320d2Dde5BA5BAFA1EbcD270052070483ec", // Real Yield ETH + "1:0x4068BDD217a45F8F668EF19F1E3A1f043e4c4934", // Real Yield LINK + "1:0xcBf2250F33c4161e18D4A2FA47464520Af5216b5", // Real Yield SNX + "1:0x6A6AF5393DC23D7e3dB28D28Ef422DB7c40932B6", // Real Yield UNI + "1:0x97e6E0a40a3D02F12d1cEC30ebfbAE04e37C119E", // Real Yield USD + "1:0x3F07A84eCdf494310D397d24c1C78B041D2fa622", // Steady ETH + "1:0x4986fD36b6b16f49b43282Ee2e24C5cF90ed166d", // Steady BTC + "1:0x05641a27C82799AaF22b436F20A3110410f29652", // Steady MATIC + "1:0x6F069F711281618467dAe7873541EcC082761B33", // Steady UNI + "1:0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e", // Turbo EETH + "1:0x0C190DEd9Be5f512Bd72827bdaD4003e9Cc7975C", // Turbo GHO + "1:0x5195222f69c5821f8095ec565E71e18aB6A2298f", // Turbo SOMM + "1:0xc7372Ab5dd315606dB799246E8aA112405abAeFf", // Turbo stETH (stETH deposit) + "1:0xfd6db5011b171B05E1Ea3b92f9EAcaEEb055e971", // Turbo stETH (WETH deposit) + "1:0xd33dAd974b938744dAC81fE00ac67cb5AA13958E", // Turbo swETH } // Set 7seas publisher intents for existing cellars From 844f79c7c27fdf2d80d4a651aac94d7643be1425 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 13:12:19 -0600 Subject: [PATCH 08/16] add arbitrum test cellar to pubsub --- app/upgrades/v7/upgrades.go | 55 +++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index 7f9f4646..a6bdfc89 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -214,34 +214,35 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { publishers := []*pubsubtypes.Publisher{&publisher} cellars := []string{ - "1:0x7bAD5DF5E11151Dc5Ee1a648800057C5c934c0d5", // Aave V2 - "1:0x03df2A53Cbed19B824347D6a45d09016C2D1676a", // DeFi Stars - "1:0x6c51041A91C91C86f3F08a72cB4D3F67f1208897", // ETH Trend Growth - "1:0x6b7f87279982d919Bbf85182DDeAB179B366D8f2", // ETH-BTC Trend - "1:0x6E2dAc3b9E9ADc0CbbaE2D0B9Fd81952a8D33872", // ETH-BTC Momentum - "1:0xDBe19d1c3F21b1bB250ca7BDaE0687A97B5f77e6", // Fraximal - "1:0xC7b69E15D86C5c1581dacce3caCaF5b68cd6596F", // Real Yield 1INCH - "1:0x0274a704a6D9129F90A62dDC6f6024b33EcDad36", // Real Yield BTC - "1:0x18ea937aba6053bC232d9Ae2C42abE7a8a2Be440", // Real Yield ENS - "1:0xb5b29320d2Dde5BA5BAFA1EbcD270052070483ec", // Real Yield ETH - "1:0x4068BDD217a45F8F668EF19F1E3A1f043e4c4934", // Real Yield LINK - "1:0xcBf2250F33c4161e18D4A2FA47464520Af5216b5", // Real Yield SNX - "1:0x6A6AF5393DC23D7e3dB28D28Ef422DB7c40932B6", // Real Yield UNI - "1:0x97e6E0a40a3D02F12d1cEC30ebfbAE04e37C119E", // Real Yield USD - "1:0x3F07A84eCdf494310D397d24c1C78B041D2fa622", // Steady ETH - "1:0x4986fD36b6b16f49b43282Ee2e24C5cF90ed166d", // Steady BTC - "1:0x05641a27C82799AaF22b436F20A3110410f29652", // Steady MATIC - "1:0x6F069F711281618467dAe7873541EcC082761B33", // Steady UNI - "1:0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e", // Turbo EETH - "1:0x0C190DEd9Be5f512Bd72827bdaD4003e9Cc7975C", // Turbo GHO - "1:0x5195222f69c5821f8095ec565E71e18aB6A2298f", // Turbo SOMM - "1:0xc7372Ab5dd315606dB799246E8aA112405abAeFf", // Turbo stETH (stETH deposit) - "1:0xfd6db5011b171B05E1Ea3b92f9EAcaEEb055e971", // Turbo stETH (WETH deposit) - "1:0xd33dAd974b938744dAC81fE00ac67cb5AA13958E", // Turbo swETH + "1:0x7bAD5DF5E11151Dc5Ee1a648800057C5c934c0d5", // Aave V2 + "1:0x03df2A53Cbed19B824347D6a45d09016C2D1676a", // DeFi Stars + "1:0x6c51041A91C91C86f3F08a72cB4D3F67f1208897", // ETH Trend Growth + "1:0x6b7f87279982d919Bbf85182DDeAB179B366D8f2", // ETH-BTC Trend + "1:0x6E2dAc3b9E9ADc0CbbaE2D0B9Fd81952a8D33872", // ETH-BTC Momentum + "1:0xDBe19d1c3F21b1bB250ca7BDaE0687A97B5f77e6", // Fraximal + "1:0xC7b69E15D86C5c1581dacce3caCaF5b68cd6596F", // Real Yield 1INCH + "1:0x0274a704a6D9129F90A62dDC6f6024b33EcDad36", // Real Yield BTC + "1:0x18ea937aba6053bC232d9Ae2C42abE7a8a2Be440", // Real Yield ENS + "1:0xb5b29320d2Dde5BA5BAFA1EbcD270052070483ec", // Real Yield ETH + "1:0x4068BDD217a45F8F668EF19F1E3A1f043e4c4934", // Real Yield LINK + "1:0xcBf2250F33c4161e18D4A2FA47464520Af5216b5", // Real Yield SNX + "1:0x6A6AF5393DC23D7e3dB28D28Ef422DB7c40932B6", // Real Yield UNI + "1:0x97e6E0a40a3D02F12d1cEC30ebfbAE04e37C119E", // Real Yield USD + "1:0x3F07A84eCdf494310D397d24c1C78B041D2fa622", // Steady ETH + "1:0x4986fD36b6b16f49b43282Ee2e24C5cF90ed166d", // Steady BTC + "1:0x05641a27C82799AaF22b436F20A3110410f29652", // Steady MATIC + "1:0x6F069F711281618467dAe7873541EcC082761B33", // Steady UNI + "1:0x9a7b4980C6F0FCaa50CD5f288Ad7038f434c692e", // Turbo EETH + "1:0x0C190DEd9Be5f512Bd72827bdaD4003e9Cc7975C", // Turbo GHO + "1:0x5195222f69c5821f8095ec565E71e18aB6A2298f", // Turbo SOMM + "1:0xc7372Ab5dd315606dB799246E8aA112405abAeFf", // Turbo stETH (stETH deposit) + "1:0xfd6db5011b171B05E1Ea3b92f9EAcaEEb055e971", // Turbo stETH (WETH deposit) + "1:0xd33dAd974b938744dAC81fE00ac67cb5AA13958E", // Turbo swETH + "42161:0x438087f7c226A89762a791F187d7c3D4a0e95ae6", // Arbitrum test cellar } // Set 7seas publisher intents for existing cellars - publisherIntents := make([]*pubsubtypes.PublisherIntent, 24) + publisherIntents := make([]*pubsubtypes.PublisherIntent, 25) for _, cellar := range cellars { publisherIntents = append(publisherIntents, &pubsubtypes.PublisherIntent{ SubscriptionId: cellar, @@ -252,7 +253,7 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { } // Set default subscriptions for 7seas as the publisher for existing cellars - defaultSubscriptions := make([]*pubsubtypes.DefaultSubscription, 24) + defaultSubscriptions := make([]*pubsubtypes.DefaultSubscription, 25) for _, cellar := range cellars { defaultSubscriptions = append(defaultSubscriptions, &pubsubtypes.DefaultSubscription{ SubscriptionId: cellar, @@ -262,7 +263,7 @@ func pubsubInitGenesis(ctx sdk.Context, pubsubKeeper pubsubkeeper.Keeper) { // Create subscribers and intents for existing validators subscribers := createSubscribers() - subscriberIntents := make([]*pubsubtypes.SubscriberIntent, 840) + subscriberIntents := make([]*pubsubtypes.SubscriberIntent, 875) for _, subscriber := range subscribers { for _, cellar := range cellars { subscriberIntents = append(subscriberIntents, &pubsubtypes.SubscriberIntent{ From 6f6497efb776ff238e35d5117cdfc26a353846c5 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 13:51:23 -0600 Subject: [PATCH 09/16] Add test arbitrum cellar to axelarcork --- app/upgrades/v7/upgrades.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index a6bdfc89..c69062d3 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -192,6 +192,30 @@ func axelarcorkInitGenesis(ctx sdk.Context, axelarcorkKeeper axelarcorkkeeper.Ke }, } + // InitGenesis reads through each chain configuration in order and sets the cellar ID set + // for it based on index, so this list must be of the same size and order as the respective + // chain configurations above + genesisState.CellarIds = []*axelarcorktypes.CellarIDSet{ + { + Ids: []string{"0x438087f7c226A89762a791F187d7c3D4a0e95ae6"}, + }, + { + Ids: []string{}, + }, + { + Ids: []string{}, + }, + { + Ids: []string{}, + }, + { + Ids: []string{}, + }, + { + Ids: []string{}, + }, + } + if err := genesisState.Validate(); err != nil { panic(fmt.Errorf("axelarcork genesis state invalid: %s", err)) } From be6aebe3c32a4244ccd41abdd51131b1ed17594d Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 14:27:27 -0600 Subject: [PATCH 10/16] some comments --- app/upgrades/v7/upgrades.go | 3 +-- x/auction/keeper/keeper.go | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index c69062d3..2c769364 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -50,7 +50,6 @@ func CreateUpgradeHandler( ctx.Logger().Info("v7 upgrading: setting cellarfees default params") cellarfeesKeeper.SetParams(ctx, cellarfeestypes.DefaultParams()) - //TODO(bolten): verify that the default params are fine or if we need to customize them for auction and pubsub ctx.Logger().Info("v7 upgrade: initializing auction genesis state") auctionInitGenesis(ctx, auctionKeeper) @@ -197,7 +196,7 @@ func axelarcorkInitGenesis(ctx sdk.Context, axelarcorkKeeper axelarcorkkeeper.Ke // chain configurations above genesisState.CellarIds = []*axelarcorktypes.CellarIDSet{ { - Ids: []string{"0x438087f7c226A89762a791F187d7c3D4a0e95ae6"}, + Ids: []string{"0x438087f7c226A89762a791F187d7c3D4a0e95ae6"}, // arbitrum test cellar }, { Ids: []string{}, diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index 49edb1de..b3390f78 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -224,6 +224,8 @@ func (k Keeper) BeginAuction(ctx sdk.Context, // determine how many usomm each sale token min unit costs saleTokenPriceInUsomm := saleTokenMinUnitValue.Quo(usommMinUnitValue) + // TODO(bolten): we are not inspecting the MinimumSaleTokensUsdValue param and using it -- implement later? + auctionID := k.GetLastAuctionID(ctx) + 1 auction := types.Auction{ Id: auctionID, From 67380d1fbc1a3c4df14bcfea86cf84056c278d96 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 14:39:21 -0600 Subject: [PATCH 11/16] loosen ProofURL validation --- x/pubsub/types/proposal.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x/pubsub/types/proposal.go b/x/pubsub/types/proposal.go index a073f70f..9ef92104 100644 --- a/x/pubsub/types/proposal.go +++ b/x/pubsub/types/proposal.go @@ -90,9 +90,10 @@ func ValidateProofURL(proofURL string, domain string, address string) error { return err } - validProofURL := fmt.Sprintf("https://%s/%s/cacert.pem", domain, address) - if proofURL != validProofURL { - return fmt.Errorf("invalid proof URL format, should be: %s", validProofURL) + validProofURL := fmt.Sprintf("%s/%s/cacert.pem", domain, address) + validProofURLWithHttps := fmt.Sprintf("https://%s", validProofURL) + if proofURL != validProofURL && proofURL != validProofURLWithHttps { + return fmt.Errorf("invalid proof URL format, should be: %s", validProofURLWithHttps) } return nil From 76dd34fb6456d820be0cf01e738e82790e64c597 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 14:42:49 -0600 Subject: [PATCH 12/16] fix auction params test --- x/auction/types/params_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/auction/types/params_test.go b/x/auction/types/params_test.go index e60abf87..cc28c74f 100644 --- a/x/auction/types/params_test.go +++ b/x/auction/types/params_test.go @@ -26,6 +26,7 @@ func TestParamsValidate(t *testing.T) { params: Params{ PriceMaxBlockAge: uint64(1000), MinimumBidInUsomm: uint64(500), + MinimumSaleTokensUsdValue: sdk.MustNewDecFromStr("1.0"), AuctionMaxBlockAge: uint64(100), AuctionPriceDecreaseAccelerationRate: sdk.MustNewDecFromStr("0.1"), }, @@ -37,6 +38,7 @@ func TestParamsValidate(t *testing.T) { params: Params{ PriceMaxBlockAge: uint64(0), MinimumBidInUsomm: uint64(500), + MinimumSaleTokensUsdValue: sdk.MustNewDecFromStr("1.0"), AuctionMaxBlockAge: uint64(100), AuctionPriceDecreaseAccelerationRate: sdk.MustNewDecFromStr("0.1"), }, @@ -48,6 +50,7 @@ func TestParamsValidate(t *testing.T) { params: Params{ PriceMaxBlockAge: uint64(1000), MinimumBidInUsomm: uint64(500), + MinimumSaleTokensUsdValue: sdk.MustNewDecFromStr("1.0"), AuctionMaxBlockAge: uint64(100), AuctionPriceDecreaseAccelerationRate: sdk.MustNewDecFromStr("-0.01"), }, @@ -59,6 +62,7 @@ func TestParamsValidate(t *testing.T) { params: Params{ PriceMaxBlockAge: uint64(1000), MinimumBidInUsomm: uint64(500), + MinimumSaleTokensUsdValue: sdk.MustNewDecFromStr("1.0"), AuctionMaxBlockAge: uint64(100), AuctionPriceDecreaseAccelerationRate: sdk.MustNewDecFromStr("1.1"), }, From a867b7f6e1c83bb64b36a8835600eb8ee9655106 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 14:55:11 -0600 Subject: [PATCH 13/16] set LastUpdatedBlock for token prices in v7 upgrade --- app/upgrades/v7/upgrades.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/upgrades/v7/upgrades.go b/app/upgrades/v7/upgrades.go index 2c769364..e87c352f 100644 --- a/app/upgrades/v7/upgrades.go +++ b/app/upgrades/v7/upgrades.go @@ -73,8 +73,8 @@ func auctionInitGenesis(ctx sdk.Context, auctionKeeper auctionkeeper.Keeper) { btc52WeekHigh := sdk.MustNewDecFromStr("44202.18") oneDollar := sdk.MustNewDecFromStr("1.0") - // TODO(bolten): update LastUpdatedBlock to the upgrade height when finalized - var lastUpdatedBlock uint64 = 1 + // Setting this to a block on 12/14/23 -- just means token price will get stale 4 days faster post-upgrade + var lastUpdatedBlock uint64 = 12187266 usommPrice := auctiontypes.TokenPrice{ Denom: "usomm", From fc3b6753883f7cf58989e718d40f9d282c1b1771 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 14:59:12 -0600 Subject: [PATCH 14/16] ledger support for cork --- x/cork/types/codec.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/x/cork/types/codec.go b/x/cork/types/codec.go index 4665a007..37661eeb 100644 --- a/x/cork/types/codec.go +++ b/x/cork/types/codec.go @@ -1,12 +1,36 @@ package types import ( + "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) +// RegisterLegacyAminoCodec registers the vesting interfaces and concrete types on the +// provided LegacyAmino codec. These types are used for Amino JSON serialization +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgScheduleCorkRequest{}, "cork/MsgScheduleCorkRequest", nil) +} + +var ( + amino = codec.NewLegacyAmino() + // ModuleCdc Note, the codec should ONLY be used in certain instances of tests and for + // JSON encoding as Amino is still used for that purpose. + // + // The actual codec used for serialization should be provided to x/staking and + // defined at the application level. + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + // RegisterInterfaces registers the cork proto files func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations( From e214bdfebb00c489a1263862e4623f1d62fddaee Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 15:21:23 -0600 Subject: [PATCH 15/16] GetSignBytes for cork --- x/cork/types/msgs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/cork/types/msgs.go b/x/cork/types/msgs.go index 56eca780..2bb8e5d2 100644 --- a/x/cork/types/msgs.go +++ b/x/cork/types/msgs.go @@ -49,7 +49,7 @@ func (m *MsgScheduleCorkRequest) ValidateBasic() error { // GetSignBytes implements sdk.Msg func (m *MsgScheduleCorkRequest) GetSignBytes() []byte { - panic("amino support disabled") + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) } // GetSigners implements sdk.Msg From 0dcd33174fd29bec99a2c9873edc81382fc328c2 Mon Sep 17 00:00:00 2001 From: Eric Bolten Date: Thu, 14 Dec 2023 15:24:10 -0600 Subject: [PATCH 16/16] appease linter --- x/pubsub/types/proposal.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x/pubsub/types/proposal.go b/x/pubsub/types/proposal.go index 9ef92104..89bb990e 100644 --- a/x/pubsub/types/proposal.go +++ b/x/pubsub/types/proposal.go @@ -91,9 +91,9 @@ func ValidateProofURL(proofURL string, domain string, address string) error { } validProofURL := fmt.Sprintf("%s/%s/cacert.pem", domain, address) - validProofURLWithHttps := fmt.Sprintf("https://%s", validProofURL) - if proofURL != validProofURL && proofURL != validProofURLWithHttps { - return fmt.Errorf("invalid proof URL format, should be: %s", validProofURLWithHttps) + validProofURLWithHTTPS := fmt.Sprintf("https://%s", validProofURL) + if proofURL != validProofURL && proofURL != validProofURLWithHTTPS { + return fmt.Errorf("invalid proof URL format, should be: %s", validProofURLWithHTTPS) } return nil