Fix compile
This commit is contained in:
parent
56dc2363fa
commit
d911565d0b
|
@ -68,7 +68,7 @@ type BaseApp struct {
|
||||||
|
|
||||||
// spam prevention
|
// spam prevention
|
||||||
minimumFees sdk.Coins
|
minimumFees sdk.Coins
|
||||||
maximumBlockGas int64
|
maximumBlockGas uint64
|
||||||
|
|
||||||
// flag for sealing
|
// flag for sealing
|
||||||
sealed bool
|
sealed bool
|
||||||
|
@ -185,7 +185,7 @@ func (app *BaseApp) initFromStore(mainKey sdk.StoreKey) error {
|
||||||
func (app *BaseApp) SetMinimumFees(fees sdk.Coins) { app.minimumFees = fees }
|
func (app *BaseApp) SetMinimumFees(fees sdk.Coins) { app.minimumFees = fees }
|
||||||
|
|
||||||
// SetMaximumBlockGas sets the maximum gas allowable per block.
|
// SetMaximumBlockGas sets the maximum gas allowable per block.
|
||||||
func (app *BaseApp) SetMaximumBlockGas(gas int64) { app.maximumBlockGas = gas }
|
func (app *BaseApp) SetMaximumBlockGas(gas uint64) { app.maximumBlockGas = gas }
|
||||||
|
|
||||||
// NewContext returns a new Context with the correct store, the given header, and nil txBytes.
|
// NewContext returns a new Context with the correct store, the given header, and nil txBytes.
|
||||||
func (app *BaseApp) NewContext(isCheckTx bool, header abci.Header) sdk.Context {
|
func (app *BaseApp) NewContext(isCheckTx bool, header abci.Header) sdk.Context {
|
||||||
|
|
|
@ -855,7 +855,7 @@ func TestTxGasLimits(t *testing.T) {
|
||||||
|
|
||||||
// Test that transactions exceeding gas limits fail
|
// Test that transactions exceeding gas limits fail
|
||||||
func TestMaxBlockGasLimits(t *testing.T) {
|
func TestMaxBlockGasLimits(t *testing.T) {
|
||||||
gasGranted := int64(10)
|
gasGranted := uint64(10)
|
||||||
anteOpt := func(bapp *BaseApp) {
|
anteOpt := func(bapp *BaseApp) {
|
||||||
bapp.SetAnteHandler(func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, res sdk.Result, abort bool) {
|
bapp.SetAnteHandler(func(ctx sdk.Context, tx sdk.Tx, simulate bool) (newCtx sdk.Context, res sdk.Result, abort bool) {
|
||||||
newCtx = ctx.WithGasMeter(sdk.NewGasMeter(gasGranted))
|
newCtx = ctx.WithGasMeter(sdk.NewGasMeter(gasGranted))
|
||||||
|
@ -880,7 +880,7 @@ func TestMaxBlockGasLimits(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
count := tx.(*txTest).Counter
|
count := tx.(*txTest).Counter
|
||||||
newCtx.GasMeter().ConsumeGas(count, "counter-ante")
|
newCtx.GasMeter().ConsumeGas(uint64(count), "counter-ante")
|
||||||
res = sdk.Result{
|
res = sdk.Result{
|
||||||
GasWanted: gasGranted,
|
GasWanted: gasGranted,
|
||||||
}
|
}
|
||||||
|
@ -892,7 +892,7 @@ func TestMaxBlockGasLimits(t *testing.T) {
|
||||||
routerOpt := func(bapp *BaseApp) {
|
routerOpt := func(bapp *BaseApp) {
|
||||||
bapp.Router().AddRoute(routeMsgCounter, func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
|
bapp.Router().AddRoute(routeMsgCounter, func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
|
||||||
count := msg.(msgCounter).Counter
|
count := msg.(msgCounter).Counter
|
||||||
ctx.GasMeter().ConsumeGas(count, "counter-handler")
|
ctx.GasMeter().ConsumeGas(uint64(count), "counter-handler")
|
||||||
return sdk.Result{}
|
return sdk.Result{}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -903,7 +903,7 @@ func TestMaxBlockGasLimits(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
tx *txTest
|
tx *txTest
|
||||||
numDelivers int
|
numDelivers int
|
||||||
gasUsedPerDeliver int64
|
gasUsedPerDeliver uint64
|
||||||
fail bool
|
fail bool
|
||||||
failAfterDeliver int
|
failAfterDeliver int
|
||||||
}{
|
}{
|
||||||
|
@ -933,12 +933,13 @@ func TestMaxBlockGasLimits(t *testing.T) {
|
||||||
|
|
||||||
// check for failed transactions
|
// check for failed transactions
|
||||||
if tc.fail && (j+1) > tc.failAfterDeliver {
|
if tc.fail && (j+1) > tc.failAfterDeliver {
|
||||||
require.Equal(t, res.Code, sdk.ToABCICode(sdk.CodespaceRoot, sdk.CodeOutOfGas), fmt.Sprintf("%d: %v, %v", i, tc, res))
|
require.Equal(t, res.Code, sdk.CodeOutOfGas, fmt.Sprintf("%d: %v, %v", i, tc, res))
|
||||||
|
require.Equal(t, res.Codespace, sdk.CodespaceRoot, fmt.Sprintf("%d: %v, %v", i, tc, res))
|
||||||
require.True(t, ctx.BlockGasMeter().PastLimit())
|
require.True(t, ctx.BlockGasMeter().PastLimit())
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// check gas used and wanted
|
// check gas used and wanted
|
||||||
expBlockGasUsed := tc.gasUsedPerDeliver * int64(j+1)
|
expBlockGasUsed := tc.gasUsedPerDeliver * uint64(j+1)
|
||||||
require.Equal(t, expBlockGasUsed, blockGasUsed,
|
require.Equal(t, expBlockGasUsed, blockGasUsed,
|
||||||
fmt.Sprintf("%d,%d: %v, %v, %v, %v", i, j, tc, expBlockGasUsed, blockGasUsed, res))
|
fmt.Sprintf("%d,%d: %v, %v, %v, %v", i, j, tc, expBlockGasUsed, blockGasUsed, res))
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ func SetMinimumFees(minFees string) func(*BaseApp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMinimumFees returns an option that sets the minimum fees on the app.
|
// SetMinimumFees returns an option that sets the minimum fees on the app.
|
||||||
func SetMaximumBlockGas(gas int64) func(*BaseApp) {
|
func SetMaximumBlockGas(gas uint64) func(*BaseApp) {
|
||||||
return func(bap *BaseApp) { bap.SetMaximumBlockGas(gas) }
|
return func(bap *BaseApp) { bap.SetMaximumBlockGas(gas) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ func newApp(logger log.Logger, db dbm.DB,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
maxBlockGas := genDoc.ConsensusParams.BlockSize.MaxGas
|
maxBlockGas := uint64(genDoc.ConsensusParams.BlockSize.MaxGas)
|
||||||
|
|
||||||
return app.NewGaiaApp(logger, db, traceStore,
|
return app.NewGaiaApp(logger, db, traceStore,
|
||||||
baseapp.SetPruning(viper.GetString("pruning")),
|
baseapp.SetPruning(viper.GetString("pruning")),
|
||||||
|
|
Loading…
Reference in New Issue