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

feat: upgrades + audit fixes #97

Merged
merged 15 commits into from
Mar 5, 2025
Merged
13 changes: 13 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@

// local imports
"github.com/initia-labs/miniwasm/app/keepers"
"github.com/skip-mev/block-sdk/v2/block"
blockservice "github.com/skip-mev/block-sdk/v2/block/service"

// kvindexer
kvindexermodule "github.com/initia-labs/kvindexer/x/kvindexer"
Expand Down Expand Up @@ -492,6 +494,9 @@
// Register node gRPC service for grpc-gateway.
nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// Register the Block SDK mempool API routes.
blockservice.RegisterGRPCGatewayRoutes(apiSvr.ClientCtx, apiSvr.GRPCGatewayRouter)

Check warning on line 499 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L497-L499

Added lines #L497 - L499 were not covered by tests
// Register grpc-gateway routes for all modules.
app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

Expand Down Expand Up @@ -519,6 +524,14 @@
app.BaseApp.GRPCQueryRouter(), clientCtx,
app.Simulate, app.interfaceRegistry,
)

// Register the Block SDK mempool transaction service.
mempool, ok := app.Mempool().(block.Mempool)
if !ok {
panic("mempool is not a block.Mempool")

Check warning on line 531 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L527-L531

Added lines #L527 - L531 were not covered by tests
}

blockservice.RegisterMempoolService(app.GRPCQueryRouter(), mempool)

Check warning on line 534 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L534

Added line #L534 was not covered by tests
}

// RegisterTendermintService implements the Application.RegisterTendermintService method.
Expand Down
1 change: 1 addition & 0 deletions app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (genState GenesisState) ConfigureMinGasPrices(cdc codec.JSONCodec) GenesisS
var opChildGenState opchildtypes.GenesisState
cdc.MustUnmarshalJSON(genState[opchildtypes.ModuleName], &opChildGenState)
opChildGenState.Params.MinGasPrices = nil
opChildGenState.Params.HookMaxGas = 3_000_000
genState[opchildtypes.ModuleName] = cdc.MustMarshalJSON(&opChildGenState)

return genState
Expand Down
2 changes: 0 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ func NewAppKeeper(
appKeepers.keys[packetforwardtypes.StoreKey],
appKeepers.TransferKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
communityPoolKeeper,
appKeepers.BankKeeper,
// ics4wrapper: transfer -> packet forward -> rate limit
rateLimitKeeper,
Expand All @@ -409,7 +408,6 @@ func NewAppKeeper(
appKeepers.PacketForwardKeeper,
0,
packetforwardkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)

// create the rate limit keeper
Expand Down
4 changes: 2 additions & 2 deletions app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
opchildtypes "github.com/initia-labs/OPinit/x/opchild/types"
)

const upgradeName = "0.6.4"
const upgradeName = "0.7.1"

// RegisterUpgradeHandlers returns upgrade handlers
func (app *MinitiaApp) RegisterUpgradeHandlers(cfg module.Configurator) {
Expand All @@ -31,7 +31,7 @@
}
}

return vm, nil
return app.ModuleManager.RunMigrations(ctx, cfg, vm)

Check warning on line 34 in app/upgrade.go

View check run for this annotation

Codecov / codecov/patch

app/upgrade.go#L34

Added line #L34 was not covered by tests
},
)
}
11 changes: 11 additions & 0 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,17 @@
"Params": "MarketMapParams"
}
}
},
{
"url": "./tmp-swagger-gen/sdk/auction/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "AuctionParams"
}
}
},
{
"url": "./tmp-swagger-gen/sdk/mempool/v1/query.swagger.json"
}
]
}
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

280 changes: 280 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46966,6 +46966,153 @@ paths:
format: byte
tags:
- Query
/block-sdk/auction/v1/params:
get:
summary: Params queries the parameters of the x/auction module.
operationId: AuctionParams
responses:
'200':
description: A successful response.
schema:
type: object
properties:
params:
description: Params defines the parameters of the module.
type: object
properties:
max_bundle_size:
type: integer
format: int64
description: >-
max_bundle_size is the maximum number of transactions that
can be bundled

in a single bundle.
escrow_account_address:
type: string
format: byte
description: >-
escrow_account_address is the address of the account that
will receive a

portion of the bid proceeds.
reserve_fee:
description: reserve_fee specifies the bid floor for the auction.
type: object
properties:
denom:
type: string
amount:
type: string
min_bid_increment:
description: >-
min_bid_increment specifies the minimum amount that the
next bid must be

greater than the previous bid.
type: object
properties:
denom:
type: string
amount:
type: string
front_running_protection:
type: boolean
description: >-
front_running_protection specifies whether front running
and sandwich

attack protection is enabled.
proposer_fee:
type: string
description: >-
proposer_fee defines the portion of the winning bid that
goes to the block

proposer that proposed the block.
escrow_address_string:
type: string
description: >-
EscrowAddressString is the string representation of the escrow
address stored

in params.
description: >-
QueryParamsResponse is the response type for the Query/Params RPC
method.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Query
/block-sdk/mempool/v1/distribution:
get:
summary: >-
GetTxDistribution returns the distribution of transactions in the
mempool.
operationId: GetTxDistribution
responses:
'200':
description: A successful response.
schema:
type: object
properties:
distribution:
type: object
additionalProperties:
type: string
format: uint64
description: >-
Distribution is a map of lane to the number of transactions in
the mempool for that lane.
description: >-
GetTxDistributionResponse is the response type for the
Service.GetTxDistribution

RPC method.
default:
description: An unexpected error response.
schema:
type: object
properties:
error:
type: string
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
type_url:
type: string
value:
type: string
format: byte
tags:
- Service
definitions:
cosmos.auth.v1beta1.AddressBytesToStringResponse:
type: object
Expand Down Expand Up @@ -75560,3 +75707,136 @@ definitions:
feed is scaled to a number of decimal places and has a minimum number of

providers required to consider the ticker valid.
sdk.auction.v1.Params:
type: object
properties:
max_bundle_size:
type: integer
format: int64
description: >-
max_bundle_size is the maximum number of transactions that can be
bundled

in a single bundle.
escrow_account_address:
type: string
format: byte
description: >-
escrow_account_address is the address of the account that will receive
a

portion of the bid proceeds.
reserve_fee:
description: reserve_fee specifies the bid floor for the auction.
type: object
properties:
denom:
type: string
amount:
type: string
min_bid_increment:
description: >-
min_bid_increment specifies the minimum amount that the next bid must
be

greater than the previous bid.
type: object
properties:
denom:
type: string
amount:
type: string
front_running_protection:
type: boolean
description: |-
front_running_protection specifies whether front running and sandwich
attack protection is enabled.
proposer_fee:
type: string
description: >-
proposer_fee defines the portion of the winning bid that goes to the
block

proposer that proposed the block.
description: Params defines the parameters of the x/auction module.
sdk.auction.v1.QueryParamsResponse:
type: object
properties:
params:
description: Params defines the parameters of the module.
type: object
properties:
max_bundle_size:
type: integer
format: int64
description: >-
max_bundle_size is the maximum number of transactions that can be
bundled

in a single bundle.
escrow_account_address:
type: string
format: byte
description: >-
escrow_account_address is the address of the account that will
receive a

portion of the bid proceeds.
reserve_fee:
description: reserve_fee specifies the bid floor for the auction.
type: object
properties:
denom:
type: string
amount:
type: string
min_bid_increment:
description: >-
min_bid_increment specifies the minimum amount that the next bid
must be

greater than the previous bid.
type: object
properties:
denom:
type: string
amount:
type: string
front_running_protection:
type: boolean
description: >-
front_running_protection specifies whether front running and
sandwich

attack protection is enabled.
proposer_fee:
type: string
description: >-
proposer_fee defines the portion of the winning bid that goes to
the block

proposer that proposed the block.
escrow_address_string:
type: string
description: >-
EscrowAddressString is the string representation of the escrow address
stored

in params.
description: QueryParamsResponse is the response type for the Query/Params RPC method.
sdk.mempool.v1.GetTxDistributionResponse:
type: object
properties:
distribution:
type: object
additionalProperties:
type: string
format: uint64
description: >-
Distribution is a map of lane to the number of transactions in the
mempool for that lane.
description: >-
GetTxDistributionResponse is the response type for the
Service.GetTxDistribution

RPC method.
Loading
Loading