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: state data for aborted tx amount #1395

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 11 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
4 changes: 2 additions & 2 deletions app/setup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/upgrade/types"
observertypes "github.com/zeta-chain/zetacore/x/observer/types"
crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types"
)

const releaseVersion = "v10.1.0"
Expand All @@ -17,7 +17,7 @@ func SetupHandlers(app *App) {
for m, mb := range app.mm.Modules {
vm[m] = mb.ConsensusVersion()
}
vm[observertypes.ModuleName] = vm[observertypes.ModuleName] - 1
vm[crosschaintypes.ModuleName] = vm[crosschaintypes.ModuleName] - 1
return app.mm.RunMigrations(ctx, app.configurator, vm)
})

Expand Down
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Unreleased

### Features

* [1395](https://github.com/zeta-chain/node/pull/1395) - Add state variable to track aborted zeta amount
### Fixes

* [1372](https://github.com/zeta-chain/node/pull/1372) - Include Event Index as part for inbound tx digest
Expand Down
1 change: 1 addition & 0 deletions docs/cli/zetacored/zetacored_query_crosschain.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ zetacored query crosschain [flags]
### SEE ALSO

* [zetacored query](zetacored_query.md) - Querying subcommands
* [zetacored query crosschain get-aborted-zeta-amount](zetacored_query_crosschain_get-aborted-zeta-amount.md) - Query current tss address
* [zetacored query crosschain get-tss-address](zetacored_query_crosschain_get-tss-address.md) - Query current tss address
* [zetacored query crosschain in-tx-hash-to-cctx-data](zetacored_query_crosschain_in-tx-hash-to-cctx-data.md) - query a cctx data from a in tx hash
* [zetacored query crosschain last-zeta-height](zetacored_query_crosschain_last-zeta-height.md) - Query last Zeta Height
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# query crosschain get-aborted-zeta-amount

Query current tss address
kingpinXD marked this conversation as resolved.
Show resolved Hide resolved

```
zetacored query crosschain get-aborted-zeta-amount [flags]
```

### Options

```
--grpc-addr string the gRPC endpoint to use for this chain
--grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS
--height int Use a specific height to query state at (this can error if the node is pruning state)
-h, --help help for get-aborted-zeta-amount
--node string [host]:[port] to Tendermint RPC interface for this chain
-o, --output string Output format (text|json)
```

### Options inherited from parent commands

```
--chain-id string The network chain ID
--home string directory for config and data
--log_format string The logging format (json|plain)
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic)
--trace print out full stack trace on errors
```

### SEE ALSO

* [zetacored query crosschain](zetacored_query_crosschain.md) - Querying commands for the crosschain module

19 changes: 19 additions & 0 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26477,6 +26477,20 @@ paths:
$ref: '#/definitions/googlerpcStatus'
tags:
- Query
/zeta-chain/crosschain/abortedZetaAmount:
get:
operationId: Query_ZetaAccounting
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/crosschainQueryZetaAccountingResponse'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/googlerpcStatus'
tags:
- Query
/zeta-chain/crosschain/cctx:
get:
summary: Queries a list of send items.
Expand Down Expand Up @@ -50952,6 +50966,11 @@ definitions:
items:
type: object
$ref: '#/definitions/crosschainTSS'
crosschainQueryZetaAccountingResponse:
type: object
properties:
aborted_zeta_amount:
type: string
crosschainTSS:
type: object
properties:
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ require (
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/libp2p/go-yamux/v4 v4.0.0 // indirect
github.com/linxGnu/grocksdb v1.7.15 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect
github.com/onsi/ginkgo/v2 v2.9.7 // indirect
github.com/prometheus/tsdb v0.7.1 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
Expand All @@ -91,6 +92,7 @@ require (
github.com/quic-go/webtransport-go v0.5.3 // indirect
github.com/rjeczalik/notify v0.9.1 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/securego/gosec v0.0.0-20200401082031-e946c8c39989 // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
github.com/tidwall/gjson v1.14.4 // indirect
github.com/tidwall/match v1.1.1 // indirect
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,7 @@ github.com/cosmos/ibc-go/v6 v6.1.0 h1:o7oXws2vKkKfOFzJI+oNylRn44PCNt5wzHd/zKQKbv
github.com/cosmos/ibc-go/v6 v6.1.0/go.mod h1:CY3zh2HLfetRiW8LY6kVHMATe90Wj/UOoY8T6cuB0is=
github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA=
github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI=
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand Down Expand Up @@ -1813,6 +1814,7 @@ github.com/ipfs/go-datastore v0.6.0/go.mod h1:rt5M3nNbSO/8q1t4LNkLyUwRs8HupMeN/8
github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk=
github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps=
github.com/ipfs/go-ipfs-util v0.0.2 h1:59Sswnk1MFaiq+VcaknX7aYEyGyGDAA73ilhEK2POp8=
github.com/ipfs/go-ipfs-util v0.0.2/go.mod h1:CbPtkWJzjLdEcezDns2XYaehFVNXG9zrdrtMecczcsQ=
github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM=
github.com/ipfs/go-log v1.0.5 h1:2dOuUCB1Z7uoczMWgAyDck5JLb72zHzrMnGnCNNbvY8=
github.com/ipfs/go-log v1.0.5/go.mod h1:j0b8ZoR+7+R99LD9jZ6+AJsrzkPbSXbZfGakb5JPtIo=
Expand Down Expand Up @@ -1920,6 +1922,7 @@ github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiD
github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro=
github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8=
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
Expand Down Expand Up @@ -2284,6 +2287,7 @@ github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1t
github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 h1:4kuARK6Y6FxaNu/BnU2OAaLF86eTVhP2hjTB6iMvItA=
github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8=
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo=
Expand Down Expand Up @@ -2626,6 +2630,7 @@ github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvW
github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83/go.mod h1:vvbZ2Ae7AzSq3/kywjUDxSNq2SJ27RxCz2un0H3ePqE=
github.com/securego/gosec v0.0.0-20200401082031-e946c8c39989 h1:rq2/kILQnPtq5oL4+IAjgVOjh5e2yj2aaCYi7squEvI=
github.com/securego/gosec v0.0.0-20200401082031-e946c8c39989/go.mod h1:i9l/TNj+yDFh9SZXUTvspXTjbFXgZGP/UvhU1S65A4A=
github.com/securego/gosec/v2 v2.3.0/go.mod h1:UzeVyUXbxukhLeHKV3VVqo7HdoQR9MrRfFmZYotn8ME=
github.com/securego/gosec/v2 v2.13.1/go.mod h1:EO1sImBMBWFjOTFzMWfTRrZW6M15gm60ljzrmy/wtHo=
Expand Down Expand Up @@ -2699,6 +2704,7 @@ github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34c
github.com/sourcegraph/go-diff v0.5.3/go.mod h1:v9JDtjCE4HHHCZGId75rg8gkKKa98RVjBcBGsVmMmak=
github.com/sourcegraph/go-diff v0.6.1/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs=
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
Expand Down
7 changes: 7 additions & 0 deletions proto/crosschain/cross_chain_tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ message InboundTxParams {
uint64 inbound_tx_finalized_zeta_height = 10;
}

message ZetaAccounting {
string aborted_zeta_amount = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
}

message OutboundTxParams {
string receiver = 1;
int64 receiver_chainId = 2;
Expand Down
1 change: 1 addition & 0 deletions proto/crosschain/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ message GenesisState {
repeated InTxHashToCctx inTxHashToCctxList = 9 [(gogoproto.nullable) = false];
repeated TSS tss_history = 10 [(gogoproto.nullable) = false];
repeated InTxTracker in_tx_tracker_list = 11 [(gogoproto.nullable) = false];
ZetaAccounting zeta_accounting = 12 [(gogoproto.nullable) = false];
}
13 changes: 13 additions & 0 deletions proto/crosschain/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,19 @@ service Query {
rpc CctxByStatus(QueryCctxByStatusRequest) returns (QueryCctxByStatusResponse) {
option (google.api.http).get = "/zeta-chain/crosschain/cctxbyStatus/{status}";
}

rpc ZetaAccounting(QueryZetaAccountingRequest) returns (QueryZetaAccountingResponse) {
option (google.api.http).get = "/zeta-chain/crosschain/abortedZetaAmount";
}
}

message QueryZetaAccountingRequest {}

message QueryZetaAccountingResponse {
string aborted_zeta_amount = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
(gogoproto.nullable) = false
];
}

message QueryCctxByStatusRequest {
Expand Down
24 changes: 24 additions & 0 deletions typescript/crosschain/cross_chain_tx_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,30 @@ export declare class InboundTxParams extends Message<InboundTxParams> {
static equals(a: InboundTxParams | PlainMessage<InboundTxParams> | undefined, b: InboundTxParams | PlainMessage<InboundTxParams> | undefined): boolean;
}

/**
* @generated from message zetachain.zetacore.crosschain.ZetaAccounting
*/
export declare class ZetaAccounting extends Message<ZetaAccounting> {
/**
* @generated from field: string aborted_zeta_amount = 1;
*/
abortedZetaAmount: string;

constructor(data?: PartialMessage<ZetaAccounting>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.crosschain.ZetaAccounting";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ZetaAccounting;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ZetaAccounting;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ZetaAccounting;

static equals(a: ZetaAccounting | PlainMessage<ZetaAccounting> | undefined, b: ZetaAccounting | PlainMessage<ZetaAccounting> | undefined): boolean;
}

/**
* @generated from message zetachain.zetacore.crosschain.OutboundTxParams
*/
Expand Down
7 changes: 6 additions & 1 deletion typescript/crosschain/genesis_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { OutTxTracker } from "./out_tx_tracker_pb.js";
import type { TSS } from "./tss_pb.js";
import type { GasPrice } from "./gas_price_pb.js";
import type { ChainNonces } from "./chain_nonces_pb.js";
import type { CrossChainTx } from "./cross_chain_tx_pb.js";
import type { CrossChainTx, ZetaAccounting } from "./cross_chain_tx_pb.js";
import type { LastBlockHeight } from "./last_block_height_pb.js";
import type { InTxHashToCctx } from "./in_tx_hash_to_cctx_pb.js";
import type { InTxTracker } from "./in_tx_tracker_pb.js";
Expand Down Expand Up @@ -71,6 +71,11 @@ export declare class GenesisState extends Message<GenesisState> {
*/
inTxTrackerList: InTxTracker[];

/**
* @generated from field: zetachain.zetacore.crosschain.ZetaAccounting zeta_accounting = 12;
*/
zetaAccounting?: ZetaAccounting;

constructor(data?: PartialMessage<GenesisState>);

static readonly runtime: typeof proto3;
Expand Down
43 changes: 43 additions & 0 deletions typescript/crosschain/query_pb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,49 @@ import type { ChainNonces } from "./chain_nonces_pb.js";
import type { PendingNonces } from "./nonce_to_cctx_pb.js";
import type { LastBlockHeight } from "./last_block_height_pb.js";

/**
* @generated from message zetachain.zetacore.crosschain.QueryZetaAccountingRequest
*/
export declare class QueryZetaAccountingRequest extends Message<QueryZetaAccountingRequest> {
constructor(data?: PartialMessage<QueryZetaAccountingRequest>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.crosschain.QueryZetaAccountingRequest";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): QueryZetaAccountingRequest;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): QueryZetaAccountingRequest;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): QueryZetaAccountingRequest;

static equals(a: QueryZetaAccountingRequest | PlainMessage<QueryZetaAccountingRequest> | undefined, b: QueryZetaAccountingRequest | PlainMessage<QueryZetaAccountingRequest> | undefined): boolean;
}

/**
* @generated from message zetachain.zetacore.crosschain.QueryZetaAccountingResponse
*/
export declare class QueryZetaAccountingResponse extends Message<QueryZetaAccountingResponse> {
/**
* @generated from field: string aborted_zeta_amount = 1;
*/
abortedZetaAmount: string;

constructor(data?: PartialMessage<QueryZetaAccountingResponse>);

static readonly runtime: typeof proto3;
static readonly typeName = "zetachain.zetacore.crosschain.QueryZetaAccountingResponse";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): QueryZetaAccountingResponse;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): QueryZetaAccountingResponse;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): QueryZetaAccountingResponse;

static equals(a: QueryZetaAccountingResponse | PlainMessage<QueryZetaAccountingResponse> | undefined, b: QueryZetaAccountingResponse | PlainMessage<QueryZetaAccountingResponse> | undefined): boolean;
}

/**
* @generated from message zetachain.zetacore.crosschain.QueryCctxByStatusRequest
*/
Expand Down
1 change: 1 addition & 0 deletions x/crosschain/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func GetQueryCmd(_ string) *cobra.Command {
CmdPendingCctx(),
CmdListInTxTrackerByChain(),
CmdListInTxTrackers(),
CmdGetZetaAccounting(),
)

return cmd
Expand Down
31 changes: 31 additions & 0 deletions x/crosschain/client/cli/query_zeta_accounting.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cli

import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
"github.com/zeta-chain/zetacore/x/crosschain/types"
)

func CmdGetZetaAccounting() *cobra.Command {
cmd := &cobra.Command{
Use: "get-zeta-accounting",
Short: "Query zeta accounting",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) (err error) {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)
params := &types.QueryZetaAccountingRequest{}
res, err := queryClient.ZetaAccounting(cmd.Context(), params)
if err != nil {
return err
}
return clientCtx.PrintProto(res)
},
}
flags.AddQueryFlagsToCmd(cmd)
return cmd
}
6 changes: 6 additions & 0 deletions x/crosschain/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
// Params
k.SetParams(ctx, genState.Params)

k.SetZetaAccounting(ctx, genState.ZetaAccounting)
// Set all the outTxTracker
for _, elem := range genState.OutTxTrackerList {
k.SetOutTxTracker(ctx, elem)
Expand Down Expand Up @@ -70,6 +71,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)
k.SetTSSHistory(ctx, elem)
}
}

}

// ExportGenesis returns the crosschain module's exported genesis.
Expand Down Expand Up @@ -116,6 +118,10 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState {
}

genesis.TssHistory = k.GetAllTSS(ctx)
amount, found := k.GetZetaAccounting(ctx)
if found {
genesis.ZetaAccounting = amount
}

return &genesis
}
4 changes: 4 additions & 0 deletions x/crosschain/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package crosschain_test
import (
"testing"

sdkmath "cosmossdk.io/math"
"github.com/stretchr/testify/require"
keepertest "github.com/zeta-chain/zetacore/testutil/keeper"
"github.com/zeta-chain/zetacore/testutil/nullify"
Expand All @@ -14,6 +15,9 @@ import (
func TestGenesis(t *testing.T) {
genesisState := types.GenesisState{
Params: types.DefaultParams(),
ZetaAccounting: types.ZetaAccounting{
AbortedZetaAmount: sdkmath.OneUint(),
},
OutTxTrackerList: []types.OutTxTracker{
sample.OutTxTracker(t, "0"),
sample.OutTxTracker(t, "1"),
Expand Down
Loading
Loading