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: added interchain security, ibcratelimit. updated dex #NTRN-408 #10

Merged
merged 2 commits into from
Nov 27, 2024
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ node_modules/
/protos/neutron
/protos/slinky
/protos/wasmd
/protos/interchain-security

/build/
/capability/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
[submodule "wasmd"]
path = protos/wasmd-src
url = git@github.com:neutron-org/wasmd.git
[submodule "interchain-security"]
path = protos/interchain-security-src
url = git@github.com:cosmos/interchain-security.git
1 change: 1 addition & 0 deletions protos/interchain-security-src
2 changes: 1 addition & 1 deletion protos/neutron-src
Submodule neutron-src updated 570 files
2 changes: 1 addition & 1 deletion scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ done

rm -rf ./build

for dir in admin-module block-sdk cosmos-sdk feemarket ibc-go neutron slinky wasmd ; do
for dir in admin-module block-sdk cosmos-sdk feemarket ibc-go neutron slinky wasmd; do
rm -rf "protos/$dir"
done
1 change: 1 addition & 0 deletions scripts/codegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ telescope({
"protos/neutron",
"protos/slinky",
"protos/wasmd",
"protos/interchain-security",
],
outPath: outPath,
options: {
Expand Down
2 changes: 1 addition & 1 deletion scripts/exports_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for dir in admin-module cosmos-sdk ibc-go wasmd ; do
buf export "protos/$dir-src/" --output "protos/$dir"
done

for dir in block-sdk feemarket slinky ; do
for dir in block-sdk feemarket slinky interchain-security; do
rm -rf "protos/$dir"
mkdir -p "protos/$dir"
echo "Autogenerated folder, see export_protos.sh" > "protos/$dir/README.md"
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 slinky tendermint interchain-security)
FILES=(
binary.d.ts
binary.js
Expand Down
3 changes: 3 additions & 0 deletions scripts/set-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ readonly IBC_GO_DIR="ibc-go-src"
readonly NEUTRON_DIR="neutron-src"
readonly SLINKY_DIR="slinky-src"
readonly WASMD_DIR="wasmd-src"
readonly ICS_DIR="interchain-security-src"

readonly ADMIN_MODULE_REV="v2.0.2"
readonly BLOCK_SDK_REV="v2.1.5"
Expand All @@ -20,6 +21,7 @@ readonly IBC_GO_REV="v8.5.1"
readonly NEUTRON_REV="main"
readonly SLINKY_REV="v1.0.12"
readonly WASMD_REV="v0.51.2-neutron"
readonly ICS_REV="v5.1.1"

checkout_version () {
git -C protos/$1 checkout $2
Expand All @@ -33,3 +35,4 @@ 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
checkout_version $ICS_DIR $ICS_REV
184 changes: 184 additions & 0 deletions src/interchain_security/ccv/consumer/v1/consumer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
/* eslint-disable */
import { Any } from "../../../../google/protobuf/any";
import { Timestamp } from "../../../../google/protobuf/timestamp";
import { BinaryReader, BinaryWriter } from "../../../../binary";
import {
isSet,
bytesFromBase64,
base64FromBytes,
DeepPartial,
Exact,
fromJsonTimestamp,
fromTimestamp,
} from "../../../../helpers";
import { JsonSafe } from "../../../../json-safe";
export const protobufPackage = "interchain_security.ccv.consumer.v1";
/**
* CrossChainValidator defines the type used to store validator information
* internal to the consumer CCV module. Note one cross chain validator entry is
* persisted for each consumer validator, where incoming VSC packets update this
* data, which is eventually forwarded to comet for consumer chain consensus.
*
* Note this type is only used internally to the consumer CCV module.
*/
export interface CrossChainValidator {
address: Uint8Array;
power: bigint;
/** pubkey is the consensus public key of the validator, as a Protobuf Any. */
pubkey?: Any;
/**
* !!! DEPRECATED !!! opted_out is deprecated because after the introduction of Partial Set Security (PSS)
* we removed the soft opt-out feature.
*/
/** @deprecated */
optedOut: boolean;
}
/**
* A record storing the state of a slash packet sent to the provider chain
* which may bounce back and forth until handled by the provider.
*
* Note this type is only used internally to the consumer CCV module.
*/
export interface SlashRecord {
waitingOnReply: boolean;
sendTime: Timestamp;
}
function createBaseCrossChainValidator(): CrossChainValidator {
return {
address: new Uint8Array(),
power: BigInt(0),
pubkey: undefined,
optedOut: false,
};
}
export const CrossChainValidator = {
typeUrl: "/interchain_security.ccv.consumer.v1.CrossChainValidator",
encode(message: CrossChainValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.address.length !== 0) {
writer.uint32(10).bytes(message.address);
}
if (message.power !== BigInt(0)) {
writer.uint32(16).int64(message.power);
}
if (message.pubkey !== undefined) {
Any.encode(message.pubkey, writer.uint32(26).fork()).ldelim();
}
if (message.optedOut === true) {
writer.uint32(32).bool(message.optedOut);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): CrossChainValidator {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseCrossChainValidator();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.bytes();
break;
case 2:
message.power = reader.int64();
break;
case 3:
message.pubkey = Any.decode(reader, reader.uint32());
break;
case 4:
message.optedOut = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): CrossChainValidator {
const obj = createBaseCrossChainValidator();
if (isSet(object.address)) obj.address = bytesFromBase64(object.address);
if (isSet(object.power)) obj.power = BigInt(object.power.toString());
if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey);
if (isSet(object.optedOut)) obj.optedOut = Boolean(object.optedOut);
return obj;
},
toJSON(message: CrossChainValidator): JsonSafe<CrossChainValidator> {
const obj: any = {};
message.address !== undefined &&
(obj.address = base64FromBytes(message.address !== undefined ? message.address : new Uint8Array()));
message.power !== undefined && (obj.power = (message.power || BigInt(0)).toString());
message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined);
message.optedOut !== undefined && (obj.optedOut = message.optedOut);
return obj;
},
fromPartial<I extends Exact<DeepPartial<CrossChainValidator>, I>>(object: I): CrossChainValidator {
const message = createBaseCrossChainValidator();
message.address = object.address ?? new Uint8Array();
if (object.power !== undefined && object.power !== null) {
message.power = BigInt(object.power.toString());
}
if (object.pubkey !== undefined && object.pubkey !== null) {
message.pubkey = Any.fromPartial(object.pubkey);
}
message.optedOut = object.optedOut ?? false;
return message;
},
};
function createBaseSlashRecord(): SlashRecord {
return {
waitingOnReply: false,
sendTime: Timestamp.fromPartial({}),
};
}
export const SlashRecord = {
typeUrl: "/interchain_security.ccv.consumer.v1.SlashRecord",
encode(message: SlashRecord, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter {
if (message.waitingOnReply === true) {
writer.uint32(8).bool(message.waitingOnReply);
}
if (message.sendTime !== undefined) {
Timestamp.encode(message.sendTime, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): SlashRecord {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseSlashRecord();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.waitingOnReply = reader.bool();
break;
case 2:
message.sendTime = Timestamp.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): SlashRecord {
const obj = createBaseSlashRecord();
if (isSet(object.waitingOnReply)) obj.waitingOnReply = Boolean(object.waitingOnReply);
if (isSet(object.sendTime)) obj.sendTime = fromJsonTimestamp(object.sendTime);
return obj;
},
toJSON(message: SlashRecord): JsonSafe<SlashRecord> {
const obj: any = {};
message.waitingOnReply !== undefined && (obj.waitingOnReply = message.waitingOnReply);
message.sendTime !== undefined && (obj.sendTime = fromTimestamp(message.sendTime).toISOString());
return obj;
},
fromPartial<I extends Exact<DeepPartial<SlashRecord>, I>>(object: I): SlashRecord {
const message = createBaseSlashRecord();
message.waitingOnReply = object.waitingOnReply ?? false;
if (object.sendTime !== undefined && object.sendTime !== null) {
message.sendTime = Timestamp.fromPartial(object.sendTime);
}
return message;
},
};
Loading