Skip to content

Commit

Permalink
fix: add circuit breaker controller to smartaccount module (#8216)
Browse files Browse the repository at this point in the history
* fix: add circuit breaker controller to smartaccount module

* chore: adding changelog

(cherry picked from commit f322111)
  • Loading branch information
PaddyMc authored and mergify[bot] committed May 3, 2024
1 parent 6cb6692 commit 55c7591
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions app/upgrades/v25/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
5 changes: 3 additions & 2 deletions app/upgrades/v25/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions app/upgrades/v25/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 55c7591

Please sign in to comment.