Skip to content

Commit

Permalink
fix: add circuit breaker controller to smartaccount module
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddyMc committed May 3, 2024
1 parent 68cba4f commit 0bb45e7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
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 0bb45e7

Please sign in to comment.