From a97bf1302f3e9671d2d762e2c282ce02d258bc54 Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 26 Jun 2024 14:44:56 +0100 Subject: [PATCH 1/9] fix: add tx input and gas in rpc methods for synthetic txs (#2382) --- changelog.md | 1 + rpc/backend/backend_suite_test.go | 1 + rpc/backend/tx_info_test.go | 3 +++ rpc/types/events.go | 4 +++- rpc/types/utils.go | 2 +- 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 373c0bafb3..8b386c85ec 100644 --- a/changelog.md +++ b/changelog.md @@ -83,6 +83,7 @@ * [2256](https://github.com/zeta-chain/node/pull/2256) - fix rate limiter falsely included reverted non-withdraw cctxs * [2327](https://github.com/zeta-chain/node/pull/2327) - partially cherry picked the fix to Bitcoin outbound dust amount * [2362](https://github.com/zeta-chain/node/pull/2362) - set 1000 satoshis as minimum BTC amount that can be withdrawn from zEVM +* [2382](https://github.com/zeta-chain/node/pull/2382) - add tx input and gas in rpc methods for synthetic eth txs ### CI diff --git a/rpc/backend/backend_suite_test.go b/rpc/backend/backend_suite_test.go index 1abd882fd2..21744e87e3 100644 --- a/rpc/backend/backend_suite_test.go +++ b/rpc/backend/backend_suite_test.go @@ -155,6 +155,7 @@ func (suite *BackendTestSuite) buildSyntheticTxResult(txHash string) ([]byte, ab {Type: evmtypes.EventTypeEthereumTx, Attributes: []abci.EventAttribute{ {Key: "ethereumTxHash", Value: txHash}, {Key: "txIndex", Value: "8888"}, + {Key: "txData", Value: "0x1234"}, {Key: "amount", Value: "1000"}, {Key: "txGasUsed", Value: "21000"}, {Key: "txHash", Value: ""}, diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index c76a26ead8..0ceb0160a6 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -56,6 +56,9 @@ func (suite *BackendTestSuite) TestGetSyntheticTransactionByHash() { suite.Require().Equal(uint64(88), txType) suite.Require().Equal(int64(7001), res.ChainID.ToInt().Int64()) suite.Require().Equal(int64(1000), res.Value.ToInt().Int64()) + gas, _ := hexutil.DecodeUint64(res.Gas.String()) + suite.Require().Equal(uint64(21000), gas) + suite.Require().Equal("0x1234", res.Input.String()) suite.Require().Nil(res.V) suite.Require().Nil(res.R) suite.Require().Nil(res.S) diff --git a/rpc/types/events.go b/rpc/types/events.go index 4a265f2c6d..f43270fae3 100644 --- a/rpc/types/events.go +++ b/rpc/types/events.go @@ -169,7 +169,8 @@ func ParseTxResult(result *abci.ResponseDeliverTx, tx sdk.Tx) (*ParsedTxs, error } // some old versions miss some events, fill it with tx result - if len(p.Txs) == 1 { + // txs with type CosmosEVMTxType will always emit GasUsed in events so no need to override for those + if len(p.Txs) == 1 && p.Txs[0].Type != CosmosEVMTxType { // #nosec G701 always positive p.Txs[0].GasUsed = uint64(result.GasUsed) } @@ -240,6 +241,7 @@ func ParseTxIndexerResult( Type: parsedTx.Type, Recipient: parsedTx.Recipient, Sender: parsedTx.Sender, + GasUsed: parsedTx.GasUsed, Data: parsedTx.Data, Nonce: parsedTx.Nonce, }, nil diff --git a/rpc/types/utils.go b/rpc/types/utils.go index dfda689557..7ba3c998da 100644 --- a/rpc/types/utils.go +++ b/rpc/types/utils.go @@ -252,7 +252,7 @@ func NewRPCTransactionFromIncompleteMsg( Gas: hexutil.Uint64(txAdditional.GasUsed), GasPrice: (*hexutil.Big)(baseFee), Hash: common.HexToHash(msg.Hash), - Input: []byte{}, + Input: txAdditional.Data, Nonce: hexutil.Uint64(txAdditional.Nonce), // TODO: get nonce for "from" from ethermint To: to, Value: (*hexutil.Big)(txAdditional.Value), From f2ac8f66d5202035a6f002c510b5b0e4460a9376 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 26 Jun 2024 11:06:50 -0400 Subject: [PATCH 2/9] feat: add queries for tss funds migrator info (#2372) --- changelog.md | 1 + .../cli/zetacored/zetacored_query_observer.md | 2 + ..._query_observer_list-tss-funds-migrator.md | 40 + ..._query_observer_show-tss-funds-migrator.md | 40 + docs/openapi/openapi.swagger.yaml | 57 + proto/zetachain/zetacore/observer/query.proto | 25 + .../zetachain/zetacore/observer/query_pb.d.ts | 92 ++ x/observer/client/cli/query.go | 2 + .../client/cli/query_tss_fund_migrator.go | 70 ++ .../grpc_query_tss_funds_migrator_info.go | 51 + .../grpc_query_tss_funds_migrator_test.go | 104 ++ x/observer/types/query.pb.go | 1112 ++++++++++++++--- x/observer/types/query.pb.gw.go | 148 +++ 13 files changed, 1544 insertions(+), 200 deletions(-) create mode 100644 docs/cli/zetacored/zetacored_query_observer_list-tss-funds-migrator.md create mode 100644 docs/cli/zetacored/zetacored_query_observer_show-tss-funds-migrator.md create mode 100644 x/observer/client/cli/query_tss_fund_migrator.go create mode 100644 x/observer/keeper/grpc_query_tss_funds_migrator_info.go create mode 100644 x/observer/keeper/grpc_query_tss_funds_migrator_test.go diff --git a/changelog.md b/changelog.md index 8b386c85ec..3d0194dc28 100644 --- a/changelog.md +++ b/changelog.md @@ -29,6 +29,7 @@ * [2325](https://github.com/zeta-chain/node/pull/2325) - revert telemetry server changes * [2339](https://github.com/zeta-chain/node/pull/2339) - add binaries related question to syncing issue form * [2366](https://github.com/zeta-chain/node/pull/2366) - add migration script for adding authorizations table +* [2372](https://github.com/zeta-chain/node/pull/2372) - add queries for tss fund migration info ### Refactor diff --git a/docs/cli/zetacored/zetacored_query_observer.md b/docs/cli/zetacored/zetacored_query_observer.md index 42d0ffe777..e19f4cbecb 100644 --- a/docs/cli/zetacored/zetacored_query_observer.md +++ b/docs/cli/zetacored/zetacored_query_observer.md @@ -36,6 +36,7 @@ zetacored query observer [flags] * [zetacored query observer list-node-account](zetacored_query_observer_list-node-account.md) - list all NodeAccount * [zetacored query observer list-observer-set](zetacored_query_observer_list-observer-set.md) - Query observer set * [zetacored query observer list-pending-nonces](zetacored_query_observer_list-pending-nonces.md) - shows a chainNonces +* [zetacored query observer list-tss-funds-migrator](zetacored_query_observer_list-tss-funds-migrator.md) - list all tss funds migrators * [zetacored query observer list-tss-history](zetacored_query_observer_list-tss-history.md) - show historical list of TSS * [zetacored query observer show-ballot](zetacored_query_observer_show-ballot.md) - Query BallotByIdentifier * [zetacored query observer show-blame](zetacored_query_observer_show-blame.md) - Query BlameByIdentifier @@ -46,4 +47,5 @@ zetacored query observer [flags] * [zetacored query observer show-node-account](zetacored_query_observer_show-node-account.md) - shows a NodeAccount * [zetacored query observer show-observer-count](zetacored_query_observer_show-observer-count.md) - Query show-observer-count * [zetacored query observer show-tss](zetacored_query_observer_show-tss.md) - shows a TSS +* [zetacored query observer show-tss-funds-migrator](zetacored_query_observer_show-tss-funds-migrator.md) - show the tss funds migrator for a chain diff --git a/docs/cli/zetacored/zetacored_query_observer_list-tss-funds-migrator.md b/docs/cli/zetacored/zetacored_query_observer_list-tss-funds-migrator.md new file mode 100644 index 0000000000..0eca411dae --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_observer_list-tss-funds-migrator.md @@ -0,0 +1,40 @@ +# query observer list-tss-funds-migrator + +list all tss funds migrators + +``` +zetacored query observer list-tss-funds-migrator [flags] +``` + +### Options + +``` + --count-total count total number of records in list-tss-funds-migrator to query for + --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 list-tss-funds-migrator + --limit uint pagination limit of list-tss-funds-migrator to query for (default 100) + --node string [host]:[port] to Tendermint RPC interface for this chain + --offset uint pagination offset of list-tss-funds-migrator to query for + -o, --output string Output format (text|json) + --page uint pagination page of list-tss-funds-migrator to query for. This sets offset to a multiple of limit (default 1) + --page-key string pagination page-key of list-tss-funds-migrator to query for + --reverse results are sorted in descending order +``` + +### 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) + --log_no_color Disable colored logs + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module + diff --git a/docs/cli/zetacored/zetacored_query_observer_show-tss-funds-migrator.md b/docs/cli/zetacored/zetacored_query_observer_show-tss-funds-migrator.md new file mode 100644 index 0000000000..c307953301 --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_observer_show-tss-funds-migrator.md @@ -0,0 +1,40 @@ +# query observer show-tss-funds-migrator + +show the tss funds migrator for a chain + +``` +zetacored query observer show-tss-funds-migrator [chain-id] [flags] +``` + +### Options + +``` + --count-total count total number of records in show-tss-funds-migrator [chain-id] to query for + --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 show-tss-funds-migrator + --limit uint pagination limit of show-tss-funds-migrator [chain-id] to query for (default 100) + --node string [host]:[port] to Tendermint RPC interface for this chain + --offset uint pagination offset of show-tss-funds-migrator [chain-id] to query for + -o, --output string Output format (text|json) + --page uint pagination page of show-tss-funds-migrator [chain-id] to query for. This sets offset to a multiple of limit (default 1) + --page-key string pagination page-key of show-tss-funds-migrator [chain-id] to query for + --reverse results are sorted in descending order +``` + +### 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) + --log_no_color Disable colored logs + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module + diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index dc72d0bf6b..987feb13d4 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -30252,6 +30252,42 @@ paths: format: int64 tags: - Query + /zeta-chain/observer/getAllTssFundsMigrators: + get: + summary: Queries all TssFundMigratorInfo + operationId: Query_TssFundsMigratorInfoAll + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryTssFundsMigratorInfoAllResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + tags: + - Query + /zeta-chain/observer/getTssFundsMigrator: + get: + summary: Queries the TssFundMigratorInfo for a specific chain + operationId: Query_TssFundsMigratorInfo + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryTssFundsMigratorInfoResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: chain_id + in: query + required: false + type: string + format: int64 + tags: + - Query /zeta-chain/observer/has_voted/{ballot_identifier}/{voter_address}: get: summary: Query if a voter has voted for a ballot @@ -58111,6 +58147,19 @@ definitions: items: type: object $ref: '#/definitions/chainsChain' + observerQueryTssFundsMigratorInfoAllResponse: + type: object + properties: + tss_funds_migrators: + type: array + items: + type: object + $ref: '#/definitions/observerTssFundMigratorInfo' + observerQueryTssFundsMigratorInfoResponse: + type: object + properties: + tss_funds_migrator: + $ref: '#/definitions/observerTssFundMigratorInfo' observerQueryTssHistoryResponse: type: object properties: @@ -58140,6 +58189,14 @@ definitions: keyGenZetaHeight: type: string format: int64 + observerTssFundMigratorInfo: + type: object + properties: + chain_id: + type: string + format: int64 + migration_cctx_index: + type: string observerVoteType: type: string enum: diff --git a/proto/zetachain/zetacore/observer/query.proto b/proto/zetachain/zetacore/observer/query.proto index ef06616b2e..799bc1efb9 100644 --- a/proto/zetachain/zetacore/observer/query.proto +++ b/proto/zetachain/zetacore/observer/query.proto @@ -16,6 +16,7 @@ import "zetachain/zetacore/observer/pending_nonces.proto"; import "zetachain/zetacore/observer/tss.proto"; import "zetachain/zetacore/pkg/chains/chains.proto"; import "zetachain/zetacore/pkg/proofs/proofs.proto"; +import "zetachain/zetacore/observer/tss_funds_migrator.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -150,6 +151,30 @@ service Query { returns (QueryAllChainNoncesResponse) { option (google.api.http).get = "/zeta-chain/observer/chainNonces"; } + // Queries the TssFundMigratorInfo for a specific chain + rpc TssFundsMigratorInfo(QueryTssFundsMigratorInfoRequest) + returns (QueryTssFundsMigratorInfoResponse) { + option (google.api.http).get = "/zeta-chain/observer/getTssFundsMigrator"; + } + + // Queries all TssFundMigratorInfo + rpc TssFundsMigratorInfoAll(QueryTssFundsMigratorInfoAllRequest) + returns (QueryTssFundsMigratorInfoAllResponse) { + option (google.api.http).get = + "/zeta-chain/observer/getAllTssFundsMigrators"; + } +} + +message QueryTssFundsMigratorInfoAllRequest {} + +message QueryTssFundsMigratorInfoAllResponse { + repeated TssFundMigratorInfo tss_funds_migrators = 1 + [ (gogoproto.nullable) = false ]; +} + +message QueryTssFundsMigratorInfoRequest { int64 chain_id = 1; } +message QueryTssFundsMigratorInfoResponse { + TssFundMigratorInfo tss_funds_migrator = 1 [ (gogoproto.nullable) = false ]; } message QueryGetChainNoncesRequest { string index = 1; } diff --git a/typescript/zetachain/zetacore/observer/query_pb.d.ts b/typescript/zetachain/zetacore/observer/query_pb.d.ts index 5c4f8c71d0..41873827e5 100644 --- a/typescript/zetachain/zetacore/observer/query_pb.d.ts +++ b/typescript/zetachain/zetacore/observer/query_pb.d.ts @@ -5,6 +5,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; +import type { TssFundMigratorInfo } from "./tss_funds_migrator_pb.js"; import type { ChainNonces } from "./chain_nonces_pb.js"; import type { PageRequest, PageResponse } from "../../../cosmos/base/query/v1beta1/pagination_pb.js"; import type { PendingNonces } from "./pending_nonces_pb.js"; @@ -18,6 +19,97 @@ import type { CrosschainFlags } from "./crosschain_flags_pb.js"; import type { Keygen } from "./keygen_pb.js"; import type { Blame } from "./blame_pb.js"; +/** + * @generated from message zetachain.zetacore.observer.QueryTssFundsMigratorInfoAllRequest + */ +export declare class QueryTssFundsMigratorInfoAllRequest extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryTssFundsMigratorInfoAllRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryTssFundsMigratorInfoAllRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryTssFundsMigratorInfoAllRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryTssFundsMigratorInfoAllRequest; + + static equals(a: QueryTssFundsMigratorInfoAllRequest | PlainMessage | undefined, b: QueryTssFundsMigratorInfoAllRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryTssFundsMigratorInfoAllResponse + */ +export declare class QueryTssFundsMigratorInfoAllResponse extends Message { + /** + * @generated from field: repeated zetachain.zetacore.observer.TssFundMigratorInfo tss_funds_migrators = 1; + */ + tssFundsMigrators: TssFundMigratorInfo[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryTssFundsMigratorInfoAllResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryTssFundsMigratorInfoAllResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryTssFundsMigratorInfoAllResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryTssFundsMigratorInfoAllResponse; + + static equals(a: QueryTssFundsMigratorInfoAllResponse | PlainMessage | undefined, b: QueryTssFundsMigratorInfoAllResponse | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryTssFundsMigratorInfoRequest + */ +export declare class QueryTssFundsMigratorInfoRequest extends Message { + /** + * @generated from field: int64 chain_id = 1; + */ + chainId: bigint; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryTssFundsMigratorInfoRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryTssFundsMigratorInfoRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryTssFundsMigratorInfoRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryTssFundsMigratorInfoRequest; + + static equals(a: QueryTssFundsMigratorInfoRequest | PlainMessage | undefined, b: QueryTssFundsMigratorInfoRequest | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.observer.QueryTssFundsMigratorInfoResponse + */ +export declare class QueryTssFundsMigratorInfoResponse extends Message { + /** + * @generated from field: zetachain.zetacore.observer.TssFundMigratorInfo tss_funds_migrator = 1; + */ + tssFundsMigrator?: TssFundMigratorInfo; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.observer.QueryTssFundsMigratorInfoResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryTssFundsMigratorInfoResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryTssFundsMigratorInfoResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryTssFundsMigratorInfoResponse; + + static equals(a: QueryTssFundsMigratorInfoResponse | PlainMessage | undefined, b: QueryTssFundsMigratorInfoResponse | PlainMessage | undefined): boolean; +} + /** * @generated from message zetachain.zetacore.observer.QueryGetChainNoncesRequest */ diff --git a/x/observer/client/cli/query.go b/x/observer/client/cli/query.go index 84b9c6c6e6..39f43847a7 100644 --- a/x/observer/client/cli/query.go +++ b/x/observer/client/cli/query.go @@ -41,6 +41,8 @@ func GetQueryCmd(_ string) *cobra.Command { CmdListChainNonces(), CmdShowChainNonces(), CmdListPendingNonces(), + CmdGetAllTssFundsMigrator(), + CmdGetTssFundsMigrator(), ) return cmd diff --git a/x/observer/client/cli/query_tss_fund_migrator.go b/x/observer/client/cli/query_tss_fund_migrator.go new file mode 100644 index 0000000000..a5483fde51 --- /dev/null +++ b/x/observer/client/cli/query_tss_fund_migrator.go @@ -0,0 +1,70 @@ +package cli + +import ( + "context" + "strconv" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func CmdGetTssFundsMigrator() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-tss-funds-migrator [chain-id]", + Short: "show the tss funds migrator for a chain", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + chainID, err := strconv.ParseInt(args[0], 10, 64) + if err != nil { + return err + } + params := &types.QueryTssFundsMigratorInfoRequest{ + ChainId: chainID, + } + + res, err := queryClient.TssFundsMigratorInfo(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} + +func CmdGetAllTssFundsMigrator() *cobra.Command { + cmd := &cobra.Command{ + Use: "list-tss-funds-migrator", + Short: "list all tss funds migrators", + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryTssFundsMigratorInfoAllRequest{} + + res, err := queryClient.TssFundsMigratorInfoAll(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddPaginationFlagsToCmd(cmd, cmd.Use) + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/observer/keeper/grpc_query_tss_funds_migrator_info.go b/x/observer/keeper/grpc_query_tss_funds_migrator_info.go new file mode 100644 index 0000000000..7a2ab7e357 --- /dev/null +++ b/x/observer/keeper/grpc_query_tss_funds_migrator_info.go @@ -0,0 +1,51 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// TssFundsMigratorInfo queries a tss fund migrator info +func (k Keeper) TssFundsMigratorInfo( + goCtx context.Context, + req *types.QueryTssFundsMigratorInfoRequest, +) (*types.QueryTssFundsMigratorInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + if chains.GetChainFromChainID(req.ChainId) == nil { + return nil, status.Error(codes.InvalidArgument, "invalid chain id") + } + + fm, found := k.GetFundMigrator(ctx, req.ChainId) + if !found { + return nil, status.Error(codes.NotFound, "tss fund migrator not found") + } + return &types.QueryTssFundsMigratorInfoResponse{ + TssFundsMigrator: fm, + }, nil +} + +// TssFundsMigratorInfoAll queries all tss fund migrator info for all chains +func (k Keeper) TssFundsMigratorInfoAll( + goCtx context.Context, + request *types.QueryTssFundsMigratorInfoAllRequest, +) (*types.QueryTssFundsMigratorInfoAllResponse, error) { + if request == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(goCtx) + + migrators := k.GetAllTssFundMigrators(ctx) + + return &types.QueryTssFundsMigratorInfoAllResponse{TssFundsMigrators: migrators}, nil +} diff --git a/x/observer/keeper/grpc_query_tss_funds_migrator_test.go b/x/observer/keeper/grpc_query_tss_funds_migrator_test.go new file mode 100644 index 0000000000..3882079f5d --- /dev/null +++ b/x/observer/keeper/grpc_query_tss_funds_migrator_test.go @@ -0,0 +1,104 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/pkg/chains" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +func TestKeeper_TssFundsMigratorInfo(t *testing.T) { + t.Run("should error if req is nil", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + + res, err := k.TssFundsMigratorInfo(wctx, nil) + require.ErrorContains(t, err, "invalid request") + require.Nil(t, res) + }) + + t.Run("should error if chain id is invalid", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + + res, err := k.TssFundsMigratorInfo(wctx, &types.QueryTssFundsMigratorInfoRequest{ + ChainId: 0, + }) + require.ErrorContains(t, err, "invalid chain id") + require.Nil(t, res) + }) + + t.Run("should error if not found", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + + res, err := k.TssFundsMigratorInfo(wctx, &types.QueryTssFundsMigratorInfoRequest{ + ChainId: chains.Ethereum.ChainId, + }) + require.ErrorContains(t, err, "tss fund migrator not found") + require.Nil(t, res) + }) + + t.Run("should return if found", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + chainId := chains.Ethereum.ChainId + + fm := types.TssFundMigratorInfo{ + ChainId: chainId, + MigrationCctxIndex: sample.ZetaIndex(t), + } + k.SetFundMigrator(ctx, fm) + + res, err := k.TssFundsMigratorInfo(wctx, &types.QueryTssFundsMigratorInfoRequest{ + ChainId: chainId, + }) + require.NoError(t, err) + require.Equal(t, fm, res.TssFundsMigrator) + }) +} + +func TestKeeper_TssFundsMigratorInfoAll(t *testing.T) { + t.Run("should error if req is nil", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + + res, err := k.TssFundsMigratorInfoAll(wctx, nil) + require.ErrorContains(t, err, "invalid request") + require.Nil(t, res) + }) + + t.Run("should return empty list if not found", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + + res, err := k.TssFundsMigratorInfoAll(wctx, &types.QueryTssFundsMigratorInfoAllRequest{}) + require.NoError(t, err) + require.Equal(t, 0, len(res.TssFundsMigrators)) + }) + + t.Run("should return list of infos if found", func(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + + migrators := make([]types.TssFundMigratorInfo, 3) + for i := 0; i < 3; i++ { + fm := types.TssFundMigratorInfo{ + ChainId: int64(i), + MigrationCctxIndex: sample.ZetaIndex(t), + } + k.SetFundMigrator(ctx, fm) + migrators[i] = fm + } + + res, err := k.TssFundsMigratorInfoAll(wctx, &types.QueryTssFundsMigratorInfoAllRequest{}) + require.NoError(t, err) + require.Equal(t, 3, len(res.TssFundsMigrators)) + require.ElementsMatch(t, migrators, res.TssFundsMigrators) + }) +} diff --git a/x/observer/types/query.pb.go b/x/observer/types/query.pb.go index 1c7b0178cc..38d676df2b 100644 --- a/x/observer/types/query.pb.go +++ b/x/observer/types/query.pb.go @@ -32,6 +32,174 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type QueryTssFundsMigratorInfoAllRequest struct { +} + +func (m *QueryTssFundsMigratorInfoAllRequest) Reset() { *m = QueryTssFundsMigratorInfoAllRequest{} } +func (m *QueryTssFundsMigratorInfoAllRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTssFundsMigratorInfoAllRequest) ProtoMessage() {} +func (*QueryTssFundsMigratorInfoAllRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_25b2aa420449a0c0, []int{0} +} +func (m *QueryTssFundsMigratorInfoAllRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTssFundsMigratorInfoAllRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTssFundsMigratorInfoAllRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTssFundsMigratorInfoAllRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTssFundsMigratorInfoAllRequest.Merge(m, src) +} +func (m *QueryTssFundsMigratorInfoAllRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTssFundsMigratorInfoAllRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTssFundsMigratorInfoAllRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTssFundsMigratorInfoAllRequest proto.InternalMessageInfo + +type QueryTssFundsMigratorInfoAllResponse struct { + TssFundsMigrators []TssFundMigratorInfo `protobuf:"bytes,1,rep,name=tss_funds_migrators,json=tssFundsMigrators,proto3" json:"tss_funds_migrators"` +} + +func (m *QueryTssFundsMigratorInfoAllResponse) Reset() { *m = QueryTssFundsMigratorInfoAllResponse{} } +func (m *QueryTssFundsMigratorInfoAllResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTssFundsMigratorInfoAllResponse) ProtoMessage() {} +func (*QueryTssFundsMigratorInfoAllResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_25b2aa420449a0c0, []int{1} +} +func (m *QueryTssFundsMigratorInfoAllResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTssFundsMigratorInfoAllResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTssFundsMigratorInfoAllResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTssFundsMigratorInfoAllResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTssFundsMigratorInfoAllResponse.Merge(m, src) +} +func (m *QueryTssFundsMigratorInfoAllResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTssFundsMigratorInfoAllResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTssFundsMigratorInfoAllResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTssFundsMigratorInfoAllResponse proto.InternalMessageInfo + +func (m *QueryTssFundsMigratorInfoAllResponse) GetTssFundsMigrators() []TssFundMigratorInfo { + if m != nil { + return m.TssFundsMigrators + } + return nil +} + +type QueryTssFundsMigratorInfoRequest struct { + ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +} + +func (m *QueryTssFundsMigratorInfoRequest) Reset() { *m = QueryTssFundsMigratorInfoRequest{} } +func (m *QueryTssFundsMigratorInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryTssFundsMigratorInfoRequest) ProtoMessage() {} +func (*QueryTssFundsMigratorInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_25b2aa420449a0c0, []int{2} +} +func (m *QueryTssFundsMigratorInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTssFundsMigratorInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTssFundsMigratorInfoRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTssFundsMigratorInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTssFundsMigratorInfoRequest.Merge(m, src) +} +func (m *QueryTssFundsMigratorInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryTssFundsMigratorInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTssFundsMigratorInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTssFundsMigratorInfoRequest proto.InternalMessageInfo + +func (m *QueryTssFundsMigratorInfoRequest) GetChainId() int64 { + if m != nil { + return m.ChainId + } + return 0 +} + +type QueryTssFundsMigratorInfoResponse struct { + TssFundsMigrator TssFundMigratorInfo `protobuf:"bytes,1,opt,name=tss_funds_migrator,json=tssFundsMigrator,proto3" json:"tss_funds_migrator"` +} + +func (m *QueryTssFundsMigratorInfoResponse) Reset() { *m = QueryTssFundsMigratorInfoResponse{} } +func (m *QueryTssFundsMigratorInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryTssFundsMigratorInfoResponse) ProtoMessage() {} +func (*QueryTssFundsMigratorInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_25b2aa420449a0c0, []int{3} +} +func (m *QueryTssFundsMigratorInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryTssFundsMigratorInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryTssFundsMigratorInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryTssFundsMigratorInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryTssFundsMigratorInfoResponse.Merge(m, src) +} +func (m *QueryTssFundsMigratorInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryTssFundsMigratorInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryTssFundsMigratorInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryTssFundsMigratorInfoResponse proto.InternalMessageInfo + +func (m *QueryTssFundsMigratorInfoResponse) GetTssFundsMigrator() TssFundMigratorInfo { + if m != nil { + return m.TssFundsMigrator + } + return TssFundMigratorInfo{} +} + type QueryGetChainNoncesRequest struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` } @@ -40,7 +208,7 @@ func (m *QueryGetChainNoncesRequest) Reset() { *m = QueryGetChainNoncesR func (m *QueryGetChainNoncesRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetChainNoncesRequest) ProtoMessage() {} func (*QueryGetChainNoncesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{0} + return fileDescriptor_25b2aa420449a0c0, []int{4} } func (m *QueryGetChainNoncesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -84,7 +252,7 @@ func (m *QueryGetChainNoncesResponse) Reset() { *m = QueryGetChainNonces func (m *QueryGetChainNoncesResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetChainNoncesResponse) ProtoMessage() {} func (*QueryGetChainNoncesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{1} + return fileDescriptor_25b2aa420449a0c0, []int{5} } func (m *QueryGetChainNoncesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -128,7 +296,7 @@ func (m *QueryAllChainNoncesRequest) Reset() { *m = QueryAllChainNoncesR func (m *QueryAllChainNoncesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllChainNoncesRequest) ProtoMessage() {} func (*QueryAllChainNoncesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{2} + return fileDescriptor_25b2aa420449a0c0, []int{6} } func (m *QueryAllChainNoncesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -173,7 +341,7 @@ func (m *QueryAllChainNoncesResponse) Reset() { *m = QueryAllChainNonces func (m *QueryAllChainNoncesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllChainNoncesResponse) ProtoMessage() {} func (*QueryAllChainNoncesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{3} + return fileDescriptor_25b2aa420449a0c0, []int{7} } func (m *QueryAllChainNoncesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -224,7 +392,7 @@ func (m *QueryAllPendingNoncesRequest) Reset() { *m = QueryAllPendingNon func (m *QueryAllPendingNoncesRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllPendingNoncesRequest) ProtoMessage() {} func (*QueryAllPendingNoncesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{4} + return fileDescriptor_25b2aa420449a0c0, []int{8} } func (m *QueryAllPendingNoncesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -269,7 +437,7 @@ func (m *QueryAllPendingNoncesResponse) Reset() { *m = QueryAllPendingNo func (m *QueryAllPendingNoncesResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllPendingNoncesResponse) ProtoMessage() {} func (*QueryAllPendingNoncesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{5} + return fileDescriptor_25b2aa420449a0c0, []int{9} } func (m *QueryAllPendingNoncesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -320,7 +488,7 @@ func (m *QueryPendingNoncesByChainRequest) Reset() { *m = QueryPendingNo func (m *QueryPendingNoncesByChainRequest) String() string { return proto.CompactTextString(m) } func (*QueryPendingNoncesByChainRequest) ProtoMessage() {} func (*QueryPendingNoncesByChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{6} + return fileDescriptor_25b2aa420449a0c0, []int{10} } func (m *QueryPendingNoncesByChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -364,7 +532,7 @@ func (m *QueryPendingNoncesByChainResponse) Reset() { *m = QueryPendingN func (m *QueryPendingNoncesByChainResponse) String() string { return proto.CompactTextString(m) } func (*QueryPendingNoncesByChainResponse) ProtoMessage() {} func (*QueryPendingNoncesByChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{7} + return fileDescriptor_25b2aa420449a0c0, []int{11} } func (m *QueryPendingNoncesByChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -407,7 +575,7 @@ func (m *QueryGetTSSRequest) Reset() { *m = QueryGetTSSRequest{} } func (m *QueryGetTSSRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetTSSRequest) ProtoMessage() {} func (*QueryGetTSSRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{8} + return fileDescriptor_25b2aa420449a0c0, []int{12} } func (m *QueryGetTSSRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -444,7 +612,7 @@ func (m *QueryGetTSSResponse) Reset() { *m = QueryGetTSSResponse{} } func (m *QueryGetTSSResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetTSSResponse) ProtoMessage() {} func (*QueryGetTSSResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{9} + return fileDescriptor_25b2aa420449a0c0, []int{13} } func (m *QueryGetTSSResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -488,7 +656,7 @@ func (m *QueryGetTssAddressRequest) Reset() { *m = QueryGetTssAddressReq func (m *QueryGetTssAddressRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetTssAddressRequest) ProtoMessage() {} func (*QueryGetTssAddressRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{10} + return fileDescriptor_25b2aa420449a0c0, []int{14} } func (m *QueryGetTssAddressRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -533,7 +701,7 @@ func (m *QueryGetTssAddressResponse) Reset() { *m = QueryGetTssAddressRe func (m *QueryGetTssAddressResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetTssAddressResponse) ProtoMessage() {} func (*QueryGetTssAddressResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{11} + return fileDescriptor_25b2aa420449a0c0, []int{15} } func (m *QueryGetTssAddressResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -589,7 +757,7 @@ func (m *QueryGetTssAddressByFinalizedHeightRequest) String() string { } func (*QueryGetTssAddressByFinalizedHeightRequest) ProtoMessage() {} func (*QueryGetTssAddressByFinalizedHeightRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{12} + return fileDescriptor_25b2aa420449a0c0, []int{16} } func (m *QueryGetTssAddressByFinalizedHeightRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -645,7 +813,7 @@ func (m *QueryGetTssAddressByFinalizedHeightResponse) String() string { } func (*QueryGetTssAddressByFinalizedHeightResponse) ProtoMessage() {} func (*QueryGetTssAddressByFinalizedHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{13} + return fileDescriptor_25b2aa420449a0c0, []int{17} } func (m *QueryGetTssAddressByFinalizedHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -696,7 +864,7 @@ func (m *QueryTssHistoryRequest) Reset() { *m = QueryTssHistoryRequest{} func (m *QueryTssHistoryRequest) String() string { return proto.CompactTextString(m) } func (*QueryTssHistoryRequest) ProtoMessage() {} func (*QueryTssHistoryRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{14} + return fileDescriptor_25b2aa420449a0c0, []int{18} } func (m *QueryTssHistoryRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -741,7 +909,7 @@ func (m *QueryTssHistoryResponse) Reset() { *m = QueryTssHistoryResponse func (m *QueryTssHistoryResponse) String() string { return proto.CompactTextString(m) } func (*QueryTssHistoryResponse) ProtoMessage() {} func (*QueryTssHistoryResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{15} + return fileDescriptor_25b2aa420449a0c0, []int{19} } func (m *QueryTssHistoryResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -793,7 +961,7 @@ func (m *QueryHasVotedRequest) Reset() { *m = QueryHasVotedRequest{} } func (m *QueryHasVotedRequest) String() string { return proto.CompactTextString(m) } func (*QueryHasVotedRequest) ProtoMessage() {} func (*QueryHasVotedRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{16} + return fileDescriptor_25b2aa420449a0c0, []int{20} } func (m *QueryHasVotedRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -844,7 +1012,7 @@ func (m *QueryHasVotedResponse) Reset() { *m = QueryHasVotedResponse{} } func (m *QueryHasVotedResponse) String() string { return proto.CompactTextString(m) } func (*QueryHasVotedResponse) ProtoMessage() {} func (*QueryHasVotedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{17} + return fileDescriptor_25b2aa420449a0c0, []int{21} } func (m *QueryHasVotedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -888,7 +1056,7 @@ func (m *QueryBallotByIdentifierRequest) Reset() { *m = QueryBallotByIde func (m *QueryBallotByIdentifierRequest) String() string { return proto.CompactTextString(m) } func (*QueryBallotByIdentifierRequest) ProtoMessage() {} func (*QueryBallotByIdentifierRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{18} + return fileDescriptor_25b2aa420449a0c0, []int{22} } func (m *QueryBallotByIdentifierRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -933,7 +1101,7 @@ func (m *VoterList) Reset() { *m = VoterList{} } func (m *VoterList) String() string { return proto.CompactTextString(m) } func (*VoterList) ProtoMessage() {} func (*VoterList) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{19} + return fileDescriptor_25b2aa420449a0c0, []int{23} } func (m *VoterList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -987,7 +1155,7 @@ func (m *QueryBallotByIdentifierResponse) Reset() { *m = QueryBallotById func (m *QueryBallotByIdentifierResponse) String() string { return proto.CompactTextString(m) } func (*QueryBallotByIdentifierResponse) ProtoMessage() {} func (*QueryBallotByIdentifierResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{20} + return fileDescriptor_25b2aa420449a0c0, []int{24} } func (m *QueryBallotByIdentifierResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1051,7 +1219,7 @@ func (m *QueryObserverSet) Reset() { *m = QueryObserverSet{} } func (m *QueryObserverSet) String() string { return proto.CompactTextString(m) } func (*QueryObserverSet) ProtoMessage() {} func (*QueryObserverSet) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{21} + return fileDescriptor_25b2aa420449a0c0, []int{25} } func (m *QueryObserverSet) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1088,7 +1256,7 @@ func (m *QueryObserverSetResponse) Reset() { *m = QueryObserverSetRespon func (m *QueryObserverSetResponse) String() string { return proto.CompactTextString(m) } func (*QueryObserverSetResponse) ProtoMessage() {} func (*QueryObserverSetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{22} + return fileDescriptor_25b2aa420449a0c0, []int{26} } func (m *QueryObserverSetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1131,7 +1299,7 @@ func (m *QuerySupportedChains) Reset() { *m = QuerySupportedChains{} } func (m *QuerySupportedChains) String() string { return proto.CompactTextString(m) } func (*QuerySupportedChains) ProtoMessage() {} func (*QuerySupportedChains) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{23} + return fileDescriptor_25b2aa420449a0c0, []int{27} } func (m *QuerySupportedChains) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1168,7 +1336,7 @@ func (m *QuerySupportedChainsResponse) Reset() { *m = QuerySupportedChai func (m *QuerySupportedChainsResponse) String() string { return proto.CompactTextString(m) } func (*QuerySupportedChainsResponse) ProtoMessage() {} func (*QuerySupportedChainsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{24} + return fileDescriptor_25b2aa420449a0c0, []int{28} } func (m *QuerySupportedChainsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1212,7 +1380,7 @@ func (m *QueryGetChainParamsForChainRequest) Reset() { *m = QueryGetChai func (m *QueryGetChainParamsForChainRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetChainParamsForChainRequest) ProtoMessage() {} func (*QueryGetChainParamsForChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{25} + return fileDescriptor_25b2aa420449a0c0, []int{29} } func (m *QueryGetChainParamsForChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1256,7 +1424,7 @@ func (m *QueryGetChainParamsForChainResponse) Reset() { *m = QueryGetCha func (m *QueryGetChainParamsForChainResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetChainParamsForChainResponse) ProtoMessage() {} func (*QueryGetChainParamsForChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{26} + return fileDescriptor_25b2aa420449a0c0, []int{30} } func (m *QueryGetChainParamsForChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1299,7 +1467,7 @@ func (m *QueryGetChainParamsRequest) Reset() { *m = QueryGetChainParamsR func (m *QueryGetChainParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetChainParamsRequest) ProtoMessage() {} func (*QueryGetChainParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{27} + return fileDescriptor_25b2aa420449a0c0, []int{31} } func (m *QueryGetChainParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1336,7 +1504,7 @@ func (m *QueryGetChainParamsResponse) Reset() { *m = QueryGetChainParams func (m *QueryGetChainParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetChainParamsResponse) ProtoMessage() {} func (*QueryGetChainParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{28} + return fileDescriptor_25b2aa420449a0c0, []int{32} } func (m *QueryGetChainParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1380,7 +1548,7 @@ func (m *QueryGetNodeAccountRequest) Reset() { *m = QueryGetNodeAccountR func (m *QueryGetNodeAccountRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetNodeAccountRequest) ProtoMessage() {} func (*QueryGetNodeAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{29} + return fileDescriptor_25b2aa420449a0c0, []int{33} } func (m *QueryGetNodeAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1424,7 +1592,7 @@ func (m *QueryGetNodeAccountResponse) Reset() { *m = QueryGetNodeAccount func (m *QueryGetNodeAccountResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetNodeAccountResponse) ProtoMessage() {} func (*QueryGetNodeAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{30} + return fileDescriptor_25b2aa420449a0c0, []int{34} } func (m *QueryGetNodeAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1468,7 +1636,7 @@ func (m *QueryAllNodeAccountRequest) Reset() { *m = QueryAllNodeAccountR func (m *QueryAllNodeAccountRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllNodeAccountRequest) ProtoMessage() {} func (*QueryAllNodeAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{31} + return fileDescriptor_25b2aa420449a0c0, []int{35} } func (m *QueryAllNodeAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1513,7 +1681,7 @@ func (m *QueryAllNodeAccountResponse) Reset() { *m = QueryAllNodeAccount func (m *QueryAllNodeAccountResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllNodeAccountResponse) ProtoMessage() {} func (*QueryAllNodeAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{32} + return fileDescriptor_25b2aa420449a0c0, []int{36} } func (m *QueryAllNodeAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1563,7 +1731,7 @@ func (m *QueryGetCrosschainFlagsRequest) Reset() { *m = QueryGetCrosscha func (m *QueryGetCrosschainFlagsRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetCrosschainFlagsRequest) ProtoMessage() {} func (*QueryGetCrosschainFlagsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{33} + return fileDescriptor_25b2aa420449a0c0, []int{37} } func (m *QueryGetCrosschainFlagsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1600,7 +1768,7 @@ func (m *QueryGetCrosschainFlagsResponse) Reset() { *m = QueryGetCrossch func (m *QueryGetCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetCrosschainFlagsResponse) ProtoMessage() {} func (*QueryGetCrosschainFlagsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{34} + return fileDescriptor_25b2aa420449a0c0, []int{38} } func (m *QueryGetCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1643,7 +1811,7 @@ func (m *QueryGetKeygenRequest) Reset() { *m = QueryGetKeygenRequest{} } func (m *QueryGetKeygenRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetKeygenRequest) ProtoMessage() {} func (*QueryGetKeygenRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{35} + return fileDescriptor_25b2aa420449a0c0, []int{39} } func (m *QueryGetKeygenRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1680,7 +1848,7 @@ func (m *QueryGetKeygenResponse) Reset() { *m = QueryGetKeygenResponse{} func (m *QueryGetKeygenResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetKeygenResponse) ProtoMessage() {} func (*QueryGetKeygenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{36} + return fileDescriptor_25b2aa420449a0c0, []int{40} } func (m *QueryGetKeygenResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1723,7 +1891,7 @@ func (m *QueryShowObserverCountRequest) Reset() { *m = QueryShowObserver func (m *QueryShowObserverCountRequest) String() string { return proto.CompactTextString(m) } func (*QueryShowObserverCountRequest) ProtoMessage() {} func (*QueryShowObserverCountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{37} + return fileDescriptor_25b2aa420449a0c0, []int{41} } func (m *QueryShowObserverCountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1760,7 +1928,7 @@ func (m *QueryShowObserverCountResponse) Reset() { *m = QueryShowObserve func (m *QueryShowObserverCountResponse) String() string { return proto.CompactTextString(m) } func (*QueryShowObserverCountResponse) ProtoMessage() {} func (*QueryShowObserverCountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{38} + return fileDescriptor_25b2aa420449a0c0, []int{42} } func (m *QueryShowObserverCountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1804,7 +1972,7 @@ func (m *QueryBlameByIdentifierRequest) Reset() { *m = QueryBlameByIdent func (m *QueryBlameByIdentifierRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlameByIdentifierRequest) ProtoMessage() {} func (*QueryBlameByIdentifierRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{39} + return fileDescriptor_25b2aa420449a0c0, []int{43} } func (m *QueryBlameByIdentifierRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1848,7 +2016,7 @@ func (m *QueryBlameByIdentifierResponse) Reset() { *m = QueryBlameByIden func (m *QueryBlameByIdentifierResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlameByIdentifierResponse) ProtoMessage() {} func (*QueryBlameByIdentifierResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{40} + return fileDescriptor_25b2aa420449a0c0, []int{44} } func (m *QueryBlameByIdentifierResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1892,7 +2060,7 @@ func (m *QueryAllBlameRecordsRequest) Reset() { *m = QueryAllBlameRecord func (m *QueryAllBlameRecordsRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllBlameRecordsRequest) ProtoMessage() {} func (*QueryAllBlameRecordsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{41} + return fileDescriptor_25b2aa420449a0c0, []int{45} } func (m *QueryAllBlameRecordsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1937,7 +2105,7 @@ func (m *QueryAllBlameRecordsResponse) Reset() { *m = QueryAllBlameRecor func (m *QueryAllBlameRecordsResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllBlameRecordsResponse) ProtoMessage() {} func (*QueryAllBlameRecordsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{42} + return fileDescriptor_25b2aa420449a0c0, []int{46} } func (m *QueryAllBlameRecordsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1989,7 +2157,7 @@ func (m *QueryBlameByChainAndNonceRequest) Reset() { *m = QueryBlameByCh func (m *QueryBlameByChainAndNonceRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlameByChainAndNonceRequest) ProtoMessage() {} func (*QueryBlameByChainAndNonceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{43} + return fileDescriptor_25b2aa420449a0c0, []int{47} } func (m *QueryBlameByChainAndNonceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2040,7 +2208,7 @@ func (m *QueryBlameByChainAndNonceResponse) Reset() { *m = QueryBlameByC func (m *QueryBlameByChainAndNonceResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlameByChainAndNonceResponse) ProtoMessage() {} func (*QueryBlameByChainAndNonceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_25b2aa420449a0c0, []int{44} + return fileDescriptor_25b2aa420449a0c0, []int{48} } func (m *QueryBlameByChainAndNonceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2077,6 +2245,10 @@ func (m *QueryBlameByChainAndNonceResponse) GetBlameInfo() []*Blame { } func init() { + proto.RegisterType((*QueryTssFundsMigratorInfoAllRequest)(nil), "zetachain.zetacore.observer.QueryTssFundsMigratorInfoAllRequest") + proto.RegisterType((*QueryTssFundsMigratorInfoAllResponse)(nil), "zetachain.zetacore.observer.QueryTssFundsMigratorInfoAllResponse") + proto.RegisterType((*QueryTssFundsMigratorInfoRequest)(nil), "zetachain.zetacore.observer.QueryTssFundsMigratorInfoRequest") + proto.RegisterType((*QueryTssFundsMigratorInfoResponse)(nil), "zetachain.zetacore.observer.QueryTssFundsMigratorInfoResponse") proto.RegisterType((*QueryGetChainNoncesRequest)(nil), "zetachain.zetacore.observer.QueryGetChainNoncesRequest") proto.RegisterType((*QueryGetChainNoncesResponse)(nil), "zetachain.zetacore.observer.QueryGetChainNoncesResponse") proto.RegisterType((*QueryAllChainNoncesRequest)(nil), "zetachain.zetacore.observer.QueryAllChainNoncesRequest") @@ -2129,140 +2301,150 @@ func init() { } var fileDescriptor_25b2aa420449a0c0 = []byte{ - // 2128 bytes of a gzipped FileDescriptorProto + // 2284 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5a, 0xcf, 0x6f, 0x1b, 0xc7, - 0x15, 0xf6, 0x4a, 0x89, 0x22, 0x3d, 0xd9, 0x92, 0x3c, 0x96, 0x1d, 0x87, 0x76, 0x64, 0x79, 0x65, - 0xc7, 0xb2, 0x62, 0x73, 0x6d, 0x3a, 0xa9, 0x7f, 0xc7, 0x16, 0xdd, 0x58, 0xb2, 0x93, 0xda, 0x0e, - 0xa9, 0x36, 0x80, 0x91, 0x96, 0x5d, 0x92, 0x43, 0x72, 0xeb, 0xd5, 0x0e, 0xb3, 0x33, 0x72, 0xc2, - 0xa8, 0x02, 0x8a, 0x1e, 0x73, 0x2a, 0x50, 0xa0, 0xbd, 0x15, 0xbd, 0xf4, 0x58, 0xa0, 0x08, 0x50, - 0xb4, 0x40, 0xd1, 0x43, 0x4e, 0xcd, 0xa1, 0x87, 0x14, 0x05, 0x8a, 0x9e, 0xda, 0xc0, 0xee, 0xff, - 0xd1, 0x62, 0x67, 0xde, 0x92, 0xbb, 0xcb, 0xe5, 0x72, 0x28, 0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x7e, 0x15, 0x41, 0x49, 0x63, 0x7d, 0x05, - 0xa8, 0xe2, 0x95, 0xa6, 0x6b, 0xbd, 0x1b, 0xf3, 0x78, 0x42, 0xa0, 0xa2, 0x0d, 0x56, 0x3e, 0x2f, - 0x21, 0x45, 0xc3, 0xa7, 0x88, 0xe4, 0x61, 0x2a, 0x92, 0x73, 0xba, 0x48, 0xe4, 0x50, 0x8d, 0xa1, - 0x89, 0xc8, 0xe5, 0x07, 0xac, 0x4e, 0x57, 0xd5, 0x96, 0x22, 0x5b, 0x2e, 0xff, 0xa8, 0x87, 0x31, - 0xe6, 0xd3, 0xcb, 0x56, 0x74, 0x7b, 0xa2, 0x95, 0xad, 0x68, 0x9c, 0x69, 0xaf, 0x77, 0x13, 0x55, - 0xca, 0x29, 0xf8, 0xf6, 0xaa, 0xa6, 0x7c, 0x11, 0x51, 0xca, 0x69, 0x94, 0xee, 0xc3, 0x74, 0xa4, - 0x59, 0x4b, 0x29, 0xc7, 0x18, 0x45, 0x6e, 0xf6, 0xae, 0xc0, 0x2c, 0xe2, 0x02, 0x1e, 0x0c, 0x95, - 0xee, 0x66, 0xf3, 0x6e, 0xb0, 0xd7, 0x0c, 0x07, 0xd3, 0x4f, 0x0c, 0x5c, 0x1d, 0xd3, 0x4c, 0x90, - 0xda, 0xf7, 0x61, 0x2e, 0xb9, 0x55, 0xd5, 0x1b, 0x55, 0xf1, 0x78, 0x58, 0x46, 0x67, 0x6b, 0xf1, - 0x66, 0xf3, 0x55, 0xac, 0x4d, 0x6b, 0x54, 0xbc, 0x27, 0x77, 0xb7, 0x21, 0xb6, 0xef, 0xa2, 0x50, - 0x88, 0x3c, 0x40, 0x44, 0xd7, 0x61, 0x42, 0x6d, 0x84, 0x11, 0xc7, 0x52, 0x26, 0x0e, 0x74, 0x46, - 0x17, 0xf3, 0x04, 0xea, 0xf9, 0x72, 0x8b, 0x7d, 0x12, 0x2e, 0x63, 0x77, 0x22, 0x43, 0x26, 0xc8, - 0xc9, 0xc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 0xc9, 0x79, 0xc9, 0xe4, 0x0c, 0x39, - 0xad, 0xc5, 0x24, 0x00, 0x1d, 0x13, 0x49, 0x7a, 0x88, 0xfb, 0x15, 0xa1, 0x26, 0xe2, 0x14, 0x8d, - 0x67, 0x5e, 0x90, 0x88, 0x57, 0xc8, 0x72, 0x2a, 0xe2, 0x88, 0x26, 0xb5, 0xb6, 0xa5, 0x0c, 0xde, - 0x09, 0xc6, 0xfe, 0x4c, 0x24, 0xd2, 0xaa, 0xeb, 0xea, 0xe0, 0x4e, 0x55, 0xb2, 0x3a, 0xb8, 0xd3, - 0xb5, 0xa9, 0xb9, 0x2c, 0x71, 0x9b, 0x64, 0x71, 0x18, 0x6e, 0xf2, 0x27, 0x03, 0x66, 0x13, 0xb2, - 0x4d, 0x67, 0x89, 0x1c, 0xa8, 0x2f, 0x75, 0x96, 0xc8, 0xc1, 0xca, 0x73, 0xc8, 0x10, 0x49, 0x8a, - 0x52, 0xf2, 0x0b, 0x03, 0x26, 0x94, 0xd8, 0x23, 0x05, 0xad, 0x7e, 0x63, 0x7a, 0x33, 0x77, 0x69, - 0x24, 0x1f, 0x84, 0xb8, 0x24, 0x21, 0xbe, 0x4e, 0x8e, 0xa5, 0x42, 0x54, 0x92, 0x93, 0xfc, 0xc5, - 0x80, 0x83, 0x7d, 0x62, 0x92, 0x5c, 0xd3, 0x58, 0xd1, 0x06, 0x68, 0xd4, 0xdc, 0xf5, 0x5d, 0xf9, - 0x22, 0xe6, 0xab, 0x12, 0xf3, 0x25, 0x72, 0x31, 0x8a, 0xb9, 0xff, 0x24, 0x86, 0xb7, 0xd8, 0x27, - 0x09, 0x85, 0x4b, 0xfe, 0x66, 0xc0, 0xc1, 0x3e, 0x21, 0xa9, 0xc3, 0x64, 0x90, 0x92, 0xd5, 0x61, - 0x32, 0x50, 0xb9, 0x9a, 0x77, 0x24, 0x93, 0x9b, 0xe4, 0x7a, 0x7a, 0x0d, 0x95, 0xea, 0x27, 0x59, - 0x42, 0x13, 0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, + 0xb3, 0x81, 0x46, 0x03, 0xf5, 0x88, 0x2f, 0x64, 0x7a, 0x49, 0xd2, 0xb4, 0xb9, 0xd5, 0x41, 0x4c, + 0x14, 0x01, 0x72, 0xef, 0x27, 0x7f, 0xff, 0xef, 0x2f, 0x86, 0xbe, 0x8d, 0x0b, 0x72, 0x83, 0xed, + 0x9c, 0xda, 0x6b, 0xeb, 0x6c, 0xb1, 0x75, 0x74, 0xab, 0xb9, 0xd3, 0x23, 0xde, 0x76, 0xcd, 0x9d, + 0x88, 0xba, 0xdc, 0xc5, 0xff, 0x34, 0x10, 0xee, 0x55, 0x80, 0xf8, 0x7a, 0x7f, 0x58, 0xa9, 0xea, + 0x37, 0x77, 0x63, 0x6f, 0xc6, 0xc0, 0xee, 0x6d, 0xc9, 0xee, 0x16, 0xbe, 0x99, 0xc8, 0x0e, 0x28, + 0x55, 0xda, 0x21, 0x56, 0x49, 0x44, 0xf1, 0xaf, 0x0d, 0x34, 0x1e, 0x52, 0x63, 0xf8, 0x5c, 0x7f, + 0x50, 0xa1, 0xee, 0xb9, 0x37, 0x07, 0xea, 0xde, 0x01, 0x7f, 0x56, 0x82, 0x5f, 0xc0, 0xa7, 0x12, + 0xc1, 0x77, 0xd2, 0x22, 0xa7, 0x02, 0xff, 0xd6, 0x40, 0x93, 0x31, 0x71, 0xa7, 0x33, 0x81, 0x62, + 0x26, 0xb9, 0xab, 0x03, 0x9b, 0x74, 0xc0, 0xae, 0x48, 0xb0, 0xaf, 0xe3, 0xc5, 0x44, 0xb0, 0x3c, + 0x86, 0xed, 0x3f, 0x06, 0x3a, 0x9a, 0xac, 0xf6, 0xf0, 0xad, 0xfe, 0x18, 0x32, 0x85, 0x66, 0xee, + 0xf6, 0xde, 0x1d, 0x00, 0x97, 0x82, 0xe4, 0x72, 0x03, 0x5f, 0x4b, 0xe4, 0xd2, 0xa0, 0xa2, 0x1c, + 0x56, 0x7f, 0xe5, 0x3a, 0xf3, 0x54, 0x83, 0xb9, 0x13, 0x64, 0x98, 0x5d, 0xfc, 0x85, 0x81, 0x26, + 0xa2, 0xc3, 0xe0, 0xcb, 0x83, 0x02, 0x0b, 0x18, 0x5d, 0x19, 0xdc, 0x10, 0x98, 0x9c, 0x93, 0x4c, + 0xce, 0xe0, 0xd3, 0x5a, 0x4c, 0x7c, 0xd0, 0x11, 0x91, 0xa4, 0x87, 0xb8, 0x57, 0x11, 0x6a, 0x22, + 0x4e, 0xd0, 0x78, 0xe4, 0xbc, 0x44, 0xbc, 0x8c, 0x97, 0x12, 0x11, 0x87, 0x34, 0xa9, 0xb9, 0x23, + 0x65, 0xf0, 0xae, 0x3f, 0xf7, 0x27, 0x42, 0x9e, 0xd6, 0x1c, 0x47, 0x07, 0x77, 0xa2, 0x92, 0xd5, + 0xc1, 0x9d, 0xac, 0x4d, 0xc9, 0x92, 0xc4, 0x4d, 0xf0, 0x7c, 0x3f, 0xdc, 0xf8, 0x4f, 0x06, 0x9a, + 0x8c, 0xc9, 0x36, 0x9d, 0x14, 0x99, 0xaa, 0x2f, 0x75, 0x52, 0x64, 0xba, 0xf2, 0xec, 0x33, 0x45, + 0xe2, 0xa2, 0x14, 0xff, 0xd2, 0x40, 0x23, 0x4a, 0xec, 0xe1, 0x55, 0xad, 0x71, 0x23, 0x7a, 0x33, + 0x77, 0x71, 0x20, 0x1b, 0x80, 0xb8, 0x20, 0x21, 0xbe, 0x86, 0x8f, 0x27, 0x42, 0x54, 0x92, 0x13, + 0xff, 0xc5, 0x40, 0xd3, 0x3d, 0x62, 0x12, 0x5f, 0xd3, 0xc8, 0x68, 0x29, 0x1a, 0x35, 0x77, 0x7d, + 0x4f, 0xb6, 0x80, 0xf9, 0xaa, 0xc4, 0x7c, 0x11, 0x5f, 0x08, 0x63, 0xee, 0x3d, 0xc3, 0xe2, 0x4d, + 0xf6, 0x71, 0x4c, 0xe1, 0xe2, 0xbf, 0x19, 0x68, 0xba, 0x47, 0x48, 0xea, 0x30, 0x49, 0x53, 0xb2, + 0x3a, 0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df, 0xde, + 0x1b, 0x9a, 0xee, 0x07, 0x43, 0xb9, 0xb5, 0x17, 0xf0, 0x00, 0x94, 0x2e, 0x49, 0x4a, 0x79, 0xbc, + 0x92, 0x46, 0x69, 0xcd, 0x71, 0xe2, 0x3e, 0x78, 0xe1, 0xee, 0x57, 0xcf, 0xe6, 0x8c, 0xaf, 0x9f, + 0xcd, 0x19, 0xdf, 0x3c, 0x9b, 0x33, 0x7e, 0xfe, 0x7c, 0xee, 0xc0, 0xd7, 0xcf, 0xe7, 0x0e, 0xfc, + 0xeb, 0xf9, 0xdc, 0x81, 0xc7, 0x66, 0xc3, 0x16, 0xcd, 0xed, 0x4a, 0xbe, 0xca, 0xb6, 0x12, 0x85, + 0xe6, 0x27, 0xa1, 0xe4, 0xd6, 0x6e, 0x51, 0x5e, 0x19, 0x91, 0x9f, 0x48, 0x5d, 0xfc, 0x5f, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xc1, 0xd9, 0x00, 0xc6, 0x18, 0x28, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2315,6 +2497,10 @@ type QueryClient interface { ChainNonces(ctx context.Context, in *QueryGetChainNoncesRequest, opts ...grpc.CallOption) (*QueryGetChainNoncesResponse, error) // Queries a list of chainNonces items. ChainNoncesAll(ctx context.Context, in *QueryAllChainNoncesRequest, opts ...grpc.CallOption) (*QueryAllChainNoncesResponse, error) + // Queries the TssFundMigratorInfo for a specific chain + TssFundsMigratorInfo(ctx context.Context, in *QueryTssFundsMigratorInfoRequest, opts ...grpc.CallOption) (*QueryTssFundsMigratorInfoResponse, error) + // Queries all TssFundMigratorInfo + TssFundsMigratorInfoAll(ctx context.Context, in *QueryTssFundsMigratorInfoAllRequest, opts ...grpc.CallOption) (*QueryTssFundsMigratorInfoAllResponse, error) } type queryClient struct { @@ -2523,6 +2709,24 @@ func (c *queryClient) ChainNoncesAll(ctx context.Context, in *QueryAllChainNonce return out, nil } +func (c *queryClient) TssFundsMigratorInfo(ctx context.Context, in *QueryTssFundsMigratorInfoRequest, opts ...grpc.CallOption) (*QueryTssFundsMigratorInfoResponse, error) { + out := new(QueryTssFundsMigratorInfoResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/TssFundsMigratorInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) TssFundsMigratorInfoAll(ctx context.Context, in *QueryTssFundsMigratorInfoAllRequest, opts ...grpc.CallOption) (*QueryTssFundsMigratorInfoAllResponse, error) { + out := new(QueryTssFundsMigratorInfoAllResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/TssFundsMigratorInfoAll", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Query if a voter has voted for a ballot @@ -2563,6 +2767,10 @@ type QueryServer interface { ChainNonces(context.Context, *QueryGetChainNoncesRequest) (*QueryGetChainNoncesResponse, error) // Queries a list of chainNonces items. ChainNoncesAll(context.Context, *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error) + // Queries the TssFundMigratorInfo for a specific chain + TssFundsMigratorInfo(context.Context, *QueryTssFundsMigratorInfoRequest) (*QueryTssFundsMigratorInfoResponse, error) + // Queries all TssFundMigratorInfo + TssFundsMigratorInfoAll(context.Context, *QueryTssFundsMigratorInfoAllRequest) (*QueryTssFundsMigratorInfoAllResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -2635,6 +2843,12 @@ func (*UnimplementedQueryServer) ChainNonces(ctx context.Context, req *QueryGetC func (*UnimplementedQueryServer) ChainNoncesAll(ctx context.Context, req *QueryAllChainNoncesRequest) (*QueryAllChainNoncesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChainNoncesAll not implemented") } +func (*UnimplementedQueryServer) TssFundsMigratorInfo(ctx context.Context, req *QueryTssFundsMigratorInfoRequest) (*QueryTssFundsMigratorInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TssFundsMigratorInfo not implemented") +} +func (*UnimplementedQueryServer) TssFundsMigratorInfoAll(ctx context.Context, req *QueryTssFundsMigratorInfoAllRequest) (*QueryTssFundsMigratorInfoAllResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TssFundsMigratorInfoAll not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -3036,6 +3250,42 @@ func _Query_ChainNoncesAll_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Query_TssFundsMigratorInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTssFundsMigratorInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TssFundsMigratorInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/TssFundsMigratorInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TssFundsMigratorInfo(ctx, req.(*QueryTssFundsMigratorInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_TssFundsMigratorInfoAll_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTssFundsMigratorInfoAllRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).TssFundsMigratorInfoAll(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/TssFundsMigratorInfoAll", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).TssFundsMigratorInfoAll(ctx, req.(*QueryTssFundsMigratorInfoAllRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.observer.Query", HandlerType: (*QueryServer)(nil), @@ -3128,12 +3378,20 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "ChainNoncesAll", Handler: _Query_ChainNoncesAll_Handler, }, + { + MethodName: "TssFundsMigratorInfo", + Handler: _Query_TssFundsMigratorInfo_Handler, + }, + { + MethodName: "TssFundsMigratorInfoAll", + Handler: _Query_TssFundsMigratorInfoAll_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "zetachain/zetacore/observer/query.proto", } -func (m *QueryGetChainNoncesRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryTssFundsMigratorInfoAllRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3143,27 +3401,20 @@ func (m *QueryGetChainNoncesRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetChainNoncesRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryTssFundsMigratorInfoAllRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetChainNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryTssFundsMigratorInfoAllRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Index) > 0 { - i -= len(m.Index) - copy(dAtA[i:], m.Index) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } -func (m *QueryGetChainNoncesResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryTssFundsMigratorInfoAllResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -3173,25 +3424,153 @@ func (m *QueryGetChainNoncesResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryGetChainNoncesResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryTssFundsMigratorInfoAllResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryGetChainNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryTssFundsMigratorInfoAllResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.ChainNonces.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- + if len(m.TssFundsMigrators) > 0 { + for iNdEx := len(m.TssFundsMigrators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TssFundsMigrators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryTssFundsMigratorInfoRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTssFundsMigratorInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTssFundsMigratorInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryTssFundsMigratorInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryTssFundsMigratorInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryTssFundsMigratorInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.TssFundsMigrator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGetChainNoncesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetChainNoncesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetChainNoncesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Index) > 0 { + i -= len(m.Index) + copy(dAtA[i:], m.Index) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Index))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetChainNoncesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGetChainNoncesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetChainNoncesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ChainNonces.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -4676,6 +5055,53 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *QueryTssFundsMigratorInfoAllRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryTssFundsMigratorInfoAllResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.TssFundsMigrators) > 0 { + for _, e := range m.TssFundsMigrators { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryTssFundsMigratorInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) + } + return n +} + +func (m *QueryTssFundsMigratorInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.TssFundsMigrator.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func (m *QueryGetChainNoncesRequest) Size() (n int) { if m == nil { return 0 @@ -5294,6 +5720,292 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *QueryTssFundsMigratorInfoAllRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTssFundsMigratorInfoAllRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTssFundsMigratorInfoAllRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTssFundsMigratorInfoAllResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTssFundsMigratorInfoAllResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTssFundsMigratorInfoAllResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TssFundsMigrators", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TssFundsMigrators = append(m.TssFundsMigrators, TssFundMigratorInfo{}) + if err := m.TssFundsMigrators[len(m.TssFundsMigrators)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTssFundsMigratorInfoRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTssFundsMigratorInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTssFundsMigratorInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryTssFundsMigratorInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryTssFundsMigratorInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryTssFundsMigratorInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TssFundsMigrator", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.TssFundsMigrator.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryGetChainNoncesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/observer/types/query.pb.gw.go b/x/observer/types/query.pb.gw.go index fc62c63354..0c1295a13f 100644 --- a/x/observer/types/query.pb.gw.go +++ b/x/observer/types/query.pb.gw.go @@ -945,6 +945,60 @@ func local_request_Query_ChainNoncesAll_0(ctx context.Context, marshaler runtime } +var ( + filter_Query_TssFundsMigratorInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_TssFundsMigratorInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTssFundsMigratorInfoRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TssFundsMigratorInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.TssFundsMigratorInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TssFundsMigratorInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTssFundsMigratorInfoRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_TssFundsMigratorInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.TssFundsMigratorInfo(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_TssFundsMigratorInfoAll_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTssFundsMigratorInfoAllRequest + var metadata runtime.ServerMetadata + + msg, err := client.TssFundsMigratorInfoAll(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_TssFundsMigratorInfoAll_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryTssFundsMigratorInfoAllRequest + var metadata runtime.ServerMetadata + + msg, err := server.TssFundsMigratorInfoAll(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -1457,6 +1511,52 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_TssFundsMigratorInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TssFundsMigratorInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TssFundsMigratorInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TssFundsMigratorInfoAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_TssFundsMigratorInfoAll_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TssFundsMigratorInfoAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1938,6 +2038,46 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_TssFundsMigratorInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TssFundsMigratorInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TssFundsMigratorInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_TssFundsMigratorInfoAll_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_TssFundsMigratorInfoAll_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_TssFundsMigratorInfoAll_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1985,6 +2125,10 @@ var ( pattern_Query_ChainNonces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "chainNonces", "index"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ChainNoncesAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "chainNonces"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TssFundsMigratorInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "getTssFundsMigrator"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_TssFundsMigratorInfoAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "getAllTssFundsMigrators"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -2031,4 +2175,8 @@ var ( forward_Query_ChainNonces_0 = runtime.ForwardResponseMessage forward_Query_ChainNoncesAll_0 = runtime.ForwardResponseMessage + + forward_Query_TssFundsMigratorInfo_0 = runtime.ForwardResponseMessage + + forward_Query_TssFundsMigratorInfoAll_0 = runtime.ForwardResponseMessage ) From 57457fdecb9ba5893923b1e97f75c6025e4f733f Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Wed, 26 Jun 2024 19:35:51 +0200 Subject: [PATCH 3/9] docs(`zetaclient`): add more function and package documentation (#2321) * bitcoin * add revamp todos * evm * config * keys and metrics * orchestrator and tss * zetacore package * add package headers * changelog entry * Update zetaclient/chains/bitcoin/observer/observer.go Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> * Update zetaclient/chains/bitcoin/observer/observer.go Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> * Update zetaclient/chains/bitcoin/observer/observer.go Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> * apply some comments * Apply suggestions from code review Co-authored-by: Tanmay * add one comment * add some fixes --------- Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Co-authored-by: Tanmay --- changelog.md | 4 ++ zetaclient/authz/authz_signer.go | 8 +++ zetaclient/authz/authz_signer_test.go | 2 + zetaclient/chains/bitcoin/observer/inbound.go | 9 ++++ .../chains/bitcoin/observer/observer.go | 16 +++++- .../chains/bitcoin/observer/outbound.go | 8 +++ zetaclient/chains/bitcoin/signer/signer.go | 5 ++ zetaclient/chains/bitcoin/utils.go | 5 ++ zetaclient/chains/evm/observer/inbound.go | 4 ++ zetaclient/chains/evm/observer/observer.go | 15 ++++++ zetaclient/chains/evm/observer/outbound.go | 3 ++ zetaclient/chains/evm/signer/signer.go | 14 ++++++ zetaclient/chains/interfaces/interfaces.go | 2 +- zetaclient/compliance/compliance.go | 1 + zetaclient/config/config.go | 7 +++ zetaclient/config/config_chain.go | 12 +++++ zetaclient/config/types.go | 19 ++++++- zetaclient/context/app_context.go | 3 ++ zetaclient/context/zetacore_context.go | 5 ++ zetaclient/hsm/hsm_signer.go | 3 ++ zetaclient/keys/keys.go | 7 ++- zetaclient/metrics/metrics.go | 18 +++++++ zetaclient/metrics/telemetry.go | 4 ++ zetaclient/orchestrator/orchestrator.go | 11 +++- .../outboundprocessor/outbound_processor.go | 9 ++++ zetaclient/ratelimiter/rate_limiter.go | 1 + zetaclient/supplychecker/logger.go | 1 + zetaclient/supplychecker/validate.go | 1 + .../supplychecker/zeta_supply_checker.go | 8 +++ zetaclient/testutils/mempool_client.go | 6 +++ zetaclient/testutils/mocks/zetacore_client.go | 7 --- zetaclient/testutils/testdata.go | 2 + zetaclient/tss/tss_signer.go | 25 ++++++++++ zetaclient/types/dynamic_ticker.go | 5 ++ zetaclient/types/ethish.go | 1 + zetaclient/types/sql_evm.go | 7 +++ zetaclient/zetacore/broadcast.go | 3 +- zetaclient/zetacore/client.go | 5 ++ zetaclient/zetacore/query.go | 50 ++++++++++++++----- zetaclient/zetacore/query_test.go | 24 --------- zetaclient/zetacore/tx.go | 18 +++++++ 41 files changed, 306 insertions(+), 52 deletions(-) diff --git a/changelog.md b/changelog.md index 3d0194dc28..db3d2475f4 100644 --- a/changelog.md +++ b/changelog.md @@ -98,6 +98,10 @@ * [2335](https://github.com/zeta-chain/node/pull/2335) - ci: updated the artillery report to publish to artillery cloud * [2377](https://github.com/zeta-chain/node/pull/2377) - ci: adjusted sast-linters.yml to not scan itself, nor alert on removal of nosec. +### Documentation + +* [2321](https://github.com/zeta-chain/node/pull/2321) - improve documentation for ZetaClient functions and packages + ## v17.0.0 ### Fixes diff --git a/zetaclient/authz/authz_signer.go b/zetaclient/authz/authz_signer.go index 5f1221f9a9..7f9dc4d471 100644 --- a/zetaclient/authz/authz_signer.go +++ b/zetaclient/authz/authz_signer.go @@ -1,3 +1,5 @@ +// Package authz provides a signer object for transactions using grants +// grants are used to allow a hotkey to sign transactions on behalf of the observers package authz import ( @@ -7,18 +9,22 @@ import ( crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" ) +// Signer represents a signer for a grantee key type Signer struct { KeyType authz.KeyType GranterAddress string GranteeAddress sdk.AccAddress } +// String returns a string representation of a Signer func (a Signer) String() string { return a.KeyType.String() + " " + a.GranterAddress + " " + a.GranteeAddress.String() } +// signers is a map of all the signers for the different tx types var signers map[string]Signer +// init initializes the signers map with all the crosschain tx types using the ZetaClientGranteeKey func init() { signersList := make(map[string]Signer) for _, tx := range crosschaintypes.GetAllAuthzZetaclientTxTypes() { @@ -27,6 +33,7 @@ func init() { signers = signersList } +// SetupAuthZSignerList sets the granter and grantee for all the signers func SetupAuthZSignerList(granter string, grantee sdk.AccAddress) { for k, v := range signers { v.GranterAddress = granter @@ -35,6 +42,7 @@ func SetupAuthZSignerList(granter string, grantee sdk.AccAddress) { } } +// GetSigner returns the signer for a given msgURL func GetSigner(msgURL string) Signer { return signers[msgURL] } diff --git a/zetaclient/authz/authz_signer_test.go b/zetaclient/authz/authz_signer_test.go index 00a25722c4..1cc70b3116 100644 --- a/zetaclient/authz/authz_signer_test.go +++ b/zetaclient/authz/authz_signer_test.go @@ -1 +1,3 @@ package authz_test + +// NOTE: test file currently created empty to add the package in the test coverage scope diff --git a/zetaclient/chains/bitcoin/observer/inbound.go b/zetaclient/chains/bitcoin/observer/inbound.go index 2438411b5b..037fd11cd1 100644 --- a/zetaclient/chains/bitcoin/observer/inbound.go +++ b/zetaclient/chains/bitcoin/observer/inbound.go @@ -26,6 +26,8 @@ import ( ) // WatchInbound watches Bitcoin chain for inbounds on a ticker +// It starts a ticker and run ObserveInbound +// TODO(revamp): move all ticker related methods in the same file func (ob *Observer) WatchInbound() { ticker, err := types.NewDynamicTicker("Bitcoin_WatchInbound", ob.GetChainParams().InboundTicker) if err != nil { @@ -37,6 +39,7 @@ func (ob *Observer) WatchInbound() { ob.logger.Inbound.Info().Msgf("WatchInbound started for chain %d", ob.Chain().ChainId) sampledLogger := ob.logger.Inbound.Sample(&zerolog.BasicSampler{N: 10}) + // ticker loop for { select { case <-ticker.C(): @@ -58,6 +61,7 @@ func (ob *Observer) WatchInbound() { } // ObserveInbound observes the Bitcoin chain for inbounds and post votes to zetacore +// TODO(revamp): simplify this function into smaller functions func (ob *Observer) ObserveInbound() error { // get and update latest block height cnt, err := ob.btcClient.GetBlockCount() @@ -171,6 +175,7 @@ func (ob *Observer) ObserveInbound() error { } // WatchInboundTracker watches zetacore for bitcoin inbound trackers +// TODO(revamp): move all ticker related methods in the same file func (ob *Observer) WatchInboundTracker() { ticker, err := types.NewDynamicTicker("Bitcoin_WatchInboundTracker", ob.GetChainParams().InboundTicker) if err != nil { @@ -200,6 +205,7 @@ func (ob *Observer) WatchInboundTracker() { } // ProcessInboundTrackers processes inbound trackers +// TODO(revamp): move inbound tracker logic in a specific file func (ob *Observer) ProcessInboundTrackers() error { trackers, err := ob.ZetacoreClient().GetInboundTrackersForChain(ob.Chain().ChainId) if err != nil { @@ -328,6 +334,7 @@ func FilterAndParseIncomingTx( return inbounds, nil } +// GetInboundVoteMessageFromBtcEvent converts a BTCInboundEvent to a MsgVoteInbound to enable voting on the inbound on zetacore func (ob *Observer) GetInboundVoteMessageFromBtcEvent(inbound *BTCInboundEvent) *crosschaintypes.MsgVoteInbound { ob.logger.Inbound.Debug().Msgf("Processing inbound: %s", inbound.TxHash) amount := big.NewFloat(inbound.Value) @@ -360,6 +367,7 @@ func (ob *Observer) GetInboundVoteMessageFromBtcEvent(inbound *BTCInboundEvent) } // DoesInboundContainsRestrictedAddress returns true if the inbound contains restricted addresses +// TODO(revamp): move all compliance related functions in a specific file func (ob *Observer) DoesInboundContainsRestrictedAddress(inTx *BTCInboundEvent) bool { receiver := "" parsedAddress, _, err := chains.ParseAddressAndData(hex.EncodeToString(inTx.MemoBytes)) @@ -376,6 +384,7 @@ func (ob *Observer) DoesInboundContainsRestrictedAddress(inTx *BTCInboundEvent) // GetBtcEvent either returns a valid BTCInboundEvent or nil // Note: the caller should retry the tx on error (e.g., GetSenderAddressByVin failed) +// TODO(revamp): simplify this function func GetBtcEvent( rpcClient interfaces.BTCRPCClient, tx btcjson.TxRawResult, diff --git a/zetaclient/chains/bitcoin/observer/observer.go b/zetaclient/chains/bitcoin/observer/observer.go index 5d6e308dfe..11ccc5460a 100644 --- a/zetaclient/chains/bitcoin/observer/observer.go +++ b/zetaclient/chains/bitcoin/observer/observer.go @@ -1,3 +1,4 @@ +// Package observer implements the Bitcoin chain observer package observer import ( @@ -54,6 +55,7 @@ type Logger struct { } // BTCInboundEvent represents an incoming transaction event +// TODO(revamp): Move to inbound type BTCInboundEvent struct { // FromAddress is the first input address FromAddress string @@ -69,7 +71,7 @@ type BTCInboundEvent struct { TxHash string } -// BTCOutboundEvent contains bitcoin block and the header +// BTCBlockNHeader contains bitcoin block and the header type BTCBlockNHeader struct { Header *wire.BlockHeader Block *btcjson.GetBlockVerboseTxResult @@ -190,7 +192,7 @@ func (ob *Observer) GetChainParams() observertypes.ChainParams { return ob.ChainParams() } -// Start starts the Go routine to observe the Bitcoin chain +// Start starts the Go routine processes to observe the Bitcoin chain func (ob *Observer) Start() { ob.Logger().Chain.Info().Msgf("observer is starting for chain %d", ob.Chain().ChainId) @@ -214,6 +216,8 @@ func (ob *Observer) Start() { } // WatchRPCStatus watches the RPC status of the Bitcoin chain +// TODO(revamp): move ticker related functions to a specific file +// TODO(revamp): move inner logic in a separate function func (ob *Observer) WatchRPCStatus() { ob.logger.Chain.Info().Msgf("RPCStatus is starting") ticker := time.NewTicker(60 * time.Second) @@ -297,6 +301,8 @@ func (ob *Observer) ConfirmationsThreshold(amount *big.Int) int64 { } // WatchGasPrice watches Bitcoin chain for gas rate and post to zetacore +// TODO(revamp): move ticker related functions to a specific file +// TODO(revamp): move inner logic in a separate function func (ob *Observer) WatchGasPrice() { // report gas price right away as the ticker takes time to kick in err := ob.PostGasPrice() @@ -333,6 +339,7 @@ func (ob *Observer) WatchGasPrice() { } // PostGasPrice posts gas price to zetacore +// TODO(revamp): move to gas price file func (ob *Observer) PostGasPrice() error { // hardcode gas price here since this RPC is not available on regtest if chains.IsBitcoinRegnet(ob.Chain().ChainId) { @@ -379,6 +386,7 @@ func (ob *Observer) PostGasPrice() error { } // GetSenderAddressByVin get the sender address from the previous transaction +// TODO(revamp): move in upper package to separate file (e.g., rpc.go) func GetSenderAddressByVin(rpcClient interfaces.BTCRPCClient, vin btcjson.Vin, net *chaincfg.Params) (string, error) { // query previous raw transaction by txid // GetTransaction requires reconfiguring the bitcoin node (txindex=1), so we use GetRawTransaction instead @@ -421,6 +429,7 @@ func GetSenderAddressByVin(rpcClient interfaces.BTCRPCClient, vin btcjson.Vin, n } // WatchUTXOs watches bitcoin chain for UTXOs owned by the TSS address +// TODO(revamp): move ticker related functions to a specific file func (ob *Observer) WatchUTXOs() { ticker, err := clienttypes.NewDynamicTicker("Bitcoin_WatchUTXOs", ob.GetChainParams().WatchUtxoTicker) if err != nil { @@ -448,6 +457,7 @@ func (ob *Observer) WatchUTXOs() { } // FetchUTXOs fetches TSS-owned UTXOs from the Bitcoin node +// TODO(revamp): move to UTXO file func (ob *Observer) FetchUTXOs() error { defer func() { if err := recover(); err != nil { @@ -511,6 +521,7 @@ func (ob *Observer) FetchUTXOs() error { } // SaveBroadcastedTx saves successfully broadcasted transaction +// TODO(revamp): move to db file func (ob *Observer) SaveBroadcastedTx(txHash string, nonce uint64) { outboundID := ob.GetTxID(nonce) ob.Mu().Lock() @@ -641,6 +652,7 @@ func (ob *Observer) isTssTransaction(txid string) bool { } // postBlockHeader posts block header to zetacore +// TODO(revamp): move to block header file func (ob *Observer) postBlockHeader(tip int64) error { ob.logger.Inbound.Info().Msgf("postBlockHeader: tip %d", tip) bn := tip diff --git a/zetaclient/chains/bitcoin/observer/outbound.go b/zetaclient/chains/bitcoin/observer/outbound.go index 5bf20c8e7d..5f4684f50f 100644 --- a/zetaclient/chains/bitcoin/observer/outbound.go +++ b/zetaclient/chains/bitcoin/observer/outbound.go @@ -27,6 +27,8 @@ func (ob *Observer) GetTxID(nonce uint64) string { } // WatchOutbound watches Bitcoin chain for outgoing txs status +// TODO(revamp): move ticker functions to a specific file +// TODO(revamp): move into a separate package func (ob *Observer) WatchOutbound() { ticker, err := types.NewDynamicTicker("Bitcoin_WatchOutbound", ob.GetChainParams().OutboundTicker) if err != nil { @@ -111,6 +113,7 @@ func (ob *Observer) WatchOutbound() { } // IsOutboundProcessed returns isIncluded(or inMempool), isConfirmed, Error +// TODO(revamp): rename as it vote the outbound and doesn't only check if outbound is processed func (ob *Observer) IsOutboundProcessed(cctx *crosschaintypes.CrossChainTx, logger zerolog.Logger) (bool, bool, error) { params := *cctx.GetCurrentOutboundParam() sendHash := cctx.Index @@ -213,6 +216,8 @@ func (ob *Observer) IsOutboundProcessed(cctx *crosschaintypes.CrossChainTx, logg // - the total value of the selected UTXOs. // - the number of consolidated UTXOs. // - the total value of the consolidated UTXOs. +// +// TODO(revamp): move to utxo file func (ob *Observer) SelectUTXOs( amount float64, utxosToSpend uint16, @@ -329,6 +334,8 @@ func (ob *Observer) refreshPendingNonce() { } } +// getOutboundIDByNonce gets the outbound ID from the nonce of the outbound transaction +// test is true for unit test only func (ob *Observer) getOutboundIDByNonce(nonce uint64, test bool) (string, error) { // There are 2 types of txids an observer can trust // 1. The ones had been verified and saved by observer self. @@ -363,6 +370,7 @@ func (ob *Observer) getOutboundIDByNonce(nonce uint64, test bool) (string, error return "", fmt.Errorf("getOutboundIDByNonce: cannot find outbound txid for nonce %d", nonce) } +// findNonceMarkUTXO finds the nonce-mark UTXO in the list of UTXOs. func (ob *Observer) findNonceMarkUTXO(nonce uint64, txid string) (int, error) { tssAddress := ob.TSS().BTCAddressWitnessPubkeyHash().EncodeAddress() amount := chains.NonceMarkAmount(nonce) diff --git a/zetaclient/chains/bitcoin/signer/signer.go b/zetaclient/chains/bitcoin/signer/signer.go index 6ad9bfc2a6..eae11a68ce 100644 --- a/zetaclient/chains/bitcoin/signer/signer.go +++ b/zetaclient/chains/bitcoin/signer/signer.go @@ -1,3 +1,4 @@ +// Package signer implements the ChainSigner interface for BTC package signer import ( @@ -168,6 +169,7 @@ func (signer *Signer) AddWithdrawTxOutputs( } // SignWithdrawTx receives utxos sorted by value, amount in BTC, feeRate in BTC per Kb +// TODO(revamp): simplify the function func (signer *Signer) SignWithdrawTx( to btcutil.Address, amount float64, @@ -291,6 +293,7 @@ func (signer *Signer) SignWithdrawTx( return tx, nil } +// Broadcast sends the signed transaction to the network func (signer *Signer) Broadcast(signedTx *wire.MsgTx) error { fmt.Printf("BTCSigner: Broadcasting: %s\n", signedTx.TxHash().String()) @@ -311,6 +314,8 @@ func (signer *Signer) Broadcast(signedTx *wire.MsgTx) error { return nil } +// TryProcessOutbound signs and broadcasts a BTC transaction from a new outbound +// TODO(revamp): simplify the function func (signer *Signer) TryProcessOutbound( cctx *types.CrossChainTx, outboundProcessor *outboundprocessor.Processor, diff --git a/zetaclient/chains/bitcoin/utils.go b/zetaclient/chains/bitcoin/utils.go index fe2bb2481b..8c37e01fad 100644 --- a/zetaclient/chains/bitcoin/utils.go +++ b/zetaclient/chains/bitcoin/utils.go @@ -8,6 +8,9 @@ import ( "github.com/pkg/errors" ) +// TODO(revamp): Remove utils.go and move the functions to the appropriate files + +// PrettyPrintStruct returns a pretty-printed string representation of a struct func PrettyPrintStruct(val interface{}) (string, error) { prettyStruct, err := json.MarshalIndent( val, @@ -20,6 +23,7 @@ func PrettyPrintStruct(val interface{}) (string, error) { return string(prettyStruct), nil } +// GetSatoshis converts a bitcoin amount to satoshis func GetSatoshis(btc float64) (int64, error) { // The amount is only considered invalid if it cannot be represented // as an integer type. This may happen if f is NaN or +-Infinity. @@ -39,6 +43,7 @@ func GetSatoshis(btc float64) (int64, error) { return round(btc * btcutil.SatoshiPerBitcoin), nil } +// round rounds a float64 to the nearest integer func round(f float64) int64 { if f < 0 { // #nosec G701 always in range diff --git a/zetaclient/chains/evm/observer/inbound.go b/zetaclient/chains/evm/observer/inbound.go index 41ada01375..40844ddbd7 100644 --- a/zetaclient/chains/evm/observer/inbound.go +++ b/zetaclient/chains/evm/observer/inbound.go @@ -34,6 +34,7 @@ import ( ) // WatchInbound watches evm chain for incoming txs and post votes to zetacore +// TODO(revamp): move ticker function to a separate file func (ob *Observer) WatchInbound() { ticker, err := clienttypes.NewDynamicTicker( fmt.Sprintf("EVM_WatchInbound_%d", ob.Chain().ChainId), @@ -70,6 +71,7 @@ func (ob *Observer) WatchInbound() { // WatchInboundTracker gets a list of Inbound tracker suggestions from zeta-core at each tick and tries to check if the in-tx was confirmed. // If it was, it tries to broadcast the confirmation vote. If this zeta client has previously broadcast the vote, the tx would be rejected +// TODO(revamp): move inbound tracker function to a separate file func (ob *Observer) WatchInboundTracker() { ticker, err := clienttypes.NewDynamicTicker( fmt.Sprintf("EVM_WatchInboundTracker_%d", ob.Chain().ChainId), @@ -101,6 +103,7 @@ func (ob *Observer) WatchInboundTracker() { } // ProcessInboundTrackers processes inbound trackers from zetacore +// TODO(revamp): move inbound tracker function to a separate file func (ob *Observer) ProcessInboundTrackers() error { trackers, err := ob.ZetacoreClient().GetInboundTrackersForChain(ob.Chain().ChainId) if err != nil { @@ -152,6 +155,7 @@ func (ob *Observer) ProcessInboundTrackers() error { return nil } +// ObserveInbound observes the evm chain for inbounds and posts votes to zetacore func (ob *Observer) ObserveInbound(sampledLogger zerolog.Logger) error { // get and update latest block height blockNumber, err := ob.evmClient.BlockNumber(context.Background()) diff --git a/zetaclient/chains/evm/observer/observer.go b/zetaclient/chains/evm/observer/observer.go index 3db0538870..0a33603196 100644 --- a/zetaclient/chains/evm/observer/observer.go +++ b/zetaclient/chains/evm/observer/observer.go @@ -1,3 +1,4 @@ +// Package observer implements the EVM chain observer package observer import ( @@ -147,6 +148,7 @@ func (ob *Observer) GetERC20CustodyContract() (ethcommon.Address, *erc20custody. } // FetchConnectorContractEth returns the Eth connector address and binder +// TODO(revamp): move this to a contract package func FetchConnectorContractEth( addr ethcommon.Address, client interfaces.EVMRPCClient, @@ -155,6 +157,7 @@ func FetchConnectorContractEth( } // FetchZetaTokenContract returns the non-Eth ZETA token binder +// TODO(revamp): move this to a contract package func FetchZetaTokenContract( addr ethcommon.Address, client interfaces.EVMRPCClient, @@ -183,6 +186,8 @@ func (ob *Observer) Start() { } // WatchRPCStatus watches the RPC status of the evm chain +// TODO(revamp): move ticker to ticker file +// TODO(revamp): move inner logic to a separate function func (ob *Observer) WatchRPCStatus() { ob.Logger().Chain.Info().Msgf("Starting RPC status check for chain %d", ob.Chain().ChainId) ticker := time.NewTicker(60 * time.Second) @@ -288,6 +293,8 @@ func (ob *Observer) CheckTxInclusion(tx *ethtypes.Transaction, receipt *ethtypes } // WatchGasPrice watches evm chain for gas prices and post to zetacore +// TODO(revamp): move ticker to ticker file +// TODO(revamp): move inner logic to a separate function func (ob *Observer) WatchGasPrice() { // report gas price right away as the ticker takes time to kick in err := ob.PostGasPrice() @@ -326,6 +333,8 @@ func (ob *Observer) WatchGasPrice() { } } +// PostGasPrice posts gas price to zetacore +// TODO(revamp): move to gas price file func (ob *Observer) PostGasPrice() error { // GAS PRICE gasPrice, err := ob.evmClient.SuggestGasPrice(context.TODO()) @@ -353,6 +362,7 @@ func (ob *Observer) PostGasPrice() error { } // TransactionByHash query transaction by hash via JSON-RPC +// TODO(revamp): update this method as a pure RPC method that takes two parameters (jsonRPC, and txHash) and move to upper package to file rpc.go func (ob *Observer) TransactionByHash(txHash string) (*ethrpc.Transaction, bool, error) { tx, err := ob.evmJSONRPC.EthGetTransactionByHash(txHash) if err != nil { @@ -365,6 +375,7 @@ func (ob *Observer) TransactionByHash(txHash string) (*ethrpc.Transaction, bool, return tx, tx.BlockNumber == nil, nil } +// GetBlockHeaderCached get block header by number from cache func (ob *Observer) GetBlockHeaderCached(blockNumber uint64) (*ethtypes.Header, error) { if result, ok := ob.HeaderCache().Get(blockNumber); ok { if header, ok := result.(*ethtypes.Header); ok { @@ -422,6 +433,7 @@ func (ob *Observer) BlockByNumber(blockNumber int) (*ethrpc.Block, error) { } // LoadDB open sql database and load data into EVM observer +// TODO(revamp): move to a db file func (ob *Observer) LoadDB(dbPath string) error { if dbPath == "" { return errors.New("empty db path") @@ -450,6 +462,7 @@ func (ob *Observer) LoadDB(dbPath string) error { } // LoadLastBlockScanned loads the last scanned block from the database +// TODO(revamp): move to a db file func (ob *Observer) LoadLastBlockScanned() error { err := ob.Observer.LoadLastBlockScanned(ob.Logger().Chain) if err != nil { @@ -471,6 +484,8 @@ func (ob *Observer) LoadLastBlockScanned() error { return nil } +// postBlockHeader posts the block header to zetacore +// TODO(revamp): move to a block header file func (ob *Observer) postBlockHeader(tip uint64) error { bn := tip diff --git a/zetaclient/chains/evm/observer/outbound.go b/zetaclient/chains/evm/observer/outbound.go index 9c3bd1c66b..2f3d3c136f 100644 --- a/zetaclient/chains/evm/observer/outbound.go +++ b/zetaclient/chains/evm/observer/outbound.go @@ -34,6 +34,8 @@ func (ob *Observer) GetTxID(nonce uint64) string { } // WatchOutbound watches evm chain for outgoing txs status +// TODO(revamp): move ticker function to ticker file +// TODO(revamp): move inner logic to a separate function func (ob *Observer) WatchOutbound() { ticker, err := clienttypes.NewDynamicTicker( fmt.Sprintf("EVM_WatchOutbound_%d", ob.Chain().ChainId), @@ -130,6 +132,7 @@ func (ob *Observer) PostVoteOutbound( // IsOutboundProcessed checks outbound status and returns (isIncluded, isConfirmed, error) // It also posts vote to zetacore if the tx is confirmed +// TODO(revamp): rename as it also vote the outbound func (ob *Observer) IsOutboundProcessed(cctx *crosschaintypes.CrossChainTx, logger zerolog.Logger) (bool, bool, error) { // skip if outbound is not confirmed nonce := cctx.GetCurrentOutboundParam().TssNonce diff --git a/zetaclient/chains/evm/signer/signer.go b/zetaclient/chains/evm/signer/signer.go index d50b214b03..3ea7852766 100644 --- a/zetaclient/chains/evm/signer/signer.go +++ b/zetaclient/chains/evm/signer/signer.go @@ -1,3 +1,4 @@ +// Package signer implements the ChainSigner interface for EVM chains package signer import ( @@ -329,6 +330,7 @@ func (signer *Signer) SignCommandTx(txData *OutboundData, cmd string, params str // TryProcessOutbound - signer interface implementation // This function will attempt to build and sign an evm transaction using the TSS signer. // It will then broadcast the signed transaction to the outbound chain. +// TODO(revamp): simplify function func (signer *Signer) TryProcessOutbound( cctx *types.CrossChainTx, outboundProc *outboundprocessor.Processor, @@ -618,14 +620,19 @@ func (signer *Signer) GetReportedTxList() *map[string]bool { return &signer.outboundHashBeingReported } +// EvmClient returns the EVM RPC client func (signer *Signer) EvmClient() interfaces.EVMRPCClient { return signer.client } +// EvmSigner returns the EVM signer object for the signer func (signer *Signer) EvmSigner() ethtypes.Signer { + // TODO(revamp): rename field into evmSigner return signer.ethSigner } +// IsSenderZetaChain checks if the sender chain is ZetaChain +// TODO(revamp): move to another package more general for cctx functions func IsSenderZetaChain( cctx *types.CrossChainTx, zetacoreClient interfaces.ZetacoreClient, @@ -635,6 +642,7 @@ func IsSenderZetaChain( cctx.CctxStatus.Status == types.CctxStatus_PendingOutbound && flags.IsOutboundEnabled } +// ErrorMsg returns a error message for SignOutbound failure with cctx data func ErrorMsg(cctx *types.CrossChainTx) string { return fmt.Sprintf( "signer SignOutbound error: nonce %d chain %d", @@ -643,6 +651,8 @@ func ErrorMsg(cctx *types.CrossChainTx) string { ) } +// SignWhitelistERC20Cmd signs a whitelist command for ERC20 token +// TODO(revamp): move the cmd in a specific file func (signer *Signer) SignWhitelistERC20Cmd(txData *OutboundData, params string) (*ethtypes.Transaction, error) { outboundParams := txData.outboundParams erc20 := ethcommon.HexToAddress(params) @@ -672,6 +682,8 @@ func (signer *Signer) SignWhitelistERC20Cmd(txData *OutboundData, params string) return tx, nil } +// SignMigrateTssFundsCmd signs a migrate TSS funds command +// TODO(revamp): move the cmd in a specific file func (signer *Signer) SignMigrateTssFundsCmd(txData *OutboundData) (*ethtypes.Transaction, error) { tx, _, _, err := signer.Sign( nil, @@ -689,6 +701,7 @@ func (signer *Signer) SignMigrateTssFundsCmd(txData *OutboundData) (*ethtypes.Tr } // reportToOutboundTracker reports outboundHash to tracker only when tx receipt is available +// TODO(revamp): move outbound tracker function to a outbound tracker file func (signer *Signer) reportToOutboundTracker( zetacoreClient interfaces.ZetacoreClient, chainID int64, @@ -821,6 +834,7 @@ func getEVMRPC(endpoint string) (interfaces.EVMRPCClient, ethtypes.Signer, error return client, ethSigner, nil } +// roundUpToNearestGwei rounds up the gas price to the nearest Gwei func roundUpToNearestGwei(gasPrice *big.Int) *big.Int { oneGwei := big.NewInt(1_000_000_000) // 1 Gwei mod := new(big.Int) diff --git a/zetaclient/chains/interfaces/interfaces.go b/zetaclient/chains/interfaces/interfaces.go index 1ef94ec8de..2272ef1dfe 100644 --- a/zetaclient/chains/interfaces/interfaces.go +++ b/zetaclient/chains/interfaces/interfaces.go @@ -1,3 +1,4 @@ +// Package interfaces provides interfaces for clients and signers for the chain to interact with package interfaces import ( @@ -96,7 +97,6 @@ type ZetacoreClient interface { GetKeys() keyinterfaces.ObserverKeys GetKeyGen() (*observertypes.Keygen, error) GetBlockHeight() (int64, error) - GetLastBlockHeightByChain(chain chains.Chain) (*crosschaintypes.LastBlockHeight, error) ListPendingCctx(chainID int64) ([]*crosschaintypes.CrossChainTx, uint64, error) ListPendingCctxWithinRatelimit() ([]*crosschaintypes.CrossChainTx, uint64, int64, string, bool, error) GetRateLimiterInput(window int64) (crosschaintypes.QueryRateLimiterInputResponse, error) diff --git a/zetaclient/compliance/compliance.go b/zetaclient/compliance/compliance.go index e085b6954b..849d56742b 100644 --- a/zetaclient/compliance/compliance.go +++ b/zetaclient/compliance/compliance.go @@ -1,3 +1,4 @@ +// Package compliance provides functions to check for compliance of cross-chain transactions package compliance import ( diff --git a/zetaclient/config/config.go b/zetaclient/config/config.go index 7dcf1b00f3..6efd149628 100644 --- a/zetaclient/config/config.go +++ b/zetaclient/config/config.go @@ -1,3 +1,4 @@ +// Package config provides functions to load and save ZetaClient config package config import ( @@ -11,7 +12,10 @@ import ( // restrictedAddressBook is a map of restricted addresses var restrictedAddressBook = map[string]bool{} +// filename is config file name for ZetaClient const filename string = "zetaclient_config.json" + +// folder is the folder name for ZetaClient config const folder string = "config" // Save saves ZetaClient config @@ -78,10 +82,12 @@ func Load(path string) (Config, error) { return cfg, nil } +// LoadComplianceConfig loads compliance data (restricted addresses) from config func LoadComplianceConfig(cfg Config) { restrictedAddressBook = cfg.GetRestrictedAddressBook() } +// GetPath returns the absolute path of the input path func GetPath(inputPath string) string { path := strings.Split(inputPath, "/") if len(path) > 0 { @@ -94,6 +100,7 @@ func GetPath(inputPath string) string { return filepath.Join(path...) } } + return inputPath } diff --git a/zetaclient/config/config_chain.go b/zetaclient/config/config_chain.go index 12c889f6af..5c2ed1d077 100644 --- a/zetaclient/config/config_chain.go +++ b/zetaclient/config/config_chain.go @@ -7,20 +7,29 @@ const ( ) const ( + // ConnectorAbiString is the ABI of the connector contract + // TODO(revamp): we should be able to use info from Go binding ConnectorAbiString = ` [{"inputs":[{"internalType":"address","name":"_zetaTokenAddress","type":"address"},{"internalType":"address","name":"_tssAddress","type":"address"},{"internalType":"address","name":"_tssAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"indexed":true,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"destinationAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"originChainId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":true,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":true,"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"ZetaReverted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"originSenderAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasLimit","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"zetaParams","type":"bytes"}],"name":"ZetaSent","type":"event"},{"inputs":[],"name":"getLockedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"originSenderAddress","type":"bytes"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"address","name":"destinationAddress","type":"address"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"originSenderAddress","type":"address"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes32","name":"internalSendHash","type":"bytes32"}],"name":"onRevert","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTssAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes","name":"destinationAddress","type":"bytes"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"uint256","name":"zetaAmount","type":"uint256"},{"internalType":"bytes","name":"zetaParams","type":"bytes"}],"internalType":"struct ZetaInterfaces.SendInput","name":"input","type":"tuple"}],"name":"send","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tssAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tssAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tssAddress","type":"address"}],"name":"updateTssAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zetaToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]` + + // ERC20CustodyAbiString is the ABI of the erc20 custodu contract + // TODO(revamp): we should be able to use info from Go binding ERC20CustodyAbiString = ` [{"inputs":[{"internalType":"address","name":"_TSSAddress","type":"address"},{"internalType":"address","name":"_TSSAddressUpdater","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidSender","type":"error"},{"inputs":[],"name":"InvalidTSSUpdater","type":"error"},{"inputs":[],"name":"IsPaused","type":"error"},{"inputs":[],"name":"NotPaused","type":"error"},{"inputs":[],"name":"NotWhitelisted","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"recipient","type":"bytes"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Unwhitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"}],"name":"Whitelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"TSSAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TSSAddressUpdater","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"recipient","type":"bytes"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceTSSAddressUpdater","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"unwhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"updateTSSAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"whitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]` ) +// GetConnectorABI returns the ABI of the connector contract func GetConnectorABI() string { return ConnectorAbiString } +// GetERC20CustodyABI returns the ABI of the erc20 custody contract func GetERC20CustodyABI() string { return ERC20CustodyAbiString } +// New returns a new config +// It is initialize with default chain configs func New() Config { return Config{ EVMChainConfigs: evmChainsConfigs, @@ -28,6 +37,7 @@ func New() Config { } } +// bitcoinConfigRegnet contains Bitcoin config for regnet var bitcoinConfigRegnet = BTCConfig{ RPCUsername: "smoketest", // smoketest is the previous name for E2E test, we keep this name for compatibility between client versions in upgrade test RPCPassword: "123", @@ -35,6 +45,8 @@ var bitcoinConfigRegnet = BTCConfig{ RPCParams: "regtest", } +// evmChainsConfigs contains EVM chain configs +// it contains list of EVM chains with empty endpoint except for localnet var evmChainsConfigs = map[int64]EVMConfig{ chains.Ethereum.ChainId: { Chain: chains.Ethereum, diff --git a/zetaclient/config/types.go b/zetaclient/config/types.go index b14cc8191b..96cdf24a4c 100644 --- a/zetaclient/config/types.go +++ b/zetaclient/config/types.go @@ -12,9 +12,14 @@ import ( type KeyringBackend string const ( + // KeyringBackendUndefined is undefined keyring backend KeyringBackendUndefined KeyringBackend = "" - KeyringBackendTest KeyringBackend = "test" - KeyringBackendFile KeyringBackend = "file" + + // KeyringBackendTest is the test Cosmos keyring backend + KeyringBackendTest KeyringBackend = "test" + + // KeyringBackendFile is the file Cosmos keyring backend + KeyringBackendFile KeyringBackend = "file" ) // ClientConfiguration is a subset of zetaclient config that is used by zetacore client @@ -27,11 +32,13 @@ type ClientConfiguration struct { HsmMode bool `json:"hsm_mode"` } +// EVMConfig is the config for EVM chain type EVMConfig struct { Chain chains.Chain Endpoint string } +// BTCConfig is the config for Bitcoin chain type BTCConfig struct { // the following are rpcclient ConnConfig fields RPCUsername string @@ -40,6 +47,7 @@ type BTCConfig struct { RPCParams string // "regtest", "mainnet", "testnet3" } +// ComplianceConfig is the config for compliance type ComplianceConfig struct { LogPath string `json:"LogPath"` RestrictedAddresses []string `json:"RestrictedAddresses"` @@ -78,6 +86,8 @@ type Config struct { ComplianceConfig ComplianceConfig `json:"ComplianceConfig"` } +// NewConfig returns a new Config with initialize EVM chain mapping and a new mutex +// TODO(revamp): consolidate with New function func NewConfig() Config { return Config{ cfgLock: &sync.RWMutex{}, @@ -85,6 +95,7 @@ func NewConfig() Config { } } +// GetEVMConfig returns the EVM config for the given chain ID func (c Config) GetEVMConfig(chainID int64) (EVMConfig, bool) { c.cfgLock.RLock() defer c.cfgLock.RUnlock() @@ -92,6 +103,7 @@ func (c Config) GetEVMConfig(chainID int64) (EVMConfig, bool) { return evmCfg, found } +// GetAllEVMConfigs returns a map of all EVM configs func (c Config) GetAllEVMConfigs() map[int64]EVMConfig { c.cfgLock.RLock() defer c.cfgLock.RUnlock() @@ -104,6 +116,7 @@ func (c Config) GetAllEVMConfigs() map[int64]EVMConfig { return copied } +// GetBTCConfig returns the BTC config func (c Config) GetBTCConfig() (BTCConfig, bool) { c.cfgLock.RLock() defer c.cfgLock.RUnlock() @@ -111,6 +124,7 @@ func (c Config) GetBTCConfig() (BTCConfig, bool) { return c.BitcoinConfig, c.BitcoinConfig != (BTCConfig{}) } +// String returns the string representation of the config func (c Config) String() string { s, err := json.MarshalIndent(c, "", "\t") if err != nil { @@ -131,6 +145,7 @@ func (c Config) GetRestrictedAddressBook() map[string]bool { return restrictedAddresses } +// GetKeyringBackend returns the keyring backend func (c *Config) GetKeyringBackend() KeyringBackend { c.cfgLock.RLock() defer c.cfgLock.RUnlock() diff --git a/zetaclient/context/app_context.go b/zetaclient/context/app_context.go index d47cd925e8..ffdfa05604 100644 --- a/zetaclient/context/app_context.go +++ b/zetaclient/context/app_context.go @@ -1,3 +1,4 @@ +// Package context provides global app context for ZetaClient package context import ( @@ -22,10 +23,12 @@ func NewAppContext( } } +// Config returns the config of the app func (a AppContext) Config() config.Config { return a.config } +// ZetacoreContext returns the context for ZetaChain func (a AppContext) ZetacoreContext() *ZetacoreContext { return a.coreContext } diff --git a/zetaclient/context/zetacore_context.go b/zetaclient/context/zetacore_context.go index 73ad83ff29..17d4cc5c3d 100644 --- a/zetaclient/context/zetacore_context.go +++ b/zetaclient/context/zetacore_context.go @@ -52,6 +52,7 @@ func NewZetacoreContext(cfg config.Config) *ZetacoreContext { } } +// GetKeygen returns the current keygen func (c *ZetacoreContext) GetKeygen() observertypes.Keygen { c.coreContextLock.RLock() defer c.coreContextLock.RUnlock() @@ -69,6 +70,7 @@ func (c *ZetacoreContext) GetKeygen() observertypes.Keygen { } } +// GetCurrentTssPubkey returns the current tss pubkey func (c *ZetacoreContext) GetCurrentTssPubkey() string { c.coreContextLock.RLock() defer c.coreContextLock.RUnlock() @@ -99,6 +101,7 @@ func (c *ZetacoreContext) GetEnabledExternalChains() []chains.Chain { return externalChains } +// GetEVMChainParams returns chain params for a specific EVM chain func (c *ZetacoreContext) GetEVMChainParams(chainID int64) (*observertypes.ChainParams, bool) { c.coreContextLock.RLock() defer c.coreContextLock.RUnlock() @@ -107,6 +110,7 @@ func (c *ZetacoreContext) GetEVMChainParams(chainID int64) (*observertypes.Chain return evmChainParams, found } +// GetAllEVMChainParams returns all chain params for EVM chains func (c *ZetacoreContext) GetAllEVMChainParams() map[int64]*observertypes.ChainParams { c.coreContextLock.RLock() defer c.coreContextLock.RUnlock() @@ -137,6 +141,7 @@ func (c *ZetacoreContext) GetBTCChainParams() (chains.Chain, *observertypes.Chai return *chain, c.bitcoinChainParams, true } +// GetCrossChainFlags returns crosschain flags func (c *ZetacoreContext) GetCrossChainFlags() observertypes.CrosschainFlags { c.coreContextLock.RLock() defer c.coreContextLock.RUnlock() diff --git a/zetaclient/hsm/hsm_signer.go b/zetaclient/hsm/hsm_signer.go index a6d513a353..7d11952716 100644 --- a/zetaclient/hsm/hsm_signer.go +++ b/zetaclient/hsm/hsm_signer.go @@ -1,3 +1,5 @@ +// Package hsm is used to interact with chains with a HSM +// it is currently not used package hsm import ( @@ -158,6 +160,7 @@ func SignWithHSM( return txBuilder.SetSignatures(prevSignatures...) } +// GetPKCS11Config returns the PKCS11 configuration from the environment variables func GetPKCS11Config() (config *crypto11.Config, err error) { config = &crypto11.Config{} config.Path = os.Getenv(hsmPath) diff --git a/zetaclient/keys/keys.go b/zetaclient/keys/keys.go index 3532c12233..0fdef6c204 100644 --- a/zetaclient/keys/keys.go +++ b/zetaclient/keys/keys.go @@ -23,8 +23,11 @@ import ( ) var ( + // ErrBech32ifyPubKey is an error when Bech32ifyPubKey fails ErrBech32ifyPubKey = errors.New("Bech32ifyPubKey fail in main") - ErrNewPubKey = errors.New("NewPubKey error from string") + + // ErrNewPubKey is an error when NewPubKey fails + ErrNewPubKey = errors.New("NewPubKey error from string") ) var _ interfaces.ObserverKeys = &Keys{} @@ -52,6 +55,7 @@ func NewKeysWithKeybase( } } +// GetGranteeKeyName return the grantee name func GetGranteeKeyName(signerName string) string { return signerName } @@ -110,6 +114,7 @@ func (k *Keys) GetSignerInfo() *ckeys.Record { return info } +// GetOperatorAddress return the operator address func (k *Keys) GetOperatorAddress() sdk.AccAddress { return k.OperatorAddress } diff --git a/zetaclient/metrics/metrics.go b/zetaclient/metrics/metrics.go index 1170d16f68..1da10d10e8 100644 --- a/zetaclient/metrics/metrics.go +++ b/zetaclient/metrics/metrics.go @@ -1,3 +1,4 @@ +// Package metrics provides metrics functionalities for the zetaclient package metrics import ( @@ -11,79 +12,93 @@ import ( "github.com/rs/zerolog/log" ) +// Metrics is a struct that contains the http server for metrics type Metrics struct { s *http.Server } +// ZetaClientNamespace is the namespace for the metrics const ZetaClientNamespace = "zetaclient" var ( + // PendingTxsPerChain is a gauge that contains the number of pending transactions per chain PendingTxsPerChain = promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "pending_txs_total", Help: "Number of pending transactions per chain", }, []string{"chain"}) + // GetFilterLogsPerChain is a counter that contains the number of getLogs per chain GetFilterLogsPerChain = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: ZetaClientNamespace, Name: "rpc_getFilterLogs_count", Help: "Count of getLogs per chain", }, []string{"chain"}) + // GetBlockByNumberPerChain is a counter that contains the number of getBlockByNumber per chain GetBlockByNumberPerChain = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: ZetaClientNamespace, Name: "rpc_getBlockByNumber_count", Help: "Count of getLogs per chain", }, []string{"chain"}) + // TssNodeBlamePerPubKey is a counter that contains the number of tss node blame per pubkey TssNodeBlamePerPubKey = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: ZetaClientNamespace, Name: "tss_node_blame_count", Help: "Tss node blame counter per pubkey", }, []string{"pubkey"}) + // HotKeyBurnRate is a gauge that contains the fee burn rate of the hotkey HotKeyBurnRate = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "hotkey_burn_rate", Help: "Fee burn rate of the hotkey", }) + // NumberOfUTXO is a gauge that contains the number of UTXOs NumberOfUTXO = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "utxo_number", Help: "Number of UTXOs", }) + // LastScannedBlockNumber is a gauge that contains the last scanned block number per chain LastScannedBlockNumber = promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "last_scanned_block_number", Help: "Last scanned block number per chain", }, []string{"chain"}) + // LastCoreBlockNumber is a gauge that contains the last core block number LastCoreBlockNumber = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "last_core_block_number", Help: "Last core block number", }) + // Info is a gauge that contains information about the zetaclient environment Info = promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "info", Help: "Information about Zetaclient environment", }, []string{"version"}) + // LastStartTime is a gauge that contains the start time in Unix time LastStartTime = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "last_start_timestamp_seconds", Help: "Start time in Unix time", }) + // NumActiveMsgSigns is a gauge that contains the number of concurrent key signs NumActiveMsgSigns = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "num_active_message_signs", Help: "Number of concurrent key signs", }) + // PercentageOfRateReached is a gauge that contains the percentage of the rate limiter rate reached PercentageOfRateReached = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: ZetaClientNamespace, Name: "percentage_of_rate_reached", @@ -91,6 +106,7 @@ var ( }) ) +// NewMetrics creates a new Metrics instance func NewMetrics() (*Metrics, error) { handler := promhttp.InstrumentMetricHandler( prometheus.DefaultRegisterer, @@ -111,6 +127,7 @@ func NewMetrics() (*Metrics, error) { }, nil } +// Start starts the metrics server func (m *Metrics) Start() { log.Info().Msg("metrics server starting") go func() { @@ -120,6 +137,7 @@ func (m *Metrics) Start() { }() } +// Stop stops the metrics server func (m *Metrics) Stop() error { ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) defer cancel() diff --git a/zetaclient/metrics/telemetry.go b/zetaclient/metrics/telemetry.go index f49c1bf7b1..ebf62d887c 100644 --- a/zetaclient/metrics/telemetry.go +++ b/zetaclient/metrics/telemetry.go @@ -176,10 +176,12 @@ func (t *TelemetryServer) Stop() error { return err } +// pingHandler returns a 200 OK response func (t *TelemetryServer) pingHandler(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) } +// p2pHandler returns the p2p id func (t *TelemetryServer) p2pHandler(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) t.mu.Lock() @@ -187,6 +189,7 @@ func (t *TelemetryServer) p2pHandler(w http.ResponseWriter, _ *http.Request) { fmt.Fprintf(w, "%s", t.p2pid) } +// ipHandler returns the ip address func (t *TelemetryServer) ipHandler(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) t.mu.Lock() @@ -248,6 +251,7 @@ func (t *TelemetryServer) hotKeyFeeBurnRate(w http.ResponseWriter, _ *http.Reque fmt.Fprintf(w, "%v", t.HotKeyBurnRate.GetBurnRate()) } +// logMiddleware logs the incoming HTTP request func logMiddleware() mux.MiddlewareFunc { return func(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/zetaclient/orchestrator/orchestrator.go b/zetaclient/orchestrator/orchestrator.go index 1407557d3e..2c5ea2d2de 100644 --- a/zetaclient/orchestrator/orchestrator.go +++ b/zetaclient/orchestrator/orchestrator.go @@ -1,3 +1,4 @@ +// Package orchestrator provides the orchestrator for orchestrating cross-chain transactions package orchestrator import ( @@ -32,6 +33,8 @@ const ( loggerSamplingRate = 10 ) +// Log is a struct that contains the logger +// TODO(revamp): rename to logger type Log struct { Std zerolog.Logger Sampled zerolog.Logger @@ -42,8 +45,10 @@ type Orchestrator struct { // zetacore client zetacoreClient interfaces.ZetacoreClient - // chain signers and observers - signerMap map[int64]interfaces.ChainSigner + // signerMap contains the chain signers indexed by chainID + signerMap map[int64]interfaces.ChainSigner + + // observerMap contains the chain observers indexed by chainID observerMap map[int64]interfaces.ChainObserver // outbound processor @@ -94,6 +99,7 @@ func NewOrchestrator( return &oc } +// MonitorCore starts the orchestrator for CCTXs func (oc *Orchestrator) MonitorCore(appContext *context.AppContext) error { signerAddress, err := oc.zetacoreClient.GetKeys().GetAddress() if err != nil { @@ -231,6 +237,7 @@ func (oc *Orchestrator) GetPendingCctxsWithinRatelimit( } // StartCctxScheduler schedules keysigns for cctxs on each ZetaChain block (the ticker) +// TODO(revamp): make this function simpler func (oc *Orchestrator) StartCctxScheduler(appContext *context.AppContext) { observeTicker := time.NewTicker(3 * time.Second) var lastBlockNum int64 diff --git a/zetaclient/outboundprocessor/outbound_processor.go b/zetaclient/outboundprocessor/outbound_processor.go index feb4caafa7..75a9a6a19f 100644 --- a/zetaclient/outboundprocessor/outbound_processor.go +++ b/zetaclient/outboundprocessor/outbound_processor.go @@ -1,3 +1,4 @@ +// Package outboundprocessor provides functionalities to track outbound processing package outboundprocessor import ( @@ -8,6 +9,9 @@ import ( "github.com/rs/zerolog" ) +// Processor is a struct that contains data about outbound being processed +// TODO(revamp): rename this struct as it is not used to process outbound but track their processing +// We can also consider removing it once we refactor chain client to contains common logic to sign outbounds type Processor struct { outboundStartTime map[string]time.Time outboundEndTime map[string]time.Time @@ -17,6 +21,7 @@ type Processor struct { numActiveProcessor int64 } +// NewProcessor creates a new Processor func NewProcessor(logger zerolog.Logger) *Processor { return &Processor{ outboundStartTime: make(map[string]time.Time), @@ -28,6 +33,7 @@ func NewProcessor(logger zerolog.Logger) *Processor { } } +// StartTryProcess register a new outbound ID to track func (p *Processor) StartTryProcess(outboundID string) { p.mu.Lock() defer p.mu.Unlock() @@ -37,6 +43,7 @@ func (p *Processor) StartTryProcess(outboundID string) { p.Logger.Info().Msgf("StartTryProcess %s, numActiveProcessor %d", outboundID, p.numActiveProcessor) } +// EndTryProcess remove the outbound ID from tracking func (p *Processor) EndTryProcess(outboundID string) { p.mu.Lock() defer p.mu.Unlock() @@ -47,6 +54,7 @@ func (p *Processor) EndTryProcess(outboundID string) { Msgf("EndTryProcess %s, numActiveProcessor %d, time elapsed %s", outboundID, p.numActiveProcessor, time.Since(p.outboundStartTime[outboundID])) } +// IsOutboundActive checks if the outbound ID is being processed func (p *Processor) IsOutboundActive(outboundID string) bool { p.mu.Lock() defer p.mu.Unlock() @@ -54,6 +62,7 @@ func (p *Processor) IsOutboundActive(outboundID string) bool { return found } +// TimeInTryProcess returns the time elapsed since the outbound ID is being processed func (p *Processor) TimeInTryProcess(outboundID string) time.Duration { p.mu.Lock() defer p.mu.Unlock() diff --git a/zetaclient/ratelimiter/rate_limiter.go b/zetaclient/ratelimiter/rate_limiter.go index 0ddb3b378b..e3c69898fa 100644 --- a/zetaclient/ratelimiter/rate_limiter.go +++ b/zetaclient/ratelimiter/rate_limiter.go @@ -1,3 +1,4 @@ +// Package ratelimiter provides functionalities for rate limiting the cross-chain transactions package ratelimiter import ( diff --git a/zetaclient/supplychecker/logger.go b/zetaclient/supplychecker/logger.go index 223e43eab8..89da0300d6 100644 --- a/zetaclient/supplychecker/logger.go +++ b/zetaclient/supplychecker/logger.go @@ -21,6 +21,7 @@ type ZetaSupplyCheckLogs struct { SupplyCheckSuccess bool `json:"supply_check_success"` } +// LogOutput logs the output of the ZetaSupplyChecker func (z ZetaSupplyCheckLogs) LogOutput() { output, err := bitcoin.PrettyPrintStruct(z) if err != nil { diff --git a/zetaclient/supplychecker/validate.go b/zetaclient/supplychecker/validate.go index d70bda8c34..f9e4dbaf79 100644 --- a/zetaclient/supplychecker/validate.go +++ b/zetaclient/supplychecker/validate.go @@ -5,6 +5,7 @@ import ( "github.com/rs/zerolog" ) +// ValidateZetaSupply validates the zeta supply from the checked values func ValidateZetaSupply( logger zerolog.Logger, abortedTxAmounts, zetaInTransit, genesisAmounts, externalChainTotalSupply, zetaTokenSupplyOnNode, ethLockedAmount sdkmath.Int, diff --git a/zetaclient/supplychecker/zeta_supply_checker.go b/zetaclient/supplychecker/zeta_supply_checker.go index 952c0df16f..10ad1d5db1 100644 --- a/zetaclient/supplychecker/zeta_supply_checker.go +++ b/zetaclient/supplychecker/zeta_supply_checker.go @@ -1,3 +1,5 @@ +// Package supplychecker provides functionalities to check the total supply of Zeta tokens +// Currently not used in the codebase package supplychecker import ( @@ -92,6 +94,7 @@ func NewZetaSupplyChecker( return zetaSupplyChecker, nil } +// Start starts the ZetaSupplyChecker func (zs *ZetaSupplyChecker) Start() { defer zs.ticker.Stop() for { @@ -107,11 +110,13 @@ func (zs *ZetaSupplyChecker) Start() { } } +// Stop stops the ZetaSupplyChecker func (zs *ZetaSupplyChecker) Stop() { zs.logger.Info().Msgf("ZetaSupplyChecker is stopping") close(zs.stop) } +// CheckZetaTokenSupply checks the total supply of Zeta tokens func (zs *ZetaSupplyChecker) CheckZetaTokenSupply() error { externalChainTotalSupply := sdkmath.ZeroInt() for _, chain := range zs.externalEvmChain { @@ -193,6 +198,7 @@ func (zs *ZetaSupplyChecker) CheckZetaTokenSupply() error { return nil } +// AbortedTxAmount returns the amount of Zeta tokens in aborted transactions func (zs *ZetaSupplyChecker) AbortedTxAmount() (sdkmath.Int, error) { amount, err := zs.zetaClient.GetAbortedZetaAmount() if err != nil { @@ -205,6 +211,7 @@ func (zs *ZetaSupplyChecker) AbortedTxAmount() (sdkmath.Int, error) { return amountInt, nil } +// GetAmountOfZetaInTransit returns the amount of Zeta tokens in transit func (zs *ZetaSupplyChecker) GetAmountOfZetaInTransit() (sdkmath.Int, error) { chainsToCheck := make([]chains.Chain, len(zs.externalEvmChain)+1) chainsToCheck = append(append(chainsToCheck, zs.externalEvmChain...), zs.ethereumChain) @@ -222,6 +229,7 @@ func (zs *ZetaSupplyChecker) GetAmountOfZetaInTransit() (sdkmath.Int, error) { return amountInt, nil } +// GetPendingCCTXInTransit returns the pending CCTX in transit func (zs *ZetaSupplyChecker) GetPendingCCTXInTransit(receivingChains []chains.Chain) []*types.CrossChainTx { cctxInTransit := make([]*types.CrossChainTx, 0) for _, chain := range receivingChains { diff --git a/zetaclient/testutils/mempool_client.go b/zetaclient/testutils/mempool_client.go index 03c79120dc..a49ff45e78 100644 --- a/zetaclient/testutils/mempool_client.go +++ b/zetaclient/testutils/mempool_client.go @@ -15,6 +15,7 @@ const ( APIURLBlockTxsTestnet = "https://mempool.space/testnet/api/block/%s/txs" ) +// MempoolBlock represents a block in the mempool type MempoolBlock struct { ID string `json:"id"` Height int `json:"height"` @@ -32,6 +33,7 @@ type MempoolBlock struct { Extras BlockExtra `json:"extras"` } +// Vin represents a Bitcoin transaction input type Vin struct { TxID string `json:"txid"` Vout uint32 `json:"vout"` @@ -47,6 +49,7 @@ type Vin struct { Sequence uint32 `json:"sequence"` } +// Vout represents a Bitcoin transaction output type Vout struct { Scriptpubkey string `json:"scriptpubkey"` ScriptpubkeyAsm string `json:"scriptpubkey_asm"` @@ -54,6 +57,7 @@ type Vout struct { Value int64 `json:"value"` } +// MempoolTx represents a transaction in the mempool type MempoolTx struct { TxID string `json:"txid"` Version int `json:"version"` @@ -65,6 +69,7 @@ type MempoolTx struct { Fee int `json:"fee"` } +// BlockExtra represents extra information about a block type BlockExtra struct { TotalFees int `json:"totalFees"` MedianFee float64 `json:"medianFee"` @@ -105,6 +110,7 @@ type BlockExtra struct { ExpectedWeight int `json:"expectedWeight"` } +// Get makes a GET request to the given path and decodes the response func Get(ctx context.Context, path string, v interface{}) error { req, err := http.NewRequest("GET", path, nil) if err != nil { diff --git a/zetaclient/testutils/mocks/zetacore_client.go b/zetaclient/testutils/mocks/zetacore_client.go index 953d8ce287..2f413a8764 100644 --- a/zetaclient/testutils/mocks/zetacore_client.go +++ b/zetaclient/testutils/mocks/zetacore_client.go @@ -145,13 +145,6 @@ func (m *MockZetacoreClient) GetBlockHeight() (int64, error) { return 0, nil } -func (m *MockZetacoreClient) GetLastBlockHeightByChain(_ chains.Chain) (*crosschaintypes.LastBlockHeight, error) { - if m.paused { - return nil, errors.New(ErrMsgPaused) - } - return &crosschaintypes.LastBlockHeight{}, nil -} - func (m *MockZetacoreClient) GetRateLimiterInput(_ int64) (crosschaintypes.QueryRateLimiterInputResponse, error) { if m.paused { return crosschaintypes.QueryRateLimiterInputResponse{}, errors.New(ErrMsgPaused) diff --git a/zetaclient/testutils/testdata.go b/zetaclient/testutils/testdata.go index fc028bf0ec..620eb16b17 100644 --- a/zetaclient/testutils/testdata.go +++ b/zetaclient/testutils/testdata.go @@ -48,6 +48,8 @@ func LoadObjectFromJSONFile(t *testing.T, obj interface{}, filename string) { require.NoError(t, err) } +// ComplianceConfigTest returns a test compliance config +// TODO(revamp): move to sample package func ComplianceConfigTest() config.ComplianceConfig { return config.ComplianceConfig{ RestrictedAddresses: []string{RestrictedEVMAddressTest, RestrictedBtcAddressTest}, diff --git a/zetaclient/tss/tss_signer.go b/zetaclient/tss/tss_signer.go index 8fdd0384ee..08d48833db 100644 --- a/zetaclient/tss/tss_signer.go +++ b/zetaclient/tss/tss_signer.go @@ -1,3 +1,4 @@ +// Package tss provides the TSS signer functionalities for the zetaclient to sign transactions on external chains package tss import ( @@ -37,15 +38,18 @@ import ( ) const ( + // envFlagPostBlame is the environment flag to enable posting blame data to core envFlagPostBlame = "POST_BLAME" ) +// Key is a struct that holds the public key, bech32 pubkey, and address for the TSS type Key struct { PubkeyInBytes []byte PubkeyInBech32 string AddressInHex string } +// NewTSSKey creates a new TSS key func NewTSSKey(pk string) (*Key, error) { TSSKey := &Key{ PubkeyInBech32: pk, @@ -141,6 +145,8 @@ func NewTSS( return &newTss, nil } +// SetupTSSServer creates a new TSS server +// TODO(revamp): move to TSS server file func SetupTSSServer( peer p2p.AddrList, privkey tmcrypto.PrivKey, @@ -207,6 +213,7 @@ func SetupTSSServer( return tssServer, nil } +// Pubkey returns the current pubkey func (tss *TSS) Pubkey() []byte { return tss.Keys[tss.CurrentPubkey].PubkeyInBytes } @@ -404,6 +411,7 @@ func (tss *TSS) SignBatch(digests [][]byte, height uint64, nonce uint64, chainID return sigBytes, nil } +// Validate validates the TSS func (tss *TSS) Validate() error { evmAddress := tss.EVMAddress() blankAddress := ethcommon.Address{} @@ -419,6 +427,7 @@ func (tss *TSS) Validate() error { return nil } +// EVMAddress generates an EVM address from pubkey func (tss *TSS) EVMAddress() ethcommon.Address { addr, err := GetTssAddrEVM(tss.CurrentPubkey) if err != nil { @@ -438,6 +447,7 @@ func (tss *TSS) BTCAddress() string { return addr } +// BTCAddressWitnessPubkeyHash generates a bech32 p2wpkh address from pubkey func (tss *TSS) BTCAddressWitnessPubkeyHash() *btcutil.AddressWitnessPubKeyHash { addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tss.CurrentPubkey, tss.BitcoinChainID) if err != nil { @@ -447,6 +457,7 @@ func (tss *TSS) BTCAddressWitnessPubkeyHash() *btcutil.AddressWitnessPubKeyHash return addrWPKH } +// PubKeyCompressedBytes returns the compressed bytes of the current pubkey func (tss *TSS) PubKeyCompressedBytes() []byte { pubk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tss.CurrentPubkey) if err != nil { @@ -466,6 +477,7 @@ func (tss *TSS) InsertPubKey(pk string) error { return nil } +// VerifyKeysharesForPubkeys verifies the keyshares present on the node. It checks whether the node has TSS key shares for the TSS ceremonies it was part of. func (tss *TSS) VerifyKeysharesForPubkeys(tssList []observertypes.TSS, granteePubKey32 string) error { for _, t := range tssList { if wasNodePartOfTss(granteePubKey32, t.TssParticipantList) { @@ -477,6 +489,7 @@ func (tss *TSS) VerifyKeysharesForPubkeys(tssList []observertypes.TSS, granteePu return nil } +// LoadTssFilesFromDirectory loads the TSS files at the directory specified by the `tssPath` func (tss *TSS) LoadTssFilesFromDirectory(tssPath string) error { files, err := os.ReadDir(tssPath) if err != nil { @@ -528,6 +541,7 @@ func (tss *TSS) LoadTssFilesFromDirectory(tssPath string) error { return nil } +// GetTssAddrBTC generates a bech32 p2wpkh address from pubkey func GetTssAddrBTC(tssPubkey string, bitcoinChainID int64) (string, error) { addrWPKH, err := getKeyAddrBTCWitnessPubkeyHash(tssPubkey, bitcoinChainID) if err != nil { @@ -538,6 +552,7 @@ func GetTssAddrBTC(tssPubkey string, bitcoinChainID int64) (string, error) { return addrWPKH.EncodeAddress(), nil } +// GetTssAddrEVM generates an EVM address from pubkey func GetTssAddrEVM(tssPubkey string) (ethcommon.Address, error) { var keyAddr ethcommon.Address pubk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tssPubkey) @@ -558,6 +573,9 @@ func GetTssAddrEVM(tssPubkey string) (ethcommon.Address, error) { return keyAddr, nil } +// TestKeysign tests the keysign +// it is called when a new TSS is generated to ensure the network works as expected +// TODO(revamp): move to a test package func TestKeysign(tssPubkey string, tssServer *tss.TssServer) error { log.Info().Msg("trying keysign...") data := []byte("hello meta") @@ -594,11 +612,14 @@ func TestKeysign(tssPubkey string, tssServer *tss.TssServer) error { return fmt.Errorf("verify signature fail") } +// IsEnvFlagEnabled checks if the environment flag is enabled func IsEnvFlagEnabled(flag string) bool { value := os.Getenv(flag) return value == "true" || value == "1" } +// verifySignature verifies the signature +// TODO(revamp): move to a test package func verifySignature(tssPubkey string, signature []keysign.Signature, H []byte) bool { if len(signature) == 0 { log.Warn().Msg("verify_signature: empty signature array") @@ -640,12 +661,15 @@ func verifySignature(tssPubkey string, signature []keysign.Signature, H []byte) return bytes.Equal(pubkey.Bytes(), compressedPubkey) } +// combineDigests combines the digests func combineDigests(digestList []string) []byte { digestConcat := strings.Join(digestList[:], "") digestBytes := chainhash.DoubleHashH([]byte(digestConcat)) return digestBytes.CloneBytes() } +// wasNodePartOfTss checks if the node was part of the TSS +// it checks whether a pubkey is part of the list used to generate the TSS , Every TSS generated on the network has its own list of associated public keys func wasNodePartOfTss(granteePubKey32 string, granteeList []string) bool { for _, grantee := range granteeList { if granteePubKey32 == grantee { @@ -655,6 +679,7 @@ func wasNodePartOfTss(granteePubKey32 string, granteeList []string) bool { return false } +// getKeyAddrBTCWitnessPubkeyHash generates a bech32 p2wpkh address from pubkey func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string, chainID int64) (*btcutil.AddressWitnessPubKeyHash, error) { pubk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tssPubkey) if err != nil { diff --git a/zetaclient/types/dynamic_ticker.go b/zetaclient/types/dynamic_ticker.go index 49434e03ea..103bfffb94 100644 --- a/zetaclient/types/dynamic_ticker.go +++ b/zetaclient/types/dynamic_ticker.go @@ -7,12 +7,14 @@ import ( "github.com/rs/zerolog" ) +// DynamicTicker is a ticker that can have its interval updated type DynamicTicker struct { name string interval uint64 impl *time.Ticker } +// NewDynamicTicker creates a new DynamicTicker func NewDynamicTicker(name string, interval uint64) (*DynamicTicker, error) { if interval <= 0 { return nil, fmt.Errorf("non-positive ticker interval %d for %s", interval, name) @@ -25,10 +27,12 @@ func NewDynamicTicker(name string, interval uint64) (*DynamicTicker, error) { }, nil } +// C returns the channel of the ticker func (t *DynamicTicker) C() <-chan time.Time { return t.impl.C } +// UpdateInterval updates the interval of the ticker func (t *DynamicTicker) UpdateInterval(newInterval uint64, logger zerolog.Logger) { if newInterval > 0 && t.interval != newInterval { t.impl.Stop() @@ -39,6 +43,7 @@ func (t *DynamicTicker) UpdateInterval(newInterval uint64, logger zerolog.Logger } } +// Stop stops the ticker func (t *DynamicTicker) Stop() { t.impl.Stop() } diff --git a/zetaclient/types/ethish.go b/zetaclient/types/ethish.go index fd3a40af6d..6935a22141 100644 --- a/zetaclient/types/ethish.go +++ b/zetaclient/types/ethish.go @@ -4,6 +4,7 @@ import ( "encoding/hex" ) +// EthHexToBytes converts an Ethereum hex string to bytes func BytesToEthHex(b []byte) string { return "0x" + hex.EncodeToString(b) } diff --git a/zetaclient/types/sql_evm.go b/zetaclient/types/sql_evm.go index c551fda503..398a968a60 100644 --- a/zetaclient/types/sql_evm.go +++ b/zetaclient/types/sql_evm.go @@ -71,6 +71,7 @@ type LastBlockSQLType struct { // Type translation functions: +// ToReceiptDBType : Converts an Ethereum receipt to a ReceiptDB type func ToReceiptDBType(receipt *ethtypes.Receipt) (ReceiptDB, error) { logs, err := json.Marshal(receipt.Logs) if err != nil { @@ -92,6 +93,7 @@ func ToReceiptDBType(receipt *ethtypes.Receipt) (ReceiptDB, error) { }, nil } +// FromReceiptDBType : Converts a ReceiptDB type to an Ethereum receipt func FromReceiptDBType(receipt ReceiptDB) (*ethtypes.Receipt, error) { res := ðtypes.Receipt{ Type: receipt.Type, @@ -111,6 +113,7 @@ func FromReceiptDBType(receipt ReceiptDB) (*ethtypes.Receipt, error) { return res, err } +// ToReceiptSQLType : Converts an Ethereum receipt to a ReceiptSQLType func ToReceiptSQLType(receipt *ethtypes.Receipt, index string) (*ReceiptSQLType, error) { r, err := ToReceiptDBType(receipt) if err != nil { @@ -122,6 +125,7 @@ func ToReceiptSQLType(receipt *ethtypes.Receipt, index string) (*ReceiptSQLType, }, nil } +// ToTransactionDBType : Converts an Ethereum transaction to a TransactionDB type func ToTransactionDBType(transaction *ethtypes.Transaction) (TransactionDB, error) { data, err := transaction.MarshalBinary() if err != nil { @@ -137,12 +141,14 @@ func ToTransactionDBType(transaction *ethtypes.Transaction) (TransactionDB, erro }, nil } +// FromTransactionDBType : Converts a TransactionDB type to an Ethereum transaction func FromTransactionDBType(transaction TransactionDB) (*ethtypes.Transaction, error) { res := ðtypes.Transaction{} err := res.UnmarshalBinary(transaction.TransactionData) return res, err } +// ToTransactionSQLType : Converts an Ethereum transaction to a TransactionSQLType func ToTransactionSQLType(transaction *ethtypes.Transaction, index string) (*TransactionSQLType, error) { trans, err := ToTransactionDBType(transaction) if err != nil { @@ -154,6 +160,7 @@ func ToTransactionSQLType(transaction *ethtypes.Transaction, index string) (*Tra }, nil } +// ToLastBlockSQLType : Converts a last block number to a LastBlockSQLType func ToLastBlockSQLType(lastBlock uint64) *LastBlockSQLType { return &LastBlockSQLType{ Model: gorm.Model{ID: LastBlockNumID}, diff --git a/zetaclient/zetacore/broadcast.go b/zetaclient/zetacore/broadcast.go index 82a011c6ba..6c1b475476 100644 --- a/zetaclient/zetacore/broadcast.go +++ b/zetaclient/zetacore/broadcast.go @@ -50,7 +50,7 @@ func BroadcastToZetaCore( return client.Broadcast(gasLimit, authzWrappedMsg, authzSigner) } -// Broadcast Broadcasts tx to metachain. Returns txHash and error +// Broadcast Broadcasts tx to ZetaChain. Returns txHash and error func (c *Client) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg, authzSigner authz.Signer) (string, error) { c.broadcastLock.Lock() defer c.broadcastLock.Unlock() @@ -204,6 +204,7 @@ func (c *Client) GetContext() (client.Context, error) { return ctx, nil } +// SignTx signs a tx with the given name func (c *Client) SignTx( txf clienttx.Factory, name string, diff --git a/zetaclient/zetacore/client.go b/zetaclient/zetacore/client.go index 3b85296fe1..4443316a4a 100644 --- a/zetaclient/zetacore/client.go +++ b/zetaclient/zetacore/client.go @@ -1,3 +1,4 @@ +// Package zetacore provides functionalities for interacting with ZetaChain package zetacore import ( @@ -283,14 +284,18 @@ func (c *Client) UpdateZetacoreContext( return nil } +// Pause pauses the client func (c *Client) Pause() { <-c.pause } +// Unpause unpauses the client func (c *Client) Unpause() { c.pause <- struct{}{} } +// EnableMockSDKClient enables the mock cosmos sdk client +// TODO(revamp): move this to a test package func (c *Client) EnableMockSDKClient(client rpcclient.Client) { c.mockSDKClient = client c.enableMockSDKClient = true diff --git a/zetaclient/zetacore/query.go b/zetaclient/zetacore/query.go index b68ea37f8b..e90be274ff 100644 --- a/zetaclient/zetacore/query.go +++ b/zetaclient/zetacore/query.go @@ -25,6 +25,7 @@ import ( "github.com/zeta-chain/zetacore/zetaclient/chains/interfaces" ) +// GetCrosschainFlags returns the crosschain flags func (c *Client) GetCrosschainFlags() (observertypes.CrosschainFlags, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.CrosschainFlags(context.Background(), &observertypes.QueryGetCrosschainFlagsRequest{}) @@ -34,6 +35,7 @@ func (c *Client) GetCrosschainFlags() (observertypes.CrosschainFlags, error) { return resp.CrosschainFlags, nil } +// GetBlockHeaderEnabledChains returns the enabled chains for block headers func (c *Client) GetBlockHeaderEnabledChains() ([]lightclienttypes.HeaderSupportedChain, error) { client := lightclienttypes.NewQueryClient(c.grpcConn) resp, err := client.HeaderEnabledChains(context.Background(), &lightclienttypes.QueryHeaderEnabledChainsRequest{}) @@ -43,6 +45,7 @@ func (c *Client) GetBlockHeaderEnabledChains() ([]lightclienttypes.HeaderSupport return resp.HeaderEnabledChains, nil } +// GetRateLimiterFlags returns the rate limiter flags func (c *Client) GetRateLimiterFlags() (crosschaintypes.RateLimiterFlags, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.RateLimiterFlags(context.Background(), &crosschaintypes.QueryRateLimiterFlagsRequest{}) @@ -52,6 +55,7 @@ func (c *Client) GetRateLimiterFlags() (crosschaintypes.RateLimiterFlags, error) return resp.RateLimiterFlags, nil } +// GetChainParamsForChainID returns the chain params for a given chain ID func (c *Client) GetChainParamsForChainID(externalChainID int64) (*observertypes.ChainParams, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.GetChainParamsForChain( @@ -64,6 +68,7 @@ func (c *Client) GetChainParamsForChainID(externalChainID int64) (*observertypes return resp.ChainParams, nil } +// GetChainParams returns all the chain params func (c *Client) GetChainParams() ([]*observertypes.ChainParams, error) { client := observertypes.NewQueryClient(c.grpcConn) var err error @@ -79,6 +84,7 @@ func (c *Client) GetChainParams() ([]*observertypes.ChainParams, error) { return nil, fmt.Errorf("failed to get chain params | err %s", err.Error()) } +// GetUpgradePlan returns the current upgrade plan func (c *Client) GetUpgradePlan() (*upgradetypes.Plan, error) { client := upgradetypes.NewQueryClient(c.grpcConn) @@ -89,6 +95,7 @@ func (c *Client) GetUpgradePlan() (*upgradetypes.Plan, error) { return resp.Plan, nil } +// GetAllCctx returns all cross chain transactions func (c *Client) GetAllCctx() ([]*crosschaintypes.CrossChainTx, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.CctxAll(context.Background(), &crosschaintypes.QueryAllCctxRequest{}) @@ -98,6 +105,7 @@ func (c *Client) GetAllCctx() ([]*crosschaintypes.CrossChainTx, error) { return resp.CrossChainTx, nil } +// GetCctxByHash returns a cross chain transaction by hash func (c *Client) GetCctxByHash(sendHash string) (*crosschaintypes.CrossChainTx, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.Cctx(context.Background(), &crosschaintypes.QueryGetCctxRequest{Index: sendHash}) @@ -107,6 +115,7 @@ func (c *Client) GetCctxByHash(sendHash string) (*crosschaintypes.CrossChainTx, return resp.CrossChainTx, nil } +// GetCctxByNonce returns a cross chain transaction by nonce func (c *Client) GetCctxByNonce(chainID int64, nonce uint64) (*crosschaintypes.CrossChainTx, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.CctxByNonce(context.Background(), &crosschaintypes.QueryGetCctxByNonceRequest{ @@ -119,6 +128,7 @@ func (c *Client) GetCctxByNonce(chainID int64, nonce uint64) (*crosschaintypes.C return resp.CrossChainTx, nil } +// GetObserverList returns the list of observers func (c *Client) GetObserverList() ([]string, error) { var err error client := observertypes.NewQueryClient(c.grpcConn) @@ -185,6 +195,7 @@ func (c *Client) ListPendingCctxWithinRatelimit() ([]*crosschaintypes.CrossChain return resp.CrossChainTx, resp.TotalPending, resp.CurrentWithdrawWindow, resp.CurrentWithdrawRate, resp.RateLimitExceeded, nil } +// GetAbortedZetaAmount returns the amount of zeta that has been aborted func (c *Client) GetAbortedZetaAmount() (string, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.ZetaAccounting(context.Background(), &crosschaintypes.QueryZetaAccountingRequest{}) @@ -194,6 +205,7 @@ func (c *Client) GetAbortedZetaAmount() (string, error) { return resp.AbortedZetaAmount, nil } +// GetGenesisSupply returns the genesis supply func (c *Client) GetGenesisSupply() (sdkmath.Int, error) { tmURL := fmt.Sprintf("http://%s", c.cfg.ChainRPC) s, err := tmhttp.New(tmURL, "/websocket") @@ -212,6 +224,7 @@ func (c *Client) GetGenesisSupply() (sdkmath.Int, error) { return bankstate.Supply.AmountOf(config.BaseDenom), nil } +// GetZetaTokenSupplyOnNode returns the zeta token supply on the node func (c *Client) GetZetaTokenSupplyOnNode() (sdkmath.Int, error) { client := banktypes.NewQueryClient(c.grpcConn) resp, err := client.SupplyOf(context.Background(), &banktypes.QuerySupplyOfRequest{Denom: config.BaseDenom}) @@ -221,6 +234,7 @@ func (c *Client) GetZetaTokenSupplyOnNode() (sdkmath.Int, error) { return resp.GetAmount().Amount, nil } +// GetLastBlockHeight returns the last block height func (c *Client) GetLastBlockHeight() ([]*crosschaintypes.LastBlockHeight, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.LastBlockHeightAll(context.Background(), &crosschaintypes.QueryAllLastBlockHeightRequest{}) @@ -231,6 +245,7 @@ func (c *Client) GetLastBlockHeight() ([]*crosschaintypes.LastBlockHeight, error return resp.LastBlockHeight, nil } +// GetLatestZetaBlock returns the latest zeta block func (c *Client) GetLatestZetaBlock() (*tmservice.Block, error) { client := tmservice.NewServiceClient(c.grpcConn) res, err := client.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{}) @@ -240,6 +255,7 @@ func (c *Client) GetLatestZetaBlock() (*tmservice.Block, error) { return res.SdkBlock, nil } +// GetNodeInfo returns the node info func (c *Client) GetNodeInfo() (*tmservice.GetNodeInfoResponse, error) { var err error @@ -254,18 +270,7 @@ func (c *Client) GetNodeInfo() (*tmservice.GetNodeInfoResponse, error) { return nil, err } -func (c *Client) GetLastBlockHeightByChain(chain chains.Chain) (*crosschaintypes.LastBlockHeight, error) { - client := crosschaintypes.NewQueryClient(c.grpcConn) - resp, err := client.LastBlockHeight( - context.Background(), - &crosschaintypes.QueryGetLastBlockHeightRequest{Index: chain.ChainName.String()}, - ) - if err != nil { - return nil, err - } - return resp.LastBlockHeight, nil -} - +// GetBlockHeight returns the zetachain block height func (c *Client) GetBlockHeight() (int64, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.LastZetaHeight(context.Background(), &crosschaintypes.QueryLastZetaHeightRequest{}) @@ -275,6 +280,7 @@ func (c *Client) GetBlockHeight() (int64, error) { return resp.Height, nil } +// GetBaseGasPrice returns the base gas price func (c *Client) GetBaseGasPrice() (int64, error) { client := feemarkettypes.NewQueryClient(c.grpcConn) resp, err := client.Params(context.Background(), &feemarkettypes.QueryParamsRequest{}) @@ -287,6 +293,7 @@ func (c *Client) GetBaseGasPrice() (int64, error) { return resp.Params.BaseFee.Int64(), nil } +// GetBallotByID returns a ballot by ID func (c *Client) GetBallotByID(id string) (*observertypes.QueryBallotByIdentifierResponse, error) { client := observertypes.NewQueryClient(c.grpcConn) return client.BallotByIdentifier(context.Background(), &observertypes.QueryBallotByIdentifierRequest{ @@ -294,6 +301,7 @@ func (c *Client) GetBallotByID(id string) (*observertypes.QueryBallotByIdentifie }) } +// GetNonceByChain returns the nonce by chain func (c *Client) GetNonceByChain(chain chains.Chain) (observertypes.ChainNonces, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.ChainNonces( @@ -306,6 +314,7 @@ func (c *Client) GetNonceByChain(chain chains.Chain) (observertypes.ChainNonces, return resp.ChainNonces, nil } +// GetAllNodeAccounts returns all node accounts func (c *Client) GetAllNodeAccounts() ([]*observertypes.NodeAccount, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.NodeAccountAll(context.Background(), &observertypes.QueryAllNodeAccountRequest{}) @@ -316,6 +325,7 @@ func (c *Client) GetAllNodeAccounts() ([]*observertypes.NodeAccount, error) { return resp.NodeAccount, nil } +// GetKeyGen returns the keygen func (c *Client) GetKeyGen() (*observertypes.Keygen, error) { var err error client := observertypes.NewQueryClient(c.grpcConn) @@ -330,6 +340,7 @@ func (c *Client) GetKeyGen() (*observertypes.Keygen, error) { return nil, fmt.Errorf("failed to get keygen | err %s", err.Error()) } +// GetBallot returns a ballot by ID func (c *Client) GetBallot(ballotIdentifier string) (*observertypes.QueryBallotByIdentifierResponse, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.BallotByIdentifier(context.Background(), &observertypes.QueryBallotByIdentifierRequest{ @@ -341,6 +352,7 @@ func (c *Client) GetBallot(ballotIdentifier string) (*observertypes.QueryBallotB return resp, nil } +// GetInboundTrackersForChain returns the inbound trackers for a chain func (c *Client) GetInboundTrackersForChain(chainID int64) ([]crosschaintypes.InboundTracker, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.InboundTrackerAllByChain( @@ -353,6 +365,7 @@ func (c *Client) GetInboundTrackersForChain(chainID int64) ([]crosschaintypes.In return resp.InboundTracker, nil } +// GetCurrentTss returns the current TSS func (c *Client) GetCurrentTss() (observertypes.TSS, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.TSS(context.Background(), &observertypes.QueryGetTSSRequest{}) @@ -362,6 +375,8 @@ func (c *Client) GetCurrentTss() (observertypes.TSS, error) { return resp.TSS, nil } +// GetEthTssAddress returns the ETH TSS address +// TODO(revamp): rename to EVM func (c *Client) GetEthTssAddress() (string, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.GetTssAddress(context.Background(), &observertypes.QueryGetTssAddressRequest{}) @@ -371,6 +386,7 @@ func (c *Client) GetEthTssAddress() (string, error) { return resp.Eth, nil } +// GetBtcTssAddress returns the BTC TSS address func (c *Client) GetBtcTssAddress(chainID int64) (string, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.GetTssAddress(context.Background(), &observertypes.QueryGetTssAddressRequest{ @@ -382,6 +398,7 @@ func (c *Client) GetBtcTssAddress(chainID int64) (string, error) { return resp.Btc, nil } +// GetTssHistory returns the TSS history func (c *Client) GetTssHistory() ([]observertypes.TSS, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.TssHistory(context.Background(), &observertypes.QueryTssHistoryRequest{}) @@ -391,6 +408,7 @@ func (c *Client) GetTssHistory() ([]observertypes.TSS, error) { return resp.TssList, nil } +// GetOutboundTracker returns the outbound tracker for a chain and nonce func (c *Client) GetOutboundTracker(chain chains.Chain, nonce uint64) (*crosschaintypes.OutboundTracker, error) { client := crosschaintypes.NewQueryClient(c.grpcConn) resp, err := client.OutboundTracker(context.Background(), &crosschaintypes.QueryGetOutboundTrackerRequest{ @@ -403,6 +421,7 @@ func (c *Client) GetOutboundTracker(chain chains.Chain, nonce uint64) (*crosscha return &resp.OutboundTracker, nil } +// GetAllOutboundTrackerByChain returns all outbound trackers for a chain func (c *Client) GetAllOutboundTrackerByChain( chainID int64, order interfaces.Order, @@ -437,6 +456,7 @@ func (c *Client) GetAllOutboundTrackerByChain( return resp.OutboundTracker, nil } +// GetPendingNoncesByChain returns the pending nonces for a chain and current tss address func (c *Client) GetPendingNoncesByChain(chainID int64) (observertypes.PendingNonces, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.PendingNoncesByChain( @@ -449,6 +469,7 @@ func (c *Client) GetPendingNoncesByChain(chainID int64) (observertypes.PendingNo return resp.PendingNonces, nil } +// GetBlockHeaderChainState returns the block header chain state func (c *Client) GetBlockHeaderChainState(chainID int64) (lightclienttypes.QueryGetChainStateResponse, error) { client := lightclienttypes.NewQueryClient(c.grpcConn) resp, err := client.ChainState(context.Background(), &lightclienttypes.QueryGetChainStateRequest{ChainId: chainID}) @@ -458,6 +479,7 @@ func (c *Client) GetBlockHeaderChainState(chainID int64) (lightclienttypes.Query return *resp, nil } +// GetSupportedChains returns the supported chains func (c *Client) GetSupportedChains() ([]*chains.Chain, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.SupportedChains(context.Background(), &observertypes.QuerySupportedChains{}) @@ -467,6 +489,7 @@ func (c *Client) GetSupportedChains() ([]*chains.Chain, error) { return resp.GetChains(), nil } +// GetPendingNonces returns the pending nonces func (c *Client) GetPendingNonces() (*observertypes.QueryAllPendingNoncesResponse, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.PendingNoncesAll(context.Background(), &observertypes.QueryAllPendingNoncesRequest{}) @@ -476,6 +499,7 @@ func (c *Client) GetPendingNonces() (*observertypes.QueryAllPendingNoncesRespons return resp, nil } +// Prove returns whether a proof is valid func (c *Client) Prove( blockHash string, txHash string, @@ -497,6 +521,7 @@ func (c *Client) Prove( return resp.Valid, nil } +// HasVoted returns whether an observer has voted func (c *Client) HasVoted(ballotIndex string, voterAddress string) (bool, error) { client := observertypes.NewQueryClient(c.grpcConn) resp, err := client.HasVoted(context.Background(), &observertypes.QueryHasVotedRequest{ @@ -509,6 +534,7 @@ func (c *Client) HasVoted(ballotIndex string, voterAddress string) (bool, error) return resp.HasVoted, nil } +// GetZetaHotKeyBalance returns the zeta hot key balance func (c *Client) GetZetaHotKeyBalance() (sdkmath.Int, error) { client := banktypes.NewQueryClient(c.grpcConn) address, err := c.keys.GetAddress() diff --git a/zetaclient/zetacore/query_test.go b/zetaclient/zetacore/query_test.go index 05d52fc088..70898b8e11 100644 --- a/zetaclient/zetacore/query_test.go +++ b/zetaclient/zetacore/query_test.go @@ -461,30 +461,6 @@ func TestZetacore_GetNodeInfo(t *testing.T) { require.Equal(t, expectedOutput, *resp) } -func TestZetacore_GetLastBlockHeightByChain(t *testing.T) { - index := chains.BscMainnet - expectedOutput := crosschainTypes.QueryGetLastBlockHeightResponse{ - LastBlockHeight: &crosschainTypes.LastBlockHeight{ - Index: index.ChainName.String(), - Chain: "7000", - LastOutboundHeight: 2134123, - LastInboundHeight: 1234333, - }, - } - input := crosschainTypes.QueryGetLastBlockHeightRequest{Index: index.ChainName.String()} - method := "/zetachain.zetacore.crosschain.Query/LastBlockHeight" - server := setupMockServer(t, crosschainTypes.RegisterQueryServer, method, input, expectedOutput) - server.Serve() - defer closeMockServer(t, server) - - client, err := setupZetacoreClient() - require.NoError(t, err) - - resp, err := client.GetLastBlockHeightByChain(index) - require.NoError(t, err) - require.Equal(t, expectedOutput.LastBlockHeight, resp) -} - func TestZetacore_GetZetaBlockHeight(t *testing.T) { expectedOutput := crosschainTypes.QueryLastZetaHeightResponse{Height: 12345} input := crosschainTypes.QueryLastZetaHeightRequest{} diff --git a/zetaclient/zetacore/tx.go b/zetaclient/zetacore/tx.go index 798654856f..0a28336b04 100644 --- a/zetaclient/zetacore/tx.go +++ b/zetaclient/zetacore/tx.go @@ -24,6 +24,7 @@ import ( ) // GetInboundVoteMessage returns a new MsgVoteInbound +// TODO(revamp): move to a different file func GetInboundVoteMessage( sender string, senderChain int64, @@ -69,6 +70,8 @@ func GasPriceMultiplier(chainID int64) (float64, error) { return 0, fmt.Errorf("cannot get gas price multiplier for unknown chain %d", chainID) } +// WrapMessageWithAuthz wraps a message with an authz message +// used since a hotkey is used to broadcast the transactions, instead of the operator func (c *Client) WrapMessageWithAuthz(msg sdk.Msg) (sdk.Msg, clientauthz.Signer, error) { msgURL := sdk.MsgTypeURL(msg) @@ -82,6 +85,8 @@ func (c *Client) WrapMessageWithAuthz(msg sdk.Msg) (sdk.Msg, clientauthz.Signer, return &authzMessage, authzSigner, nil } +// PostGasPrice posts a gas price vote +// TODO(revamp): rename to PostVoteGasPrice func (c *Client) PostGasPrice(chain chains.Chain, gasPrice uint64, supply string, blockNum uint64) (string, error) { // apply gas price multiplier for the chain multiplier, err := GasPriceMultiplier(chain.ChainId) @@ -110,6 +115,8 @@ func (c *Client) PostGasPrice(chain chains.Chain, gasPrice uint64, supply string return "", fmt.Errorf("post gasprice failed after %d retries", DefaultRetryInterval) } +// AddOutboundTracker adds an outbound tracker +// TODO(revamp): rename to PostAddOutboundTracker func (c *Client) AddOutboundTracker( chainID int64, nonce uint64, @@ -143,6 +150,8 @@ func (c *Client) AddOutboundTracker( return zetaTxHash, nil } +// SetTSS sends message to vote tss +// TODO(revamp): rename to PostVoteTSS func (c *Client) SetTSS(tssPubkey string, keyGenZetaHeight int64, status chains.ReceiveStatus) (string, error) { signerAddress := c.keys.GetOperatorAddress().String() msg := observertypes.NewMsgVoteTSS(signerAddress, tssPubkey, keyGenZetaHeight, status) @@ -166,6 +175,8 @@ func (c *Client) SetTSS(tssPubkey string, keyGenZetaHeight int64, status chains. } // ZetacoreContextUpdater is a polling goroutine that checks and updates zetacore context at every height +// TODO(revamp): move to a different file +// TODO(revamp): rename to UpdateZetacoreContext func (c *Client) ZetacoreContextUpdater(appContext *appcontext.AppContext) { c.logger.Info().Msg("ZetacoreContextUpdater started") ticker := time.NewTicker(time.Duration(appContext.Config().ConfigUpdateTicker) * time.Second) @@ -185,6 +196,8 @@ func (c *Client) ZetacoreContextUpdater(appContext *appcontext.AppContext) { } } +// PostBlameData posts blame data message to zetacore +// TODO(revamp): rename to PostVoteBlame func (c *Client) PostBlameData(blame *blame.Blame, chainID int64, index string) (string, error) { signerAddress := c.keys.GetOperatorAddress().String() zetaBlame := observertypes.Blame{ @@ -212,6 +225,7 @@ func (c *Client) PostBlameData(blame *blame.Blame, chainID int64, index string) return "", fmt.Errorf("post blame data failed after %d retries", DefaultRetryCount) } +// PostVoteBlockHeader posts a vote on an observed block header func (c *Client) PostVoteBlockHeader( chainID int64, blockHash []byte, @@ -280,6 +294,7 @@ func (c *Client) PostVoteInbound(gasLimit, retryGasLimit uint64, msg *types.MsgV // MonitorVoteInboundResult monitors the result of a vote inbound tx // retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas // if retryGasLimit is 0, the tx is not resent +// TODO(revamp): move to a monitor file func (c *Client) MonitorVoteInboundResult(zetaTxHash string, retryGasLimit uint64, msg *types.MsgVoteInbound) { var lastErr error @@ -330,6 +345,7 @@ func (c *Client) MonitorVoteInboundResult(zetaTxHash string, retryGasLimit uint6 } // PostVoteOutbound posts a vote on an observed outbound tx +// TODO(revamp): rename and move to a different file func (c *Client) PostVoteOutbound( cctxIndex string, outboundHash string, @@ -372,6 +388,7 @@ func (c *Client) PostVoteOutbound( } // PostVoteOutboundFromMsg posts a vote on an observed outbound tx from a MsgVoteOutbound +// TODO(revamp): rename to PostVoteOutbound func (c *Client) PostVoteOutboundFromMsg( gasLimit, retryGasLimit uint64, msg *types.MsgVoteOutbound, @@ -412,6 +429,7 @@ func (c *Client) PostVoteOutboundFromMsg( // MonitorVoteOutboundResult monitors the result of a vote outbound tx // retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas // if retryGasLimit is 0, the tx is not resent +// TODO(revamp): move to a monitor file func (c *Client) MonitorVoteOutboundResult(zetaTxHash string, retryGasLimit uint64, msg *types.MsgVoteOutbound) { var lastErr error From 47d835a51ec509616e84ec1886385bd2b2c42059 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 26 Jun 2024 16:13:52 -0400 Subject: [PATCH 4/9] test: add stateful upgrade test (#2364) --- .github/workflows/execute_advanced_tests.yaml | 90 ++++++++++++++++++- .github/workflows/publish-release.yml | 33 ++++++- Makefile | 49 ++++++---- changelog.md | 1 + cmd/zetacored/parse_genesis.go | 2 +- contrib/localnet/docker-compose-upgrade.yml | 1 + contrib/localnet/docker-compose.yml | 3 + contrib/localnet/scripts/import-data.sh | 2 +- .../scripts/start-upgrade-orchestrator.sh | 2 +- contrib/localnet/scripts/start-zetacored.sh | 4 +- .../zetacored/zetacored_parse-genesis-file.md | 2 +- e2e/txserver/zeta_tx_server.go | 4 +- 12 files changed, 165 insertions(+), 28 deletions(-) mode change 100644 => 100755 contrib/localnet/scripts/import-data.sh diff --git a/.github/workflows/execute_advanced_tests.yaml b/.github/workflows/execute_advanced_tests.yaml index 0af6d13a48..77d6a2b6bd 100644 --- a/.github/workflows/execute_advanced_tests.yaml +++ b/.github/workflows/execute_advanced_tests.yaml @@ -11,6 +11,10 @@ on: type: boolean required: false default: false + e2e-stateful-upgrade-test: + type: boolean + required: false + default: false e2e-performance-test: type: boolean required: false @@ -19,6 +23,10 @@ on: type: boolean required: false default: false + e2e-stateful-data-test: + type: boolean + required: false + default: false debug: type: boolean required: false @@ -63,7 +71,7 @@ jobs: e2e-upgrade-test: if: ${{ github.event.inputs.e2e-upgrade-test == 'true' || github.event_name == 'schedule' }} - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: buildjet-16vcpu-ubuntu-2204 timeout-minutes: 120 steps: - name: "Checkout Code" @@ -92,6 +100,37 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} + e2e-stateful-upgrade-test: + if: ${{ github.event.inputs.e2e-stateful-upgrade-test == 'true' || github.event_name == 'schedule' }} + runs-on: buildjet-16vcpu-ubuntu-2204 + timeout-minutes: 120 + steps: + - name: "Checkout Code" + uses: actions/checkout@v4 + + - name: Start Test + run: make start-upgrade-import-mainnet-test + + - name: Watch Test + run: | + container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") + docker logs -f "${container_id}" & + exit $(docker wait "${container_id}") + + - name: Full Log Dump On Failure + if: failure() + run: | + make stop-localnet + + - name: Notify Slack on Failure + if: failure() && github.event_name == 'schedule' + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} + e2e-upgrade-test-light: if: ${{ github.event.inputs.e2e-upgrade-test-light == 'true' }} runs-on: buildjet-4vcpu-ubuntu-2204 @@ -114,6 +153,15 @@ jobs: run: | make stop-localnet + - name: Notify Slack on Failure + if: failure() && github.event_name == 'schedule' + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} + e2e-performance-test: if: ${{ github.event.inputs.e2e-performance-test == 'true' }} runs-on: buildjet-4vcpu-ubuntu-2204 @@ -135,3 +183,43 @@ jobs: if: failure() run: | make stop-localnet + + - name: Notify Slack on Failure + if: failure() && github.event_name == 'schedule' + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} + + e2e-stateful-data-test: + if: ${{ github.event.inputs.e2e-stateful-data-test == 'true' || github.event_name == 'schedule' }} + runs-on: buildjet-16vcpu-ubuntu-2204 + timeout-minutes: 120 + steps: + - name: "Checkout Code" + uses: actions/checkout@v4 + + - name: Start Test + run: make start-e2e-import-mainnet-test + + - name: Watch Test + run: | + container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") + docker logs -f "${container_id}" & + exit $(docker wait "${container_id}") + + - name: Full Log Dump On Failure + if: failure() + run: | + make stop-localnet + + - name: Notify Slack on Failure + if: failure() && github.event_name == 'schedule' + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} \ No newline at end of file diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 89a4b1f688..7eded17252 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -367,6 +367,8 @@ jobs: shell: bash run: | make start-e2e-admin-test + container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") + docker logs -f "${container_id}" & exit $(docker wait "${container_id}") - name: Mark Job Complete Skipped if: ${{ github.event.inputs.skip_checks == 'true' }} @@ -377,7 +379,7 @@ jobs: e2e-upgrade-test: needs: - check_branch - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: buildjet-16vcpu-ubuntu-2204 timeout-minutes: 120 steps: - name: "Checkout Code" @@ -388,7 +390,33 @@ jobs: if: ${{ github.event.inputs.skip_checks != 'true' }} shell: bash run: | - make start-upgrade-test + make start-upgrade-import-mainnet-test + container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") + docker logs -f "${container_id}" & exit $(docker wait "${container_id}") + + - name: Mark Job Complete Skipped + if: ${{ github.event.inputs.skip_checks == 'true' }} + shell: bash + run: | + echo "continue" + + e2e-stateful-data-test: + needs: + - check_branch + runs-on: buildjet-16vcpu-ubuntu-2204 + timeout-minutes: 120 + steps: + - name: "Checkout Code" + if: ${{ github.event.inputs.skip_checks != 'true' }} + uses: actions/checkout@v3 + + - name: Execute stateful-data-test + if: ${{ github.event.inputs.skip_checks != 'true' }} + shell: bash + run: | + make start-e2e-import-mainnet-test + container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") + docker logs -f "${container_id}" & exit $(docker wait "${container_id}") - name: Mark Job Complete Skipped if: ${{ github.event.inputs.skip_checks == 'true' }} @@ -407,6 +435,7 @@ jobs: - smoke-test - build-test - e2e-admin-tests + - e2e-stateful-data-test - e2e-upgrade-test - check_branch runs-on: ubuntu-22.04 diff --git a/Makefile b/Makefile index 858efad24a..509cb40fd7 100644 --- a/Makefile +++ b/Makefile @@ -204,8 +204,22 @@ mocks: generate: proto-gen openapi specs typescript docs-zetacored mocks fmt .PHONY: generate + ############################################################################### -### E2E tests and localnet ### +### Localnet ### +############################################################################### +start-localnet: zetanode start-localnet-skip-build + +start-localnet-skip-build: + @echo "--> Starting localnet" + export LOCALNET_MODE=setup-only && \ + cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml up -d + +stop-localnet: + cd contrib/localnet/ && $(DOCKER) compose down --remove-orphans + +############################################################################### +### E2E tests ### ############################################################################### zetanode: @@ -233,11 +247,21 @@ start-e2e-performance-test: zetanode export E2E_ARGS="--test-performance" && \ cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml up -d +start-e2e-import-mainnet-test: zetanode + @echo "--> Starting e2e import-data test" + export ZETACORED_IMPORT_GENESIS_DATA=true && \ + export ZETACORED_START_PERIOD=15m && \ + cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml up -d + start-stress-test: zetanode @echo "--> Starting stress test" cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-stress.yml up -d -#TODO: replace OLD_VERSION with v16 tag once its available +############################################################################### +### Upgrade Tests ### +############################################################################### + + zetanode-upgrade: zetanode @echo "Building zetanode-upgrade" $(DOCKER) build -t zetanode:old -f Dockerfile-localnet --target old-runtime --build-arg OLD_VERSION='release/v17' . @@ -256,22 +280,13 @@ start-upgrade-test-light: zetanode-upgrade export UPGRADE_HEIGHT=90 && \ cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade.yml up -d -start-localnet: zetanode start-localnet-skip-build - -start-localnet-skip-build: - @echo "--> Starting localnet" - export LOCALNET_MODE=setup-only && \ - cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml up -d - -start-e2e-import-mainnet-test: zetanode - @echo "--> Starting e2e import-data test" +start-upgrade-import-mainnet-test: zetanode-upgrade + @echo "--> Starting import-data upgrade test" + export LOCALNET_MODE=upgrade && \ export ZETACORED_IMPORT_GENESIS_DATA=true && \ - export ZETACORED_START_PERIOD=10m && \ - cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml up -d - -stop-localnet: - cd contrib/localnet/ && $(DOCKER) compose down --remove-orphans - + export ZETACORED_START_PERIOD=15m && \ + export UPGRADE_HEIGHT=225 && \ + cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml -f docker-compose-upgrade.yml up -d ############################################################################### ### Monitoring ### ############################################################################### diff --git a/changelog.md b/changelog.md index db3d2475f4..1a7d568bd3 100644 --- a/changelog.md +++ b/changelog.md @@ -68,6 +68,7 @@ * [2329](https://github.com/zeta-chain/node/pull/2329) - fix TODOs in rpc unit tests * [2342](https://github.com/zeta-chain/node/pull/2342) - extend rpc unit tests with testing extension to include synthetic ethereum txs * [2299](https://github.com/zeta-chain/node/pull/2299) - add `zetae2e` command to deploy test contracts +* [2364](https://github.com/zeta-chain/node/pull/2364) - add stateful upgrade test * [2360](https://github.com/zeta-chain/node/pull/2360) - add stateful e2e tests. * [2349](https://github.com/zeta-chain/node/pull/2349) - add TestBitcoinDepositRefund and WithdrawBitcoinMultipleTimes E2E tests * [2368](https://github.com/zeta-chain/node/pull/2368) - eliminate panic usage across testing suite diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index 8f177ee7ef..b671519d11 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -119,7 +119,7 @@ func CmdParseGenesisFile() *cobra.Command { return nil }, } - cmd.PersistentFlags().Bool("modify", false, "Modify the genesis file before importing") + cmd.PersistentFlags().Bool("modify", false, "modify the genesis file before importing") return cmd } diff --git a/contrib/localnet/docker-compose-upgrade.yml b/contrib/localnet/docker-compose-upgrade.yml index c6ae72941a..badd7db8e5 100644 --- a/contrib/localnet/docker-compose-upgrade.yml +++ b/contrib/localnet/docker-compose-upgrade.yml @@ -1,3 +1,4 @@ +version: "3" # This docker-compose redefine the services: # - ZetaChain with 2 nodes (zetacore0, zetacore1) using the upgrade option for cosmovisor # - ZetaChain observer set with 2 clients (zetaclient0, zetaclient1) using the background option diff --git a/contrib/localnet/docker-compose.yml b/contrib/localnet/docker-compose.yml index 1a59202d0d..e73a946c04 100644 --- a/contrib/localnet/docker-compose.yml +++ b/contrib/localnet/docker-compose.yml @@ -18,6 +18,9 @@ services: image: zetanode:latest container_name: rosetta hostname: rosetta + depends_on: + zetacore0: + condition: service_healthy ports: - "8080:8080" networks: diff --git a/contrib/localnet/scripts/import-data.sh b/contrib/localnet/scripts/import-data.sh old mode 100644 new mode 100755 index 5236bfe166..52b18945fd --- a/contrib/localnet/scripts/import-data.sh +++ b/contrib/localnet/scripts/import-data.sh @@ -8,7 +8,7 @@ fi NETWORK=$1 echo "NETWORK: ${NETWORK}" rm -rf ~/.zetacored/genesis_data -mkdir ~/.zetacored/genesis_data +mkdir -p ~/.zetacored/genesis_data echo "Download Latest State Export" LATEST_EXPORT_URL=$(curl https://snapshots.zetachain.com/latest-state-export | jq -r ."${NETWORK}") echo "LATEST EXPORT URL: ${LATEST_EXPORT_URL}" diff --git a/contrib/localnet/scripts/start-upgrade-orchestrator.sh b/contrib/localnet/scripts/start-upgrade-orchestrator.sh index f68009db9a..0bc93b7aec 100755 --- a/contrib/localnet/scripts/start-upgrade-orchestrator.sh +++ b/contrib/localnet/scripts/start-upgrade-orchestrator.sh @@ -63,7 +63,7 @@ cat > upgrade.json < $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="500000000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="100s"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.app_state["feemarket"]["params"]["min_gas_price"]="10000000000.0000"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json # set governance parameters in new params module for sdk v0.47+ @@ -249,10 +248,13 @@ then scp $NODE:~/.zetacored/config/gentx/* ~/.zetacored/config/gentx/z2gentx/ done +# TODO : USE --modify flag to modify the genesis file when v18 is released if [[ -n "$ZETACORED_IMPORT_GENESIS_DATA" ]]; then echo "Importing data" zetacored parse-genesis-file /root/genesis_data/exported-genesis.json fi +# Update governance voting period to 100s , to ignore the voting period imported from mainnet. + cat $HOME/.zetacored/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="100s"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json # 4. Collect all the gentx files in zetacore0 and create the final genesis.json zetacored collect-gentxs diff --git a/docs/cli/zetacored/zetacored_parse-genesis-file.md b/docs/cli/zetacored/zetacored_parse-genesis-file.md index a7b66ebb73..b67b875d53 100644 --- a/docs/cli/zetacored/zetacored_parse-genesis-file.md +++ b/docs/cli/zetacored/zetacored_parse-genesis-file.md @@ -10,7 +10,7 @@ zetacored parse-genesis-file [import-genesis-file] [optional-genesis-file] [flag ``` -h, --help help for parse-genesis-file - --modify Modify the genesis file before importing + --modify modify the genesis file before importing ``` ### Options inherited from parent commands diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index b6f19a5807..5c4c5e80af 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -118,7 +118,7 @@ func NewZetaTxServer(rpcAddr string, names []string, privateKeys []string, chain txFactory: txf, name: names, address: addresses, - blockTimeout: 1 * time.Minute, + blockTimeout: 2 * time.Minute, }, nil } @@ -199,7 +199,6 @@ func (zts ZetaTxServer) BroadcastTx(account string, msg sdktypes.Msg) (*sdktypes if err != nil { return nil, err } - return broadcastWithBlockTimeout(zts, txBytes) } @@ -270,7 +269,6 @@ func (zts ZetaTxServer) EnableHeaderVerification(account string, chainIDList []i addr.String(), chainIDList, )) - return err } From 98c63b92cd3ef20d90afdb8093a7b24adb84ad03 Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Thu, 27 Jun 2024 09:39:17 -0700 Subject: [PATCH 5/9] refactor(e2e): move addresses and private keys to config (#2308) * refactor(e2e): move all addresses and private keys to config * localnet config and inject into orchestrator * zetacored from config * generate keys in init * fmt * docs * more lint fixes * s/deployer/default_account/ * trim prefix --- Dockerfile-localnet | 3 +- cmd/zetae2e/README.md | 8 +- cmd/zetae2e/balances.go | 12 +- cmd/zetae2e/bitcoin_address.go | 12 +- cmd/zetae2e/config/clients.go | 17 +- cmd/zetae2e/config/config.go | 42 ++-- cmd/zetae2e/config/config_test.go | 40 +++ cmd/zetae2e/config/contracts.go | 125 +++++----- cmd/zetae2e/config/example.yml | 4 +- cmd/zetae2e/config/local.yml | 5 +- cmd/zetae2e/config/localnet.yml | 51 ++++ cmd/zetae2e/init.go | 13 +- cmd/zetae2e/local/accounts.go | 44 ---- cmd/zetae2e/local/admin.go | 8 +- cmd/zetae2e/local/bitcoin.go | 6 +- cmd/zetae2e/local/config.go | 8 +- cmd/zetae2e/local/erc20.go | 6 +- cmd/zetae2e/local/ethereum.go | 3 +- cmd/zetae2e/local/local.go | 5 +- cmd/zetae2e/local/misc.go | 6 +- cmd/zetae2e/local/performance.go | 6 +- cmd/zetae2e/local/test_runner.go | 8 +- cmd/zetae2e/local/zeta.go | 6 +- cmd/zetae2e/local/zevm_mp.go | 6 +- cmd/zetae2e/run.go | 10 +- cmd/zetae2e/setup_bitcoin.go | 11 +- cmd/zetae2e/show_tss.go | 12 +- cmd/zetae2e/stress.go | 32 +-- .../orchestrator/Dockerfile.fastbuild | 3 +- .../localnet/orchestrator/start-zetae2e.sh | 50 ++-- contrib/localnet/scripts/start-zetacored.sh | 27 +- e2e/config/config.go | 230 ++++++++++++++++-- e2e/config/config_test.go | 39 +++ e2e/e2etests/test_context_upgrade.go | 2 +- e2e/e2etests/test_crosschain_swap.go | 8 +- e2e/e2etests/test_erc20_deposit.go | 2 +- e2e/e2etests/test_erc20_deposit_refund.go | 16 +- e2e/e2etests/test_erc20_multiple_deposits.go | 6 +- e2e/e2etests/test_erc20_multiple_withdraws.go | 4 +- e2e/e2etests/test_eth_deposit_call.go | 7 +- .../test_eth_deposit_liquidity_cap.go | 8 +- e2e/e2etests/test_eth_deposit_refund.go | 7 +- .../test_message_passing_external_chains.go | 2 +- ...age_passing_external_chains_revert_fail.go | 2 +- e2e/e2etests/test_migrate_chain_support.go | 19 +- e2e/e2etests/test_rate_limiter.go | 2 +- e2e/e2etests/test_stress_eth_withdraw.go | 2 +- e2e/e2etests/test_update_bytecode_zrc20.go | 8 +- e2e/e2etests/test_zeta_deposit.go | 2 +- .../test_zeta_withdraw_bitcoin_revert.go | 2 +- e2e/e2etests/test_zrc20_swap.go | 8 +- e2e/runner/balances.go | 18 +- e2e/runner/bitcoin.go | 4 +- e2e/runner/evm.go | 7 +- e2e/runner/runner.go | 15 +- e2e/runner/setup_bitcoin.go | 4 +- e2e/runner/setup_evm.go | 18 +- e2e/runner/zeta.go | 8 +- 58 files changed, 631 insertions(+), 408 deletions(-) create mode 100644 cmd/zetae2e/config/config_test.go create mode 100644 cmd/zetae2e/config/localnet.yml delete mode 100644 cmd/zetae2e/local/accounts.go create mode 100644 e2e/config/config_test.go diff --git a/Dockerfile-localnet b/Dockerfile-localnet index bacf8c19a4..1ed82c6b98 100644 --- a/Dockerfile-localnet +++ b/Dockerfile-localnet @@ -28,7 +28,7 @@ RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0 FROM golang:1.20.14-bookworm AS base-runtime RUN apt update && \ - apt install -yq jq curl tmux python3 openssh-server iputils-ping iproute2 && \ + apt install -yq jq yq curl tmux python3 openssh-server iputils-ping iproute2 && \ rm -rf /var/lib/apt/lists/* RUN ssh-keygen -A && \ @@ -46,6 +46,7 @@ ENV PATH /root/.zetacored/cosmovisor/current/bin/:/root/.zetaclientd/upgrades/cu COPY contrib/localnet/scripts /root COPY contrib/localnet/ssh_config /etc/ssh/ssh_config.d/localnet.conf COPY contrib/localnet/zetacored /root/zetacored +COPY cmd/zetae2e/config/localnet.yml /root/config.yml RUN chmod 755 /root/*.sh && \ chmod 644 /etc/ssh/ssh_config.d/localnet.conf diff --git a/cmd/zetae2e/README.md b/cmd/zetae2e/README.md index c57863e7cf..bdc043f7d2 100644 --- a/cmd/zetae2e/README.md +++ b/cmd/zetae2e/README.md @@ -24,9 +24,9 @@ This is an example of config for interaction with Athens3: ```go zeta_chain_id: "athens_7001-1" -accounts: +default_account: evm_address: "" - evm_priv_key: "" + private_key: "" rpcs: zevm: ", generally using port 8545" evm: ", generally using port 8545" @@ -101,9 +101,9 @@ Testing a gas token requires the following values to be defined in the config: ```go zeta_chain_id -accounts: +default_account: evm_address - evm_priv_key + private_key rpcs: zevm evm diff --git a/cmd/zetae2e/balances.go b/cmd/zetae2e/balances.go index bf1b543227..13df89430a 100644 --- a/cmd/zetae2e/balances.go +++ b/cmd/zetae2e/balances.go @@ -2,9 +2,7 @@ package main import ( "context" - "errors" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/fatih/color" "github.com/spf13/cobra" @@ -54,21 +52,13 @@ func runBalances(cmd *cobra.Command, args []string) error { // initialize context ctx, cancel := context.WithCancel(context.Background()) - // get EVM address from config - evmAddr := conf.Accounts.EVMAddress - if !ethcommon.IsHexAddress(evmAddr) { - cancel() - return errors.New("invalid EVM address") - } - // initialize deployer runner with config r, err := zetae2econfig.RunnerFromConfig( ctx, "e2e", cancel, conf, - ethcommon.HexToAddress(evmAddr), - conf.Accounts.EVMPrivKey, + conf.DefaultAccount, logger, ) if err != nil { diff --git a/cmd/zetae2e/bitcoin_address.go b/cmd/zetae2e/bitcoin_address.go index 63eb26d386..6c9c5c3f4a 100644 --- a/cmd/zetae2e/bitcoin_address.go +++ b/cmd/zetae2e/bitcoin_address.go @@ -2,9 +2,7 @@ package main import ( "context" - "errors" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/fatih/color" "github.com/spf13/cobra" @@ -54,21 +52,13 @@ func runBitcoinAddress(cmd *cobra.Command, args []string) error { // initialize context ctx, cancel := context.WithCancel(context.Background()) - // get EVM address from config - evmAddr := conf.Accounts.EVMAddress - if !ethcommon.IsHexAddress(evmAddr) { - cancel() - return errors.New("invalid EVM address") - } - // initialize deployer runner with config r, err := zetae2econfig.RunnerFromConfig( ctx, "e2e", cancel, conf, - ethcommon.HexToAddress(evmAddr), - conf.Accounts.EVMPrivKey, + conf.DefaultAccount, logger, ) if err != nil { diff --git a/cmd/zetae2e/config/clients.go b/cmd/zetae2e/config/clients.go index ae56eaa9dd..8c6bb37106 100644 --- a/cmd/zetae2e/config/clients.go +++ b/cmd/zetae2e/config/clients.go @@ -8,7 +8,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" "google.golang.org/grpc" @@ -20,7 +19,7 @@ import ( ) // getClientsFromConfig get clients from config -func getClientsFromConfig(ctx context.Context, conf config.Config, evmPrivKey string) ( +func getClientsFromConfig(ctx context.Context, conf config.Config, account config.Account) ( *rpcclient.Client, *ethclient.Client, *bind.TransactOpts, @@ -38,7 +37,7 @@ func getClientsFromConfig(ctx context.Context, conf config.Config, evmPrivKey st if err != nil { return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get btc client: %w", err) } - evmClient, evmAuth, err := getEVMClient(ctx, conf.RPCs.EVM, evmPrivKey) + evmClient, evmAuth, err := getEVMClient(ctx, conf.RPCs.EVM, account) if err != nil { return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get evm client: %w", err) } @@ -48,7 +47,7 @@ func getClientsFromConfig(ctx context.Context, conf config.Config, evmPrivKey st if err != nil { return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get zeta clients: %w", err) } - zevmClient, zevmAuth, err := getEVMClient(ctx, conf.RPCs.Zevm, evmPrivKey) + zevmClient, zevmAuth, err := getEVMClient(ctx, conf.RPCs.Zevm, account) if err != nil { return nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, fmt.Errorf("failed to get zevm client: %w", err) } @@ -91,7 +90,11 @@ func getBtcClient(rpcConf config.BitcoinRPC) (*rpcclient.Client, error) { } // getEVMClient get evm client -func getEVMClient(ctx context.Context, rpc, privKey string) (*ethclient.Client, *bind.TransactOpts, error) { +func getEVMClient( + ctx context.Context, + rpc string, + account config.Account, +) (*ethclient.Client, *bind.TransactOpts, error) { evmClient, err := ethclient.Dial(rpc) if err != nil { return nil, nil, fmt.Errorf("failed to dial evm client: %w", err) @@ -101,11 +104,11 @@ func getEVMClient(ctx context.Context, rpc, privKey string) (*ethclient.Client, if err != nil { return nil, nil, fmt.Errorf("failed to get chain id: %w", err) } - deployerPrivkey, err := crypto.HexToECDSA(privKey) + privKey, err := account.PrivateKey() if err != nil { return nil, nil, fmt.Errorf("failed to get deployer privkey: %w", err) } - evmAuth, err := bind.NewKeyedTransactorWithChainID(deployerPrivkey, chainid) + evmAuth, err := bind.NewKeyedTransactorWithChainID(privKey, chainid) if err != nil { return nil, nil, fmt.Errorf("failed to get keyed transactor: %w", err) } diff --git a/cmd/zetae2e/config/config.go b/cmd/zetae2e/config/config.go index 7918a9a9ae..a0aedef1a6 100644 --- a/cmd/zetae2e/config/config.go +++ b/cmd/zetae2e/config/config.go @@ -4,8 +4,6 @@ import ( "context" "fmt" - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" ) @@ -16,8 +14,7 @@ func RunnerFromConfig( name string, ctxCancel context.CancelFunc, conf config.Config, - evmUserAddr ethcommon.Address, - evmUserPrivKey string, + account config.Account, logger *runner.Logger, opts ...runner.E2ERunnerOption, ) (*runner.E2ERunner, error) { @@ -33,7 +30,7 @@ func RunnerFromConfig( lightClient, zevmClient, zevmAuth, - err := getClientsFromConfig(ctx, conf, evmUserPrivKey) + err := getClientsFromConfig(ctx, conf, account) if err != nil { return nil, fmt.Errorf("failed to get clients from config: %w", err) } @@ -43,8 +40,7 @@ func RunnerFromConfig( ctx, name, ctxCancel, - evmUserAddr, - evmUserPrivKey, + account, evmClient, zevmClient, cctxClient, @@ -79,23 +75,23 @@ func RunnerFromConfig( // ExportContractsFromRunner export contracts from the runner to config using a source config func ExportContractsFromRunner(r *runner.E2ERunner, conf config.Config) config.Config { // copy contracts from deployer runner - conf.Contracts.EVM.ZetaEthAddress = r.ZetaEthAddr.Hex() - conf.Contracts.EVM.ConnectorEthAddr = r.ConnectorEthAddr.Hex() - conf.Contracts.EVM.CustodyAddr = r.ERC20CustodyAddr.Hex() - conf.Contracts.EVM.ERC20 = r.ERC20Addr.Hex() - conf.Contracts.EVM.TestDappAddr = r.EvmTestDAppAddr.Hex() + conf.Contracts.EVM.ZetaEthAddr = config.DoubleQuotedString(r.ZetaEthAddr.Hex()) + conf.Contracts.EVM.ConnectorEthAddr = config.DoubleQuotedString(r.ConnectorEthAddr.Hex()) + conf.Contracts.EVM.CustodyAddr = config.DoubleQuotedString(r.ERC20CustodyAddr.Hex()) + conf.Contracts.EVM.ERC20 = config.DoubleQuotedString(r.ERC20Addr.Hex()) + conf.Contracts.EVM.TestDappAddr = config.DoubleQuotedString(r.EvmTestDAppAddr.Hex()) - conf.Contracts.ZEVM.SystemContractAddr = r.SystemContractAddr.Hex() - conf.Contracts.ZEVM.ETHZRC20Addr = r.ETHZRC20Addr.Hex() - conf.Contracts.ZEVM.ERC20ZRC20Addr = r.ERC20ZRC20Addr.Hex() - conf.Contracts.ZEVM.BTCZRC20Addr = r.BTCZRC20Addr.Hex() - conf.Contracts.ZEVM.UniswapFactoryAddr = r.UniswapV2FactoryAddr.Hex() - conf.Contracts.ZEVM.UniswapRouterAddr = r.UniswapV2RouterAddr.Hex() - conf.Contracts.ZEVM.ConnectorZEVMAddr = r.ConnectorZEVMAddr.Hex() - conf.Contracts.ZEVM.WZetaAddr = r.WZetaAddr.Hex() - conf.Contracts.ZEVM.ZEVMSwapAppAddr = r.ZEVMSwapAppAddr.Hex() - conf.Contracts.ZEVM.ContextAppAddr = r.ContextAppAddr.Hex() - conf.Contracts.ZEVM.TestDappAddr = r.ZevmTestDAppAddr.Hex() + conf.Contracts.ZEVM.SystemContractAddr = config.DoubleQuotedString(r.SystemContractAddr.Hex()) + conf.Contracts.ZEVM.ETHZRC20Addr = config.DoubleQuotedString(r.ETHZRC20Addr.Hex()) + conf.Contracts.ZEVM.ERC20ZRC20Addr = config.DoubleQuotedString(r.ERC20ZRC20Addr.Hex()) + conf.Contracts.ZEVM.BTCZRC20Addr = config.DoubleQuotedString(r.BTCZRC20Addr.Hex()) + conf.Contracts.ZEVM.UniswapFactoryAddr = config.DoubleQuotedString(r.UniswapV2FactoryAddr.Hex()) + conf.Contracts.ZEVM.UniswapRouterAddr = config.DoubleQuotedString(r.UniswapV2RouterAddr.Hex()) + conf.Contracts.ZEVM.ConnectorZEVMAddr = config.DoubleQuotedString(r.ConnectorZEVMAddr.Hex()) + conf.Contracts.ZEVM.WZetaAddr = config.DoubleQuotedString(r.WZetaAddr.Hex()) + conf.Contracts.ZEVM.ZEVMSwapAppAddr = config.DoubleQuotedString(r.ZEVMSwapAppAddr.Hex()) + conf.Contracts.ZEVM.ContextAppAddr = config.DoubleQuotedString(r.ContextAppAddr.Hex()) + conf.Contracts.ZEVM.TestDappAddr = config.DoubleQuotedString(r.ZevmTestDAppAddr.Hex()) return conf } diff --git a/cmd/zetae2e/config/config_test.go b/cmd/zetae2e/config/config_test.go new file mode 100644 index 0000000000..f8eb98a01e --- /dev/null +++ b/cmd/zetae2e/config/config_test.go @@ -0,0 +1,40 @@ +package config + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/e2e/config" +) + +func TestReadConfig(t *testing.T) { + tests := []struct { + name string + filePath string + expectNoError bool + expectNotEmpty bool + }{ + { + name: "ReadLocalnetConfig", + filePath: "localnet.yml", + expectNoError: true, + expectNotEmpty: true, + }, + { + name: "ReadLocalConfig", + filePath: "local.yml", + expectNoError: true, + expectNotEmpty: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + conf, err := config.ReadConfig(tt.filePath) + require.NoError(t, err) + require.NotEmpty(t, conf.DefaultAccount.RawEVMAddress) + require.NotEmpty(t, conf.DefaultAccount.RawPrivateKey) + }) + } +} diff --git a/cmd/zetae2e/config/contracts.go b/cmd/zetae2e/config/contracts.go index a47b39ef4e..110038298a 100644 --- a/cmd/zetae2e/config/contracts.go +++ b/cmd/zetae2e/config/contracts.go @@ -3,7 +3,6 @@ package config import ( "fmt" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" zetaeth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zeta.eth.sol" zetaconnectoreth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.eth.sol" @@ -26,169 +25,173 @@ func setContractsFromConfig(r *runner.E2ERunner, conf config.Config) error { var err error // set EVM contracts - if c := conf.Contracts.EVM.ZetaEthAddress; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ZetaEthAddress: %s", c) + if c := conf.Contracts.EVM.ZetaEthAddr; c != "" { + r.ZetaEthAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ZetaEthAddr: %w", err) } - r.ZetaEthAddr = ethcommon.HexToAddress(c) r.ZetaEth, err = zetaeth.NewZetaEth(r.ZetaEthAddr, r.EVMClient) if err != nil { return err } } + if c := conf.Contracts.EVM.ConnectorEthAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ConnectorEthAddr: %s", c) + r.ConnectorEthAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ConnectorEthAddr: %w", err) } - r.ConnectorEthAddr = ethcommon.HexToAddress(c) r.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(r.ConnectorEthAddr, r.EVMClient) if err != nil { return err } } + if c := conf.Contracts.EVM.CustodyAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid CustodyAddr: %s", c) + r.ERC20CustodyAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid CustodyAddr: %w", err) } - r.ERC20CustodyAddr = ethcommon.HexToAddress(c) r.ERC20Custody, err = erc20custody.NewERC20Custody(r.ERC20CustodyAddr, r.EVMClient) if err != nil { return err } } + if c := conf.Contracts.EVM.ERC20; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ERC20: %s", c) + r.ERC20Addr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ERC20: %w", err) } - r.ERC20Addr = ethcommon.HexToAddress(c) r.ERC20, err = erc20.NewERC20(r.ERC20Addr, r.EVMClient) if err != nil { return err } } - // set Zevm contracts + // set ZEVM contracts if c := conf.Contracts.ZEVM.SystemContractAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid SystemContractAddr: %s", c) + r.SystemContractAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid SystemContractAddr: %w", err) } - r.SystemContractAddr = ethcommon.HexToAddress(c) r.SystemContract, err = systemcontract.NewSystemContract(r.SystemContractAddr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.ETHZRC20Addr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ETHZRC20Addr: %s", c) + r.ETHZRC20Addr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ETHZRC20Addr: %w", err) } - r.ETHZRC20Addr = ethcommon.HexToAddress(c) r.ETHZRC20, err = zrc20.NewZRC20(r.ETHZRC20Addr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.ERC20ZRC20Addr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ERC20ZRC20Addr: %s", c) + r.ERC20ZRC20Addr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ERC20ZRC20Addr: %w", err) } - r.ERC20ZRC20Addr = ethcommon.HexToAddress(c) r.ERC20ZRC20, err = zrc20.NewZRC20(r.ERC20ZRC20Addr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.BTCZRC20Addr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid BTCZRC20Addr: %s", c) - } - r.BTCZRC20Addr = ethcommon.HexToAddress(c) - r.BTCZRC20, err = zrc20.NewZRC20(r.BTCZRC20Addr, r.ZEVMClient) + r.BTCZRC20Addr, err = c.AsEVMAddress() if err != nil { - return err - } - } - if c := conf.Contracts.ZEVM.ERC20ZRC20Addr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ERC20ZRC20Addr: %s", c) + return fmt.Errorf("invalid BTCZRC20Addr: %w", err) } - r.ERC20ZRC20Addr = ethcommon.HexToAddress(c) - r.ERC20ZRC20, err = zrc20.NewZRC20(r.ERC20ZRC20Addr, r.ZEVMClient) + r.BTCZRC20, err = zrc20.NewZRC20(r.BTCZRC20Addr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.UniswapFactoryAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid UniswapFactoryAddr: %s", c) + r.UniswapV2FactoryAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid UniswapFactoryAddr: %w", err) } - r.UniswapV2FactoryAddr = ethcommon.HexToAddress(c) r.UniswapV2Factory, err = uniswapv2factory.NewUniswapV2Factory(r.UniswapV2FactoryAddr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.UniswapRouterAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid UniswapRouterAddr: %s", c) + r.UniswapV2RouterAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid UniswapRouterAddr: %w", err) } - r.UniswapV2RouterAddr = ethcommon.HexToAddress(c) r.UniswapV2Router, err = uniswapv2router.NewUniswapV2Router02(r.UniswapV2RouterAddr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.ConnectorZEVMAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ConnectorZEVMAddr: %s", c) + r.ConnectorZEVMAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ConnectorZEVMAddr: %w", err) } - r.ConnectorZEVMAddr = ethcommon.HexToAddress(c) r.ConnectorZEVM, err = connectorzevm.NewZetaConnectorZEVM(r.ConnectorZEVMAddr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.WZetaAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid WZetaAddr: %s", c) + r.WZetaAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid WZetaAddr: %w", err) } - r.WZetaAddr = ethcommon.HexToAddress(c) r.WZeta, err = wzeta.NewWETH9(r.WZetaAddr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.ZEVMSwapAppAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ZEVMSwapAppAddr: %s", c) + r.ZEVMSwapAppAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ZEVMSwapAppAddr: %w", err) } - r.ZEVMSwapAppAddr = ethcommon.HexToAddress(c) r.ZEVMSwapApp, err = zevmswap.NewZEVMSwapApp(r.ZEVMSwapAppAddr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.ContextAppAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ContextAppAddr: %s", c) + r.ContextAppAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ContextAppAddr: %w", err) } - r.ContextAppAddr = ethcommon.HexToAddress(c) r.ContextApp, err = contextapp.NewContextApp(r.ContextAppAddr, r.ZEVMClient) if err != nil { return err } } + if c := conf.Contracts.ZEVM.TestDappAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid ZevmTestDappAddr: %s", c) + r.ZevmTestDAppAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid ZevmTestDappAddr: %w", err) } - r.ZevmTestDAppAddr = ethcommon.HexToAddress(c) } + if c := conf.Contracts.EVM.TestDappAddr; c != "" { - if !ethcommon.IsHexAddress(c) { - return fmt.Errorf("invalid EvmTestDappAddr: %s", c) + r.EvmTestDAppAddr, err = c.AsEVMAddress() + if err != nil { + return fmt.Errorf("invalid EvmTestDappAddr: %w", err) } - r.EvmTestDAppAddr = ethcommon.HexToAddress(c) } return nil diff --git a/cmd/zetae2e/config/example.yml b/cmd/zetae2e/config/example.yml index be692b9d4c..21cdd6de36 100644 --- a/cmd/zetae2e/config/example.yml +++ b/cmd/zetae2e/config/example.yml @@ -1,7 +1,7 @@ zeta_chain_id: "athens_7001-1" -accounts: +default_account: evm_address: "" - evm_priv_key: "" + private_key: "" rpcs: zevm: ", generally using port 8545" evm: ", generally using port 8545" diff --git a/cmd/zetae2e/config/local.yml b/cmd/zetae2e/config/local.yml index ae2638ace7..ee5e171ccc 100644 --- a/cmd/zetae2e/config/local.yml +++ b/cmd/zetae2e/config/local.yml @@ -1,7 +1,8 @@ zeta_chain_id: "athens_7001-1" -accounts: +default_account: + bech32_address: zeta1uhznv7uzyjq84s3q056suc8pkme85lkvhrz3dd evm_address: "0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC" - evm_priv_key: "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263" + private_key: "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263" rpcs: zevm: "http://0.0.0.0:9545" evm: "http://0.0.0.0:8545" diff --git a/cmd/zetae2e/config/localnet.yml b/cmd/zetae2e/config/localnet.yml new file mode 100644 index 0000000000..abb780db39 --- /dev/null +++ b/cmd/zetae2e/config/localnet.yml @@ -0,0 +1,51 @@ +zeta_chain_id: "athens_101-1" +default_account: + bech32_address: "zeta1uhznv7uzyjq84s3q056suc8pkme85lkvhrz3dd" + evm_address: "0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC" + private_key: "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263" +additional_accounts: + user_erc20: + bech32_address: "zeta1datate7xmwm4uk032f9rmcu0cwy7ch7kg6y6zv" + evm_address: "0x6F57D5E7c6DBb75e59F1524a3dE38Fc389ec5Fd6" + private_key: "fda3be1b1517bdf48615bdadacc1e6463d2865868dc8077d2cdcfa4709a16894" + user_zeta_test: + bech32_address: "zeta1tnp0hvsq4y5mxuhrq9h3jfwulxywpq0ads0rer" + evm_address: "0x5cC2fBb200A929B372e3016F1925DcF988E081fd" + private_key: "729a6cdc5c925242e7df92fdeeb94dadbf2d0b9950d4db8f034ab27a3b114ba7" + user_zevm_mp_test: + bech32_address: "zeta13t3zjxvwec7g38q8mdjga37rpes9zkfvv7tkn2" + evm_address: "0x8Ae229198eCE3c889C07DB648Ec7C30E6051592c" + private_key: "105460aebf71b10bfdb710ef5aa6d2932ee6ff6fc317ac9c24e0979903b10a5d" + user_bitcoin: + bech32_address: "zeta19q7czqysah6qg0n4y3l2a08gfzqxydla492v80" + evm_address: "0x283d810090EdF4043E75247eAeBcE848806237fD" + private_key: "7bb523963ee2c78570fb6113d886a4184d42565e8847f1cb639f5f5e2ef5b37a" + user_ether: + bech32_address: "zeta134rakuus43xn63yucgxhn88ywj8ewcv6ezn2ga" + evm_address: "0x8D47Db7390AC4D3D449Cc20D799ce4748F97619A" + private_key: "098e74a1c2261fa3c1b8cfca8ef2b4ff96c73ce36710d208d1f6535aef42545d" + user_misc: + bech32_address: "zeta1jqfx6qhyrj0t9ggvl3p64vaax3s9y0xldt020w" + evm_address: "0x90126d02E41c9eB2a10cfc43aAb3BD3460523Cdf" + private_key: "853c0945b8035a501b1161df65a17a0a20fc848bda8975a8b4e9222cc6f84cd4" + user_admin: + bech32_address: "zeta17w0adeg64ky0daxwd2ugyuneellmjgnx4e483s" + evm_address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" + private_key: "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" + user_fungible_admin: + bech32_address: "zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3" + evm_address: "0x8305C114Ea73cAc4A88f39A173803F94741b9055" + private_key: "d88d09a7d6849c15a36eb6931f9dd616091a63e9849a2cc86f309ba11fb8fec5" +rpcs: + zevm: "http://zetacore0:8545" + evm: "http://eth:8545" + bitcoin: + host: "bitcoin:18443" + user: "smoketest" + pass: "123" + http_post_mode: true + disable_tls: true + params: regnet + zetacore_grpc: "zetacore0:9090" + zetacore_rpc: "http://zetacore0:26657" +# contracts will be populated on first run \ No newline at end of file diff --git a/cmd/zetae2e/init.go b/cmd/zetae2e/init.go index b35f42ff97..742b3ebd96 100644 --- a/cmd/zetae2e/init.go +++ b/cmd/zetae2e/init.go @@ -16,7 +16,7 @@ func NewInitCmd() *cobra.Command { var InitCmd = &cobra.Command{ Use: "init", Short: "initialize config file for e2e tests", - Run: initConfig, + RunE: initConfig, } InitCmd.Flags().StringVar(&initConf.RPCs.EVM, "ethURL", "http://eth:8545", "--ethURL http://eth:8545") @@ -33,9 +33,14 @@ func NewInitCmd() *cobra.Command { return InitCmd } -func initConfig(_ *cobra.Command, _ []string) { - err := config.WriteConfig(configFile, initConf) +func initConfig(_ *cobra.Command, _ []string) error { + err := initConf.GenerateKeys() if err != nil { - fmt.Printf("error writing config file: %s", err.Error()) + return fmt.Errorf("generating keys: %w", err) } + err = config.WriteConfig(configFile, initConf) + if err != nil { + return fmt.Errorf("writing config: %w", err) + } + return nil } diff --git a/cmd/zetae2e/local/accounts.go b/cmd/zetae2e/local/accounts.go deleted file mode 100644 index 16ab7d97a4..0000000000 --- a/cmd/zetae2e/local/accounts.go +++ /dev/null @@ -1,44 +0,0 @@ -package local - -import ( - ethcommon "github.com/ethereum/go-ethereum/common" -) - -var ( - // DeployerAddress is the address of the account for deploying networks - DeployerAddress = ethcommon.HexToAddress("0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC") - DeployerPrivateKey = "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263" // #nosec G101 - used for testing - - // UserERC20Address is the address of the account for testing ERC20 - UserERC20Address = ethcommon.HexToAddress("0x6F57D5E7c6DBb75e59F1524a3dE38Fc389ec5Fd6") - UserERC20PrivateKey = "fda3be1b1517bdf48615bdadacc1e6463d2865868dc8077d2cdcfa4709a16894" // #nosec G101 - used for testing - - // UserZetaTestAddress is the address of the account for testing Zeta transfers - UserZetaTestAddress = ethcommon.HexToAddress("0x5cC2fBb200A929B372e3016F1925DcF988E081fd") - UserZetaTestPrivateKey = "729a6cdc5c925242e7df92fdeeb94dadbf2d0b9950d4db8f034ab27a3b114ba7" // #nosec G101 - used for testing - - // UserZEVMMPTestAddress is the address of the account for testing ZEVM Message Passing - UserZEVMMPTestAddress = ethcommon.HexToAddress("0x8Ae229198eCE3c889C07DB648Ec7C30E6051592c") - UserZEVMMPTestPrivateKey = "105460aebf71b10bfdb710ef5aa6d2932ee6ff6fc317ac9c24e0979903b10a5d" // #nosec G101 - used for testing - - // UserBitcoinAddress is the address of the account for testing Bitcoin - UserBitcoinAddress = ethcommon.HexToAddress("0x283d810090EdF4043E75247eAeBcE848806237fD") - UserBitcoinPrivateKey = "7bb523963ee2c78570fb6113d886a4184d42565e8847f1cb639f5f5e2ef5b37a" // #nosec G101 - used for testing - - // UserEtherAddress is the address of the account for testing Ether - UserEtherAddress = ethcommon.HexToAddress("0x8D47Db7390AC4D3D449Cc20D799ce4748F97619A") - UserEtherPrivateKey = "098e74a1c2261fa3c1b8cfca8ef2b4ff96c73ce36710d208d1f6535aef42545d" // #nosec G101 - used for testing - - // UserMiscAddress is the address of the account for miscellaneous tests - UserMiscAddress = ethcommon.HexToAddress("0x90126d02E41c9eB2a10cfc43aAb3BD3460523Cdf") - UserMiscPrivateKey = "853c0945b8035a501b1161df65a17a0a20fc848bda8975a8b4e9222cc6f84cd4" // #nosec G101 - used for testing - - // UserAdminAddress is the address of the account for testing admin function features - // NOTE: this is the default account using Anvil - UserAdminAddress = ethcommon.HexToAddress("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266") - UserAdminPrivateKey = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" // #nosec G101 - used for testing - - // FungibleAdminAddress is the address of the account for testing the fungible admin functions - UserFungibleAdminAddress = ethcommon.HexToAddress("0x8305C114Ea73cAc4A88f39A173803F94741b9055") - UserFungibleAdminPrivateKey = "d88d09a7d6849c15a36eb6931f9dd616091a63e9849a2cc86f309ba11fb8fec5" // #nosec G101 - used for testing -) diff --git a/cmd/zetae2e/local/admin.go b/cmd/zetae2e/local/admin.go index 63cff6fe23..bc76aeeedc 100644 --- a/cmd/zetae2e/local/admin.go +++ b/cmd/zetae2e/local/admin.go @@ -19,13 +19,13 @@ func adminTestRoutine( testNames ...string, ) func() error { return func() (err error) { + account := conf.AdditionalAccounts.UserAdmin // initialize runner for erc20 advanced test adminRunner, err := initTestRunner( "admin", conf, deployerRunner, - UserAdminAddress, - UserAdminPrivateKey, + account, runner.NewLogger(verbose, color.FgHiGreen, "admin"), runner.WithZetaTxServer(deployerRunner.ZetaTxServer), ) @@ -38,8 +38,8 @@ func adminTestRoutine( // funding the account // we transfer around the total supply of Zeta to the admin for the chain migration test - txZetaSend := deployerRunner.SendZetaOnEvm(UserAdminAddress, 20_500_000_000) - txERC20Send := deployerRunner.SendERC20OnEvm(UserAdminAddress, 1000) + txZetaSend := deployerRunner.SendZetaOnEvm(account.EVMAddress(), 20_500_000_000) + txERC20Send := deployerRunner.SendERC20OnEvm(account.EVMAddress(), 1000) adminRunner.WaitForTxReceiptOnEvm(txZetaSend) adminRunner.WaitForTxReceiptOnEvm(txERC20Send) diff --git a/cmd/zetae2e/local/bitcoin.go b/cmd/zetae2e/local/bitcoin.go index cfb0501a8c..05098fd5a9 100644 --- a/cmd/zetae2e/local/bitcoin.go +++ b/cmd/zetae2e/local/bitcoin.go @@ -21,13 +21,13 @@ func bitcoinTestRoutine( testNames ...string, ) func() error { return func() (err error) { + account := conf.AdditionalAccounts.UserBitcoin // initialize runner for bitcoin test bitcoinRunner, err := initTestRunner( "bitcoin", conf, deployerRunner, - UserBitcoinAddress, - UserBitcoinPrivateKey, + account, runner.NewLogger(verbose, color.FgYellow, "bitcoin"), ) if err != nil { @@ -38,7 +38,7 @@ func bitcoinTestRoutine( startTime := time.Now() // funding the account - txERC20Send := deployerRunner.SendERC20OnEvm(UserBitcoinAddress, 1000) + txERC20Send := deployerRunner.SendERC20OnEvm(account.EVMAddress(), 1000) bitcoinRunner.WaitForTxReceiptOnEvm(txERC20Send) // depositing the necessary tokens on ZetaChain diff --git a/cmd/zetae2e/local/config.go b/cmd/zetae2e/local/config.go index 98ece83ac0..8788024b7d 100644 --- a/cmd/zetae2e/local/config.go +++ b/cmd/zetae2e/local/config.go @@ -1,6 +1,7 @@ package local import ( + "fmt" "path/filepath" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,12 +15,7 @@ import ( func GetConfig(cmd *cobra.Command) (config.Config, error) { configFile, err := cmd.Flags().GetString(FlagConfigFile) if err != nil { - return config.Config{}, err - } - - // use default config if no config file is specified - if configFile == "" { - return config.DefaultConfig(), nil + return config.Config{}, fmt.Errorf("--config is a required parameter") } configFile, err = filepath.Abs(configFile) diff --git a/cmd/zetae2e/local/erc20.go b/cmd/zetae2e/local/erc20.go index fe0fa8bb8a..8b0d21e564 100644 --- a/cmd/zetae2e/local/erc20.go +++ b/cmd/zetae2e/local/erc20.go @@ -19,13 +19,13 @@ func erc20TestRoutine( testNames ...string, ) func() error { return func() (err error) { + account := conf.AdditionalAccounts.UserERC20 // initialize runner for erc20 test erc20Runner, err := initTestRunner( "erc20", conf, deployerRunner, - UserERC20Address, - UserERC20PrivateKey, + account, runner.NewLogger(verbose, color.FgGreen, "erc20"), runner.WithZetaTxServer(deployerRunner.ZetaTxServer), ) @@ -37,7 +37,7 @@ func erc20TestRoutine( startTime := time.Now() // funding the account - txERC20Send := deployerRunner.SendERC20OnEvm(UserERC20Address, 10) + txERC20Send := deployerRunner.SendERC20OnEvm(account.EVMAddress(), 10) erc20Runner.WaitForTxReceiptOnEvm(txERC20Send) // depositing the necessary tokens on ZetaChain diff --git a/cmd/zetae2e/local/ethereum.go b/cmd/zetae2e/local/ethereum.go index fa9e7754e2..ae2eebc268 100644 --- a/cmd/zetae2e/local/ethereum.go +++ b/cmd/zetae2e/local/ethereum.go @@ -25,8 +25,7 @@ func ethereumTestRoutine( "ether", conf, deployerRunner, - UserEtherAddress, - UserEtherPrivateKey, + conf.AdditionalAccounts.UserEther, runner.NewLogger(verbose, color.FgMagenta, "ether"), ) if err != nil { diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index bd9dd654a2..7e00f9ba5b 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -127,7 +127,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { zetaTxServer, err := txserver.NewZetaTxServer( conf.RPCs.ZetaCoreRPC, []string{utils.FungibleAdminName}, - []string{UserFungibleAdminPrivateKey}, + []string{conf.AdditionalAccounts.UserFungibleAdmin.RawPrivateKey.String()}, conf.ZetaChainID, ) noError(err) @@ -138,8 +138,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) { "deployer", cancel, conf, - DeployerAddress, - DeployerPrivateKey, + conf.DefaultAccount, logger, runner.WithZetaTxServer(zetaTxServer), ) diff --git a/cmd/zetae2e/local/misc.go b/cmd/zetae2e/local/misc.go index 65467ec9e5..a27c93c932 100644 --- a/cmd/zetae2e/local/misc.go +++ b/cmd/zetae2e/local/misc.go @@ -19,13 +19,13 @@ func miscTestRoutine( testNames ...string, ) func() error { return func() (err error) { + account := conf.AdditionalAccounts.UserMisc // initialize runner for misc test miscRunner, err := initTestRunner( "misc", conf, deployerRunner, - UserMiscAddress, - UserMiscPrivateKey, + account, runner.NewLogger(verbose, color.FgCyan, "misc"), ) if err != nil { @@ -36,7 +36,7 @@ func miscTestRoutine( startTime := time.Now() // funding the account - txZetaSend := deployerRunner.SendZetaOnEvm(UserMiscAddress, 1000) + txZetaSend := deployerRunner.SendZetaOnEvm(account.EVMAddress(), 1000) miscRunner.WaitForTxReceiptOnEvm(txZetaSend) // depositing the necessary tokens on ZetaChain diff --git a/cmd/zetae2e/local/performance.go b/cmd/zetae2e/local/performance.go index 7d289c4e90..4039084550 100644 --- a/cmd/zetae2e/local/performance.go +++ b/cmd/zetae2e/local/performance.go @@ -27,8 +27,7 @@ func ethereumDepositPerformanceRoutine( "ether", conf, deployerRunner, - UserERC20Address, - UserERC20PrivateKey, + conf.AdditionalAccounts.UserERC20, runner.NewLogger(verbose, color.FgHiMagenta, "perf_eth_deposit"), ) if err != nil { @@ -69,8 +68,7 @@ func ethereumWithdrawPerformanceRoutine( "ether", conf, deployerRunner, - UserEtherAddress, - UserEtherPrivateKey, + conf.AdditionalAccounts.UserEther, runner.NewLogger(verbose, color.FgHiBlue, "perf_eth_withdraw"), ) if err != nil { diff --git a/cmd/zetae2e/local/test_runner.go b/cmd/zetae2e/local/test_runner.go index f2fe0ae811..198260c05c 100644 --- a/cmd/zetae2e/local/test_runner.go +++ b/cmd/zetae2e/local/test_runner.go @@ -1,8 +1,6 @@ package local import ( - ethcommon "github.com/ethereum/go-ethereum/common" - zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" @@ -14,8 +12,7 @@ func initTestRunner( name string, conf config.Config, deployerRunner *runner.E2ERunner, - userAddress ethcommon.Address, - userPrivKey string, + account config.Account, logger *runner.Logger, opts ...runner.E2ERunnerOption, ) (*runner.E2ERunner, error) { @@ -25,8 +22,7 @@ func initTestRunner( name, deployerRunner.CtxCancel, conf, - userAddress, - userPrivKey, + account, logger, opts..., ) diff --git a/cmd/zetae2e/local/zeta.go b/cmd/zetae2e/local/zeta.go index 6f5039b63f..3fdb4f48cc 100644 --- a/cmd/zetae2e/local/zeta.go +++ b/cmd/zetae2e/local/zeta.go @@ -19,13 +19,13 @@ func zetaTestRoutine( testNames ...string, ) func() error { return func() (err error) { + account := conf.AdditionalAccounts.UserZetaTest // initialize runner for zeta test zetaRunner, err := initTestRunner( "zeta", conf, deployerRunner, - UserZetaTestAddress, - UserZetaTestPrivateKey, + account, runner.NewLogger(verbose, color.FgBlue, "zeta"), ) if err != nil { @@ -36,7 +36,7 @@ func zetaTestRoutine( startTime := time.Now() // funding the account - txZetaSend := deployerRunner.SendZetaOnEvm(UserZetaTestAddress, 1000) + txZetaSend := deployerRunner.SendZetaOnEvm(account.EVMAddress(), 1000) zetaRunner.WaitForTxReceiptOnEvm(txZetaSend) // depositing the necessary tokens on ZetaChain diff --git a/cmd/zetae2e/local/zevm_mp.go b/cmd/zetae2e/local/zevm_mp.go index f95fa24390..bc97c45e29 100644 --- a/cmd/zetae2e/local/zevm_mp.go +++ b/cmd/zetae2e/local/zevm_mp.go @@ -19,13 +19,13 @@ func zevmMPTestRoutine( testNames ...string, ) func() error { return func() (err error) { + account := conf.AdditionalAccounts.UserZEVMMPTest // initialize runner for zevm mp test zevmMPRunner, err := initTestRunner( "zevm_mp", conf, deployerRunner, - UserZEVMMPTestAddress, - UserZEVMMPTestPrivateKey, + account, runner.NewLogger(verbose, color.FgHiRed, "zevm_mp"), ) if err != nil { @@ -36,7 +36,7 @@ func zevmMPTestRoutine( startTime := time.Now() // funding the account - txZetaSend := deployerRunner.SendZetaOnEvm(UserZEVMMPTestAddress, 1000) + txZetaSend := deployerRunner.SendZetaOnEvm(account.EVMAddress(), 1000) zevmMPRunner.WaitForTxReceiptOnEvm(txZetaSend) // depositing the necessary tokens on ZetaChain diff --git a/cmd/zetae2e/run.go b/cmd/zetae2e/run.go index 7d57500823..9c36d8e3d2 100644 --- a/cmd/zetae2e/run.go +++ b/cmd/zetae2e/run.go @@ -8,7 +8,6 @@ import ( "strings" "time" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/fatih/color" "github.com/spf13/cobra" @@ -75,20 +74,13 @@ func runE2ETest(cmd *cobra.Command, args []string) error { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - // get EVM address from config - evmAddr := conf.Accounts.EVMAddress - if !ethcommon.IsHexAddress(evmAddr) { - return errors.New("invalid EVM address") - } - // initialize deployer runner with config testRunner, err := zetae2econfig.RunnerFromConfig( ctx, "e2e", cancel, conf, - ethcommon.HexToAddress(evmAddr), - conf.Accounts.EVMPrivKey, + conf.DefaultAccount, logger, ) if err != nil { diff --git a/cmd/zetae2e/setup_bitcoin.go b/cmd/zetae2e/setup_bitcoin.go index f77924e768..99a5365adc 100644 --- a/cmd/zetae2e/setup_bitcoin.go +++ b/cmd/zetae2e/setup_bitcoin.go @@ -2,9 +2,7 @@ package main import ( "context" - "errors" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/fatih/color" "github.com/spf13/cobra" @@ -42,20 +40,13 @@ func runSetupBitcoin(_ *cobra.Command, args []string) error { // initialize context ctx, cancel := context.WithCancel(context.Background()) - // get EVM address from config - evmAddr := conf.Accounts.EVMAddress - if !ethcommon.IsHexAddress(evmAddr) { - cancel() - return errors.New("invalid EVM address") - } // initialize deployer runner with config r, err := zetae2econfig.RunnerFromConfig( ctx, "e2e", cancel, conf, - ethcommon.HexToAddress(evmAddr), - conf.Accounts.EVMPrivKey, + conf.DefaultAccount, logger, ) if err != nil { diff --git a/cmd/zetae2e/show_tss.go b/cmd/zetae2e/show_tss.go index 780a525b19..01b61317a1 100644 --- a/cmd/zetae2e/show_tss.go +++ b/cmd/zetae2e/show_tss.go @@ -2,9 +2,7 @@ package main import ( "context" - "errors" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/fatih/color" "github.com/spf13/cobra" @@ -42,21 +40,13 @@ func runShowTSS(_ *cobra.Command, args []string) error { // initialize context ctx, cancel := context.WithCancel(context.Background()) - // get EVM address from config - evmAddr := conf.Accounts.EVMAddress - if !ethcommon.IsHexAddress(evmAddr) { - cancel() - return errors.New("invalid EVM address") - } - // initialize deployer runner with config testRunner, err := zetae2econfig.RunnerFromConfig( ctx, "tss", cancel, conf, - ethcommon.HexToAddress(evmAddr), - conf.Accounts.EVMPrivKey, + conf.DefaultAccount, logger, ) if err != nil { diff --git a/cmd/zetae2e/stress.go b/cmd/zetae2e/stress.go index ca0446cbc9..30b2faf924 100644 --- a/cmd/zetae2e/stress.go +++ b/cmd/zetae2e/stress.go @@ -12,7 +12,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/accounts/abi/bind" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/ethclient" "github.com/fatih/color" "github.com/spf13/cobra" @@ -38,12 +37,10 @@ var ( ) type stressArguments struct { - deployerAddress string - deployerPrivateKey string - network string - txnInterval int64 - contractsDeployed bool - config string + network string + txnInterval int64 + contractsDeployed bool + config string } var stressTestArgs = stressArguments{} @@ -57,10 +54,6 @@ func NewStressTestCmd() *cobra.Command { Run: StressTest, } - StressCmd.Flags(). - StringVar(&stressTestArgs.deployerAddress, "addr", "0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC", "--addr ") - StressCmd.Flags(). - StringVar(&stressTestArgs.deployerPrivateKey, "privKey", "d87baf7bf6dc560a252596678c12e41f7d1682837f05b29d411bc3f78ae2c263", "--privKey ") StressCmd.Flags().StringVar(&stressTestArgs.network, "network", "LOCAL", "--network TESTNET") StressCmd.Flags(). Int64Var(&stressTestArgs.txnInterval, "tx-interval", 500, "--tx-interval [TIME_INTERVAL_MILLISECONDS]") @@ -69,8 +62,6 @@ func NewStressTestCmd() *cobra.Command { StressCmd.Flags().StringVar(&stressTestArgs.config, local.FlagConfigFile, "", "config file to use for the E2E test") StressCmd.Flags().Bool(flagVerbose, false, "set to true to enable verbose logging") - local.DeployerAddress = ethcommon.HexToAddress(stressTestArgs.deployerAddress) - return StressCmd } @@ -93,11 +84,13 @@ func StressTest(cmd *cobra.Command, _ []string) { // initialize E2E tests config conf := must(local.GetConfig(cmd)) + deployerAccount := conf.DefaultAccount + // Initialize clients ---------------------------------------------------------------- evmClient := must(ethclient.Dial(conf.RPCs.EVM)) - bal := must(evmClient.BalanceAt(context.TODO(), local.DeployerAddress, nil)) + bal := must(evmClient.BalanceAt(context.TODO(), deployerAccount.EVMAddress(), nil)) - fmt.Printf("Deployer address: %s, balance: %d Wei\n", local.DeployerAddress.Hex(), bal) + fmt.Printf("Deployer address: %s, balance: %d Wei\n", deployerAccount.EVMAddress().Hex(), bal) grpcConn := must(grpc.Dial(conf.RPCs.ZetaCoreGRPC, grpc.WithInsecure())) @@ -136,8 +129,7 @@ func StressTest(cmd *cobra.Command, _ []string) { "deployer", cancel, conf, - local.DeployerAddress, - local.DeployerPrivateKey, + conf.DefaultAccount, logger, )) @@ -164,7 +156,7 @@ func StressTest(cmd *cobra.Command, _ []string) { } // Check zrc20 balance of Deployer address - ethZRC20Balance := must(e2eTest.ETHZRC20.BalanceOf(nil, local.DeployerAddress)) + ethZRC20Balance := must(e2eTest.ETHZRC20.BalanceOf(nil, deployerAccount.EVMAddress())) fmt.Printf("eth zrc20 balance: %s Wei \n", ethZRC20Balance.String()) //Pre-approve ETH withdraw on ZEVM @@ -179,7 +171,7 @@ func StressTest(cmd *cobra.Command, _ []string) { blockNum := must(e2eTest.ZEVMClient.BlockNumber(ctx)) // #nosec G701 e2eTest - always in range - nonce := must(e2eTest.ZEVMClient.NonceAt(ctx, local.DeployerAddress, big.NewInt(int64(blockNum)))) + nonce := must(e2eTest.ZEVMClient.NonceAt(ctx, deployerAccount.EVMAddress(), big.NewInt(int64(blockNum)))) // #nosec G701 e2e - always in range zevmNonce = big.NewInt(int64(nonce)) @@ -309,7 +301,7 @@ func WithdrawETHZRC20(r *runner.E2ERunner) { ethZRC20 := r.ETHZRC20 r.ZEVMAuth.Nonce = zevmNonce - must(ethZRC20.Withdraw(r.ZEVMAuth, local.DeployerAddress.Bytes(), big.NewInt(100))) + must(ethZRC20.Withdraw(r.ZEVMAuth, r.EVMAddress().Bytes(), big.NewInt(100))) } // Get ETH based chain ID diff --git a/contrib/localnet/orchestrator/Dockerfile.fastbuild b/contrib/localnet/orchestrator/Dockerfile.fastbuild index 2ef5520c64..96f437ed30 100644 --- a/contrib/localnet/orchestrator/Dockerfile.fastbuild +++ b/contrib/localnet/orchestrator/Dockerfile.fastbuild @@ -3,13 +3,14 @@ FROM ethereum/client-go:v1.10.26 as geth FROM golang:1.20.14-bookworm as orchestrator RUN apt update && \ - apt install -yq jq curl tmux python3 openssh-server iputils-ping iproute2 && \ + apt install -yq jq yq curl tmux python3 openssh-server iputils-ping iproute2 && \ rm -rf /var/lib/apt/lists/* COPY --from=geth /usr/local/bin/geth /usr/local/bin/ COPY --from=zeta /usr/local/bin/zetacored /usr/local/bin/zetaclientd /usr/local/bin/zetae2e /usr/local/bin/ COPY contrib/localnet/orchestrator/start-zetae2e.sh /work/ +COPY cmd/zetae2e/config/localnet.yml /work/config.yml RUN chmod +x /work/*.sh WORKDIR /work diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index 791f0a6074..676d55e26e 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -37,41 +37,45 @@ sleep 2 ### Create the accounts and fund them with Ether on local Ethereum network -# unlock the deployer account -echo "funding deployer address 0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC", value: web3.toWei(10000,"ether")})' attach http://eth:8545 +# unlock the default account account +address=$(yq -r '.default_account.evm_address' config.yml) +echo "funding deployer address ${address} with 10000 Ether" +geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 # unlock erc20 tester accounts -echo "funding deployer address 0x6F57D5E7c6DBb75e59F1524a3dE38Fc389ec5Fd6 with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0x6F57D5E7c6DBb75e59F1524a3dE38Fc389ec5Fd6", value: web3.toWei(10000,"ether")})' attach http://eth:8545 +address=$(yq -r '.additional_accounts.user_erc20.evm_address' config.yml) +echo "funding erc20 address ${address} with 10000 Ether" +geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 # unlock zeta tester accounts -echo "funding deployer address 0x5cC2fBb200A929B372e3016F1925DcF988E081fd with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0x5cC2fBb200A929B372e3016F1925DcF988E081fd", value: web3.toWei(10000,"ether")})' attach http://eth:8545 +address=$(yq -r '.additional_accounts.user_zeta_test.evm_address' config.yml) +echo "funding zeta tester address ${address} with 10000 Ether" +geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 # unlock zevm message passing tester accounts -echo "funding deployer address 0x8Ae229198eCE3c889C07DB648Ec7C30E6051592c with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0x8Ae229198eCE3c889C07DB648Ec7C30E6051592c", value: web3.toWei(10000,"ether")})' attach http://eth:8545 +address=$(yq -r '.additional_accounts.user_zevm_mp_test.evm_address' config.yml) +echo "funding zevm mp tester address ${address} with 10000 Ether" +geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 # unlock bitcoin tester accounts -echo "funding deployer address 0x283d810090EdF4043E75247eAeBcE848806237fD with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0x283d810090EdF4043E75247eAeBcE848806237fD", value: web3.toWei(10000,"ether")})' attach http://eth:8545 +address=$(yq -r '.additional_accounts.user_bitcoin.evm_address' config.yml) +echo "funding bitcoin tester address ${address} with 10000 Ether" +geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 # unlock ethers tester accounts -echo "funding deployer address 0x8D47Db7390AC4D3D449Cc20D799ce4748F97619A with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0x8D47Db7390AC4D3D449Cc20D799ce4748F97619A", value: web3.toWei(10000,"ether")})' attach http://eth:8545 +address=$(yq -r '.additional_accounts.user_ether.evm_address' config.yml) +echo "funding ether tester address ${address} with 10000 Ether" +geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 # unlock miscellaneous tests accounts -echo "funding deployer address 0x90126d02E41c9eB2a10cfc43aAb3BD3460523Cdf with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0x90126d02E41c9eB2a10cfc43aAb3BD3460523Cdf", value: web3.toWei(10000,"ether")})' attach http://eth:8545 +address=$(yq -r '.additional_accounts.user_misc.evm_address' config.yml) +echo "funding misc tester address ${address} with 10000 Ether" +geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 # unlock admin erc20 tests accounts -echo "funding deployer address 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", value: web3.toWei(10000,"ether")})' attach http://eth:8545 - -# unlock the TSS account -echo "funding TSS address 0xF421292cb0d3c97b90EEEADfcD660B893592c6A2 with 10000 Ether" -geth --exec 'eth.sendTransaction({from: eth.coinbase, to: "0xF421292cb0d3c97b90EEEADfcD660B893592c6A2", value: web3.toWei(10000,"ether")})' attach http://eth:8545 +address=$(yq -r '.additional_accounts.user_admin.evm_address' config.yml) +echo "funding admin tester address ${address} with 10000 Ether" +geth --exec "eth.sendTransaction({from: eth.coinbase, to: '${address}', value: web3.toWei(10000,'ether')})" attach http://eth:8545 ### Run zetae2e command depending on the option passed @@ -83,7 +87,7 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then UPGRADE_HEIGHT=${UPGRADE_HEIGHT:=225} if [[ ! -f deployed.yml ]]; then - zetae2e local $E2E_ARGS --setup-only --config-out deployed.yml --skip-header-proof + zetae2e local $E2E_ARGS --setup-only --config config.yml --config-out deployed.yml --skip-header-proof if [ $? -ne 0 ]; then echo "e2e setup failed" exit 1 @@ -159,7 +163,7 @@ else echo "running e2e setup..." if [[ ! -f deployed.yml ]]; then - zetae2e local $E2E_ARGS --setup-only --config-out deployed.yml + zetae2e local $E2E_ARGS --config config.yml --setup-only --config-out deployed.yml if [ $? -ne 0 ]; then echo "e2e setup failed" exit 1 diff --git a/contrib/localnet/scripts/start-zetacored.sh b/contrib/localnet/scripts/start-zetacored.sh index 29be9fb1ad..aba9538c5e 100755 --- a/contrib/localnet/scripts/start-zetacored.sh +++ b/contrib/localnet/scripts/start-zetacored.sh @@ -213,23 +213,30 @@ then fi # set admin account - zetacored add-genesis-account zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3 100000000000000000000000000azeta zetacored add-genesis-account zeta1n0rn6sne54hv7w2uu93fl48ncyqz97d3kty6sh 100000000000000000000000000azeta # Funds the localnet_gov_admin account - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][0]["address"]="zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][1]["address"]="zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][2]["address"]="zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json + + address=$(yq -r '.additional_accounts.user_fungible_admin.bech32_address' /root/config.yml) + zetacored add-genesis-account "$address" 100000000000000000000000000azeta + cat $HOME/.zetacored/config/genesis.json | jq --arg address "$address" '.app_state["authority"]["policies"]["items"][0]["address"] = $address' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json + cat $HOME/.zetacored/config/genesis.json | jq --arg address "$address" '.app_state["authority"]["policies"]["items"][1]["address"] = $address' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json + cat $HOME/.zetacored/config/genesis.json | jq --arg address "$address" '.app_state["authority"]["policies"]["items"][2]["address"] = $address' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json # give balance to runner accounts to deploy contracts directly on zEVM -# deployer - zetacored add-genesis-account zeta1uhznv7uzyjq84s3q056suc8pkme85lkvhrz3dd 100000000000000000000000000azeta +# default account + address=$(yq -r '.default_account.bech32_address' /root/config.yml) + zetacored add-genesis-account "$address" 100000000000000000000000000azeta # erc20 tester - zetacored add-genesis-account zeta1datate7xmwm4uk032f9rmcu0cwy7ch7kg6y6zv 100000000000000000000000000azeta + address=$(yq -r '.additional_accounts.user_erc20.bech32_address' /root/config.yml) + zetacored add-genesis-account "$address" 100000000000000000000000000azeta # zeta tester - zetacored add-genesis-account zeta1tnp0hvsq4y5mxuhrq9h3jfwulxywpq0ads0rer 100000000000000000000000000azeta + address=$(yq -r '.additional_accounts.user_zeta_test.bech32_address' /root/config.yml) + zetacored add-genesis-account "$address" 100000000000000000000000000azeta # bitcoin tester - zetacored add-genesis-account zeta19q7czqysah6qg0n4y3l2a08gfzqxydla492v80 100000000000000000000000000azeta + address=$(yq -r '.additional_accounts.user_bitcoin.bech32_address' /root/config.yml) + zetacored add-genesis-account "$address" 100000000000000000000000000azeta # ethers tester - zetacored add-genesis-account zeta134rakuus43xn63yucgxhn88ywj8ewcv6ezn2ga 100000000000000000000000000azeta + address=$(yq -r '.additional_accounts.user_ether.bech32_address' /root/config.yml) + zetacored add-genesis-account "$address" 100000000000000000000000000azeta # 3. Copy the genesis.json to all the nodes .And use it to create a gentx for every node zetacored gentx operator 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING --gas-prices 20000000000azeta diff --git a/e2e/config/config.go b/e2e/config/config.go index 450b02c5a3..66409ee339 100644 --- a/e2e/config/config.go +++ b/e2e/config/config.go @@ -1,26 +1,70 @@ package config import ( + "crypto/ecdsa" "errors" "fmt" "os" + "strings" "github.com/btcsuite/btcd/chaincfg" - "gopkg.in/yaml.v2" + "github.com/cosmos/cosmos-sdk/types/bech32" + ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/crypto" + "gopkg.in/yaml.v3" ) +// DoubleQuotedString forces a string to be double quoted when marshaling to yaml. +// This is required because of https://github.com/go-yaml/yaml/issues/847 +type DoubleQuotedString string + +func (s DoubleQuotedString) MarshalYAML() (interface{}, error) { + return yaml.Node{ + Value: string(s), + Kind: yaml.ScalarNode, + Style: yaml.DoubleQuotedStyle, + }, nil +} + +func (s DoubleQuotedString) String() string { + return string(s) +} + +func (s DoubleQuotedString) AsEVMAddress() (ethcommon.Address, error) { + if !ethcommon.IsHexAddress(string(s)) { + return ethcommon.Address{}, fmt.Errorf("invalid evm address: %s", string(s)) + } + return ethcommon.HexToAddress(string(s)), nil +} + // Config contains the configuration for the e2e test type Config struct { - Accounts Accounts `yaml:"accounts"` - RPCs RPCs `yaml:"rpcs"` - Contracts Contracts `yaml:"contracts"` - ZetaChainID string `yaml:"zeta_chain_id"` + // Default account to use when running tests and running setup + DefaultAccount Account `yaml:"default_account"` + AdditionalAccounts AdditionalAccounts `yaml:"additional_accounts"` + RPCs RPCs `yaml:"rpcs"` + Contracts Contracts `yaml:"contracts"` + ZetaChainID string `yaml:"zeta_chain_id"` +} + +// Account contains configuration for an account +type Account struct { + RawBech32Address DoubleQuotedString `yaml:"bech32_address"` + RawEVMAddress DoubleQuotedString `yaml:"evm_address"` + RawPrivateKey DoubleQuotedString `yaml:"private_key"` } -// Accounts contains the configuration for the accounts -type Accounts struct { - EVMAddress string `yaml:"evm_address"` - EVMPrivKey string `yaml:"evm_priv_key"` +// AdditionalAccounts are extra accounts required to run specific tests +type AdditionalAccounts struct { + UserERC20 Account `yaml:"user_erc20"` + UserZetaTest Account `yaml:"user_zeta_test"` + UserZEVMMPTest Account `yaml:"user_zevm_mp_test"` + UserBitcoin Account `yaml:"user_bitcoin"` + UserEther Account `yaml:"user_ether"` + UserMisc Account `yaml:"user_misc"` + UserAdmin Account `yaml:"user_admin"` + UserFungibleAdmin Account `yaml:"user_fungible_admin"` } // RPCs contains the configuration for the RPC endpoints @@ -50,26 +94,26 @@ type Contracts struct { // EVM contains the addresses of predeployed contracts on the EVM chain type EVM struct { - ZetaEthAddress string `yaml:"zeta_eth"` - ConnectorEthAddr string `yaml:"connector_eth"` - CustodyAddr string `yaml:"custody"` - ERC20 string `yaml:"erc20"` - TestDappAddr string `yaml:"test_dapp"` + ZetaEthAddr DoubleQuotedString `yaml:"zeta_eth"` + ConnectorEthAddr DoubleQuotedString `yaml:"connector_eth"` + CustodyAddr DoubleQuotedString `yaml:"custody"` + ERC20 DoubleQuotedString `yaml:"erc20"` + TestDappAddr DoubleQuotedString `yaml:"test_dapp"` } // ZEVM contains the addresses of predeployed contracts on the zEVM chain type ZEVM struct { - SystemContractAddr string `yaml:"system_contract"` - ETHZRC20Addr string `yaml:"eth_zrc20"` - ERC20ZRC20Addr string `yaml:"erc20_zrc20"` - BTCZRC20Addr string `yaml:"btc_zrc20"` - UniswapFactoryAddr string `yaml:"uniswap_factory"` - UniswapRouterAddr string `yaml:"uniswap_router"` - ConnectorZEVMAddr string `yaml:"connector_zevm"` - WZetaAddr string `yaml:"wzeta"` - ZEVMSwapAppAddr string `yaml:"zevm_swap_app"` - ContextAppAddr string `yaml:"context_app"` - TestDappAddr string `yaml:"test_dapp"` + SystemContractAddr DoubleQuotedString `yaml:"system_contract"` + ETHZRC20Addr DoubleQuotedString `yaml:"eth_zrc20"` + ERC20ZRC20Addr DoubleQuotedString `yaml:"erc20_zrc20"` + BTCZRC20Addr DoubleQuotedString `yaml:"btc_zrc20"` + UniswapFactoryAddr DoubleQuotedString `yaml:"uniswap_factory"` + UniswapRouterAddr DoubleQuotedString `yaml:"uniswap_router"` + ConnectorZEVMAddr DoubleQuotedString `yaml:"connector_zevm"` + WZetaAddr DoubleQuotedString `yaml:"wzeta"` + ZEVMSwapAppAddr DoubleQuotedString `yaml:"zevm_swap_app"` + ContextAppAddr DoubleQuotedString `yaml:"context_app"` + TestDappAddr DoubleQuotedString `yaml:"test_dapp"` } // DefaultConfig returns the default config using values for localnet testing @@ -137,6 +181,21 @@ func WriteConfig(file string, config Config) error { return nil } +// AsSlice gets all accounts as a slice rather than a +// struct +func (a AdditionalAccounts) AsSlice() []Account { + return []Account{ + a.UserERC20, + a.UserZetaTest, + a.UserZEVMMPTest, + a.UserBitcoin, + a.UserEther, + a.UserMisc, + a.UserAdmin, + a.UserFungibleAdmin, + } +} + // Validate validates the config func (c Config) Validate() error { if c.RPCs.Bitcoin.Params != Mainnet && @@ -144,6 +203,105 @@ func (c Config) Validate() error { c.RPCs.Bitcoin.Params != Regnet { return errors.New("invalid bitcoin params") } + + err := c.DefaultAccount.Validate() + if err != nil { + return fmt.Errorf("validating deployer account: %w", err) + } + + accounts := c.AdditionalAccounts.AsSlice() + for i, account := range accounts { + if account.RawEVMAddress == "" { + continue + } + err := account.Validate() + if err != nil { + return fmt.Errorf("validating account %d: %w", i, err) + } + } + return nil +} + +// GenerateKeys generates new key pairs for all accounts +func (c *Config) GenerateKeys() error { + var err error + c.DefaultAccount, err = generateAccount() + if err != nil { + return err + } + c.AdditionalAccounts.UserERC20, err = generateAccount() + if err != nil { + return err + } + c.AdditionalAccounts.UserZetaTest, err = generateAccount() + if err != nil { + return err + } + c.AdditionalAccounts.UserZEVMMPTest, err = generateAccount() + if err != nil { + return err + } + c.AdditionalAccounts.UserBitcoin, err = generateAccount() + if err != nil { + return err + } + c.AdditionalAccounts.UserEther, err = generateAccount() + if err != nil { + return err + } + c.AdditionalAccounts.UserMisc, err = generateAccount() + if err != nil { + return err + } + c.AdditionalAccounts.UserAdmin, err = generateAccount() + if err != nil { + return err + } + c.AdditionalAccounts.UserFungibleAdmin, err = generateAccount() + if err != nil { + return err + } + return nil +} + +func (a Account) EVMAddress() ethcommon.Address { + return ethcommon.HexToAddress(a.RawEVMAddress.String()) +} + +func (a Account) PrivateKey() (*ecdsa.PrivateKey, error) { + return crypto.HexToECDSA(a.RawPrivateKey.String()) +} + +// Validate that the address and the private key specified in the +// config actually match +func (a Account) Validate() error { + privateKey, err := a.PrivateKey() + if err != nil { + return fmt.Errorf("invalid private key: %w", err) + } + privateKeyAddress := crypto.PubkeyToAddress(privateKey.PublicKey) + if a.RawEVMAddress.String() != privateKeyAddress.Hex() { + return fmt.Errorf( + "address derived from private key (%s) does not match configured address (%s)", + privateKeyAddress, + a.RawEVMAddress, + ) + } + _, _, err = bech32.DecodeAndConvert(a.RawBech32Address.String()) + if err != nil { + return fmt.Errorf("decoding bech32 address: %w", err) + } + bech32PrivateKeyAddress, err := bech32.ConvertAndEncode("zeta", privateKeyAddress.Bytes()) + if err != nil { + return fmt.Errorf("encoding private key to bech32: %w", err) + } + if a.RawBech32Address.String() != bech32PrivateKeyAddress { + return fmt.Errorf( + "address derived from private key (%s) does not match configured address (%s)", + bech32PrivateKeyAddress, + a.RawBech32Address, + ) + } return nil } @@ -170,3 +328,25 @@ func (bnt BitcoinNetworkType) GetParams() (chaincfg.Params, error) { return chaincfg.Params{}, fmt.Errorf("invalid bitcoin params %s", bnt) } } + +func generateAccount() (Account, error) { + privateKey, err := crypto.GenerateKey() + if err != nil { + return Account{}, fmt.Errorf("generating private key: %w", err) + } + // encode private key and strip 0x prefix + encodedPrivateKey := hexutil.Encode(crypto.FromECDSA(privateKey)) + encodedPrivateKey = strings.TrimPrefix(encodedPrivateKey, "0x") + + evmAddress := crypto.PubkeyToAddress(privateKey.PublicKey) + bech32Address, err := bech32.ConvertAndEncode("zeta", evmAddress.Bytes()) + if err != nil { + return Account{}, fmt.Errorf("bech32 convert and encode: %w", err) + } + + return Account{ + RawEVMAddress: DoubleQuotedString(evmAddress.String()), + RawPrivateKey: DoubleQuotedString(encodedPrivateKey), + RawBech32Address: DoubleQuotedString(bech32Address), + }, nil +} diff --git a/e2e/config/config_test.go b/e2e/config/config_test.go new file mode 100644 index 0000000000..033efb81b6 --- /dev/null +++ b/e2e/config/config_test.go @@ -0,0 +1,39 @@ +package config + +import ( + "reflect" + "testing" + + "github.com/stretchr/testify/require" +) + +// TestAdditionalAccountsSlicesSynced ensures than if any new accounts are added the +// AccountsSlice() function is updated +func TestConfigAdditionalAccountsSliceSynced(t *testing.T) { + additionalAccountsType := reflect.TypeOf(AdditionalAccounts{}) + numberOfAdditionalAccounts := additionalAccountsType.NumField() + + require.Greater(t, numberOfAdditionalAccounts, 0) + + conf := Config{} + err := conf.GenerateKeys() + require.NoError(t, err) + + additionalAccountsSlice := conf.AdditionalAccounts.AsSlice() + require.Len(t, additionalAccountsSlice, numberOfAdditionalAccounts) + + for _, account := range additionalAccountsSlice { + require.NoError(t, account.Validate()) + } +} + +func TestConfigInvalidAccount(t *testing.T) { + conf := Config{ + DefaultAccount: Account{ + RawEVMAddress: "asdf", + RawPrivateKey: "asdf", + }, + } + err := conf.Validate() + require.Error(t, err) +} diff --git a/e2e/e2etests/test_context_upgrade.go b/e2e/e2etests/test_context_upgrade.go index 4d06ee84d1..4a71b07428 100644 --- a/e2e/e2etests/test_context_upgrade.go +++ b/e2e/e2etests/test_context_upgrade.go @@ -57,7 +57,7 @@ func TestContextUpgrade(r *runner.E2ERunner, args []string) { r.Logger.Info(" msgsender: %s", eventIter.Event.MsgSender.Hex()) found = true - require.Equal(r, 0, bytes.Compare(eventIter.Event.Origin, r.DeployerAddress.Bytes()), "origin mismatch") + require.Equal(r, 0, bytes.Compare(eventIter.Event.Origin, r.EVMAddress().Bytes()), "origin mismatch") chainID, err := r.EVMClient.ChainID(r.Ctx) require.NoError(r, err) diff --git a/e2e/e2etests/test_crosschain_swap.go b/e2e/e2etests/test_crosschain_swap.go index f1fe6f54aa..798958a652 100644 --- a/e2e/e2etests/test_crosschain_swap.go +++ b/e2e/e2etests/test_crosschain_swap.go @@ -58,7 +58,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { big.NewInt(1e8), big.NewInt(1e8), big.NewInt(1e5), - r.DeployerAddress, + r.EVMAddress(), big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) require.NoError(r, err) @@ -80,7 +80,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { r.Logger.Info("***** First test: ERC20 -> BTC") // Should deposit ERC20 for swap, swap for BTC and withdraw BTC - txHash := r.DepositERC20WithAmountAndMessage(r.DeployerAddress, big.NewInt(8e7), msg) + txHash := r.DepositERC20WithAmountAndMessage(r.EVMAddress(), big.NewInt(8e7), msg) cctx1 := utils.WaitCctxMinedByInboundHash(r.Ctx, txHash.Hex(), r.CctxClient, r.Logger, r.CctxTimeout) // check the cctx status @@ -110,7 +110,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { r.Logger.Info("#utxos %d", len(utxos)) r.Logger.Info("memo address %s", r.ERC20ZRC20Addr) - memo, err := r.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, r.ERC20ZRC20Addr, r.DeployerAddress.Bytes()) + memo, err := r.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, r.ERC20ZRC20Addr, r.EVMAddress().Bytes()) require.NoError(r, err) memo = append(r.ZEVMSwapAppAddr.Bytes(), memo...) @@ -138,7 +138,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { r.Logger.Info("******* Third test: BTC -> ETH with contract call reverted; should refund BTC") // the following memo will result in a revert in the contract call as targetZRC20 is set to DeployerAddress // which is apparently not a ZRC20 contract; the UNISWAP call will revert - memo, err := r.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, r.DeployerAddress, r.DeployerAddress.Bytes()) + memo, err := r.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, r.EVMAddress(), r.EVMAddress().Bytes()) require.NoError(r, err) memo = append(r.ZEVMSwapAppAddr.Bytes(), memo...) diff --git a/e2e/e2etests/test_erc20_deposit.go b/e2e/e2etests/test_erc20_deposit.go index 2f763f34b0..c7f1d4fc5f 100644 --- a/e2e/e2etests/test_erc20_deposit.go +++ b/e2e/e2etests/test_erc20_deposit.go @@ -15,7 +15,7 @@ func TestERC20Deposit(r *runner.E2ERunner, args []string) { amount, ok := big.NewInt(0).SetString(args[0], 10) require.True(r, ok, "Invalid amount specified for TestERC20Deposit.") - hash := r.DepositERC20WithAmountAndMessage(r.DeployerAddress, amount, []byte{}) + hash := r.DepositERC20WithAmountAndMessage(r.EVMAddress(), amount, []byte{}) // wait for the cctx to be mined cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, hash.Hex(), r.CctxClient, r.Logger, r.CctxTimeout) diff --git a/e2e/e2etests/test_erc20_deposit_refund.go b/e2e/e2etests/test_erc20_deposit_refund.go index ad0a962507..5e8d1173ef 100644 --- a/e2e/e2etests/test_erc20_deposit_refund.go +++ b/e2e/e2etests/test_erc20_deposit_refund.go @@ -17,7 +17,7 @@ import ( func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { // Get the initial balance of the deployer - initialBal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + initialBal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) r.Logger.Info("Sending a deposit that should revert without a liquidity pool makes the cctx aborted") @@ -36,13 +36,13 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { r.Logger.CCTX(*cctx, "deposit") r.Logger.Info("Refunding the cctx via admin") - msg := types.NewMsgRefundAbortedCCTX(r.ZetaTxServer.GetAccountAddress(0), cctx.Index, r.DeployerAddress.String()) + msg := types.NewMsgRefundAbortedCCTX(r.ZetaTxServer.GetAccountAddress(0), cctx.Index, r.EVMAddress().String()) _, err = r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) require.NoError(r, err) // Check that the erc20 in the aborted cctx was refunded on ZetaChain - newBalance, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + newBalance, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) expectedBalance := initialBal.Add(initialBal, amount) @@ -65,7 +65,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { r.Logger.Info("Liquidity pool created") - erc20Balance, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + erc20Balance, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) // send the deposit @@ -87,7 +87,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { utils.RequireTxSuccessful(r, receipt) // check that the erc20 in the reverted cctx was refunded on EVM - erc20BalanceAfterRefund, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + erc20BalanceAfterRefund, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) // the new balance must be higher than the previous one because of the revert refund @@ -118,7 +118,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { amount := big.NewInt(1e10) - txHash := r.DepositERC20WithAmountAndMessage(r.DeployerAddress, amount, []byte{}) + txHash := r.DepositERC20WithAmountAndMessage(r.EVMAddress(), amount, []byte{}) utils.WaitCctxMinedByInboundHash(r.Ctx, txHash.Hex(), r.CctxClient, r.Logger, r.CctxTimeout) tx, err := r.ERC20ZRC20.Approve(r.ZEVMAuth, r.UniswapV2RouterAddr, big.NewInt(1e10)) @@ -138,7 +138,7 @@ func createZetaERC20LiquidityPool(r *runner.E2ERunner) error { amount, big.NewInt(0), big.NewInt(0), - r.DeployerAddress, + r.EVMAddress(), big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) r.ZEVMAuth.Value = previousValue @@ -163,7 +163,7 @@ func sendInvalidERC20Deposit(r *runner.E2ERunner, amount *big.Int) (string, erro tx, err = r.ERC20Custody.Deposit( r.EVMAuth, - r.DeployerAddress.Bytes(), + r.EVMAddress().Bytes(), r.ERC20Addr, amount, []byte("this is an invalid msg that will cause the contract to revert"), diff --git a/e2e/e2etests/test_erc20_multiple_deposits.go b/e2e/e2etests/test_erc20_multiple_deposits.go index a99642f356..87b8309924 100644 --- a/e2e/e2etests/test_erc20_multiple_deposits.go +++ b/e2e/e2etests/test_erc20_multiple_deposits.go @@ -22,7 +22,7 @@ func TestMultipleERC20Deposit(r *runner.E2ERunner, args []string) { require.True(r, ok) require.NotZero(r, numberOfDeposits.Int64()) - initialBal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + initialBal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) txhash := multipleDeposits(r, depositAmount, numberOfDeposits) @@ -37,7 +37,7 @@ func TestMultipleERC20Deposit(r *runner.E2ERunner, args []string) { require.Len(r, cctxs, 3) // check new balance is increased by amount * count - bal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + bal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) diff := big.NewInt(0).Sub(bal, initialBal) @@ -61,7 +61,7 @@ func multipleDeposits(r *runner.E2ERunner, amount, count *big.Int) ethcommon.Has r.Logger.Info("ERC20 Approve receipt tx hash: %s", tx.Hash().Hex()) // deposit - tx, err = depositor.RunDeposits(r.EVMAuth, r.DeployerAddress.Bytes(), r.ERC20Addr, amount, []byte{}, count) + tx, err = depositor.RunDeposits(r.EVMAuth, r.EVMAddress().Bytes(), r.ERC20Addr, amount, []byte{}, count) require.NoError(r, err) receipt = utils.MustWaitForTxReceipt(r.Ctx, r.EVMClient, tx, r.Logger, r.ReceiptTimeout) diff --git a/e2e/e2etests/test_erc20_multiple_withdraws.go b/e2e/e2etests/test_erc20_multiple_withdraws.go index 14bbb176ca..53a45d1b41 100644 --- a/e2e/e2etests/test_erc20_multiple_withdraws.go +++ b/e2e/e2etests/test_erc20_multiple_withdraws.go @@ -56,7 +56,7 @@ func TestMultipleERC20Withdraws(r *runner.E2ERunner, args []string) { r.Logger.Info("eth zrc20 approve receipt: status %d", receipt.Status) // check the balance - bal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + bal, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) r.Logger.Info("balance of deployer on ERC20 ZRC20: %d", bal) @@ -65,7 +65,7 @@ func TestMultipleERC20Withdraws(r *runner.E2ERunner, args []string) { // withdraw tx, err = withdrawer.RunWithdraws( r.ZEVMAuth, - r.DeployerAddress.Bytes(), + r.EVMAddress().Bytes(), r.ERC20ZRC20Addr, withdrawalAmount, numberOfWithdrawals, diff --git a/e2e/e2etests/test_eth_deposit_call.go b/e2e/e2etests/test_eth_deposit_call.go index 0d7734fbdb..7fd928266d 100644 --- a/e2e/e2etests/test_eth_deposit_call.go +++ b/e2e/e2etests/test_eth_deposit_call.go @@ -5,7 +5,6 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/e2e/runner" @@ -33,7 +32,7 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { gasPrice, err := evmClient.SuggestGasPrice(r.Ctx) require.NoError(r, err) - nonce, err := evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(r.Ctx, r.EVMAddress()) require.NoError(r, err) data := append(exampleAddr.Bytes(), []byte("hello sailors")...) @@ -41,7 +40,7 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { chainID, err := evmClient.NetworkID(r.Ctx) require.NoError(r, err) - deployerPrivkey, err := crypto.HexToECDSA(r.DeployerPrivateKey) + deployerPrivkey, err := r.Account.PrivateKey() require.NoError(r, err) signedTx, err := ethtypes.SignTx(tx, ethtypes.NewEIP155Signer(chainID), deployerPrivkey) @@ -80,7 +79,7 @@ func TestEtherDepositAndCall(r *runner.E2ERunner, args []string) { gasPrice, err = evmClient.SuggestGasPrice(r.Ctx) require.NoError(r, err) - nonce, err = evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err = evmClient.PendingNonceAt(r.Ctx, r.EVMAddress()) require.NoError(r, err) data = append(reverterAddr.Bytes(), []byte("hello sailors")...) diff --git a/e2e/e2etests/test_eth_deposit_liquidity_cap.go b/e2e/e2etests/test_eth_deposit_liquidity_cap.go index f64b041478..2f03c7a568 100644 --- a/e2e/e2etests/test_eth_deposit_liquidity_cap.go +++ b/e2e/e2etests/test_eth_deposit_liquidity_cap.go @@ -47,7 +47,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { r.Logger.Info("CCTX has been reverted") r.Logger.Info("Depositing less than liquidity cap should still succeed") - initialBal, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + initialBal, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) signedTx, err = r.SendEther(r.TSSAddress, amountLessThanCap, nil) @@ -61,7 +61,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { expectedBalance := big.NewInt(0).Add(initialBal, amountLessThanCap) - bal, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + bal, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) require.Equal(r, 0, bal.Cmp(expectedBalance)) @@ -79,7 +79,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { r.Logger.Info("remove liquidity cap tx hash: %s", res.TxHash) - initialBal, err = r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + initialBal, err = r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) signedTx, err = r.SendEther(r.TSSAddress, amountMoreThanCap, nil) @@ -91,7 +91,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { utils.WaitCctxMinedByInboundHash(r.Ctx, signedTx.Hash().Hex(), r.CctxClient, r.Logger, r.CctxTimeout) expectedBalance = big.NewInt(0).Add(initialBal, amountMoreThanCap) - bal, err = r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + bal, err = r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) require.Equal(r, 0, diff --git a/e2e/e2etests/test_eth_deposit_refund.go b/e2e/e2etests/test_eth_deposit_refund.go index 394ffdd8e4..946c457927 100644 --- a/e2e/e2etests/test_eth_deposit_refund.go +++ b/e2e/e2etests/test_eth_deposit_refund.go @@ -5,7 +5,6 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/e2e/runner" @@ -21,7 +20,7 @@ func TestEtherDepositAndCallRefund(r *runner.E2ERunner, args []string) { evmClient := r.EVMClient - nonce, err := evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(r.Ctx, r.EVMAddress()) require.NoError(r, err) gasLimit := uint64(23000) // in units @@ -33,7 +32,7 @@ func TestEtherDepositAndCallRefund(r *runner.E2ERunner, args []string) { chainID, err := evmClient.NetworkID(r.Ctx) require.NoError(r, err) - deployerPrivkey, err := crypto.HexToECDSA(r.DeployerPrivateKey) + deployerPrivkey, err := r.Account.PrivateKey() require.NoError(r, err) signedTx, err := ethtypes.SignTx(tx, ethtypes.NewEIP155Signer(chainID), deployerPrivkey) @@ -66,7 +65,7 @@ func TestEtherDepositAndCallRefund(r *runner.E2ERunner, args []string) { utils.RequireCCTXStatus(r, cctx, types.CctxStatus_Reverted) utils.RequireTxSuccessful(r, receipt) - require.Equal(r, r.DeployerAddress, *tx.To(), "expected tx to %s; got %s", r.DeployerAddress.Hex(), tx.To().Hex()) + require.Equal(r, r.EVMAddress(), *tx.To(), "expected tx to %s; got %s", r.EVMAddress().Hex(), tx.To().Hex()) // the received value must be lower than the original value because of the paid fees for the revert tx // we check that the value is still greater than 0 diff --git a/e2e/e2etests/test_message_passing_external_chains.go b/e2e/e2etests/test_message_passing_external_chains.go index 317665920b..2c2ed65997 100644 --- a/e2e/e2etests/test_message_passing_external_chains.go +++ b/e2e/e2etests/test_message_passing_external_chains.go @@ -39,7 +39,7 @@ func TestMessagePassingExternalChains(r *runner.E2ERunner, args []string) { r.Logger.Info("Calling ConnectorEth.Send") tx, err = r.ConnectorEth.Send(auth, zetaconnectoreth.ZetaInterfacesSendInput{ DestinationChainId: chainID, - DestinationAddress: r.DeployerAddress.Bytes(), + DestinationAddress: r.EVMAddress().Bytes(), DestinationGasLimit: big.NewInt(400_000), Message: nil, ZetaValueAndGas: amount, diff --git a/e2e/e2etests/test_message_passing_external_chains_revert_fail.go b/e2e/e2etests/test_message_passing_external_chains_revert_fail.go index 3950a8cdd5..9cc1ee8d8f 100644 --- a/e2e/e2etests/test_message_passing_external_chains_revert_fail.go +++ b/e2e/e2etests/test_message_passing_external_chains_revert_fail.go @@ -39,7 +39,7 @@ func TestMessagePassingRevertFailExternalChains(r *runner.E2ERunner, args []stri tx, err = r.ConnectorEth.Send(auth, zetaconnectoreth.ZetaInterfacesSendInput{ DestinationChainId: chainID, - DestinationAddress: r.DeployerAddress.Bytes(), + DestinationAddress: r.EVMAddress().Bytes(), DestinationGasLimit: big.NewInt(400_000), Message: []byte( "revert", diff --git a/e2e/e2etests/test_migrate_chain_support.go b/e2e/e2etests/test_migrate_chain_support.go index 848335ddef..07f49a5815 100644 --- a/e2e/e2etests/test_migrate_chain_support.go +++ b/e2e/e2etests/test_migrate_chain_support.go @@ -9,12 +9,12 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethclient" "github.com/fatih/color" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" + "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/txserver" "github.com/zeta-chain/zetacore/e2e/utils" @@ -38,7 +38,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { // deposit most of the ZETA supply on ZetaChain zetaAmount := big.NewInt(1e18) zetaAmount = zetaAmount.Mul(zetaAmount, big.NewInt(20_000_000_000)) // 20B Zeta - r.DepositZetaWithAmount(r.DeployerAddress, zetaAmount) + r.DepositZetaWithAmount(r.EVMAddress(), zetaAmount) // do an ethers withdraw on the previous chain (0.01eth) for some interaction TestEtherWithdraw(r, []string{"10000000000000000"}) @@ -120,7 +120,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { time.Sleep(10 * time.Second) // emitting a withdraw with the previous chain should fail - txWithdraw, err := r.ETHZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), big.NewInt(10000000000000000)) + txWithdraw, err := r.ETHZRC20.Withdraw(r.ZEVMAuth, r.EVMAddress().Bytes(), big.NewInt(10000000000000000)) if err == nil { receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, txWithdraw, r.Logger, r.ReceiptTimeout) utils.RequiredTxFailed(r, receipt) @@ -199,8 +199,7 @@ func configureEVM2(r *runner.E2ERunner) (*runner.E2ERunner, error) { r.Ctx, "admin-evm2", r.CtxCancel, - r.DeployerAddress, - r.DeployerPrivateKey, + r.Account, r.EVMClient, r.ZEVMClient, r.CctxClient, @@ -217,7 +216,7 @@ func configureEVM2(r *runner.E2ERunner) (*runner.E2ERunner, error) { ) // All existing fields of the runner are the same except for the RPC URL and client for EVM - ewvmClient, evmAuth, err := getEVMClient(newRunner.Ctx, EVM2RPCURL, r.DeployerPrivateKey) + ewvmClient, evmAuth, err := getEVMClient(newRunner.Ctx, EVM2RPCURL, r.Account) if err != nil { return nil, err } @@ -243,7 +242,11 @@ func configureEVM2(r *runner.E2ERunner) (*runner.E2ERunner, error) { } // getEVMClient get evm client from rpc and private key -func getEVMClient(ctx context.Context, rpc, privKey string) (*ethclient.Client, *bind.TransactOpts, error) { +func getEVMClient( + ctx context.Context, + rpc string, + account config.Account, +) (*ethclient.Client, *bind.TransactOpts, error) { evmClient, err := ethclient.Dial(rpc) if err != nil { return nil, nil, err @@ -253,7 +256,7 @@ func getEVMClient(ctx context.Context, rpc, privKey string) (*ethclient.Client, if err != nil { return nil, nil, err } - deployerPrivkey, err := crypto.HexToECDSA(privKey) + deployerPrivkey, err := account.PrivateKey() if err != nil { return nil, nil, err } diff --git a/e2e/e2etests/test_rate_limiter.go b/e2e/e2etests/test_rate_limiter.go index 446d49a6b2..739d7821dc 100644 --- a/e2e/e2etests/test_rate_limiter.go +++ b/e2e/e2etests/test_rate_limiter.go @@ -221,7 +221,7 @@ func addZetaGasLiquidity(r *runner.E2ERunner) error { amount, big.NewInt(1e18), big.NewInt(1e18), - r.DeployerAddress, + r.EVMAddress(), big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) if err != nil { diff --git a/e2e/e2etests/test_stress_eth_withdraw.go b/e2e/e2etests/test_stress_eth_withdraw.go index 3a67ca8f94..2abd036a25 100644 --- a/e2e/e2etests/test_stress_eth_withdraw.go +++ b/e2e/e2etests/test_stress_eth_withdraw.go @@ -40,7 +40,7 @@ func TestStressEtherWithdraw(r *runner.E2ERunner, args []string) { for i := 0; i < numWithdraws; i++ { i := i - tx, err := r.ETHZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), withdrawalAmount) + tx, err := r.ETHZRC20.Withdraw(r.ZEVMAuth, r.EVMAddress().Bytes(), withdrawalAmount) require.NoError(r, err) receipt := utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) diff --git a/e2e/e2etests/test_update_bytecode_zrc20.go b/e2e/e2etests/test_update_bytecode_zrc20.go index ba914655d1..8205b88d9c 100644 --- a/e2e/e2etests/test_update_bytecode_zrc20.go +++ b/e2e/e2etests/test_update_bytecode_zrc20.go @@ -60,10 +60,10 @@ func TestUpdateBytecodeZRC20(r *runner.E2ERunner, _ []string) { totalSupply, err := r.ETHZRC20.TotalSupply(&bind.CallOpts{}) require.NoError(r, err) - balance, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + balance, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) - approval, err := r.ETHZRC20.Allowance(&bind.CallOpts{}, r.DeployerAddress, approved) + approval, err := r.ETHZRC20.Allowance(&bind.CallOpts{}, r.EVMAddress(), approved) require.NoError(r, err) r.Logger.Info("Updating the bytecode of the ZRC20") @@ -95,11 +95,11 @@ func TestUpdateBytecodeZRC20(r *runner.E2ERunner, _ []string) { require.NoError(r, err) require.Equal(r, 0, totalSupply.Cmp(newTotalSupply)) - newBalance, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + newBalance, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) require.Equal(r, 0, balance.Cmp(newBalance)) - newApproval, err := r.ETHZRC20.Allowance(&bind.CallOpts{}, r.DeployerAddress, approved) + newApproval, err := r.ETHZRC20.Allowance(&bind.CallOpts{}, r.EVMAddress(), approved) require.NoError(r, err) require.Equal(r, 0, approval.Cmp(newApproval)) diff --git a/e2e/e2etests/test_zeta_deposit.go b/e2e/e2etests/test_zeta_deposit.go index 056ee5709f..eb8021876d 100644 --- a/e2e/e2etests/test_zeta_deposit.go +++ b/e2e/e2etests/test_zeta_deposit.go @@ -15,7 +15,7 @@ func TestZetaDeposit(r *runner.E2ERunner, args []string) { amount, ok := big.NewInt(0).SetString(args[0], 10) require.True(r, ok, "Invalid amount specified for TestZetaDeposit.") - hash := r.DepositZetaWithAmount(r.DeployerAddress, amount) + hash := r.DepositZetaWithAmount(r.EVMAddress(), amount) // wait for the cctx to be mined cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, hash.Hex(), r.CctxClient, r.Logger, r.CctxTimeout) diff --git a/e2e/e2etests/test_zeta_withdraw_bitcoin_revert.go b/e2e/e2etests/test_zeta_withdraw_bitcoin_revert.go index ae34058c94..3685dccfb3 100644 --- a/e2e/e2etests/test_zeta_withdraw_bitcoin_revert.go +++ b/e2e/e2etests/test_zeta_withdraw_bitcoin_revert.go @@ -41,7 +41,7 @@ func TestZetaWithdrawBTCRevert(r *runner.E2ERunner, args []string) { lessThanAmount := amount.Div(amount, big.NewInt(10)) // 1/10 of amount tx, err = r.ConnectorZEVM.Send(r.ZEVMAuth, connectorzevm.ZetaInterfacesSendInput{ DestinationChainId: big.NewInt(chains.BitcoinRegtest.ChainId), - DestinationAddress: r.DeployerAddress.Bytes(), + DestinationAddress: r.EVMAddress().Bytes(), DestinationGasLimit: big.NewInt(400_000), Message: nil, ZetaValueAndGas: lessThanAmount, diff --git a/e2e/e2etests/test_zrc20_swap.go b/e2e/e2etests/test_zrc20_swap.go index 661d2fc40f..14febbe800 100644 --- a/e2e/e2etests/test_zrc20_swap.go +++ b/e2e/e2etests/test_zrc20_swap.go @@ -56,7 +56,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { big.NewInt(1000), big.NewInt(90000), big.NewInt(1000), - r.DeployerAddress, + r.EVMAddress(), big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) require.NoError(r, err) @@ -64,7 +64,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("Add liquidity receipt txhash %s status %d", receipt.TxHash, receipt.Status) - balETHBefore, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + balETHBefore, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) ethOutAmout := big.NewInt(1) @@ -73,7 +73,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { big.NewInt(1000), ethOutAmout, []ethcommon.Address{r.ERC20ZRC20Addr, r.ETHZRC20Addr}, - r.DeployerAddress, + r.EVMAddress(), big.NewInt(time.Now().Add(10*time.Minute).Unix()), ) require.NoError(r, err) @@ -81,7 +81,7 @@ func TestZRC20Swap(r *runner.E2ERunner, _ []string) { receipt = utils.MustWaitForTxReceipt(r.Ctx, r.ZEVMClient, tx, r.Logger, r.ReceiptTimeout) r.Logger.Info("Swap ERC20 ZRC20 for ETH ZRC20 %s status %d", receipt.TxHash, receipt.Status) - balETHAfter, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + balETHAfter, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) ethDiff := big.NewInt(0).Sub(balETHAfter, balETHBefore) diff --git a/e2e/runner/balances.go b/e2e/runner/balances.go index 8a0c37782a..d1e19d4c61 100644 --- a/e2e/runner/balances.go +++ b/e2e/runner/balances.go @@ -33,37 +33,37 @@ type AccountBalancesDiff struct { // GetAccountBalances returns the account balances of the accounts used in the E2E test func (r *E2ERunner) GetAccountBalances(skipBTC bool) (AccountBalances, error) { // zevm - zetaZeta, err := r.ZEVMClient.BalanceAt(r.Ctx, r.DeployerAddress, nil) + zetaZeta, err := r.ZEVMClient.BalanceAt(r.Ctx, r.EVMAddress(), nil) if err != nil { return AccountBalances{}, err } - zetaWZeta, err := r.WZeta.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + zetaWZeta, err := r.WZeta.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) if err != nil { return AccountBalances{}, err } - zetaEth, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + zetaEth, err := r.ETHZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) if err != nil { return AccountBalances{}, err } - zetaErc20, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + zetaErc20, err := r.ERC20ZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) if err != nil { return AccountBalances{}, err } - zetaBtc, err := r.BTCZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + zetaBtc, err := r.BTCZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) if err != nil { return AccountBalances{}, err } // evm - evmEth, err := r.EVMClient.BalanceAt(r.Ctx, r.DeployerAddress, nil) + evmEth, err := r.EVMClient.BalanceAt(r.Ctx, r.EVMAddress(), nil) if err != nil { return AccountBalances{}, err } - evmZeta, err := r.ZetaEth.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + evmZeta, err := r.ZetaEth.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) if err != nil { return AccountBalances{}, err } - evmErc20, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + evmErc20, err := r.ERC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) if err != nil { return AccountBalances{}, err } @@ -129,7 +129,7 @@ func (r *E2ERunner) GetBitcoinBalanceByAddress(address btcutil.Address) (btcutil // PrintAccountBalances shows the account balances of the accounts used in the E2E test // Note: USDT is mentioned as erc20 here because we want to show the balance of any erc20 contract func (r *E2ERunner) PrintAccountBalances(balances AccountBalances) { - r.Logger.Print(" ---💰 Account info %s ---", r.DeployerAddress.Hex()) + r.Logger.Print(" ---💰 Account info %s ---", r.EVMAddress().Hex()) // zevm r.Logger.Print("ZetaChain:") diff --git a/e2e/runner/bitcoin.go b/e2e/runner/bitcoin.go index c096bfc748..3165d745ca 100644 --- a/e2e/runner/bitcoin.go +++ b/e2e/runner/bitcoin.go @@ -141,7 +141,7 @@ func (r *E2ERunner) DepositBTC(testHeader bool) { ) utils.RequireCCTXStatus(r, cctx, crosschaintypes.CctxStatus_OutboundMined) - balance, err := r.BTCZRC20.BalanceOf(&bind.CallOpts{}, r.DeployerAddress) + balance, err := r.BTCZRC20.BalanceOf(&bind.CallOpts{}, r.EVMAddress()) require.NoError(r, err) require.Equal(r, 1, balance.Sign(), "balance should be positive") @@ -156,7 +156,7 @@ func (r *E2ERunner) SendToTSSFromDeployerToDeposit(amount float64, inputUTXOs [] *chainhash.Hash, error, ) { - return r.SendToTSSFromDeployerWithMemo(amount, inputUTXOs, r.DeployerAddress.Bytes()) + return r.SendToTSSFromDeployerWithMemo(amount, inputUTXOs, r.EVMAddress().Bytes()) } func (r *E2ERunner) SendToTSSFromDeployerWithMemo( diff --git a/e2e/runner/evm.go b/e2e/runner/evm.go index 523e01e207..88c1e100bf 100644 --- a/e2e/runner/evm.go +++ b/e2e/runner/evm.go @@ -7,7 +7,6 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/rpc" "github.com/stretchr/testify/require" @@ -66,7 +65,7 @@ func (r *E2ERunner) SendERC20OnEvm(address ethcommon.Address, amountERC20 int64) func (r *E2ERunner) DepositERC20() ethcommon.Hash { r.Logger.Print("⏳ depositing ERC20 into ZEVM") - return r.DepositERC20WithAmountAndMessage(r.DeployerAddress, big.NewInt(1e18), []byte{}) + return r.DepositERC20WithAmountAndMessage(r.EVMAddress(), big.NewInt(1e18), []byte{}) } func (r *E2ERunner) DepositERC20WithAmountAndMessage(to ethcommon.Address, amount *big.Int, msg []byte) ethcommon.Hash { @@ -143,7 +142,7 @@ func (r *E2ERunner) DepositEtherWithAmount(testHeader bool, amount *big.Int) eth func (r *E2ERunner) SendEther(_ ethcommon.Address, value *big.Int, data []byte) (*ethtypes.Transaction, error) { evmClient := r.EVMClient - nonce, err := evmClient.PendingNonceAt(r.Ctx, r.DeployerAddress) + nonce, err := evmClient.PendingNonceAt(r.Ctx, r.EVMAddress()) if err != nil { return nil, err } @@ -160,7 +159,7 @@ func (r *E2ERunner) SendEther(_ ethcommon.Address, value *big.Int, data []byte) return nil, err } - deployerPrivkey, err := crypto.HexToECDSA(r.DeployerPrivateKey) + deployerPrivkey, err := r.Account.PrivateKey() if err != nil { return nil, err } diff --git a/e2e/runner/runner.go b/e2e/runner/runner.go index e27de63247..a9c5c11d00 100644 --- a/e2e/runner/runner.go +++ b/e2e/runner/runner.go @@ -25,6 +25,7 @@ import ( "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-core/contracts/uniswapv2factory.sol" uniswapv2router "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" + "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/contracts/contextapp" "github.com/zeta-chain/zetacore/e2e/contracts/erc20" "github.com/zeta-chain/zetacore/e2e/contracts/zevmswap" @@ -49,8 +50,7 @@ func WithZetaTxServer(txServer *txserver.ZetaTxServer) E2ERunnerOption { // It also provides some helper functions type E2ERunner struct { // accounts - DeployerAddress ethcommon.Address - DeployerPrivateKey string + Account config.Account TSSAddress ethcommon.Address BTCTSSAddress btcutil.Address BTCDeployerAddress *btcutil.AddressWitnessPubKeyHash @@ -128,8 +128,7 @@ func NewE2ERunner( ctx context.Context, name string, ctxCancel context.CancelFunc, - deployerAddress ethcommon.Address, - deployerPrivateKey string, + account config.Account, evmClient *ethclient.Client, zevmClient *ethclient.Client, cctxClient crosschaintypes.QueryClient, @@ -148,8 +147,7 @@ func NewE2ERunner( Name: name, CtxCancel: ctxCancel, - DeployerAddress: deployerAddress, - DeployerPrivateKey: deployerPrivateKey, + Account: account, ZEVMClient: zevmClient, EVMClient: evmClient, @@ -314,3 +312,8 @@ func (r *E2ERunner) FailNow() { func (r *E2ERunner) requireTxSuccessful(receipt *ethtypes.Receipt, msgAndArgs ...any) { utils.RequireTxSuccessful(r, receipt, msgAndArgs...) } + +// EVMAddress is shorthand to get the EVM address of the account +func (r *E2ERunner) EVMAddress() ethcommon.Address { + return r.Account.EVMAddress() +} diff --git a/e2e/runner/setup_bitcoin.go b/e2e/runner/setup_bitcoin.go index 92a7eac428..15b6d4a11d 100644 --- a/e2e/runner/setup_bitcoin.go +++ b/e2e/runner/setup_bitcoin.go @@ -40,7 +40,7 @@ func (r *E2ERunner) SetupBitcoinAccount(initNetwork bool) { // GetBtcAddress returns the BTC address of the deployer from its EVM private key func (r *E2ERunner) GetBtcAddress() (string, string, error) { - skBytes, err := hex.DecodeString(r.DeployerPrivateKey) + skBytes, err := hex.DecodeString(r.Account.RawPrivateKey.String()) if err != nil { return "", "", err } @@ -65,7 +65,7 @@ func (r *E2ERunner) GetBtcAddress() (string, string, error) { // SetBtcAddress imports the deployer's private key into the Bitcoin node func (r *E2ERunner) SetBtcAddress(name string, rescan bool) { - skBytes, err := hex.DecodeString(r.DeployerPrivateKey) + skBytes, err := hex.DecodeString(r.Account.RawPrivateKey.String()) require.NoError(r, err) sk, _ := btcec.PrivKeyFromBytes(btcec.S256(), skBytes) diff --git a/e2e/runner/setup_evm.go b/e2e/runner/setup_evm.go index ff5b2e0ddc..7b61d43163 100644 --- a/e2e/runner/setup_evm.go +++ b/e2e/runner/setup_evm.go @@ -28,12 +28,12 @@ func (r *E2ERunner) SetEVMContractsFromConfig() { require.NoError(r, err) // Set ZetaEthAddr - r.ZetaEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ZetaEthAddress) + r.ZetaEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ZetaEthAddr.String()) r.ZetaEth, err = zetaeth.NewZetaEth(r.ZetaEthAddr, r.EVMClient) require.NoError(r, err) // Set ConnectorEthAddr - r.ConnectorEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ConnectorEthAddr) + r.ConnectorEthAddr = ethcommon.HexToAddress(conf.Contracts.EVM.ConnectorEthAddr.String()) r.ConnectorEth, err = zetaconnectoreth.NewZetaConnectorEth(r.ConnectorEthAddr, r.EVMClient) require.NoError(r, err) } @@ -66,14 +66,14 @@ func (r *E2ERunner) SetupEVM(contractsDeployed bool, whitelistERC20 bool) { zetaEthAddr, txZetaEth, ZetaEth, err := zetaeth.DeployZetaEth( r.EVMAuth, r.EVMClient, - r.DeployerAddress, + r.EVMAddress(), big.NewInt(21_000_000_000), ) require.NoError(r, err) r.ZetaEth = ZetaEth r.ZetaEthAddr = zetaEthAddr - conf.Contracts.EVM.ZetaEthAddress = zetaEthAddr.String() + conf.Contracts.EVM.ZetaEthAddr = config.DoubleQuotedString(zetaEthAddr.String()) r.Logger.Info("ZetaEth contract address: %s, tx hash: %s", zetaEthAddr.Hex(), zetaEthAddr.Hash().Hex()) r.Logger.Info("Deploying ZetaConnectorEth contract") @@ -82,14 +82,14 @@ func (r *E2ERunner) SetupEVM(contractsDeployed bool, whitelistERC20 bool) { r.EVMClient, zetaEthAddr, r.TSSAddress, - r.DeployerAddress, - r.DeployerAddress, + r.EVMAddress(), + r.EVMAddress(), ) require.NoError(r, err) r.ConnectorEth = ConnectorEth r.ConnectorEthAddr = connectorEthAddr - conf.Contracts.EVM.ConnectorEthAddr = connectorEthAddr.String() + conf.Contracts.EVM.ConnectorEthAddr = config.DoubleQuotedString(connectorEthAddr.String()) r.Logger.Info( "ZetaConnectorEth contract address: %s, tx hash: %s", @@ -101,8 +101,8 @@ func (r *E2ERunner) SetupEVM(contractsDeployed bool, whitelistERC20 bool) { erc20CustodyAddr, txCustody, ERC20Custody, err := erc20custody.DeployERC20Custody( r.EVMAuth, r.EVMClient, - r.DeployerAddress, - r.DeployerAddress, + r.EVMAddress(), + r.EVMAddress(), big.NewInt(0), big.NewInt(1e18), ethcommon.HexToAddress("0x"), diff --git a/e2e/runner/zeta.go b/e2e/runner/zeta.go index 726f3f5cb6..732104afe1 100644 --- a/e2e/runner/zeta.go +++ b/e2e/runner/zeta.go @@ -66,7 +66,7 @@ func (r *E2ERunner) DepositZeta() ethcommon.Hash { amount := big.NewInt(1e18) amount = amount.Mul(amount, big.NewInt(100)) // 100 Zeta - return r.DepositZetaWithAmount(r.DeployerAddress, amount) + return r.DepositZetaWithAmount(r.EVMAddress(), amount) } // DepositZetaWithAmount deposits ZETA on ZetaChain from the ZETA smart contract on EVM with the specified amount @@ -149,7 +149,7 @@ func (r *E2ERunner) WithdrawZeta(amount *big.Int, waitReceipt bool) *ethtypes.Tr tx, err := r.ConnectorZEVM.Send(r.ZEVMAuth, connectorzevm.ZetaInterfacesSendInput{ DestinationChainId: chainID, - DestinationAddress: r.DeployerAddress.Bytes(), + DestinationAddress: r.EVMAddress().Bytes(), DestinationGasLimit: big.NewInt(400_000), Message: nil, ZetaValueAndGas: amount, @@ -182,7 +182,7 @@ func (r *E2ERunner) WithdrawZeta(amount *big.Int, waitReceipt bool) *ethtypes.Tr // WithdrawEther withdraws Ether from ZetaChain to the ZETA smart contract on EVM func (r *E2ERunner) WithdrawEther(amount *big.Int) *ethtypes.Transaction { // withdraw - tx, err := r.ETHZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), amount) + tx, err := r.ETHZRC20.Withdraw(r.ZEVMAuth, r.EVMAddress().Bytes(), amount) require.NoError(r, err) r.Logger.EVMTransaction(*tx, "withdraw") @@ -198,7 +198,7 @@ func (r *E2ERunner) WithdrawEther(amount *big.Int) *ethtypes.Transaction { // WithdrawERC20 withdraws an ERC20 token from ZetaChain to the ZETA smart contract on EVM func (r *E2ERunner) WithdrawERC20(amount *big.Int) *ethtypes.Transaction { - tx, err := r.ERC20ZRC20.Withdraw(r.ZEVMAuth, r.DeployerAddress.Bytes(), amount) + tx, err := r.ERC20ZRC20.Withdraw(r.ZEVMAuth, r.EVMAddress().Bytes(), amount) require.NoError(r, err) r.Logger.EVMTransaction(*tx, "withdraw") From ef8470cf66b10ca09a2a14570c986e8069295012 Mon Sep 17 00:00:00 2001 From: Charlie <31941002+CharlieMc0@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:08:15 -0500 Subject: [PATCH 6/9] ci: enable artifact attenstations (#2388) * updated * Testing * Testing * Testing * Testing * Testing * Testing * Testing * Testing * Testing * Testing * Testing * enable all binaries * enable all binaries * Testing * Testing * Testing * Testing * Testing * enable all binaries * cleanup from testing * cleanup from testing * test default token * test default token * changed back to default token * updated changelog --------- Co-authored-by: Grant Zukel Co-authored-by: Alex Gartner --- .github/workflows/docker-build-and-push.yml | 4 ++-- .github/workflows/publish-release.yml | 24 +++++++++++++++++++-- .goreleaser.yaml | 1 - changelog.md | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 95ca015953..c2def3200d 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -30,7 +30,7 @@ jobs: fetch-depth: 0 - name: Set Version from the release title. - if: github.event_name != 'workflow_dispatch' + if: github.event_name == 'workflow_dispatch' run: | echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.release.name }}" >> $GITHUB_ENV @@ -62,7 +62,7 @@ jobs: fetch-depth: 0 - name: Set Version from the release title. - if: github.event_name != 'workflow_dispatch' + if: github.event_name == 'workflow_dispatch' run: | echo "GITHUB_TAG_MAJOR_VERSION=${{ github.event.release.name }}" >> $GITHUB_ENV diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 7eded17252..97dc97aa9a 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -425,6 +425,10 @@ jobs: echo "continue" publish-release: + permissions: + id-token: write + contents: write + attestations: write if: ${{ github.event.inputs.skip_release == 'false' }} needs: - gosec @@ -495,18 +499,34 @@ jobs: uses: softprops/action-gh-release@v1 with: prerelease: true - token: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }} + token: ${{ secrets.GITHUB_TOKEN }} body_path: ${{ github.workspace }}-CHANGELOG.txt tag_name: ${{ env.GITHUB_TAG_MAJOR_VERSION }} - name: Publish Release Files env: - GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_SERVICE_ACCT }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_CURRENT_TAG: ${{ env.GITHUB_TAG_MAJOR_VERSION }} run: | touch .release-env make release + - name: Artifact Attestations + id: attestation + uses: actions/attest-build-provenance@v1 + with: + subject-path: | + dist/zetacored_**/* + dist/zetaclientd_**/* + dist/checksums.txt + + - name: Upload Attestation Bundle + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + gh release upload ${{ env.GITHUB_TAG_MAJOR_VERSION }} ${{ steps.attestation.outputs.bundle-path }} + - name: Clean Up Workspace if: always() shell: bash diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 16541f2291..7291e57a08 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -6,7 +6,6 @@ # - Add SBOMs # - Add Docker Builds # - SLSA - https://github.com/goreleaser/goreleaser-example-slsa-provenance -# - Add Code Signing env: - CGO_ENABLED=1 diff --git a/changelog.md b/changelog.md index 1a7d568bd3..a16cd90d2d 100644 --- a/changelog.md +++ b/changelog.md @@ -88,7 +88,7 @@ * [2382](https://github.com/zeta-chain/node/pull/2382) - add tx input and gas in rpc methods for synthetic eth txs ### CI - +* [2388](https://github.com/zeta-chain/node/pull/2388) - added GitHub attestations of binaries produced in the release workflow. * [2285](https://github.com/zeta-chain/node/pull/2285) - added nightly EVM performance testing pipeline, modified localnet testing docker image to utilitze debian:bookworm, removed build-jet runners where applicable, removed deprecated/removed upgrade path testing pipeline * [2268](https://github.com/zeta-chain/node/pull/2268) - updated the publish-release pipeline to utilize the Github Actions Ubuntu 20.04 Runners * [2070](https://github.com/zeta-chain/node/pull/2070) - Added commands to build binaries from the working branch as a live full node rpc to test non-governance changes From 0660e73614aec34f15515a378557b046c6b07346 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 10:13:41 +0200 Subject: [PATCH 7/9] chore(deps): bump github.com/hashicorp/go-getter from 1.7.4 to 1.7.5 (#2392) Bumps [github.com/hashicorp/go-getter](https://github.com/hashicorp/go-getter) from 1.7.4 to 1.7.5. - [Release notes](https://github.com/hashicorp/go-getter/releases) - [Changelog](https://github.com/hashicorp/go-getter/blob/main/.goreleaser.yml) - [Commits](https://github.com/hashicorp/go-getter/compare/v1.7.4...v1.7.5) --- updated-dependencies: - dependency-name: github.com/hashicorp/go-getter dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Gartner --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 60a7598f16..43584e6b4e 100644 --- a/go.mod +++ b/go.mod @@ -215,7 +215,7 @@ require ( github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.4 + github.com/hashicorp/go-getter v1.7.5 github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect diff --git a/go.sum b/go.sum index a5bbf02ee3..ad13862826 100644 --- a/go.sum +++ b/go.sum @@ -921,8 +921,8 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.4 h1:3yQjWuxICvSpYwqSayAdKRFcvBl1y/vogCxczWSmix0= -github.com/hashicorp/go-getter v1.7.4/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.5 h1:dT58k9hQ/vbxNMwoI5+xFYAJuv6152UNvdHokfI5wE4= +github.com/hashicorp/go-getter v1.7.5/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= From 86298f28d8a4e6ea00f316840f409bcd4186dafa Mon Sep 17 00:00:00 2001 From: Alex Gartner Date: Fri, 28 Jun 2024 09:09:49 -0700 Subject: [PATCH 8/9] chore: update PR template (#2394) * chore: update PR template * remove checklist --- .github/pull_request_template.md | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 09a533c5d6..7abe7810e0 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,26 +1,13 @@ # Description -Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. - -Closes: - -## Type of change - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) -- [ ] This change requires a documentation update + # How Has This Been Tested? -Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce. + - [ ] Tested CCTX in localnet - [ ] Tested in development environment - [ ] Go unit tests - [ ] Go integration tests -- [ ] Tested via GitHub Actions - -# Checklist: - -- [ ] I have added unit tests that prove my fix feature works +- [ ] Tested via GitHub Actions From 0bcb422e614c3e1b2c565de83017c93538ff668c Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Mon, 1 Jul 2024 19:11:00 +0200 Subject: [PATCH 9/9] chore: add fbac as codeowner (#2410) Signed-off-by: Francisco de Borja Aranda Castillejo Co-authored-by: Francisco de Borja Aranda Castillejo --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 65567bd2ab..084809afa5 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,3 @@ -* @brewmaster012 @kingpinXD @lumtis @ws4charlie @skosito @swift1337 +* @brewmaster012 @kingpinXD @lumtis @ws4charlie @skosito @swift1337 @fbac .github/** @zeta-chain/devops