Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions chains.yamale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ chain:
id: str()
priority: int()
chain-id: any(int(), str())
chain-ids: map(str(), any(), required=False)
short-names: list(str())
code: str()
grpcId: int()
Expand Down
8 changes: 8 additions & 0 deletions chains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3539,23 +3539,31 @@ chain-settings:
label: Injective
type: cosmos
settings:
method-spec: "cosmos-evm"
expected-block-time: 700ms
lags:
syncing: 40
lagging: 20
chains:
- id: Mainnet
chain-ids:
cosmos: injective-1
eth: 0x6f0
chain-id: injective-1
short-names: [injective, injective-mainnet]
code: INJECTIVE_MAINNET
grpcId: 1134
priority: 100
- id: Testnet
chain-ids:
cosmos: injective-888
eth: 0x59f
chain-id: injective-888
short-names: [injective-testnet]
code: INJECTIVE_TESTNET
grpcId: 10171
priority: 10
net-version: 888
- id: mantra
label: Mantra
type: cosmos
Expand Down
3 changes: 2 additions & 1 deletion docs/method-specs.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ The resulting `eth` spec carries every method declared by `eth-json-rpc` plus ev

The `tron` bundle is the multi-transport example: it composes `tron-json-rpc` (Ethereum-compatible `/jsonrpc`), `tron-rest` (the canonical `/wallet/*` HTTP API), and `tron-rest-solidity` (a `rest-additional` mirror over `/walletsolidity/*` for confirmed-only reads). The resulting `tron` spec carries methods across all three connectors at once.

A bundle can also import other bundles: `astar` is `["eth", "polkadot"]`, because an Astar node serves the EVM RPC and the substrate RPC from the same endpoint. Both halves keep their own behaviour — the eth methods stay cacheable with their tag parsers, the polkadot methods stay `cacheable: false` — and both subscription families end up in the ws `sub` group. Same-level imports may not define the same method name, so this composition only works because the eth and polkadot method sets are disjoint.
A bundle can also import other bundles: `astar` is `["eth", "polkadot"]`, because an Astar node serves the EVM RPC and the substrate RPC from the same endpoint. Both halves keep their own behaviour — the eth methods stay cacheable with their tag parsers, the polkadot methods stay `cacheable: false` — and both subscription families end up in the ws `sub` group. Same-level imports may not define the same method name, so this composition only works because the eth and polkadot method sets are disjoint. `cosmos-evm` is the same shape over `["eth", "cosmos"]`, for Cosmos SDK chains with an EVM module (Injective and the like) whose nodes expose the EVM JSON-RPC alongside the Tendermint RPC, LCD REST and gRPC endpoints. Point any such chain at it via `method-spec: "cosmos-evm"`.

## Shipped specs

Expand All @@ -240,6 +240,7 @@ The `specs` package embeds the specs below (see [`pkg/methods/specs/`](../pkg/me
| `sui` | `sui-grpc` |
| `polkadot` | `polkadot-json-rpc`, `polkadot-websocket` |
| `astar` | `eth`, `polkadot` |
| `cosmos-evm` | `eth`, `cosmos` |

### Plain specs

Expand Down
39 changes: 39 additions & 0 deletions pkg/methods/cosmos_spec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,42 @@ func TestGetGrpcServicesListsAllCosmosServices(t *testing.T) {
"ibc.core.connection.v1.Query",
}, cosmosServices)
}

// Cosmos SDK chains with an EVM module (Injective and the like) serve the EVM
// JSON-RPC next to the Cosmos endpoints, so the cosmos-evm bundle is the union
// of eth and cosmos. Both halves keep their own behaviour.
func TestCosmosEvmBundleCarriesEthAndCosmos(t *testing.T) {
require.NoError(t, specs.NewMethodSpecLoader().Load())

assert.ElementsMatch(t,
[]specs.ApiConnectorType{
specs.JsonRpcConnector,
specs.WebsocketConnector,
specs.TendermintConnector,
specs.RestConnector,
specs.GrpcConnector,
},
specs.GetSpecConnectors("cosmos-evm"),
)

ethMethod := specs.GetSpecMethod("cosmos-evm", "eth_getBalance")
require.NotNil(t, ethMethod)
assert.True(t, ethMethod.IsCacheable())

tendermintMethod := specs.GetSpecMethod("cosmos-evm", "status")
require.NotNil(t, tendermintMethod)
assert.False(t, tendermintMethod.IsCacheable())

assert.NotNil(t, specs.GetSpecMethod("cosmos-evm", "GET#/cosmos/bank/v1beta1/params"))
assert.NotNil(t, specs.GetSpecMethod("cosmos-evm", "/cosmos.bank.v1beta1.Query/Params"))

jsonRPCOnly := specs.GetSpecMethodsByConnectors("cosmos-evm", []specs.ApiConnectorType{specs.JsonRpcConnector})
require.NotNil(t, jsonRPCOnly)
assert.Contains(t, jsonRPCOnly[specs.DefaultMethodGroup], "eth_getBalance")
assert.NotContains(t, jsonRPCOnly[specs.DefaultMethodGroup], "status")

tendermintOnly := specs.GetSpecMethodsByConnectors("cosmos-evm", []specs.ApiConnectorType{specs.TendermintConnector})
require.NotNil(t, tendermintOnly)
assert.Contains(t, tendermintOnly[specs.DefaultMethodGroup], "status")
assert.NotContains(t, tendermintOnly[specs.DefaultMethodGroup], "eth_getBalance")
}
15 changes: 15 additions & 0 deletions pkg/methods/specs/cosmos-evm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"openrpc": "1.0.0",
"info": {
"title": "Cosmos EVM chain methods - Ethereum JSON-RPC and websocket plus Cosmos Tendermint RPC, LCD REST and gRPC",
"version": "1.0.0"
},
"spec": {
"name": "cosmos-evm",
"type": "bundle"
},
"spec-imports": [
"eth",
"cosmos"
]
}
Loading