From cd1518497ca0af0fa7a9535df1c979a00b98e1cf Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Thu, 14 Sep 2023 08:21:34 +0200 Subject: [PATCH 1/7] refactor(`fungible`): improve `UpdateZRC20WithdrawFee` (#1112) * fix message * simplify protocal flat fee query * intiialize successful test * error cases * other failing test * complete tests * goimport * remove uppercase * fix comment * commit position --- x/fungible/keeper/evm.go | 38 +++++ .../msg_server_update_zrc20_withdraw_fee.go | 73 ++++---- ...g_server_update_zrc20_withdraw_fee_test.go | 159 ++++++++++++++++++ .../message_update_zrc20_withdraw_fee.go | 2 +- 4 files changed, 233 insertions(+), 39 deletions(-) create mode 100644 x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index 731b57cad6..9911c81adf 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -3,6 +3,7 @@ package keeper import ( "encoding/hex" "encoding/json" + "errors" "fmt" "math/big" "strconv" @@ -226,6 +227,43 @@ func (k Keeper) DepositZRC20AndCallContract(ctx sdk.Context, "depositAndCall", context, zrc20Addr, amount, targetContract, message) } +// QueryProtocolFlatFee returns the protocol flat fee associated with a given zrc20 +func (k Keeper) QueryProtocolFlatFee(ctx sdk.Context, contract common.Address) (*big.Int, error) { + zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi() + if err != nil { + return nil, err + } + res, err := k.CallEVM( + ctx, + *zrc20ABI, + types.ModuleAddressEVM, + contract, + BigIntZero, + nil, + false, + false, + "PROTOCOL_FLAT_FEE", + ) + if err != nil { + return nil, err + } + + unpacked, err := zrc20ABI.Unpack("PROTOCOL_FLAT_FEE", res.Ret) + if err != nil { + return nil, err + } + if len(unpacked) == 0 { + return nil, fmt.Errorf("expect 1 returned values, got %d", len(unpacked)) + } + + protocolGasFee, ok := unpacked[0].(*big.Int) + if !ok { + return nil, errors.New("can't read returned value as big.Int") + } + + return protocolGasFee, nil +} + // QueryZRC20Data returns the data of a deployed ZRC20 contract func (k Keeper) QueryZRC20Data( ctx sdk.Context, diff --git a/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go index dc6d18864a..56e75381e6 100644 --- a/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go +++ b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee.go @@ -2,7 +2,8 @@ package keeper import ( "context" - "math/big" + + cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -14,55 +15,50 @@ import ( func (k Keeper) UpdateZRC20WithdrawFee(goCtx context.Context, msg *types.MsgUpdateZRC20WithdrawFee) (*types.MsgUpdateZRC20WithdrawFeeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + + // check signer permission if msg.Creator != k.observerKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_deploy_fungible_coin) { - return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account") + return nil, cosmoserrors.Wrap(sdkerrors.ErrUnauthorized, "deploy can only be executed by the correct policy account") } + + // check the zrc20 exists zrc20Addr := ethcommon.HexToAddress(msg.Zrc20Address) if zrc20Addr == (ethcommon.Address{}) { - return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", msg.Zrc20Address) - } - - // update contracts - zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi() - if err != nil { - return nil, sdkerrors.Wrapf(types.ErrABIGet, "failed to get zrc20 abi") - } - - foreignCoins := k.GetAllForeignCoins(ctx) - found := false - var coin types.ForeignCoins - for _, fcoin := range foreignCoins { - coinZRC20Addr := ethcommon.HexToAddress(fcoin.Zrc20ContractAddress) - if coinZRC20Addr == (ethcommon.Address{}) { - k.Logger(ctx).Error("invalid zrc20 contract address", "address", fcoin.Zrc20ContractAddress) - continue - } - if coinZRC20Addr == zrc20Addr { - coin = fcoin - found = true - break - } + return nil, cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid zrc20 contract address (%s)", msg.Zrc20Address) } - + coin, found := k.GetForeignCoins(ctx, msg.Zrc20Address) if !found { - return nil, sdkerrors.Wrapf(types.ErrInvalidAddress, "no foreign coin match requested zrc20 address (%s)", msg.Zrc20Address) + return nil, cosmoserrors.Wrapf(types.ErrForeignCoinNotFound, "no foreign coin match requested zrc20 address (%s)", msg.Zrc20Address) } - res, err := k.CallEVM(ctx, *zrc20ABI, types.ModuleAddressEVM, zrc20Addr, BigIntZero, nil, false, false, "PROTOCOL_FLAT_FEE") + // get the previous fee + oldWithdrawFee, err := k.QueryProtocolFlatFee(ctx, zrc20Addr) if err != nil { - return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract PROTOCOL_FLAT_FEE method (%s)", err.Error()) - } - unpacked, err := zrc20ABI.Unpack("PROTOCOL_FLAT_FEE", res.Ret) - if err != nil || len(unpacked) == 0 { - return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to unpack zrc20 contract PROTOCOL_FLAT_FEE method (%s)", err.Error()) + return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to query protocol flat fee (%s)", err.Error()) } - oldWithdrawFee, ok := unpacked[0].(*big.Int) - if !ok { - return nil, sdkerrors.Wrapf(types.ErrContractCall, "failed to interpret the returned unpacked zrc20 contract PROTOCOL_FLAT_FEE method; ret %x", res.Ret) + + zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi() + if err != nil { + return nil, cosmoserrors.Wrapf(types.ErrABIGet, "failed to get zrc20 abi") } + // call the contract method to update the fee tmpCtx, commit := ctx.CacheContext() - _, err = k.CallEVM(tmpCtx, *zrc20ABI, types.ModuleAddressEVM, zrc20Addr, BigIntZero, nil, true, false, "updateProtocolFlatFee", msg.NewWithdrawFee.BigInt()) + _, err = k.CallEVM( + tmpCtx, + *zrc20ABI, + types.ModuleAddressEVM, + zrc20Addr, + BigIntZero, + nil, + true, + false, + "updateProtocolFlatFee", + msg.NewWithdrawFee.BigInt(), + ) + if err != nil { + return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract updateProtocolFlatFee method (%s)", err.Error()) + } err = ctx.EventManager().EmitTypedEvent( &types.EventZRC20WithdrawFeeUpdated{ @@ -77,8 +73,9 @@ func (k Keeper) UpdateZRC20WithdrawFee(goCtx context.Context, msg *types.MsgUpda ) if err != nil { k.Logger(ctx).Error("failed to emit event", "error", err.Error()) - return nil, sdkerrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error()) + return nil, cosmoserrors.Wrapf(types.ErrEmitEvent, "failed to emit event (%s)", err.Error()) } commit() + return &types.MsgUpdateZRC20WithdrawFeeResponse{}, nil } diff --git a/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go new file mode 100644 index 0000000000..28a967b248 --- /dev/null +++ b/x/fungible/keeper/msg_server_update_zrc20_withdraw_fee_test.go @@ -0,0 +1,159 @@ +package keeper_test + +import ( + "errors" + "math/big" + "testing" + + "cosmossdk.io/math" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/fungible/types" +) + +func TestKeeper_UpdateZRC20WithdrawFee(t *testing.T) { + t.Run("can update the withdraw fee", func(t *testing.T) { + k, ctx, sdkk, zk := keepertest.FungibleKeeper(t) + chainID := getValidChainID(t) + k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + + // set coin admin + admin := sample.AccAddress() + setAdminDeployFungibleCoin(ctx, zk, admin) + + // deploy the system contract and a ZRC20 contract + deploySystemContracts(t, ctx, k, sdkk.EvmKeeper) + zrc20Addr := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chainID, "alpha", "alpha") + + // initial protocol fee is zero + fee, err := k.QueryProtocolFlatFee(ctx, zrc20Addr) + require.NoError(t, err) + require.Zero(t, fee.Uint64()) + + // can update the fee + _, err = k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee( + admin, + zrc20Addr.String(), + math.NewUint(42), + )) + require.NoError(t, err) + + // can query the updated fee + fee, err = k.QueryProtocolFlatFee(ctx, zrc20Addr) + require.NoError(t, err) + require.Equal(t, uint64(42), fee.Uint64()) + }) + + t.Run("should fail if not authorized", func(t *testing.T) { + k, ctx, _, _ := keepertest.FungibleKeeper(t) + + _, err := k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee( + sample.AccAddress(), + sample.EthAddress().String(), + math.NewUint(42)), + ) + require.ErrorIs(t, err, sdkerrors.ErrUnauthorized) + }) + + t.Run("should fail if invalid zrc20 address", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeper(t) + admin := sample.AccAddress() + setAdminDeployFungibleCoin(ctx, zk, admin) + + _, err := k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee( + admin, + "invalid_address", + math.NewUint(42)), + ) + require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress) + }) + + t.Run("should fail if can't retrieve the foreign coin", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeper(t) + admin := sample.AccAddress() + setAdminDeployFungibleCoin(ctx, zk, admin) + + _, err := k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee( + admin, + sample.EthAddress().String(), + math.NewUint(42)), + ) + require.ErrorIs(t, err, types.ErrForeignCoinNotFound) + }) + + t.Run("should fail if can't query old fee", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeper(t) + k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + + // setup + admin := sample.AccAddress() + setAdminDeployFungibleCoin(ctx, zk, admin) + zrc20 := sample.EthAddress() + k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20.String())) + + // the method shall fail since we only set the foreign coin manually in the store but didn't deploy the contract + _, err := k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee( + admin, + zrc20.String(), + math.NewUint(42)), + ) + require.ErrorIs(t, err, types.ErrContractCall) + }) + + t.Run("should fail if contract call for setting new fee fails", func(t *testing.T) { + k, ctx, _, zk := keepertest.FungibleKeeperWithMocks(t, keepertest.FungibleMockOptions{UseEVMMock: true}) + k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) + mockEVMKeeper := keepertest.GetFungibleEVMMock(t, k) + + // setup + admin := sample.AccAddress() + setAdminDeployFungibleCoin(ctx, zk, admin) + zrc20Addr := sample.EthAddress() + k.SetForeignCoins(ctx, sample.ForeignCoins(t, zrc20Addr.String())) + + // evm mocks + mockEVMKeeper.On("EstimateGas", mock.Anything, mock.Anything).Maybe().Return( + &evmtypes.EstimateGasResponse{Gas: 1000}, + nil, + ) + mockEVMKeeper.On("WithChainID", mock.Anything).Maybe().Return(ctx) + mockEVMKeeper.On("ChainID").Maybe().Return(big.NewInt(1)) + + // this is the query (commit == false) + zrc20ABI, err := zrc20.ZRC20MetaData.GetAbi() + require.NoError(t, err) + protocolFlatFee, err := zrc20ABI.Methods["PROTOCOL_FLAT_FEE"].Outputs.Pack(big.NewInt(42)) + require.NoError(t, err) + mockEVMKeeper.On( + "ApplyMessage", + mock.Anything, + mock.Anything, + mock.Anything, + false, + ).Return(&evmtypes.MsgEthereumTxResponse{Ret: protocolFlatFee}, nil) + + // this is the update call (commit == true) + mockEVMKeeper.On( + "ApplyMessage", + mock.Anything, + mock.Anything, + mock.Anything, + true, + ).Return(&evmtypes.MsgEthereumTxResponse{}, errors.New("transaction failed")) + + _, err = k.UpdateZRC20WithdrawFee(ctx, types.NewMsgUpdateZRC20WithdrawFee( + admin, + zrc20Addr.String(), + math.NewUint(42)), + ) + require.ErrorIs(t, err, types.ErrContractCall) + + mockEVMKeeper.AssertExpectations(t) + }) +} diff --git a/x/fungible/types/message_update_zrc20_withdraw_fee.go b/x/fungible/types/message_update_zrc20_withdraw_fee.go index ba1c61183f..1b1d6de1ec 100644 --- a/x/fungible/types/message_update_zrc20_withdraw_fee.go +++ b/x/fungible/types/message_update_zrc20_withdraw_fee.go @@ -45,7 +45,7 @@ func (msg *MsgUpdateZRC20WithdrawFee) ValidateBasic() error { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } // check if the system contract address is valid - if ethcommon.HexToAddress(msg.Zrc20Address) == (ethcommon.Address{}) { + if !ethcommon.IsHexAddress(msg.Zrc20Address) { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid system contract address (%s)", msg.Zrc20Address) } if msg.NewWithdrawFee.IsNil() { From ad65753043589edb6c4783b108b3b0cb34c53d98 Mon Sep 17 00:00:00 2001 From: Charlie <31941002+CharlieMc0@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:31:00 -0400 Subject: [PATCH 2/7] ci: update linter to go 1.20 (#1129) * Updated to Go 1.20 * cosmos gosec and labeler * Fixing token * disabled G702 --- .github/labeler.yml | 3 ++ .github/workflows/sast-linters.yml | 52 ++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index aebf63e968..293796511c 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -4,3 +4,6 @@ breaking:proto: breaking:cli: - "x/*/client/cli/*.go" - "cmd/**/*.go" + +ci: + - ".github/**" diff --git a/.github/workflows/sast-linters.yml b/.github/workflows/sast-linters.yml index 8b86ea3c6c..79efac1562 100644 --- a/.github/workflows/sast-linters.yml +++ b/.github/workflows/sast-linters.yml @@ -33,10 +33,33 @@ jobs: # uses: ./.github/actions/install-dependencies - name: Run Gosec Security Scanner - run: | - export PATH=$PATH:$(go env GOPATH)/bin - go install github.com/securego/gosec/v2/cmd/gosec@latest - gosec ./... + uses: securego/gosec@master + with: + args: ./... + + gosec-cosmos: + runs-on: ubuntu-latest + env: + GO111MODULE: on + steps: + - name: Checkout Source + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.20' + + # - name: Install Pipeline Dependencies + # uses: ./.github/actions/install-dependencies + + - name: Run Cosmos Gosec Security Scanner + uses: cosmos/gosec@master + with: + args: './... -include=G701,G703,G704' # Disabled G702 as it doesn't seem to be relevant 2023-09-14 + git-guardian: runs-on: ubuntu-latest @@ -68,18 +91,18 @@ jobs: with: fetch-depth: 0 - - name: Install Pipeline Dependencies - uses: ./.github/actions/install-dependencies + # - name: Install Pipeline Dependencies + # uses: ./.github/actions/install-dependencies - name: Set up Go uses: actions/setup-go@v3 with: - go-version: '1.19' + go-version: '1.20' - name: Run golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.50 + version: v1.54 skip-cache: true args: --timeout=15m @@ -137,8 +160,11 @@ jobs: Be very careful about using `#nosec` in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way. + Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203 + Broad `#nosec` annotations should be avoided, as they can hide other vulnerabilities. **The CI will block you from merging this PR until you remove `#nosec` annotations that do not target specific rules**. + Pay extra attention to the way `#nosec` is being used in the files listed above. - + - name: Add Label uses: actions/github-script@v6 if: env.nosec_detected == 1 @@ -150,3 +176,11 @@ jobs: repo: context.repo.repo, labels: ["nosec"] }) + + - name: Check for '#nosec' without a specific rule + run: | + DIFF=$(git diff ${{ github.event.pull_request.base.sha }}) + echo "$DIFF" | grep -P '#nosec(?!(\sG\d{3}))(?![^\s\t])([\s\t]*|$)' && echo "nosec without specified rule found!" && exit 1 || exit 0 + + + \ No newline at end of file From e5bd24ee656b6b740c760436aa8920ab11edc10f Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Fri, 15 Sep 2023 18:04:12 +0200 Subject: [PATCH 3/7] refactor(`crosschain`): rename `ZetaMinted` into `ValueReceived` in `MsgVoteOnObservedOutboundTx` (#1130) * update proto * remaining renaming --- docs/spec/crosschain/messages.md | 2 +- proto/crosschain/events.proto | 4 +- proto/crosschain/tx.proto | 4 +- x/crosschain/client/cli/cli_cctx.go | 2 +- .../client/integrationtests/cli_helpers.go | 11 +- .../integrationtests/outbound_voter_test.go | 18 +- x/crosschain/keeper/events.go | 20 +- .../keeper_cross_chain_tx_vote_outbound_tx.go | 8 +- x/crosschain/types/events.pb.go | 130 ++++++------- .../message_vote_on_observed_outbound_tx.go | 4 +- ...ssage_vote_on_observed_outbound_tx_test.go | 12 +- x/crosschain/types/tx.pb.go | 180 +++++++++--------- 12 files changed, 197 insertions(+), 198 deletions(-) diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index 6ef9aed746..84917d6a33 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -135,7 +135,7 @@ message MsgVoteOnObservedOutboundTx { uint64 observed_outTx_gas_used = 10; string observed_outTx_effective_gas_price = 11; uint64 observed_outTx_effective_gas_limit = 12; - string zeta_minted = 5; + string value_received = 5; common.ReceiveStatus status = 6; int64 outTx_chain = 7; uint64 outTx_tss_nonce = 8; diff --git a/proto/crosschain/events.proto b/proto/crosschain/events.proto index cc022fb368..90fff428fb 100644 --- a/proto/crosschain/events.proto +++ b/proto/crosschain/events.proto @@ -48,7 +48,7 @@ message EventOutboundFailure { string cctx_index = 2; string old_status = 3; string new_status = 4; - string zeta_minted = 5; + string value_received = 5; } message EventOutboundSuccess { @@ -56,5 +56,5 @@ message EventOutboundSuccess { string cctx_index = 2; string old_status = 3; string new_status = 4; - string zeta_minted = 5; + string value_received = 5; } diff --git a/proto/crosschain/tx.proto b/proto/crosschain/tx.proto index da2a21beb6..eb878b0523 100644 --- a/proto/crosschain/tx.proto +++ b/proto/crosschain/tx.proto @@ -92,10 +92,10 @@ message MsgVoteOnObservedOutboundTx { (gogoproto.nullable) = false ]; uint64 observed_outTx_effective_gas_limit = 12; - string zeta_minted = 5 [ + string value_received = 5 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"zeta_minted\"" + (gogoproto.moretags) = "yaml:\"value_received\"" ]; common.ReceiveStatus status = 6; int64 outTx_chain = 7; diff --git a/x/crosschain/client/cli/cli_cctx.go b/x/crosschain/client/cli/cli_cctx.go index 11e4e814a5..1a701c8416 100644 --- a/x/crosschain/client/cli/cli_cctx.go +++ b/x/crosschain/client/cli/cli_cctx.go @@ -141,7 +141,7 @@ func CmdCCTXInboundVoter() *cobra.Command { func CmdCCTXOutboundVoter() *cobra.Command { cmd := &cobra.Command{ - Use: "outbound-voter [sendHash] [outTxHash] [outBlockHeight] [outGasUsed] [outEffectiveGasPrice] [outEffectiveGasLimit] [ZetaMinted] [Status] [chain] [outTXNonce] [coinType]", + Use: "outbound-voter [sendHash] [outTxHash] [outBlockHeight] [outGasUsed] [outEffectiveGasPrice] [outEffectiveGasLimit] [valueReceived] [Status] [chain] [outTXNonce] [coinType]", Short: "Broadcast message receiveConfirmation", Args: cobra.ExactArgs(11), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/x/crosschain/client/integrationtests/cli_helpers.go b/x/crosschain/client/integrationtests/cli_helpers.go index 16922f18da..0cad26f293 100644 --- a/x/crosschain/client/integrationtests/cli_helpers.go +++ b/x/crosschain/client/integrationtests/cli_helpers.go @@ -128,7 +128,8 @@ func BuildSignedTssVote(t testing.TB, val *network.Validator, denom string, acco return WriteToNewTempFile(t, res.String()) } -func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI, cctxIndex, outTxHash, zetaminted, status string) *os.File { +func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI, + cctxIndex, outTxHash, valueReceived, status string) *os.File { cmd := cli.CmdCCTXOutboundVoter() outboundVoterArgs := []string{ cctxIndex, @@ -137,7 +138,7 @@ func BuildSignedOutboundVote(t testing.TB, val *network.Validator, denom string, "0", "0", "0", - zetaminted, + valueReceived, status, strconv.FormatInt(common.GoerliChain().ChainId, 10), "1", @@ -210,9 +211,7 @@ func GetBallotIdentifier(message string) string { return msg.Digest() } -func GetBallotIdentifierOutBound(cctxindex, outtxHash, zetaminted string) string { - math.NewUintFromString(zetaminted) - +func GetBallotIdentifierOutBound(cctxindex, outtxHash, valueReceived string) string { msg := types.NewMsgVoteOnObservedOutboundTx( "", cctxindex, @@ -221,7 +220,7 @@ func GetBallotIdentifierOutBound(cctxindex, outtxHash, zetaminted string) string 0, math.ZeroInt(), 0, - math.NewUintFromString(zetaminted), + math.NewUintFromString(valueReceived), 0, common.GoerliChain().ChainId, 1, diff --git a/x/crosschain/client/integrationtests/outbound_voter_test.go b/x/crosschain/client/integrationtests/outbound_voter_test.go index dee7ea514e..54c7c83605 100644 --- a/x/crosschain/client/integrationtests/outbound_voter_test.go +++ b/x/crosschain/client/integrationtests/outbound_voter_test.go @@ -22,7 +22,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { tt := []struct { name string votes []Vote - zetaMinted string // TODO : calculate this value + valueReceived string // TODO : calculate this value correctBallotResult observerTypes.BallotStatus cctxStatus crosschaintypes.CctxStatus falseBallotIdentifier string @@ -43,7 +43,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { }, correctBallotResult: observerTypes.BallotStatus_BallotFinalized_SuccessObservation, cctxStatus: crosschaintypes.CctxStatus_OutboundMined, - zetaMinted: "7991636132140714751", + valueReceived: "7991636132140714751", }, { name: "1 fake vote but ballot still success", @@ -61,7 +61,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { }, correctBallotResult: observerTypes.BallotStatus_BallotFinalized_SuccessObservation, cctxStatus: crosschaintypes.CctxStatus_OutboundMined, - zetaMinted: "7990439496224753106", + valueReceived: "7990439496224753106", }, { name: "Half success and half false", @@ -79,7 +79,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { }, correctBallotResult: observerTypes.BallotStatus_BallotInProgress, cctxStatus: crosschaintypes.CctxStatus_PendingOutbound, - zetaMinted: "7993442360774956232", + valueReceived: "7993442360774956232", }, { name: "Fake ballot has more votes outbound gets finalized", @@ -97,7 +97,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { }, correctBallotResult: observerTypes.BallotStatus_BallotInProgress, cctxStatus: crosschaintypes.CctxStatus_OutboundMined, - zetaMinted: "7987124742653889020", + valueReceived: "7987124742653889020", }, { name: "5 success 5 Failed votes ", @@ -115,7 +115,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { }, correctBallotResult: observerTypes.BallotStatus_BallotInProgress, cctxStatus: crosschaintypes.CctxStatus_PendingOutbound, - zetaMinted: "7991636132140714751", + valueReceived: "7991636132140714751", }, } for _, test := range tt { @@ -184,7 +184,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { votestring = "1" } - signedTx := BuildSignedOutboundVote(s.T(), val, s.cfg.BondDenom, account, cctxIdentifier, outTxhash, test.zetaMinted, votestring) + signedTx := BuildSignedOutboundVote(s.T(), val, s.cfg.BondDenom, account, cctxIdentifier, outTxhash, test.valueReceived, votestring) out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, authcli.GetBroadcastCommand(), []string{signedTx.Name(), "--broadcast-mode", "sync"}) s.Require().NoError(err) } @@ -193,7 +193,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { cctx = crosschaintypes.QueryGetCctxResponse{} s.NoError(broadcaster.ClientCtx.Codec.UnmarshalJSON(out.Bytes(), &cctx)) s.Assert().Equal(test.cctxStatus, cctx.CrossChainTx.CctxStatus.Status) - outboundBallotIdentifier := GetBallotIdentifierOutBound(cctxIdentifier, test.name, test.zetaMinted) + outboundBallotIdentifier := GetBallotIdentifierOutBound(cctxIdentifier, test.name, test.valueReceived) out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{outboundBallotIdentifier, "--output", "json"}) s.Require().NoError(err) ballot := observerTypes.QueryBallotByIdentifierResponse{} @@ -213,7 +213,7 @@ func (s *IntegrationTestSuite) TestCCTXOutBoundVoter() { } } if len(fakeVotes) > 0 { - outboundFakeBallotIdentifier := GetBallotIdentifierOutBound(cctxIdentifier, test.name+"falseVote", test.zetaMinted) + outboundFakeBallotIdentifier := GetBallotIdentifierOutBound(cctxIdentifier, test.name+"falseVote", test.valueReceived) out, err = clitestutil.ExecTestCLICmd(broadcaster.ClientCtx, observerCli.CmdBallotByIdentifier(), []string{outboundFakeBallotIdentifier, "--output", "json"}) s.Require().NoError(err) fakeBallot := observerTypes.QueryBallotByIdentifierResponse{} diff --git a/x/crosschain/keeper/events.go b/x/crosschain/keeper/events.go index 3306b7d1f8..2f6a88908c 100644 --- a/x/crosschain/keeper/events.go +++ b/x/crosschain/keeper/events.go @@ -61,11 +61,11 @@ func EmitZetaWithdrawCreated(ctx sdk.Context, cctx types.CrossChainTx) { func EmitOutboundSuccess(ctx sdk.Context, msg *types.MsgVoteOnObservedOutboundTx, oldStatus string, newStatus string, cctx types.CrossChainTx) { err := ctx.EventManager().EmitTypedEvents(&types.EventOutboundSuccess{ - MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}), - CctxIndex: cctx.Index, - ZetaMinted: msg.ZetaMinted.String(), - OldStatus: oldStatus, - NewStatus: newStatus, + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}), + CctxIndex: cctx.Index, + ValueReceived: msg.ValueReceived.String(), + OldStatus: oldStatus, + NewStatus: newStatus, }) if err != nil { ctx.Logger().Error("Error emitting MsgVoteOnObservedOutboundTx :", err) @@ -75,11 +75,11 @@ func EmitOutboundSuccess(ctx sdk.Context, msg *types.MsgVoteOnObservedOutboundTx func EmitOutboundFailure(ctx sdk.Context, msg *types.MsgVoteOnObservedOutboundTx, oldStatus string, newStatus string, cctx types.CrossChainTx) { err := ctx.EventManager().EmitTypedEvents(&types.EventOutboundFailure{ - MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}), - CctxIndex: cctx.Index, - ZetaMinted: msg.ZetaMinted.String(), - OldStatus: oldStatus, - NewStatus: newStatus, + MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedOutboundTx{}), + CctxIndex: cctx.Index, + ValueReceived: msg.ValueReceived.String(), + OldStatus: oldStatus, + NewStatus: newStatus, }) if err != nil { ctx.Logger().Error("Error emitting MsgVoteOnObservedOutboundTx :", err) diff --git a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go b/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go index 42d01988dd..a72bc84a07 100644 --- a/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go +++ b/x/crosschain/keeper/keeper_cross_chain_tx_vote_outbound_tx.go @@ -109,11 +109,11 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms return &types.MsgVoteOnObservedOutboundTxResponse{}, nil } if ballot.BallotStatus != observerTypes.BallotStatus_BallotFinalized_FailureObservation { - if !msg.ZetaMinted.Equal(cctx.GetCurrentOutTxParam().Amount) { - log.Error().Msgf("VoteOnObservedOutboundTx: Mint mismatch: %s zeta minted vs %s cctx amount", - msg.ZetaMinted, + if !msg.ValueReceived.Equal(cctx.GetCurrentOutTxParam().Amount) { + log.Error().Msgf("VoteOnObservedOutboundTx: Mint mismatch: %s value received vs %s cctx amount", + msg.ValueReceived, cctx.GetCurrentOutTxParam().Amount) - return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("ZetaMinted %s does not match send ZetaMint %s", msg.ZetaMinted, cctx.GetCurrentOutTxParam().Amount)) + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("ValueReceived %s does not match sent value %s", msg.ValueReceived, cctx.GetCurrentOutTxParam().Amount)) } } diff --git a/x/crosschain/types/events.pb.go b/x/crosschain/types/events.pb.go index 0c60abeaaa..3fbc7f3fa3 100644 --- a/x/crosschain/types/events.pb.go +++ b/x/crosschain/types/events.pb.go @@ -358,11 +358,11 @@ func (m *EventZetaWithdrawCreated) GetNewStatus() string { } type EventOutboundFailure struct { - MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` - CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"` - OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"` - NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"` - ZetaMinted string `protobuf:"bytes,5,opt,name=zeta_minted,json=zetaMinted,proto3" json:"zeta_minted,omitempty"` + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"` + OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"` + NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"` + ValueReceived string `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3" json:"value_received,omitempty"` } func (m *EventOutboundFailure) Reset() { *m = EventOutboundFailure{} } @@ -426,19 +426,19 @@ func (m *EventOutboundFailure) GetNewStatus() string { return "" } -func (m *EventOutboundFailure) GetZetaMinted() string { +func (m *EventOutboundFailure) GetValueReceived() string { if m != nil { - return m.ZetaMinted + return m.ValueReceived } return "" } type EventOutboundSuccess struct { - MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` - CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"` - OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"` - NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"` - ZetaMinted string `protobuf:"bytes,5,opt,name=zeta_minted,json=zetaMinted,proto3" json:"zeta_minted,omitempty"` + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + CctxIndex string `protobuf:"bytes,2,opt,name=cctx_index,json=cctxIndex,proto3" json:"cctx_index,omitempty"` + OldStatus string `protobuf:"bytes,3,opt,name=old_status,json=oldStatus,proto3" json:"old_status,omitempty"` + NewStatus string `protobuf:"bytes,4,opt,name=new_status,json=newStatus,proto3" json:"new_status,omitempty"` + ValueReceived string `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3" json:"value_received,omitempty"` } func (m *EventOutboundSuccess) Reset() { *m = EventOutboundSuccess{} } @@ -502,9 +502,9 @@ func (m *EventOutboundSuccess) GetNewStatus() string { return "" } -func (m *EventOutboundSuccess) GetZetaMinted() string { +func (m *EventOutboundSuccess) GetValueReceived() string { if m != nil { - return m.ZetaMinted + return m.ValueReceived } return "" } @@ -521,43 +521,43 @@ func init() { proto.RegisterFile("crosschain/events.proto", fileDescriptor_7398d var fileDescriptor_7398db8b12b87b9e = []byte{ // 586 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x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f, 0xd9, 0xcd, 0x6e, 0x8e, - 0xeb, 0xf8, 0xda, 0x26, 0xb7, 0xf7, 0xd3, 0xa3, 0x9e, 0xdb, 0xbf, 0xcf, 0xbf, 0x07, 0x00, 0x00, - 0xff, 0xff, 0xd2, 0x22, 0x77, 0xcb, 0xe4, 0x05, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xdd, 0x6a, 0xd4, 0x40, + 0x14, 0x6e, 0xda, 0xdd, 0xed, 0xee, 0xf4, 0x0f, 0x62, 0xb5, 0x63, 0xb1, 0xa1, 0x2e, 0xf8, 0x73, + 0xe3, 0x06, 0xf1, 0x0d, 0x5a, 0x94, 0x16, 0x91, 0x42, 0x5b, 0x11, 0x7a, 0x33, 0xcc, 0x26, 0x87, + 0x64, 0x30, 0x99, 0x59, 0x66, 0x26, 0xbb, 0xd9, 0x3e, 0x85, 0x2f, 0x22, 0xf8, 0x00, 0x3e, 0x80, + 0x97, 0xbd, 0xf0, 0xc2, 0x4b, 0xd9, 0x7d, 0x11, 0x99, 0x99, 0x44, 0xbb, 0xa9, 0xe8, 0x85, 0x28, + 0x78, 0x95, 0x73, 0xbe, 0x73, 0x72, 0xf2, 0xcd, 0xf7, 0x4d, 0x0e, 0xda, 0x89, 0xa4, 0x50, 0x2a, + 0x4a, 0x29, 0xe3, 0x21, 0x8c, 0x81, 0x6b, 0x35, 0x18, 0x49, 0xa1, 0x85, 0xbf, 0x77, 0x09, 0x9a, + 0x5a, 0x7c, 0x60, 0x23, 0x21, 0x61, 0xf0, 0xa3, 0x77, 0xf7, 0x56, 0x24, 0xf2, 0x5c, 0xf0, 0xd0, + 0x3d, 0xdc, 0x3b, 0xbb, 0xdb, 0x89, 0x48, 0x84, 0x0d, 0x43, 0x13, 0x39, 0xb4, 0xff, 0x79, 0x05, + 0xdd, 0x7e, 0x6e, 0x46, 0x1f, 0xf3, 0xa1, 0x28, 0x78, 0xfc, 0x82, 0x71, 0x9a, 0xb1, 0x4b, 0x88, + 0xfd, 0x7d, 0xb4, 0x9e, 0xab, 0x84, 0xe8, 0xe9, 0x08, 0x48, 0x21, 0x33, 0xec, 0xed, 0x7b, 0x8f, + 0x7b, 0xa7, 0x28, 0x57, 0xc9, 0xf9, 0x74, 0x04, 0xaf, 0x65, 0xe6, 0xef, 0x21, 0x14, 0x45, 0xba, + 0x24, 0x8c, 0xc7, 0x50, 0xe2, 0x65, 0x5b, 0xef, 0x19, 0xe4, 0xd8, 0x00, 0xfe, 0x1d, 0xd4, 0x51, + 0xc0, 0x63, 0x90, 0x78, 0xc5, 0x96, 0xaa, 0xcc, 0xbf, 0x8b, 0xba, 0xba, 0x24, 0x42, 0x26, 0x8c, + 0xe3, 0x96, 0xad, 0xac, 0xea, 0xf2, 0xc4, 0xa4, 0xfe, 0x36, 0x6a, 0x53, 0xa5, 0x40, 0xe3, 0xb6, + 0xc5, 0x5d, 0xe2, 0xdf, 0x43, 0x88, 0x71, 0xa2, 0x4b, 0x92, 0x52, 0x95, 0xe2, 0x8e, 0x2d, 0x75, + 0x19, 0x3f, 0x2f, 0x8f, 0xa8, 0x4a, 0xfd, 0x87, 0x68, 0x8b, 0x71, 0x32, 0xcc, 0x44, 0xf4, 0x96, + 0xa4, 0xc0, 0x92, 0x54, 0xe3, 0x55, 0xdb, 0xb2, 0xc1, 0xf8, 0x81, 0x41, 0x8f, 0x2c, 0xe8, 0xef, + 0xa2, 0xae, 0x84, 0x08, 0xd8, 0x18, 0x24, 0xee, 0xba, 0x19, 0x75, 0xee, 0x3f, 0x40, 0x9b, 0x75, + 0x4c, 0xac, 0x84, 0xb8, 0xe7, 0x46, 0xd4, 0xe8, 0xa1, 0x01, 0xcd, 0x89, 0x68, 0x2e, 0x0a, 0xae, + 0x31, 0x72, 0x27, 0x72, 0x99, 0xff, 0x08, 0x6d, 0x49, 0xc8, 0xe8, 0x14, 0x62, 0x92, 0x83, 0x52, + 0x34, 0x01, 0x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cd, 0x02, 0xef, 0x6a, 0x16, 0x78, 0x5f, 0x67, + 0x81, 0xf7, 0x6e, 0x1e, 0x2c, 0x5d, 0xcd, 0x83, 0xa5, 0x2f, 0xf3, 0x60, 0xe9, 0xe2, 0x69, 0xc2, + 0x74, 0x5a, 0x0c, 0x07, 0x91, 0xc8, 0x43, 0xb3, 0x9c, 0x9f, 0xb8, 0xfd, 0x5d, 0xef, 0xe9, 0xb0, + 0x0c, 0xaf, 0x6d, 0x75, 0x73, 0x4a, 0x35, 0xec, 0xd8, 0x5d, 0xfc, 0xec, 0x5b, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xee, 0x0c, 0x96, 0x59, 0xf0, 0x05, 0x00, 0x00, } func (m *EventInboundFinalized) Marshal() (dAtA []byte, err error) { @@ -845,10 +845,10 @@ func (m *EventOutboundFailure) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ZetaMinted) > 0 { - i -= len(m.ZetaMinted) - copy(dAtA[i:], m.ZetaMinted) - i = encodeVarintEvents(dAtA, i, uint64(len(m.ZetaMinted))) + if len(m.ValueReceived) > 0 { + i -= len(m.ValueReceived) + copy(dAtA[i:], m.ValueReceived) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ValueReceived))) i-- dAtA[i] = 0x2a } @@ -903,10 +903,10 @@ func (m *EventOutboundSuccess) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.ZetaMinted) > 0 { - i -= len(m.ZetaMinted) - copy(dAtA[i:], m.ZetaMinted) - i = encodeVarintEvents(dAtA, i, uint64(len(m.ZetaMinted))) + if len(m.ValueReceived) > 0 { + i -= len(m.ValueReceived) + copy(dAtA[i:], m.ValueReceived) + i = encodeVarintEvents(dAtA, i, uint64(len(m.ValueReceived))) i-- dAtA[i] = 0x2a } @@ -1113,7 +1113,7 @@ func (m *EventOutboundFailure) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.ZetaMinted) + l = len(m.ValueReceived) if l > 0 { n += 1 + l + sovEvents(uint64(l)) } @@ -1142,7 +1142,7 @@ func (m *EventOutboundSuccess) Size() (n int) { if l > 0 { n += 1 + l + sovEvents(uint64(l)) } - l = len(m.ZetaMinted) + l = len(m.ValueReceived) if l > 0 { n += 1 + l + sovEvents(uint64(l)) } @@ -2360,7 +2360,7 @@ func (m *EventOutboundFailure) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ZetaMinted", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2388,7 +2388,7 @@ func (m *EventOutboundFailure) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ZetaMinted = string(dAtA[iNdEx:postIndex]) + m.ValueReceived = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2570,7 +2570,7 @@ func (m *EventOutboundSuccess) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ZetaMinted", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2598,7 +2598,7 @@ func (m *EventOutboundSuccess) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ZetaMinted = string(dAtA[iNdEx:postIndex]) + m.ValueReceived = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/crosschain/types/message_vote_on_observed_outbound_tx.go b/x/crosschain/types/message_vote_on_observed_outbound_tx.go index 9bccf434c6..bf940f6984 100644 --- a/x/crosschain/types/message_vote_on_observed_outbound_tx.go +++ b/x/crosschain/types/message_vote_on_observed_outbound_tx.go @@ -18,7 +18,7 @@ func NewMsgVoteOnObservedOutboundTx( outTxGasUsed uint64, outTxEffectiveGasPrice math.Int, outTxEffectiveGasLimit uint64, - mMint math.Uint, + valueReceived math.Uint, status common.ReceiveStatus, chain int64, nonce uint64, @@ -32,7 +32,7 @@ func NewMsgVoteOnObservedOutboundTx( ObservedOutTxGasUsed: outTxGasUsed, ObservedOutTxEffectiveGasPrice: outTxEffectiveGasPrice, ObservedOutTxEffectiveGasLimit: outTxEffectiveGasLimit, - ZetaMinted: mMint, + ValueReceived: valueReceived, Status: status, OutTxChain: chain, OutTxTssNonce: nonce, diff --git a/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go b/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go index 7df78fd94d..cce6a29c3c 100644 --- a/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go +++ b/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go @@ -28,7 +28,7 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { ObservedOutTxGasUsed: 42, ObservedOutTxEffectiveGasPrice: math.NewInt(42), ObservedOutTxEffectiveGasLimit: 42, - ZetaMinted: math.NewUint(42), + ValueReceived: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: 42, OutTxTssNonce: 42, @@ -43,7 +43,7 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { ObservedOutTxHash: sample.String(), ObservedOutTxBlockHeight: 42, ObservedOutTxGasUsed: 42, - ZetaMinted: math.NewUint(42), + ValueReceived: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: 42, OutTxTssNonce: 42, @@ -60,7 +60,7 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { ObservedOutTxGasUsed: 42, ObservedOutTxEffectiveGasPrice: math.NewInt(42), ObservedOutTxEffectiveGasLimit: 42, - ZetaMinted: math.NewUint(42), + ValueReceived: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: 42, OutTxTssNonce: 42, @@ -78,7 +78,7 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { ObservedOutTxGasUsed: 42, ObservedOutTxEffectiveGasPrice: math.NewInt(42), ObservedOutTxEffectiveGasLimit: 42, - ZetaMinted: math.NewUint(42), + ValueReceived: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: -1, OutTxTssNonce: 42, @@ -110,7 +110,7 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) { ObservedOutTxGasUsed: 42, ObservedOutTxEffectiveGasPrice: math.NewInt(42), ObservedOutTxEffectiveGasLimit: 42, - ZetaMinted: math.NewUint(42), + ValueReceived: math.NewUint(42), Status: common.ReceiveStatus_Created, OutTxChain: 42, OutTxTssNonce: 42, @@ -169,7 +169,7 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) { // zeta minted used msg2 = msg - msg2.ZetaMinted = math.NewUint(43) + msg2.ValueReceived = math.NewUint(43) hash2 = msg2.Digest() require.NotEqual(t, hash, hash2, "zeta minted should change hash") diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index 303a06633a..da54881dd4 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -767,7 +767,7 @@ type MsgVoteOnObservedOutboundTx struct { ObservedOutTxGasUsed uint64 `protobuf:"varint,10,opt,name=observed_outTx_gas_used,json=observedOutTxGasUsed,proto3" json:"observed_outTx_gas_used,omitempty"` ObservedOutTxEffectiveGasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=observed_outTx_effective_gas_price,json=observedOutTxEffectiveGasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"observed_outTx_effective_gas_price"` ObservedOutTxEffectiveGasLimit uint64 `protobuf:"varint,12,opt,name=observed_outTx_effective_gas_limit,json=observedOutTxEffectiveGasLimit,proto3" json:"observed_outTx_effective_gas_limit,omitempty"` - ZetaMinted github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,5,opt,name=zeta_minted,json=zetaMinted,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"zeta_minted" yaml:"zeta_minted"` + ValueReceived github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"value_received" yaml:"value_received"` Status common.ReceiveStatus `protobuf:"varint,6,opt,name=status,proto3,enum=common.ReceiveStatus" json:"status,omitempty"` OutTxChain int64 `protobuf:"varint,7,opt,name=outTx_chain,json=outTxChain,proto3" json:"outTx_chain,omitempty"` OutTxTssNonce uint64 `protobuf:"varint,8,opt,name=outTx_tss_nonce,json=outTxTssNonce,proto3" json:"outTx_tss_nonce,omitempty"` @@ -1206,90 +1206,90 @@ func init() { func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) } var fileDescriptor_81d6d611190b7635 = []byte{ - // 1313 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x36, 0x89, 0x63, 0xbf, 0xc4, 0x69, 0x32, 0x49, 0x9b, 0xed, 0xa6, 0x75, 0xda, 0x2d, - 0x2d, 0x15, 0x6a, 0xec, 0x92, 0x82, 0x28, 0x85, 0x03, 0x4d, 0x54, 0xd2, 0x52, 0x9c, 0x54, 0x1b, - 0x17, 0xa4, 0x5e, 0x56, 0xeb, 0xdd, 0xc9, 0x7a, 0x15, 0xef, 0x8e, 0xb5, 0x33, 0x8e, 0xec, 0x8a, - 0x13, 0x12, 0x07, 0x6e, 0x1c, 0x90, 0x40, 0x7c, 0x01, 0xbe, 0x4a, 0xb9, 0x55, 0x9c, 0x10, 0x87, - 0x0a, 0xda, 0x6f, 0xc0, 0x27, 0x40, 0xf3, 0x67, 0x37, 0x5e, 0x27, 0xb6, 0xe3, 0x20, 0x4e, 0x3b, - 0xef, 0xed, 0xfb, 0xf3, 0x7b, 0x33, 0xbf, 0x37, 0x7f, 0x60, 0xc9, 0x8d, 0x09, 0xa5, 0x6e, 0xc3, - 0x09, 0xa2, 0x0a, 0xeb, 0x94, 0x5b, 0x31, 0x61, 0x04, 0x5d, 0x79, 0x81, 0x99, 0x23, 0x74, 0x65, - 0x31, 0x22, 0x31, 0x2e, 0x1f, 0xd9, 0x19, 0x4b, 0x2e, 0x09, 0x43, 0x12, 0x55, 0xe4, 0x47, 0xfa, - 0x18, 0xcb, 0x3e, 0xf1, 0x89, 0x18, 0x56, 0xf8, 0x48, 0x6a, 0xcd, 0x1d, 0x58, 0xaa, 0x52, 0xff, - 0x59, 0xcb, 0x73, 0x18, 0xae, 0x51, 0xfa, 0xc0, 0xf3, 0x62, 0x4c, 0x29, 0xd2, 0x61, 0xc6, 0x8d, - 0xb1, 0xc3, 0x48, 0xac, 0x6b, 0x57, 0xb5, 0x5b, 0x05, 0x2b, 0x11, 0xd1, 0x15, 0x00, 0x46, 0xa9, - 0xdd, 0x6a, 0xd7, 0x0f, 0x70, 0x57, 0x3f, 0x27, 0x7e, 0x16, 0x18, 0xa5, 0x4f, 0x85, 0xc2, 0xbc, - 0x02, 0xab, 0x27, 0xc4, 0xb3, 0x30, 0x6d, 0x91, 0x88, 0x62, 0xf3, 0x77, 0x0d, 0x16, 0xab, 0xd4, - 0xff, 0xba, 0x11, 0x30, 0xdc, 0x0c, 0x28, 0x7b, 0x68, 0x6d, 0x6d, 0xdc, 0x19, 0x92, 0xed, 0x3a, - 0x14, 0x71, 0xec, 0x6e, 0xdc, 0xb1, 0x1d, 0x19, 0x48, 0x25, 0x9c, 0x13, 0xca, 0x04, 0xec, 0x25, - 0xc8, 0x8b, 0xba, 0xed, 0xc0, 0xd3, 0x27, 0xaf, 0x6a, 0xb7, 0x26, 0xad, 0x19, 0x21, 0x3f, 0xf6, - 0x10, 0x82, 0xa9, 0xc8, 0x09, 0xb1, 0x3e, 0x25, 0xdc, 0xc4, 0x18, 0x5d,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0x90, 0xa4, 0xde, 0x22, 0x41, 0x54, 0xeb, 0xb6, 0xb0, 0x95, 0x77, 0xd5, 0xc8, 0xbc, 0x01, 0xd7, - 0x87, 0x30, 0x3a, 0x65, 0xfe, 0xdf, 0x93, 0x60, 0x1c, 0xb3, 0x7b, 0x1c, 0x8d, 0x26, 0x3e, 0xef, - 0x6d, 0x1c, 0x79, 0x38, 0x56, 0xac, 0x57, 0x12, 0x2f, 0x47, 0x8e, 0xec, 0xbe, 0xa3, 0xb0, 0x28, - 0xd5, 0x5b, 0xaa, 0x43, 0x0d, 0xc8, 0xc7, 0x72, 0xc2, 0x62, 0x75, 0x58, 0xa4, 0x32, 0xba, 0x01, - 0xf3, 0xc9, 0x58, 0x4d, 0xdb, 0xb4, 0x0c, 0x91, 0x68, 0xe5, 0xcc, 0x6d, 0x43, 0xce, 0x09, 0x49, - 0x3b, 0x62, 0x62, 0x25, 0x0a, 0x9b, 0x95, 0x31, 0x17, 0xdb, 0x52, 0xee, 0xbc, 0xca, 0x10, 0x53, - 0xea, 0xf8, 0x72, 0xea, 0x0b, 0x56, 0x22, 0xa2, 0xcb, 0x00, 0x7c, 0xca, 0x55, 0xe3, 0x16, 0x24, - 0xce, 0x20, 0x52, 0xfd, 0x7a, 0x13, 0xce, 0x07, 0x91, 0xec, 0x51, 0xbb, 0x21, 0x9b, 0x54, 0x76, - 0x5a, 0x31, 0x88, 0x7a, 0x3b, 0x33, 0x73, 0x68, 0xcf, 0x0a, 0x8b, 0xf4, 0xd0, 0xce, 0xae, 0xeb, - 0xdc, 0xa8, 0x75, 0xe5, 0xb1, 0x58, 0xc7, 0x26, 0x71, 0xe0, 0x07, 0x91, 0x5e, 0x94, 0x80, 0x58, - 0x67, 0x57, 0xc8, 0x7c, 0xdb, 0x73, 0x28, 0xc5, 0x4c, 0x9f, 0x17, 0x3f, 0xa4, 0x60, 0xbe, 0x03, - 0xe6, 0xe0, 0x25, 0x4e, 0x99, 0xf0, 0xbd, 0x06, 0xf3, 0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0x0d, 0x56, - 0x06, 0xed, 0xed, 0x1f, 0x8f, 0x1b, 0x3f, 0x75, 0x35, 0x1e, 0x9c, 0xd9, 0xb5, 0x97, 0xa1, 0x7d, - 0x8f, 0xaf, 0x53, 0x30, 0x34, 0xeb, 0x71, 0x1a, 0x86, 0x9e, 0xfc, 0x18, 0x42, 0xdf, 0x6a, 0xb0, - 0x70, 0xec, 0xad, 0xb9, 0x31, 0x3a, 0x5c, 0xbf, 0x8f, 0x71, 0x7f, 0x7c, 0x9f, 0x04, 0xc4, 0xe6, - 0x93, 0x97, 0x6f, 0x4a, 0xda, 0xab, 0x37, 0x25, 0xed, 0xaf, 0x37, 0x25, 0xed, 0x87, 0xb7, 0xa5, - 0x89, 0x57, 0x6f, 0x4b, 0x13, 0x7f, 0xbc, 0x2d, 0x4d, 0x3c, 0x7f, 0xbf, 0xe7, 0x04, 0xe3, 0x51, - 0xd7, 0xe5, 0xb3, 0x3b, 0x49, 0x50, 0xe9, 0x54, 0x7a, 0x1f, 0xe3, 0xfc, 0x40, 0xab, 0xe7, 0xc4, - 0x33, 0xfa, 0xee, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7d, 0xa2, 0x25, 0x9b, 0xa7, 0x0f, 0x00, - 0x00, + // 1316 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcb, 0x6e, 0xdb, 0x46, + 0x17, 0x36, 0x63, 0x5b, 0x96, 0x8e, 0x2d, 0xc7, 0x1e, 0x3b, 0x31, 0x43, 0x27, 0x72, 0xc2, 0xfc, + 0xc9, 0x1f, 0x14, 0xb1, 0x94, 0x3a, 0x2d, 0x9a, 0xa6, 0x5d, 0x34, 0x36, 0x52, 0x27, 0x4d, 0x65, + 0x07, 0xb4, 0xd2, 0x02, 0xd9, 0x10, 0x14, 0x39, 0xa1, 0x08, 0x8b, 0x1c, 0x81, 0x33, 0x32, 0xa4,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x8e, 0xed, 0xc8, 0x40, 0x2a, 0xe1, 0x9c, 0x50, 0x26, 0x60, + 0x2f, 0x41, 0x5e, 0xd4, 0x6d, 0x07, 0x9e, 0x3e, 0x79, 0x55, 0xbb, 0x35, 0x69, 0xcd, 0x08, 0xf9, + 0xb1, 0x87, 0x10, 0x4c, 0x45, 0x4e, 0x88, 0xf5, 0x29, 0xe1, 0x26, 0xc6, 0xe8, 0x22, 0xe4, 0x68, + 0x37, 0xac, 0x93, 0xa6, 0x3e, 0x2d, 0xb4, 0x4a, 0x42, 0x06, 0xe4, 0x3d, 0xec, 0x06, 0xa1, 0xd3, + 0xa4, 0x7a, 0xee, 0xaa, 0x76, 0xab, 0x68, 0xa5, 0x32, 0x5a, 0x85, 0x82, 0xef, 0x50, 0xbb, 0x19, + 0x84, 0x01, 0xd3, 0x67, 0x44, 0x8e, 0xbc, 0xef, 0xd0, 0xcf, 0xb9, 0x6c, 0xae, 0xc2, 0xa5, 0x63, + 0x35, 0xa5, 0x15, 0xbf, 0x84, 0xe5, 0x2a, 0xf5, 0x1f, 0x78, 0x5e, 0x8d, 0xec, 0xb6, 0x59, 0xad, + 0x53, 0x8b, 0x1d, 0x77, 0x1f, 0xc7, 0x43, 0x6a, 0xee, 0x2d, 0xe7, 0x5c, 0xb6, 0x9c, 0x65, 0x98, + 0x8e, 0x48, 0xe4, 0x62, 0x51, 0xe6, 0x94, 0x25, 0x05, 0xb4, 0x02, 0x33, 0xac, 0x63, 0x37, 0x1c, + 0xda, 0x50, 0x75, 0xe6, 0x58, 0xe7, 0x91, 0x43, 0x1b, 0x66, 0x09, 0x2e, 0x9f, 0x94, 0x3b, 0xc5, + 0xf6, 0x42, 0x00, 0xb7, 0x70, 0x48, 0x0e, 0xf0, 0xa7, 0x31, 0x09, 0xff, 0x23, 0x80, 0xe6, 0x75, + 0xb8, 0x36, 0x30, 0x4f, 0x0a, 0xe6, 0x67, 0x49, 0x8d, 0x2d, 0x9e, 0x04, 0xd7, 0xf6, 0x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0x71, 0x30, 0x3e, 0x18, 0xd3, 0x21, 0x4d, 0xdd, 0x02, + 0xe8, 0xb9, 0x44, 0xdc, 0x1e, 0x1d, 0xe6, 0xc8, 0xda, 0x78, 0x6f, 0x1c, 0xeb, 0x34, 0xe3, 0x4f, + 0x1a, 0xe8, 0x03, 0x6f, 0x10, 0xf7, 0x47, 0x87, 0x1c, 0xe4, 0x6b, 0x6c, 0x9e, 0xdd, 0x37, 0x05, + 0xf7, 0x83, 0x06, 0x2b, 0x83, 0xf6, 0xf6, 0x0f, 0xc7, 0x8d, 0x9f, 0xba, 0x1a, 0x0f, 0xce, 0xec, + 0xda, 0xcb, 0xd0, 0xbe, 0x57, 0xd8, 0x29, 0x18, 0x9a, 0xf5, 0x38, 0x0d, 0x43, 0x4f, 0x7e, 0x15, + 0xa1, 0xaf, 0x35, 0x58, 0x38, 0xf6, 0xe8, 0xdc, 0x18, 0x1d, 0xae, 0xdf, 0xc7, 0xb8, 0x3f, 0xbe, + 0x4f, 0x02, 0x62, 0xf3, 0xc9, 0xab, 0xb7, 0x25, 0xed, 0xf5, 0xdb, 0x92, 0xf6, 0xe7, 0xdb, 0x92, + 0xf6, 0xdd, 0x61, 0x69, 0xe2, 0xf5, 0x61, 0x69, 0xe2, 0xb7, 0xc3, 0xd2, 0xc4, 0xf3, 0x77, 0x7b, + 0x4e, 0x30, 0x1e, 0x75, 0x5d, 0xbe, 0xbf, 0x93, 0x04, 0x95, 0x4e, 0xa5, 0xf7, 0x55, 0xce, 0x0f, + 0xb4, 0x7a, 0x4e, 0xbc, 0xa7, 0xef, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xa1, 0x90, 0x03, + 0xb0, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2211,9 +2211,9 @@ func (m *MsgVoteOnObservedOutboundTx) MarshalToSizedBuffer(dAtA []byte) (int, er dAtA[i] = 0x30 } { - size := m.ZetaMinted.Size() + size := m.ValueReceived.Size() i -= size - if _, err := m.ZetaMinted.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.ValueReceived.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintTx(dAtA, i, uint64(size)) @@ -2730,7 +2730,7 @@ func (m *MsgVoteOnObservedOutboundTx) Size() (n int) { if m.ObservedOutTxBlockHeight != 0 { n += 1 + sovTx(uint64(m.ObservedOutTxBlockHeight)) } - l = m.ZetaMinted.Size() + l = m.ValueReceived.Size() n += 1 + l + sovTx(uint64(l)) if m.Status != 0 { n += 1 + sovTx(uint64(m.Status)) @@ -4423,7 +4423,7 @@ func (m *MsgVoteOnObservedOutboundTx) Unmarshal(dAtA []byte) error { } case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ZetaMinted", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValueReceived", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4451,7 +4451,7 @@ func (m *MsgVoteOnObservedOutboundTx) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ZetaMinted.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ValueReceived.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex From 91a84d5c477a75530873d2d1578f3659b0a054c6 Mon Sep 17 00:00:00 2001 From: brewmaster012 <88689859+brewmaster012@users.noreply.github.com> Date: Fri, 15 Sep 2023 14:07:34 -0500 Subject: [PATCH 4/7] feat: block header and merkle proof (#949) * WIP: prototype * add voting on block headers on ethereum * enable authz for MsgAddBlockHeader * WIP: plug in the confirmation flow * fix build of smoketest * smoketest passes * add RPC to get block header by hash * AddToOutTxTracker: allow anyone to send if a proof is provided * fix compile * on ethereum only prove outbound, not vote * fix gas limit * fix smoketest * fix compile * revert back to old out tx tracker add * Update x/observer/keeper/msg_server_add_block_header.go Co-authored-by: Lucas Bertrand * Update proto/common/ethereum/ethereum.proto Co-authored-by: Lucas Bertrand * Update x/crosschain/keeper/keeper_cross_chain_tx_prove_outbound_tx.go Co-authored-by: Lucas Bertrand * clean up * add merkle prove query RPC and smoketest for it * address review * fix linter and generate * update mocks * make mocks * Update proto/observer/query.proto Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> * rename protobuf field per review suggestions * fix per review suggestion * more fix per review suggestion * more fix per review suggestion * more fix per review suggestion * Update x/observer/keeper/msg_server_add_block_header.go Co-authored-by: Lucas Bertrand * add link to TODO issue * make generate * added some comments to Verify function * added one more TODO issue * fixed linter complaints * address PR review * remove redundant if * fix comments * make generate --------- Co-authored-by: brewmaster012 <> Co-authored-by: Lucas Bertrand Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> --- Makefile | 4 + common/chain.go | 6 + common/ethereum/ethereum.pb.go | 374 +++ common/ethereum/proof.go | 168 ++ common/ethereum/proof_test.go | 125 + .../localnet/orchestrator/smoketest/main.go | 2 +- .../smoketest/test_deposit_eth.go | 110 +- .../localnet/orchestrator/smoketest/utils.go | 4 +- docs/openapi/openapi.swagger.yaml | 184 ++ docs/spec/crosschain/messages.md | 3 + docs/spec/observer/messages.md | 14 + proto/common/ethereum/ethereum.proto | 9 + proto/crosschain/out_tx_tracker.proto | 1 + proto/crosschain/tx.proto | 5 + proto/observer/headers.proto | 15 + proto/observer/query.proto | 44 + proto/observer/tx.proto | 12 + scripts/mocks-generate.sh | 11 + testutil/keeper/mocks/crosschain/account.go | 3 +- testutil/keeper/mocks/crosschain/bank.go | 5 +- testutil/keeper/mocks/crosschain/fungible.go | 2 +- testutil/keeper/mocks/crosschain/observer.go | 29 +- testutil/keeper/mocks/crosschain/staking.go | 5 +- testutil/keeper/mocks/fungible/account.go | 3 +- testutil/keeper/mocks/fungible/bank.go | 3 +- testutil/keeper/mocks/fungible/evm.go | 2 +- testutil/keeper/mocks/fungible/observer.go | 5 +- testutil/keeper/{ => mocks}/mocks.go | 20 +- x/crosschain/client/cli/cli_out_tx_tracker.go | 3 + x/crosschain/keeper/keeper_out_tx_tracker.go | 82 +- x/crosschain/types/cctx_utils.go | 1 + x/crosschain/types/errors.go | 4 + x/crosschain/types/expected_keepers.go | 1 + .../types/message_add_to_out_tx_tracker.go | 14 +- x/crosschain/types/out_tx_tracker.pb.go | 80 +- x/crosschain/types/tx.pb.go | 326 +- x/observer/keeper/grpc_query_prove.go | 47 + x/observer/keeper/keeper_block_header.go | 80 + .../keeper/msg_server_add_block_header.go | 58 + x/observer/types/errors.go | 1 + x/observer/types/headers.pb.go | 500 ++++ x/observer/types/keys.go | 1 + x/observer/types/messages_add_block_header.go | 101 + x/observer/types/query.pb.go | 2664 +++++++++++++---- x/observer/types/query.pb.gw.go | 267 ++ x/observer/types/tx.pb.go | 609 +++- zetaclient/btc_signer.go | 2 +- zetaclient/evm_client.go | 44 +- zetaclient/evm_signer.go | 4 +- zetaclient/query.go | 16 + zetaclient/tx.go | 22 +- 51 files changed, 5231 insertions(+), 864 deletions(-) create mode 100644 common/ethereum/ethereum.pb.go create mode 100644 common/ethereum/proof.go create mode 100644 common/ethereum/proof_test.go create mode 100644 proto/common/ethereum/ethereum.proto create mode 100644 proto/observer/headers.proto create mode 100644 scripts/mocks-generate.sh rename testutil/keeper/{ => mocks}/mocks.go (74%) create mode 100644 x/observer/keeper/grpc_query_prove.go create mode 100644 x/observer/keeper/keeper_block_header.go create mode 100644 x/observer/keeper/msg_server_add_block_header.go create mode 100644 x/observer/types/headers.pb.go create mode 100644 x/observer/types/messages_add_block_header.go diff --git a/Makefile b/Makefile index 019f5cef68..ec328166c6 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,10 @@ specs: @go run ./scripts/gen-spec.go .PHONY: specs +mocks: + @echo "--> Generating mocks" + @bash ./scripts/mocks-generate.sh + generate: proto openapi specs .PHONY: generate diff --git a/common/chain.go b/common/chain.go index c0286a1f8d..0952a64b49 100644 --- a/common/chain.go +++ b/common/chain.go @@ -102,6 +102,12 @@ func IsEVMChain(chainID int64) bool { chainID == 137 // polygon mainnet } +func IsEthereum(chainID int64) bool { + return chainID == 5 || // Goerli + chainID == 1337 || // eth privnet + chainID == 1 // eth mainnet +} + func (chain Chain) IsKlaytnChain() bool { return chain.ChainId == 1001 } diff --git a/common/ethereum/ethereum.pb.go b/common/ethereum/ethereum.pb.go new file mode 100644 index 0000000000..8dd8096019 --- /dev/null +++ b/common/ethereum/ethereum.pb.go @@ -0,0 +1,374 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: common/ethereum/ethereum.proto + +package ethereum + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + proto "github.com/gogo/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type Proof struct { + Keys [][]byte `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` + Values [][]byte `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` +} + +func (m *Proof) Reset() { *m = Proof{} } +func (m *Proof) String() string { return proto.CompactTextString(m) } +func (*Proof) ProtoMessage() {} +func (*Proof) Descriptor() ([]byte, []int) { + return fileDescriptor_93e74b59a4555c70, []int{0} +} +func (m *Proof) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Proof.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 *Proof) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proof.Merge(m, src) +} +func (m *Proof) XXX_Size() int { + return m.Size() +} +func (m *Proof) XXX_DiscardUnknown() { + xxx_messageInfo_Proof.DiscardUnknown(m) +} + +var xxx_messageInfo_Proof proto.InternalMessageInfo + +func (m *Proof) GetKeys() [][]byte { + if m != nil { + return m.Keys + } + return nil +} + +func (m *Proof) GetValues() [][]byte { + if m != nil { + return m.Values + } + return nil +} + +func init() { + proto.RegisterType((*Proof)(nil), "ethereum.Proof") +} + +func init() { proto.RegisterFile("common/ethereum/ethereum.proto", fileDescriptor_93e74b59a4555c70) } + +var fileDescriptor_93e74b59a4555c70 = []byte{ + // 159 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0xcf, 0xcd, + 0xcd, 0xcf, 0xd3, 0x4f, 0x2d, 0xc9, 0x48, 0x2d, 0x4a, 0x2d, 0xcd, 0x85, 0x33, 0xf4, 0x0a, 0x8a, + 0xf2, 0x4b, 0xf2, 0x85, 0x38, 0x60, 0x7c, 0x25, 0x63, 0x2e, 0xd6, 0x80, 0xa2, 0xfc, 0xfc, 0x34, + 0x21, 0x21, 0x2e, 0x96, 0xec, 0xd4, 0xca, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x9e, 0x20, 0x30, + 0x5b, 0x48, 0x8c, 0x8b, 0xad, 0x2c, 0x31, 0xa7, 0x34, 0xb5, 0x58, 0x82, 0x09, 0x2c, 0x0a, 0xe5, + 0x39, 0x79, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, + 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x5e, 0x7a, 0x66, + 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x55, 0x6a, 0x49, 0xa2, 0x6e, 0x72, 0x46, + 0x62, 0x66, 0x1e, 0x98, 0x99, 0x9c, 0x5f, 0x94, 0xaa, 0x8f, 0xe6, 0xae, 0x24, 0x36, 0xb0, 0x7b, + 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x31, 0x9b, 0x72, 0x4f, 0xb1, 0x00, 0x00, 0x00, +} + +func (m *Proof) 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 *Proof) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Values) > 0 { + for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Values[iNdEx]) + copy(dAtA[i:], m.Values[iNdEx]) + i = encodeVarintEthereum(dAtA, i, uint64(len(m.Values[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.Keys) > 0 { + for iNdEx := len(m.Keys) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Keys[iNdEx]) + copy(dAtA[i:], m.Keys[iNdEx]) + i = encodeVarintEthereum(dAtA, i, uint64(len(m.Keys[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintEthereum(dAtA []byte, offset int, v uint64) int { + offset -= sovEthereum(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Proof) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Keys) > 0 { + for _, b := range m.Keys { + l = len(b) + n += 1 + l + sovEthereum(uint64(l)) + } + } + if len(m.Values) > 0 { + for _, b := range m.Values { + l = len(b) + n += 1 + l + sovEthereum(uint64(l)) + } + } + return n +} + +func sovEthereum(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEthereum(x uint64) (n int) { + return sovEthereum(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Proof) 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 ErrIntOverflowEthereum + } + 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: Proof: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Proof: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Keys", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEthereum + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEthereum + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEthereum + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Keys = append(m.Keys, make([]byte, postIndex-iNdEx)) + copy(m.Keys[len(m.Keys)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEthereum + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthEthereum + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthEthereum + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Values = append(m.Values, make([]byte, postIndex-iNdEx)) + copy(m.Values[len(m.Values)-1], dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEthereum(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEthereum + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEthereum(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEthereum + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEthereum + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEthereum + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEthereum + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEthereum + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEthereum + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEthereum = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEthereum = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEthereum = fmt.Errorf("proto: unexpected end of group") +) diff --git a/common/ethereum/proof.go b/common/ethereum/proof.go new file mode 100644 index 0000000000..1ff6f705b4 --- /dev/null +++ b/common/ethereum/proof.go @@ -0,0 +1,168 @@ +// This file was adapted from go-ethereum. Here's the go-ethereum license reproduced: + +// Copyright 2014 The go-ethereum Authors +// This file is part of the go-ethereum library. +// +// The go-ethereum library is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// The go-ethereum library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with the go-ethereum library. If not, see . + +// Package trie implements Merkle Patricia Tries. + +package ethereum + +import ( + "bytes" + "errors" + "sync" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/trie" +) + +func NewProof() *Proof { + return &Proof{ + Keys: make([][]byte, 0), + Values: make([][]byte, 0), + } +} + +func (m *Proof) Put(key []byte, value []byte) error { + for i := 0; i < len(m.Keys); i++ { + if bytes.Equal(m.Keys[i], key) { + m.Values[i] = value + return nil + } + } + m.Keys = append(m.Keys, key) + m.Values = append(m.Values, value) + + return nil +} + +func (m *Proof) Delete(key []byte) error { + found := false + index := -1 + for i := 0; i < len(m.Keys); i++ { + if bytes.Equal(m.Keys[i], key) { + found = true + index = i + break + } + } + if !found { + return errors.New("key not found") + } + copy(m.Keys[index:len(m.Keys)-1], m.Keys[index+1:]) + copy(m.Values[index:len(m.Values)-1], m.Values[index+1:]) + m.Keys = m.Keys[:len(m.Keys)-1] + m.Values = m.Values[:len(m.Values)-1] + + return nil +} + +func (m *Proof) Has(key []byte) (bool, error) { + for i := 0; i < len(m.Keys); i++ { + if bytes.Equal(m.Keys[i], key) { + + return true, nil + } + } + return false, nil +} + +func (m *Proof) Get(key []byte) ([]byte, error) { + found := false + index := -1 + for i := 0; i < len(m.Keys); i++ { + if bytes.Equal(m.Keys[i], key) { + found = true + index = i + break + } + } + if !found { + return nil, errors.New("key not found") + } + + return m.Values[index], nil +} + +// Verify verifies the proof against the given root hash and key. +// Typically, the rootHash is from a trusted source (e.g. a trusted block header), +// and the key is the index of the transaction in the block. +func (m *Proof) Verify(rootHash common.Hash, key int) ([]byte, error) { + var indexBuf []byte + indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(key)) + return trie.VerifyProof(rootHash, indexBuf, m) +} + +type Trie struct { + *trie.Trie +} + +var encodeBufferPool = sync.Pool{ + New: func() interface{} { return new(bytes.Buffer) }, +} + +func encodeForDerive(list types.DerivableList, i int, buf *bytes.Buffer) []byte { + buf.Reset() + list.EncodeIndex(i, buf) + // It's really unfortunate that we need to do perform this copy. + // StackTrie holds onto the values until Hash is called, so the values + // written to it must not alias. + return common.CopyBytes(buf.Bytes()) +} + +func (t *Trie) GenerateProof(txIndex int) (*Proof, error) { + var indexBuf []byte + indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(txIndex)) + proof := NewProof() + err := t.Prove(indexBuf, 0, proof) + if err != nil { + return nil, err + } + return proof, nil +} + +// NewTrie builds a trie from a DerivableList. The DerivableList must be types.Transactions +// or types.Receipts. +func NewTrie(list types.DerivableList) Trie { + hasher := new(trie.Trie) + hasher.Reset() + + valueBuf := encodeBufferPool.Get().(*bytes.Buffer) + defer encodeBufferPool.Put(valueBuf) + + // StackTrie requires values to be inserted in increasing hash order, which is not the + // order that `list` provides hashes in. This insertion sequence ensures that the + // order is correct. + var indexBuf []byte + for i := 1; i < list.Len() && i <= 0x7f; i++ { + indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i)) + value := encodeForDerive(list, i, valueBuf) + hasher.Update(indexBuf, value) + } + if list.Len() > 0 { + indexBuf = rlp.AppendUint64(indexBuf[:0], 0) + value := encodeForDerive(list, 0, valueBuf) + hasher.Update(indexBuf, value) + } + for i := 0x80; i < list.Len(); i++ { + indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i)) + value := encodeForDerive(list, i, valueBuf) + hasher.Update(indexBuf, value) + } + return Trie{hasher} +} diff --git a/common/ethereum/proof_test.go b/common/ethereum/proof_test.go new file mode 100644 index 0000000000..14a153ffc7 --- /dev/null +++ b/common/ethereum/proof_test.go @@ -0,0 +1,125 @@ +package ethereum + +import ( + "context" + "math/big" + "testing" + "time" + + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rlp" + "github.com/ethereum/go-ethereum/trie" +) + +func TestProofGeneration(t *testing.T) { + RPC_URL := "https://rpc.ankr.com/eth_goerli" + client, err := ethclient.Dial(RPC_URL) + if err != nil { + t.Fatal(err) + } + bn := int64(9509129) + block, err := client.BlockByNumber(context.Background(), big.NewInt(bn)) + if err != nil { + t.Fatal(err) + } + + headerRLP, _ := rlp.EncodeToBytes(block.Header()) + t.Logf("block header size %d\n", len(headerRLP)) + + var header types.Header + rlp.DecodeBytes(headerRLP, &header) + + t.Logf("block %d\n", block.Number()) + t.Logf(" tx root %x\n", header.TxHash) + + //ttt := new(trie.Trie) + tr := NewTrie(block.Transactions()) + t.Logf(" sha2 %x\n", tr.Hash()) + if tr.Hash() != header.TxHash { + t.Fatal("tx root mismatch") + } else { + t.Logf(" tx root hash & block tx root match\n") + } + + var indexBuf []byte + for i := 0; i < len(block.Transactions()); i++ { + + indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i)) + + proof := NewProof() + tr.Prove(indexBuf, 0, proof) + t.Logf("proof len %d\n", len(proof.Keys)) + value, err := proof.Verify(block.Header().TxHash, i) + //value, err := trie.VerifyProof(tr.trie.Hash(), indexBuf, proof) + t.Logf("pass? %v\n", err == nil) + //t.Logf("value %x\n", value) + + var txx types.Transaction + txx.UnmarshalBinary(value) + t.Logf(" tx %+v\n", txx.To().Hex()) + t.Logf(" tx hash %+v\n", txx.Hash().Hex()) + if txx.Hash() != block.Transactions()[i].Hash() { + t.Fatal("tx hash mismatch") + } else { + t.Logf(" tx hash & block tx hash match\n") + } + signer := types.NewLondonSigner(txx.ChainId()) + sender, err := types.Sender(signer, &txx) + t.Logf(" tx from %s\n", sender.Hex()) + } + + //for k, v := range proof.Proof { + // key, _ := base64.StdEncoding.DecodeString(k) + // t.Logf("k: %x, v: %x\n", key, v) + //} + + { + var receipts types.Receipts + for _, tx := range block.Transactions() { + receipt, err := client.TransactionReceipt(context.Background(), tx.Hash()) + if err != nil { + t.Fatal(err) + } + receipts = append(receipts, receipt) + time.Sleep(200 * time.Millisecond) + } + + receiptTree := NewTrie(receipts) + t.Logf(" block receipt root %x\n", block.Header().ReceiptHash) + t.Logf(" receipt tree root %x\n", receiptTree.Hash()) + if receiptTree.Hash() != block.Header().ReceiptHash { + t.Fatal("receipt root mismatch") + } else { + t.Logf(" receipt root hash & block receipt root match\n") + } + + i := 1 + proof := NewProof() + indexBuf = rlp.AppendUint64(indexBuf[:0], uint64(i)) + err = receiptTree.Prove(indexBuf, 0, proof) + if err != nil { + t.Fatal(err) + } + + // NOTE: eth receipts only hashes the following fields + // data := &receiptRLP{r.statusEncoding(), r.CumulativeGasUsed, r.Bloom, r.Logs} + value, err := trie.VerifyProof(block.Header().ReceiptHash, indexBuf, proof) + t.Logf("pass? %v\n", err == nil) + t.Logf("value %x\n", value) + value, err = proof.Verify(block.Header().ReceiptHash, i) + if err != nil { + t.Fatal(err) + } + + var receipt types.Receipt + receipt.UnmarshalBinary(value) + + t.Logf(" receipt %+v\n", receipt) + t.Logf(" receipt tx hash %+v\n", receipt.TxHash.Hex()) + + for _, log := range receipt.Logs { + t.Logf(" log %+v\n", log) + } + } +} diff --git a/contrib/localnet/orchestrator/smoketest/main.go b/contrib/localnet/orchestrator/smoketest/main.go index 2939ea2181..5608bfca90 100644 --- a/contrib/localnet/orchestrator/smoketest/main.go +++ b/contrib/localnet/orchestrator/smoketest/main.go @@ -284,7 +284,7 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { smokeTest.CheckZRC20ReserveAndSupply() smokeTest.TestBitcoinWithdraw() - smokeTest.CheckZRC20ReserveAndSupply() + //smokeTest.CheckZRC20ReserveAndSupply() smokeTest.TestCrosschainSwap() smokeTest.CheckZRC20ReserveAndSupply() diff --git a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go b/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go index b65fdb5691..e79b23feb5 100644 --- a/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go +++ b/contrib/localnet/orchestrator/smoketest/test_deposit_eth.go @@ -9,15 +9,16 @@ import ( "math/big" "time" - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/x/crosschain/types" - "github.com/zeta-chain/zetacore/zetaclient" - "github.com/ethereum/go-ethereum/accounts/abi/bind" + ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/common/ethereum" + "github.com/zeta-chain/zetacore/x/crosschain/types" + observertypes "github.com/zeta-chain/zetacore/x/observer/types" + "github.com/zeta-chain/zetacore/zetaclient" ) // this tests sending ZETA out of ZetaChain to Ethereum @@ -39,6 +40,26 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() { } fmt.Printf("GOERLI deployer balance: %s\n", bal.String()) + systemContract := sm.SystemContract + if err != nil { + panic(err) + } + ethZRC20Addr, err := systemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.GoerliChain().ChainId)) + if err != nil { + panic(err) + } + sm.ETHZRC20Addr = ethZRC20Addr + fmt.Printf("eth zrc20 address: %s\n", ethZRC20Addr.String()) + ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, sm.zevmClient) + if err != nil { + panic(err) + } + sm.ETHZRC20 = ethZRC20 + initialBalance, err := ethZRC20.BalanceOf(nil, DeployerAddress) + if err != nil { + panic(err) + } + value := big.NewInt(1000000000000000000) // in wei (1 eth) signedTx, err := sm.SendEther(TSSAddress, value, nil) if err != nil { @@ -53,6 +74,67 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() { fmt.Printf(" value: %d\n", signedTx.Value()) fmt.Printf(" block num: %d\n", receipt.BlockNumber) + { + LoudPrintf("Merkle Proof\n") + txHash := receipt.TxHash + blockHash := receipt.BlockHash + txIndex := int(receipt.TransactionIndex) + + block, err := sm.goerliClient.BlockByHash(context.Background(), blockHash) + if err != nil { + panic(err) + } + i := 0 + for { + if i > 20 { + panic("block header not found") + } + _, err := sm.observerClient.GetBlockHeaderByHash(context.Background(), &observertypes.QueryGetBlockHeaderByHashRequest{ + BlockHash: blockHash.Bytes(), + }) + if err != nil { + fmt.Printf("WARN: block header not found; retrying...\n") + time.Sleep(2 * time.Second) + } else { + fmt.Printf("OK: block header found\n") + break + } + i++ + } + + trie := ethereum.NewTrie(block.Transactions()) + if trie.Hash() != block.Header().TxHash { + panic("tx root hash & block tx root mismatch") + } + txProof, err := trie.GenerateProof(txIndex) + if err != nil { + panic("error generating txProof") + } + val, err := txProof.Verify(block.TxHash(), txIndex) + if err != nil { + panic("error verifying txProof") + } + var txx ethtypes.Transaction + err = txx.UnmarshalBinary(val) + if err != nil { + panic("error unmarshalling txProof'd tx") + } + res, err := sm.observerClient.Prove(context.Background(), &observertypes.QueryProveRequest{ + BlockHash: blockHash.Hex(), + TxIndex: int64(txIndex), + TxHash: txHash.Hex(), + Proof: txProof, + ChainId: 0, + }) + if err != nil { + panic(err) + } + if !res.Valid { + panic("txProof invalid") // FIXME: don't do this in production + } + fmt.Printf("OK: txProof verified\n") + } + { tx, err := sm.SendEther(TSSAddress, big.NewInt(101000000000000000), []byte(zetaclient.DonationMessage)) if err != nil { @@ -71,26 +153,6 @@ func (sm *SmokeTest) TestDepositEtherIntoZRC20() { }() sm.wg.Add(1) go func() { - systemContract := sm.SystemContract - if err != nil { - panic(err) - } - ethZRC20Addr, err := systemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.GoerliChain().ChainId)) - if err != nil { - panic(err) - } - sm.ETHZRC20Addr = ethZRC20Addr - fmt.Printf("eth zrc20 address: %s\n", ethZRC20Addr.String()) - ethZRC20, err := zrc20.NewZRC20(ethZRC20Addr, sm.zevmClient) - if err != nil { - panic(err) - } - sm.ETHZRC20 = ethZRC20 - initialBalance, err := ethZRC20.BalanceOf(nil, DeployerAddress) - if err != nil { - panic(err) - } - defer sm.wg.Done() <-c diff --git a/contrib/localnet/orchestrator/smoketest/utils.go b/contrib/localnet/orchestrator/smoketest/utils.go index 735d2d305a..7c4345f536 100644 --- a/contrib/localnet/orchestrator/smoketest/utils.go +++ b/contrib/localnet/orchestrator/smoketest/utils.go @@ -15,12 +15,10 @@ import ( "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcutil" - + ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/zeta-chain/zetacore/x/crosschain/types" - - ethcommon "github.com/ethereum/go-ethereum/common" ) // WaitCctxMinedByInTxHash waits until cctx is mined; returns the cctxIndex (the last one) diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 639510433c..3294b7827a 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -27310,6 +27310,84 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query + /zeta-chain/observer/get_all_block_headers: + get: + operationId: Query_GetAllBlockHeaders + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryAllBlockHeaderResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: pagination.key + description: |- + key is a value returned in PageResponse.next_key to begin + querying the next page most efficiently. Only one of offset or key + should be set. + in: query + required: false + type: string + format: byte + - name: pagination.offset + description: |- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key should + be set. + in: query + required: false + type: string + format: uint64 + - name: pagination.limit + description: |- + limit is the total number of results to be returned in the result page. + If left empty it will default to a value to be set by each app. + in: query + required: false + type: string + format: uint64 + - name: pagination.count_total + description: |- + count_total is set to true to indicate that the result set should include + a count of the total number of items available for pagination in UIs. + count_total is only respected when offset is used. It is ignored when key + is set. + in: query + required: false + type: boolean + - name: pagination.reverse + description: |- + reverse is set to true if results are to be returned in the descending order. + + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean + tags: + - Query + /zeta-chain/observer/get_block_header_by_hash/{block_hash}: + get: + operationId: Query_GetBlockHeaderByHash + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryGetBlockHeaderByHashResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: block_hash + in: path + required: true + type: string + format: byte + tags: + - Query /zeta-chain/observer/get_client_params_for_chain/{chain_id}: get: summary: Queries a list of GetClientParamsForChain items. @@ -27489,6 +27567,56 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query + /zeta-chain/observer/prove: + get: + summary: merkle proof verification + operationId: Query_Prove + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/observerQueryProveResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + parameters: + - name: chain_id + in: query + required: false + type: string + format: uint64 + - name: tx_hash + in: query + required: false + type: string + - name: proof.keys + in: query + required: false + type: array + items: + type: string + format: byte + collectionFormat: multi + - name: proof.values + in: query + required: false + type: array + items: + type: string + format: byte + collectionFormat: multi + - name: block_hash + in: query + required: false + type: string + - name: tx_index + in: query + required: false + type: string + format: int64 + tags: + - Query /zeta-chain/observer/supportedChains: get: operationId: Query_SupportedChains @@ -50536,6 +50664,8 @@ definitions: type: string tx_signer: type: string + proved: + type: boolean emissionsQueryGetEmmisonsFactorsResponse: type: object properties: @@ -50559,6 +50689,19 @@ definitions: properties: amount: type: string + ethereumProof: + type: object + properties: + keys: + type: array + items: + type: string + format: byte + values: + type: array + items: + type: string + format: byte fungibleForeignCoins: type: object properties: @@ -50681,6 +50824,25 @@ definitions: items: type: object $ref: '#/definitions/observerNode' + observerBlockHeader: + type: object + properties: + header: + type: string + format: byte + title: binary encoded headers; RLP for ethereum + height: + type: string + format: int64 + hash: + type: string + format: byte + parentHash: + type: string + format: byte + chain_id: + type: string + format: int64 observerCoreParams: type: object properties: @@ -50754,6 +50916,8 @@ definitions: format: int64 observerMsgAddBlameVoteResponse: type: object + observerMsgAddBlockHeaderResponse: + type: object observerMsgAddObserverResponse: type: object observerMsgUpdateCoreParamsResponse: @@ -50851,6 +51015,16 @@ definitions: items: type: object $ref: '#/definitions/observerBlame' + observerQueryAllBlockHeaderResponse: + type: object + properties: + block_headers: + type: array + items: + type: object + $ref: '#/definitions/observerBlockHeader' + pagination: + $ref: '#/definitions/v1beta1PageResponse' observerQueryAllNodeAccountResponse: type: object properties: @@ -50888,6 +51062,11 @@ definitions: properties: blame_info: $ref: '#/definitions/observerBlame' + observerQueryGetBlockHeaderByHashResponse: + type: object + properties: + block_header: + $ref: '#/definitions/observerBlockHeader' observerQueryGetCoreParamsForChainResponse: type: object properties: @@ -50920,6 +51099,11 @@ definitions: type: array items: type: string + observerQueryProveResponse: + type: object + properties: + valid: + type: boolean observerQueryShowObserverCountResponse: type: object properties: diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index 84917d6a33..21a3916c8d 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -13,6 +13,9 @@ message MsgAddToOutTxTracker { int64 chain_id = 2; uint64 nonce = 3; string tx_hash = 4; + ethereum.Proof proof = 5; + string block_hash = 6; + int64 tx_index = 7; } ``` diff --git a/docs/spec/observer/messages.md b/docs/spec/observer/messages.md index 6ae205a88e..4a34d7779b 100644 --- a/docs/spec/observer/messages.md +++ b/docs/spec/observer/messages.md @@ -70,3 +70,17 @@ message MsgUpdateKeygen { } ``` +## MsgAddBlockHeader + +MsgAddBlockHeader handles adding a block header to the store, through majority voting of observers + +```proto +message MsgAddBlockHeader { + string creator = 1; + int64 chain_id = 2; + bytes block_hash = 3; + bytes block_header = 4; + int64 height = 5; +} +``` + diff --git a/proto/common/ethereum/ethereum.proto b/proto/common/ethereum/ethereum.proto new file mode 100644 index 0000000000..92d3813035 --- /dev/null +++ b/proto/common/ethereum/ethereum.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; +package ethereum; + +option go_package = "github.com/zeta-chain/zetacore/common/ethereum"; + +message Proof { + repeated bytes keys = 1; + repeated bytes values = 2; +} diff --git a/proto/crosschain/out_tx_tracker.proto b/proto/crosschain/out_tx_tracker.proto index 16fa43d6d3..43d2a05f2c 100644 --- a/proto/crosschain/out_tx_tracker.proto +++ b/proto/crosschain/out_tx_tracker.proto @@ -6,6 +6,7 @@ option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; message TxHashList { string tx_hash = 1; string tx_signer = 2; + bool proved = 3; } message OutTxTracker { string index = 1; // format: "chain-nonce" diff --git a/proto/crosschain/tx.proto b/proto/crosschain/tx.proto index eb878b0523..033d2d83cd 100644 --- a/proto/crosschain/tx.proto +++ b/proto/crosschain/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package zetachain.zetacore.crosschain; import "common/common.proto"; +import "common/ethereum/ethereum.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; @@ -17,6 +18,7 @@ service Msg { rpc VoteOnObservedInboundTx(MsgVoteOnObservedInboundTx) returns (MsgVoteOnObservedInboundTxResponse); rpc WhitelistERC20(MsgWhitelistERC20) returns (MsgWhitelistERC20Response); rpc UpdateTssAddress(MsgUpdateTssAddress) returns (MsgUpdateTssAddressResponse); + // rpc ProveOutboundTx(MsgProveOutboundTx) returns (MsgProveOutboundTxResponse); } message MsgUpdateTssAddress { @@ -42,6 +44,9 @@ message MsgAddToOutTxTracker { int64 chain_id = 2; uint64 nonce = 3; string tx_hash = 4; + ethereum.Proof proof = 5; + string block_hash = 6; + int64 tx_index = 7; } message MsgAddToOutTxTrackerResponse {} diff --git a/proto/observer/headers.proto b/proto/observer/headers.proto new file mode 100644 index 0000000000..af1544c4f7 --- /dev/null +++ b/proto/observer/headers.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package zetachain.zetacore.observer; + +import "gogoproto/gogo.proto"; +import "observer/observer.proto"; + +option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; + +message BlockHeader { + bytes header = 1; // binary encoded headers; RLP for ethereum + int64 height = 2; + bytes hash = 3; + bytes parentHash = 4; + int64 chain_id = 5; +} diff --git a/proto/observer/query.proto b/proto/observer/query.proto index b5de301651..a989c2c2a5 100644 --- a/proto/observer/query.proto +++ b/proto/observer/query.proto @@ -2,11 +2,13 @@ syntax = "proto3"; package zetachain.zetacore.observer; import "common/common.proto"; +import "common/ethereum/ethereum.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "observer/ballot.proto"; import "observer/blame.proto"; +import "observer/headers.proto"; import "observer/keygen.proto"; import "observer/node_account.proto"; import "observer/observer.proto"; @@ -79,6 +81,31 @@ service Query { rpc GetAllBlameRecords(QueryAllBlameRecordsRequest) returns (QueryAllBlameRecordsResponse) { option (google.api.http).get = "/zeta-chain/observer/get_all_blame_records"; } + + rpc GetAllBlockHeaders(QueryAllBlockHeaderRequest) returns (QueryAllBlockHeaderResponse) { + option (google.api.http).get = "/zeta-chain/observer/get_all_block_headers"; + } + + rpc GetBlockHeaderByHash(QueryGetBlockHeaderByHashRequest) returns (QueryGetBlockHeaderByHashResponse) { + option (google.api.http).get = "/zeta-chain/observer/get_block_header_by_hash/{block_hash}"; + } + + // merkle proof verification + rpc Prove(QueryProveRequest) returns (QueryProveResponse) { + option (google.api.http).get = "/zeta-chain/observer/prove"; + } +} + +message QueryProveRequest { + uint64 chain_id = 1; + string tx_hash = 2; + ethereum.Proof proof = 5; + string block_hash = 6; + int64 tx_index = 7; +} + +message QueryProveResponse { + bool valid = 1; } message QueryParamsRequest {} @@ -185,3 +212,20 @@ message QueryAllBlameRecordsRequest {} message QueryAllBlameRecordsResponse { repeated Blame blame_info = 1; } + +message QueryAllBlockHeaderRequest { + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +message QueryAllBlockHeaderResponse { + repeated BlockHeader block_headers = 1; + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +message QueryGetBlockHeaderByHashRequest { + bytes block_hash = 1; +} + +message QueryGetBlockHeaderByHashResponse { + BlockHeader block_header = 1; +} diff --git a/proto/observer/tx.proto b/proto/observer/tx.proto index 76a414cbae..589030dc74 100644 --- a/proto/observer/tx.proto +++ b/proto/observer/tx.proto @@ -4,6 +4,7 @@ package zetachain.zetacore.observer; import "common/common.proto"; import "gogoproto/gogo.proto"; import "observer/blame.proto"; +import "observer/headers.proto"; import "observer/observer.proto"; import "observer/params.proto"; @@ -16,8 +17,19 @@ service Msg { rpc AddBlameVote(MsgAddBlameVote) returns (MsgAddBlameVoteResponse); rpc UpdatePermissionFlags(MsgUpdatePermissionFlags) returns (MsgUpdatePermissionFlagsResponse); rpc UpdateKeygen(MsgUpdateKeygen) returns (MsgUpdateKeygenResponse); + rpc AddBlockHeader(MsgAddBlockHeader) returns (MsgAddBlockHeaderResponse); } +message MsgAddBlockHeader { + string creator = 1; + int64 chain_id = 2; + bytes block_hash = 3; + bytes block_header = 4; + int64 height = 5; +} + +message MsgAddBlockHeaderResponse {} + message MsgUpdateCoreParams { string creator = 1; CoreParams coreParams = 2; diff --git a/scripts/mocks-generate.sh b/scripts/mocks-generate.sh new file mode 100644 index 0000000000..8e7dc5222b --- /dev/null +++ b/scripts/mocks-generate.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Install mockery +go install github.com/vektra/mockery/v2@latest + +# Run generate command for mocks +cd ./testutil/keeper/mocks +go generate "mocks.go" + +# Print a message to indicate completion +echo "Mocks generated." \ No newline at end of file diff --git a/testutil/keeper/mocks/crosschain/account.go b/testutil/keeper/mocks/crosschain/account.go index 7e8c1ae7da..9044c1009c 100644 --- a/testutil/keeper/mocks/crosschain/account.go +++ b/testutil/keeper/mocks/crosschain/account.go @@ -1,10 +1,9 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - mock "github.com/stretchr/testify/mock" types "github.com/cosmos/cosmos-sdk/types" diff --git a/testutil/keeper/mocks/crosschain/bank.go b/testutil/keeper/mocks/crosschain/bank.go index 39acac1f3a..8fef8170d5 100644 --- a/testutil/keeper/mocks/crosschain/bank.go +++ b/testutil/keeper/mocks/crosschain/bank.go @@ -1,10 +1,11 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks import ( - types "github.com/cosmos/cosmos-sdk/types" mock "github.com/stretchr/testify/mock" + + types "github.com/cosmos/cosmos-sdk/types" ) // CrosschainBankKeeper is an autogenerated mock type for the CrosschainBankKeeper type diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index 8daca22327..7b8b6884a3 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index 08735e93dd..252c36e1cf 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -1,11 +1,10 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks import ( - common "github.com/zeta-chain/zetacore/common" - mock "github.com/stretchr/testify/mock" + common "github.com/zeta-chain/zetacore/common" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -173,6 +172,30 @@ func (_m *CrosschainObserverKeeper) GetBallot(ctx types.Context, index string) ( return r0, r1 } +// GetBlockHeader provides a mock function with given fields: ctx, hash +func (_m *CrosschainObserverKeeper) GetBlockHeader(ctx types.Context, hash []byte) (observertypes.BlockHeader, bool) { + ret := _m.Called(ctx, hash) + + var r0 observertypes.BlockHeader + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, []byte) (observertypes.BlockHeader, bool)); ok { + return rf(ctx, hash) + } + if rf, ok := ret.Get(0).(func(types.Context, []byte) observertypes.BlockHeader); ok { + r0 = rf(ctx, hash) + } else { + r0 = ret.Get(0).(observertypes.BlockHeader) + } + + if rf, ok := ret.Get(1).(func(types.Context, []byte) bool); ok { + r1 = rf(ctx, hash) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 +} + // GetCoreParamsByChainID provides a mock function with given fields: ctx, chainID func (_m *CrosschainObserverKeeper) GetCoreParamsByChainID(ctx types.Context, chainID int64) (*observertypes.CoreParams, bool) { ret := _m.Called(ctx, chainID) diff --git a/testutil/keeper/mocks/crosschain/staking.go b/testutil/keeper/mocks/crosschain/staking.go index a6c02e638d..f35ad1190d 100644 --- a/testutil/keeper/mocks/crosschain/staking.go +++ b/testutil/keeper/mocks/crosschain/staking.go @@ -1,11 +1,12 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks import ( - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" mock "github.com/stretchr/testify/mock" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + types "github.com/cosmos/cosmos-sdk/types" ) diff --git a/testutil/keeper/mocks/fungible/account.go b/testutil/keeper/mocks/fungible/account.go index 301f6d882a..d94cae3a4f 100644 --- a/testutil/keeper/mocks/fungible/account.go +++ b/testutil/keeper/mocks/fungible/account.go @@ -1,10 +1,9 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - mock "github.com/stretchr/testify/mock" types "github.com/cosmos/cosmos-sdk/types" diff --git a/testutil/keeper/mocks/fungible/bank.go b/testutil/keeper/mocks/fungible/bank.go index dbbb384d3e..3d78731354 100644 --- a/testutil/keeper/mocks/fungible/bank.go +++ b/testutil/keeper/mocks/fungible/bank.go @@ -1,10 +1,9 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - mock "github.com/stretchr/testify/mock" types "github.com/cosmos/cosmos-sdk/types" diff --git a/testutil/keeper/mocks/fungible/evm.go b/testutil/keeper/mocks/fungible/evm.go index e05034a958..42e3917ec1 100644 --- a/testutil/keeper/mocks/fungible/evm.go +++ b/testutil/keeper/mocks/fungible/evm.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go index 7d8248a6ae..3dee529922 100644 --- a/testutil/keeper/mocks/fungible/observer.go +++ b/testutil/keeper/mocks/fungible/observer.go @@ -1,11 +1,10 @@ -// Code generated by mockery v2.32.3. DO NOT EDIT. +// Code generated by mockery v2.33.2. DO NOT EDIT. package mocks import ( - common "github.com/zeta-chain/zetacore/common" - mock "github.com/stretchr/testify/mock" + common "github.com/zeta-chain/zetacore/common" observertypes "github.com/zeta-chain/zetacore/x/observer/types" diff --git a/testutil/keeper/mocks.go b/testutil/keeper/mocks/mocks.go similarity index 74% rename from testutil/keeper/mocks.go rename to testutil/keeper/mocks/mocks.go index 90d3835197..53e5842e65 100644 --- a/testutil/keeper/mocks.go +++ b/testutil/keeper/mocks/mocks.go @@ -1,4 +1,4 @@ -package keeper +package mocks import ( crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -9,27 +9,27 @@ import ( * Crosschain Mocks */ -//go:generate mockery --name CrosschainAccountKeeper --filename account.go --case underscore --output ./mocks/crosschain +//go:generate mockery --name CrosschainAccountKeeper --filename account.go --case underscore --output ./crosschain type CrosschainAccountKeeper interface { crosschaintypes.AccountKeeper } -//go:generate mockery --name CrosschainBankKeeper --filename bank.go --case underscore --output ./mocks/crosschain +//go:generate mockery --name CrosschainBankKeeper --filename bank.go --case underscore --output ./crosschain type CrosschainBankKeeper interface { crosschaintypes.BankKeeper } -//go:generate mockery --name CrosschainStakingKeeper --filename staking.go --case underscore --output ./mocks/crosschain +//go:generate mockery --name CrosschainStakingKeeper --filename staking.go --case underscore --output ./crosschain type CrosschainStakingKeeper interface { crosschaintypes.StakingKeeper } -//go:generate mockery --name CrosschainObserverKeeper --filename observer.go --case underscore --output ./mocks/crosschain +//go:generate mockery --name CrosschainObserverKeeper --filename observer.go --case underscore --output ./crosschain type CrosschainObserverKeeper interface { crosschaintypes.ZetaObserverKeeper } -//go:generate mockery --name CrosschainFungibleKeeper --filename fungible.go --case underscore --output ./mocks/crosschain +//go:generate mockery --name CrosschainFungibleKeeper --filename fungible.go --case underscore --output ./crosschain type CrosschainFungibleKeeper interface { crosschaintypes.FungibleKeeper } @@ -38,22 +38,22 @@ type CrosschainFungibleKeeper interface { * Fungible Mocks */ -//go:generate mockery --name FungibleAccountKeeper --filename account.go --case underscore --output ./mocks/fungible +//go:generate mockery --name FungibleAccountKeeper --filename account.go --case underscore --output ./fungible type FungibleAccountKeeper interface { fungibletypes.AccountKeeper } -//go:generate mockery --name FungibleBankKeeper --filename bank.go --case underscore --output ./mocks/fungible +//go:generate mockery --name FungibleBankKeeper --filename bank.go --case underscore --output ./fungible type FungibleBankKeeper interface { fungibletypes.BankKeeper } -//go:generate mockery --name FungibleObserverKeeper --filename observer.go --case underscore --output ./mocks/fungible +//go:generate mockery --name FungibleObserverKeeper --filename observer.go --case underscore --output ./fungible type FungibleObserverKeeper interface { fungibletypes.ObserverKeeper } -//go:generate mockery --name FungibleEVMKeeper --filename evm.go --case underscore --output ./mocks/fungible +//go:generate mockery --name FungibleEVMKeeper --filename evm.go --case underscore --output ./fungible type FungibleEVMKeeper interface { fungibletypes.EVMKeeper } diff --git a/x/crosschain/client/cli/cli_out_tx_tracker.go b/x/crosschain/client/cli/cli_out_tx_tracker.go index 87535ea0be..95432badad 100644 --- a/x/crosschain/client/cli/cli_out_tx_tracker.go +++ b/x/crosschain/client/cli/cli_out_tx_tracker.go @@ -110,6 +110,9 @@ func CmdAddToWatchList() *cobra.Command { argChain, uint64(argNonce), argTxHash, + nil, // TODO: add option to provide a proof from CLI arguments https://github.com/zeta-chain/node/issues/1134 + "", + -1, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/x/crosschain/keeper/keeper_out_tx_tracker.go b/x/crosschain/keeper/keeper_out_tx_tracker.go index 030d12eadb..75b6e9cd1d 100644 --- a/x/crosschain/keeper/keeper_out_tx_tracker.go +++ b/x/crosschain/keeper/keeper_out_tx_tracker.go @@ -9,6 +9,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" + eth "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" "github.com/zeta-chain/zetacore/x/crosschain/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" @@ -167,16 +170,65 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO return nil, zetaObserverTypes.ErrSupportedChains } - adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_out_tx_tracker) - isAdmin := msg.Creator == adminPolicyAccount + if msg.Proof == nil { // without proof, only certain accounts can send this message + adminPolicyAccount := k.zetaObserverKeeper.GetParams(ctx).GetAdminPolicyAccount(zetaObserverTypes.Policy_Type_out_tx_tracker) + isAdmin := msg.Creator == adminPolicyAccount - isObserver, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain) - if err != nil { - ctx.Logger().Error("Error while checking if the account is an observer", err) + isObserver, err := k.zetaObserverKeeper.IsAuthorized(ctx, msg.Creator, chain) + if err != nil { + ctx.Logger().Error("Error while checking if the account is an observer", err) + return nil, sdkerrors.Wrap(zetaObserverTypes.ErrNotAuthorized, fmt.Sprintf("error IsAuthorized %s", msg.Creator)) + } + // Sender needs to be either the admin policy account or an observer + if !(isAdmin || isObserver) { + return nil, sdkerrors.Wrap(zetaObserverTypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator)) + } } - // Sender needs to be either the admin policy account or an observer - if !(isAdmin || isObserver) { - return nil, sdkerrors.Wrap(zetaObserverTypes.ErrNotAuthorized, fmt.Sprintf("Creator %s", msg.Creator)) + + proven := false + if msg.Proof != nil { + blockHash := eth.HexToHash(msg.BlockHash) + res, found := k.zetaObserverKeeper.GetBlockHeader(ctx, blockHash.Bytes()) + if !found { + return nil, sdkerrors.Wrap(zetaObserverTypes.ErrBlockHeaderNotFound, fmt.Sprintf("block header not found %s", msg.BlockHash)) + } + var header ethtypes.Header + err := rlp.DecodeBytes(res.Header, &header) + if err != nil { + return nil, err + } + val, err := msg.Proof.Verify(header.TxHash, int(msg.TxIndex)) + if err == nil { + var txx ethtypes.Transaction + err = txx.UnmarshalBinary(val) + if err != nil { + return nil, err + } + signer := ethtypes.NewLondonSigner(txx.ChainId()) + sender, err := ethtypes.Sender(signer, &txx) + if err != nil { + return nil, err + } + res, err := k.GetTssAddress(ctx, &types.QueryGetTssAddressRequest{}) + if err != nil { + return nil, err + } + tssAddr := eth.HexToAddress(res.Eth) + if tssAddr == (eth.Address{}) { + return nil, fmt.Errorf("tss address not found") + } + if sender != tssAddr { + return nil, fmt.Errorf("sender is not tss address") + } + if txx.Nonce() != msg.Nonce { + return nil, fmt.Errorf("nonce mismatch") + } + proven = true + } + + if !proven { + return nil, fmt.Errorf("proof failed") + } } tracker, found := k.GetOutTxTracker(ctx, msg.ChainId, msg.Nonce) @@ -198,11 +250,23 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO for _, hash := range tracker.HashList { if strings.EqualFold(hash.TxHash, msg.TxHash) { isDup = true + if proven { + hash.Proved = true + k.SetOutTxTracker(ctx, tracker) + k.Logger(ctx).Info("Proof'd outbound transaction") + return &types.MsgAddToOutTxTrackerResponse{}, nil + } break } } if !isDup { - tracker.HashList = append(tracker.HashList, &hash) + if proven { + hash.Proved = true + tracker.HashList = append([]*types.TxHashList{&hash}, tracker.HashList...) + k.Logger(ctx).Info("Proof'd outbound transaction") + } else { + tracker.HashList = append(tracker.HashList, &hash) + } k.SetOutTxTracker(ctx, tracker) } return &types.MsgAddToOutTxTrackerResponse{}, nil diff --git a/x/crosschain/types/cctx_utils.go b/x/crosschain/types/cctx_utils.go index ba2afd7918..d05eb24f3a 100644 --- a/x/crosschain/types/cctx_utils.go +++ b/x/crosschain/types/cctx_utils.go @@ -26,5 +26,6 @@ func GetAllAuthzZetaclientTxTypes() []string { sdk.MsgTypeURL(&MsgAddToOutTxTracker{}), sdk.MsgTypeURL(&MsgSetNodeKeys{}), sdk.MsgTypeURL(&types.MsgAddBlameVote{}), + sdk.MsgTypeURL(&types.MsgAddBlockHeader{}), } } diff --git a/x/crosschain/types/errors.go b/x/crosschain/types/errors.go index aa78a52a87..413740dd60 100644 --- a/x/crosschain/types/errors.go +++ b/x/crosschain/types/errors.go @@ -30,4 +30,8 @@ var ( ErrDeployContract = errorsmod.Register(ModuleName, 1129, "Unable to deploy contract") ErrUnableToUpdateTss = errorsmod.Register(ModuleName, 1130, "Unable to update TSS address") ErrNotEnoughFunds = errorsmod.Register(ModuleName, 1131, "Not enough funds") + + ErrProofVerificationFail = errorsmod.Register(ModuleName, 1132, "Proof verification fail") + ErrCannotFindCctx = errorsmod.Register(ModuleName, 1133, "Cannot find cctx") + ErrStatusNotPending = errorsmod.Register(ModuleName, 1134, "Status not pending") ) diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index fe35310c01..53a540c927 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -66,6 +66,7 @@ type ZetaObserverKeeper interface { IsAuthorized(ctx sdk.Context, address string, chain *common.Chain) (bool, error) FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType zetaObserverTypes.ObservationType) (ballot zetaObserverTypes.Ballot, isNew bool, err error) AddBallotToList(ctx sdk.Context, ballot zetaObserverTypes.Ballot) + GetBlockHeader(ctx sdk.Context, hash []byte) (val zetaObserverTypes.BlockHeader, found bool) } type FungibleKeeper interface { diff --git a/x/crosschain/types/message_add_to_out_tx_tracker.go b/x/crosschain/types/message_add_to_out_tx_tracker.go index cdb878dd93..dffccbb32b 100644 --- a/x/crosschain/types/message_add_to_out_tx_tracker.go +++ b/x/crosschain/types/message_add_to_out_tx_tracker.go @@ -3,18 +3,22 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/zeta-chain/zetacore/common/ethereum" ) const TypeMsgAddToOutTxTracker = "AddToTracker" var _ sdk.Msg = &MsgAddToOutTxTracker{} -func NewMsgAddToOutTxTracker(creator string, chain int64, nonce uint64, txHash string) *MsgAddToOutTxTracker { +func NewMsgAddToOutTxTracker(creator string, chain int64, nonce uint64, txHash string, proof *ethereum.Proof, blockHash string, txIndex int64) *MsgAddToOutTxTracker { return &MsgAddToOutTxTracker{ - Creator: creator, - ChainId: chain, - Nonce: nonce, - TxHash: txHash, + Creator: creator, + ChainId: chain, + Nonce: nonce, + TxHash: txHash, + Proof: proof, + BlockHash: blockHash, + TxIndex: txIndex, } } diff --git a/x/crosschain/types/out_tx_tracker.pb.go b/x/crosschain/types/out_tx_tracker.pb.go index 86eba158a2..d9d021851a 100644 --- a/x/crosschain/types/out_tx_tracker.pb.go +++ b/x/crosschain/types/out_tx_tracker.pb.go @@ -26,6 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type TxHashList struct { TxHash string `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` TxSigner string `protobuf:"bytes,2,opt,name=tx_signer,json=txSigner,proto3" json:"tx_signer,omitempty"` + Proved bool `protobuf:"varint,3,opt,name=proved,proto3" json:"proved,omitempty"` } func (m *TxHashList) Reset() { *m = TxHashList{} } @@ -75,6 +76,13 @@ func (m *TxHashList) GetTxSigner() string { return "" } +func (m *TxHashList) GetProved() bool { + if m != nil { + return m.Proved + } + return false +} + type OutTxTracker struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -151,25 +159,26 @@ func init() { func init() { proto.RegisterFile("crosschain/out_tx_tracker.proto", fileDescriptor_5638c11005e4d36d) } var fileDescriptor_5638c11005e4d36d = []byte{ - // 287 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xb1, 0x4e, 0xf3, 0x30, - 0x14, 0x85, 0xeb, 0xbf, 0xfd, 0xdb, 0xc6, 0x30, 0x59, 0x48, 0x04, 0x21, 0x4c, 0xd4, 0x29, 0x0c, - 0x38, 0x02, 0xde, 0xa0, 0x03, 0x02, 0x81, 0x84, 0x14, 0x32, 0xb1, 0x58, 0x69, 0x62, 0xd5, 0x16, - 0x10, 0x57, 0xf6, 0x8d, 0x64, 0x78, 0x0a, 0x5e, 0x80, 0xf7, 0x61, 0xec, 0xc8, 0x88, 0x92, 0x17, - 0x41, 0x71, 0x8a, 0xca, 0xc4, 0x76, 0x8f, 0x8e, 0xee, 0x77, 0xef, 0x39, 0xf8, 0xb8, 0x30, 0xda, - 0xda, 0x42, 0xe6, 0xaa, 0x4a, 0x74, 0x0d, 0x1c, 0x1c, 0x07, 0x93, 0x17, 0x8f, 0xc2, 0xb0, 0x95, - 0xd1, 0xa0, 0xc9, 0xd1, 0xab, 0x80, 0xdc, 0xfb, 0xcc, 0x4f, 0xda, 0x08, 0xb6, 0xdd, 0x99, 0xcd, - 0x31, 0xce, 0xdc, 0x55, 0x6e, 0xe5, 0xad, 0xb2, 0x40, 0xf6, 0xf1, 0x04, 0x1c, 0x97, 0xb9, 0x95, - 0x21, 0x8a, 0x50, 0x1c, 0xa4, 0x63, 0xf0, 0x26, 0x39, 0xc4, 0x01, 0x38, 0x6e, 0xd5, 0xb2, 0x12, - 0x26, 0xfc, 0xe7, 0xad, 0x29, 0xb8, 0x7b, 0xaf, 0x67, 0xef, 0x08, 0xef, 0xde, 0xd5, 0x90, 0xb9, - 0xac, 0xbf, 0x4c, 0xf6, 0xf0, 0x7f, 0x55, 0x95, 0xc2, 0x6d, 0x20, 0xbd, 0x20, 0x07, 0x78, 0xea, - 0x6f, 0x72, 0x55, 0x7a, 0xc4, 0x30, 0x9d, 0x78, 0x7d, 0x5d, 0x76, 0x0b, 0x95, 0xae, 0x0a, 0x11, - 0x0e, 0x23, 0x14, 0x8f, 0xd2, 0x5e, 0x90, 0x4b, 0x1c, 0x74, 0xaf, 0xf0, 0x27, 0x65, 0x21, 0x1c, - 0x45, 0xc3, 0x78, 0xe7, 0xfc, 0x84, 0xfd, 0x19, 0x87, 0x6d, 0xb3, 0xa4, 0x53, 0xb9, 0x99, 0xe6, - 0x37, 0x1f, 0x0d, 0x45, 0xeb, 0x86, 0xa2, 0xaf, 0x86, 0xa2, 0xb7, 0x96, 0x0e, 0xd6, 0x2d, 0x1d, - 0x7c, 0xb6, 0x74, 0xf0, 0x70, 0xb6, 0x54, 0x20, 0xeb, 0x05, 0x2b, 0xf4, 0x73, 0xd2, 0xe1, 0x4e, - 0xfb, 0x22, 0x7f, 0xc8, 0x89, 0x4b, 0x7e, 0xd5, 0x0b, 0x2f, 0x2b, 0x61, 0x17, 0x63, 0x5f, 0xeb, - 0xc5, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x97, 0x57, 0xaa, 0x79, 0x01, 0x00, 0x00, + // 299 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xb1, 0x4e, 0xeb, 0x30, + 0x14, 0x86, 0xeb, 0xdb, 0xde, 0x36, 0x35, 0x4c, 0x16, 0x82, 0x20, 0x84, 0xa9, 0x3a, 0x95, 0x01, + 0x47, 0xc0, 0x1b, 0x30, 0x20, 0x10, 0x48, 0x48, 0xa1, 0x53, 0x17, 0x2b, 0x4d, 0xac, 0xda, 0x02, + 0xe2, 0xc8, 0x3e, 0x41, 0x86, 0xa7, 0xe0, 0x05, 0x78, 0x1f, 0xc6, 0x8e, 0x8c, 0x28, 0x79, 0x11, + 0x14, 0x27, 0xa8, 0x4c, 0x6c, 0xe7, 0xd3, 0xd1, 0xf9, 0xf4, 0x9f, 0x1f, 0x1f, 0xa5, 0x46, 0x5b, + 0x9b, 0xca, 0x44, 0xe5, 0x91, 0x2e, 0x81, 0x83, 0xe3, 0x60, 0x92, 0xf4, 0x41, 0x18, 0x56, 0x18, + 0x0d, 0x9a, 0x1c, 0xbe, 0x0a, 0x48, 0xfc, 0x9e, 0xf9, 0x49, 0x1b, 0xc1, 0x36, 0x37, 0xd3, 0x05, + 0xc6, 0x73, 0x77, 0x95, 0x58, 0x79, 0xab, 0x2c, 0x90, 0x3d, 0x3c, 0x02, 0xc7, 0x65, 0x62, 0x65, + 0x88, 0x26, 0x68, 0x36, 0x8e, 0x87, 0xe0, 0x97, 0xe4, 0x00, 0x8f, 0xc1, 0x71, 0xab, 0x56, 0xb9, + 0x30, 0xe1, 0x3f, 0xbf, 0x0a, 0xc0, 0xdd, 0x7b, 0x26, 0xbb, 0x78, 0x58, 0x18, 0xfd, 0x2c, 0xb2, + 0xb0, 0x3f, 0x41, 0xb3, 0x20, 0xee, 0x68, 0xfa, 0x8e, 0xf0, 0xf6, 0x5d, 0x09, 0x73, 0x37, 0x6f, + 0x13, 0x91, 0x1d, 0xfc, 0x5f, 0xe5, 0x99, 0x70, 0x9d, 0xbc, 0x05, 0xb2, 0x8f, 0x03, 0x9f, 0x85, + 0xab, 0xcc, 0xab, 0xfb, 0xf1, 0xc8, 0xf3, 0x75, 0xd6, 0x1c, 0xe4, 0x3a, 0x4f, 0x85, 0x17, 0x0f, + 0xe2, 0x16, 0xc8, 0x25, 0x1e, 0x37, 0x11, 0xf9, 0xa3, 0xb2, 0x10, 0x0e, 0x26, 0xfd, 0xd9, 0xd6, + 0xd9, 0x31, 0xfb, 0xf3, 0x4d, 0xb6, 0xf9, 0x31, 0x0e, 0x64, 0x37, 0x5d, 0xdc, 0x7c, 0x54, 0x14, + 0xad, 0x2b, 0x8a, 0xbe, 0x2a, 0x8a, 0xde, 0x6a, 0xda, 0x5b, 0xd7, 0xb4, 0xf7, 0x59, 0xd3, 0xde, + 0xe2, 0x74, 0xa5, 0x40, 0x96, 0x4b, 0x96, 0xea, 0xa7, 0xa8, 0xd1, 0x9d, 0xb4, 0x05, 0xff, 0x98, + 0x23, 0x17, 0xfd, 0xaa, 0x1d, 0x5e, 0x0a, 0x61, 0x97, 0x43, 0x5f, 0xf7, 0xf9, 0x77, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x0c, 0x73, 0x3d, 0x85, 0x91, 0x01, 0x00, 0x00, } func (m *TxHashList) Marshal() (dAtA []byte, err error) { @@ -192,6 +201,16 @@ func (m *TxHashList) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Proved { + i-- + if m.Proved { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } if len(m.TxSigner) > 0 { i -= len(m.TxSigner) copy(dAtA[i:], m.TxSigner) @@ -288,6 +307,9 @@ func (m *TxHashList) Size() (n int) { if l > 0 { n += 1 + l + sovOutTxTracker(uint64(l)) } + if m.Proved { + n += 2 + } return n } @@ -415,6 +437,26 @@ func (m *TxHashList) Unmarshal(dAtA []byte) error { } m.TxSigner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Proved", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOutTxTracker + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Proved = bool(v != 0) default: iNdEx = preIndex skippy, err := skipOutTxTracker(dAtA[iNdEx:]) diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index da54881dd4..a27cf5db9f 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -15,6 +15,7 @@ import ( grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" common "github.com/zeta-chain/zetacore/common" + ethereum "github.com/zeta-chain/zetacore/common/ethereum" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -248,10 +249,13 @@ func (m *MsgWhitelistERC20Response) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWhitelistERC20Response proto.InternalMessageInfo type MsgAddToOutTxTracker struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` - TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` + TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + Proof *ethereum.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` + BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` } func (m *MsgAddToOutTxTracker) Reset() { *m = MsgAddToOutTxTracker{} } @@ -315,6 +319,27 @@ func (m *MsgAddToOutTxTracker) GetTxHash() string { return "" } +func (m *MsgAddToOutTxTracker) GetProof() *ethereum.Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *MsgAddToOutTxTracker) GetBlockHash() string { + if m != nil { + return m.BlockHash + } + return "" +} + +func (m *MsgAddToOutTxTracker) GetTxIndex() int64 { + if m != nil { + return m.TxIndex + } + return 0 +} + type MsgAddToOutTxTrackerResponse struct { } @@ -1206,90 +1231,93 @@ func init() { func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) } var fileDescriptor_81d6d611190b7635 = []byte{ - // 1316 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xcb, 0x6e, 0xdb, 0x46, - 0x17, 0x36, 0x63, 0x5b, 0x96, 0x8e, 0x2d, 0xc7, 0x1e, 0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 0xe6, 0x15, 0x58, 0x3d, 0x21, 0x9e, 0x85, 0x69, 0x8b, 0x44, 0x14, 0x9b, 0xbf, 0x6a, 0xb0, 0x58, - 0xa5, 0xfe, 0x97, 0x8d, 0x80, 0xe1, 0x66, 0x40, 0xd9, 0x43, 0x6b, 0x6b, 0xe3, 0xce, 0x90, 0x6c, - 0xd7, 0xa1, 0x88, 0x63, 0x77, 0xe3, 0x8e, 0xed, 0xc8, 0x40, 0x2a, 0xe1, 0x9c, 0x50, 0x26, 0x60, - 0x2f, 0x41, 0x5e, 0xd4, 0x6d, 0x07, 0x9e, 0x3e, 0x79, 0x55, 0xbb, 0x35, 0x69, 0xcd, 0x08, 0xf9, - 0xb1, 0x87, 0x10, 0x4c, 0x45, 0x4e, 0x88, 0xf5, 0x29, 0xe1, 0x26, 0xc6, 0xe8, 0x22, 0xe4, 0x68, - 0x37, 0xac, 0x93, 0xa6, 0x3e, 0x2d, 0xb4, 0x4a, 0x42, 0x06, 0xe4, 0x3d, 0xec, 0x06, 0xa1, 0xd3, - 0xa4, 0x7a, 0xee, 0xaa, 0x76, 0xab, 0x68, 0xa5, 0x32, 0x5a, 0x85, 0x82, 0xef, 0x50, 0xbb, 0x19, - 0x84, 0x01, 0xd3, 0x67, 0x44, 0x8e, 0xbc, 0xef, 0xd0, 0xcf, 0xb9, 0x6c, 0xae, 0xc2, 0xa5, 0x63, - 0x35, 0xa5, 0x15, 0xbf, 0x84, 0xe5, 0x2a, 0xf5, 0x1f, 0x78, 0x5e, 0x8d, 0xec, 0xb6, 0x59, 0xad, - 0x53, 0x8b, 0x1d, 0x77, 0x1f, 0xc7, 0x43, 0x6a, 0xee, 0x2d, 0xe7, 0x5c, 0xb6, 0x9c, 0x65, 0x98, - 0x8e, 0x48, 0xe4, 0x62, 0x51, 0xe6, 0x94, 0x25, 0x05, 0xb4, 0x02, 0x33, 0xac, 0x63, 0x37, 0x1c, - 0xda, 0x50, 0x75, 0xe6, 0x58, 0xe7, 0x91, 0x43, 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xef, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0xf3, 0xa1, 0x90, 0x03, - 0xb0, 0x0f, 0x00, 0x00, + // 1375 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x36, 0x89, 0x63, 0xbf, 0xc4, 0x69, 0x32, 0x49, 0x9b, 0xed, 0xa6, 0x75, 0xda, 0x2d, + 0x2d, 0x15, 0x6a, 0xec, 0xe2, 0x82, 0x28, 0x85, 0x03, 0x4d, 0x54, 0xd2, 0x50, 0x9c, 0x44, 0x1b, + 0x17, 0xa4, 0x5e, 0xac, 0xf5, 0xee, 0x64, 0xbd, 0x8a, 0x77, 0xc7, 0xda, 0x19, 0x47, 0x76, 0xc5, + 0x09, 0x89, 0x03, 0x37, 0x0e, 0x48, 0x20, 0xbe, 0x00, 0x5f, 0xa5, 0xdc, 0x2a, 0x4e, 0xfc, 0x91, + 0x2a, 0x68, 0xbe, 0x01, 0x9f, 0x00, 0xcd, 0x9f, 0xdd, 0x78, 0x9d, 0xd8, 0x4e, 0x82, 0x38, 0x79, + 0xde, 0x9b, 0xf7, 0xe7, 0xf7, 0xe6, 0xbd, 0x37, 0xf3, 0xd6, 0xb0, 0xe0, 0x44, 0x84, 0x52, 0xa7, + 0x61, 0xfb, 0x61, 0x89, 0x75, 0x8a, 0xad, 0x88, 0x30, 0x82, 0xae, 0xbd, 0xc0, 0xcc, 0x16, 0xbc, + 0xa2, 0x58, 0x91, 0x08, 0x17, 0x8f, 0xe4, 0x8c, 0x05, 0x87, 0x04, 0x01, 0x09, 0x4b, 0xf2, 0x47, + 0xea, 0x18, 0x05, 0xc5, 0xc4, 0xac, 0x81, 0x23, 0xdc, 0x0e, 0x92, 0x85, 0xda, 0x5f, 0xf4, 0x88, + 0x47, 0xc4, 0xb2, 0xc4, 0x57, 0x92, 0x6b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 0xee, 0x07, 0x0d, 0x96, 0x06, 0xdd, 0xed, + 0x1f, 0x9e, 0xd5, 0x7e, 0xa2, 0x6a, 0x3c, 0x3a, 0xb7, 0x6a, 0x6f, 0x85, 0xf6, 0x7d, 0xe7, 0x9d, + 0xa2, 0x42, 0xd3, 0x1a, 0xa7, 0xa9, 0xd0, 0x93, 0xbf, 0xbb, 0xd0, 0xd7, 0x1a, 0xcc, 0x1d, 0xfb, + 0xac, 0x2d, 0x8f, 0x36, 0xd7, 0xaf, 0x63, 0x3c, 0x3c, 0xbb, 0x4e, 0x0c, 0x62, 0xed, 0xe9, 0xcb, + 0x37, 0x05, 0xed, 0xd5, 0x9b, 0x82, 0xf6, 0xd7, 0x9b, 0x82, 0xf6, 0xdd, 0x61, 0x61, 0xec, 0xd5, + 0x61, 0x61, 0xec, 0xb7, 0xc3, 0xc2, 0xd8, 0xf3, 0x77, 0x7b, 0x5e, 0x30, 0x6e, 0x75, 0x55, 0xfe, + 0x03, 0x10, 0x3b, 0x28, 0x75, 0x4a, 0xbd, 0xff, 0x0b, 0xf0, 0x07, 0xad, 0x9e, 0x11, 0x5f, 0xec, + 0xf7, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xc9, 0xb3, 0x25, 0xb5, 0x32, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1829,6 +1857,30 @@ func (m *MsgAddToOutTxTracker) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.TxIndex != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.TxIndex)) + i-- + dAtA[i] = 0x38 + } + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x32 + } + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } if len(m.TxHash) > 0 { i -= len(m.TxHash) copy(dAtA[i:], m.TxHash) @@ -2574,6 +2626,17 @@ func (m *MsgAddToOutTxTracker) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.TxIndex != 0 { + n += 1 + sovTx(uint64(m.TxIndex)) + } return n } @@ -3443,6 +3506,93 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { } m.TxHash = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proof == nil { + m.Proof = ðereum.Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) + } + m.TxIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TxIndex |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/x/observer/keeper/grpc_query_prove.go b/x/observer/keeper/grpc_query_prove.go new file mode 100644 index 0000000000..99db2ae44a --- /dev/null +++ b/x/observer/keeper/grpc_query_prove.go @@ -0,0 +1,47 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + eth "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/rlp" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.QueryProveResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + blockHash := eth.HexToHash(req.BlockHash) + res, found := k.GetBlockHeader(ctx, blockHash.Bytes()) + if !found { + return nil, status.Error(codes.NotFound, "block header not found") + } + var header ethtypes.Header + err := rlp.DecodeBytes(res.Header, &header) + if err != nil { + return nil, status.Error(codes.Internal, fmt.Sprintf("failed to decode header: %s", err)) + } + proven := false + + val, err := req.Proof.Verify(header.TxHash, int(req.TxIndex)) + if err == nil { + var txx ethtypes.Transaction + err = txx.UnmarshalBinary(val) + if err != nil { + return nil, status.Error(codes.Internal, fmt.Sprintf("failed to unmarshal transaction: %s", err)) + } + proven = true + } + + return &types.QueryProveResponse{ + Valid: proven, + }, nil +} diff --git a/x/observer/keeper/keeper_block_header.go b/x/observer/keeper/keeper_block_header.go new file mode 100644 index 0000000000..36fba2ff14 --- /dev/null +++ b/x/observer/keeper/keeper_block_header.go @@ -0,0 +1,80 @@ +package keeper + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/query" + "github.com/zeta-chain/zetacore/x/observer/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// SetNodeAccount set a specific nodeAccount in the store from its index +func (k Keeper) SetBlockHeader(ctx sdk.Context, header types.BlockHeader) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey)) + b := k.cdc.MustMarshal(&header) + store.Set(header.Hash, b) +} + +// GetNodeAccount returns a nodeAccount from its index +func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val types.BlockHeader, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey)) + + b := store.Get(hash) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveNodeAccount removes a nodeAccount from the store +func (k Keeper) RemoveBlockHeader(ctx sdk.Context, hash []byte) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey)) + store.Delete(hash) +} + +// GRPC querier for block header +func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHeaderRequest) (*types.QueryAllBlockHeaderResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + store := ctx.KVStore(k.storeKey) + blockHeaderStore := prefix.NewStore(store, types.KeyPrefix(types.BlockHeaderKey)) + + var blockHeaders []*types.BlockHeader + pageRes, err := query.Paginate(blockHeaderStore, req.Pagination, func(key []byte, value []byte) error { + var blockHeader types.BlockHeader + if err := k.cdc.Unmarshal(value, &blockHeader); err != nil { + return err + } + + blockHeaders = append(blockHeaders, &blockHeader) + return nil + }) + if err != nil { + return nil, status.Error(codes.Internal, err.Error()) + } + return &types.QueryAllBlockHeaderResponse{BlockHeaders: blockHeaders, Pagination: pageRes}, nil +} + +func (k Keeper) GetBlockHeaderByHash(c context.Context, req *types.QueryGetBlockHeaderByHashRequest) (*types.QueryGetBlockHeaderByHashResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + if len(req.BlockHash) != 32 { + return nil, status.Error(codes.InvalidArgument, "invalid hash") + } + + header, found := k.GetBlockHeader(sdk.UnwrapSDKContext(c), req.BlockHash) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetBlockHeaderByHashResponse{BlockHeader: &header}, nil +} diff --git a/x/observer/keeper/msg_server_add_block_header.go b/x/observer/keeper/msg_server_add_block_header.go new file mode 100644 index 0000000000..caf53cffe6 --- /dev/null +++ b/x/observer/keeper/msg_server_add_block_header.go @@ -0,0 +1,58 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/x/observer/types" +) + +// MsgAddBlockHeader handles adding a block header to the store, through majority voting of observers +func (k msgServer) AddBlockHeader(goCtx context.Context, msg *types.MsgAddBlockHeader) (*types.MsgAddBlockHeaderResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + observationType := types.ObservationType_InBoundTx + chain := common.GetChainFromChainID(msg.ChainId) + ok, err := k.IsAuthorized(ctx, msg.Creator, chain) + if !ok { + return nil, err + } + + ballot, _, err := k.FindBallot(ctx, msg.Digest(), chain, observationType) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to find ballot") + } + ballot, err = k.AddVoteToBallot(ctx, ballot, msg.Creator, types.VoteType_SuccessObservation) + if err != nil { + return nil, sdkerrors.Wrap(err, "failed to add vote to ballot") + } + _, isFinalized := k.CheckIfFinalizingVote(ctx, ballot) + if !isFinalized { + return &types.MsgAddBlockHeaderResponse{}, nil + } + + _, found := k.GetBlockHeader(ctx, msg.BlockHash) + if found { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("block header with hash %s already exists", msg.BlockHeader)) + } + + pHash, err := msg.ParentHash() // error is checked in BasicValidation in msg; check again for extra caution + if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, fmt.Sprintf("failed to get parent hash: %s", err.Error())) + } + + // TODO: add check for parent block header's existence here https://github.com/zeta-chain/node/issues/1133 + + bh := types.BlockHeader{ + Header: msg.BlockHeader, + Height: msg.Height, + Hash: msg.BlockHash, + ParentHash: pHash, + ChainId: msg.ChainId, + } + + k.SetBlockHeader(ctx, bh) + return &types.MsgAddBlockHeaderResponse{}, nil +} diff --git a/x/observer/types/errors.go b/x/observer/types/errors.go index 6823988c3b..5df4dab889 100644 --- a/x/observer/types/errors.go +++ b/x/observer/types/errors.go @@ -27,4 +27,5 @@ var ( ErrInvalidCoinType = errorsmod.Register(ModuleName, 1117, "Invalid coin type") ErrObserverCountNegative = errorsmod.Register(ModuleName, 1118, "Observer count cannot be negative") ErrInvalidPubKey = errorsmod.Register(ModuleName, 1119, "Invalid PubKey") + ErrBlockHeaderNotFound = errorsmod.Register(ModuleName, 1120, "Block header not found") ) diff --git a/x/observer/types/headers.pb.go b/x/observer/types/headers.pb.go new file mode 100644 index 0000000000..63acd00960 --- /dev/null +++ b/x/observer/types/headers.pb.go @@ -0,0 +1,500 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: observer/headers.proto + +package types + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type BlockHeader struct { + Header []byte `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` + Hash []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"` + ParentHash []byte `protobuf:"bytes,4,opt,name=parentHash,proto3" json:"parentHash,omitempty"` + ChainId int64 `protobuf:"varint,5,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +} + +func (m *BlockHeader) Reset() { *m = BlockHeader{} } +func (m *BlockHeader) String() string { return proto.CompactTextString(m) } +func (*BlockHeader) ProtoMessage() {} +func (*BlockHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_2b67bad3a61a5de9, []int{0} +} +func (m *BlockHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BlockHeader.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 *BlockHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockHeader.Merge(m, src) +} +func (m *BlockHeader) XXX_Size() int { + return m.Size() +} +func (m *BlockHeader) XXX_DiscardUnknown() { + xxx_messageInfo_BlockHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_BlockHeader proto.InternalMessageInfo + +func (m *BlockHeader) GetHeader() []byte { + if m != nil { + return m.Header + } + return nil +} + +func (m *BlockHeader) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *BlockHeader) GetHash() []byte { + if m != nil { + return m.Hash + } + return nil +} + +func (m *BlockHeader) GetParentHash() []byte { + if m != nil { + return m.ParentHash + } + return nil +} + +func (m *BlockHeader) GetChainId() int64 { + if m != nil { + return m.ChainId + } + return 0 +} + +func init() { + proto.RegisterType((*BlockHeader)(nil), "zetachain.zetacore.observer.BlockHeader") +} + +func init() { proto.RegisterFile("observer/headers.proto", fileDescriptor_2b67bad3a61a5de9) } + +var fileDescriptor_2b67bad3a61a5de9 = []byte{ + // 245 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcb, 0x4f, 0x2a, 0x4e, + 0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0xcf, 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x2a, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, + 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x4a, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xea, 0xf4, 0x41, + 0x2c, 0x88, 0x16, 0x29, 0x71, 0xb8, 0x51, 0x30, 0x06, 0x44, 0x42, 0xa9, 0x87, 0x91, 0x8b, 0xdb, + 0x29, 0x27, 0x3f, 0x39, 0xdb, 0x03, 0x6c, 0x85, 0x90, 0x18, 0x17, 0x1b, 0xc4, 0x32, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0x9e, 0x20, 0x28, 0x0f, 0x22, 0x9e, 0x99, 0x9e, 0x51, 0x22, 0xc1, 0xa4, 0xc0, + 0xa8, 0xc1, 0x1c, 0x04, 0xe5, 0x09, 0x09, 0x71, 0xb1, 0x64, 0x24, 0x16, 0x67, 0x48, 0x30, 0x83, + 0x55, 0x83, 0xd9, 0x42, 0x72, 0x5c, 0x5c, 0x05, 0x89, 0x45, 0xa9, 0x79, 0x25, 0x1e, 0x20, 0x19, + 0x16, 0xb0, 0x0c, 0x92, 0x88, 0x90, 0x24, 0x17, 0x07, 0xd8, 0xf5, 0xf1, 0x99, 0x29, 0x12, 0xac, + 0x60, 0xd3, 0xd8, 0xc1, 0x7c, 0xcf, 0x14, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, + 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, + 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, + 0xf9, 0x5a, 0x17, 0xac, 0x45, 0x1f, 0x16, 0x00, 0xfa, 0x15, 0x70, 0x9f, 0xe9, 0x97, 0x54, 0x16, + 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x3d, 0x68, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xba, 0x02, 0xb5, + 0x91, 0x46, 0x01, 0x00, 0x00, +} + +func (m *BlockHeader) 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 *BlockHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ChainId != 0 { + i = encodeVarintHeaders(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x28 + } + if len(m.ParentHash) > 0 { + i -= len(m.ParentHash) + copy(dAtA[i:], m.ParentHash) + i = encodeVarintHeaders(dAtA, i, uint64(len(m.ParentHash))) + i-- + dAtA[i] = 0x22 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintHeaders(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x1a + } + if m.Height != 0 { + i = encodeVarintHeaders(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x10 + } + if len(m.Header) > 0 { + i -= len(m.Header) + copy(dAtA[i:], m.Header) + i = encodeVarintHeaders(dAtA, i, uint64(len(m.Header))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintHeaders(dAtA []byte, offset int, v uint64) int { + offset -= sovHeaders(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BlockHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Header) + if l > 0 { + n += 1 + l + sovHeaders(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovHeaders(uint64(m.Height)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovHeaders(uint64(l)) + } + l = len(m.ParentHash) + if l > 0 { + n += 1 + l + sovHeaders(uint64(l)) + } + if m.ChainId != 0 { + n += 1 + sovHeaders(uint64(m.ChainId)) + } + return n +} + +func sovHeaders(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozHeaders(x uint64) (n int) { + return sovHeaders(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *BlockHeader) 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 ErrIntOverflowHeaders + } + 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: BlockHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BlockHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeaders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthHeaders + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthHeaders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Header = append(m.Header[:0], dAtA[iNdEx:postIndex]...) + if m.Header == nil { + m.Header = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeaders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeaders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthHeaders + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthHeaders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParentHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowHeaders + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthHeaders + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthHeaders + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ParentHash = append(m.ParentHash[:0], dAtA[iNdEx:postIndex]...) + if m.ParentHash == nil { + m.ParentHash = []byte{} + } + iNdEx = postIndex + case 5: + 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 ErrIntOverflowHeaders + } + 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 := skipHeaders(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthHeaders + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipHeaders(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHeaders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHeaders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowHeaders + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthHeaders + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupHeaders + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthHeaders + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthHeaders = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowHeaders = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupHeaders = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/observer/types/keys.go b/x/observer/types/keys.go index 4dc482976f..c21e731c22 100644 --- a/x/observer/types/keys.go +++ b/x/observer/types/keys.go @@ -43,6 +43,7 @@ const ( LastBlockObserverCountKey = "ObserverCount-value-" NodeAccountKey = "NodeAccount-value-" KeygenKey = "Keygen-value-" + BlockHeaderKey = "BlockHeader-value-" BallotListKey = "BallotList-value-" ) diff --git a/x/observer/types/messages_add_block_header.go b/x/observer/types/messages_add_block_header.go new file mode 100644 index 0000000000..d216494393 --- /dev/null +++ b/x/observer/types/messages_add_block_header.go @@ -0,0 +1,101 @@ +package types + +import ( + "bytes" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/rlp" + "github.com/zeta-chain/zetacore/common" +) + +var _ sdk.Msg = &MsgAddBlockHeader{} + +const ( + TypeMsgAddBlockHeader = "add_block_header" +) + +func NewMsgAddBlockHeader(creator string, chainID int64, blockHash []byte, height int64, header []byte) *MsgAddBlockHeader { + return &MsgAddBlockHeader{ + Creator: creator, + ChainId: chainID, + BlockHash: blockHash, + Height: height, + BlockHeader: header, + } +} + +func (msg *MsgAddBlockHeader) Route() string { + return RouterKey +} + +func (msg *MsgAddBlockHeader) Type() string { + return TypeMsgAddBlockHeader +} + +func (msg *MsgAddBlockHeader) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgAddBlockHeader) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgAddBlockHeader) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + + if len(msg.BlockHash) > 32 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid msg.txhash; too long (%d)", len(msg.BlockHash)) + } + if len(msg.BlockHeader) > 1024 { // on ethereum the block header is ~538 bytes in RLP encoding + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid msg.blockheader; too long (%d)", len(msg.BlockHeader)) + } + if common.IsEthereum(msg.ChainId) { + // RLP encoded block header + var header types.Header + err = rlp.DecodeBytes(msg.BlockHeader, &header) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header; cannot decode RLP (%s)", err) + } + if err = header.SanityCheck(); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header; sanity check failed (%s)", err) + } + if bytes.Compare(msg.BlockHash, header.Hash().Bytes()) != 0 { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header; tx hash mismatch") + } + if msg.Height != header.Number.Int64() { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block header; height mismatch") + } + } else { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid chain id (%d)", msg.ChainId) + } + + return nil +} + +func (msg *MsgAddBlockHeader) Digest() string { + m := *msg + m.Creator = "" + hash := crypto.Keccak256Hash([]byte(m.String())) + return hash.Hex() +} + +func (msg *MsgAddBlockHeader) ParentHash() ([]byte, error) { + var header types.Header + err := rlp.DecodeBytes(msg.BlockHeader, &header) + if err != nil { + return nil, err + } + + return header.ParentHash.Bytes(), nil +} diff --git a/x/observer/types/query.pb.go b/x/observer/types/query.pb.go index 7bc6e87576..91ff1026cf 100644 --- a/x/observer/types/query.pb.go +++ b/x/observer/types/query.pb.go @@ -15,6 +15,7 @@ import ( grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" common "github.com/zeta-chain/zetacore/common" + ethereum "github.com/zeta-chain/zetacore/common/ethereum" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -32,6 +33,126 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type QueryProveRequest struct { + ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + Proof *ethereum.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` + BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` +} + +func (m *QueryProveRequest) Reset() { *m = QueryProveRequest{} } +func (m *QueryProveRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProveRequest) ProtoMessage() {} +func (*QueryProveRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{0} +} +func (m *QueryProveRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProveRequest.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 *QueryProveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProveRequest.Merge(m, src) +} +func (m *QueryProveRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProveRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProveRequest proto.InternalMessageInfo + +func (m *QueryProveRequest) GetChainId() uint64 { + if m != nil { + return m.ChainId + } + return 0 +} + +func (m *QueryProveRequest) GetTxHash() string { + if m != nil { + return m.TxHash + } + return "" +} + +func (m *QueryProveRequest) GetProof() *ethereum.Proof { + if m != nil { + return m.Proof + } + return nil +} + +func (m *QueryProveRequest) GetBlockHash() string { + if m != nil { + return m.BlockHash + } + return "" +} + +func (m *QueryProveRequest) GetTxIndex() int64 { + if m != nil { + return m.TxIndex + } + return 0 +} + +type QueryProveResponse struct { + Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` +} + +func (m *QueryProveResponse) Reset() { *m = QueryProveResponse{} } +func (m *QueryProveResponse) String() string { return proto.CompactTextString(m) } +func (*QueryProveResponse) ProtoMessage() {} +func (*QueryProveResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{1} +} +func (m *QueryProveResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProveResponse.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 *QueryProveResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProveResponse.Merge(m, src) +} +func (m *QueryProveResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryProveResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProveResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProveResponse proto.InternalMessageInfo + +func (m *QueryProveResponse) GetValid() bool { + if m != nil { + return m.Valid + } + return false +} + type QueryParamsRequest struct { } @@ -39,7 +160,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{0} + return fileDescriptor_dcb801e455adaee4, []int{2} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -78,7 +199,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{1} + return fileDescriptor_dcb801e455adaee4, []int{3} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -122,7 +243,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_dcb801e455adaee4, []int{2} + return fileDescriptor_dcb801e455adaee4, []int{4} } func (m *QueryBallotByIdentifierRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -167,7 +288,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_dcb801e455adaee4, []int{3} + return fileDescriptor_dcb801e455adaee4, []int{5} } func (m *VoterList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -221,7 +342,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_dcb801e455adaee4, []int{4} + return fileDescriptor_dcb801e455adaee4, []int{6} } func (m *QueryBallotByIdentifierResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -286,7 +407,7 @@ func (m *QueryObserversByChainRequest) Reset() { *m = QueryObserversByCh func (m *QueryObserversByChainRequest) String() string { return proto.CompactTextString(m) } func (*QueryObserversByChainRequest) ProtoMessage() {} func (*QueryObserversByChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{5} + return fileDescriptor_dcb801e455adaee4, []int{7} } func (m *QueryObserversByChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -330,7 +451,7 @@ func (m *QueryObserversByChainResponse) Reset() { *m = QueryObserversByC func (m *QueryObserversByChainResponse) String() string { return proto.CompactTextString(m) } func (*QueryObserversByChainResponse) ProtoMessage() {} func (*QueryObserversByChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{6} + return fileDescriptor_dcb801e455adaee4, []int{8} } func (m *QueryObserversByChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -373,7 +494,7 @@ func (m *QueryAllObserverMappersRequest) Reset() { *m = QueryAllObserver func (m *QueryAllObserverMappersRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllObserverMappersRequest) ProtoMessage() {} func (*QueryAllObserverMappersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{7} + return fileDescriptor_dcb801e455adaee4, []int{9} } func (m *QueryAllObserverMappersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -410,7 +531,7 @@ func (m *QueryAllObserverMappersResponse) Reset() { *m = QueryAllObserve func (m *QueryAllObserverMappersResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllObserverMappersResponse) ProtoMessage() {} func (*QueryAllObserverMappersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{8} + return fileDescriptor_dcb801e455adaee4, []int{10} } func (m *QueryAllObserverMappersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -453,7 +574,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_dcb801e455adaee4, []int{9} + return fileDescriptor_dcb801e455adaee4, []int{11} } func (m *QuerySupportedChains) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -490,7 +611,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_dcb801e455adaee4, []int{10} + return fileDescriptor_dcb801e455adaee4, []int{12} } func (m *QuerySupportedChainsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -534,7 +655,7 @@ func (m *QueryGetCoreParamsForChainRequest) Reset() { *m = QueryGetCoreP func (m *QueryGetCoreParamsForChainRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetCoreParamsForChainRequest) ProtoMessage() {} func (*QueryGetCoreParamsForChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{11} + return fileDescriptor_dcb801e455adaee4, []int{13} } func (m *QueryGetCoreParamsForChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -578,7 +699,7 @@ func (m *QueryGetCoreParamsForChainResponse) Reset() { *m = QueryGetCore func (m *QueryGetCoreParamsForChainResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetCoreParamsForChainResponse) ProtoMessage() {} func (*QueryGetCoreParamsForChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{12} + return fileDescriptor_dcb801e455adaee4, []int{14} } func (m *QueryGetCoreParamsForChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -621,7 +742,7 @@ func (m *QueryGetCoreParamsRequest) Reset() { *m = QueryGetCoreParamsReq func (m *QueryGetCoreParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetCoreParamsRequest) ProtoMessage() {} func (*QueryGetCoreParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{13} + return fileDescriptor_dcb801e455adaee4, []int{15} } func (m *QueryGetCoreParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -658,7 +779,7 @@ func (m *QueryGetCoreParamsResponse) Reset() { *m = QueryGetCoreParamsRe func (m *QueryGetCoreParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetCoreParamsResponse) ProtoMessage() {} func (*QueryGetCoreParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{14} + return fileDescriptor_dcb801e455adaee4, []int{16} } func (m *QueryGetCoreParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -702,7 +823,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_dcb801e455adaee4, []int{15} + return fileDescriptor_dcb801e455adaee4, []int{17} } func (m *QueryGetNodeAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -746,7 +867,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_dcb801e455adaee4, []int{16} + return fileDescriptor_dcb801e455adaee4, []int{18} } func (m *QueryGetNodeAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -790,7 +911,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_dcb801e455adaee4, []int{17} + return fileDescriptor_dcb801e455adaee4, []int{19} } func (m *QueryAllNodeAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -835,7 +956,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_dcb801e455adaee4, []int{18} + return fileDescriptor_dcb801e455adaee4, []int{20} } func (m *QueryAllNodeAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -885,7 +1006,7 @@ func (m *QueryGetPermissionFlagsRequest) Reset() { *m = QueryGetPermissi func (m *QueryGetPermissionFlagsRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetPermissionFlagsRequest) ProtoMessage() {} func (*QueryGetPermissionFlagsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{19} + return fileDescriptor_dcb801e455adaee4, []int{21} } func (m *QueryGetPermissionFlagsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -922,7 +1043,7 @@ func (m *QueryGetPermissionFlagsResponse) Reset() { *m = QueryGetPermiss func (m *QueryGetPermissionFlagsResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetPermissionFlagsResponse) ProtoMessage() {} func (*QueryGetPermissionFlagsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{20} + return fileDescriptor_dcb801e455adaee4, []int{22} } func (m *QueryGetPermissionFlagsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -965,7 +1086,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_dcb801e455adaee4, []int{21} + return fileDescriptor_dcb801e455adaee4, []int{23} } func (m *QueryGetKeygenRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1002,7 +1123,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_dcb801e455adaee4, []int{22} + return fileDescriptor_dcb801e455adaee4, []int{24} } func (m *QueryGetKeygenResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1045,7 +1166,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_dcb801e455adaee4, []int{23} + return fileDescriptor_dcb801e455adaee4, []int{25} } func (m *QueryShowObserverCountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1082,7 +1203,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_dcb801e455adaee4, []int{24} + return fileDescriptor_dcb801e455adaee4, []int{26} } func (m *QueryShowObserverCountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1126,7 +1247,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_dcb801e455adaee4, []int{25} + return fileDescriptor_dcb801e455adaee4, []int{27} } func (m *QueryBlameByIdentifierRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1170,7 +1291,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_dcb801e455adaee4, []int{26} + return fileDescriptor_dcb801e455adaee4, []int{28} } func (m *QueryBlameByIdentifierResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1213,7 +1334,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_dcb801e455adaee4, []int{27} + return fileDescriptor_dcb801e455adaee4, []int{29} } func (m *QueryAllBlameRecordsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1250,7 +1371,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_dcb801e455adaee4, []int{28} + return fileDescriptor_dcb801e455adaee4, []int{30} } func (m *QueryAllBlameRecordsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1286,7 +1407,193 @@ func (m *QueryAllBlameRecordsResponse) GetBlameInfo() []*Blame { return nil } +type QueryAllBlockHeaderRequest struct { + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllBlockHeaderRequest) Reset() { *m = QueryAllBlockHeaderRequest{} } +func (m *QueryAllBlockHeaderRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllBlockHeaderRequest) ProtoMessage() {} +func (*QueryAllBlockHeaderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{31} +} +func (m *QueryAllBlockHeaderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBlockHeaderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBlockHeaderRequest.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 *QueryAllBlockHeaderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBlockHeaderRequest.Merge(m, src) +} +func (m *QueryAllBlockHeaderRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBlockHeaderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBlockHeaderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBlockHeaderRequest proto.InternalMessageInfo + +func (m *QueryAllBlockHeaderRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryAllBlockHeaderResponse struct { + BlockHeaders []*BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryAllBlockHeaderResponse) Reset() { *m = QueryAllBlockHeaderResponse{} } +func (m *QueryAllBlockHeaderResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllBlockHeaderResponse) ProtoMessage() {} +func (*QueryAllBlockHeaderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{32} +} +func (m *QueryAllBlockHeaderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBlockHeaderResponse.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 *QueryAllBlockHeaderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBlockHeaderResponse.Merge(m, src) +} +func (m *QueryAllBlockHeaderResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBlockHeaderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBlockHeaderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBlockHeaderResponse proto.InternalMessageInfo + +func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*BlockHeader { + if m != nil { + return m.BlockHeaders + } + return nil +} + +func (m *QueryAllBlockHeaderResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +type QueryGetBlockHeaderByHashRequest struct { + BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` +} + +func (m *QueryGetBlockHeaderByHashRequest) Reset() { *m = QueryGetBlockHeaderByHashRequest{} } +func (m *QueryGetBlockHeaderByHashRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetBlockHeaderByHashRequest) ProtoMessage() {} +func (*QueryGetBlockHeaderByHashRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{33} +} +func (m *QueryGetBlockHeaderByHashRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBlockHeaderByHashRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBlockHeaderByHashRequest.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 *QueryGetBlockHeaderByHashRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBlockHeaderByHashRequest.Merge(m, src) +} +func (m *QueryGetBlockHeaderByHashRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBlockHeaderByHashRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBlockHeaderByHashRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBlockHeaderByHashRequest proto.InternalMessageInfo + +func (m *QueryGetBlockHeaderByHashRequest) GetBlockHash() []byte { + if m != nil { + return m.BlockHash + } + return nil +} + +type QueryGetBlockHeaderByHashResponse struct { + BlockHeader *BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` +} + +func (m *QueryGetBlockHeaderByHashResponse) Reset() { *m = QueryGetBlockHeaderByHashResponse{} } +func (m *QueryGetBlockHeaderByHashResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetBlockHeaderByHashResponse) ProtoMessage() {} +func (*QueryGetBlockHeaderByHashResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_dcb801e455adaee4, []int{34} +} +func (m *QueryGetBlockHeaderByHashResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetBlockHeaderByHashResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetBlockHeaderByHashResponse.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 *QueryGetBlockHeaderByHashResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetBlockHeaderByHashResponse.Merge(m, src) +} +func (m *QueryGetBlockHeaderByHashResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetBlockHeaderByHashResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetBlockHeaderByHashResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetBlockHeaderByHashResponse proto.InternalMessageInfo + +func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *BlockHeader { + if m != nil { + return m.BlockHeader + } + return nil +} + func init() { + proto.RegisterType((*QueryProveRequest)(nil), "zetachain.zetacore.observer.QueryProveRequest") + proto.RegisterType((*QueryProveResponse)(nil), "zetachain.zetacore.observer.QueryProveResponse") proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.observer.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.observer.QueryParamsResponse") proto.RegisterType((*QueryBallotByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierRequest") @@ -1316,107 +1623,130 @@ func init() { proto.RegisterType((*QueryBlameByIdentifierResponse)(nil), "zetachain.zetacore.observer.QueryBlameByIdentifierResponse") proto.RegisterType((*QueryAllBlameRecordsRequest)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsRequest") proto.RegisterType((*QueryAllBlameRecordsResponse)(nil), "zetachain.zetacore.observer.QueryAllBlameRecordsResponse") + proto.RegisterType((*QueryAllBlockHeaderRequest)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderRequest") + proto.RegisterType((*QueryAllBlockHeaderResponse)(nil), "zetachain.zetacore.observer.QueryAllBlockHeaderResponse") + proto.RegisterType((*QueryGetBlockHeaderByHashRequest)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashRequest") + proto.RegisterType((*QueryGetBlockHeaderByHashResponse)(nil), "zetachain.zetacore.observer.QueryGetBlockHeaderByHashResponse") } func init() { proto.RegisterFile("observer/query.proto", fileDescriptor_dcb801e455adaee4) } var fileDescriptor_dcb801e455adaee4 = []byte{ - // 1507 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x58, 0x5f, 0x6f, 0x13, 0xc7, - 0x16, 0xcf, 0x26, 0xe0, 0x4b, 0x4e, 0x08, 0x49, 0x86, 0x00, 0xc1, 0x01, 0x27, 0x77, 0xb8, 0x80, - 0x21, 0xe0, 0x25, 0x46, 0xba, 0xf7, 0xd2, 0x14, 0x50, 0x1c, 0x41, 0xca, 0x7f, 0x6a, 0x5a, 0x5a, - 0x55, 0x6a, 0xad, 0xb5, 0x3d, 0x71, 0x96, 0xae, 0x77, 0x96, 0xdd, 0x4d, 0xc0, 0x45, 0x91, 0xaa, - 0x7e, 0x02, 0xa4, 0x4a, 0xfd, 0x16, 0xed, 0x03, 0x2f, 0x7d, 0xa8, 0xfa, 0xd2, 0x97, 0xf2, 0x54, - 0x51, 0x55, 0xaa, 0xfa, 0xd2, 0xaa, 0x02, 0x3e, 0x48, 0xb5, 0x33, 0x67, 0xd7, 0xeb, 0xfd, 0x63, - 0xaf, 0xf3, 0xe4, 0xdd, 0x99, 0xf9, 0x9d, 0xf3, 0x3b, 0x67, 0xce, 0x9e, 0xf3, 0x93, 0x61, 0x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0xd2, 0x64, 0x63, 0x96, 0x48, - 0x52, 0x65, 0xe2, 0x80, 0x56, 0x28, 0xf5, 0x5b, 0x54, 0x31, 0x44, 0x34, 0xea, 0x0e, 0xf9, 0x51, - 0x01, 0xb2, 0xce, 0xdc, 0x88, 0x10, 0x24, 0xd9, 0xbe, 0xb7, 0x04, 0x69, 0x99, 0x65, 0x48, 0xa5, - 0xa8, 0x4e, 0x5a, 0x16, 0x01, 0x9d, 0x23, 0x67, 0x53, 0x7b, 0xa2, 0x37, 0x5d, 0x65, 0x0c, 0xb6, - 0xc4, 0x56, 0x6e, 0xbc, 0x7c, 0x5d, 0x50, 0x5e, 0xbd, 0x2e, 0x28, 0x7f, 0xbf, 0x2e, 0x28, 0xcf, - 0xdf, 0x14, 0x46, 0x5e, 0xbd, 0x29, 0x8c, 0xfc, 0xf1, 0xa6, 0x30, 0xf2, 0x89, 0xda, 0xd2, 0xdd, - 0xcd, 0xad, 0x7a, 0xa9, 0xc1, 0xdb, 0x89, 0x57, 0xfd, 0xb4, 0x6b, 0xda, 0xed, 0x58, 0xcc, 0xa9, - 0xe7, 0xc4, 0xff, 0x91, 0x17, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xa0, 0x93, 0x43, 0xeb, - 0x15, 0x00, 0x00, + // 1823 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x59, 0xcd, 0x4f, 0x1b, 0x49, + 0x16, 0xa7, 0x21, 0x18, 0x78, 0x86, 0x00, 0x15, 0x92, 0x80, 0x01, 0xe3, 0xad, 0x2c, 0x89, 0x03, + 0x89, 0x1d, 0x1c, 0x69, 0xf3, 0x41, 0x20, 0xc2, 0x28, 0x21, 0xe4, 0x93, 0x75, 0x76, 0xb3, 0xab, + 0x95, 0x76, 0xad, 0xb6, 0x5d, 0xd8, 0x4e, 0xda, 0x5d, 0x4e, 0x77, 0x43, 0xf0, 0x46,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 0xd0, 0x14, 0x0c, 0xee, 0xab, + 0x9a, 0xc0, 0x39, 0x9c, 0xe3, 0x0d, 0x3c, 0xe5, 0xcc, 0x65, 0xc9, 0x10, 0xb4, 0xf0, 0x5f, 0xe1, + 0x44, 0x4b, 0xaf, 0x70, 0xb1, 0x01, 0x11, 0x9e, 0x34, 0xe6, 0x23, 0x9a, 0x39, 0x93, 0xea, 0xb0, + 0x21, 0x53, 0xdc, 0x38, 0x7b, 0xec, 0xed, 0xcf, 0x0b, 0x7d, 0x39, 0x61, 0x88, 0x1f, 0x40, 0x9c, + 0x79, 0xce, 0xb2, 0xed, 0x90, 0x6d, 0x6c, 0x97, 0x88, 0x6e, 0x55, 0x77, 0xab, 0xc4, 0x70, 0x52, + 0xba, 0x0c, 0x93, 0x7c, 0xaf, 0xe4, 0xab, 0xee, 0x18, 0x8b, 0x37, 0x92, 0x9b, 0xe0, 0x03, 0x4d, + 0x1b, 0x6c, 0xc1, 0xc8, 0x13, 0x6a, 0x11, 0xe3, 0x7e, 0xd5, 0xb4, 0xd0, 0x19, 0x18, 0xdb, 0xb7, + 0x1b, 0x79, 0xb5, 0x54, 0x32, 0x88, 0x69, 0x0a, 0xab, 0x51, 0xd6, 0xb9, 0xc1, 0xfb, 0x50, 0x16, + 0x46, 0xec, 0x76, 0xde, 0x6a, 0xd4, 0x09, 0x5b, 0x98, 0xe3, 0x99, 0xc5, 0x8e, 0x34, 0x6c, 0xff, + 0x7f, 0x6a, 0xd4, 0x49, 0x6e, 0x78, 0x5f, 0x7c, 0xe1, 0x2f, 0xfa, 0x61, 0x21, 0x90, 0x85, 0xc8, + 0x55, 0x2f, 0x34, 0xd0, 0x3a, 0x44, 0x18, 0x48, 0x73, 0xba, 0x3f, 0x31, 0x90, 0x8c, 0x66, 0xce, + 0x76, 0x45, 0xc4, 0x18, 0xe7, 0x84, 0x15, 0xfa, 0x0b, 0x4c, 0xf0, 0x51, 0x76, 0xf8, 0x38, 0xb7, + 0x01, 0xc6, 0xed,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 0x5c, 0xb2, 0x8c, 0xcb, 0x0d, 0x74, + 0x3d, 0x90, 0x8b, 0xcc, 0xc3, 0xde, 0x65, 0xf6, 0xb3, 0xc3, 0xde, 0x5f, 0xce, 0x13, 0xe4, 0x10, + 0xfd, 0x47, 0x81, 0x41, 0xf6, 0x2f, 0x7d, 0x94, 0x0a, 0x21, 0xe2, 0xa5, 0x5f, 0x29, 0x62, 0xe9, + 0xd0, 0xf3, 0x05, 0x5c, 0xcc, 0xe0, 0xce, 0xa1, 0x98, 0x7f, 0xa9, 0xb4, 0xe7, 0x66, 0xb7, 0xdf, + 0xbe, 0x8f, 0x2b, 0xef, 0xde, 0xc7, 0x95, 0x5f, 0xde, 0xc7, 0x95, 0x57, 0x1f, 0xe2, 0x7d, 0xef, + 0x3e, 0xc4, 0xfb, 0x7e, 0xf8, 0x10, 0xef, 0xfb, 0x5b, 0xba, 0x5c, 0xb5, 0x2a, 0x7b, 0x85, 0x54, + 0x91, 0xd6, 0x7c, 0x6b, 0xc2, 0x41, 0xd3, 0x95, 0xd5, 0xa8, 0x13, 0xb3, 0x10, 0x61, 0x3f, 0xb1, + 0x5c, 0xfe, 0x2d, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x48, 0x99, 0x25, 0xf6, 0x1a, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1456,6 +1786,10 @@ type QueryClient interface { BlameByIdentifier(ctx context.Context, in *QueryBlameByIdentifierRequest, opts ...grpc.CallOption) (*QueryBlameByIdentifierResponse, error) // Queries a list of VoterByIdentifier items. GetAllBlameRecords(ctx context.Context, in *QueryAllBlameRecordsRequest, opts ...grpc.CallOption) (*QueryAllBlameRecordsResponse, error) + GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error) + GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error) + // merkle proof verification + Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) } type queryClient struct { @@ -1592,20 +1926,47 @@ func (c *queryClient) GetAllBlameRecords(ctx context.Context, in *QueryAllBlameR return out, nil } -// QueryServer is the server API for Query service. -type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // Queries a list of VoterByIdentifier items. - BallotByIdentifier(context.Context, *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error) - // Queries a list of ObserversByChainAndType items. - ObserversByChain(context.Context, *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error) - AllObserverMappers(context.Context, *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error) - SupportedChains(context.Context, *QuerySupportedChains) (*QuerySupportedChainsResponse, error) - // Queries a list of GetClientParamsForChain items. - GetCoreParamsForChain(context.Context, *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error) - // Queries a list of GetCoreParams items. - GetCoreParams(context.Context, *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error) +func (c *queryClient) GetAllBlockHeaders(ctx context.Context, in *QueryAllBlockHeaderRequest, opts ...grpc.CallOption) (*QueryAllBlockHeaderResponse, error) { + out := new(QueryAllBlockHeaderResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetAllBlockHeaders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) GetBlockHeaderByHash(ctx context.Context, in *QueryGetBlockHeaderByHashRequest, opts ...grpc.CallOption) (*QueryGetBlockHeaderByHashResponse, error) { + out := new(QueryGetBlockHeaderByHashResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Prove(ctx context.Context, in *QueryProveRequest, opts ...grpc.CallOption) (*QueryProveResponse, error) { + out := new(QueryProveResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Prove", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // Queries a list of VoterByIdentifier items. + BallotByIdentifier(context.Context, *QueryBallotByIdentifierRequest) (*QueryBallotByIdentifierResponse, error) + // Queries a list of ObserversByChainAndType items. + ObserversByChain(context.Context, *QueryObserversByChainRequest) (*QueryObserversByChainResponse, error) + AllObserverMappers(context.Context, *QueryAllObserverMappersRequest) (*QueryAllObserverMappersResponse, error) + SupportedChains(context.Context, *QuerySupportedChains) (*QuerySupportedChainsResponse, error) + // Queries a list of GetClientParamsForChain items. + GetCoreParamsForChain(context.Context, *QueryGetCoreParamsForChainRequest) (*QueryGetCoreParamsForChainResponse, error) + // Queries a list of GetCoreParams items. + GetCoreParams(context.Context, *QueryGetCoreParamsRequest) (*QueryGetCoreParamsResponse, error) // Queries a nodeAccount by index. NodeAccount(context.Context, *QueryGetNodeAccountRequest) (*QueryGetNodeAccountResponse, error) // Queries a list of nodeAccount items. @@ -1619,6 +1980,10 @@ type QueryServer interface { BlameByIdentifier(context.Context, *QueryBlameByIdentifierRequest) (*QueryBlameByIdentifierResponse, error) // Queries a list of VoterByIdentifier items. GetAllBlameRecords(context.Context, *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error) + GetAllBlockHeaders(context.Context, *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) + GetBlockHeaderByHash(context.Context, *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error) + // merkle proof verification + Prove(context.Context, *QueryProveRequest) (*QueryProveResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -1667,6 +2032,15 @@ func (*UnimplementedQueryServer) BlameByIdentifier(ctx context.Context, req *Que func (*UnimplementedQueryServer) GetAllBlameRecords(ctx context.Context, req *QueryAllBlameRecordsRequest) (*QueryAllBlameRecordsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAllBlameRecords not implemented") } +func (*UnimplementedQueryServer) GetAllBlockHeaders(ctx context.Context, req *QueryAllBlockHeaderRequest) (*QueryAllBlockHeaderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllBlockHeaders not implemented") +} +func (*UnimplementedQueryServer) GetBlockHeaderByHash(ctx context.Context, req *QueryGetBlockHeaderByHashRequest) (*QueryGetBlockHeaderByHashResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBlockHeaderByHash not implemented") +} +func (*UnimplementedQueryServer) Prove(ctx context.Context, req *QueryProveRequest) (*QueryProveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Prove not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -1924,6 +2298,60 @@ func _Query_GetAllBlameRecords_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_GetAllBlockHeaders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllBlockHeaderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetAllBlockHeaders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetAllBlockHeaders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetAllBlockHeaders(ctx, req.(*QueryAllBlockHeaderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_GetBlockHeaderByHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetBlockHeaderByHashRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).GetBlockHeaderByHash(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/GetBlockHeaderByHash", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).GetBlockHeaderByHash(ctx, req.(*QueryGetBlockHeaderByHashRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Prove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Prove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Query/Prove", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Prove(ctx, req.(*QueryProveRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.observer.Query", HandlerType: (*QueryServer)(nil), @@ -1984,11 +2412,115 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "GetAllBlameRecords", Handler: _Query_GetAllBlameRecords_Handler, }, + { + MethodName: "GetAllBlockHeaders", + Handler: _Query_GetAllBlockHeaders_Handler, + }, + { + MethodName: "GetBlockHeaderByHash", + Handler: _Query_GetBlockHeaderByHash_Handler, + }, + { + MethodName: "Prove", + Handler: _Query_Prove_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "observer/query.proto", } +func (m *QueryProveRequest) 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 *QueryProveRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.TxIndex != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.TxIndex)) + i-- + dAtA[i] = 0x38 + } + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x32 + } + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.TxHash) > 0 { + i -= len(m.TxHash) + copy(dAtA[i:], m.TxHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.TxHash))) + i-- + dAtA[i] = 0x12 + } + if m.ChainId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryProveResponse) 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 *QueryProveResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Valid { + i-- + if m.Valid { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2913,71 +3445,259 @@ func (m *QueryAllBlameRecordsResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryAllBlockHeaderRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - return n + return dAtA[:n], nil } -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n +func (m *QueryAllBlockHeaderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryBallotByIdentifierRequest) Size() (n int) { - if m == nil { - return 0 - } +func (m *QueryAllBlockHeaderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.BallotIdentifier) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - return n + return len(dAtA) - i, nil } -func (m *VoterList) Size() (n int) { - if m == nil { - return 0 +func (m *QueryAllBlockHeaderResponse) 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 *QueryAllBlockHeaderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBlockHeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.VoterAddress) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - if m.VoteType != 0 { - n += 1 + sovQuery(uint64(m.VoteType)) + if len(m.BlockHeaders) > 0 { + for iNdEx := len(m.BlockHeaders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BlockHeaders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return n + return len(dAtA) - i, nil } -func (m *QueryBallotByIdentifierResponse) Size() (n int) { - if m == nil { - return 0 +func (m *QueryGetBlockHeaderByHashRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int + return dAtA[:n], nil +} + +func (m *QueryGetBlockHeaderByHashRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBlockHeaderByHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryGetBlockHeaderByHashResponse) 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 *QueryGetBlockHeaderByHashResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetBlockHeaderByHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BlockHeader != nil { + { + size, err := m.BlockHeader.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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryProveRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainId != 0 { + n += 1 + sovQuery(uint64(m.ChainId)) + } + l = len(m.TxHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.TxIndex != 0 { + n += 1 + sovQuery(uint64(m.TxIndex)) + } + return n +} + +func (m *QueryProveResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Valid { + n += 2 + } + return n +} + +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryBallotByIdentifierRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BallotIdentifier) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *VoterList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.VoterAddress) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.VoteType != 0 { + n += 1 + sovQuery(uint64(m.VoteType)) + } + return n +} + +func (m *QueryBallotByIdentifierResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int _ = l l = len(m.BallotIdentifier) if l > 0 { @@ -3293,63 +4013,71 @@ func (m *QueryAllBlameRecordsResponse) Size() (n int) { return n } -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func (m *QueryAllBlockHeaderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n } -func (m *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: 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 + +func (m *QueryAllBlockHeaderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.BlockHeaders) > 0 { + for _, e := range m.BlockHeaders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *QueryGetBlockHeaderByHashRequest) Size() (n int) { + if m == nil { + return 0 } - return nil + var l int + _ = l + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n } -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + +func (m *QueryGetBlockHeaderByHashResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.BlockHeader != nil { + l = m.BlockHeader.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryProveRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3372,17 +4100,17 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryProveRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryProveRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } - var msglen int + m.ChainId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3392,25 +4120,670 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.ChainId |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthQuery + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TxHash", wireType) } - postIndex := iNdEx + msglen - if postIndex < 0 { + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TxHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", 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 m.Proof == nil { + m.Proof = ðereum.Proof{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TxIndex", wireType) + } + m.TxIndex = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TxIndex |= 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 *QueryProveResponse) 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: QueryProveResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProveResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Valid", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Valid = bool(v != 0) + 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 *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params.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 *QueryBallotByIdentifierRequest) 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: QueryBallotByIdentifierRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBallotByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.BallotIdentifier = string(dAtA[iNdEx:postIndex]) + 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 *VoterList) 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: VoterList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VoterList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VoterAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VoterAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VoteType", wireType) + } + m.VoteType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VoteType |= VoteType(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 *QueryBallotByIdentifierResponse) 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: QueryBallotByIdentifierResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBallotByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BallotIdentifier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voters", 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.Voters = append(m.Voters, &VoterList{}) + if err := m.Voters[len(m.Voters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ObservationType", wireType) + } + m.ObservationType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ObservationType |= ObservationType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BallotStatus", wireType) + } + m.BallotStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BallotStatus |= BallotStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3432,7 +4805,7 @@ func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error { +func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3455,15 +4828,15 @@ func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBallotByIdentifierRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryObserversByChainRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBallotByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryObserversByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObservationChain", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3491,7 +4864,7 @@ func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BallotIdentifier = string(dAtA[iNdEx:postIndex]) + m.ObservationChain = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3514,7 +4887,7 @@ func (m *QueryBallotByIdentifierRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *VoterList) Unmarshal(dAtA []byte) error { +func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3537,15 +4910,15 @@ func (m *VoterList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: VoterList: wiretype end group for non-group") + return fmt.Errorf("proto: QueryObserversByChainResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: VoterList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryObserversByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VoterAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Observers", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3573,27 +4946,8 @@ func (m *VoterList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.VoterAddress = string(dAtA[iNdEx:postIndex]) + m.Observers = append(m.Observers, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VoteType", wireType) - } - m.VoteType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.VoteType |= VoteType(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3615,7 +4969,7 @@ func (m *VoterList) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3638,47 +4992,65 @@ func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBallotByIdentifierResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllObserverMappersRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBallotByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllObserverMappersRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BallotIdentifier", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryAllObserverMappersResponse) 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 } - m.BallotIdentifier = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + 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: QueryAllObserverMappersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllObserverMappersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voters", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ObserverMappers", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3705,49 +5077,11 @@ func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Voters = append(m.Voters, &VoterList{}) - if err := m.Voters[len(m.Voters)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ObserverMappers = append(m.ObserverMappers, &ObserverMapper{}) + if err := m.ObserverMappers[len(m.ObserverMappers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ObservationType", wireType) - } - m.ObservationType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ObservationType |= ObservationType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BallotStatus", wireType) - } - m.BallotStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BallotStatus |= BallotStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3769,7 +5103,7 @@ func (m *QueryBallotByIdentifierResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error { +func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3792,44 +5126,12 @@ func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryObserversByChainRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySupportedChains: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryObserversByChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySupportedChains: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObservationChain", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ObservationChain = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3851,7 +5153,7 @@ func (m *QueryObserversByChainRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error { +func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3874,17 +5176,17 @@ func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryObserversByChainResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QuerySupportedChainsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryObserversByChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QuerySupportedChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Observers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Chains", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3894,23 +5196,25 @@ func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Observers = append(m.Observers, string(dAtA[iNdEx:postIndex])) + m.Chains = append(m.Chains, &common.Chain{}) + if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -3933,7 +5237,7 @@ func (m *QueryObserversByChainResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3956,12 +5260,31 @@ func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllObserverMappersRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllObserverMappersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: 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:]) @@ -3983,7 +5306,7 @@ func (m *QueryAllObserverMappersRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4006,15 +5329,15 @@ func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllObserverMappersResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllObserverMappersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObserverMappers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4041,8 +5364,10 @@ func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ObserverMappers = append(m.ObserverMappers, &ObserverMapper{}) - if err := m.ObserverMappers[len(m.ObserverMappers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.CoreParams == nil { + m.CoreParams = &CoreParams{} + } + if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4067,7 +5392,7 @@ func (m *QueryAllObserverMappersResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error { +func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4090,10 +5415,10 @@ func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySupportedChains: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetCoreParamsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySupportedChains: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetCoreParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4117,7 +5442,7 @@ func (m *QuerySupportedChains) Unmarshal(dAtA []byte) error { } return nil } -func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4140,15 +5465,15 @@ func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QuerySupportedChainsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetCoreParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QuerySupportedChainsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetCoreParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Chains", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4175,8 +5500,10 @@ func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Chains = append(m.Chains, &common.Chain{}) - if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.CoreParams == nil { + m.CoreParams = &CoreParamsList{} + } + if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4201,7 +5528,7 @@ func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4224,17 +5551,17 @@ func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNodeAccountRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCoreParamsForChainRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNodeAccountRequest: 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) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) } - m.ChainId = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4244,11 +5571,24 @@ func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ChainId |= int64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Index = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4270,7 +5610,7 @@ func (m *QueryGetCoreParamsForChainRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4293,15 +5633,15 @@ func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetNodeAccountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCoreParamsForChainResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4328,10 +5668,10 @@ func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.CoreParams == nil { - m.CoreParams = &CoreParams{} + if m.NodeAccount == nil { + m.NodeAccount = &NodeAccount{} } - if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.NodeAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4356,7 +5696,7 @@ func (m *QueryGetCoreParamsForChainResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllNodeAccountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4379,12 +5719,48 @@ func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetCoreParamsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllNodeAccountRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCoreParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4406,7 +5782,7 @@ func (m *QueryGetCoreParamsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4429,15 +5805,15 @@ func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetCoreParamsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllNodeAccountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetCoreParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CoreParams", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4464,10 +5840,44 @@ func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.CoreParams == nil { - m.CoreParams = &CoreParamsList{} + m.NodeAccount = append(m.NodeAccount, &NodeAccount{}) + if err := m.NodeAccount[len(m.NodeAccount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if err := m.CoreParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4492,7 +5902,7 @@ func (m *QueryGetCoreParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetPermissionFlagsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4515,44 +5925,12 @@ func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetNodeAccountRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetPermissionFlagsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetPermissionFlagsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Index = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4574,7 +5952,7 @@ func (m *QueryGetNodeAccountRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4597,15 +5975,15 @@ func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetNodeAccountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetPermissionFlagsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetPermissionFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PermissionFlags", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4632,10 +6010,7 @@ func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.NodeAccount == nil { - m.NodeAccount = &NodeAccount{} - } - if err := m.NodeAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.PermissionFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4660,7 +6035,7 @@ func (m *QueryGetNodeAccountResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllNodeAccountRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4673,58 +6048,22 @@ func (m *QueryAllNodeAccountRequest) Unmarshal(dAtA []byte) error { 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: QueryAllNodeAccountRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllNodeAccountRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { - m.Pagination = &query.PageRequest{} - } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx = postIndex + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetKeygenRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetKeygenRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -4746,7 +6085,7 @@ func (m *QueryAllNodeAccountRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4769,49 +6108,15 @@ func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllNodeAccountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetKeygenResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllNodeAccountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetKeygenResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeAccount", 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.NodeAccount = append(m.NodeAccount, &NodeAccount{}) - if err := m.NodeAccount[len(m.NodeAccount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Keygen", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4838,10 +6143,10 @@ func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Pagination == nil { - m.Pagination = &query.PageResponse{} + if m.Keygen == nil { + m.Keygen = &Keygen{} } - if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Keygen.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4866,7 +6171,7 @@ func (m *QueryAllNodeAccountResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetPermissionFlagsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4889,10 +6194,10 @@ func (m *QueryGetPermissionFlagsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPermissionFlagsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryShowObserverCountRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPermissionFlagsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryShowObserverCountRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -4916,7 +6221,7 @@ func (m *QueryGetPermissionFlagsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4939,15 +6244,15 @@ func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetPermissionFlagsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryShowObserverCountResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetPermissionFlagsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryShowObserverCountResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PermissionFlags", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LastObserverCount", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4974,7 +6279,10 @@ func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PermissionFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.LastObserverCount == nil { + m.LastObserverCount = &LastObserverCount{} + } + if err := m.LastObserverCount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4999,7 +6307,7 @@ func (m *QueryGetPermissionFlagsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5022,12 +6330,44 @@ func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetKeygenRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlameByIdentifierRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetKeygenRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlameByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlameIdentifier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlameIdentifier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5049,7 +6389,7 @@ func (m *QueryGetKeygenRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5072,15 +6412,15 @@ func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryGetKeygenResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBlameByIdentifierResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryGetKeygenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryBlameByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Keygen", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5107,10 +6447,10 @@ func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Keygen == nil { - m.Keygen = &Keygen{} + if m.BlameInfo == nil { + m.BlameInfo = &Blame{} } - if err := m.Keygen.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5135,7 +6475,7 @@ func (m *QueryGetKeygenResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5158,10 +6498,10 @@ func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryShowObserverCountRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllBlameRecordsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryShowObserverCountRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllBlameRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -5185,7 +6525,7 @@ func (m *QueryShowObserverCountRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5208,15 +6548,15 @@ func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryShowObserverCountResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllBlameRecordsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryShowObserverCountResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllBlameRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastObserverCount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5243,10 +6583,8 @@ func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.LastObserverCount == nil { - m.LastObserverCount = &LastObserverCount{} - } - if err := m.LastObserverCount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.BlameInfo = append(m.BlameInfo, &Blame{}) + if err := m.BlameInfo[len(m.BlameInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5271,7 +6609,7 @@ func (m *QueryShowObserverCountResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error { +func (m *QueryAllBlockHeaderRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5294,17 +6632,17 @@ func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBlameByIdentifierRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllBlockHeaderRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBlameByIdentifierRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllBlockHeaderRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlameIdentifier", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5314,23 +6652,27 @@ func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.BlameIdentifier = string(dAtA[iNdEx:postIndex]) + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -5353,7 +6695,7 @@ func (m *QueryBlameByIdentifierRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error { +func (m *QueryAllBlockHeaderResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5376,15 +6718,15 @@ func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBlameByIdentifierResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryAllBlockHeaderResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBlameByIdentifierResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryAllBlockHeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeaders", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5411,10 +6753,44 @@ func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.BlameInfo == nil { - m.BlameInfo = &Blame{} + m.BlockHeaders = append(m.BlockHeaders, &BlockHeader{}) + if err := m.BlockHeaders[len(m.BlockHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - if err := m.BlameInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", 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 m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5439,7 +6815,7 @@ func (m *QueryBlameByIdentifierResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error { +func (m *QueryGetBlockHeaderByHashRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5462,12 +6838,46 @@ func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllBlameRecordsRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetBlockHeaderByHashRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllBlameRecordsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetBlockHeaderByHashRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.BlockHash == nil { + m.BlockHash = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -5489,7 +6899,7 @@ func (m *QueryAllBlameRecordsRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error { +func (m *QueryGetBlockHeaderByHashResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5512,15 +6922,15 @@ func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAllBlameRecordsResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryGetBlockHeaderByHashResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAllBlameRecordsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryGetBlockHeaderByHashResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlameInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeader", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5547,8 +6957,10 @@ func (m *QueryAllBlameRecordsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BlameInfo = append(m.BlameInfo, &Blame{}) - if err := m.BlameInfo[len(m.BlameInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.BlockHeader == nil { + m.BlockHeader = &BlockHeader{} + } + if err := m.BlockHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/observer/types/query.pb.gw.go b/x/observer/types/query.pb.gw.go index d7e061ea4c..360d1ad447 100644 --- a/x/observer/types/query.pb.gw.go +++ b/x/observer/types/query.pb.gw.go @@ -483,6 +483,132 @@ func local_request_Query_GetAllBlameRecords_0(ctx context.Context, marshaler run } +var ( + filter_Query_GetAllBlockHeaders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_GetAllBlockHeaders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllBlockHeaderRequest + 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_GetAllBlockHeaders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetAllBlockHeaders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetAllBlockHeaders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllBlockHeaderRequest + 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_GetAllBlockHeaders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetAllBlockHeaders(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_GetBlockHeaderByHash_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBlockHeaderByHashRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["block_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "block_hash") + } + + protoReq.BlockHash, err = runtime.Bytes(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "block_hash", err) + } + + msg, err := client.GetBlockHeaderByHash(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_GetBlockHeaderByHash_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetBlockHeaderByHashRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["block_hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "block_hash") + } + + protoReq.BlockHash, err = runtime.Bytes(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "block_hash", err) + } + + msg, err := server.GetBlockHeaderByHash(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Prove_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Prove_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProveRequest + 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_Prove_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Prove(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Prove_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProveRequest + 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_Prove_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Prove(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. @@ -811,6 +937,75 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_GetAllBlockHeaders_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_GetAllBlockHeaders_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_GetAllBlockHeaders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBlockHeaderByHash_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_GetBlockHeaderByHash_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_GetBlockHeaderByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Prove_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_Prove_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_Prove_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1132,6 +1327,66 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_GetAllBlockHeaders_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_GetAllBlockHeaders_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_GetAllBlockHeaders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_GetBlockHeaderByHash_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_GetBlockHeaderByHash_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_GetBlockHeaderByHash_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Prove_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_Prove_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_Prove_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -1163,6 +1418,12 @@ var ( pattern_Query_BlameByIdentifier_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "blame_by_identifier", "blame_identifier"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_GetAllBlameRecords_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "get_all_blame_records"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetAllBlockHeaders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "get_all_block_headers"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_GetBlockHeaderByHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "get_block_header_by_hash", "block_hash"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Prove_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "prove"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -1193,4 +1454,10 @@ var ( forward_Query_BlameByIdentifier_0 = runtime.ForwardResponseMessage forward_Query_GetAllBlameRecords_0 = runtime.ForwardResponseMessage + + forward_Query_GetAllBlockHeaders_0 = runtime.ForwardResponseMessage + + forward_Query_GetBlockHeaderByHash_0 = runtime.ForwardResponseMessage + + forward_Query_Prove_0 = runtime.ForwardResponseMessage ) diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index d2e91155aa..8019e5dc5a 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -30,6 +30,118 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type MsgAddBlockHeader struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + BlockHeader []byte `protobuf:"bytes,4,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` + Height int64 `protobuf:"varint,5,opt,name=height,proto3" json:"height,omitempty"` +} + +func (m *MsgAddBlockHeader) Reset() { *m = MsgAddBlockHeader{} } +func (m *MsgAddBlockHeader) String() string { return proto.CompactTextString(m) } +func (*MsgAddBlockHeader) ProtoMessage() {} +func (*MsgAddBlockHeader) Descriptor() ([]byte, []int) { + return fileDescriptor_1bcd40fa296a2b1d, []int{0} +} +func (m *MsgAddBlockHeader) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddBlockHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddBlockHeader.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 *MsgAddBlockHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddBlockHeader.Merge(m, src) +} +func (m *MsgAddBlockHeader) XXX_Size() int { + return m.Size() +} +func (m *MsgAddBlockHeader) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddBlockHeader.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddBlockHeader proto.InternalMessageInfo + +func (m *MsgAddBlockHeader) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgAddBlockHeader) GetChainId() int64 { + if m != nil { + return m.ChainId + } + return 0 +} + +func (m *MsgAddBlockHeader) GetBlockHash() []byte { + if m != nil { + return m.BlockHash + } + return nil +} + +func (m *MsgAddBlockHeader) GetBlockHeader() []byte { + if m != nil { + return m.BlockHeader + } + return nil +} + +func (m *MsgAddBlockHeader) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +type MsgAddBlockHeaderResponse struct { +} + +func (m *MsgAddBlockHeaderResponse) Reset() { *m = MsgAddBlockHeaderResponse{} } +func (m *MsgAddBlockHeaderResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddBlockHeaderResponse) ProtoMessage() {} +func (*MsgAddBlockHeaderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_1bcd40fa296a2b1d, []int{1} +} +func (m *MsgAddBlockHeaderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgAddBlockHeaderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgAddBlockHeaderResponse.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 *MsgAddBlockHeaderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddBlockHeaderResponse.Merge(m, src) +} +func (m *MsgAddBlockHeaderResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgAddBlockHeaderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddBlockHeaderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgAddBlockHeaderResponse proto.InternalMessageInfo + type MsgUpdateCoreParams struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` CoreParams *CoreParams `protobuf:"bytes,2,opt,name=coreParams,proto3" json:"coreParams,omitempty"` @@ -39,7 +151,7 @@ func (m *MsgUpdateCoreParams) Reset() { *m = MsgUpdateCoreParams{} } func (m *MsgUpdateCoreParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateCoreParams) ProtoMessage() {} func (*MsgUpdateCoreParams) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{0} + return fileDescriptor_1bcd40fa296a2b1d, []int{2} } func (m *MsgUpdateCoreParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -89,7 +201,7 @@ func (m *MsgUpdateCoreParamsResponse) Reset() { *m = MsgUpdateCoreParams func (m *MsgUpdateCoreParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateCoreParamsResponse) ProtoMessage() {} func (*MsgUpdateCoreParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{1} + return fileDescriptor_1bcd40fa296a2b1d, []int{3} } func (m *MsgUpdateCoreParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -129,7 +241,7 @@ func (m *MsgAddObserver) Reset() { *m = MsgAddObserver{} } func (m *MsgAddObserver) String() string { return proto.CompactTextString(m) } func (*MsgAddObserver) ProtoMessage() {} func (*MsgAddObserver) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{2} + return fileDescriptor_1bcd40fa296a2b1d, []int{4} } func (m *MsgAddObserver) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -193,7 +305,7 @@ func (m *MsgAddObserverResponse) Reset() { *m = MsgAddObserverResponse{} func (m *MsgAddObserverResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddObserverResponse) ProtoMessage() {} func (*MsgAddObserverResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{3} + return fileDescriptor_1bcd40fa296a2b1d, []int{5} } func (m *MsgAddObserverResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -232,7 +344,7 @@ func (m *MsgAddBlameVote) Reset() { *m = MsgAddBlameVote{} } func (m *MsgAddBlameVote) String() string { return proto.CompactTextString(m) } func (*MsgAddBlameVote) ProtoMessage() {} func (*MsgAddBlameVote) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{4} + return fileDescriptor_1bcd40fa296a2b1d, []int{6} } func (m *MsgAddBlameVote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -289,7 +401,7 @@ func (m *MsgAddBlameVoteResponse) Reset() { *m = MsgAddBlameVoteResponse func (m *MsgAddBlameVoteResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddBlameVoteResponse) ProtoMessage() {} func (*MsgAddBlameVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{5} + return fileDescriptor_1bcd40fa296a2b1d, []int{7} } func (m *MsgAddBlameVoteResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -328,7 +440,7 @@ func (m *MsgUpdatePermissionFlags) Reset() { *m = MsgUpdatePermissionFla func (m *MsgUpdatePermissionFlags) String() string { return proto.CompactTextString(m) } func (*MsgUpdatePermissionFlags) ProtoMessage() {} func (*MsgUpdatePermissionFlags) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{6} + return fileDescriptor_1bcd40fa296a2b1d, []int{8} } func (m *MsgUpdatePermissionFlags) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -385,7 +497,7 @@ func (m *MsgUpdatePermissionFlagsResponse) Reset() { *m = MsgUpdatePermi func (m *MsgUpdatePermissionFlagsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdatePermissionFlagsResponse) ProtoMessage() {} func (*MsgUpdatePermissionFlagsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{7} + return fileDescriptor_1bcd40fa296a2b1d, []int{9} } func (m *MsgUpdatePermissionFlagsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -423,7 +535,7 @@ func (m *MsgUpdateKeygen) Reset() { *m = MsgUpdateKeygen{} } func (m *MsgUpdateKeygen) String() string { return proto.CompactTextString(m) } func (*MsgUpdateKeygen) ProtoMessage() {} func (*MsgUpdateKeygen) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{8} + return fileDescriptor_1bcd40fa296a2b1d, []int{10} } func (m *MsgUpdateKeygen) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -473,7 +585,7 @@ func (m *MsgUpdateKeygenResponse) Reset() { *m = MsgUpdateKeygenResponse func (m *MsgUpdateKeygenResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateKeygenResponse) ProtoMessage() {} func (*MsgUpdateKeygenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1bcd40fa296a2b1d, []int{9} + return fileDescriptor_1bcd40fa296a2b1d, []int{11} } func (m *MsgUpdateKeygenResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -503,6 +615,8 @@ func (m *MsgUpdateKeygenResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateKeygenResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*MsgAddBlockHeader)(nil), "zetachain.zetacore.observer.MsgAddBlockHeader") + proto.RegisterType((*MsgAddBlockHeaderResponse)(nil), "zetachain.zetacore.observer.MsgAddBlockHeaderResponse") proto.RegisterType((*MsgUpdateCoreParams)(nil), "zetachain.zetacore.observer.MsgUpdateCoreParams") proto.RegisterType((*MsgUpdateCoreParamsResponse)(nil), "zetachain.zetacore.observer.MsgUpdateCoreParamsResponse") proto.RegisterType((*MsgAddObserver)(nil), "zetachain.zetacore.observer.MsgAddObserver") @@ -518,47 +632,53 @@ func init() { func init() { proto.RegisterFile("observer/tx.proto", fileDescriptor_1bcd40fa296a2b1d) } var fileDescriptor_1bcd40fa296a2b1d = []byte{ - // 627 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x4f, 0xd4, 0x40, - 0x14, 0xa6, 0x82, 0x02, 0x0f, 0x23, 0x50, 0x40, 0x4a, 0x89, 0xcd, 0xa6, 0x17, 0x51, 0xb1, 0x55, - 0xd0, 0xc4, 0x98, 0x78, 0x58, 0x8c, 0x92, 0x8d, 0x41, 0x48, 0x13, 0x3d, 0x78, 0x69, 0xa6, 0x9d, - 0xa1, 0x34, 0xb4, 0x33, 0xcd, 0x4c, 0xd7, 0xb0, 0x1e, 0xbc, 0x7b, 0xd0, 0xf8, 0x47, 0x79, 0xf0, - 0xc8, 0xd1, 0xa3, 0x81, 0xbb, 0x7f, 0x83, 0xd9, 0x99, 0x6d, 0xf7, 0xa7, 0x65, 0xd7, 0xd3, 0xce, - 0xbc, 0xf7, 0xbd, 0xef, 0x7d, 0xef, 0xcd, 0xb7, 0xbb, 0xb0, 0xcc, 0x02, 0x41, 0xf8, 0x47, 0xc2, - 0xdd, 0xfc, 0xcc, 0xc9, 0x38, 0xcb, 0x99, 0x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 0x97, 0xa2, 0x60, 0xdf, 0xf9, 0x33, 0x03, 0xd3, 0x07, 0x22, 0xd2, 0x19, 0x2c, - 0xf4, 0xda, 0xf3, 0x41, 0xe5, 0xce, 0xfb, 0x5d, 0x60, 0xee, 0x4e, 0x00, 0x2e, 0x1a, 0xeb, 0x9f, - 0x61, 0x69, 0xe8, 0x9b, 0xfa, 0xe8, 0x2a, 0xa2, 0xc1, 0x0a, 0xf3, 0xd9, 0xa4, 0x15, 0x65, 0x7f, - 0x0e, 0x37, 0xfb, 0xec, 0xba, 0x3d, 0xc6, 0x10, 0x25, 0xda, 0x7c, 0x32, 0x09, 0xba, 0xec, 0xf9, - 0x55, 0x83, 0xb5, 0xd1, 0xe6, 0x7b, 0x3a, 0xde, 0x1c, 0x03, 0x65, 0xe6, 0x8b, 0xff, 0x2a, 0xeb, - 0xdd, 0x41, 0x9f, 0xaf, 0xb6, 0xc7, 0xa3, 0x53, 0xe8, 0xab, 0x77, 0x30, 0xca, 0x70, 0x7b, 0x8d, - 0x9f, 0x17, 0x96, 0x76, 0x7e, 0x61, 0x69, 0xbf, 0x2f, 0x2c, 0xed, 0xfb, 0xa5, 0x35, 0x75, 0x7e, - 0x69, 0x4d, 0xfd, 0xba, 0xb4, 0xa6, 0x3e, 0xb8, 0x51, 0x9c, 0x9f, 0x34, 0x03, 0x27, 0x64, 0xa9, - 0xdb, 0xe6, 0x7b, 0x28, 0xa9, 0xdd, 0x82, 0xda, 0x3d, 0x73, 0xbb, 0x7f, 0x40, 0xad, 0x8c, 0x88, - 0xe0, 0x86, 0xfc, 0xd9, 0xdf, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x1d, 0x55, 0xa7, 0x00, 0x99, - 0x06, 0x00, 0x00, + // 723 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcb, 0x6e, 0xd3, 0x4c, + 0x14, 0xae, 0xff, 0xfe, 0xbd, 0xe4, 0xa4, 0xea, 0xc5, 0xbd, 0x39, 0xa9, 0x1a, 0x05, 0x6f, 0x28, + 0x50, 0x62, 0x68, 0x01, 0x21, 0x24, 0x16, 0x29, 0x82, 0x36, 0x42, 0xa5, 0x95, 0x25, 0x58, 0xb0, + 0xb1, 0xc6, 0x9e, 0x53, 0xdb, 0x6a, 0x3c, 0x13, 0x79, 0x1c, 0x94, 0xb0, 0x60, 0xcf, 0x02, 0xc4, + 0x33, 0xf0, 0x2c, 0x2c, 0x58, 0x76, 0xc9, 0x12, 0xb5, 0x1b, 0x1e, 0x03, 0x65, 0x7c, 0x69, 0x2e, + 0x25, 0x4d, 0xba, 0xf2, 0xcc, 0x39, 0xdf, 0xf9, 0xce, 0x77, 0x2e, 0xd6, 0xc0, 0x12, 0xb7, 0x05, + 0x86, 0x1f, 0x30, 0x34, 0xa2, 0x56, 0xa5, 0x11, 0xf2, 0x88, 0xab, 0x1b, 0x1f, 0x31, 0x22, 0x8e, + 0x47, 0x7c, 0x56, 0x91, 0x27, 0x1e, 0x62, 0x25, 0x45, 0x15, 0x97, 0x1d, 0x1e, 0x04, 0x9c, 0x19, + 0xf1, 0x27, 0x8e, 0x28, 0xae, 0xb8, 0xdc, 0xe5, 0xf2, 0x68, 0x74, 0x4e, 0xa9, 0x35, 0xa3, 0xb6, + 0xeb, 0x24, 0xc0, 0xc4, 0xba, 0x96, 0x59, 0x3d, 0x24, 0x14, 0x43, 0x91, 0xd8, 0xd7, 0x33, 0x7b, + 0x7a, 0x48, 0x1c, 0xab, 0x99, 0xa3, 0x41, 0x42, 0x12, 0x24, 0x78, 0xfd, 0xbb, 0x02, 0x4b, 0x87, + 0xc2, 0xad, 0x52, 0xba, 0x57, 0xe7, 0xce, 0xe9, 0x81, 0x24, 0x53, 0x35, 0x98, 0x71, 0x42, 0x24, + 0x11, 0x0f, 0x35, 0xa5, 0xac, 0x6c, 0xe5, 0xcc, 0xf4, 0xaa, 0x16, 0x60, 0x56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, 0x80, 0xd3, 0xc4, 0xea, 0x27, 0x58, 0x1c, + 0xf8, 0x53, 0x1f, 0x5c, 0x47, 0xd4, 0x1f, 0x51, 0x7c, 0x3a, 0x6e, 0x44, 0x96, 0x3f, 0x84, 0xb9, + 0x9e, 0x75, 0xdd, 0x1e, 0xa1, 0x88, 0x0c, 0x5d, 0x7c, 0x34, 0x0e, 0x3a, 0xcb, 0xf9, 0x45, 0x81, + 0xd5, 0xab, 0x97, 0xef, 0xf1, 0x68, 0x75, 0xf4, 0x85, 0x15, 0x9f, 0xdf, 0x28, 0xac, 0xbb, 0x07, + 0x3d, 0x7b, 0xb5, 0x3d, 0x1a, 0x5d, 0x8c, 0xbe, 0xbe, 0x07, 0x57, 0x2d, 0x9c, 0xda, 0x82, 0xf9, + 0xbe, 0x27, 0xa6, 0x32, 0x52, 0x2f, 0x33, 0x7c, 0xf1, 0xc9, 0x78, 0xf8, 0x34, 0xf3, 0x5e, 0xed, + 0xe7, 0x79, 0x49, 0x39, 0x3b, 0x2f, 0x29, 0xbf, 0xcf, 0x4b, 0xca, 0xb7, 0x8b, 0xd2, 0xc4, 0xd9, + 0x45, 0x69, 0xe2, 0xd7, 0x45, 0x69, 0xe2, 0xbd, 0xe1, 0xfa, 0x91, 0xd7, 0xb4, 0x2b, 0x0e, 0x0f, + 0x8c, 0x0e, 0xe3, 0x7d, 0x49, 0x6e, 0xa4, 0xe4, 0x46, 0xcb, 0xb8, 0x7c, 0xd4, 0xdb, 0x0d, 0x14, + 0xf6, 0xb4, 0x7c, 0x32, 0x77, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x14, 0x0f, 0x4d, 0xed, + 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -578,6 +698,7 @@ type MsgClient interface { AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts ...grpc.CallOption) (*MsgAddBlameVoteResponse, error) UpdatePermissionFlags(ctx context.Context, in *MsgUpdatePermissionFlags, opts ...grpc.CallOption) (*MsgUpdatePermissionFlagsResponse, error) UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts ...grpc.CallOption) (*MsgUpdateKeygenResponse, error) + AddBlockHeader(ctx context.Context, in *MsgAddBlockHeader, opts ...grpc.CallOption) (*MsgAddBlockHeaderResponse, error) } type msgClient struct { @@ -633,6 +754,15 @@ func (c *msgClient) UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts return out, nil } +func (c *msgClient) AddBlockHeader(ctx context.Context, in *MsgAddBlockHeader, opts ...grpc.CallOption) (*MsgAddBlockHeaderResponse, error) { + out := new(MsgAddBlockHeaderResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/AddBlockHeader", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AddObserver(context.Context, *MsgAddObserver) (*MsgAddObserverResponse, error) @@ -640,6 +770,7 @@ type MsgServer interface { AddBlameVote(context.Context, *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error) UpdatePermissionFlags(context.Context, *MsgUpdatePermissionFlags) (*MsgUpdatePermissionFlagsResponse, error) UpdateKeygen(context.Context, *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error) + AddBlockHeader(context.Context, *MsgAddBlockHeader) (*MsgAddBlockHeaderResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -661,6 +792,9 @@ func (*UnimplementedMsgServer) UpdatePermissionFlags(ctx context.Context, req *M func (*UnimplementedMsgServer) UpdateKeygen(ctx context.Context, req *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateKeygen not implemented") } +func (*UnimplementedMsgServer) AddBlockHeader(ctx context.Context, req *MsgAddBlockHeader) (*MsgAddBlockHeaderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddBlockHeader not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -756,6 +890,24 @@ func _Msg_UpdateKeygen_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_AddBlockHeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddBlockHeader) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).AddBlockHeader(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.observer.Msg/AddBlockHeader", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).AddBlockHeader(ctx, req.(*MsgAddBlockHeader)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.observer.Msg", HandlerType: (*MsgServer)(nil), @@ -780,11 +932,92 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateKeygen", Handler: _Msg_UpdateKeygen_Handler, }, + { + MethodName: "AddBlockHeader", + Handler: _Msg_AddBlockHeader_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "observer/tx.proto", } +func (m *MsgAddBlockHeader) 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 *MsgAddBlockHeader) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddBlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Height != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x28 + } + if len(m.BlockHeader) > 0 { + i -= len(m.BlockHeader) + copy(dAtA[i:], m.BlockHeader) + i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHeader))) + i-- + dAtA[i] = 0x22 + } + if len(m.BlockHash) > 0 { + i -= len(m.BlockHash) + copy(dAtA[i:], m.BlockHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.BlockHash))) + i-- + dAtA[i] = 0x1a + } + if m.ChainId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgAddBlockHeaderResponse) 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 *MsgAddBlockHeaderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgAddBlockHeaderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgUpdateCoreParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1139,6 +1372,42 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *MsgAddBlockHeader) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.ChainId != 0 { + n += 1 + sovTx(uint64(m.ChainId)) + } + l = len(m.BlockHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.BlockHeader) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Height != 0 { + n += 1 + sovTx(uint64(m.Height)) + } + return n +} + +func (m *MsgAddBlockHeaderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgUpdateCoreParams) Size() (n int) { if m == nil { return 0 @@ -1286,6 +1555,244 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *MsgAddBlockHeader) 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 ErrIntOverflowTx + } + 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: MsgAddBlockHeader: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddBlockHeader: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) + if m.BlockHash == nil { + m.BlockHash = []byte{} + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockHeader", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockHeader = append(m.BlockHeader[:0], dAtA[iNdEx:postIndex]...) + if m.BlockHeader == nil { + m.BlockHeader = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) + } + m.Height = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Height |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgAddBlockHeaderResponse) 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 ErrIntOverflowTx + } + 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: MsgAddBlockHeaderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgAddBlockHeaderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgUpdateCoreParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/zetaclient/btc_signer.go b/zetaclient/btc_signer.go index 4b0ab4cd94..e6f30cfe10 100644 --- a/zetaclient/btc_signer.go +++ b/zetaclient/btc_signer.go @@ -287,7 +287,7 @@ func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out continue } logger.Info().Msgf("Broadcast success: nonce %d to chain %s outTxHash %s", outboundTxTssNonce, btcClient.chain.String(), outTxHash) - zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(btcClient.chain.ChainId, outboundTxTssNonce, outTxHash) + zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(btcClient.chain.ChainId, outboundTxTssNonce, outTxHash, nil, "", -1) if err != nil { logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", outboundTxTssNonce, btcClient.chain.ChainName, outTxHash) } diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go index 7162091f3d..f942160e4c 100644 --- a/zetaclient/evm_client.go +++ b/zetaclient/evm_client.go @@ -16,11 +16,12 @@ import ( "sync/atomic" "time" - "gorm.io/driver/sqlite" - "gorm.io/gorm" - "cosmossdk.io/math" + "github.com/ethereum/go-ethereum/rlp" + lru "github.com/hashicorp/golang-lru" "github.com/pkg/errors" + "gorm.io/driver/sqlite" + "gorm.io/gorm" "github.com/ethereum/go-ethereum/accounts/abi/bind" ethtypes "github.com/ethereum/go-ethereum/core/types" @@ -90,6 +91,8 @@ type EVMChainClient struct { cfg *config.Config params observertypes.CoreParams ts *TelemetryServer + + BlockCache *lru.Cache } var _ ChainClient = (*EVMChainClient)(nil) @@ -134,6 +137,12 @@ func NewEVMChainClient(bridge *ZetaCoreBridge, tss TSSSigner, dbpath string, met } ob.EvmClient = client + ob.BlockCache, err = lru.New(1000) + if err != nil { + ob.logger.ChainLogger.Error().Err(err).Msg("failed to create block cache") + return nil, err + } + if ob.chain.IsKlaytnChain() { kclient, err := Dial(evmCfg.Endpoint) if err != nil { @@ -799,12 +808,23 @@ func (ob *EVMChainClient) observeInTX() error { if !ob.chain.IsKlaytnChain() { for bn := startBlock; bn <= toBlock; bn++ { //block, err := ob.EvmClient.BlockByNumber(context.Background(), big.NewInt(int64(bn))) - block, err := ob.EvmClient.BlockByNumber(context.Background(), big.NewInt(bn)) + block, err := ob.GetBlockByNumberCached(bn) if err != nil { ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error getting block: %d", bn) continue } - //ob.logger.ExternalChainWatcher.Debug().Msgf("block %d: num txs: %d", bn, len(block.Transactions())) + _ = ob.BlockCache.Add(block.Hash(), block) + headerRLP, err := rlp.EncodeToBytes(block.Header()) + if err != nil { + ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error encoding block header: %d", bn) + continue + } + _, err = ob.zetaClient.PostAddBlockHeader(ob.chain.ChainId, block.Hash().Bytes(), block.Number().Int64(), headerRLP) + if err != nil { + ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("error posting block header: %d", bn) + continue + } + for _, tx := range block.Transactions() { if tx.To() == nil { continue @@ -813,6 +833,7 @@ func (ob *EVMChainClient) observeInTX() error { ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation!: %s", tx.Hash().Hex()) continue } + if *tx.To() == tssAddress { receipt, err := ob.EvmClient.TransactionReceipt(context.Background(), tx.Hash()) if err != nil { @@ -834,6 +855,7 @@ func (ob *EVMChainClient) observeInTX() error { continue } } + zetaHash, err := ob.ReportTokenSentToTSS(tx.Hash(), tx.Value(), receipt, from, tx.Data()) if err != nil { ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting to zeta core") @@ -1129,3 +1151,15 @@ func (ob *EVMChainClient) GetTxID(nonce uint64) string { tssAddr := ob.Tss.EVMAddress().String() return fmt.Sprintf("%d-%s-%d", ob.chain.ChainId, tssAddr, nonce) } + +func (ob *EVMChainClient) GetBlockByNumberCached(blockNumber int64) (*ethtypes.Block, error) { + if block, ok := ob.BlockCache.Get(blockNumber); ok { + return block.(*ethtypes.Block), nil + } + block, err := ob.EvmClient.BlockByNumber(context.Background(), big.NewInt(blockNumber)) + if err != nil { + return nil, err + } + ob.BlockCache.Add(blockNumber, block) + return block, nil +} diff --git a/zetaclient/evm_signer.go b/zetaclient/evm_signer.go index 6f9984e3e0..cb321801af 100644 --- a/zetaclient/evm_signer.go +++ b/zetaclient/evm_signer.go @@ -494,7 +494,7 @@ func (signer *EVMSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out log.Warn().Err(err).Msgf("OutTx Broadcast error") retry, report := HandleBroadcastError(err, strconv.FormatUint(send.GetCurrentOutTxParam().OutboundTxTssNonce, 10), toChain.String(), outTxHash) if report { - zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash) + zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash, nil, "", -1) if err != nil { logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash) } @@ -507,7 +507,7 @@ func (signer *EVMSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out continue } logger.Info().Msgf("Broadcast success: nonce %d to chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash) - zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash) + zetaHash, err := zetaBridge.AddTxHashToOutTxTracker(toChain.ChainId, tx.Nonce(), outTxHash, nil, "", -1) if err != nil { logger.Err(err).Msgf("Unable to add to tracker on ZetaCore: nonce %d chain %s outTxHash %s", send.GetCurrentOutTxParam().OutboundTxTssNonce, toChain, outTxHash) } diff --git a/zetaclient/query.go b/zetaclient/query.go index 8e4ab27329..2fd4fecf73 100644 --- a/zetaclient/query.go +++ b/zetaclient/query.go @@ -12,6 +12,7 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" tmtypes "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/common/ethereum" "github.com/zeta-chain/zetacore/x/crosschain/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc" @@ -297,3 +298,18 @@ func (b *ZetaCoreBridge) GetPendingNonces() (*types.QueryAllPendingNoncesRespons } return resp, nil } + +func (b *ZetaCoreBridge) Prove(blockHash string, txHash string, txIndex int64, proof *ethereum.Proof, chainID uint64) (bool, error) { + client := zetaObserverTypes.NewQueryClient(b.grpcConn) + resp, err := client.Prove(context.Background(), &zetaObserverTypes.QueryProveRequest{ + BlockHash: blockHash, + TxIndex: txIndex, + Proof: proof, + ChainId: chainID, + TxHash: txHash, + }) + if err != nil { + return false, err + } + return resp.Valid, nil +} diff --git a/zetaclient/tx.go b/zetaclient/tx.go index ea0335ee01..5b23ef5a73 100644 --- a/zetaclient/tx.go +++ b/zetaclient/tx.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" + "github.com/zeta-chain/zetacore/common/ethereum" "github.com/zeta-chain/zetacore/zetaclient/config" "gitlab.com/thorchain/tss/go-tss/blame" @@ -25,6 +26,7 @@ const ( PostReceiveConfirmationGasLimit = 200_000 PostBlameDataGasLimit = 200_000 DefaultGasLimit = 200_000 + PostProveOutboundTxGasLimit = 400_000 DefaultRetryCount = 5 DefaultRetryInterval = 5 ) @@ -53,9 +55,9 @@ func (b *ZetaCoreBridge) PostGasPrice(chain common.Chain, gasPrice uint64, suppl return "", fmt.Errorf("post gasprice failed after %d retries", DefaultRetryInterval) } -func (b *ZetaCoreBridge) AddTxHashToOutTxTracker(chainID int64, nonce uint64, txHash string) (string, error) { +func (b *ZetaCoreBridge) AddTxHashToOutTxTracker(chainID int64, nonce uint64, txHash string, proof *ethereum.Proof, blockHash string, txIndex int64) (string, error) { signerAddress := b.keys.GetOperatorAddress().String() - msg := types.NewMsgAddToOutTxTracker(signerAddress, chainID, nonce, txHash) + msg := types.NewMsgAddToOutTxTracker(signerAddress, chainID, nonce, txHash, proof, blockHash, txIndex) authzMsg, authzSigner := b.WrapMessageWithAuthz(msg) zetaTxHash, err := b.Broadcast(AddTxHashToOutTxTrackerGasLimit, authzMsg, authzSigner) if err != nil { @@ -189,3 +191,19 @@ func (b *ZetaCoreBridge) PostBlameData(blame *blame.Blame, chainID int64, index } return "", fmt.Errorf("post blame data failed after %d retries", DefaultRetryCount) } + +func (b *ZetaCoreBridge) PostAddBlockHeader(chainID int64, txhash []byte, height int64, header []byte) (string, error) { + signerAddress := b.keys.GetOperatorAddress().String() + msg := observerTypes.NewMsgAddBlockHeader(signerAddress, chainID, txhash, height, header) + authzMsg, authzSigner := b.WrapMessageWithAuthz(msg) + var gasLimit uint64 = DefaultGasLimit + for i := 0; i < DefaultRetryCount; i++ { + zetaTxHash, err := b.Broadcast(gasLimit, authzMsg, authzSigner) + if err == nil { + return zetaTxHash, nil + } + b.logger.Error().Err(err).Msgf("PostAddBlockHeader broadcast fail | Retry count : %d", i+1) + time.Sleep(DefaultRetryInterval * time.Second) + } + return "", fmt.Errorf("post add block header failed after %d retries", DefaultRetryCount) +} From 736b05464abedfc4775e73883d3e52ffe19c7e04 Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Fri, 15 Sep 2023 21:54:05 -0500 Subject: [PATCH 5/7] fix: cherry picked all v9.x.x hotfix (#1123) * hotfix for BSC and Mumbai outbound issue * skip invalid cctx that contains invalid receiver address or zero amount * check PKWSH address conversion only as zetacore already decoded address successfully * fixed ZERO amount issue and improved log print * convert math.Uint -> float64 for bitcoin only * skip old gabbage trackers to unblock EVM chain outbound cctxes * make fetchUTXO faster 260 secs --> 160 ms * fix wrong GasPrice ticker * cherry pick for all hotfix of v9.x.x * cleaned up redundant code * corrected Mumbai chain_id as 80001 --------- Co-authored-by: charliec --- zetaclient/bitcoin_client.go | 22 +++++----------------- zetaclient/btc_signer.go | 2 +- zetaclient/evm_client.go | 13 ++++++++++++- zetaclient/query.go | 2 +- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index c84ff232b7..c9aa882991 100644 --- a/zetaclient/bitcoin_client.go +++ b/zetaclient/bitcoin_client.go @@ -71,7 +71,6 @@ type BitcoinChainClient struct { const ( minConfirmations = 0 - chunkSize = 1000 maxHeightDiff = 10000 dustOffset = 2000 ) @@ -598,24 +597,13 @@ func (ob *BitcoinChainClient) fetchUTXOS() error { return fmt.Errorf("btc: error decoding wallet address (%s) : %s", tssAddr, err.Error()) } addresses := []btcutil.Address{address} - var utxos []btcjson.ListUnspentResult - // populate utxos array - for i := minConfirmations; i < maxConfirmations; i += chunkSize { - unspents, err := ob.rpcClient.ListUnspentMinMaxAddresses(i, i+chunkSize, addresses) - if err != nil { - return err - } - utxos = append(utxos, unspents...) - //ob.logger.WatchUTXOS.Debug().Msgf("btc: fetched %d utxos", len(unspents)) - //for idx, utxo := range unspents { - // fmt.Printf("utxo %d\n", idx) - // fmt.Printf(" txid: %s\n", utxo.TxID) - // fmt.Printf(" address: %s\n", utxo.Address) - // fmt.Printf(" amount: %f\n", utxo.Amount) - // fmt.Printf(" confirmations: %d\n", utxo.Confirmations) - //} + // fetching all TSS utxos takes 160ms + utxos, err := ob.rpcClient.ListUnspentMinMaxAddresses(0, maxConfirmations, addresses) + if err != nil { + return err } + //ob.logger.WatchUTXOS.Debug().Msgf("btc: fetched %d utxos in confirmation range [0, %d]", len(unspents), maxConfirmations) // rigid sort to make utxo list deterministic sort.SliceStable(utxos, func(i, j int) bool { diff --git a/zetaclient/btc_signer.go b/zetaclient/btc_signer.go index e6f30cfe10..6f9f53c6a7 100644 --- a/zetaclient/btc_signer.go +++ b/zetaclient/btc_signer.go @@ -254,7 +254,7 @@ func (signer *BTCSigner) TryProcessOutTx(send *types.CrossChainTx, outTxMan *Out } to, ok := addr.(*btcutil.AddressWitnessPubKeyHash) if err != nil || !ok { - logger.Error().Err(err).Msgf("cannot decode address %s ", params.Receiver) + logger.Error().Err(err).Msgf("cannot convert address %s to P2WPKH address", params.Receiver) return } diff --git a/zetaclient/evm_client.go b/zetaclient/evm_client.go index f942160e4c..0e95cb3bea 100644 --- a/zetaclient/evm_client.go +++ b/zetaclient/evm_client.go @@ -454,6 +454,13 @@ func (ob *EVMChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64, co return false, false, nil } +// The lowest nonce we observe outTx for each chain +var lowestOutTxNonceToObserve = map[int64]uint64{ + 5: 70000, // Goerli + 97: 95000, // BSC testnet + 80001: 120000, // Mumbai +} + // FIXME: there's a chance that a txhash in OutTxChan may not deliver when Stop() is called // observeOutTx periodically checks all the txhash in potential outbound txs func (ob *EVMChainClient) observeOutTx() { @@ -482,8 +489,12 @@ func (ob *EVMChainClient) observeOutTx() { }) outTimeout := time.After(time.Duration(timeoutNonce) * time.Second) TRACKERLOOP: + // Skip old gabbage trackers as we spent too much time on querying them for _, tracker := range trackers { nonceInt := tracker.Nonce + if nonceInt < lowestOutTxNonceToObserve[ob.chain.ChainId] { + continue + } TXHASHLOOP: for _, txHash := range tracker.HashList { //inTimeout := time.After(3000 * time.Millisecond) @@ -953,7 +964,7 @@ func (ob *EVMChainClient) WatchGasPrice() { height, _ := ob.zetaClient.GetBlockHeight() ob.logger.WatchGasPrice.Error().Err(err).Msgf("PostGasPrice error at zeta block : %d ", height) } - ticker.UpdateInterval(ob.GetCoreParams().InTxTicker, ob.logger.WatchGasPrice) + ticker.UpdateInterval(ob.GetCoreParams().GasPriceTicker, ob.logger.WatchGasPrice) case <-ob.stop: ob.logger.WatchGasPrice.Info().Msg("WatchGasPrice stopped") return diff --git a/zetaclient/query.go b/zetaclient/query.go index 2fd4fecf73..a93c52c5e4 100644 --- a/zetaclient/query.go +++ b/zetaclient/query.go @@ -260,7 +260,7 @@ func (b *ZetaCoreBridge) GetAllOutTxTrackerByChain(chain common.Chain, order Ord Pagination: &query.PageRequest{ Key: nil, Offset: 0, - Limit: 1000, + Limit: 2000, CountTotal: false, Reverse: false, }, From 758c366def0670a96374e53fa539fcad5148657f Mon Sep 17 00:00:00 2001 From: kevinssgh <79858682+kevinssgh@users.noreply.github.com> Date: Tue, 19 Sep 2023 14:10:37 -0400 Subject: [PATCH 6/7] fix: some data race warnings in zetaclient (#1100) * fixed some data race issues in zetaclient * refactored fix * cleanup extra spaces and comments. --- Makefile | 4 ++-- contrib/localnet/orchestrator/smoketest/main.go | 6 ++++-- zetaclient/broadcast.go | 10 ++++------ zetaclient/tss_signer.go | 1 + zetaclient/zetabridge.go | 6 +++++- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index ec328166c6..99f64d7951 100644 --- a/Makefile +++ b/Makefile @@ -82,8 +82,8 @@ build-testnet-ubuntu: go.sum install: go.sum @echo "--> Installing zetacored & zetaclientd" - @go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored - @go install -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd + @go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetacored + @go install -race -mod=readonly $(BUILD_FLAGS) ./cmd/zetaclientd install-zetaclient: go.sum @echo "--> Installing zetaclientd" diff --git a/contrib/localnet/orchestrator/smoketest/main.go b/contrib/localnet/orchestrator/smoketest/main.go index 5608bfca90..c08b04d3ac 100644 --- a/contrib/localnet/orchestrator/smoketest/main.go +++ b/contrib/localnet/orchestrator/smoketest/main.go @@ -148,6 +148,9 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { bankClient := banktypes.NewQueryClient(grpcConn) observerClient := observertypes.NewQueryClient(grpcConn) + //Wait for Genesis + time.Sleep(20 * time.Second) + // initialize client to send messages to ZetaChain zetaTxServer, err := NewZetaTxServer( "http://zetacore0:26657", @@ -158,8 +161,7 @@ func LocalSmokeTest(_ *cobra.Command, _ []string) { panic(err) } - // Wait for Genesis and keygen to be completed. ~ height 30 - time.Sleep(20 * time.Second) + //Wait for keygen to be completed. ~ height 30 for { time.Sleep(5 * time.Second) response, err := cctxClient.LastZetaHeight(context.Background(), &crosschaintypes.QueryLastZetaHeightRequest{}) diff --git a/zetaclient/broadcast.go b/zetaclient/broadcast.go index a9c9c91b3c..70f1ce0739 100644 --- a/zetaclient/broadcast.go +++ b/zetaclient/broadcast.go @@ -13,7 +13,6 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" flag "github.com/spf13/pflag" rpchttp "github.com/tendermint/tendermint/rpc/client/http" - "github.com/zeta-chain/zetacore/app" ) // Broadcast Broadcasts tx to metachain. Returns txHash and error @@ -119,11 +118,10 @@ func (b *ZetaCoreBridge) GetContext() client.Context { ctx = ctx.WithFromAddress(addr) ctx = ctx.WithBroadcastMode("sync") - encodingConfig := app.MakeEncodingConfig() - ctx = ctx.WithCodec(encodingConfig.Codec) - ctx = ctx.WithInterfaceRegistry(encodingConfig.InterfaceRegistry) - ctx = ctx.WithTxConfig(encodingConfig.TxConfig) - ctx = ctx.WithLegacyAmino(encodingConfig.Amino) + ctx = ctx.WithCodec(b.encodingCfg.Codec) + ctx = ctx.WithInterfaceRegistry(b.encodingCfg.InterfaceRegistry) + ctx = ctx.WithTxConfig(b.encodingCfg.TxConfig) + ctx = ctx.WithLegacyAmino(b.encodingCfg.Amino) ctx = ctx.WithAccountRetriever(authtypes.AccountRetriever{}) remote := b.cfg.ChainRPC diff --git a/zetaclient/tss_signer.go b/zetaclient/tss_signer.go index d0e540017d..d171c74ff9 100644 --- a/zetaclient/tss_signer.go +++ b/zetaclient/tss_signer.go @@ -173,6 +173,7 @@ func (tss *TSS) SignBatch(digests [][]byte, height uint64, chain *common.Chain) digestBase64[i] = base64.StdEncoding.EncodeToString(digest) } keysignReq := keysign.NewRequest(tssPubkey, digestBase64, int64(height), nil, "0.14.0") + ksRes, err := tss.Server.KeySign(keysignReq) if err != nil { log.Warn().Err(err).Msg("keysign fail") diff --git a/zetaclient/zetabridge.go b/zetaclient/zetabridge.go index 64a7a565bd..6e4c625ec2 100644 --- a/zetaclient/zetabridge.go +++ b/zetaclient/zetabridge.go @@ -4,6 +4,8 @@ import ( "fmt" "time" + "github.com/cosmos/cosmos-sdk/simapp/params" + "github.com/zeta-chain/zetacore/common" "sync" @@ -32,6 +34,7 @@ import ( //"strconv" //"strings" + "github.com/zeta-chain/zetacore/app" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -46,6 +49,7 @@ type ZetaCoreBridge struct { grpcConn *grpc.ClientConn httpClient *retryablehttp.Client cfg config.ClientConfiguration + encodingCfg params.EncodingConfig keys *Keys broadcastLock *sync.RWMutex zetaChainID string @@ -92,6 +96,7 @@ func NewZetaCoreBridge(k *Keys, chainIP string, signerName string, chainID strin accountNumber: accountsMap, seqNumber: seqMap, cfg: cfg, + encodingCfg: app.MakeEncodingConfig(), keys: k, broadcastLock: &sync.RWMutex{}, lastOutTxReportTime: map[string]time.Time{}, @@ -194,7 +199,6 @@ func (b *ZetaCoreBridge) UpdateConfigFromCore(cfg *config.Config, init bool) err } cfg.UpdateCoreParams(keyGen, newChains, newEVMParams, newBTCParams, init, b.logger) - cfg.Keygen = *keyGen tss, err := b.GetCurrentTss() if err != nil { b.logger.Error().Err(err).Msg("Unable to fetch TSS from zetacore") From de85c7faa88d9ef49b4bf8336d2d0cf7fa25c30e Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Wed, 20 Sep 2023 16:58:55 +0200 Subject: [PATCH 7/7] fix(`rpc`): reduce Ethereum rpc API and improve websocket API (#1106) * disable debug and personal * disable eth not secure * goimports * set message limit * set limit to 32MB * Update rpc/websockets.go --------- Co-authored-by: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> --- rpc/apis.go | 129 +++++++++--------- rpc/namespaces/ethereum/debug/api.go | 10 +- rpc/namespaces/ethereum/eth/api.go | 60 ++++---- rpc/namespaces/ethereum/eth/filters/api.go | 14 +- .../ethereum/eth/filters/filter_system.go | 16 +-- .../ethereum/eth/filters/filters.go | 12 +- rpc/namespaces/ethereum/miner/api.go | 3 - rpc/namespaces/ethereum/personal/api.go | 13 +- rpc/namespaces/ethereum/txpool/api.go | 4 +- rpc/namespaces/ethereum/web3/api.go | 3 +- rpc/websockets.go | 17 ++- 11 files changed, 127 insertions(+), 154 deletions(-) diff --git a/rpc/apis.go b/rpc/apis.go index 3256f42d77..da130ad0a1 100644 --- a/rpc/apis.go +++ b/rpc/apis.go @@ -20,21 +20,14 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" - "github.com/ethereum/go-ethereum/rpc" - ethermint "github.com/evmos/ethermint/types" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" "github.com/zeta-chain/zetacore/rpc/backend" - "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/debug" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth/filters" - "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/miner" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/net" - "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/personal" - "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/txpool" "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/web3" - - rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" ) // RPC namespaces and API version @@ -47,8 +40,8 @@ const ( Web3Namespace = "web3" EthNamespace = "eth" - PersonalNamespace = "personal" NetNamespace = "net" + PersonalNamespace = "personal" TxPoolNamespace = "txpool" DebugNamespace = "debug" MinerNamespace = "miner" @@ -112,64 +105,66 @@ func init() { }, } }, - PersonalNamespace: func(ctx *server.Context, - clientCtx client.Context, - _ *rpcclient.WSClient, - allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, - ) []rpc.API { - evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) - return []rpc.API{ - { - Namespace: PersonalNamespace, - Version: apiVersion, - Service: personal.NewAPI(ctx.Logger, evmBackend), - Public: false, - }, - } - }, - TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API { - return []rpc.API{ - { - Namespace: TxPoolNamespace, - Version: apiVersion, - Service: txpool.NewPublicAPI(ctx.Logger), - Public: true, - }, - } - }, - DebugNamespace: func(ctx *server.Context, - clientCtx client.Context, - _ *rpcclient.WSClient, - allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, - ) []rpc.API { - evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) - return []rpc.API{ - { - Namespace: DebugNamespace, - Version: apiVersion, - Service: debug.NewAPI(ctx, evmBackend), - Public: true, - }, - } - }, - MinerNamespace: func(ctx *server.Context, - clientCtx client.Context, - _ *rpcclient.WSClient, - allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, - ) []rpc.API { - evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) - return []rpc.API{ - { - Namespace: MinerNamespace, - Version: apiVersion, - Service: miner.NewPrivateAPI(ctx, evmBackend), - Public: false, - }, - } - }, + // Disabled + // NOTE: Public field of API is deprecated and defined only for compatibility. + //PersonalNamespace: func(ctx *server.Context, + // clientCtx client.Context, + // _ *rpcclient.WSClient, + // allowUnprotectedTxs bool, + // indexer ethermint.EVMTxIndexer, + //) []rpc.API { + // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) + // return []rpc.API{ + // { + // Namespace: PersonalNamespace, + // Version: apiVersion, + // Service: personal.NewAPI(ctx.Logger, evmBackend), + // Public: false, + // }, + // } + //}, + //TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API { + // return []rpc.API{ + // { + // Namespace: TxPoolNamespace, + // Version: apiVersion, + // Service: txpool.NewPublicAPI(ctx.Logger), + // Public: true, + // }, + // } + //}, + //DebugNamespace: func(ctx *server.Context, + // clientCtx client.Context, + // _ *rpcclient.WSClient, + // allowUnprotectedTxs bool, + // indexer ethermint.EVMTxIndexer, + //) []rpc.API { + // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) + // return []rpc.API{ + // { + // Namespace: DebugNamespace, + // Version: apiVersion, + // Service: debug.NewAPI(ctx, evmBackend), + // Public: true, + // }, + // } + //}, + //MinerNamespace: func(ctx *server.Context, + // clientCtx client.Context, + // _ *rpcclient.WSClient, + // allowUnprotectedTxs bool, + // indexer ethermint.EVMTxIndexer, + //) []rpc.API { + // evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) + // return []rpc.API{ + // { + // Namespace: MinerNamespace, + // Version: apiVersion, + // Service: miner.NewPrivateAPI(ctx, evmBackend), + // Public: false, + // }, + // } + //}, } } diff --git a/rpc/namespaces/ethereum/debug/api.go b/rpc/namespaces/ethereum/debug/api.go index 0620b67be0..94f771ab39 100644 --- a/rpc/namespaces/ethereum/debug/api.go +++ b/rpc/namespaces/ethereum/debug/api.go @@ -27,18 +27,14 @@ import ( "sync" "time" - "github.com/davecgh/go-spew/spew" - - evmtypes "github.com/evmos/ethermint/x/evm/types" - - stderrors "github.com/pkg/errors" - "github.com/cosmos/cosmos-sdk/server" - + "github.com/davecgh/go-spew/spew" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/rlp" + evmtypes "github.com/evmos/ethermint/x/evm/types" + stderrors "github.com/pkg/errors" "github.com/tendermint/tendermint/libs/log" "github.com/zeta-chain/zetacore/rpc/backend" rpctypes "github.com/zeta-chain/zetacore/rpc/types" diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index d62ddbe18c..7d05848b91 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -18,20 +18,14 @@ package eth import ( "context" - "github.com/ethereum/go-ethereum/signer/core/apitypes" - - "github.com/ethereum/go-ethereum/rpc" - - "github.com/tendermint/tendermint/libs/log" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" - - "github.com/zeta-chain/zetacore/rpc/backend" - + "github.com/ethereum/go-ethereum/rpc" ethermint "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/tendermint/tendermint/libs/log" + "github.com/zeta-chain/zetacore/rpc/backend" rpctypes "github.com/zeta-chain/zetacore/rpc/types" ) @@ -67,7 +61,6 @@ type EthereumAPI interface { // Allows developers to both send ETH from one address to another, write data // on-chain, and interact with smart contracts. SendRawTransaction(data hexutil.Bytes) (common.Hash, error) - SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) // eth_sendPrivateTransaction // eth_cancel PrivateTransaction @@ -111,9 +104,7 @@ type EthereumAPI interface { // Other Syncing() (interface{}, error) Coinbase() (string, error) - Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) - SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) FillTransaction(args evmtypes.TransactionArgs) (*rpctypes.SignTransactionResult, error) Resend(ctx context.Context, args evmtypes.TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error) @@ -125,6 +116,11 @@ type EthereumAPI interface { // eth_getWork (on Ethereum.org) // eth_submitWork (on Ethereum.org) // eth_submitHashrate (on Ethereum.org) + + // Disabled APIs for security reasons + //SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) + //Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) + //SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) } var _ EthereumAPI = (*PublicAPI)(nil) @@ -230,12 +226,6 @@ func (e *PublicAPI) SendRawTransaction(data hexutil.Bytes) (common.Hash, error) return e.backend.SendRawTransaction(data) } -// SendTransaction sends an Ethereum transaction. -func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { - e.logger.Debug("eth_sendTransaction", "args", args.String()) - return e.backend.SendTransaction(args) -} - /////////////////////////////////////////////////////////////////////////////// /// Account Information /// /////////////////////////////////////////////////////////////////////////////// @@ -416,12 +406,6 @@ func (e *PublicAPI) Coinbase() (string, error) { return ethAddr.Hex(), nil } -// Sign signs the provided data using the private key of address via Geth's signature standard. -func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { - e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data)) - return e.backend.Sign(address, data) -} - // GetTransactionLogs returns the logs given a transaction hash. func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) { e.logger.Debug("eth_getTransactionLogs", "hash", txHash) @@ -448,12 +432,6 @@ func (e *PublicAPI) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, err return backend.TxLogsFromEvents(resBlockResult.TxsResults[res.TxIndex].Events, int(res.MsgIndex)) } -// SignTypedData signs EIP-712 conformant typed data -func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { - e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData) - return e.backend.SignTypedData(address, typedData) -} - // FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields) // on a given unsigned transaction, and returns it to the caller for further // processing (signing + broadcast). @@ -527,3 +505,25 @@ func (e *PublicAPI) GetPendingTransactions() ([]*rpctypes.RPCTransaction, error) return result, nil } + +/////////////////////////////////////////////////////////////////////////////// +/// Disabled /// +/////////////////////////////////////////////////////////////////////////////// + +//// SendTransaction sends an Ethereum transaction. +//func (e *PublicAPI) SendTransaction(args evmtypes.TransactionArgs) (common.Hash, error) { +// e.logger.Debug("eth_sendTransaction", "args", args.String()) +// return e.backend.SendTransaction(args) +//} +// +//// Sign signs the provided data using the private key of address via Geth's signature standard. +//func (e *PublicAPI) Sign(address common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { +// e.logger.Debug("eth_sign", "address", address.Hex(), "data", common.Bytes2Hex(data)) +// return e.backend.Sign(address, data) +//} +// +//// SignTypedData signs EIP-712 conformant typed data +//func (e *PublicAPI) SignTypedData(address common.Address, typedData apitypes.TypedData) (hexutil.Bytes, error) { +// e.logger.Debug("eth_signTypedData", "address", address.Hex(), "data", typedData) +// return e.backend.SignTypedData(address, typedData) +//} diff --git a/rpc/namespaces/ethereum/eth/filters/api.go b/rpc/namespaces/ethereum/eth/filters/api.go index f6a9135a16..0268c7217d 100644 --- a/rpc/namespaces/ethereum/eth/filters/api.go +++ b/rpc/namespaces/ethereum/eth/filters/api.go @@ -22,20 +22,16 @@ import ( "time" "github.com/cosmos/cosmos-sdk/client" - "github.com/zeta-chain/zetacore/rpc/types" - - "github.com/tendermint/tendermint/libs/log" - - coretypes "github.com/tendermint/tendermint/rpc/core/types" - rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" - tmtypes "github.com/tendermint/tendermint/types" - "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/rpc" - evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/tendermint/tendermint/libs/log" + coretypes "github.com/tendermint/tendermint/rpc/core/types" + rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" + tmtypes "github.com/tendermint/tendermint/types" + "github.com/zeta-chain/zetacore/rpc/types" ) // FilterAPI gathers diff --git a/rpc/namespaces/ethereum/eth/filters/filter_system.go b/rpc/namespaces/ethereum/eth/filters/filter_system.go index ac69cfc53d..ba203cf685 100644 --- a/rpc/namespaces/ethereum/eth/filters/filter_system.go +++ b/rpc/namespaces/ethereum/eth/filters/filter_system.go @@ -21,23 +21,19 @@ import ( "sync" "time" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/ethereum/go-ethereum/common" + ethtypes "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/filters" + "github.com/ethereum/go-ethereum/rpc" + evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/pkg/errors" - tmjson "github.com/tendermint/tendermint/libs/json" "github.com/tendermint/tendermint/libs/log" tmquery "github.com/tendermint/tendermint/libs/pubsub/query" coretypes "github.com/tendermint/tendermint/rpc/core/types" rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" tmtypes "github.com/tendermint/tendermint/types" - - "github.com/ethereum/go-ethereum/common" - ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/filters" - "github.com/ethereum/go-ethereum/rpc" - - sdk "github.com/cosmos/cosmos-sdk/types" - - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/ethereum/pubsub" ) diff --git a/rpc/namespaces/ethereum/eth/filters/filters.go b/rpc/namespaces/ethereum/eth/filters/filters.go index 7bcb08fd75..4355182001 100644 --- a/rpc/namespaces/ethereum/eth/filters/filters.go +++ b/rpc/namespaces/ethereum/eth/filters/filters.go @@ -21,17 +21,15 @@ import ( "fmt" "math/big" - "github.com/zeta-chain/zetacore/rpc/backend" - "github.com/zeta-chain/zetacore/rpc/types" - - "github.com/pkg/errors" - "github.com/tendermint/tendermint/libs/log" - tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" - "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/eth/filters" + "github.com/pkg/errors" + "github.com/tendermint/tendermint/libs/log" + tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" + "github.com/zeta-chain/zetacore/rpc/backend" + "github.com/zeta-chain/zetacore/rpc/types" ) // BloomIV represents the bit indexes and value inside the bloom filter that belong diff --git a/rpc/namespaces/ethereum/miner/api.go b/rpc/namespaces/ethereum/miner/api.go index 901c567a46..9d5e8fc556 100644 --- a/rpc/namespaces/ethereum/miner/api.go +++ b/rpc/namespaces/ethereum/miner/api.go @@ -17,12 +17,9 @@ package miner import ( "github.com/cosmos/cosmos-sdk/server" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/tendermint/tendermint/libs/log" - "github.com/zeta-chain/zetacore/rpc/backend" ) diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 49b654c8dc..fa182c4759 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -21,22 +21,17 @@ import ( "os" "time" - "github.com/zeta-chain/zetacore/rpc/backend" - - "github.com/evmos/ethermint/crypto/hd" - ethermint "github.com/evmos/ethermint/types" - - "github.com/tendermint/tendermint/libs/log" - "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" - + "github.com/evmos/ethermint/crypto/hd" + ethermint "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/tendermint/tendermint/libs/log" + "github.com/zeta-chain/zetacore/rpc/backend" ) // PrivateAccountAPI is the personal_ prefixed set of APIs in the Web3 JSON-RPC spec. diff --git a/rpc/namespaces/ethereum/txpool/api.go b/rpc/namespaces/ethereum/txpool/api.go index e8320b6655..89fb056bde 100644 --- a/rpc/namespaces/ethereum/txpool/api.go +++ b/rpc/namespaces/ethereum/txpool/api.go @@ -16,10 +16,8 @@ package txpool import ( - "github.com/tendermint/tendermint/libs/log" - "github.com/ethereum/go-ethereum/common/hexutil" - + "github.com/tendermint/tendermint/libs/log" "github.com/zeta-chain/zetacore/rpc/types" ) diff --git a/rpc/namespaces/ethereum/web3/api.go b/rpc/namespaces/ethereum/web3/api.go index 47f522785d..46e09d9637 100644 --- a/rpc/namespaces/ethereum/web3/api.go +++ b/rpc/namespaces/ethereum/web3/api.go @@ -19,10 +19,9 @@ import ( "fmt" "runtime" - "github.com/zeta-chain/zetacore/common" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" + "github.com/zeta-chain/zetacore/common" ) // PublicAPI is the web3_ prefixed set of APIs in the Web3 JSON-RPC spec. diff --git a/rpc/websockets.go b/rpc/websockets.go index c76a028ea3..ba0419efcc 100644 --- a/rpc/websockets.go +++ b/rpc/websockets.go @@ -27,27 +27,28 @@ import ( "sync" "github.com/cosmos/cosmos-sdk/client" - "github.com/gorilla/mux" - "github.com/gorilla/websocket" - "github.com/pkg/errors" - "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/eth/filters" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - + evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/gorilla/mux" + "github.com/gorilla/websocket" + "github.com/pkg/errors" "github.com/tendermint/tendermint/libs/log" rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" tmtypes "github.com/tendermint/tendermint/types" - - evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/zeta-chain/zetacore/rpc/ethereum/pubsub" rpcfilters "github.com/zeta-chain/zetacore/rpc/namespaces/ethereum/eth/filters" "github.com/zeta-chain/zetacore/rpc/types" "github.com/zeta-chain/zetacore/server/config" ) +const ( + messageSizeLimit = 32 * 1024 * 1024 // 32MB +) + type WebsocketsServer interface { Start() } @@ -139,6 +140,8 @@ func (s *websocketsServer) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } + conn.SetReadLimit(messageSizeLimit) + s.readLoop(&wsConn{ mux: new(sync.Mutex), conn: conn,