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
Show file tree
Hide file tree
Changes from 14 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
9 changes: 2 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ on:
- "**.go"
- "go.mod"
- "go.sum"
pull_request:
branches:
- "main"
paths:
- "**.go"
- "go.mod"
- "go.sum"

env:
REGISTRY: ghcr.io
Expand Down Expand Up @@ -64,3 +57,5 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha
env:
VERSION: ${{ github.ref_name }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASMVM_VERSION}/li
RUN cp /lib/libwasmvm_muslc.`uname -m`.a /lib/libwasmvm_muslc.a

# force it to use static lib (from above) not standard libwasmvm.so file
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS="-linkmode=external -extldflags \"-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static\"" make build
RUN VERSION=${VERSION} LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS="-linkmode=external -extldflags \"-L/code/mimalloc/build -lmimalloc -Wl,-z,muldefs -static\"" make build

FROM alpine:3.18

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apt install -y vim
WORKDIR /code
COPY . /code/

RUN LEDGER_ENABLED=false make build
RUN VERSION=${VERSION} LEDGER_ENABLED=false make build

RUN cp /go/pkg/mod/github.com/\!cosm\!wasm/wasmvm/v2@v*/internal/api/libwasmvm.`uname -m`.so /lib/libwasmvm.so

Expand Down
131 changes: 66 additions & 65 deletions api/miniwasm/tokenfactory/v1/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,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 @@ -493,6 +495,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 500 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L498-L500

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

Expand Down Expand Up @@ -520,6 +525,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 532 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L528-L532

Added lines #L528 - L532 were not covered by tests
}

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

Check warning on line 535 in app/app.go

View check run for this annotation

Codecov / codecov/patch

app/app.go#L535

Added line #L535 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 @@ -121,6 +121,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
4 changes: 2 additions & 2 deletions app/ibc-hooks/receive.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (h WasmHooks) onRecvIcs20Packet(
data transfertypes.FungibleTokenPacketData,
) ibcexported.Acknowledgement {
isWasmRouted, hookData, err := validateAndParseMemo(data.GetMemo())
if !isWasmRouted || hookData.Message == nil {
if !isWasmRouted || (err == nil && hookData.Message == nil) {
return im.App.OnRecvPacket(ctx, packet, relayer)
} else if err != nil {
return newEmitErrorAcknowledgement(err)
Expand Down Expand Up @@ -91,7 +91,7 @@ func (h WasmHooks) onRecvIcs721Packet(
data nfttransfertypes.NonFungibleTokenPacketData,
) ibcexported.Acknowledgement {
isWasmRouted, hookData, err := validateAndParseMemo(data.GetMemo())
if !isWasmRouted || hookData.Message == nil {
if !isWasmRouted || (err == nil && hookData.Message == nil) {
return im.App.OnRecvPacket(ctx, packet, relayer)
} else if err != nil {
return newEmitErrorAcknowledgement(err)
Expand Down
2 changes: 0 additions & 2 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ func NewAppKeeper(
appKeepers.keys[packetforwardtypes.StoreKey],
appKeepers.TransferKeeper,
appKeepers.IBCKeeper.ChannelKeeper,
communityPoolKeeper,
appKeepers.BankKeeper,
// ics4wrapper: transfer -> packet forward -> rate limit
rateLimitKeeper,
Expand All @@ -410,7 +409,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 @@ -10,7 +10,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 @@ -32,7 +32,7 @@
}
}

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

Check warning on line 35 in app/upgrade.go

View check run for this annotation

Codecov / codecov/patch

app/upgrade.go#L35

Added line #L35 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.

Loading
Loading