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

Chore: ics v6 #8

Closed
wants to merge 9 commits into from
Closed
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: 0 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
[submodule "neutron"]
path = protos/neutron-src
url = [email protected]:neutron-org/neutron.git
branch = feat/choose-cron-blocker-2
[submodule "slinky"]
path = protos/slinky-src
url = [email protected]:skip-mev/slinky.git
Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Cosmjs types for users of Neutron chain.

https://www.neutron.org/
<https://www.neutron.org/>

Version of this package is synced with Neutron chain version.

Expand All @@ -20,11 +20,23 @@ git submodule update --init --recursive

# Install dependencies
npm install

# Set specified versions for submodules
npm run set-versions
```

### Rebuilding types

```sh
npm run codegen # Generate .ts files into ./src
npm run build # Build .js/.d.ts files
# Generate .ts files into ./src
npm run codegen

# Build .js/.d.ts files
npm run build
```

### Removing all unnecessary folders and files

```sh
npm run clean
```
8 changes: 4 additions & 4 deletions json-safe.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3
* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.0
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
export type JsonSafe<T> = {
[Prop in keyof T]: T[Prop] extends Uint8Array | bigint | Date ? string : T[Prop];
};
export type JsonSafe<T> = T extends Uint8Array | bigint | Date ? string : T extends Array<infer U> ? Array<JsonSafe<U>> : T extends object ? {
[K in keyof T]: JsonSafe<T[K]>;
} : T;
2 changes: 1 addition & 1 deletion json-safe.js

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

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"neutron/",
"osmosis/",
"sdk/",
"slinky/",
"connect/",
"tendermint/",
"/binary.*",
"/helpers.*",
Expand All @@ -37,14 +37,15 @@
"!cosmos-sdk-*/**/*.md"
],
"scripts": {
"set-versions": "./scripts/set-versions.sh",
"format": "prettier --write --log-level warn \"./src/**/*.ts\" \"./scripts/**/*.js\"",
"precodegen": "./scripts/exports_protos.sh",
"codegen": "rm -rf ./src && ./scripts/codegen.js && cp -rf copypaste_files/* ./src/ && npm run format",
"prepare-publishing": "./scripts/prepare-publishing.sh",
"build": "rm -rf ./build && tsc && npm run prepare-publishing"
},
"dependencies": {
"build": "rm -rf ./build && tsc && npm run prepare-publishing",
"clean": "./scripts/clean.sh"
},
"dependencies": {},
"devDependencies": {
"@cosmology/telescope": "^1.5.4",
"@types/node": "^15.6.2",
Expand Down
2 changes: 1 addition & 1 deletion protos/block-sdk-src
2 changes: 1 addition & 1 deletion protos/cosmos-sdk-src
Submodule cosmos-sdk-src updated 159 files
2 changes: 1 addition & 1 deletion protos/feemarket-src
2 changes: 1 addition & 1 deletion protos/ibc-go-src
1 change: 1 addition & 0 deletions protos/neutron-src
Submodule neutron-src added at f54aa0
2 changes: 1 addition & 1 deletion protos/slinky-src
2 changes: 1 addition & 1 deletion protos/wasmd-src
Submodule wasmd-src updated 73 files
+23 −19 .circleci/config.yml
+1 −1 .github/workflows/proto-buf-publisher.yml
+117 −38 CHANGELOG.md
+4 −4 Dockerfile
+16 −14 INTEGRATION.md
+1 −1 README.md
+23 −9 app/app.go
+0 −1 app/sim_test.go
+636 −10 docs/proto/proto-docs.md
+52 −51 go.mod
+113 −113 go.sum
+2 −2 proto/buf.lock
+3 −0 proto/cosmwasm/wasm/v1/ibc.proto
+13 −1 proto/cosmwasm/wasm/v1/query.proto
+1 −1 proto/cosmwasm/wasm/v1/tx.proto
+1 −1 tests/e2e/README.md
+225 −0 tests/e2e/ibc_callbacks_test.go
+ tests/e2e/testdata/ibc_callbacks.wasm
+17 −17 tests/system/go.mod
+36 −36 tests/system/go.sum
+1 −1 tests/system/system.go
+48 −24 x/wasm/client/cli/gov_tx.go
+3 −4 x/wasm/client/cli/tx.go
+150 −10 x/wasm/ibc.go
+97 −3 x/wasm/ibc_integration_test.go
+6 −19 x/wasm/ibc_test.go
+1 −1 x/wasm/ibctesting/chain.go
+1 −1 x/wasm/ibctesting/endpoint.go
+1 −1 x/wasm/ibctesting/event_utils.go
+1 −1 x/wasm/ibctesting/events.go
+51 −0 x/wasm/ibctesting/path.go
+2 −2 x/wasm/keeper/addresses.go
+1 −0 x/wasm/keeper/capabilities.go
+1 −1 x/wasm/keeper/contract_keeper.go
+35 −0 x/wasm/keeper/contract_keeper_test.go
+12 −0 x/wasm/keeper/events_test.go
+94 −30 x/wasm/keeper/handler_plugin.go
+1 −1 x/wasm/keeper/handler_plugin_encoders.go
+87 −24 x/wasm/keeper/handler_plugin_test.go
+131 −23 x/wasm/keeper/keeper.go
+4 −1 x/wasm/keeper/keeper_cgo.go
+54 −4 x/wasm/keeper/keeper_test.go
+23 −10 x/wasm/keeper/metrics.go
+1 −1 x/wasm/keeper/msg_server.go
+6 −0 x/wasm/keeper/options.go
+11 −3 x/wasm/keeper/options_test.go
+7 −0 x/wasm/keeper/querier.go
+1 −1 x/wasm/keeper/query_plugins_test.go
+9 −10 x/wasm/keeper/recurse_test.go
+99 −0 x/wasm/keeper/relay.go
+13 −1 x/wasm/keeper/relay_test.go
+1 −1 x/wasm/keeper/submsg_test.go
+ x/wasm/keeper/testdata/hackatom_42.wasm
+ x/wasm/keeper/testdata/hackatom_420.wasm
+ x/wasm/keeper/testdata/ibc_reflect.wasm
+44 −20 x/wasm/keeper/wasmtesting/mock_engine.go
+66 −4 x/wasm/keeper/wasmtesting/mock_keepers.go
+4 −1 x/wasm/module_test.go
+11 −0 x/wasm/types/context.go
+3 −0 x/wasm/types/errors.go
+8 −1 x/wasm/types/expected_keepers.go
+21 −0 x/wasm/types/exported_keepers.go
+2 −2 x/wasm/types/gas_register.go
+149 −23 x/wasm/types/ibc.pb.go
+20 −0 x/wasm/types/keys.go
+2 −19 x/wasm/types/params.go
+96 −95 x/wasm/types/query.pb.go
+0 −20 x/wasm/types/query.pb.gw.go
+8 −30 x/wasm/types/tx.go
+1 −1 x/wasm/types/tx.pb.go
+54 −0 x/wasm/types/tx_test.go
+32 −0 x/wasm/types/validation.go
+36 −1 x/wasm/types/wasmer_engine.go
41 changes: 41 additions & 0 deletions scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"

DIRS=(capability cosmos cosmos_proto cosmwasm feemarket gaia gogoproto google ibc neutron osmosis sdk connect tendermint)
FILES=(
binary.d.ts
binary.js
binary.js.map
helpers.d.ts
helpers.js
helpers.js.map
json-safe.d.ts
json-safe.js
json-safe.js.map
utf8.d.ts
utf8.js
utf8.js.map
varint.d.ts
varint.js
varint.js.map
querier_types.js
querier_types.d.ts
)

for dir in "${DIRS[@]}"; do
rm -rf "$dir"
done

for f in "${FILES[@]}"; do
if [[ $f != *"json-safe"* ]]; then
rm -rf "$f"
fi
done

rm -rf ./build

for dir in admin-module block-sdk cosmos-sdk feemarket ibc-go neutron connect wasmd ; do
rm -rf "protos/$dir"
done
7 changes: 6 additions & 1 deletion scripts/codegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ telescope({
logLevel: 0,
useSDKTypes: false,
tsDisable: {
files: ["slinky/oracle/v1/query.ts"],
files: [
"connect/oracle/v2/query.ts",
"connect/marketmap/v2/tx.ts",
"connect/abci/v2/vote_extensions.ts",
],
},
eslintDisable: {
disableAll: true,
Expand All @@ -44,6 +48,7 @@ telescope({
"neutron/dex/genesis.proto",
"neutron/transfer/v1/query.proto",
"slinky/abci/v1/vote_extensions.proto",
"slinky/marketmap/v1/tx.proto",
],
packages: ["google.api"],
},
Expand Down
2 changes: 2 additions & 0 deletions scripts/exports_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ for dir in block-sdk feemarket slinky ; do
buf export "protos/$dir-src/proto" --output "protos/$dir"
done

sed -i '' '/additional_bindings : \[\]/d' protos/slinky/connect/oracle/v2/query.proto

for dir in neutron ; do
rm -rf "protos/$dir"
mkdir -p "protos/$dir"
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepare-publishing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"

DIRS=(capability cosmos cosmos_proto cosmwasm feemarket gaia gogoproto google ibc neutron osmosis sdk slinky tendermint)
DIRS=(capability cosmos cosmos_proto cosmwasm feemarket gaia gogoproto google ibc neutron osmosis sdk connect tendermint)
FILES=(
binary.d.ts
binary.js
Expand Down
35 changes: 35 additions & 0 deletions scripts/set-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"

readonly ADMIN_MODULE_DIR="admin-module-src"
readonly BLOCK_SDK_DIR="block-sdk-src"
readonly COSMOS_SDK_DIR="cosmos-sdk-src"
readonly FEEMARKET_DIR="feemarket-src"
readonly IBC_GO_DIR="ibc-go-src"
readonly NEUTRON_DIR="neutron-src"
readonly SLINKY_DIR="slinky-src"
readonly WASMD_DIR="wasmd-src"

readonly ADMIN_MODULE_REV="v2.0.2"
readonly BLOCK_SDK_REV="v2.1.5"
readonly COSMOS_SDK_REV="v0.50.9-neutron"
readonly FEEMARKET_REV="v1.1.1"
readonly IBC_GO_REV="v8.5.1"
readonly NEUTRON_REV="chore/ics-v6"
readonly SLINKY_REV="v2.0.1"
readonly WASMD_REV="v0.53.0-neutron"

checkout_version () {
git -C protos/$1 checkout $2
}

checkout_version $ADMIN_MODULE_DIR $ADMIN_MODULE_REV
checkout_version $BLOCK_SDK_DIR $BLOCK_SDK_REV
checkout_version $COSMOS_SDK_DIR $COSMOS_SDK_REV
checkout_version $FEEMARKET_DIR $FEEMARKET_REV
checkout_version $IBC_GO_DIR $IBC_GO_REV
checkout_version $NEUTRON_DIR $NEUTRON_REV
checkout_version $SLINKY_DIR $SLINKY_REV
checkout_version $WASMD_DIR $WASMD_REV
2 changes: 1 addition & 1 deletion src/binary.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable */
/**
* This file and any referenced files were automatically generated by @cosmology/telescope@1.8.3
* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.0
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
* and run the transpile command or npm scripts command that is used to regenerate this bundle.
*/
Expand Down
157 changes: 157 additions & 0 deletions src/connect/abci/v2/vote_extensions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
//@ts-nocheck
/* eslint-disable */
import { BinaryReader, BinaryWriter } from "../../../binary";
import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, Exact, isObject } from "../../../helpers";
import { JsonSafe } from "../../../json-safe";
export const protobufPackage = "connect.abci.v2";
export interface OracleVoteExtension_PricesEntry {
key: bigint;
value: Uint8Array;
}
/** OracleVoteExtension defines the vote extension structure for oracle prices. */
export interface OracleVoteExtension {
/**
* Prices defines a map of id(CurrencyPair) -> price.Bytes() . i.e. 1 ->
* 0x123.. (bytes). Notice the `id` function is determined by the
* `CurrencyPairIDStrategy` used in the VoteExtensionHandler.
*/
prices: {
[key: bigint]: Uint8Array;
};
}
function createBaseOracleVoteExtension_PricesEntry(): OracleVoteExtension_PricesEntry {
return {
key: BigInt(0),
value: new Uint8Array(),
};
}
export const OracleVoteExtension_PricesEntry = {
encode(
message: OracleVoteExtension_PricesEntry,
writer: BinaryWriter = BinaryWriter.create(),
): BinaryWriter {
if (message.key !== BigInt(0)) {
writer.uint32(8).uint64(message.key);
}
if (message.value.length !== 0) {
writer.uint32(18).bytes(message.value);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): OracleVoteExtension_PricesEntry {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOracleVoteExtension_PricesEntry();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.key = reader.uint64();
break;
case 2:
message.value = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): OracleVoteExtension_PricesEntry {
const obj = createBaseOracleVoteExtension_PricesEntry();
if (isSet(object.key)) obj.key = BigInt(object.key.toString());
if (isSet(object.value)) obj.value = bytesFromBase64(object.value);
return obj;
},
toJSON(message: OracleVoteExtension_PricesEntry): JsonSafe<OracleVoteExtension_PricesEntry> {
const obj: any = {};
message.key !== undefined && (obj.key = (message.key || BigInt(0)).toString());
message.value !== undefined &&
(obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array()));
return obj;
},
fromPartial<I extends Exact<DeepPartial<OracleVoteExtension_PricesEntry>, I>>(
object: I,
): OracleVoteExtension_PricesEntry {
const message = createBaseOracleVoteExtension_PricesEntry();
if (object.key !== undefined && object.key !== null) {
message.key = BigInt(object.key.toString());
}
message.value = object.value ?? new Uint8Array();
return message;
},
};
function createBaseOracleVoteExtension(): OracleVoteExtension {
return {
prices: {},
};
}
export const OracleVoteExtension = {
typeUrl: "/connect.abci.v2.OracleVoteExtension",
encode(message: OracleVoteExtension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
Object.entries(message.prices).forEach(([key, value]) => {
OracleVoteExtension_PricesEntry.encode(
{
key: key as any,
value,
},
writer.uint32(10).fork(),
).ldelim();
});
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): OracleVoteExtension {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseOracleVoteExtension();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
const entry1 = OracleVoteExtension_PricesEntry.decode(reader, reader.uint32());
if (entry1.value !== undefined) {
message.prices[entry1.key] = entry1.value;
}
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): OracleVoteExtension {
const obj = createBaseOracleVoteExtension();
if (isObject(object.prices))
obj.prices = Object.entries(object.prices).reduce<{
[key: bigint]: bytes;
}>((acc, [key, value]) => {
acc[Number(key)] = bytes.fromJSON(value);
return acc;
}, {});
return obj;
},
toJSON(message: OracleVoteExtension): JsonSafe<OracleVoteExtension> {
const obj: any = {};
obj.prices = {};
if (message.prices) {
Object.entries(message.prices).forEach(([k, v]) => {
obj.prices[k] = bytes.toJSON(v);
});
}
return obj;
},
fromPartial<I extends Exact<DeepPartial<OracleVoteExtension>, I>>(object: I): OracleVoteExtension {
const message = createBaseOracleVoteExtension();
message.prices = Object.entries(object.prices ?? {}).reduce<{
[key: bigint]: bytes;
}>((acc, [key, value]) => {
if (value !== undefined) {
acc[Number(key)] = bytes.fromPartial(value);
}
return acc;
}, {});
return message;
},
};
Loading