Skip to content

Commit

Permalink
chore(cosmic-proto): codegen for agoric protos (#9645)
Browse files Browse the repository at this point in the history
## Description
- `swing_store_export_data_hash` added to `agoric/swingset/genesis.proto`
-  vlocalchain genesis state added via `agoric/vtransfer/genesis.proto`
  • Loading branch information
mergify[bot] authored Jul 3, 2024
2 parents 0752cec + 50553e1 commit 0705f2c
Show file tree
Hide file tree
Showing 16 changed files with 301 additions and 172 deletions.
4 changes: 4 additions & 0 deletions packages/cosmic-proto/proto/agoric/swingset/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ message GenesisState {
repeated SwingStoreExportDataEntry swing_store_export_data = 4 [
(gogoproto.jsontag) = "swingStoreExportData"
];

string swing_store_export_data_hash = 5 [
(gogoproto.jsontag) = "swingStoreExportDataHash"
];
}

// A SwingStore "export data" entry.
Expand Down
18 changes: 18 additions & 0 deletions packages/cosmic-proto/proto/agoric/vtransfer/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
syntax = "proto3";
package agoric.vtransfer;

import "gogoproto/gogo.proto";

option go_package = "github.com/Agoric/agoric-sdk/golang/cosmos/x/vtransfer/types";

// The initial and exported module state.
message GenesisState {
option (gogoproto.equal) = false;

// The list of account addresses that are being watched by the VM.
repeated bytes watched_addresses = 1 [
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress",
(gogoproto.jsontag) = "watched_addresses",
(gogoproto.moretags) = "yaml:\"watched_addresses\""
];
}
4 changes: 4 additions & 0 deletions packages/cosmic-proto/src/codegen/agoric/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as _11 from './vlocalchain/vlocalchain.js';
import * as _12 from './vstorage/genesis.js';
import * as _13 from './vstorage/query.js';
import * as _14 from './vstorage/vstorage.js';
import * as _15 from './vtransfer/genesis.js';
export namespace agoric {
export const lien = {
..._0,
Expand Down Expand Up @@ -42,4 +43,7 @@ export namespace agoric {
..._13,
..._14,
};
export const vtransfer = {
..._15,
};
}
15 changes: 15 additions & 0 deletions packages/cosmic-proto/src/codegen/agoric/swingset/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface GenesisState {
params: Params;
state: State;
swingStoreExportData: SwingStoreExportDataEntry[];
swingStoreExportDataHash: string;
}
export interface GenesisStateProtoMsg {
typeUrl: '/agoric.swingset.GenesisState';
Expand All @@ -18,6 +19,7 @@ export interface GenesisStateSDKType {
params: ParamsSDKType;
state: StateSDKType;
swing_store_export_data: SwingStoreExportDataEntrySDKType[];
swing_store_export_data_hash: string;
}
/** A SwingStore "export data" entry. */
export interface SwingStoreExportDataEntry {
Expand All @@ -38,6 +40,7 @@ function createBaseGenesisState(): GenesisState {
params: Params.fromPartial({}),
state: State.fromPartial({}),
swingStoreExportData: [],
swingStoreExportDataHash: '',
};
}
export const GenesisState = {
Expand All @@ -55,6 +58,9 @@ export const GenesisState = {
for (const v of message.swingStoreExportData) {
SwingStoreExportDataEntry.encode(v!, writer.uint32(34).fork()).ldelim();
}
if (message.swingStoreExportDataHash !== '') {
writer.uint32(42).string(message.swingStoreExportDataHash);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GenesisState {
Expand All @@ -76,6 +82,9 @@ export const GenesisState = {
SwingStoreExportDataEntry.decode(reader, reader.uint32()),
);
break;
case 5:
message.swingStoreExportDataHash = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
Expand All @@ -92,6 +101,9 @@ export const GenesisState = {
SwingStoreExportDataEntry.fromJSON(e),
)
: [],
swingStoreExportDataHash: isSet(object.swingStoreExportDataHash)
? String(object.swingStoreExportDataHash)
: '',
};
},
toJSON(message: GenesisState): JsonSafe<GenesisState> {
Expand All @@ -107,6 +119,8 @@ export const GenesisState = {
} else {
obj.swingStoreExportData = [];
}
message.swingStoreExportDataHash !== undefined &&
(obj.swingStoreExportDataHash = message.swingStoreExportDataHash);
return obj;
},
fromPartial(object: Partial<GenesisState>): GenesisState {
Expand All @@ -123,6 +137,7 @@ export const GenesisState = {
object.swingStoreExportData?.map(e =>
SwingStoreExportDataEntry.fromPartial(e),
) || [];
message.swingStoreExportDataHash = object.swingStoreExportDataHash ?? '';
return message;
},
fromProtoMsg(message: GenesisStateProtoMsg): GenesisState {
Expand Down
87 changes: 87 additions & 0 deletions packages/cosmic-proto/src/codegen/agoric/vtransfer/genesis.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//@ts-nocheck
import { BinaryReader, BinaryWriter } from '../../binary.js';
import { bytesFromBase64, base64FromBytes } from '../../helpers.js';
import { JsonSafe } from '../../json-safe.js';
/** The initial and exported module state. */
export interface GenesisState {
/** The list of account addresses that are being watched by the VM. */
watchedAddresses: Uint8Array[];
}
export interface GenesisStateProtoMsg {
typeUrl: '/agoric.vtransfer.GenesisState';
value: Uint8Array;
}
/** The initial and exported module state. */
export interface GenesisStateSDKType {
watched_addresses: Uint8Array[];
}
function createBaseGenesisState(): GenesisState {
return {
watchedAddresses: [],
};
}
export const GenesisState = {
typeUrl: '/agoric.vtransfer.GenesisState',
encode(
message: GenesisState,
writer: BinaryWriter = BinaryWriter.create(),
): BinaryWriter {
for (const v of message.watchedAddresses) {
writer.uint32(10).bytes(v!);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): GenesisState {
const reader =
input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenesisState();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.watchedAddresses.push(reader.bytes());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): GenesisState {
return {
watchedAddresses: Array.isArray(object?.watchedAddresses)
? object.watchedAddresses.map((e: any) => bytesFromBase64(e))
: [],
};
},
toJSON(message: GenesisState): JsonSafe<GenesisState> {
const obj: any = {};
if (message.watchedAddresses) {
obj.watchedAddresses = message.watchedAddresses.map(e =>
base64FromBytes(e !== undefined ? e : new Uint8Array()),
);
} else {
obj.watchedAddresses = [];
}
return obj;
},
fromPartial(object: Partial<GenesisState>): GenesisState {
const message = createBaseGenesisState();
message.watchedAddresses = object.watchedAddresses?.map(e => e) || [];
return message;
},
fromProtoMsg(message: GenesisStateProtoMsg): GenesisState {
return GenesisState.decode(message.value);
},
toProto(message: GenesisState): Uint8Array {
return GenesisState.encode(message).finish();
},
toProtoMsg(message: GenesisState): GenesisStateProtoMsg {
return {
typeUrl: '/agoric.vtransfer.GenesisState',
value: GenesisState.encode(message).finish(),
};
},
};
4 changes: 2 additions & 2 deletions packages/cosmic-proto/src/codegen/amino/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@ts-nocheck
import * as _15 from './amino.js';
import * as _16 from './amino.js';
export const amino = {
..._15,
..._16,
};
Loading

0 comments on commit 0705f2c

Please sign in to comment.