Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add circuit breaker controller to smartaccount module #8216

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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