Skip to content

Commit

Permalink
Merge branch 'main' into feat/wasmv2
Browse files Browse the repository at this point in the history
  • Loading branch information
Vritra4 authored May 6, 2024
2 parents 4293ac4 + 07f9eb3 commit 9689c13
Show file tree
Hide file tree
Showing 16 changed files with 416 additions and 92 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ WORKDIR /minitia

COPY --from=go-builder /code/build/minitiad /usr/local/bin/minitiad

# for new-metric setup
COPY --from=go-builder /code/contrib /minitia/contrib

USER minitia

# rest server
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# miniwasm
# MiniWasm

miniwasm is an optimistic rollup consumer chain powered by wasmvm. It is a framework designed to simplify the process of bootstrapping an L2 network. The main advantage of using miniwasm is that you can leverage the OPinit stack for enhanced security and utilize all the initia ecosystem tooling from day one, without the need to prepare a validator group or build your own ecosystem tools.
MiniWasm is an optimistic rollup consumer chain powered by WasmVM, designed to simplify the process of bootstrapping an L2 network. The main advantage of using MiniWasm is that the users can leverage the OPinit stack for enhanced security and utilize all the Initia ecosystem tooling from day one, without the need to prepare a validator group or build the users' own ecosystem tools.

## Prerequisites

- Go v1.22.2+

## Getting Started

To get started with L2, please visit the documentation.
To get started with L2, please visit the [documentation](https://initia.gitbook.io/initia-docs-v2/).

## Features

- Optimistic rollup consumer chain powered by wasmvm.
- Simplified network bootstrapping process.
- No need to prepare a validator group or build your own ecosystem tools.
- Enhanced security through the OPinit stack.
- Access to all initia ecosystem tools from day one.
- Powered by WasmVM, MiniWasm acts as an optimistic rollup consumer chain.
- Simplifies the network bootstrapping process, making it faster and more efficient.
- Eliminates the need for setting up a validator group or creating custom ecosystem tools.
- Integrates seamlessly with the OPinit stack, enhancing security.
- Provides immediate access to the full suite of Initia ecosystem tools right from the start.


## Contributing

Expand Down
22 changes: 18 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"slices"
"strings"

"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
Expand Down Expand Up @@ -156,9 +157,9 @@ import (
indexer "github.com/initia-labs/kvindexer"
indexerconfig "github.com/initia-labs/kvindexer/config"
blocksubmodule "github.com/initia-labs/kvindexer/submodules/block"
pair "github.com/initia-labs/kvindexer/submodules/pair"
tx "github.com/initia-labs/kvindexer/submodules/tx"
nft "github.com/initia-labs/kvindexer/submodules/wasm-nft"
pair "github.com/initia-labs/kvindexer/submodules/wasm-pair"
indexermodule "github.com/initia-labs/kvindexer/x/kvindexer"
indexerkeeper "github.com/initia-labs/kvindexer/x/kvindexer/keeper"

Expand Down Expand Up @@ -975,9 +976,22 @@ func NewMinitiaApp(
}
err = msgservice.ValidateProtoAnnotations(protoFiles)
if err != nil {
// Once we switch to using protoreflect-based antehandlers, we might
// want to panic here instead of logging a warning.
fmt.Fprintln(os.Stderr, err.Error())
errMsg := ""

// ignore injective proto annotations comes from github.com/cosoms/relayer
for _, s := range strings.Split(err.Error(), "\n") {
if strings.Contains(s, "injective") {
continue
}

errMsg += s + "\n"
}

if errMsg != "" {
// Once we switch to using protoreflect-based antehandlers, we might
// want to panic here instead of logging a warning.
fmt.Fprintln(os.Stderr, errMsg)
}
}

// must be before Loading version
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

73 changes: 44 additions & 29 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41293,7 +41293,7 @@ paths:
- Query
/indexer/version:
get:
summary: Version queries all the collections of an account
summary: Version queries all the versions of the submodules
operationId: Versions
responses:
'200':
Expand Down Expand Up @@ -41340,6 +41340,7 @@ paths:
- Query
/indexer/vmtype:
get:
summary: VMType queries the type of the Minitia's VM
operationId: VMType
responses:
'200':
Expand Down Expand Up @@ -41480,13 +41481,15 @@ paths:
type: string
title: >-
actually minitias have no identity because they
haven't MsgCreateValidator, but we decided to keep
this field for compatibility with L1
haven't MsgCreateValidator,

but we decided to keep this field for compatibility
with L1
operator_address:
type: string
title: >-
Proposer represents the proposer of a block: for
minitia, its the L2 operator
minitia, it is the L2 operator
title: Block represents a indexed block in a blockchain
pagination:
description: pagination defines the pagination in the response.
Expand Down Expand Up @@ -41650,15 +41653,17 @@ paths:
type: string
title: >-
actually minitias have no identity because they
haven't MsgCreateValidator, but we decided to keep
this field for compatibility with L1
haven't MsgCreateValidator,

but we decided to keep this field for compatibility
with L1
operator_address:
type: string
title: >-
Proposer represents the proposer of a block: for minitia,
its the L2 operator
it is the L2 operator
title: Block represents a indexed block in a blockchain
description: BlockResponse defines the response for the Blocks RPC.
description: BlockResponse defines the response for the Block RPC.
default:
description: An unexpected error response.
schema:
Expand Down Expand Up @@ -42199,7 +42204,7 @@ paths:
- Query
/indexer/tx/v1/txs/by_account/{account}:
get:
summary: TxsByAccount queries all the collections of given account
summary: TxsByAccount queries all transactions of given account
operationId: TxsByAccount
responses:
'200':
Expand Down Expand Up @@ -42712,7 +42717,7 @@ paths:
- Query
/indexer/tx/v1/txs/by_height/{height}:
get:
summary: TxsByHeight queries all the collections of given height
summary: TxsByHeight queries all transactions of given height
operationId: TxsByHeight
responses:
'200':
Expand Down Expand Up @@ -43722,7 +43727,9 @@ paths:
}
title: >-
QueryCollectionsResponse is the response type for the
Query/Collections RPC method
Query/Collections RPC

method
default:
description: An unexpected error response.
schema:
Expand Down Expand Up @@ -43848,7 +43855,9 @@ paths:
address
title: >-
QueryCollectionResponse is the response type for the
Query/Collection RPC method
Query/Collection RPC

method
default:
description: An unexpected error response.
schema:
Expand Down Expand Up @@ -44208,7 +44217,7 @@ paths:
- Query
/indexer/pair/v1/pairs:
get:
summary: Pairs queries all the collections of an account
summary: Pairs queries all the pairs of L1 and L2
operationId: Pairs
responses:
'200':
Expand Down Expand Up @@ -70446,12 +70455,13 @@ definitions:
type: string
title: >-
actually minitias have no identity because they haven't
MsgCreateValidator, but we decided to keep this field for
compatibility with L1
MsgCreateValidator,

but we decided to keep this field for compatibility with L1
operator_address:
type: string
title: >-
Proposer represents the proposer of a block: for minitia, its the L2
Proposer represents the proposer of a block: for minitia, it is the L2
operator
title: Block represents a indexed block in a blockchain
indexer.block.v1.BlockResponse:
Expand Down Expand Up @@ -70508,15 +70518,16 @@ definitions:
type: string
title: >-
actually minitias have no identity because they haven't
MsgCreateValidator, but we decided to keep this field for
compatibility with L1
MsgCreateValidator,

but we decided to keep this field for compatibility with L1
operator_address:
type: string
title: >-
Proposer represents the proposer of a block: for minitia, its the
L2 operator
Proposer represents the proposer of a block: for minitia, it is
the L2 operator
title: Block represents a indexed block in a blockchain
description: BlockResponse defines the response for the Blocks RPC.
description: BlockResponse defines the response for the Block RPC.
indexer.block.v1.BlocksResponse:
type: object
properties:
Expand Down Expand Up @@ -70573,12 +70584,13 @@ definitions:
type: string
title: >-
actually minitias have no identity because they haven't
MsgCreateValidator, but we decided to keep this field for
compatibility with L1
MsgCreateValidator,

but we decided to keep this field for compatibility with L1
operator_address:
type: string
title: >-
Proposer represents the proposer of a block: for minitia, its
Proposer represents the proposer of a block: for minitia, it is
the L2 operator
title: Block represents a indexed block in a blockchain
pagination:
Expand Down Expand Up @@ -70610,12 +70622,13 @@ definitions:
type: string
title: >-
actually minitias have no identity because they haven't
MsgCreateValidator, but we decided to keep this field for
compatibility with L1
MsgCreateValidator,

but we decided to keep this field for compatibility with L1
operator_address:
type: string
title: >-
Proposer represents the proposer of a block: for minitia, its the L2
Proposer represents the proposer of a block: for minitia, it is the L2
operator
indexer.tx.v1.QueryTxResponse:
type: object
Expand Down Expand Up @@ -71175,7 +71188,7 @@ definitions:
title: TokenHandle is an embedded message for CollectionData
title: Collection is the message for a collection of NFTs
title: IndexedCollection is wrapped Collection with its object address
title: >-
title: |-
QueryCollectionResponse is the response type for the Query/Collection RPC
method
indexer.nft.v1.QueryCollectionsResponse:
Expand Down Expand Up @@ -71237,7 +71250,9 @@ definitions:
}
title: >-
QueryCollectionsResponse is the response type for the Query/Collections
RPC method
RPC

method
indexer.nft.v1.QueryTokensResponse:
type: object
properties:
Expand Down
8 changes: 8 additions & 0 deletions cmd/minitiad/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ func initAppConfig() (string, interface{}) {
// In simapp, we set the min gas prices to 0.
srvCfg.MinGasPrices = fmt.Sprintf("0%s", types.BaseDenom)

// Enable API and unsafe CORS (CORS allowed from any host)
srvCfg.API.Enable = true
srvCfg.API.EnableUnsafeCORS = true
srvCfg.API.Address = "tcp://0.0.0.0:1317"

srvCfg.GRPC.Enable = true
srvCfg.GRPC.Address = "0.0.0.0:9090"

minitiaAppConfig := minitiaAppConfig{
Config: *srvCfg,
WasmConfig: wasmtypes.DefaultWasmConfig(),
Expand Down
4 changes: 4 additions & 0 deletions cmd/minitiad/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func InitCmd(mbm module.BasicManager, defaultNodeHome string) *cobra.Command {
config := serverCtx.Config
config.SetRoot(clientCtx.HomeDir)

// Configure the server to open RPC port to everyone and allow every origins
config.RPC.ListenAddress = "tcp://0.0.0.0:26657"
config.RPC.CORSAllowedOrigins = []string{"*"}

chainID, _ := cmd.Flags().GetString(flags.FlagChainID)
if chainID == "" {
chainID = fmt.Sprintf("test-chain-%v", cometrand.Str(6))
Expand Down
Loading

0 comments on commit 9689c13

Please sign in to comment.