From 0bb45e7061d1317518ad891455e99c30c6ba1eec Mon Sep 17 00:00:00 2001 From: PaddyMc Date: Fri, 3 May 2024 11:57:44 +0100 Subject: [PATCH 1/2] fix: add circuit breaker controller to smartaccount module --- app/upgrades/v25/constants.go | 10 ++++++++++ app/upgrades/v25/upgrades.go | 5 +++-- app/upgrades/v25/upgrades_test.go | 9 +++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/upgrades/v25/constants.go b/app/upgrades/v25/constants.go index 02f3dce9349..2438a077e9d 100644 --- a/app/upgrades/v25/constants.go +++ b/app/upgrades/v25/constants.go @@ -22,6 +22,16 @@ const ( NewMaxAgeNumBlocks = int64(1_000_000) // 1.5s blocks * 1_000_000 = 1.5M seconds > 2 weeks NewMaxAgeDuration = time.Second * 1209600 // 2 weeks + + // MaximumUnauthenticatedGas for smart account transactions to verify the fee payer + MaximumUnauthenticatedGas = uint64(120_000) + + // IsSmartAccountActive is used for the smart account circuit breaker, smartaccounts are deactivated for v25 + IsSmartAccountActive = false + + // CircuitBreakerController is a DAODAO address, used only to deactivate the smart account module + // https://daodao.zone/dao/osmo1wn58hxkv0869ua7qmz3gvek3sz773l89a778fjqvenl6anwuhgnq6ks7kl/home + CircuitBreakerController = "osmo1wn58hxkv0869ua7qmz3gvek3sz773l89a778fjqvenl6anwuhgnq6ks7kl" ) var Upgrade = upgrades.Upgrade{ diff --git a/app/upgrades/v25/upgrades.go b/app/upgrades/v25/upgrades.go index 60428a8970d..fd84b11bd9d 100644 --- a/app/upgrades/v25/upgrades.go +++ b/app/upgrades/v25/upgrades.go @@ -88,8 +88,9 @@ func CreateUpgradeHandler( // Set the authenticator params in the store authenticatorParams := keepers.SmartAccountKeeper.GetParams(ctx) - authenticatorParams.MaximumUnauthenticatedGas = 120_000 - authenticatorParams.IsSmartAccountActive = false + authenticatorParams.MaximumUnauthenticatedGas = MaximumUnauthenticatedGas + authenticatorParams.IsSmartAccountActive = IsSmartAccountActive + authenticatorParams.CircuitBreakerControllers = append(authenticatorParams.CircuitBreakerControllers, CircuitBreakerController) keepers.SmartAccountKeeper.SetParams(ctx, authenticatorParams) // Update consensus params in order to safely enable comet pruning diff --git a/app/upgrades/v25/upgrades_test.go b/app/upgrades/v25/upgrades_test.go index 92b99a920c3..a49c0f7d5ec 100644 --- a/app/upgrades/v25/upgrades_test.go +++ b/app/upgrades/v25/upgrades_test.go @@ -77,6 +77,15 @@ func (s *UpgradeTestSuite) TestUpgrade() { s.Require().Equal(params.FrontRunningProtection, v25.AuctionParams.FrontRunningProtection) s.Require().Equal(params.ProposerFee, v25.AuctionParams.ProposerFee) + // Get smartaccount params + smartAccountParams := s.App.SmartAccountKeeper.GetParams(s.Ctx) + s.Require().NoError(err) + + // Check smartaccount params + s.Require().Equal(smartAccountParams.IsSmartAccountActive, v25.IsSmartAccountActive) + s.Require().Equal(smartAccountParams.MaximumUnauthenticatedGas, v25.MaximumUnauthenticatedGas) + s.Require().Equal(smartAccountParams.CircuitBreakerControllers[0], v25.CircuitBreakerController) + // Check consensus params after upgrade consParamsPost, err := s.App.ConsensusParamsKeeper.Get(s.Ctx) s.Require().NoError(err) From 68a5ae65b6ae176234cfa796ac2cd9a1fc47082e Mon Sep 17 00:00:00 2001 From: PaddyMc Date: Fri, 3 May 2024 12:03:48 +0100 Subject: [PATCH 2/2] chore: adding changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dae64d22a4..1985ad046ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * [#8157](https://github.com/osmosis-labs/osmosis/pull/8157) Speedup protorev by not unmarshalling pools in cost-estimation phase * [#8177](https://github.com/osmosis-labs/osmosis/pull/8177) Change consensus params to match unbonding period * [#8189](https://github.com/osmosis-labs/osmosis/pull/8189) Perf: Use local cache for isSmartAccountActive param +* [#8216](https://github.com/osmosis-labs/osmosis/pull/8216) Chore: Add circuit breaker controller to smart account params ### State Compatible