-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
refactor(x/auth): Decouple store from auth module #21405
Changes from all commits
060a014
fadb7a9
77e255b
fcf9e67
1eac6e9
839870c
2aded01
4ec51db
9b6e081
9e79102
a080b27
0972bb0
efae512
961a033
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,6 +220,18 @@ func (c Context) WithGasMeter(meter storetypes.GasMeter) Context { | |
return c | ||
} | ||
|
||
// WithNewGasMeter returns a Context with a newly created transaction GasMeter. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. imho we shouldn't add anything to sdk.Context. We want to move away from it. |
||
func (c Context) WithNewGasMeter(gaslimit storetypes.Gas) Context { | ||
c.gasMeter = storetypes.NewGasMeter(gaslimit) | ||
return c | ||
Comment on lines
220
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change potentially affects state. Call sequence:
|
||
} | ||
|
||
// WithNewGasMeter returns a Context with a newly created transaction InfiniteGasMeter. | ||
func (c Context) WithNewInfiniteGasMeter() Context { | ||
c.gasMeter = storetypes.NewInfiniteGasMeter() | ||
return c | ||
} | ||
|
||
// WithBlockGasMeter returns a Context with an updated block GasMeter | ||
func (c Context) WithBlockGasMeter(meter storetypes.GasMeter) Context { | ||
c.blockGasMeter = meter | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package types | ||
|
||
import ( | ||
storetypes "cosmossdk.io/store/types" | ||
) | ||
|
||
// Wrapper errors for store/v1 ErrorOutOfGas, ErrorNegativeGasConsumed and ErrorGasOverflow so that | ||
// modules don't have to import storev1 directly. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather have module import store tan the SDK tbh (my t.wo cents) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmmm if we use stf gas implementation then we can avoid import storetypes ErrorOutOfGas all together (so i dont have to wrapped it here). But then we need to add a wrapper for the legacy sdkCtx gas meter, the problem is that the wrapper is in runtime |
||
|
||
// ErrorNegativeGasConsumed defines an error thrown when the amount of gas refunded results in a | ||
// negative gas consumed amount. | ||
type ErrorNegativeGasConsumed = storetypes.ErrorNegativeGasConsumed | ||
|
||
// ErrorOutOfGas defines an error thrown when an action results in out of gas. | ||
type ErrorOutOfGas = storetypes.ErrorOutOfGas | ||
|
||
// ErrorGasOverflow defines an error thrown when an action results gas consumption | ||
// unsigned integer overflow. | ||
type ErrorGasOverflow = storetypes.ErrorGasOverflow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tac0turtle this is where i think we need a consumed API