diff --git a/.github/workflows/ante-benchmark.yml b/.github/workflows/ante-benchmark.yml index 7ac5153cb..2d55b6dd5 100644 --- a/.github/workflows/ante-benchmark.yml +++ b/.github/workflows/ante-benchmark.yml @@ -3,12 +3,16 @@ name: AnteHandler Benchmark Tests on: push: branches: + - develop - main + - master paths: - 'app/ante/**' pull_request: branches: + - develop - main + - master paths: - 'app/ante/**' @@ -22,7 +26,7 @@ jobs: - name: Setup Golang uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' check-latest: true - name: Run benchmark tests diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8559c4569..c636203a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,24 +2,23 @@ name: Build on: pull_request: branches: + - develop - main + - master -jobs: - cleanup-runs: - runs-on: ubuntu-latest - steps: - - uses: rokroskar/workflow-run-cleanup-action@master - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" +# Automatically cancel run if another commit to the same ref is detected. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' check-latest: true - uses: technote-space/get-diff-action@v6.1.2 id: git_diff diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 89703aac3..0485a8127 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,10 +13,10 @@ name: "CodeQL" on: push: - branches: [main] + branches: [develop, main, master] pull_request: # The branches below must be a subset of the branches above - branches: [main] + branches: [develop, main, master] schedule: - cron: '37 21 * * 4' diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index 719009db6..d03ad9513 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' check-latest: true - name: "Checkout Repository" uses: actions/checkout@v4 diff --git a/.github/workflows/e2e-test-release.yml b/.github/workflows/e2e-test-release.yml index 79a58979c..95fd08b67 100644 --- a/.github/workflows/e2e-test-release.yml +++ b/.github/workflows/e2e-test-release.yml @@ -13,7 +13,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' check-latest: true - uses: actions/checkout@v4 - name: Test E2E diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index f6dab961e..d6a281f3a 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -2,10 +2,14 @@ name: E2E Test on: pull_request: branches: + - develop - main + - master push: branches: + - develop - main + - master jobs: test-e2e: @@ -13,7 +17,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' check-latest: true - uses: actions/checkout@v4 - uses: technote-space/get-diff-action@v6.1.2 diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index f1dbbaa57..9fc7c3002 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' check-latest: true - name: release dry run run: make release-dry-run diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index a897fd5d1..28e30fd13 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -3,12 +3,14 @@ on: pull_request: push: branches: + - develop - main + - master jobs: triage: runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + - uses: actions/labeler@v4 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0e6c3fc1e..7acc1096d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,12 +1,17 @@ name: Lint -# Lint runs golangci-lint over the entire exocore repository This workflow is -# run on every pull request and push to main The `golangci` will pass without +# Lint runs golangci-lint over the entire exocore repository. The `golangci` will pass without # running if no *.{go, mod, sum} files have been changed. on: pull_request: push: branches: + - develop - main + - master + +permissions: + contents: read + jobs: golangci: name: Run golangci-lint @@ -14,20 +19,25 @@ jobs: timeout-minutes: 10 steps: # Required: setup-go, for all versions v3.0.0+ of golangci-lint - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: '1.20' - check-latest: true + go-version: '1.21' + # Use pinned versions, not git versions + check-latest: false + # Match `golangci-lint-action` recommendation + cache: false - uses: actions/checkout@v4 + # Only operate if there are any differences in go files - uses: technote-space/get-diff-action@v6.1.2 with: PATTERNS: | **/**.go go.mod go.sum - - uses: golangci/golangci-lint-action@v3.7.0 + # Now, the actual golangci-lint configuration + - uses: golangci/golangci-lint-action@v4 with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. + # Required parameter version: latest args: --timeout 10m github-token: ${{ secrets.github_token }} diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml index 8e4ce3be1..f276610e8 100644 --- a/.github/workflows/markdown-links.yml +++ b/.github/workflows/markdown-links.yml @@ -5,7 +5,9 @@ on: - '**.md' push: branches: + - develop - main + - master paths: - '**.md' diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 7951718a1..54ceec5c7 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -3,7 +3,9 @@ on: pull_request: push: branches: + - develop - main + - master jobs: Gosec: diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index d0ece2e47..c54ae1743 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -4,7 +4,9 @@ on: pull_request: {} push: branches: + - develop - main + - master paths: - .github/workflows/semgrep.yml schedule: @@ -19,7 +21,8 @@ jobs: if: (github.actor != 'dependabot[bot]') steps: - name: Permission issue fix - run: git config --global --add safe.directory /__w/ExocoreNetwork/exocore + # semgrep for some reason sets the working directory to exocore/exocore + run: git config --global --add safe.directory /__w/exocore/exocore - uses: actions/checkout@v4 - name: Get Diff uses: technote-space/get-diff-action@v6.1.2 diff --git a/.github/workflows/slither.yml b/.github/workflows/slither.yml index 713b512f6..23826ddb6 100644 --- a/.github/workflows/slither.yml +++ b/.github/workflows/slither.yml @@ -4,10 +4,14 @@ on: pull_request: push: branches: + - develop - main + - master jobs: analyze: + # disabled for now, since we don't have any Solidity files. + if: ${{ false }} name: Run Slither runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/solidity-test.yml b/.github/workflows/solidity-test.yml index 74935d1e9..b8b857c46 100644 --- a/.github/workflows/solidity-test.yml +++ b/.github/workflows/solidity-test.yml @@ -2,7 +2,9 @@ name: Solidity Test on: pull_request: branches: + - develop - main + - master - release/** jobs: @@ -11,7 +13,7 @@ jobs: steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' check-latest: true - uses: actions/checkout@v4 - uses: technote-space/get-diff-action@v6.1.2 diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 792a3aa77..6ef2521d8 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -9,9 +9,9 @@ name: Lint Code Base on: push: - branches: ["main"] + branches: ["develop", "main", "master"] pull_request: - branches: ["main"] + branches: ["develop", "main", "master"] jobs: run-lint: runs-on: ubuntu-latest @@ -34,5 +34,5 @@ jobs: VALIDATE_OPENAPI: false VALIDATE_JSCPD: false VALIDATE_GO: false - DEFAULT_BRANCH: "main" + DEFAULT_BRANCH: "master" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f41650060..9b9406946 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,24 +3,23 @@ on: pull_request: push: branches: + - develop - main + - master - release/** -jobs: - cleanup-runs: - runs-on: ubuntu-latest - steps: - - uses: rokroskar/workflow-run-cleanup-action@master - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'" +# Automatically cancel run if another commit to the same ref is detected. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: test-unit-cover: runs-on: ubuntu-latest steps: - uses: actions/setup-go@v4 with: - go-version: '1.20' + go-version: '1.21' check-latest: true - uses: actions/checkout@v4 - uses: technote-space/get-diff-action@v6.1.2 diff --git a/.golangci.yml b/.golangci.yml index 44644c5f5..e58b0924c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,5 @@ run: - tests: true + tests: false timeout: 5m concurrency: 4 @@ -50,7 +50,7 @@ linters-settings: require-explanation: false require-specific: false gofumpt: - lang-version: "1.20" + lang-version: "1.21" gomodguard: blocked: versions: # List of blocked module version constraints @@ -60,3 +60,11 @@ linters-settings: - https://github.com/dgrijalva/jwt-go: # Blocked module with version constraint version: ">= 4.0.0-preview1" # Version constraint, see https://github.com/Masterminds/semver#basic-comparisons reason: "CVE-2020-26160" # Reason why the version constraint exists. (Optional) + +issues: + exclude-rules: + # `gofmt` has made this rule strict, which `nolintlint` followed by removing the option. + # however, other linters have not yet caught up. + - text: 'leading space' + linters: + - nolintlint \ No newline at end of file diff --git a/README.md b/README.md index 0243b8f64..0bf8301c0 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,25 @@ - +# exocore -Exocore is a scalable, high-throughput Proof-of-Stake blockchain -that is fully compatible and interoperable with Ethereum. -It's built using the [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/) -which runs on top of the [Tendermint Core](https://github.com/tendermint/tendermint) consensus engine. - -## Quick Start - -To learn how Exocore works from a high-level perspective. - -TBD +Exocore is an omnichain restaking protocol that combines the crypto-economic security from multiple blockchain networks and tokens, and extends it to any off-chain system. The protocol is designed with a modular architecture, incorporating Tendermint-based Byzantine Fault Tolerant (BFT) consensus mechanism, Zero-Knowledge (ZK) light-client bridging, and a fully EVM-compatible execution environment. This design enables smooth interactions for restakers and seamless integration for developers. Additionally, we introduce novel concepts, such as Union Restaking, where off-chain services can form a union to extend the crypto-economic security of their own tokens to each other. By pooling crypto-economic security and extending it to off-chain systems, Exocore powers an open market for decentralized trust. ## Documentation -TBD - -## Installation -Once the dependencies are installed, run: - -```bash -make install -``` - -Or check out the latest [release](https://github.com/Exocore/Exocore/releases). - -## Community -TBD -## Contributing -TBD \ No newline at end of file +To learn how Exocore works from a high-level perspective, see the [Exocore Whitepaper](https://t.co/A4y4YcOuEC) + +## Creating docker images +1. Once the dependencies are installed, execute +`make localnet-init`, this will generate the cluster configuration file. +2. Run the following command to create the docker image: + ```bash + make localnet-build + # Check if images build done + docker images + ``` +3. Launch the chain node: + ```bash + make localnet-start + # Check if containers are all up + docker ps + ``` +## Interacting with a local node +With a node running, the exocored binary can be used to interact with the node. Run `./bin/exocored --help` to get information about the available commands. \ No newline at end of file diff --git a/app/tps_counter.go b/app/tps_counter.go index f8af29a52..2e6eb475b 100644 --- a/app/tps_counter.go +++ b/app/tps_counter.go @@ -41,7 +41,10 @@ func newTPSCounter(logger log.Logger) *tpsCounter { return &tpsCounter{logger: logger, doneCh: make(chan bool, 1)} } +// nolint: unused // legacy code func (tpc *tpsCounter) incrementSuccess() { atomic.AddUint64(&tpc.nSuccessful, 1) } + +// nolint: unused // legacy code func (tpc *tpsCounter) incrementFailure() { atomic.AddUint64(&tpc.NFailed, 1) } const defaultTPSReportPeriod = 10 * time.Second diff --git a/precompiles/delegation/abi.json b/precompiles/delegation/abi.json index 9231aef18..14575e108 100644 --- a/precompiles/delegation/abi.json +++ b/precompiles/delegation/abi.json @@ -4,7 +4,7 @@ [ { "internalType": "uint16", - "name": "clientChainLzId", + "name": "clientChainLzID", "type": "uint16" }, { @@ -50,7 +50,7 @@ [ { "internalType": "uint16", - "name": "clientChainLzId", + "name": "clientChainLzID", "type": "uint16" }, { diff --git a/precompiles/delegation/delegation.sol b/precompiles/delegation/delegation.sol index 08049d557..e2109ec25 100644 --- a/precompiles/delegation/delegation.sol +++ b/precompiles/delegation/delegation.sol @@ -16,14 +16,14 @@ interface IDelegation { /// TRANSACTIONS /// @dev delegate the client chain assets to the operator through client chain, that will change the states in delegation and restaking_assets_manage module /// Note that this address cannot be a module account. -/// @param clientChainLzId The lzId of client chain +/// @param clientChainLzID The lzId of client chain /// @param lzNonce The cross chain tx layerZero nonce /// @param assetsAddress The client chain asset Address /// @param stakerAddress The staker address /// @param operatorAddr The operator address that wants to be delegated to /// @param opAmount The delegation amount function delegateToThroughClientChain( - uint16 clientChainLzId, + uint16 clientChainLzID, uint64 lzNonce, bytes memory assetsAddress, bytes memory stakerAddress, @@ -34,14 +34,14 @@ interface IDelegation { /// TRANSACTIONS /// @dev undelegate the client chain assets from the operator through client chain, that will change the states in delegation and restaking_assets_manage module /// Note that this address cannot be a module account. -/// @param clientChainLzId The lzId of client chain +/// @param clientChainLzID The lzId of client chain /// @param lzNonce The cross chain tx layerZero nonce /// @param assetsAddress The client chain asset Address /// @param stakerAddress The staker address /// @param operatorAddr The operator address that wants to unDelegate from /// @param opAmount The Undelegation amount function undelegateFromThroughClientChain( - uint16 clientChainLzId, + uint16 clientChainLzID, uint64 lzNonce, bytes memory assetsAddress, bytes memory stakerAddress, diff --git a/precompiles/delegation/delegation_test.go b/precompiles/delegation/delegation_test.go index 30845261c..cd869a26a 100644 --- a/precompiles/delegation/delegation_test.go +++ b/precompiles/delegation/delegation_test.go @@ -69,7 +69,7 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") opAccAddr := "evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl" - clientChainLzId := 101 + clientChainLzID := 101 lzNonce := 0 delegationAmount := big.NewInt(50) depositAmount := big.NewInt(100) @@ -78,7 +78,7 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { depositAsset := func(staker []byte, depositAmount sdkmath.Int) { // deposit asset for delegation test params := &keeper.DepositParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Deposit, StakerAddress: staker, AssetsAddress: usdtAddress, @@ -106,7 +106,7 @@ func (s *PrecompileTestSuite) TestRunDelegateToThroughClientChain() { s.app.DistrKeeper.AllocateTokensToValidator(s.ctx, val, sdk.NewDecCoinsFromCoins(coins...)) input, err := s.precompile.Pack( delegation.MethodDelegateToThroughClientChain, - uint16(clientChainLzId), + uint16(clientChainLzID), uint64(lzNonce), assetAddr, paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), @@ -295,7 +295,7 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") operatorAddr := "evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl" - clientChainLzId := 101 + clientChainLzID := 101 lzNonce := uint64(0) delegationAmount := big.NewInt(50) depositAmount := big.NewInt(100) @@ -303,7 +303,7 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { depositAsset := func(staker []byte, depositAmount sdkmath.Int) { // deposit asset for delegation test params := &keeper.DepositParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Deposit, StakerAddress: staker, AssetsAddress: usdtAddress, @@ -316,7 +316,7 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { delegateAsset := func(staker []byte, delegateAmount sdkmath.Int) { // deposit asset for delegation test delegateToParams := &keeper2.DelegationOrUndelegationParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.DelegateTo, StakerAddress: staker, AssetsAddress: usdtAddress, @@ -348,7 +348,7 @@ func (s *PrecompileTestSuite) TestRunUnDelegateFromThroughClientChain() { s.app.DistrKeeper.AllocateTokensToValidator(s.ctx, val, sdk.NewDecCoinsFromCoins(coins...)) input, err := s.precompile.Pack( delegation.MethodUndelegateFromThroughClientChain, - uint16(clientChainLzId), + uint16(clientChainLzID), lzNonce+1, assetAddr, paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), diff --git a/precompiles/delegation/tx.go b/precompiles/delegation/tx.go index ee246b181..2c9e8cb21 100644 --- a/precompiles/delegation/tx.go +++ b/precompiles/delegation/tx.go @@ -25,9 +25,9 @@ const ( // DelegateToThroughClientChain delegate the client chain assets to the operator through client chain, that will change the states in delegation and restaking_assets_manage module func (p Precompile) DelegateToThroughClientChain( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, - stateDB vm.StateDB, + _ vm.StateDB, method *abi.Method, args []interface{}, ) ([]byte, error) { @@ -55,9 +55,9 @@ func (p Precompile) DelegateToThroughClientChain( // UndelegateFromThroughClientChain Undelegation the client chain assets from the operator through client chain, that will change the states in delegation and restaking_assets_manage module func (p Precompile) UndelegateFromThroughClientChain( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, - stateDB vm.StateDB, + _ vm.StateDB, method *abi.Method, args []interface{}, ) ([]byte, error) { diff --git a/precompiles/delegation/types.go b/precompiles/delegation/types.go index c11559f59..864aa292e 100644 --- a/precompiles/delegation/types.go +++ b/precompiles/delegation/types.go @@ -24,9 +24,9 @@ func (p Precompile) GetDelegationParamsFromInputs(ctx sdk.Context, args []interf if !ok { return nil, fmt.Errorf(ErrContractInputParaOrType, 0, reflect.TypeOf(args[0]), clientChainLzID) } - delegationParams.ClientChainLzId = uint64(clientChainLzID) + delegationParams.ClientChainLzID = uint64(clientChainLzID) - info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, delegationParams.ClientChainLzId) + info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, delegationParams.ClientChainLzID) if err != nil { return nil, err } @@ -66,9 +66,9 @@ func (p Precompile) GetDelegationParamsFromInputs(ctx sdk.Context, args []interf return nil, fmt.Errorf(ErrInputOperatorAddrLength, len(operatorAddr), types.ExoCoreOperatorAddrLength) } - opAccAddr, err := sdk.AccAddressFromBech32(string(operatorAddr[:])) + opAccAddr, err := sdk.AccAddressFromBech32(string(operatorAddr)) if err != nil { - return nil, errorsmod.Wrap(err, fmt.Sprintf("error occurred when parse acc address from Bech32,the addr is:%s", string(operatorAddr[:]))) + return nil, errorsmod.Wrap(err, fmt.Sprintf("error occurred when parse acc address from Bech32,the addr is:%s", string(operatorAddr))) } delegationParams.OperatorAddress = opAccAddr diff --git a/precompiles/deposit/abi.json b/precompiles/deposit/abi.json index bf15e4d64..029092796 100644 --- a/precompiles/deposit/abi.json +++ b/precompiles/deposit/abi.json @@ -4,7 +4,7 @@ [ { "internalType": "uint16", - "name": "clientChainLzId", + "name": "clientChainLzID", "type": "uint16" }, { diff --git a/precompiles/deposit/deposit.go b/precompiles/deposit/deposit.go index a178f1822..56d9d2389 100644 --- a/precompiles/deposit/deposit.go +++ b/precompiles/deposit/deposit.go @@ -90,9 +90,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ // It avoids panics and returns the out of gas error so the EVM can continue gracefully. defer cmn.HandleGasError(ctx, contract, initialGas, &err)() - switch method.Name { - // deposit transactions - case MethodDepositTo: + if method.Name == MethodDepositTo { bz, err = p.DepositTo(ctx, evm.Origin, contract, stateDB, method, args) } diff --git a/precompiles/deposit/deposit.sol b/precompiles/deposit/deposit.sol index f0d925add..179a2f81a 100644 --- a/precompiles/deposit/deposit.sol +++ b/precompiles/deposit/deposit.sol @@ -16,12 +16,12 @@ interface IDeposit { /// TRANSACTIONS /// @dev deposit the client chain assets to the staker, that will change the state in deposit module /// Note that this address cannot be a module account. -/// @param clientChainLzId The lzId of client chain +/// @param clientChainLzID The lzId of client chain /// @param assetsAddress The client chain asset Address /// @param stakerAddress The staker address /// @param opAmount The deposit amount function depositTo( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory stakerAddress, uint256 opAmount diff --git a/precompiles/deposit/deposit_integrate_test.go b/precompiles/deposit/deposit_integrate_test.go index 41d29bee6..da95dee29 100644 --- a/precompiles/deposit/deposit_integrate_test.go +++ b/precompiles/deposit/deposit_integrate_test.go @@ -35,7 +35,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromEOA() { ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) - clientChainLzId := 101 + clientChainLzID := 101 stakerAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress @@ -61,7 +61,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromEOA() { s.Require().NoError(err) defaultDepositArgs := defaultCallArgs.WithMethodName(method) return defaultDepositArgs.WithArgs( - uint16(clientChainLzId), + uint16(clientChainLzID), assetAddr, stakerAddr, opAmount) @@ -92,7 +92,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) - clientChainLzId := 101 + clientChainLzID := 101 stakerAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress @@ -131,7 +131,7 @@ func (s *PrecompileTestSuite) TestCallDepositToFromContract() { s.Require().NoError(err) defaultDepositArgs := defaultCallArgs.WithMethodName(method) return defaultDepositArgs.WithArgs( - uint16(clientChainLzId), + uint16(clientChainLzID), assetAddr, stakerAddr, opAmount) diff --git a/precompiles/deposit/deposit_test.go b/precompiles/deposit/deposit_test.go index 85449b5c1..a2d33e405 100644 --- a/precompiles/deposit/deposit_test.go +++ b/precompiles/deposit/deposit_test.go @@ -56,7 +56,7 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) usdcAddress := paddingClientChainAddress(common.FromHex("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), types.GeneralClientChainAddrLength) - clientChainLzId := 101 + clientChainLzID := 101 stakerAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress @@ -68,7 +68,7 @@ func (s *PrecompileTestSuite) TestRunDepositTo() { s.app.DistrKeeper.AllocateTokensToValidator(s.ctx, val, sdk.NewDecCoinsFromCoins(coins...)) input, err := s.precompile.Pack( deposit.MethodDepositTo, - uint16(clientChainLzId), + uint16(clientChainLzID), assetAddr, stakerAddr, opAmount, diff --git a/precompiles/deposit/tx.go b/precompiles/deposit/tx.go index a184dd704..3ab5fe006 100644 --- a/precompiles/deposit/tx.go +++ b/precompiles/deposit/tx.go @@ -19,9 +19,9 @@ const ( // DepositTo deposit the client chain assets to the staker, that will change the state in deposit module. func (p Precompile) DepositTo( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, - stateDB vm.StateDB, + _ vm.StateDB, method *abi.Method, args []interface{}, ) ([]byte, error) { @@ -48,8 +48,8 @@ func (p Precompile) DepositTo( } // get the latest asset state of staker to return. - stakerId, assetId := types.GetStakeIDAndAssetId(depositParams.ClientChainLzId, depositParams.StakerAddress, depositParams.AssetsAddress) - info, err := p.stakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(depositParams.ClientChainLzID, depositParams.StakerAddress, depositParams.AssetsAddress) + info, err := p.stakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerID, assetID) if err != nil { return nil, err } diff --git a/precompiles/deposit/types.go b/precompiles/deposit/types.go index 5ed048e27..dddc870f9 100644 --- a/precompiles/deposit/types.go +++ b/precompiles/deposit/types.go @@ -21,9 +21,9 @@ func (p Precompile) GetDepositToParamsFromInputs(ctx sdk.Context, args []interfa if !ok { return nil, fmt.Errorf(ErrContractInputParaOrType, 0, reflect.TypeOf(args[0]), clientChainLzID) } - depositParams.ClientChainLzId = uint64(clientChainLzID) + depositParams.ClientChainLzID = uint64(clientChainLzID) - info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, depositParams.ClientChainLzId) + info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, depositParams.ClientChainLzID) if err != nil { return nil, err } diff --git a/precompiles/reward/abi.json b/precompiles/reward/abi.json index b956787e0..598f805fb 100644 --- a/precompiles/reward/abi.json +++ b/precompiles/reward/abi.json @@ -3,7 +3,7 @@ "inputs":[ { "internalType":"uint16", - "name":"clientChainLzId", + "name":"clientChainLzID", "type":"uint16" }, { diff --git a/precompiles/reward/claimReward.sol b/precompiles/reward/claimReward.sol index b6af178b3..80e0668bc 100644 --- a/precompiles/reward/claimReward.sol +++ b/precompiles/reward/claimReward.sol @@ -16,12 +16,12 @@ interface IClaimReward { /// TRANSACTIONS /// @dev ClaimReward To the staker, that will change the state in reward module /// Note that this address cannot be a module account. -/// @param clientChainLzId The lzId of client chain +/// @param clientChainLzID The lzId of client chain /// @param assetsAddress The client chain asset Address /// @param withdrawRewardAddress The claim reward address /// @param opAmount The reward amount function claimReward( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory withdrawRewardAddress, uint256 opAmount diff --git a/precompiles/reward/methods.go b/precompiles/reward/methods.go index cd5ec2baf..ba56ed3a2 100644 --- a/precompiles/reward/methods.go +++ b/precompiles/reward/methods.go @@ -19,9 +19,9 @@ const ( // Reward assets to the staker, that will change the state in reward module. func (p Precompile) Reward( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, - stateDB vm.StateDB, + _ vm.StateDB, method *abi.Method, args []interface{}, ) ([]byte, error) { @@ -45,8 +45,8 @@ func (p Precompile) Reward( return nil, err } // get the latest asset state of staker to return. - stakerId, assetId := types.GetStakeIDAndAssetId(rewardParam.ClientChainLzId, rewardParam.WithdrawRewardAddress, rewardParam.AssetsAddress) - info, err := p.stakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(rewardParam.ClientChainLzID, rewardParam.WithdrawRewardAddress, rewardParam.AssetsAddress) + info, err := p.stakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerID, assetID) if err != nil { return nil, err } diff --git a/precompiles/reward/parser.go b/precompiles/reward/parser.go index b4296c9a5..eb7f194ac 100644 --- a/precompiles/reward/parser.go +++ b/precompiles/reward/parser.go @@ -22,9 +22,9 @@ func (p Precompile) GetRewardParamsFromInputs(ctx sdk.Context, args []interface{ if !ok { return nil, fmt.Errorf(ErrContractInputParaOrType, 0, reflect.TypeOf(args[0]), clientChainLzID) } - rewardParams.ClientChainLzId = uint64(clientChainLzID) + rewardParams.ClientChainLzID = uint64(clientChainLzID) - info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, rewardParams.ClientChainLzId) + info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, rewardParams.ClientChainLzID) if err != nil { return nil, err } diff --git a/precompiles/reward/reward.go b/precompiles/reward/reward.go index 96f0ac70f..b2e9888db 100644 --- a/precompiles/reward/reward.go +++ b/precompiles/reward/reward.go @@ -91,9 +91,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ // It avoids panics and returns the out of gas error so the EVM can continue gracefully. defer cmn.HandleGasError(ctx, contract, initialGas, &err)() - switch method.Name { - // reward transactions - case MethodReward: + if method.Name == MethodReward { bz, err = p.Reward(ctx, evm.Origin, contract, stateDB, method, args) } diff --git a/precompiles/reward/reward_test.go b/precompiles/reward/reward_test.go index 7190b14dc..3306dba68 100644 --- a/precompiles/reward/reward_test.go +++ b/precompiles/reward/reward_test.go @@ -55,14 +55,14 @@ func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { // deposit params for test exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") - clientChainLzId := 101 + clientChainLzID := 101 withdrawAmount := big.NewInt(10) depositAmount := big.NewInt(100) assetAddr := paddingClientChainAddress(usdtAddress, types.GeneralClientChainAddrLength) depositAsset := func(staker []byte, depositAmount sdkmath.Int) { // deposit asset for reward test params := &keeper.DepositParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Deposit, StakerAddress: staker, AssetsAddress: usdtAddress, @@ -76,7 +76,7 @@ func (s *PrecompileTestSuite) TestRunRewardThroughClientChain() { // Prepare the call input for reward test input, err := s.precompile.Pack( reward.MethodReward, - uint16(clientChainLzId), + uint16(clientChainLzID), assetAddr, paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), withdrawAmount, diff --git a/precompiles/slash/abi.json b/precompiles/slash/abi.json index 358f0fb61..9ae673bc0 100644 --- a/precompiles/slash/abi.json +++ b/precompiles/slash/abi.json @@ -3,7 +3,7 @@ "inputs":[ { "internalType":"uint16", - "name":"clientChainLzId", + "name":"clientChainLzID", "type":"uint16" }, { diff --git a/precompiles/slash/methods.go b/precompiles/slash/methods.go index c50a90c26..0c35af83a 100644 --- a/precompiles/slash/methods.go +++ b/precompiles/slash/methods.go @@ -18,9 +18,9 @@ const ( // SubmitSlash Slash assets to the staker, that will change the state in slash module. func (p Precompile) SubmitSlash( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, - stateDB vm.StateDB, + _ vm.StateDB, method *abi.Method, args []interface{}, ) ([]byte, error) { diff --git a/precompiles/slash/parser.go b/precompiles/slash/parser.go index ad29a726d..792b74c76 100644 --- a/precompiles/slash/parser.go +++ b/precompiles/slash/parser.go @@ -21,9 +21,9 @@ func (p Precompile) GetSlashParamsFromInputs(ctx sdk.Context, args []interface{} if !ok { return nil, fmt.Errorf(ErrContractInputParaOrType, 0, reflect.TypeOf(args[0]), clientChainLzID) } - slashParams.ClientChainLzId = uint64(clientChainLzID) + slashParams.ClientChainLzID = uint64(clientChainLzID) - info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, slashParams.ClientChainLzId) + info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, slashParams.ClientChainLzID) if err != nil { return nil, err } diff --git a/precompiles/slash/slash.go b/precompiles/slash/slash.go index 34483b154..5e0135c19 100644 --- a/precompiles/slash/slash.go +++ b/precompiles/slash/slash.go @@ -91,9 +91,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ // It avoids panics and returns the out of gas error so the EVM can continue gracefully. defer cmn.HandleGasError(ctx, contract, initialGas, &err)() - switch method.Name { - // slash transactions - case MethodSlash: + if method.Name == MethodSlash { bz, err = p.SubmitSlash(ctx, evm.Origin, contract, stateDB, method, args) } diff --git a/precompiles/slash/slash.sol b/precompiles/slash/slash.sol index 87f63a834..6ac780974 100644 --- a/precompiles/slash/slash.sol +++ b/precompiles/slash/slash.sol @@ -16,7 +16,7 @@ interface ISlash { /// TRANSACTIONS /// @dev Slash the oprator, that will change the state in Slash module /// Note that this address cannot be a module account. -/// @param clientChainLzId The lzId of client chain +/// @param clientChainLzID The lzId of client chain /// @param assetsAddress The client chain asset Address /// @param opAmount The Slash amount /// @param operatorAddress The Slashed OperatorAddress @@ -25,7 +25,7 @@ interface ISlash { /// @param proof The Slash proof function submitSlash( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory stakerAddress, uint256 opAmount, diff --git a/precompiles/slash/slash_test.go b/precompiles/slash/slash_test.go index 27f1e874a..6d653dab6 100644 --- a/precompiles/slash/slash_test.go +++ b/precompiles/slash/slash_test.go @@ -55,14 +55,14 @@ func (s *PrecompileTestSuite) TestRunSlash() { // deposit params for test exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") - clientChainLzId := 101 + clientChainLzID := 101 slashAmount := big.NewInt(10) depositAmount := big.NewInt(100) assetAddr := paddingClientChainAddress(usdtAddress, types.GeneralClientChainAddrLength) depositAsset := func(staker []byte, depositAmount sdkmath.Int) { // deposit asset for slash test params := &keeper.DepositParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Deposit, StakerAddress: staker, AssetsAddress: usdtAddress, @@ -76,7 +76,7 @@ func (s *PrecompileTestSuite) TestRunSlash() { // Prepare the call input for slash test input, err := s.precompile.Pack( slash.MethodSlash, - uint16(clientChainLzId), + uint16(clientChainLzID), assetAddr, paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), slashAmount, diff --git a/precompiles/testutil/contracts/DepositCaller.json b/precompiles/testutil/contracts/DepositCaller.json index 255c068c2..38bd8060c 100644 --- a/precompiles/testutil/contracts/DepositCaller.json +++ b/precompiles/testutil/contracts/DepositCaller.json @@ -1,4 +1,4 @@ { - "abi": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"errorMessage\",\"type\":\"string\"}],\"name\":\"ErrorOccurred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"latestAssetState\",\"type\":\"uint256\"}],\"name\":\"callDepositToResult\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"clientChainLzId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"assetsAddress\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"stakerAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"opAmount\",\"type\":\"uint256\"}],\"name\":\"testCallDepositToAndEmitEvent\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"clientChainLzId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"assetsAddress\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"stakerAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"opAmount\",\"type\":\"uint256\"}],\"name\":\"testCallDepositToWithTryCatch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"clientChainLzId\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"assetsAddress\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"stakerAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"opAmount\",\"type\":\"uint256\"}],\"name\":\"testDepositTo\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + "abi": "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"string\",\"name\":\"errorMessage\",\"type\":\"string\"}],\"name\":\"ErrorOccurred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"latestAssetState\",\"type\":\"uint256\"}],\"name\":\"callDepositToResult\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"clientChainLzID\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"assetsAddress\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"stakerAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"opAmount\",\"type\":\"uint256\"}],\"name\":\"testCallDepositToAndEmitEvent\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"clientChainLzID\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"assetsAddress\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"stakerAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"opAmount\",\"type\":\"uint256\"}],\"name\":\"testCallDepositToWithTryCatch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"clientChainLzID\",\"type\":\"uint16\"},{\"internalType\":\"bytes\",\"name\":\"assetsAddress\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"stakerAddress\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"opAmount\",\"type\":\"uint256\"}],\"name\":\"testDepositTo\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", "bin": "608060405234801561001057600080fd5b5061090a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632f0baf7314610046578063c39b2a2114610077578063e43f6bf3146100a8575b600080fd5b610060600480360381019061005b919061054a565b6100d9565b60405161006e929190610613565b60405180910390f35b610091600480360381019061008c919061054a565b61021f565b60405161009f929190610613565b60405180910390f35b6100c260048036038101906100bd919061054a565b6102ed565b6040516100d0929190610613565b60405180910390f35b60008061080473ffffffffffffffffffffffffffffffffffffffff166358bd9b81878787876040518563ffffffff1660e01b815260040161011d94939291906106ca565b60408051808303816000875af192505050801561015857506040513d601f19601f82011682018060405250810190610155919061075e565b60015b6101d1576101646107ab565b806308c379a0036101c057506101786107cd565b8061018357506101c2565b7fcc8610635659273962514cbb1e149386cc83625cb5595394a01869a0c3fbf7cb816040516101b291906108b2565b60405180910390a1506101cc565b505b3d6000803e3d6000fd5b61020e565b808215157f245dbff7400bcd2635c318abe587da5622f824ca5a373ef16c76c1a929eff0d260405160405180910390a38181935093505050610216565b600080915091505b94509492505050565b60008060008061080473ffffffffffffffffffffffffffffffffffffffff166358bd9b81898989896040518563ffffffff1660e01b815260040161026694939291906106ca565b60408051808303816000875af1158015610284573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a8919061075e565b91509150808215157f245dbff7400bcd2635c318abe587da5622f824ca5a373ef16c76c1a929eff0d260405160405180910390a3818193509350505094509492505050565b60008061080473ffffffffffffffffffffffffffffffffffffffff166358bd9b81878787876040518563ffffffff1660e01b815260040161033194939291906106ca565b60408051808303816000875af115801561034f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610373919061075e565b9150915094509492505050565b6000604051905090565b600080fd5b600080fd5b600061ffff82169050919050565b6103ab81610394565b81146103b657600080fd5b50565b6000813590506103c8816103a2565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b610421826103d8565b810181811067ffffffffffffffff821117156104405761043f6103e9565b5b80604052505050565b6000610453610380565b905061045f8282610418565b919050565b600067ffffffffffffffff82111561047f5761047e6103e9565b5b610488826103d8565b9050602081019050919050565b82818337600083830152505050565b60006104b76104b284610464565b610449565b9050828152602081018484840111156104d3576104d26103d3565b5b6104de848285610495565b509392505050565b600082601f8301126104fb576104fa6103ce565b5b813561050b8482602086016104a4565b91505092915050565b6000819050919050565b61052781610514565b811461053257600080fd5b50565b6000813590506105448161051e565b92915050565b600080600080608085870312156105645761056361038a565b5b6000610572878288016103b9565b945050602085013567ffffffffffffffff8111156105935761059261038f565b5b61059f878288016104e6565b935050604085013567ffffffffffffffff8111156105c0576105bf61038f565b5b6105cc878288016104e6565b92505060606105dd87828801610535565b91505092959194509250565b60008115159050919050565b6105fe816105e9565b82525050565b61060d81610514565b82525050565b600060408201905061062860008301856105f5565b6106356020830184610604565b9392505050565b61064581610394565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561068557808201518184015260208101905061066a565b60008484015250505050565b600061069c8261064b565b6106a68185610656565b93506106b6818560208601610667565b6106bf816103d8565b840191505092915050565b60006080820190506106df600083018761063c565b81810360208301526106f18186610691565b905081810360408301526107058185610691565b90506107146060830184610604565b95945050505050565b610726816105e9565b811461073157600080fd5b50565b6000815190506107438161071d565b92915050565b6000815190506107588161051e565b92915050565b600080604083850312156107755761077461038a565b5b600061078385828601610734565b925050602061079485828601610749565b9150509250929050565b60008160e01c9050919050565b600060033d11156107ca5760046000803e6107c760005161079e565b90505b90565b600060443d1061085a576107df610380565b60043d036004823e80513d602482011167ffffffffffffffff8211171561080757505061085a565b808201805167ffffffffffffffff811115610825575050505061085a565b80602083010160043d03850181111561084257505050505061085a565b61085182602001850186610418565b82955050505050505b90565b600081519050919050565b600082825260208201905092915050565b60006108848261085d565b61088e8185610868565b935061089e818560208601610667565b6108a7816103d8565b840191505092915050565b600060208201905081810360008301526108cc8184610879565b90509291505056fea26469706673582212208f8e24c5ab27a724ba977f623ebc377db7fcae619d3f861bbf3d2e0c9284e2e864736f6c63430008150033" } \ No newline at end of file diff --git a/precompiles/testutil/contracts/DepositCaller.sol b/precompiles/testutil/contracts/DepositCaller.sol index a6e1dcc6f..f17d49a21 100644 --- a/precompiles/testutil/contracts/DepositCaller.sol +++ b/precompiles/testutil/contracts/DepositCaller.sol @@ -9,14 +9,14 @@ contract DepositCaller { event ErrorOccurred(string errorMessage); function testDepositTo( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory stakerAddress, uint256 opAmount ) public returns (bool, uint256) { return deposit.DEPOSIT_CONTRACT.depositTo( - clientChainLzId, + clientChainLzID, assetsAddress, stakerAddress, opAmount @@ -24,13 +24,13 @@ contract DepositCaller { } function testCallDepositToAndEmitEvent( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory stakerAddress, uint256 opAmount ) public returns (bool, uint256) { (bool success,uint256 latestAssetState) = deposit.DEPOSIT_CONTRACT.depositTo( - clientChainLzId, + clientChainLzID, assetsAddress, stakerAddress, opAmount @@ -41,13 +41,13 @@ contract DepositCaller { } function testCallDepositToWithTryCatch( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory stakerAddress, uint256 opAmount ) public returns (bool, uint256) { try deposit.DEPOSIT_CONTRACT.depositTo( - clientChainLzId, + clientChainLzID, assetsAddress, stakerAddress, opAmount @@ -62,7 +62,7 @@ contract DepositCaller { return (false,0); } /* function testDelegateCallDepositTo( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory stakerAddress, uint256 opAmount @@ -70,7 +70,7 @@ contract DepositCaller { (bool success,uint256 latestAssetState) = deposit.DEPOSIT_PRECOMPILE_ADDRESS.delegatecall( abi.encodeWithSignature( "depositTo(uint16,bytes,bytes,uint256)", - clientChainLzId, + clientChainLzID, assetsAddress, stakerAddress, opAmount @@ -81,7 +81,7 @@ contract DepositCaller { } function testStaticCallDepositTo( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory stakerAddress, uint256 opAmount @@ -91,7 +91,7 @@ contract DepositCaller { .staticcall( abi.encodeWithSignature( "depositTo(uint16,bytes,bytes,uint256)", - clientChainLzId, + clientChainLzID, assetsAddress, stakerAddress, opAmount diff --git a/precompiles/withdraw/abi.json b/precompiles/withdraw/abi.json index a425cd496..5ab9282c5 100644 --- a/precompiles/withdraw/abi.json +++ b/precompiles/withdraw/abi.json @@ -3,7 +3,7 @@ "inputs":[ { "internalType":"uint16", - "name":"clientChainLzId", + "name":"clientChainLzID", "type":"uint16" }, { diff --git a/precompiles/withdraw/methods.go b/precompiles/withdraw/methods.go index 60aebb7bc..0a59b01d3 100644 --- a/precompiles/withdraw/methods.go +++ b/precompiles/withdraw/methods.go @@ -18,9 +18,9 @@ const ( // Withdraw assets to the staker, that will change the state in withdraw module. func (p Precompile) Withdraw( ctx sdk.Context, - origin common.Address, + _ common.Address, contract *vm.Contract, - stateDB vm.StateDB, + _ vm.StateDB, method *abi.Method, args []interface{}, ) ([]byte, error) { @@ -44,8 +44,8 @@ func (p Precompile) Withdraw( return nil, err } // get the latest asset state of staker to return. - stakerId, assetId := types.GetStakeIDAndAssetId(withdrawParam.ClientChainLzId, withdrawParam.WithdrawAddress, withdrawParam.AssetsAddress) - info, err := p.stakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(withdrawParam.ClientChainLzID, withdrawParam.WithdrawAddress, withdrawParam.AssetsAddress) + info, err := p.stakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerID, assetID) if err != nil { return nil, err } diff --git a/precompiles/withdraw/parser.go b/precompiles/withdraw/parser.go index 740610946..79595cef9 100644 --- a/precompiles/withdraw/parser.go +++ b/precompiles/withdraw/parser.go @@ -21,9 +21,9 @@ func (p Precompile) GetWithdrawParamsFromInputs(ctx sdk.Context, args []interfac if !ok { return nil, fmt.Errorf(ErrContractInputParaOrType, 0, reflect.TypeOf(args[0]), clientChainLzID) } - withdrawParams.ClientChainLzId = uint64(clientChainLzID) + withdrawParams.ClientChainLzID = uint64(clientChainLzID) - info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, withdrawParams.ClientChainLzId) + info, err := p.stakingStateKeeper.GetClientChainInfoByIndex(ctx, withdrawParams.ClientChainLzID) if err != nil { return nil, err } diff --git a/precompiles/withdraw/withdraw.go b/precompiles/withdraw/withdraw.go index 0c74f8c31..a85532fd7 100644 --- a/precompiles/withdraw/withdraw.go +++ b/precompiles/withdraw/withdraw.go @@ -91,9 +91,7 @@ func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz [ // It avoids panics and returns the out of gas error so the EVM can continue gracefully. defer cmn.HandleGasError(ctx, contract, initialGas, &err)() - switch method.Name { - // Withdraw transactions - case MethodWithdraw: + if method.Name == MethodWithdraw { bz, err = p.Withdraw(ctx, evm.Origin, contract, stateDB, method, args) } diff --git a/precompiles/withdraw/withdraw.sol b/precompiles/withdraw/withdraw.sol index d531d9006..afd90b908 100644 --- a/precompiles/withdraw/withdraw.sol +++ b/precompiles/withdraw/withdraw.sol @@ -16,12 +16,12 @@ interface IWithdraw { /// TRANSACTIONS /// @dev withdraw To the staker, that will change the state in withdraw module /// Note that this address cannot be a module account. -/// @param clientChainLzId The lzId of client chain +/// @param clientChainLzID The lzId of client chain /// @param assetsAddress The client chain asset Address /// @param withdrawAddress The withdraw address /// @param opAmount The withdraw amount function withdrawPrinciple( - uint16 clientChainLzId, + uint16 clientChainLzID, bytes memory assetsAddress, bytes memory withdrawAddress, uint256 opAmount diff --git a/precompiles/withdraw/withdraw_integrate_test.go b/precompiles/withdraw/withdraw_integrate_test.go index 7e3cc61a9..a9566ab19 100644 --- a/precompiles/withdraw/withdraw_integrate_test.go +++ b/precompiles/withdraw/withdraw_integrate_test.go @@ -35,7 +35,7 @@ func (s *PrecompileTestSuite) TestCallWithdrawFromEOA() { ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) - clientChainLzId := 101 + clientChainLzID := 101 stakerAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) assetAddr := usdtAddress @@ -61,7 +61,7 @@ func (s *PrecompileTestSuite) TestCallWithdrawFromEOA() { s.Require().NoError(err) defaultWithdrawArgs := defaultCallArgs.WithMethodName(method) return defaultWithdrawArgs.WithArgs( - uint16(clientChainLzId), + uint16(clientChainLzID), assetAddr, stakerAddr, opAmount) diff --git a/precompiles/withdraw/withdraw_test.go b/precompiles/withdraw/withdraw_test.go index ad3f27bfd..bb4eb7fc7 100644 --- a/precompiles/withdraw/withdraw_test.go +++ b/precompiles/withdraw/withdraw_test.go @@ -7,9 +7,8 @@ import ( "github.com/ExocoreNetwork/exocore/app" "github.com/ExocoreNetwork/exocore/precompiles/withdraw" "github.com/ExocoreNetwork/exocore/x/deposit/keeper" - depositParams "github.com/ExocoreNetwork/exocore/x/deposit/types" + depositparams "github.com/ExocoreNetwork/exocore/x/deposit/types" "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" - withdrawParams "github.com/ExocoreNetwork/exocore/x/withdraw/types" "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" @@ -51,7 +50,7 @@ func paddingClientChainAddress(input []byte, outputLength int) []byte { } func (s *PrecompileTestSuite) TestRequiredGas() { - clientChainLzId := 101 + clientChainLzID := 101 usdtAddress := paddingClientChainAddress(common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7"), types.GeneralClientChainAddrLength) withdrawAddr := paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength) opAmount := big.NewInt(100) @@ -67,7 +66,7 @@ func (s *PrecompileTestSuite) TestRequiredGas() { func() []byte { input, err := s.precompile.Pack( withdraw.MethodWithdraw, - uint16(clientChainLzId), + uint16(clientChainLzID), assetAddr, withdrawAddr, opAmount, @@ -97,14 +96,14 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { // deposit params for test exoCoreLzAppEventTopic := "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec" usdtAddress := common.FromHex("0xdAC17F958D2ee523a2206206994597C13D831ec7") - clientChainLzId := 101 + clientChainLzID := 101 withdrawAmount := big.NewInt(10) depositAmount := big.NewInt(100) assetAddr := paddingClientChainAddress(usdtAddress, types.GeneralClientChainAddrLength) depositAsset := func(staker []byte, depositAmount sdkmath.Int) { // deposit asset for withdraw test params := &keeper.DepositParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Deposit, StakerAddress: staker, AssetsAddress: usdtAddress, @@ -118,7 +117,7 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { // Prepare the call input for withdraw test input, err := s.precompile.Pack( withdraw.MethodWithdraw, - uint16(clientChainLzId), + uint16(clientChainLzID), assetAddr, paddingClientChainAddress(s.address.Bytes(), types.GeneralClientChainAddrLength), withdrawAmount, @@ -139,14 +138,14 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() { { name: "pass - withdraw via pre-compiles", malleate: func() (common.Address, []byte) { - depositModuleParam := &depositParams.Params{ + depositModuleParam := &depositparams.Params{ ExoCoreLzAppAddress: s.address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam) s.Require().NoError(err) depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount)) - withdrawModuleParam := &withdrawParams.Params{ + withdrawModuleParam := &depositparams.Params{ ExoCoreLzAppAddress: s.address.String(), ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic, } diff --git a/proto/exocore/delegation/v1/query.proto b/proto/exocore/delegation/v1/query.proto index d611ffe2e..47650c31a 100644 --- a/proto/exocore/delegation/v1/query.proto +++ b/proto/exocore/delegation/v1/query.proto @@ -10,8 +10,8 @@ import "exocore/delegation/v1/tx.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/delegation/types"; message DelegationInfoReq { - string stakerId = 1; - string assetId = 2; + string stakerID = 1; + string assetID = 2; } message DelegationAmounts{ @@ -40,9 +40,9 @@ message QueryDelegationInfoResponse{ } message SingleDelegationInfoReq { - string stakerId = 1; + string stakerID = 1; string operatorAddr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string assetId = 3; + string assetID = 3; } message QueryOperatorInfoReq { diff --git a/proto/exocore/delegation/v1/tx.proto b/proto/exocore/delegation/v1/tx.proto index f68695858..e74171137 100644 --- a/proto/exocore/delegation/v1/tx.proto +++ b/proto/exocore/delegation/v1/tx.proto @@ -19,7 +19,7 @@ message ValueField { } message DelegatedSingleAssetInfo { - string AssetId = 1; + string AssetID = 1; string TotalDelegatedAmount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -34,7 +34,7 @@ message clientChainEarningAddrList { } message clientChainEarningAddrInfo { - uint64 lzClientChainId = 1; + uint64 lzClientChainID = 1; string clientChainEarningAddr = 2; } @@ -81,8 +81,8 @@ message MsgDelegation{ } message UndelegationRecord{ - string stakerId = 1; - string assetId = 2; + string stakerID = 1; + string assetID = 2; string OperatorAddr = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; string txHash = 4; diff --git a/proto/exocore/restaking_assets_manage/v1/genesis.proto b/proto/exocore/restaking_assets_manage/v1/genesis.proto index d75fc8615..651d52d15 100644 --- a/proto/exocore/restaking_assets_manage/v1/genesis.proto +++ b/proto/exocore/restaking_assets_manage/v1/genesis.proto @@ -9,5 +9,5 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage // GenesisState defines the restaking_assets_manage module's genesis state. message GenesisState { repeated ClientChainInfo DefaultSupportedClientChains = 1; - repeated ClientChainTokenInfo DefaultSupportedClientChainTokens = 2; + repeated AssetInfo DefaultSupportedClientChainTokens = 2; } diff --git a/proto/exocore/restaking_assets_manage/v1/query.proto b/proto/exocore/restaking_assets_manage/v1/query.proto index 00ee592db..c9ad6aca8 100644 --- a/proto/exocore/restaking_assets_manage/v1/query.proto +++ b/proto/exocore/restaking_assets_manage/v1/query.proto @@ -19,7 +19,7 @@ message QueryAllClientChainInfoResponse{ } message QueryStakingAssetInfo{ - string assetId = 1; + string assetID = 1; } message QueryAllStakingAssetsInfo{} @@ -28,15 +28,15 @@ message QueryAllStakingAssetsInfoResponse{ } message QueryStakerAssetInfo{ - string stakerId = 1; + string stakerID = 1; } message QueryAssetInfoResponse{ map assetInfos = 1; } message QuerySpecifiedAssetAmountReq{ - string stakerId = 1; - string assetId = 2; + string stakerID = 1; + string assetID = 2; } @@ -50,11 +50,11 @@ message QueryOperatorAssetInfosResponse{ message QueryOperatorSpecifiedAssetAmountReq{ string operatorAddr = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - string assetId = 2; + string assetID = 2; } message QueryStakerExCoreAddr { - string StakerId = 1; + string StakerID = 1; } message QueryStakerExCoreAddrResponse{ @@ -104,7 +104,7 @@ service Query { rpc QueStakerExoCoreAddr(QueryStakerExCoreAddr) returns (QueryStakerExCoreAddrResponse) { option (cosmos.query.v1.module_query_safe) = true; - option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueStakerExoCoreAddr/{StakerId}"; + option (google.api.http).get = "/exocore/restaking_assets_manage/v1/QueStakerExoCoreAddr/{StakerID}"; } } diff --git a/proto/exocore/restaking_assets_manage/v1/tx.proto b/proto/exocore/restaking_assets_manage/v1/tx.proto index 932858ab0..c3b308ef8 100644 --- a/proto/exocore/restaking_assets_manage/v1/tx.proto +++ b/proto/exocore/restaking_assets_manage/v1/tx.proto @@ -9,17 +9,17 @@ import "amino/amino.proto"; option go_package = "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types"; message ClientChainInfo { - string ChainName = 1; - string ChainMetaInfo = 2; - uint64 OriginChainId = 3; + string Name = 1; + string MetaInfo = 2; + uint64 ChainId = 3; uint64 ExoCoreChainIndex = 4; - uint64 FinalityNeedBlockDelay = 5; - uint64 LayerZeroChainId = 6; + uint64 FinalizationBlocks = 5; + uint64 LayerZeroChainID = 6; string SignatureType = 7; uint32 AddressLength = 8; } -message ClientChainTokenInfo { +message AssetInfo { string Name = 1; string Symbol = 2; string Address = 3; @@ -30,13 +30,13 @@ message ClientChainTokenInfo { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; - uint64 LayerZeroChainId = 6; + uint64 LayerZeroChainID = 6; uint64 ExoCoreChainIndex = 7; - string AssetMetaInfo = 8; + string MetaInfo = 8; } message StakingAssetInfo { - ClientChainTokenInfo AssetBasicInfo = 1; + AssetInfo AssetBasicInfo = 1; string StakingTotalAmount = 2 [ (cosmos_proto.scalar) = "cosmos.Int", @@ -111,10 +111,35 @@ message MsgSetExoCoreAddr { } message MsgSetExoCoreAddrResponse {} +message RegisterClientChainReq { + option (cosmos.msg.v1.signer) = "FromAddress"; + option (amino.name) = "cosmos-sdk/RegisterClientChain"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string FromAddress = 1 + [(cosmos_proto.scalar) = "cosmos.AddressString"]; + ClientChainInfo info = 2; +} +message RegisterClientChainResponse {} + +message RegisterAssetReq { + option (cosmos.msg.v1.signer) = "FromAddress"; + option (amino.name) = "cosmos-sdk/RegisterAsset"; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string FromAddress = 1 + [(cosmos_proto.scalar) = "cosmos.AddressString"]; + AssetInfo info = 2; +} +message RegisterAssetResponse {} + service Msg { option (cosmos.msg.v1.service) = true; rpc SetStakerExoCoreAddr(MsgSetExoCoreAddr) returns (MsgSetExoCoreAddrResponse); - + rpc RegisterClientChain(RegisterClientChainReq) returns (RegisterClientChainResponse); + rpc RegisterAsset(RegisterAssetReq) returns (RegisterAssetResponse); } \ No newline at end of file diff --git a/testutil/tx/eth.go b/testutil/tx/eth.go index e739a13c1..0bf8afb5f 100644 --- a/testutil/tx/eth.go +++ b/testutil/tx/eth.go @@ -17,8 +17,8 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ExocoreNetwork/exocore/app" + "github.com/ExocoreNetwork/exocore/utils" "github.com/evmos/evmos/v14/server/config" - "github.com/evmos/evmos/v14/utils" evmtypes "github.com/evmos/evmos/v14/x/evm/types" ) diff --git a/types/chain_id.go b/types/chain_id.go index e8bf2b4c0..f4cb91d36 100644 --- a/types/chain_id.go +++ b/types/chain_id.go @@ -7,6 +7,8 @@ import ( "strings" errorsmod "cosmossdk.io/errors" + + "github.com/evmos/evmos/v14/types" ) var ( @@ -37,18 +39,18 @@ func IsValidChainID(chainID string) bool { func ParseChainID(chainID string) (*big.Int, error) { chainID = strings.TrimSpace(chainID) if len(chainID) > 48 { - return nil, errorsmod.Wrapf(ErrInvalidChainID, "chain-id '%s' cannot exceed 48 chars", chainID) + return nil, errorsmod.Wrapf(types.ErrInvalidChainID, "chain-id '%s' cannot exceed 48 chars", chainID) } matches := evmosChainID.FindStringSubmatch(chainID) if matches == nil || len(matches) != 4 || matches[1] == "" { - return nil, errorsmod.Wrapf(ErrInvalidChainID, "%s: %v", chainID, matches) + return nil, errorsmod.Wrapf(types.ErrInvalidChainID, "%s: %v", chainID, matches) } // verify that the chain-id entered is a base 10 integer chainIDInt, ok := new(big.Int).SetString(matches[2], 10) if !ok { - return nil, errorsmod.Wrapf(ErrInvalidChainID, "epoch %s must be base-10 integer format", matches[2]) + return nil, errorsmod.Wrapf(types.ErrInvalidChainID, "epoch %s must be base-10 integer format", matches[2]) } return chainIDInt, nil diff --git a/types/errors.go b/types/errors.go deleted file mode 100644 index bdc382e40..000000000 --- a/types/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package types - -import ( - errorsmod "cosmossdk.io/errors" -) - -// RootCodespace is the codespace for all errors defined in this package -const RootCodespace = "evmos" - -// ErrInvalidChainID returns an error resulting from an invalid chain ID. -var ErrInvalidChainID = errorsmod.Register(RootCodespace, 3, "invalid chain ID") diff --git a/utils/store.go b/utils/store.go index d28d3abba..5ffdba114 100644 --- a/utils/store.go +++ b/utils/store.go @@ -4,10 +4,10 @@ import ( "bytes" "strings" + errorsmod "cosmossdk.io/errors" "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ExocoreNetwork/exocore/utils/key" ) @@ -169,7 +169,7 @@ type iterator struct { cdc codec.BinaryCodec } -// UnmarshalValue returns the value marshalled into the given type +// UnmarshalValue returns the value marshaled into the given type func (i iterator) UnmarshalValue(value codec.ProtoMarshaler) { value.Reset() i.cdc.MustUnmarshalLengthPrefixed(i.Value(), value) @@ -262,6 +262,6 @@ func (k basicKey) Equals(other Key) bool { func CloseLogError(iter sdk.Iterator, logger log.Logger) { err := iter.Close() if err != nil { - logger.Error(sdkerrors.Wrap(err, "failed to close kv store iterator").Error()) + logger.Error(errorsmod.Wrap(err, "failed to close kv store iterator").Error()) } } diff --git a/x/delegation/client/cli/query.go b/x/delegation/client/cli/query.go index a89473dbc..6cc258196 100644 --- a/x/delegation/client/cli/query.go +++ b/x/delegation/client/cli/query.go @@ -45,14 +45,14 @@ func QuerySingleDelegationInfo() *cobra.Command { } queryClient := delegationtype.NewQueryClient(clientCtx) - clientChainLzId, err := strconv.ParseUint(args[0], 10, 64) + clientChainLzID, err := strconv.ParseUint(args[0], 10, 64) if err != nil { return errorsmod.Wrap(types.ErrCliCmdInputArg, err.Error()) } - stakerId, assetId := types.GetStakeIDAndAssetIdFromStr(clientChainLzId, args[1], args[2]) + stakerID, assetID := types.GetStakeIDAndAssetIDFromStr(clientChainLzID, args[1], args[2]) req := &delegationtype.SingleDelegationInfoReq{ - StakerId: stakerId, - AssetId: assetId, + StakerID: stakerID, + AssetID: assetID, OperatorAddr: args[3], } res, err := queryClient.QuerySingleDelegationInfo(context.Background(), req) @@ -70,7 +70,7 @@ func QuerySingleDelegationInfo() *cobra.Command { // QueryDelegationInfo queries delegation info func QueryDelegationInfo() *cobra.Command { cmd := &cobra.Command{ - Use: "QueryDelegationInfo stakerId assetId", + Use: "QueryDelegationInfo stakerID assetID", Short: "Get delegation info", Long: "Get delegation info", Args: cobra.ExactArgs(2), @@ -82,8 +82,8 @@ func QueryDelegationInfo() *cobra.Command { queryClient := delegationtype.NewQueryClient(clientCtx) req := &delegationtype.DelegationInfoReq{ - StakerId: args[0], - AssetId: args[1], + StakerID: args[0], + AssetID: args[1], } res, err := queryClient.QueryDelegationInfo(context.Background(), req) if err != nil { diff --git a/x/delegation/client/cli/tx.go b/x/delegation/client/cli/tx.go index 276c11b41..2fddf42d6 100644 --- a/x/delegation/client/cli/tx.go +++ b/x/delegation/client/cli/tx.go @@ -59,13 +59,13 @@ func RegisterOperator() *cobra.Command { if len(strList) != 2 { return errorsmod.Wrap(delegationtype.ErrCliCmdInputArg, fmt.Sprintf("the error input arg is:%s", arg)) } - clientChainLzId, err := strconv.ParseUint(strList[0], 10, 64) + clientChainLzID, err := strconv.ParseUint(strList[0], 10, 64) if err != nil { return err } clientChainEarningAddress.EarningInfoList = append(clientChainEarningAddress.EarningInfoList, &delegationtype.ClientChainEarningAddrInfo{ - LzClientChainId: clientChainLzId, ClientChainEarningAddr: strList[1], + LzClientChainID: clientChainLzID, ClientChainEarningAddr: strList[1], }) } msg.Info.ClientChainEarningsAddr = clientChainEarningAddress diff --git a/x/delegation/keeper/abci.go b/x/delegation/keeper/abci.go index ef6938279..f54838680 100644 --- a/x/delegation/keeper/abci.go +++ b/x/delegation/keeper/abci.go @@ -26,7 +26,7 @@ func (k Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Validat operatorAccAddress := sdk.MustAccAddressFromBech32(record.OperatorAddr) if k.slashKeeper.IsOperatorFrozen(ctx, operatorAccAddress) { // reSet the completed height if the operator is frozen - record.CompleteBlockNumber = k.operatorOptedInKeeper.GetOperatorCanUndelegateHeight(ctx, record.AssetId, operatorAccAddress, record.BlockNumber) + record.CompleteBlockNumber = k.operatorOptedInKeeper.GetOperatorCanUndelegateHeight(ctx, record.AssetID, operatorAccAddress, record.BlockNumber) if record.CompleteBlockNumber <= uint64(ctx.BlockHeight()) { panic(fmt.Sprintf("the reset completedHeight isn't in future,setHeight:%v,curHeight:%v", record.CompleteBlockNumber, ctx.BlockHeight())) } @@ -38,7 +38,7 @@ func (k Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Validat } // get operator slashed proportion to calculate the actual canUndelegated asset amount - proportion := k.slashKeeper.OperatorAssetSlashedProportion(ctx, operatorAccAddress, record.AssetId, record.BlockNumber, record.CompleteBlockNumber) + proportion := k.slashKeeper.OperatorAssetSlashedProportion(ctx, operatorAccAddress, record.AssetID, record.BlockNumber, record.CompleteBlockNumber) if proportion.IsNil() || proportion.IsNegative() || proportion.GT(sdkmath.LegacyNewDec(1)) { panic(fmt.Sprintf("the proportion is invalid,it is:%v", proportion)) } @@ -52,19 +52,19 @@ func (k Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Validat delegatorAndAmount[record.OperatorAddr] = &delegationtype.DelegationAmounts{ WaitUndelegationAmount: recordAmountNeg, } - err = k.UpdateDelegationState(ctx, record.StakerId, record.AssetId, delegatorAndAmount) + err = k.UpdateDelegationState(ctx, record.StakerID, record.AssetID, delegatorAndAmount) if err != nil { panic(err) } // todo: if use recordAmount as an input parameter, the delegation total amount won't need to be subtracted when the related operator is slashed. - err = k.UpdateStakerDelegationTotalAmount(ctx, record.StakerId, record.AssetId, recordAmountNeg) + err = k.UpdateStakerDelegationTotalAmount(ctx, record.StakerID, record.AssetID, recordAmountNeg) if err != nil { panic(err) } // update the staker state - err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, record.StakerId, record.AssetId, types.StakerSingleAssetOrChangeInfo{ + err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, record.StakerID, record.AssetID, types.StakerSingleAssetOrChangeInfo{ CanWithdrawAmountOrWantChangeValue: actualCanUndelegateAmount, WaitUndelegationAmountOrWantChangeValue: recordAmountNeg, }) @@ -73,7 +73,7 @@ func (k Keeper) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.Validat } // update the operator state - err = k.restakingStateKeeper.UpdateOperatorAssetState(ctx, operatorAccAddress, record.AssetId, types.OperatorSingleAssetOrChangeInfo{ + err = k.restakingStateKeeper.UpdateOperatorAssetState(ctx, operatorAccAddress, record.AssetID, types.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: actualCanUndelegateAmount.Neg(), WaitUndelegationAmountOrWantChangeValue: recordAmountNeg, }) diff --git a/x/delegation/keeper/cross_chain_tx_process.go b/x/delegation/keeper/cross_chain_tx_process.go index 45254b9f5..a7eb69c73 100644 --- a/x/delegation/keeper/cross_chain_tx_process.go +++ b/x/delegation/keeper/cross_chain_tx_process.go @@ -12,7 +12,7 @@ import ( ) type DelegationOrUndelegationParams struct { - ClientChainLzId uint64 + ClientChainLzID uint64 Action types.CrossChainOpType AssetsAddress []byte OperatorAddress sdk.AccAddress @@ -20,7 +20,7 @@ type DelegationOrUndelegationParams struct { OpAmount sdkmath.Int LzNonce uint64 TxHash common.Hash - //todo: The operator approved signature might be needed here in future + // todo: The operator approved signature might be needed here in future } // The event hook process has been deprecated, now we use precompile contract to trigger the calls. @@ -42,13 +42,13 @@ type DelegationOrUndelegationParams struct { return nil, nil } - var clientChainLzId uint64 - r = bytes.NewReader(log.Topics[types.ClientChainLzIdIndexInTopics][:]) - err = binary.Read(r, binary.BigEndian, &clientChainLzId) + var clientChainLzID uint64 + r = bytes.NewReader(log.Topics[types.ClientChainLzIDIndexInTopics][:]) + err = binary.Read(r, binary.BigEndian, &clientChainLzID) if err != nil { - return nil, errorsmod.Wrap(err, "error occurred when binary read ClientChainLzId from topic") + return nil, errorsmod.Wrap(err, "error occurred when binary read ClientChainLzID from topic") } - clientChainInfo, err := k.restakingStateKeeper.GetClientChainInfoByIndex(ctx, clientChainLzId) + clientChainInfo, err := k.restakingStateKeeper.GetClientChainInfoByIndex(ctx, clientChainLzID) if err != nil { return nil, errorsmod.Wrap(err, "error occurred when get client chain info") } @@ -97,7 +97,7 @@ type DelegationOrUndelegationParams struct { amount := sdkmath.NewIntFromBigInt(big.NewInt(0).SetBytes(log.Data[readStart:readEnd])) return &DelegationOrUndelegationParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: action, AssetsAddress: assetsAddress, StakerAddress: stakerAddress, @@ -120,17 +120,16 @@ func (k Keeper) DelegateTo(ctx sdk.Context, params *DelegationOrUndelegationPara return delegationtype.ErrOperatorIsFrozen } - //todo: The operator approved signature might be needed here in future + // todo: The operator approved signature might be needed here in future - //update the related states + // update the related states if params.OpAmount.IsNegative() { return delegationtype.ErrOpAmountIsNegative } - stakerId, assetId := types.GetStakeIDAndAssetId(params.ClientChainLzId, params.StakerAddress, params.AssetsAddress) + stakerID, assetID := types.GetStakeIDAndAssetID(params.ClientChainLzID, params.StakerAddress, params.AssetsAddress) - //check if the staker asset has been deposited and the canWithdraw amount is bigger than the delegation amount - info, err := k.restakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerId, assetId) + info, err := k.restakingStateKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerID, assetID) if err != nil { return err } @@ -139,15 +138,14 @@ func (k Keeper) DelegateTo(ctx sdk.Context, params *DelegationOrUndelegationPara return delegationtype.ErrDelegationAmountTooBig } - //update staker asset state - err = k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakerId, assetId, types.StakerSingleAssetOrChangeInfo{ + err = k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakerID, assetID, types.StakerSingleAssetOrChangeInfo{ CanWithdrawAmountOrWantChangeValue: params.OpAmount.Neg(), }) if err != nil { return err } - err = k.restakingStateKeeper.UpdateOperatorAssetState(ctx, params.OperatorAddress, assetId, types.OperatorSingleAssetOrChangeInfo{ + err = k.restakingStateKeeper.UpdateOperatorAssetState(ctx, params.OperatorAddress, assetID, types.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: params.OpAmount, }) if err != nil { @@ -158,11 +156,11 @@ func (k Keeper) DelegateTo(ctx sdk.Context, params *DelegationOrUndelegationPara delegatorAndAmount[params.OperatorAddress.String()] = &delegationtype.DelegationAmounts{ CanUndelegationAmount: params.OpAmount, } - err = k.UpdateDelegationState(ctx, stakerId, assetId, delegatorAndAmount) + err = k.UpdateDelegationState(ctx, stakerID, assetID, delegatorAndAmount) if err != nil { return err } - err = k.UpdateStakerDelegationTotalAmount(ctx, stakerId, assetId, params.OpAmount) + err = k.UpdateStakerDelegationTotalAmount(ctx, stakerID, assetID, params.OpAmount) if err != nil { return err } @@ -181,8 +179,8 @@ func (k Keeper) UndelegateFrom(ctx sdk.Context, params *DelegationOrUndelegation return delegationtype.ErrOpAmountIsNegative } // get staker delegation state, then check the validation of Undelegation amount - stakerId, assetId := types.GetStakeIDAndAssetId(params.ClientChainLzId, params.StakerAddress, params.AssetsAddress) - delegationState, err := k.GetSingleDelegationInfo(ctx, stakerId, assetId, params.OperatorAddress.String()) + stakerID, assetID := types.GetStakeIDAndAssetID(params.ClientChainLzID, params.StakerAddress, params.AssetsAddress) + delegationState, err := k.GetSingleDelegationInfo(ctx, stakerID, assetID, params.OperatorAddress.String()) if err != nil { return err } @@ -190,10 +188,9 @@ func (k Keeper) UndelegateFrom(ctx sdk.Context, params *DelegationOrUndelegation return errorsmod.Wrap(delegationtype.ErrUndelegationAmountTooBig, fmt.Sprintf("UndelegationAmount:%s,CanUndelegationAmount:%s", params.OpAmount, delegationState.CanUndelegationAmount)) } - //record Undelegation event r := &delegationtype.UndelegationRecord{ - StakerId: stakerId, - AssetId: assetId, + StakerID: stakerID, + AssetID: assetID, OperatorAddr: params.OperatorAddress.String(), TxHash: params.TxHash.String(), IsPending: true, @@ -202,31 +199,29 @@ func (k Keeper) UndelegateFrom(ctx sdk.Context, params *DelegationOrUndelegation Amount: params.OpAmount, ActualCompletedAmount: sdkmath.NewInt(0), } - r.CompleteBlockNumber = k.operatorOptedInKeeper.GetOperatorCanUndelegateHeight(ctx, assetId, params.OperatorAddress, r.BlockNumber) + r.CompleteBlockNumber = k.operatorOptedInKeeper.GetOperatorCanUndelegateHeight(ctx, assetID, params.OperatorAddress, r.BlockNumber) err = k.SetUndelegationRecords(ctx, []*delegationtype.UndelegationRecord{r}) if err != nil { return err } - //update delegation state delegatorAndAmount := make(map[string]*delegationtype.DelegationAmounts) delegatorAndAmount[params.OperatorAddress.String()] = &delegationtype.DelegationAmounts{ CanUndelegationAmount: params.OpAmount.Neg(), WaitUndelegationAmount: params.OpAmount, } - err = k.UpdateDelegationState(ctx, stakerId, assetId, delegatorAndAmount) + err = k.UpdateDelegationState(ctx, stakerID, assetID, delegatorAndAmount) if err != nil { return err } - //update staker and operator assets state - err = k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakerId, assetId, types.StakerSingleAssetOrChangeInfo{ + err = k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakerID, assetID, types.StakerSingleAssetOrChangeInfo{ WaitUndelegationAmountOrWantChangeValue: params.OpAmount, }) if err != nil { return err } - err = k.restakingStateKeeper.UpdateOperatorAssetState(ctx, params.OperatorAddress, assetId, types.OperatorSingleAssetOrChangeInfo{ + err = k.restakingStateKeeper.UpdateOperatorAssetState(ctx, params.OperatorAddress, assetID, types.OperatorSingleAssetOrChangeInfo{ WaitUndelegationAmountOrWantChangeValue: params.OpAmount, }) if err != nil { diff --git a/x/delegation/keeper/delegation_op_test.go b/x/delegation/keeper/delegation_op_test.go index 3c6c50978..3cf6f8d07 100644 --- a/x/delegation/keeper/delegation_op_test.go +++ b/x/delegation/keeper/delegation_op_test.go @@ -13,10 +13,10 @@ import ( func (suite *KeeperTestSuite) TestDelegateTo() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") - clientChainLzId := uint64(101) + clientChainLzID := uint64(101) depositEvent := &keeper.DepositParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: types.Deposit, StakerAddress: suite.address[:], OpAmount: sdkmath.NewInt(100), @@ -28,7 +28,7 @@ func (suite *KeeperTestSuite) TestDelegateTo() { opAccAddr, err := sdk.AccAddressFromBech32("evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl") suite.NoError(err) delegationParams := &keeper2.DelegationOrUndelegationParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: types.DelegateTo, AssetsAddress: usdtAddress[:], OperatorAddress: opAccAddr, @@ -53,8 +53,8 @@ func (suite *KeeperTestSuite) TestDelegateTo() { suite.NoError(err) // check delegation states - stakerId, assetId := types.GetStakeIDAndAssetId(delegationParams.ClientChainLzId, delegationParams.StakerAddress, delegationParams.AssetsAddress) - restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(delegationParams.ClientChainLzID, delegationParams.StakerAddress, delegationParams.AssetsAddress) + restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -62,7 +62,7 @@ func (suite *KeeperTestSuite) TestDelegateTo() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *restakerState) - operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetId) + operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetID) suite.NoError(err) suite.Equal(types.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: delegationParams.OpAmount, @@ -70,24 +70,24 @@ func (suite *KeeperTestSuite) TestDelegateTo() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *operatorState) - specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerId, assetId, opAccAddr.String()) + specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ CanUndelegationAmount: delegationParams.OpAmount, WaitUndelegationAmount: sdkmath.NewInt(0), }, *specifiedDelegationAmount) - totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerId, assetId) + totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(delegationParams.OpAmount, totalDelegationAmount) } func (suite *KeeperTestSuite) TestUndelegateFrom() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") - clientChainLzId := uint64(101) + clientChainLzID := uint64(101) depositEvent := &keeper.DepositParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: types.Deposit, StakerAddress: suite.address[:], OpAmount: sdkmath.NewInt(100), @@ -99,7 +99,7 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { opAccAddr, err := sdk.AccAddressFromBech32("evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl") suite.NoError(err) delegationEvent := &keeper2.DelegationOrUndelegationParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: types.DelegateTo, AssetsAddress: usdtAddress[:], OperatorAddress: opAccAddr, @@ -126,8 +126,8 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { suite.NoError(err) // check state - stakerId, assetId := types.GetStakeIDAndAssetId(delegationEvent.ClientChainLzId, delegationEvent.StakerAddress, delegationEvent.AssetsAddress) - restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(delegationEvent.ClientChainLzID, delegationEvent.StakerAddress, delegationEvent.AssetsAddress) + restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -135,7 +135,7 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { WaitUndelegationAmountOrWantChangeValue: delegationEvent.OpAmount, }, *restakerState) - operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetId) + operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetID) suite.NoError(err) suite.Equal(types.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: delegationEvent.OpAmount, @@ -143,23 +143,23 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { WaitUndelegationAmountOrWantChangeValue: delegationEvent.OpAmount, }, *operatorState) - specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerId, assetId, opAccAddr.String()) + specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ CanUndelegationAmount: sdkmath.NewInt(0), WaitUndelegationAmount: delegationEvent.OpAmount, }, *specifiedDelegationAmount) - totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerId, assetId) + totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(delegationEvent.OpAmount, totalDelegationAmount) - records, err := suite.app.DelegationKeeper.GetStakerUndelegationRecords(suite.ctx, stakerId, assetId, keeper2.PendingRecords) + records, err := suite.app.DelegationKeeper.GetStakerUndelegationRecords(suite.ctx, stakerID, assetID, keeper2.PendingRecords) suite.NoError(err) suite.Equal(1, len(records)) UndelegationRecord := &delegationtype.UndelegationRecord{ - StakerId: stakerId, - AssetId: assetId, + StakerID: stakerID, + AssetID: assetID, OperatorAddr: delegationEvent.OperatorAddress.String(), TxHash: delegationEvent.TxHash.String(), IsPending: true, @@ -180,10 +180,10 @@ func (suite *KeeperTestSuite) TestUndelegateFrom() { func (suite *KeeperTestSuite) TestCompleteUndelegation() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") - clientChainLzId := uint64(101) + clientChainLzID := uint64(101) depositEvent := &keeper.DepositParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: types.Deposit, StakerAddress: suite.address[:], OpAmount: sdkmath.NewInt(100), @@ -195,7 +195,7 @@ func (suite *KeeperTestSuite) TestCompleteUndelegation() { opAccAddr, err := sdk.AccAddressFromBech32("evmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3h6cprl") suite.NoError(err) delegationEvent := &keeper2.DelegationOrUndelegationParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: types.DelegateTo, AssetsAddress: usdtAddress[:], OperatorAddress: opAccAddr, @@ -228,8 +228,8 @@ func (suite *KeeperTestSuite) TestCompleteUndelegation() { suite.app.DelegationKeeper.EndBlock(suite.ctx, abci.RequestEndBlock{}) // check state - stakerId, assetId := types.GetStakeIDAndAssetId(delegationEvent.ClientChainLzId, delegationEvent.StakerAddress, delegationEvent.AssetsAddress) - restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(delegationEvent.ClientChainLzID, delegationEvent.StakerAddress, delegationEvent.AssetsAddress) + restakerState, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -237,7 +237,7 @@ func (suite *KeeperTestSuite) TestCompleteUndelegation() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *restakerState) - operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetId) + operatorState, err := suite.app.StakingAssetsManageKeeper.GetOperatorSpecifiedAssetInfo(suite.ctx, opAccAddr, assetID) suite.NoError(err) suite.Equal(types.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: sdkmath.NewInt(0), @@ -245,23 +245,23 @@ func (suite *KeeperTestSuite) TestCompleteUndelegation() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *operatorState) - specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerId, assetId, opAccAddr.String()) + specifiedDelegationAmount, err := suite.app.DelegationKeeper.GetSingleDelegationInfo(suite.ctx, stakerID, assetID, opAccAddr.String()) suite.NoError(err) suite.Equal(delegationtype.DelegationAmounts{ CanUndelegationAmount: sdkmath.NewInt(0), WaitUndelegationAmount: sdkmath.NewInt(0), }, *specifiedDelegationAmount) - totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerId, assetId) + totalDelegationAmount, err := suite.app.DelegationKeeper.GetStakerDelegationTotalAmount(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(sdkmath.NewInt(0), totalDelegationAmount) - records, err := suite.app.DelegationKeeper.GetStakerUndelegationRecords(suite.ctx, stakerId, assetId, keeper2.CompletedRecords) + records, err := suite.app.DelegationKeeper.GetStakerUndelegationRecords(suite.ctx, stakerID, assetID, keeper2.CompletedRecords) suite.NoError(err) suite.Equal(1, len(records)) UndelegationRecord := &delegationtype.UndelegationRecord{ - StakerId: stakerId, - AssetId: assetId, + StakerID: stakerID, + AssetID: assetID, OperatorAddr: delegationEvent.OperatorAddress.String(), TxHash: delegationEvent.TxHash.String(), IsPending: false, diff --git a/x/delegation/keeper/delegation_state.go b/x/delegation/keeper/delegation_state.go index 71ff7fa3a..0e667cd3e 100644 --- a/x/delegation/keeper/delegation_state.go +++ b/x/delegation/keeper/delegation_state.go @@ -15,15 +15,15 @@ import ( // UpdateStakerDelegationTotalAmount The function is used to update the delegation total amount of the specified staker and asset. // The input `opAmount` represents the values that you want to add or decrease,using positive or negative values for increasing and decreasing,respectively. The function will calculate and update new state after a successful check. // The function will be called when there is delegation or undelegation related to the specified staker and asset. -func (k Keeper) UpdateStakerDelegationTotalAmount(ctx sdk.Context, stakerId string, assetId string, opAmount sdkmath.Int) error { +func (k Keeper) UpdateStakerDelegationTotalAmount(ctx sdk.Context, stakerID string, assetID string, opAmount sdkmath.Int) error { if opAmount.IsNil() || opAmount.IsZero() { return nil } c := sdk.UnwrapSDKContext(ctx) - // use stakerId+'/'+assetId as the key of total delegation amount + // use stakerID+'/'+assetID as the key of total delegation amount store := prefix.NewStore(c.KVStore(k.storeKey), delegationtype.KeyPrefixRestakerDelegationInfo) amount := delegationtype.ValueField{Amount: sdkmath.NewInt(0)} - key := types.GetAssetStateKey(stakerId, assetId) + key := types.GetAssetStateKey(stakerID, assetID) if store.Has(key) { value := store.Get(key) k.cdc.MustUnmarshal(value, &amount) @@ -40,26 +40,24 @@ func (k Keeper) UpdateStakerDelegationTotalAmount(ctx sdk.Context, stakerId stri } // GetStakerDelegationTotalAmount query the total delegation amount of the specified staker and asset. -func (k Keeper) GetStakerDelegationTotalAmount(ctx sdk.Context, stakerId string, assetId string) (opAmount sdkmath.Int, err error) { +func (k Keeper) GetStakerDelegationTotalAmount(ctx sdk.Context, stakerID string, assetID string) (opAmount sdkmath.Int, err error) { c := sdk.UnwrapSDKContext(ctx) store := prefix.NewStore(c.KVStore(k.storeKey), delegationtype.KeyPrefixRestakerDelegationInfo) var ret delegationtype.ValueField - prefixKey := types.GetAssetStateKey(stakerId, assetId) - isExit := store.Has(prefixKey) - if !isExit { + prefixKey := types.GetAssetStateKey(stakerID, assetID) + if !store.Has(prefixKey) { return sdkmath.Int{}, errorsmod.Wrap(delegationtype.ErrNoKeyInTheStore, fmt.Sprintf("GetStakerDelegationTotalAmount: key is %s", prefixKey)) - } else { - value := store.Get(prefixKey) - k.cdc.MustUnmarshal(value, &ret) } + value := store.Get(prefixKey) + k.cdc.MustUnmarshal(value, &ret) return ret.Amount, nil } // UpdateDelegationState The function is used to update the staker's asset amount that is delegated to a specified operator. // Compared to `UpdateStakerDelegationTotalAmount`,they use the same kv store, but in this function the store key needs to add the operator address as a suffix. -func (k Keeper) UpdateDelegationState(ctx sdk.Context, stakerId string, assetId string, delegationAmounts map[string]*delegationtype.DelegationAmounts) (err error) { +func (k Keeper) UpdateDelegationState(ctx sdk.Context, stakerID string, assetID string, delegationAmounts map[string]*delegationtype.DelegationAmounts) (err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), delegationtype.KeyPrefixRestakerDelegationInfo) - //todo: think about the difference between init and update in future + // todo: think about the difference between init and update in future for opAddr, amounts := range delegationAmounts { if amounts == nil { @@ -68,12 +66,12 @@ func (k Keeper) UpdateDelegationState(ctx sdk.Context, stakerId string, assetId if amounts.CanUndelegationAmount.IsNil() && amounts.WaitUndelegationAmount.IsNil() { continue } - //check operator address validation + _, err := sdk.AccAddressFromBech32(opAddr) if err != nil { return delegationtype.OperatorAddrIsNotAccAddr } - singleStateKey := delegationtype.GetDelegationStateKey(stakerId, assetId, opAddr) + singleStateKey := delegationtype.GetDelegationStateKey(stakerID, assetID, opAddr) delegationState := delegationtype.DelegationAmounts{ CanUndelegationAmount: sdkmath.NewInt(0), WaitUndelegationAmount: sdkmath.NewInt(0), @@ -94,7 +92,6 @@ func (k Keeper) UpdateDelegationState(ctx sdk.Context, stakerId string, assetId return errorsmod.Wrap(err, "UpdateDelegationState WaitUndelegationAmount error") } - //save single operator delegation state bz := k.cdc.MustMarshal(&delegationState) store.Set(singleStateKey, bz) } @@ -102,9 +99,9 @@ func (k Keeper) UpdateDelegationState(ctx sdk.Context, stakerId string, assetId } // GetSingleDelegationInfo query the staker's asset amount that has been delegated to the specified operator. -func (k Keeper) GetSingleDelegationInfo(ctx sdk.Context, stakerId, assetId, operatorAddr string) (*delegationtype.DelegationAmounts, error) { +func (k Keeper) GetSingleDelegationInfo(ctx sdk.Context, stakerID, assetID, operatorAddr string) (*delegationtype.DelegationAmounts, error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), delegationtype.KeyPrefixRestakerDelegationInfo) - singleStateKey := delegationtype.GetDelegationStateKey(stakerId, assetId, operatorAddr) + singleStateKey := delegationtype.GetDelegationStateKey(stakerID, assetID, operatorAddr) isExit := store.Has(singleStateKey) delegationState := delegationtype.DelegationAmounts{} if isExit { @@ -117,25 +114,25 @@ func (k Keeper) GetSingleDelegationInfo(ctx sdk.Context, stakerId, assetId, oper } // GetDelegationInfo query the staker's asset info that has been delegated. -func (k Keeper) GetDelegationInfo(ctx sdk.Context, stakerId, assetId string) (*delegationtype.QueryDelegationInfoResponse, error) { +func (k Keeper) GetDelegationInfo(ctx sdk.Context, stakerID, assetID string) (*delegationtype.QueryDelegationInfoResponse, error) { c := sdk.UnwrapSDKContext(ctx) var ret delegationtype.QueryDelegationInfoResponse - totalAmount, err := k.GetStakerDelegationTotalAmount(ctx, stakerId, assetId) + totalAmount, err := k.GetStakerDelegationTotalAmount(ctx, stakerID, assetID) if err != nil { return nil, err } ret.TotalDelegatedAmount = totalAmount store := prefix.NewStore(c.KVStore(k.storeKey), delegationtype.KeyPrefixRestakerDelegationInfo) - iterator := sdk.KVStorePrefixIterator(store, delegationtype.GetDelegationStateIteratorPrefix(stakerId, assetId)) + iterator := sdk.KVStorePrefixIterator(store, delegationtype.GetDelegationStateIteratorPrefix(stakerID, assetID)) defer iterator.Close() ret.DelegationInfos = make(map[string]*delegationtype.DelegationAmounts, 0) for ; iterator.Valid(); iterator.Next() { var amounts delegationtype.DelegationAmounts k.cdc.MustUnmarshal(iterator.Value(), &amounts) - keys, err := delegationtype.ParseStakerAssetIdAndOperatorAddrFromKey(iterator.Key()) + keys, err := delegationtype.ParseStakerAssetIDAndOperatorAddrFromKey(iterator.Key()) if err != nil { return nil, err } diff --git a/x/delegation/keeper/grpc_query.go b/x/delegation/keeper/grpc_query.go index 812e675d2..98fdfa2b2 100644 --- a/x/delegation/keeper/grpc_query.go +++ b/x/delegation/keeper/grpc_query.go @@ -11,12 +11,12 @@ var _ delegationtype.QueryServer = Keeper{} func (k Keeper) QuerySingleDelegationInfo(ctx context.Context, req *delegationtype.SingleDelegationInfoReq) (*delegationtype.DelegationAmounts, error) { c := sdk.UnwrapSDKContext(ctx) - return k.GetSingleDelegationInfo(c, req.StakerId, req.AssetId, req.OperatorAddr) + return k.GetSingleDelegationInfo(c, req.StakerID, req.AssetID, req.OperatorAddr) } func (k Keeper) QueryDelegationInfo(ctx context.Context, info *delegationtype.DelegationInfoReq) (*delegationtype.QueryDelegationInfoResponse, error) { c := sdk.UnwrapSDKContext(ctx) - return k.GetDelegationInfo(c, info.StakerId, info.AssetId) + return k.GetDelegationInfo(c, info.StakerID, info.AssetID) } func (k Keeper) QueryOperatorInfo(ctx context.Context, req *delegationtype.QueryOperatorInfoReq) (*delegationtype.OperatorInfo, error) { diff --git a/x/delegation/keeper/keeper.go b/x/delegation/keeper/keeper.go index 1f11cec43..332b8b154 100644 --- a/x/delegation/keeper/keeper.go +++ b/x/delegation/keeper/keeper.go @@ -21,7 +21,6 @@ type Keeper struct { storeKey storetypes.StoreKey cdc codec.BinaryCodec - //other keepers restakingStateKeeper keeper.Keeper depositKeeper depositkeeper.Keeper slashKeeper delegationtype.ISlashKeeper @@ -58,7 +57,6 @@ func (k Keeper) SetOperatorInfo(ctx sdk.Context, addr string, info *delegationty store := prefix.NewStore(ctx.KVStore(k.storeKey), delegationtype.KeyPrefixOperatorInfo) // todo: think about the difference between init and update in future - //key := common.HexToAddress(incentive.Contract) bz := k.cdc.MustMarshal(info) store.Set(opAccAddr, bz) @@ -71,7 +69,7 @@ func (k Keeper) GetOperatorInfo(ctx sdk.Context, addr string) (info *delegationt return nil, errorsmod.Wrap(err, "GetOperatorInfo: error occurred when parse acc address from Bech32") } store := prefix.NewStore(ctx.KVStore(k.storeKey), delegationtype.KeyPrefixOperatorInfo) - //key := common.HexToAddress(incentive.Contract) + ifExist := store.Has(opAccAddr) if !ifExist { return nil, errorsmod.Wrap(delegationtype.ErrNoKeyInTheStore, fmt.Sprintf("GetOperatorInfo: key is %s", opAccAddr)) @@ -107,7 +105,7 @@ type IDelegation interface { // UndelegateAssetFromOperator handle the UndelegateAssetFromOperator txs from msg service UndelegateAssetFromOperator(ctx context.Context, delegation *delegationtype.MsgUndelegation) (*delegationtype.UndelegationResponse, error) - GetSingleDelegationInfo(ctx sdk.Context, stakerId, assetId, operatorAddr string) (*delegationtype.DelegationAmounts, error) + GetSingleDelegationInfo(ctx sdk.Context, stakerID, assetID, operatorAddr string) (*delegationtype.DelegationAmounts, error) - GetDelegationInfo(ctx sdk.Context, stakerId, assetId string) (*delegationtype.QueryDelegationInfoResponse, error) + GetDelegationInfo(ctx sdk.Context, stakerID, assetID string) (*delegationtype.QueryDelegationInfoResponse, error) } diff --git a/x/delegation/keeper/msg_server.go b/x/delegation/keeper/msg_server.go index f7cfbaa97..0b1d739ed 100644 --- a/x/delegation/keeper/msg_server.go +++ b/x/delegation/keeper/msg_server.go @@ -20,10 +20,10 @@ func (k Keeper) RegisterOperator(ctx context.Context, req *types.RegisterOperato } // DelegateAssetToOperator todo: Delegation and Undelegation from exoCore chain directly will be implemented in future.At the moment,they are executed from client chain -func (k Keeper) DelegateAssetToOperator(ctx context.Context, delegation *types.MsgDelegation) (*types.DelegationResponse, error) { +func (k Keeper) DelegateAssetToOperator(context.Context, *types.MsgDelegation) (*types.DelegationResponse, error) { return nil, errorsmod.Wrap(types.ErrNotSupportYet, "func:DelegateAssetToOperator") } -func (k Keeper) UndelegateAssetFromOperator(ctx context.Context, delegation *types.MsgUndelegation) (*types.UndelegationResponse, error) { +func (k Keeper) UndelegateAssetFromOperator(context.Context, *types.MsgUndelegation) (*types.UndelegationResponse, error) { return nil, errorsmod.Wrap(types.ErrNotSupportYet, "func:UndelegateAssetFromOperator") } diff --git a/x/delegation/keeper/un_delegation_state.go b/x/delegation/keeper/un_delegation_state.go index 279cbd496..c104dba24 100644 --- a/x/delegation/keeper/un_delegation_state.go +++ b/x/delegation/keeper/un_delegation_state.go @@ -34,7 +34,7 @@ func (k Keeper) SetUndelegationRecords(ctx sdk.Context, records []*types.Undeleg singleRecKey := types.GetUndelegationRecordKey(record.LzTxNonce, record.TxHash, record.OperatorAddr) singleRecordStore.Set(singleRecKey, bz) - stakerKey := types.GetStakerUndelegationRecordKey(record.StakerId, record.AssetId, record.LzTxNonce) + stakerKey := types.GetStakerUndelegationRecordKey(record.StakerID, record.AssetID, record.LzTxNonce) stakerUndelegationStore.Set(stakerKey, singleRecKey) waitCompleteKey := types.GetWaitCompleteRecordKey(record.CompleteBlockNumber, record.LzTxNonce) @@ -65,33 +65,34 @@ func (k Keeper) GetUndelegationRecords(ctx sdk.Context, singleRecordKeys []strin return nil, errorsmod.Wrap(types.ErrNoKeyInTheStore, fmt.Sprintf("GetSingleDelegationRecord: key is %s", singleRecordKey)) } - if getType == PendingRecords { + switch getType { + case PendingRecords: if UndelegationRecord.IsPending { ret = append(ret, &UndelegationRecord) } - } else if getType == CompletedRecords { + case CompletedRecords: if !UndelegationRecord.IsPending { ret = append(ret, &UndelegationRecord) } - } else if getType == AllRecords { + case AllRecords: ret = append(ret, &UndelegationRecord) - } else { + default: return nil, errorsmod.Wrap(types.ErrStakerGetRecordType, fmt.Sprintf("the getType is:%v", getType)) } } return ret, nil } -func (k Keeper) SetStakerUndelegationInfo(ctx sdk.Context, stakerId, assetId string, recordKey []byte, lzNonce uint64) error { +func (k Keeper) SetStakerUndelegationInfo(ctx sdk.Context, stakerID, assetID string, recordKey []byte, lzNonce uint64) error { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixStakerUndelegationInfo) - key := types.GetStakerUndelegationRecordKey(stakerId, assetId, lzNonce) + key := types.GetStakerUndelegationRecordKey(stakerID, assetID, lzNonce) store.Set(key, recordKey) return nil } -func (k Keeper) GetStakerUndelegationRecKeys(ctx sdk.Context, stakerId, assetId string) (recordKeyList []string, err error) { +func (k Keeper) GetStakerUndelegationRecKeys(ctx sdk.Context, stakerID, assetID string) (recordKeyList []string, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixStakerUndelegationInfo) - iterator := sdk.KVStorePrefixIterator(store, []byte(strings.Join([]string{stakerId, assetId}, "/"))) + iterator := sdk.KVStorePrefixIterator(store, []byte(strings.Join([]string{stakerID, assetID}, "/"))) defer iterator.Close() ret := make([]string, 0) @@ -101,8 +102,8 @@ func (k Keeper) GetStakerUndelegationRecKeys(ctx sdk.Context, stakerId, assetId return ret, nil } -func (k Keeper) GetStakerUndelegationRecords(ctx sdk.Context, stakerId, assetId string, getType GetUndelegationRecordType) (records []*types.UndelegationRecord, err error) { - recordKeys, err := k.GetStakerUndelegationRecKeys(ctx, stakerId, assetId) +func (k Keeper) GetStakerUndelegationRecords(ctx sdk.Context, stakerID, assetID string, getType GetUndelegationRecordType) (records []*types.UndelegationRecord, err error) { + recordKeys, err := k.GetStakerUndelegationRecKeys(ctx, stakerID, assetID) if err != nil { return nil, err } diff --git a/x/delegation/module.go b/x/delegation/module.go index 27d39497c..89b3af93d 100644 --- a/x/delegation/module.go +++ b/x/delegation/module.go @@ -17,8 +17,6 @@ import ( "github.com/spf13/cobra" ) -const consensusVersion = 0 - // type check to ensure the interface is properly implemented var ( _ module.AppModule = AppModule{} @@ -59,7 +57,7 @@ type AppModule struct { keeper keeper.Keeper } -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { +func NewAppModule(_ codec.Codec, keeper keeper.Keeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: keeper, @@ -78,13 +76,13 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { delegationtype.RegisterQueryServer(cfg.QueryServer(), am.keeper) } -func (am AppModule) GenerateGenesisState(input *module.SimulationState) { +func (am AppModule) GenerateGenesisState(*module.SimulationState) { } -func (am AppModule) RegisterStoreDecoder(registry sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(sdk.StoreDecoderRegistry) { } -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(module.SimulationState) []simtypes.WeightedOperation { return []simtypes.WeightedOperation{} } diff --git a/x/delegation/types/expected_keepers.go b/x/delegation/types/expected_keepers.go index d75f51feb..24069e093 100644 --- a/x/delegation/types/expected_keepers.go +++ b/x/delegation/types/expected_keepers.go @@ -9,26 +9,26 @@ var CanUndelegationDelayHeight = uint64(10) type ISlashKeeper interface { IsOperatorFrozen(ctx sdk.Context, opAddr sdk.AccAddress) bool - OperatorAssetSlashedProportion(ctx sdk.Context, opAddr sdk.AccAddress, assetId string, startHeight, endHeight uint64) sdkmath.LegacyDec + OperatorAssetSlashedProportion(ctx sdk.Context, opAddr sdk.AccAddress, assetID string, startHeight, endHeight uint64) sdkmath.LegacyDec } // VirtualISlashKeeper todo: When the actual keeper functionality has not been implemented yet, temporarily use the virtual keeper. type VirtualISlashKeeper struct{} -func (VirtualISlashKeeper) IsOperatorFrozen(ctx sdk.Context, opAddr sdk.AccAddress) bool { +func (VirtualISlashKeeper) IsOperatorFrozen(sdk.Context, sdk.AccAddress) bool { return false } -func (VirtualISlashKeeper) OperatorAssetSlashedProportion(ctx sdk.Context, opAddr sdk.AccAddress, assetId string, startHeight, endHeight uint64) sdkmath.LegacyDec { +func (VirtualISlashKeeper) OperatorAssetSlashedProportion(sdk.Context, sdk.AccAddress, string, uint64, uint64) sdkmath.LegacyDec { return sdkmath.LegacyNewDec(0) } type OperatorOptedInMiddlewareKeeper interface { - GetOperatorCanUndelegateHeight(ctx sdk.Context, assetId string, opAddr sdk.AccAddress, startHeight uint64) uint64 + GetOperatorCanUndelegateHeight(ctx sdk.Context, assetID string, opAddr sdk.AccAddress, startHeight uint64) uint64 } type VirtualOperatorOptedInKeeper struct{} -func (VirtualOperatorOptedInKeeper) GetOperatorCanUndelegateHeight(ctx sdk.Context, assetId string, opAddr sdk.AccAddress, startHeight uint64) uint64 { +func (VirtualOperatorOptedInKeeper) GetOperatorCanUndelegateHeight(_ sdk.Context, _ string, _ sdk.AccAddress, startHeight uint64) uint64 { return startHeight + CanUndelegationDelayHeight } diff --git a/x/delegation/types/keys.go b/x/delegation/types/keys.go index f79083f80..0f52b90ec 100644 --- a/x/delegation/types/keys.go +++ b/x/delegation/types/keys.go @@ -1,12 +1,14 @@ package types import ( - errorsmod "cosmossdk.io/errors" "fmt" + "strings" + + errorsmod "cosmossdk.io/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "strings" ) // constants @@ -47,8 +49,8 @@ var ( // KeyPrefixRestakerDelegationInfo reStakerId = clientChainAddr+'_'+ExoCoreChainIndex // KeyPrefixRestakerDelegationInfo // key-value: - // reStakerId +'/'+assetId -> totalDelegationAmount - // reStakerId +'/'+assetId+'/'+operatorAddr -> delegationAmounts + // reStakerId +'/'+assetID -> totalDelegationAmount + // reStakerId +'/'+assetID+'/'+operatorAddr -> delegationAmounts KeyPrefixRestakerDelegationInfo = []byte{prefixRestakerDelegationInfo} // KeyPrefixDelegationUsedSalt key->value: operatorApproveAddr->map[salt]{} @@ -59,36 +61,36 @@ var ( // KeyPrefixUndelegationInfo singleRecordKey = lzNonce+'/'+txHash+'/'+operatorAddr // singleRecordKey -> UndelegateReqRecord KeyPrefixUndelegationInfo = []byte{prefixUndelegationInfo} - // KeyPrefixStakerUndelegationInfo reStakerId+'/'+assetId+'/'+lzNonce -> singleRecordKey + // KeyPrefixStakerUndelegationInfo reStakerId+'/'+assetID+'/'+lzNonce -> singleRecordKey KeyPrefixStakerUndelegationInfo = []byte{prefixStakerUndelegationInfo} // KeyPrefixWaitCompleteUndelegations completeHeight +'/'+lzNonce -> singleRecordKey KeyPrefixWaitCompleteUndelegations = []byte{prefixWaitCompleteUndelegations} ) -func GetDelegationStateKey(stakerId, assetId, operatorAddr string) []byte { - return []byte(strings.Join([]string{stakerId, assetId, operatorAddr}, "/")) +func GetDelegationStateKey(stakerID, assetID, operatorAddr string) []byte { + return []byte(strings.Join([]string{stakerID, assetID, operatorAddr}, "/")) } -func GetDelegationStateIteratorPrefix(stakerId, assetId string) []byte { - tmp := []byte(strings.Join([]string{stakerId, assetId}, "/")) +func GetDelegationStateIteratorPrefix(stakerID, assetID string) []byte { + tmp := []byte(strings.Join([]string{stakerID, assetID}, "/")) tmp = append(tmp, '/') return tmp } -func ParseStakerAssetIdAndOperatorAddrFromKey(key []byte) (keys *SingleDelegationInfoReq, err error) { +func ParseStakerAssetIDAndOperatorAddrFromKey(key []byte) (keys *SingleDelegationInfoReq, err error) { stringList := strings.Split(string(key), "/") if len(stringList) != 3 { return nil, errorsmod.Wrap(ErrParseDelegationKey, fmt.Sprintf("the stringList is:%v", stringList)) } - return &SingleDelegationInfoReq{StakerId: stringList[0], AssetId: stringList[1], OperatorAddr: stringList[2]}, nil + return &SingleDelegationInfoReq{StakerID: stringList[0], AssetID: stringList[1], OperatorAddr: stringList[2]}, nil } func GetUndelegationRecordKey(lzNonce uint64, txHash string, operatorAddr string) []byte { return []byte(strings.Join([]string{hexutil.EncodeUint64(lzNonce), txHash, operatorAddr}, "/")) } -func GetStakerUndelegationRecordKey(stakerId, assetId string, lzNonce uint64) []byte { - return []byte(strings.Join([]string{stakerId, assetId, hexutil.EncodeUint64(lzNonce)}, "/")) +func GetStakerUndelegationRecordKey(stakerID, assetID string, lzNonce uint64) []byte { + return []byte(strings.Join([]string{stakerID, assetID, hexutil.EncodeUint64(lzNonce)}, "/")) } func GetWaitCompleteRecordKey(height, lzNonce uint64) []byte { diff --git a/x/delegation/types/query.pb.go b/x/delegation/types/query.pb.go index 8cbe7d129..2ee0bc8ad 100644 --- a/x/delegation/types/query.pb.go +++ b/x/delegation/types/query.pb.go @@ -33,8 +33,8 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type DelegationInfoReq struct { - StakerId string `protobuf:"bytes,1,opt,name=stakerId,proto3" json:"stakerId,omitempty"` - AssetId string `protobuf:"bytes,2,opt,name=assetId,proto3" json:"assetId,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` + AssetID string `protobuf:"bytes,2,opt,name=assetID,proto3" json:"assetID,omitempty"` } func (m *DelegationInfoReq) Reset() { *m = DelegationInfoReq{} } @@ -70,16 +70,16 @@ func (m *DelegationInfoReq) XXX_DiscardUnknown() { var xxx_messageInfo_DelegationInfoReq proto.InternalMessageInfo -func (m *DelegationInfoReq) GetStakerId() string { +func (m *DelegationInfoReq) GetStakerID() string { if m != nil { - return m.StakerId + return m.StakerID } return "" } -func (m *DelegationInfoReq) GetAssetId() string { +func (m *DelegationInfoReq) GetAssetID() string { if m != nil { - return m.AssetId + return m.AssetID } return "" } @@ -168,9 +168,9 @@ func (m *QueryDelegationInfoResponse) GetDelegationInfos() map[string]*Delegatio } type SingleDelegationInfoReq struct { - StakerId string `protobuf:"bytes,1,opt,name=stakerId,proto3" json:"stakerId,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` OperatorAddr string `protobuf:"bytes,2,opt,name=operatorAddr,proto3" json:"operatorAddr,omitempty"` - AssetId string `protobuf:"bytes,3,opt,name=assetId,proto3" json:"assetId,omitempty"` + AssetID string `protobuf:"bytes,3,opt,name=assetID,proto3" json:"assetID,omitempty"` } func (m *SingleDelegationInfoReq) Reset() { *m = SingleDelegationInfoReq{} } @@ -206,9 +206,9 @@ func (m *SingleDelegationInfoReq) XXX_DiscardUnknown() { var xxx_messageInfo_SingleDelegationInfoReq proto.InternalMessageInfo -func (m *SingleDelegationInfoReq) GetStakerId() string { +func (m *SingleDelegationInfoReq) GetStakerID() string { if m != nil { - return m.StakerId + return m.StakerID } return "" } @@ -220,9 +220,9 @@ func (m *SingleDelegationInfoReq) GetOperatorAddr() string { return "" } -func (m *SingleDelegationInfoReq) GetAssetId() string { +func (m *SingleDelegationInfoReq) GetAssetID() string { if m != nil { - return m.AssetId + return m.AssetID } return "" } @@ -283,46 +283,47 @@ func init() { func init() { proto.RegisterFile("exocore/delegation/v1/query.proto", fileDescriptor_aab345e1cf20490c) } var fileDescriptor_aab345e1cf20490c = []byte{ - // 620 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xdf, 0x6b, 0xd3, 0x50, - 0x18, 0xed, 0x4d, 0x9d, 0x3f, 0xee, 0x06, 0xba, 0x6b, 0xa7, 0x5d, 0x26, 0xd9, 0x8c, 0x38, 0xca, - 0xa4, 0x89, 0xab, 0x08, 0x22, 0x55, 0xd9, 0x54, 0x46, 0x9e, 0x86, 0xd9, 0x44, 0xf0, 0x45, 0xb2, - 0xe6, 0x1a, 0x43, 0xd3, 0x7b, 0xd3, 0xdc, 0xdb, 0xd2, 0xbe, 0xea, 0x8b, 0x2f, 0x82, 0x20, 0xfe, - 0x13, 0x3e, 0xf9, 0xd0, 0x3f, 0x62, 0x8f, 0x63, 0xbe, 0x88, 0x0f, 0x43, 0x5a, 0xc1, 0x57, 0xff, - 0x01, 0x41, 0x9a, 0xdc, 0x6e, 0x69, 0x96, 0x6c, 0x0e, 0xf6, 0xd4, 0xdc, 0x9c, 0xd3, 0xf3, 0x9d, - 0x7c, 0xdf, 0xb9, 0x1f, 0xbc, 0x8e, 0x3b, 0xb4, 0x46, 0x03, 0xac, 0xdb, 0xd8, 0xc3, 0x8e, 0xc5, - 0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e9, 0x43, 0x05, 0xd0, - 0xad, 0xa3, 0xa6, 0x99, 0xb0, 0x22, 0xdf, 0xc8, 0x20, 0xc7, 0x79, 0xaa, 0xf6, 0xf6, 0xdb, 0xaf, - 0x4f, 0x52, 0x09, 0x2d, 0xea, 0xe9, 0xeb, 0x63, 0x0d, 0xf3, 0x31, 0x07, 0x5f, 0x00, 0xbc, 0x9c, - 0x92, 0x1d, 0x74, 0xfc, 0x50, 0x47, 0xb6, 0x2a, 0x27, 0x4f, 0xa4, 0x7a, 0xf7, 0xfd, 0xef, 0xaf, - 0x4b, 0x20, 0xb4, 0xba, 0x84, 0x4a, 0xd9, 0x56, 0x13, 0xa6, 0x7a, 0x00, 0xce, 0x86, 0xb2, 0x69, - 0xc9, 0x41, 0x5a, 0x86, 0x91, 0x8c, 0x98, 0xc9, 0xff, 0x9d, 0x5b, 0xf5, 0xc1, 0x81, 0xdd, 0x0a, - 0xba, 0x9d, 0x61, 0x37, 0xd3, 0xd8, 0xea, 0xa3, 0xed, 0xbe, 0x02, 0x76, 0xfa, 0x0a, 0xf8, 0xd9, - 0x57, 0xc0, 0xc7, 0x81, 0x92, 0xdb, 0x19, 0x28, 0xb9, 0xef, 0x03, 0x25, 0xf7, 0xf2, 0x66, 0x6c, - 0x65, 0x8c, 0x54, 0x3b, 0x71, 0xdd, 0x70, 0x6b, 0x6c, 0x9d, 0x0d, 0x37, 0xfe, 0x9d, 0x7f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x14, 0x6c, 0x33, 0x44, 0xb9, 0x06, 0x00, 0x00, + // 630 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x5f, 0x6b, 0xd3, 0x50, + 0x1c, 0xed, 0x4d, 0x9d, 0x7f, 0xee, 0x06, 0xba, 0x6b, 0xa7, 0x5d, 0x26, 0xd9, 0x8c, 0x30, 0xca, + 0xa4, 0x89, 0xab, 0x0a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xec, 0xf5, 0xa5, 0xcc, 0xf7, 0xbe, 0x94, 0x79, 0x71, 0x2f, + 0x72, 0x64, 0xac, 0x05, 0xaa, 0x1b, 0x98, 0xbf, 0xa1, 0x5e, 0x6d, 0x64, 0xd2, 0x8e, 0xda, 0xf8, + 0x87, 0xc8, 0xce, 0x79, 0xff, 0x03, 0x70, 0xf7, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x25, 0x51, + 0x51, 0x30, 0xc8, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -499,17 +500,17 @@ func (m *DelegationInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AssetId) > 0 { - i -= len(m.AssetId) - copy(dAtA[i:], m.AssetId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetId))) + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetID))) i-- dAtA[i] = 0x12 } - if len(m.StakerId) > 0 { - i -= len(m.StakerId) - copy(dAtA[i:], m.StakerId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerId))) + if len(m.StakerID) > 0 { + i -= len(m.StakerID) + copy(dAtA[i:], m.StakerID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerID))) i-- dAtA[i] = 0xa } @@ -638,10 +639,10 @@ func (m *SingleDelegationInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) _ = i var l int _ = l - if len(m.AssetId) > 0 { - i -= len(m.AssetId) - copy(dAtA[i:], m.AssetId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetId))) + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetID))) i-- dAtA[i] = 0x1a } @@ -652,10 +653,10 @@ func (m *SingleDelegationInfoReq) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x12 } - if len(m.StakerId) > 0 { - i -= len(m.StakerId) - copy(dAtA[i:], m.StakerId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerId))) + if len(m.StakerID) > 0 { + i -= len(m.StakerID) + copy(dAtA[i:], m.StakerID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerID))) i-- dAtA[i] = 0xa } @@ -709,11 +710,11 @@ func (m *DelegationInfoReq) Size() (n int) { } var l int _ = l - l = len(m.StakerId) + l = len(m.StakerID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.AssetId) + l = len(m.AssetID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -763,7 +764,7 @@ func (m *SingleDelegationInfoReq) Size() (n int) { } var l int _ = l - l = len(m.StakerId) + l = len(m.StakerID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -771,7 +772,7 @@ func (m *SingleDelegationInfoReq) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.AssetId) + l = len(m.AssetID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -828,7 +829,7 @@ func (m *DelegationInfoReq) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -856,11 +857,11 @@ func (m *DelegationInfoReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StakerId = string(dAtA[iNdEx:postIndex]) + m.StakerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -888,7 +889,7 @@ func (m *DelegationInfoReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AssetId = string(dAtA[iNdEx:postIndex]) + m.AssetID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1273,7 +1274,7 @@ func (m *SingleDelegationInfoReq) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1301,7 +1302,7 @@ func (m *SingleDelegationInfoReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StakerId = string(dAtA[iNdEx:postIndex]) + m.StakerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1337,7 +1338,7 @@ func (m *SingleDelegationInfoReq) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1365,7 +1366,7 @@ func (m *SingleDelegationInfoReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AssetId = string(dAtA[iNdEx:postIndex]) + m.AssetID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/delegation/types/query.pb.gw.go b/x/delegation/types/query.pb.gw.go index f73dc307f..052e2eee7 100644 --- a/x/delegation/types/query.pb.gw.go +++ b/x/delegation/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join var ( filter_Query_QueryOperatorInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} @@ -142,12 +144,14 @@ func local_request_Query_QuerySingleDelegationInfo_0(ctx context.Context, marsha // 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. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_QueryOperatorInfo_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 { @@ -155,6 +159,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueryOperatorInfo_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) @@ -168,6 +173,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueryDelegationInfo_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 { @@ -175,6 +182,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueryDelegationInfo_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) @@ -188,6 +196,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QuerySingleDelegationInfo_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 { @@ -195,6 +205,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QuerySingleDelegationInfo_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) diff --git a/x/delegation/types/tx.pb.go b/x/delegation/types/tx.pb.go index 2a9ad0f2c..06c0cdf48 100644 --- a/x/delegation/types/tx.pb.go +++ b/x/delegation/types/tx.pb.go @@ -70,7 +70,7 @@ func (m *ValueField) XXX_DiscardUnknown() { var xxx_messageInfo_ValueField proto.InternalMessageInfo type DelegatedSingleAssetInfo struct { - AssetId string `protobuf:"bytes,1,opt,name=AssetId,proto3" json:"AssetId,omitempty"` + AssetID string `protobuf:"bytes,1,opt,name=AssetID,proto3" json:"AssetID,omitempty"` TotalDelegatedAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=TotalDelegatedAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"TotalDelegatedAmount"` PerOperatorAmounts map[string]*ValueField `protobuf:"bytes,3,rep,name=PerOperatorAmounts,proto3" json:"PerOperatorAmounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } @@ -108,9 +108,9 @@ func (m *DelegatedSingleAssetInfo) XXX_DiscardUnknown() { var xxx_messageInfo_DelegatedSingleAssetInfo proto.InternalMessageInfo -func (m *DelegatedSingleAssetInfo) GetAssetId() string { +func (m *DelegatedSingleAssetInfo) GetAssetID() string { if m != nil { - return m.AssetId + return m.AssetID } return "" } @@ -167,7 +167,7 @@ func (m *ClientChainEarningAddrList) GetEarningInfoList() []*ClientChainEarningA } type ClientChainEarningAddrInfo struct { - LzClientChainId uint64 `protobuf:"varint,1,opt,name=lzClientChainId,proto3" json:"lzClientChainId,omitempty"` + LzClientChainID uint64 `protobuf:"varint,1,opt,name=lzClientChainID,proto3" json:"lzClientChainID,omitempty"` ClientChainEarningAddr string `protobuf:"bytes,2,opt,name=clientChainEarningAddr,proto3" json:"clientChainEarningAddr,omitempty"` } @@ -204,9 +204,9 @@ func (m *ClientChainEarningAddrInfo) XXX_DiscardUnknown() { var xxx_messageInfo_ClientChainEarningAddrInfo proto.InternalMessageInfo -func (m *ClientChainEarningAddrInfo) GetLzClientChainId() uint64 { +func (m *ClientChainEarningAddrInfo) GetLzClientChainID() uint64 { if m != nil { - return m.LzClientChainId + return m.LzClientChainID } return 0 } @@ -503,8 +503,8 @@ func (m *MsgDelegation) GetApprovedInfo() *DelegationApproveInfo { } type UndelegationRecord struct { - StakerId string `protobuf:"bytes,1,opt,name=stakerId,proto3" json:"stakerId,omitempty"` - AssetId string `protobuf:"bytes,2,opt,name=assetId,proto3" json:"assetId,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` + AssetID string `protobuf:"bytes,2,opt,name=assetID,proto3" json:"assetID,omitempty"` OperatorAddr string `protobuf:"bytes,3,opt,name=OperatorAddr,proto3" json:"OperatorAddr,omitempty"` TxHash string `protobuf:"bytes,4,opt,name=txHash,proto3" json:"txHash,omitempty"` IsPending bool `protobuf:"varint,5,opt,name=isPending,proto3" json:"isPending,omitempty"` @@ -548,16 +548,16 @@ func (m *UndelegationRecord) XXX_DiscardUnknown() { var xxx_messageInfo_UndelegationRecord proto.InternalMessageInfo -func (m *UndelegationRecord) GetStakerId() string { +func (m *UndelegationRecord) GetStakerID() string { if m != nil { - return m.StakerId + return m.StakerID } return "" } -func (m *UndelegationRecord) GetAssetId() string { +func (m *UndelegationRecord) GetAssetID() string { if m != nil { - return m.AssetId + return m.AssetID } return "" } @@ -787,75 +787,76 @@ func init() { func init() { proto.RegisterFile("exocore/delegation/v1/tx.proto", fileDescriptor_16596a15a828f109) } var fileDescriptor_16596a15a828f109 = []byte{ - // 1082 bytes of a gzipped FileDescriptorProto + // 1090 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0xf6, 0xc4, 0xd9, 0xfc, 0x94, 0x83, 0x12, 0x7a, 0xf3, 0x33, 0x3b, 0x20, 0x27, 0x0c, 0xec, - 0x2a, 0x04, 0x62, 0x93, 0xf0, 0xb3, 0xc8, 0x5a, 0x09, 0xe5, 0x6f, 0xc1, 0x62, 0xbd, 0x1b, 0xcd, - 0x06, 0x0e, 0x80, 0x84, 0xc6, 0x33, 0x9d, 0xc9, 0xe0, 0x71, 0xf7, 0x30, 0xdd, 0x0e, 0xf6, 0x1e, - 0x10, 0xe2, 0x04, 0x9c, 0x78, 0x84, 0x7d, 0x00, 0x0e, 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41, - 0xdf, 0x96, 0x47, 0xc2, 0xee, 0x7d, 0x9f, 0x78, 0x01, 0xde, 0x60, 0x0c, 0xf3, 0x2a, 0xd9, 0xa7, - 0x48, 0x87, 0x71, 0xb9, 0x70, 0x25, 0xa7, 0xd5, 0x5d, 0xa2, 0x10, 0x66, 0xf7, 0x28, 0xb7, 0x83, - 0xde, 0x56, 0xe5, 0xda, 0xc8, 0x25, 0xb8, 0x36, 0x14, 0x19, 0x7d, 0x05, 0x68, 0x17, 0x47, 0xf7, - 0x42, 0x1c, 0xd9, 0x9c, 0x46, 0x52, 0xc8, 0xf4, 0xfc, 0x52, 0x7e, 0xb9, 0xb0, 0xfe, 0x7e, 0x69, - 0x68, 0x76, 0x4a, 0x59, 0x07, 0x2b, 0x0d, 0x22, 0xed, 0x10, 0x1e, 0x75, 0xac, 0x21, 0x14, 0xc6, - 0x01, 0x2c, 0x64, 0x98, 0xa3, 0x19, 0xc8, 0x37, 0x70, 0x47, 0xc5, 0x26, 0xfe, 0x44, 0x37, 0xe1, - 0xca, 0x61, 0x9c, 0x32, 0x11, 0x88, 0xc2, 0xfa, 0x4b, 0x19, 0x8e, 0x25, 0x69, 0xb5, 0xa4, 0x7d, - 0x65, 0xe4, 0x5d, 0xcd, 0xec, 0x80, 0xe1, 0x04, 0x3e, 0x26, 0x7c, 0xeb, 0xc0, 0xf6, 0xc9, 0x8e, - 0x1d, 0x11, 0x9f, 0x78, 0x1b, 0xae, 0x1b, 0xdd, 0xf1, 0x19, 0x47, 0x9f, 0xc2, 0xb4, 0x12, 0xc5, - 0x47, 0x88, 0x45, 0xba, 0x26, 0x4e, 0xbf, 0x96, 0x41, 0x32, 0x1c, 0x2b, 0xde, 0x6c, 0x9d, 0x45, - 0x32, 0xbf, 0xce, 0xa2, 0x16, 0x75, 0xb0, 0x0c, 0xd3, 0xc1, 0x83, 0xad, 0x44, 0xaf, 0xea, 0x61, - 0xd4, 0x3a, 0x2b, 0x46, 0xef, 0xc0, 0xfc, 0x70,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, + 0xad, 0xda, 0xb5, 0x81, 0x2b, 0x70, 0xad, 0x2f, 0x32, 0x7a, 0x00, 0x68, 0x17, 0xb3, 0x7b, 0x11, + 0x66, 0xae, 0xa0, 0x4c, 0x09, 0xb9, 0x99, 0x9f, 0xcf, 0x2f, 0x14, 0x56, 0x3e, 0x28, 0xf5, 0xcd, + 0x4e, 0x29, 0xeb, 0x60, 0xa5, 0x5e, 0xa4, 0x2d, 0x22, 0x58, 0xcb, 0xe9, 0x43, 0x61, 0x1d, 0xc2, + 0x6c, 0x86, 0x39, 0x9a, 0x84, 0x7c, 0x0d, 0xb7, 0x74, 0x6c, 0xe2, 0x4f, 0x74, 0x0b, 0x86, 0x8e, + 0xe2, 0x94, 0xc9, 0x40, 0x14, 0x56, 0x5e, 0xc9, 0x70, 0x2c, 0x49, 0xab, 0xa3, 0xec, 0x57, 0x07, + 0xde, 0x37, 0xec, 0x16, 0x58, 0x5e, 0x18, 0x60, 0x22, 0x36, 0x0e, 0xdd, 0x80, 0x6c, 0xb9, 0x8c, + 0x04, 0xc4, 0x5f, 0xab, 0x56, 0xd9, 0xdd, 0x80, 0x0b, 0xf4, 0x19, 0x4c, 0x68, 0x51, 0x7c, 0x84, + 0x58, 0x64, 0x1a, 0xf2, 0xf4, 0xcb, 0x19, 0x24, 0xfd, 0xb1, 0xe2, 0xcd, 0xce, 0x79, 0x24, 0xfb, + 0xeb, 0x2c, 0x6a, 0x59, 0x07, 0x0b, 0x30, 0x11, 0x3e, 0xdc, 0x48, 0xf4, 0xba, 0x1e, 0x06, 0x9d, + 0xf3, 0x62, 0xf4, 0x1e, 0xcc, 0xf4, 0xc7, 0x51, 0x95, 0xe1, 0x64, 0x68, 0xed, 0x3f, 0x0d, 0x18, + 0x6f, 0x87, 0x58, 0x52, 0xda, 0x30, 0xae, 0xf5, 0x5c, 0x6e, 0x57, 0x31, 0xee, 0x92, 0xa1, 0x79, + 0x28, 0xac, 0x45, 0x11, 0xa3, 0x47, 0x38, 0xc5, 0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, 0x67, 0xc7, 0x8b, 0xc6, 0xfa, 0xce, + 0x93, 0x93, 0xa2, 0xf1, 0xf4, 0xa4, 0x68, 0xfc, 0x7e, 0x52, 0x34, 0x7e, 0x3c, 0x2d, 0xe6, 0x9e, + 0x9e, 0x16, 0x73, 0xbf, 0x9c, 0x16, 0x73, 0x9f, 0xde, 0x4c, 0x55, 0xe2, 0x96, 0xc2, 0xdd, 0xc1, + 0xe2, 0x01, 0x65, 0xb5, 0x72, 0xfb, 0x77, 0x41, 0x33, 0xfd, 0xcb, 0x40, 0xd6, 0xe6, 0xfe, 0xb0, + 0x7c, 0xa6, 0xbf, 0xf3, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x29, 0xf9, 0x36, 0xba, 0x3c, 0x0c, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1101,10 +1102,10 @@ func (m *DelegatedSingleAssetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error } i-- dAtA[i] = 0x12 - if len(m.AssetId) > 0 { - i -= len(m.AssetId) - copy(dAtA[i:], m.AssetId) - i = encodeVarintTx(dAtA, i, uint64(len(m.AssetId))) + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintTx(dAtA, i, uint64(len(m.AssetID))) i-- dAtA[i] = 0xa } @@ -1175,8 +1176,8 @@ func (m *ClientChainEarningAddrInfo) MarshalToSizedBuffer(dAtA []byte) (int, err i-- dAtA[i] = 0x12 } - if m.LzClientChainId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.LzClientChainId)) + if m.LzClientChainID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.LzClientChainID)) i-- dAtA[i] = 0x8 } @@ -1523,17 +1524,17 @@ func (m *UndelegationRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.AssetId) > 0 { - i -= len(m.AssetId) - copy(dAtA[i:], m.AssetId) - i = encodeVarintTx(dAtA, i, uint64(len(m.AssetId))) + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintTx(dAtA, i, uint64(len(m.AssetID))) i-- dAtA[i] = 0x12 } - if len(m.StakerId) > 0 { - i -= len(m.StakerId) - copy(dAtA[i:], m.StakerId) - i = encodeVarintTx(dAtA, i, uint64(len(m.StakerId))) + if len(m.StakerID) > 0 { + i -= len(m.StakerID) + copy(dAtA[i:], m.StakerID) + i = encodeVarintTx(dAtA, i, uint64(len(m.StakerID))) i-- dAtA[i] = 0xa } @@ -1681,7 +1682,7 @@ func (m *DelegatedSingleAssetInfo) Size() (n int) { } var l int _ = l - l = len(m.AssetId) + l = len(m.AssetID) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1724,8 +1725,8 @@ func (m *ClientChainEarningAddrInfo) Size() (n int) { } var l int _ = l - if m.LzClientChainId != 0 { - n += 1 + sovTx(uint64(m.LzClientChainId)) + if m.LzClientChainID != 0 { + n += 1 + sovTx(uint64(m.LzClientChainID)) } l = len(m.ClientChainEarningAddr) if l > 0 { @@ -1851,11 +1852,11 @@ func (m *UndelegationRecord) Size() (n int) { } var l int _ = l - l = len(m.StakerId) + l = len(m.StakerID) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.AssetId) + l = len(m.AssetID) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2053,7 +2054,7 @@ func (m *DelegatedSingleAssetInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2081,7 +2082,7 @@ func (m *DelegatedSingleAssetInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AssetId = string(dAtA[iNdEx:postIndex]) + m.AssetID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -2382,9 +2383,9 @@ func (m *ClientChainEarningAddrInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LzClientChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LzClientChainID", wireType) } - m.LzClientChainId = 0 + m.LzClientChainID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2394,7 +2395,7 @@ func (m *ClientChainEarningAddrInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LzClientChainId |= uint64(b&0x7F) << shift + m.LzClientChainID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -3280,7 +3281,7 @@ func (m *UndelegationRecord) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3308,11 +3309,11 @@ func (m *UndelegationRecord) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StakerId = string(dAtA[iNdEx:postIndex]) + m.StakerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3340,7 +3341,7 @@ func (m *UndelegationRecord) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AssetId = string(dAtA[iNdEx:postIndex]) + m.AssetID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { diff --git a/x/deposit/keeper/cross_chain_tx_process.go b/x/deposit/keeper/cross_chain_tx_process.go index e09723582..67c3960c3 100644 --- a/x/deposit/keeper/cross_chain_tx_process.go +++ b/x/deposit/keeper/cross_chain_tx_process.go @@ -11,7 +11,7 @@ import ( ) type DepositParams struct { - ClientChainLzId uint64 + ClientChainLzID uint64 // The action field might need to be removed,it will be used when called from event hook. Action types.CrossChainOpType AssetsAddress []byte @@ -36,14 +36,14 @@ type DepositParams struct { return nil, nil } - var clientChainLzId uint64 - r = bytes.NewReader(log.Topics[types.ClientChainLzIdIndexInTopics][:]) - err = binary.Read(r, binary.BigEndian, &clientChainLzId) + var clientChainLzID uint64 + r = bytes.NewReader(log.Topics[types.ClientChainLzIDIndexInTopics][:]) + err = binary.Read(r, binary.BigEndian, &clientChainLzID) if err != nil { - return nil, errorsmod.Wrap(err, "error occurred when binary read ClientChainLzId from topic") + return nil, errorsmod.Wrap(err, "error occurred when binary read ClientChainLzID from topic") } - clientChainInfo, err := k.restakingStateKeeper.GetClientChainInfoByIndex(ctx, clientChainLzId) + clientChainInfo, err := k.restakingStateKeeper.GetClientChainInfoByIndex(ctx, clientChainLzID) if err != nil { return nil, errorsmod.Wrap(err, "error occurred when get client chain info") } @@ -72,7 +72,7 @@ type DepositParams struct { amount := sdkmath.NewIntFromBigInt(big.NewInt(0).SetBytes(log.Data[readStart:readEnd])) return &DepositParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: action, AssetsAddress: assetsAddress, StakerAddress: depositAddress, @@ -128,23 +128,23 @@ func (k Keeper) Deposit(ctx sdk.Context, params *DepositParams) error { if params.OpAmount.IsNegative() { return errorsmod.Wrap(despoittypes.ErrDepositAmountIsNegative, fmt.Sprintf("the amount is:%s", params.OpAmount)) } - stakeId, assetId := types.GetStakeIDAndAssetId(params.ClientChainLzId, params.StakerAddress, params.AssetsAddress) + stakeID, assetID := types.GetStakeIDAndAssetID(params.ClientChainLzID, params.StakerAddress, params.AssetsAddress) // check if asset exist - if !k.restakingStateKeeper.IsStakingAsset(ctx, assetId) { - return errorsmod.Wrap(despoittypes.ErrDepositAssetNotExist, fmt.Sprintf("the assetId is:%s", assetId)) + if !k.restakingStateKeeper.IsStakingAsset(ctx, assetID) { + return errorsmod.Wrap(despoittypes.ErrDepositAssetNotExist, fmt.Sprintf("the assetID is:%s", assetID)) } changeAmount := types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: params.OpAmount, CanWithdrawAmountOrWantChangeValue: params.OpAmount, } // update asset state of the specified staker - err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakeId, assetId, changeAmount) + err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakeID, assetID, changeAmount) if err != nil { return err } // update total amount of the deposited asset - err = k.restakingStateKeeper.UpdateStakingAssetTotalAmount(ctx, assetId, params.OpAmount) + err = k.restakingStateKeeper.UpdateStakingAssetTotalAmount(ctx, assetID, params.OpAmount) if err != nil { return err } diff --git a/x/deposit/keeper/deposit_test.go b/x/deposit/keeper/deposit_test.go index 74d98beb3..46f9e51d0 100644 --- a/x/deposit/keeper/deposit_test.go +++ b/x/deposit/keeper/deposit_test.go @@ -12,7 +12,7 @@ func (suite *KeeperTestSuite) TestDeposit() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") usdcAddress := common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") params := &keeper.DepositParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Deposit, StakerAddress: suite.address[:], OpAmount: sdkmath.NewInt(100), @@ -33,8 +33,8 @@ func (suite *KeeperTestSuite) TestDeposit() { suite.NoError(err) // check state after deposit - stakerId, assetId := types.GetStakeIDAndAssetId(params.ClientChainLzId, params.StakerAddress, params.AssetsAddress) - info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(params.ClientChainLzID, params.StakerAddress, params.AssetsAddress) + info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: params.OpAmount, @@ -42,7 +42,7 @@ func (suite *KeeperTestSuite) TestDeposit() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *info) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetId) + assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) suite.NoError(err) suite.Equal(params.OpAmount, assetInfo.StakingTotalAmount) } diff --git a/x/deposit/keeper/grpc_query.go b/x/deposit/keeper/grpc_query.go index 54b5d42d0..bf84caad8 100644 --- a/x/deposit/keeper/grpc_query.go +++ b/x/deposit/keeper/grpc_query.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { c := sdk.UnwrapSDKContext(ctx) params, err := k.GetParams(c) if err != nil { diff --git a/x/deposit/keeper/params.go b/x/deposit/keeper/params.go index 98d7ad8c5..42c755e91 100644 --- a/x/deposit/keeper/params.go +++ b/x/deposit/keeper/params.go @@ -17,7 +17,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params *deposittype.Params) error { return deposittype.ErrInvalidEvmAddressFormat } if len(common.FromHex(params.ExoCoreLzAppEventTopic)) != common.HashLength { - return deposittype.ErrInvalidLzUaTopicIdLength + return deposittype.ErrInvalidLzUaTopicIDLength } params.ExoCoreLzAppAddress = strings.ToLower(params.ExoCoreLzAppAddress) params.ExoCoreLzAppEventTopic = strings.ToLower(params.ExoCoreLzAppEventTopic) diff --git a/x/deposit/module.go b/x/deposit/module.go index 2a0ce1d0a..177725127 100644 --- a/x/deposit/module.go +++ b/x/deposit/module.go @@ -16,8 +16,6 @@ import ( "github.com/spf13/cobra" ) -const consensusVersion = 0 - // type check to ensure the interface is properly implemented var ( _ module.AppModule = AppModule{} @@ -58,7 +56,7 @@ type AppModule struct { keeper keeper.Keeper } -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { +func NewAppModule(_ codec.Codec, keeper keeper.Keeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: keeper, diff --git a/x/deposit/types/deposit.pb.go b/x/deposit/types/deposit.pb.go index 7550a72a6..584a21388 100644 --- a/x/deposit/types/deposit.pb.go +++ b/x/deposit/types/deposit.pb.go @@ -83,7 +83,7 @@ func init() { func init() { proto.RegisterFile("exocore/deposit/v1/deposit.proto", fileDescriptor_bb743e1548b62476) } var fileDescriptor_bb743e1548b62476 = []byte{ - // 194 bytes of a gzipped FileDescriptorProto + // 205 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0x49, 0x2d, 0xc8, 0x2f, 0xce, 0x2c, 0xd1, 0x2f, 0x33, 0x84, 0x31, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x84, 0xa0, 0x2a, 0xf4, 0x60, 0xc2, 0x65, 0x86, 0x52, @@ -91,12 +91,12 @@ var fileDescriptor_bb743e1548b62476 = []byte{ 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0xc8, 0x80, 0x4b, 0x38, 0xb5, 0x22, 0xdf, 0x39, 0xbf, 0x28, 0xd5, 0xa7, 0xca, 0xb1, 0xa0, 0xc0, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x58, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, 0x08, 0x9b, 0x94, 0x90, 0x19, 0x97, 0x18, 0xb2, 0xb0, 0x6b, 0x59, 0x6a, 0x5e, - 0x49, 0x48, 0x7e, 0x41, 0x66, 0xb2, 0x04, 0x13, 0x58, 0x13, 0x0e, 0x59, 0x27, 0x9b, 0x13, 0x8f, + 0x49, 0x48, 0x7e, 0x41, 0x66, 0xb2, 0x04, 0x13, 0x58, 0x13, 0x0e, 0x59, 0x27, 0xef, 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, 0x52, 0x4a, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, - 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0x79, 0xb2, 0x02, 0xee, 0xcd, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, - 0x36, 0xb0, 0xc3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x92, 0x1f, 0x59, 0xfc, 0x06, 0x01, - 0x00, 0x00, + 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, + 0x4b, 0xce, 0xcf, 0xd5, 0x77, 0x85, 0x78, 0xc1, 0x2f, 0xb5, 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, + 0xe6, 0xe7, 0x0a, 0xb8, 0xaf, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xfe, 0x30, 0x06, + 0x04, 0x00, 0x00, 0xff, 0xff, 0x87, 0x19, 0xe5, 0x20, 0x15, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/deposit/types/errors.go b/x/deposit/types/errors.go index 1d9bec181..65f8acf75 100644 --- a/x/deposit/types/errors.go +++ b/x/deposit/types/errors.go @@ -7,7 +7,7 @@ import ( // errors var ( ErrInvalidEvmAddressFormat = errorsmod.Register(ModuleName, 0, "the evm address format is error") - ErrInvalidLzUaTopicIdLength = errorsmod.Register(ModuleName, 1, "the LZUaTopicId length isn't equal to HashLength") + ErrInvalidLzUaTopicIDLength = errorsmod.Register(ModuleName, 1, "the LZUaTopicID length isn't equal to HashLength") ErrNoParamsKey = errorsmod.Register(ModuleName, 2, "there is no stored key for deposit module params") ErrDepositAmountIsNegative = errorsmod.Register(ModuleName, 3, "the deposit amount is negative") ErrDepositAssetNotExist = errorsmod.Register(ModuleName, 4, "the deposit asset doesn't exist") diff --git a/x/deposit/types/query.pb.go b/x/deposit/types/query.pb.go index e61cc8614..5647536a0 100644 --- a/x/deposit/types/query.pb.go +++ b/x/deposit/types/query.pb.go @@ -122,25 +122,26 @@ func init() { func init() { proto.RegisterFile("exocore/deposit/v1/query.proto", fileDescriptor_715f16e6b5833923) } var fileDescriptor_715f16e6b5833923 = []byte{ - // 285 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x31, 0x4f, 0xc3, 0x30, - 0x14, 0x84, 0x63, 0x24, 0x32, 0x98, 0xcd, 0x74, 0x00, 0x53, 0x59, 0x55, 0x06, 0x60, 0xb2, 0xd5, - 0xb0, 0x32, 0xb1, 0xb1, 0x01, 0x23, 0x0b, 0x4a, 0x83, 0x65, 0x22, 0x91, 0x3c, 0x37, 0x76, 0xaa, - 0x76, 0x60, 0x61, 0x60, 0x46, 0xe2, 0x4f, 0x31, 0x56, 0x62, 0x61, 0x44, 0x09, 0x3f, 0x04, 0xd5, - 0x36, 0x95, 0xa0, 0x91, 0xba, 0xd9, 0xef, 0xbb, 0x3b, 0xdf, 0x33, 0x66, 0x72, 0x0e, 0x39, 0xd4, - 0x52, 0xdc, 0x4b, 0x0d, 0xa6, 0xb0, 0x62, 0x36, 0x16, 0xd3, 0x46, 0xd6, 0x0b, 0xae, 0x6b, 0xb0, - 0x40, 0x48, 0xe0, 0x3c, 0x70, 0x3e, 0x1b, 0xd3, 0x81, 0x02, 0x05, 0x0e, 0x8b, 0xd5, 0xc9, 0x2b, - 0xe9, 0x50, 0x01, 0xa8, 0x47, 0x29, 0x32, 0x5d, 0x88, 0xac, 0xaa, 0xc0, 0x66, 0xb6, 0x80, 0xca, - 0x04, 0x7a, 0x94, 0x83, 0x29, 0xc1, 0xf8, 0xec, 0x7f, 0x8f, 0xd0, 0x43, 0x0f, 0xef, 0x7c, 0xa6, - 0xbf, 0x04, 0x34, 0xea, 0xe9, 0xf7, 0x5b, 0xc5, 0x29, 0x92, 0x01, 0x26, 0xd7, 0xab, 0xac, 0xab, - 0xac, 0xce, 0x4a, 0x73, 0x23, 0xa7, 0x8d, 0x34, 0x36, 0xb9, 0xc4, 0xfb, 0x7f, 0xa6, 0x46, 0x43, - 0x65, 0x24, 0x49, 0x71, 0xac, 0xdd, 0xe4, 0x00, 0x8d, 0xd0, 0xe9, 0x5e, 0x4a, 0xf9, 0xe6, 0x7e, - 0x3c, 0x78, 0x82, 0x32, 0x7d, 0x41, 0x78, 0xd7, 0x65, 0x91, 0x27, 0x1c, 0x7b, 0x46, 0x8e, 0xfb, - 0x7c, 0x9b, 0x35, 0xe8, 0xc9, 0x56, 0x9d, 0x2f, 0x96, 0x24, 0xcf, 0x1f, 0xdf, 0x6f, 0x3b, 0x43, - 0x42, 0x45, 0xcf, 0xc2, 0x5e, 0x7b, 0x71, 0xfe, 0xde, 0x32, 0xb4, 0x6c, 0x19, 0xfa, 0x6a, 0x19, - 0x7a, 0xed, 0x58, 0xb4, 0xec, 0x58, 0xf4, 0xd9, 0xb1, 0xe8, 0x36, 0x51, 0x85, 0x7d, 0x68, 0x26, - 0x3c, 0x87, 0x72, 0xed, 0x9f, 0xaf, 0x13, 0xec, 0x42, 0x4b, 0x33, 0x89, 0xdd, 0x77, 0x9d, 0xfd, - 0x04, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x89, 0x79, 0xdf, 0xf2, 0x01, 0x00, 0x00, + // 297 bytes of a gzipped FileDescriptorProto + 0x1f, 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 0xc9, 0x16, 0x1a, 0xa1, 0xfd, 0x8d, 0x84, + 0xf2, 0xf5, 0xfd, 0xb8, 0xf7, 0x78, 0x65, 0xf2, 0x84, 0xf0, 0x7f, 0x9b, 0x45, 0x1e, 0x70, 0xe8, + 0x18, 0xd9, 0xed, 0xf3, 0xad, 0xd7, 0xa0, 0x7b, 0x7f, 0xea, 0x5c, 0xb1, 0x28, 0x7a, 0x7c, 0xfb, + 0x7c, 0xf9, 0x37, 0x24, 0x54, 0xf4, 0x2c, 0xec, 0xb4, 0x87, 0x27, 0xaf, 0x2d, 0x43, 0x8b, 0x96, + 0xa1, 0x8f, 0x96, 0xa1, 0xe7, 0x8e, 0x05, 0x8b, 0x8e, 0x05, 0xef, 0x1d, 0x0b, 0x2e, 0xe3, 0xbc, + 0x30, 0x37, 0xcd, 0x98, 0x67, 0x50, 0x8a, 0x23, 0xe7, 0x3f, 0x95, 0xe6, 0x1e, 0xea, 0xdb, 0x55, + 0xdc, 0x6c, 0x15, 0x68, 0xe6, 0x4a, 0xea, 0x71, 0x68, 0x7f, 0xef, 0xe0, 0x2b, 0x00, 0x00, 0xff, + 0xff, 0x5f, 0x20, 0xfd, 0x7d, 0x01, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/deposit/types/query.pb.gw.go b/x/deposit/types/query.pb.gw.go index 2c727832e..4e143091e 100644 --- a/x/deposit/types/query.pb.gw.go +++ b/x/deposit/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -52,12 +54,14 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // 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. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_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 { @@ -65,6 +69,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_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) diff --git a/x/deposit/types/tx.pb.go b/x/deposit/types/tx.pb.go index ce09c2db0..f5cb2ac2e 100644 --- a/x/deposit/types/tx.pb.go +++ b/x/deposit/types/tx.pb.go @@ -135,7 +135,7 @@ func init() { func init() { proto.RegisterFile("exocore/deposit/v1/tx.proto", fileDescriptor_d4939a0226905392) } var fileDescriptor_d4939a0226905392 = []byte{ - // 328 bytes of a gzipped FileDescriptorProto + // 339 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0x49, 0x2d, 0xc8, 0x2f, 0xce, 0x2c, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x4a, 0xea, 0x41, 0x25, 0xf5, 0xca, @@ -152,11 +152,12 @@ var fileDescriptor_d4939a0226905392 = []byte{ 0x16, 0xc2, 0x24, 0x25, 0x49, 0x2e, 0x71, 0x34, 0x47, 0x05, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x1a, 0xe5, 0x71, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0x25, 0x70, 0xf1, 0xa0, 0xb8, 0x59, 0x19, 0x9b, 0x5d, 0x68, 0x66, 0x48, 0x69, 0x13, 0xa1, 0x08, 0x66, 0x91, 0x14, 0x6b, 0xc3, 0xf3, 0x0d, - 0x5a, 0x8c, 0x4e, 0x36, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, - 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x94, - 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x0b, 0xe7, 0x0a, 0x78, 0x48, - 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x43, 0xd9, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, - 0xd6, 0xc3, 0xbf, 0x20, 0x17, 0x02, 0x00, 0x00, + 0x5a, 0x8c, 0x4e, 0xde, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, + 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x98, + 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, 0x0a, 0x31, 0xd7, 0x2f, 0xb5, + 0xa4, 0x3c, 0xbf, 0x28, 0x5b, 0x1f, 0x16, 0xec, 0x15, 0xf0, 0x80, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, + 0x4e, 0x62, 0x03, 0x07, 0xba, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x32, 0xea, 0x25, 0xb9, 0x26, + 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/evm/types/params.go b/x/evm/types/params.go index 92e972ae6..d0419b159 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -1,6 +1,7 @@ package types import ( + utils "github.com/ExocoreNetwork/exocore/utils" evmtype "github.com/evmos/evmos/v14/x/evm/types" ) @@ -23,7 +24,7 @@ var ExocoreAvailableEVMExtensions = []string{ // from the EVM configuration. func ExocoreEvmDefaultParams() evmtype.Params { return evmtype.Params{ - EvmDenom: evmtype.DefaultEVMDenom, + EvmDenom: utils.BaseDenom, EnableCreate: evmtype.DefaultEnableCreate, EnableCall: evmtype.DefaultEnableCall, ChainConfig: evmtype.DefaultChainConfig(), diff --git a/x/native_token/module.go b/x/native_token/module.go index 00269d42e..4ad59d5b4 100644 --- a/x/native_token/module.go +++ b/x/native_token/module.go @@ -1,3 +1,4 @@ +// nolint: all // this package is not implemented yet. package native_token import ( diff --git a/x/native_token/types/tx.pb.go b/x/native_token/types/tx.pb.go index 2843f1e49..16e996410 100644 --- a/x/native_token/types/tx.pb.go +++ b/x/native_token/types/tx.pb.go @@ -179,40 +179,41 @@ func init() { func init() { proto.RegisterFile("exocore/native_token/v1/tx.proto", fileDescriptor_769c53c072051eb9) } var fileDescriptor_769c53c072051eb9 = []byte{ - // 526 bytes of a gzipped FileDescriptorProto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 0xdc, 0x56, - 0x96, 0x35, 0xdc, 0x68, 0x08, 0x3b, 0xa7, 0xa2, 0x0a, 0xa7, 0x8f, 0x83, 0x11, 0x79, 0x19, 0xd3, - 0xf0, 0xe4, 0x6d, 0x37, 0x9d, 0xda, 0x6d, 0xcf, 0x5c, 0xc9, 0x8c, 0x64, 0x80, 0x13, 0xea, 0x74, - 0x1c, 0x27, 0x26, 0x8c, 0x89, 0x91, 0x5b, 0x39, 0x0f, 0xba, 0xc8, 0xdd, 0x20, 0x96, 0x28, 0x53, - 0x2b, 0x2b, 0xa5, 0xd6, 0x66, 0x5b, 0x5f, 0x7b, 0x33, 0x57, 0xea, 0xa9, 0x2e, 0x92, 0x1c, 0x47, - 0x3c, 0x9e, 0x5a, 0x4b, 0xcc, 0x75, 0x0f, 0xee, 0xaf, 0x48, 0x43, 0x55, 0x28, 0xf9, 0x64, 0x2a, - 0x74, 0xb7, 0x92, 0x2d, 0x3a, 0x82, 0xff, 0xc6, 0x49, 0x13, 0xa9, 0x2e, 0x9b, 0xed, 0xe6, 0xcd, - 0x5e, 0x89, 0x25, 0x40, 0x87, 0xc5, 0x67, 0x92, 0xde, 0xb9, 0x9c, 0xc9, 0xd2, 0xd5, 0x4c, 0x96, - 0xbe, 0xcf, 0x64, 0xe9, 0xd3, 0x5c, 0x2e, 0x5c, 0xcd, 0xe5, 0xc2, 0xd7, 0xb9, 0x5c, 0x78, 0xf7, - 0x38, 0x27, 0xee, 0xef, 0x4f, 0x62, 0xb2, 0xf8, 0x4d, 0xa4, 0x0a, 0x0f, 0x2a, 0xe9, 0x23, 0x7e, - 0xf2, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xe1, 0xff, 0x82, 0xf4, 0x4b, 0x04, 0x00, 0x00, + // 534 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0x93, 0x12, 0xd1, 0x29, 0x2d, 0x61, 0x29, 0x34, 0xe4, 0xe0, 0x46, 0x39, 0x44, 0xb9, + 0xd4, 0x56, 0x83, 0x54, 0xa1, 0xaa, 0x97, 0x18, 0x02, 0xf8, 0x80, 0x89, 0x9c, 0x34, 0x95, 0xb8, + 0x54, 0x1b, 0x7b, 0x31, 0xae, 0x7f, 0x36, 0xf2, 0x6e, 0xd2, 0xe4, 0x2d, 0x78, 0x18, 0x1e, 0xa2, + 0xc7, 0x8a, 0x13, 0xe2, 0x50, 0xa1, 0xe4, 0x1d, 0xb8, 0x82, 0xec, 0x35, 0xe0, 0x84, 0x44, 0xaa, + 0xd4, 0xd3, 0xee, 0xfc, 0x7c, 0xdf, 0xce, 0x7c, 0xb3, 0xbb, 0x50, 0x25, 0x13, 0x6a, 0xd1, 0x88, + 0xa8, 0x21, 0xe6, 0xee, 0x98, 0x9c, 0x73, 0xea, 0x91, 0x50, 0x1d, 0x1f, 0xaa, 0x7c, 0xa2, 0x0c, + 0x23, 0xca, 0x29, 0xda, 0x4b, 0x33, 0x94, 0x6c, 0x86, 0x32, 0x3e, 0xac, 0xec, 0x59, 0x94, 0x05, + 0x94, 0xa9, 0x01, 0x73, 0x62, 0x40, 0xc0, 0x1c, 0x81, 0xa8, 0x3c, 0x13, 0x81, 0xf3, 0xc4, 0x52, + 0x85, 0x91, 0x86, 0x76, 0x1d, 0xea, 0x50, 0xe1, 0x8f, 0x77, 0xc2, 0x5b, 0xfb, 0x95, 0x87, 0xed, + 0x3e, 0xf6, 0x5d, 0x1b, 0x73, 0x1a, 0xe9, 0xe1, 0x47, 0x8a, 0x0c, 0x28, 0x76, 0x39, 0xe6, 0x23, + 0x56, 0x96, 0xaa, 0x52, 0x63, 0xa7, 0x79, 0xa4, 0xac, 0xa9, 0x42, 0x59, 0xc0, 0xfd, 0xb3, 0x04, + 0xda, 0x4c, 0x59, 0x50, 0x1d, 0x76, 0x32, 0x89, 0x36, 0x99, 0x94, 0xf3, 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7, 0xdd, 0x64, 0x6a, 0x77, 0x3d, 0x73, 0x25, 0x33, 0x92, 0x01, 0x3a, 0xd4, 0x6e, 0xd9, + 0x76, 0x44, 0x18, 0x13, 0x23, 0x37, 0x33, 0x1e, 0x74, 0x91, 0xb9, 0x41, 0x2c, 0x56, 0xa6, 0xbc, + 0x51, 0x2d, 0x34, 0xb6, 0x9a, 0xda, 0xda, 0x9b, 0xb9, 0x52, 0x4f, 0x65, 0x91, 0xa4, 0x1d, 0xf2, + 0x68, 0x6a, 0x2e, 0x31, 0x57, 0x5c, 0x78, 0xbc, 0x22, 0x0d, 0x95, 0xa0, 0xe0, 0x91, 0xa9, 0xd0, + 0xdd, 0x8c, 0xb7, 0xe8, 0x04, 0xee, 0x8d, 0xe3, 0x26, 0x12, 0x5d, 0xb6, 0x9a, 0xf5, 0xdb, 0xbd, + 0x12, 0x53, 0x80, 0x8e, 0xf3, 0x2f, 0x24, 0xad, 0x73, 0x35, 0x93, 0xa5, 0xeb, 0x99, 0x2c, 0xfd, + 0x98, 0xc9, 0xd2, 0xe7, 0xb9, 0x9c, 0xbb, 0x9e, 0xcb, 0xb9, 0x6f, 0x73, 0x39, 0xf7, 0xe1, 0x28, + 0x23, 0x6e, 0x5b, 0xd0, 0x1a, 0x84, 0x5f, 0xd2, 0xc8, 0x53, 0xff, 0xfc, 0x19, 0x93, 0xc5, 0x5f, + 0x23, 0x11, 0x7c, 0x50, 0x4c, 0xde, 0xf4, 0xf3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, 0x55, + 0x62, 0x2e, 0x5a, 0x04, 0x00, 0x00, } func (m *ValidatorInfo) Marshal() (dAtA []byte, err error) { diff --git a/x/restaking_assets_manage/client/cli/query.go b/x/restaking_assets_manage/client/cli/query.go index 8626d71af..889ec9926 100644 --- a/x/restaking_assets_manage/client/cli/query.go +++ b/x/restaking_assets_manage/client/cli/query.go @@ -40,7 +40,7 @@ func GetQueryCmd() *cobra.Command { // QueClientChainInfoByIndex queries the client chain info by index func QueClientChainInfoByIndex() *cobra.Command { cmd := &cobra.Command{ - Use: "QueClientChainInfoByIndex clientChainLzId", + Use: "QueClientChainInfoByIndex clientChainLzID", Short: "Get client chain info by layerZero Id", Long: "Get client chain info by layerZero Id", Args: cobra.ExactArgs(1), @@ -49,13 +49,13 @@ func QueClientChainInfoByIndex() *cobra.Command { if err != nil { return err } - clientChainLzId, err := strconv.ParseUint(args[0], 10, 64) + clientChainLzID, err := strconv.ParseUint(args[0], 10, 64) if err != nil { return errorsmod.Wrap(types.ErrCliCmdInputArg, err.Error()) } queryClient := types.NewQueryClient(clientCtx) req := &types.QueryClientChainInfo{ - ChainIndex: clientChainLzId, + ChainIndex: clientChainLzID, } res, err := queryClient.QueClientChainInfoByIndex(context.Background(), req) if err != nil { @@ -99,7 +99,7 @@ func QueAllClientChainInfo() *cobra.Command { // QueStakingAssetInfo queries staking asset info func QueStakingAssetInfo() *cobra.Command { cmd := &cobra.Command{ - Use: "QueStakingAssetInfo assetAddr clientChainLzId", + Use: "QueStakingAssetInfo assetAddr clientChainLzID", Short: "Get staking asset info", Long: "Get staking asset info", Args: cobra.ExactArgs(2), @@ -109,15 +109,15 @@ func QueStakingAssetInfo() *cobra.Command { return err } - clientChainLzId, err := strconv.ParseUint(args[1], 10, 64) + clientChainLzID, err := strconv.ParseUint(args[1], 10, 64) if err != nil { return errorsmod.Wrap(types.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[1])) } - _, assetId := types.GetStakeIDAndAssetIdFromStr(clientChainLzId, "", args[0]) + _, assetID := types.GetStakeIDAndAssetIDFromStr(clientChainLzID, "", args[0]) queryClient := types.NewQueryClient(clientCtx) req := &types.QueryStakingAssetInfo{ - AssetId: assetId, + AssetID: assetID, } res, err := queryClient.QueStakingAssetInfo(context.Background(), req) if err != nil { @@ -161,7 +161,7 @@ func QueAllStakingAssetsInfo() *cobra.Command { // QueStakerAssetInfos queries staker asset info func QueStakerAssetInfos() *cobra.Command { cmd := &cobra.Command{ - Use: "QueStakerAssetInfos stakerId", + Use: "QueStakerAssetInfos stakerID", Short: "Get staker asset state", Long: "Get staker asset state", Args: cobra.ExactArgs(1), @@ -173,7 +173,7 @@ func QueStakerAssetInfos() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) req := &types.QueryStakerAssetInfo{ - StakerId: args[0], + StakerID: args[0], } res, err := queryClient.QueStakerAssetInfos(context.Background(), req) if err != nil { @@ -201,14 +201,14 @@ func QueStakerSpecifiedAssetAmount() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - clientChainLzId, err := strconv.ParseUint(args[0], 10, 64) + clientChainLzID, err := strconv.ParseUint(args[0], 10, 64) if err != nil { return errorsmod.Wrap(types.ErrCliCmdInputArg, err.Error()) } - stakerId, assetId := types.GetStakeIDAndAssetIdFromStr(clientChainLzId, args[1], args[2]) + stakerID, assetID := types.GetStakeIDAndAssetIDFromStr(clientChainLzID, args[1], args[2]) req := &types.QuerySpecifiedAssetAmountReq{ - StakerId: stakerId, - AssetId: assetId, + StakerID: stakerID, + AssetID: assetID, } res, err := queryClient.QueStakerSpecifiedAssetAmount(context.Background(), req) if err != nil { @@ -264,15 +264,15 @@ func QueOperatorSpecifiedAssetAmount() *cobra.Command { return err } - clientChainLzId, err := strconv.ParseUint(args[1], 10, 64) + clientChainLzID, err := strconv.ParseUint(args[1], 10, 64) if err != nil { return errorsmod.Wrap(types.ErrCliCmdInputArg, err.Error()) } - _, assetId := types.GetStakeIDAndAssetIdFromStr(clientChainLzId, "", args[2]) + _, assetID := types.GetStakeIDAndAssetIDFromStr(clientChainLzID, "", args[2]) queryClient := types.NewQueryClient(clientCtx) req := &types.QueryOperatorSpecifiedAssetAmountReq{ OperatorAddr: args[0], - AssetId: assetId, + AssetID: assetID, } res, err := queryClient.QueOperatorSpecifiedAssetAmount(context.Background(), req) if err != nil { @@ -289,7 +289,7 @@ func QueOperatorSpecifiedAssetAmount() *cobra.Command { // QueStakerExoCoreAddr queries staker ExoCore address func QueStakerExoCoreAddr() *cobra.Command { cmd := &cobra.Command{ - Use: "QueStakerExoCoreAddr stakerId", + Use: "QueStakerExoCoreAddr stakerID", Short: "Get staker ExoCore address", Long: "Get staker ExoCore address", Args: cobra.ExactArgs(1), @@ -301,7 +301,7 @@ func QueStakerExoCoreAddr() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) req := &types.QueryStakerExCoreAddr{ - StakerId: args[0], + StakerID: args[0], } res, err := queryClient.QueStakerExoCoreAddr(context.Background(), req) if err != nil { diff --git a/x/restaking_assets_manage/client/cli/tx.go b/x/restaking_assets_manage/client/cli/tx.go new file mode 100644 index 000000000..7b55345a0 --- /dev/null +++ b/x/restaking_assets_manage/client/cli/tx.go @@ -0,0 +1,125 @@ +package cli + +import ( + "fmt" + "strconv" + "strings" + + errorsmod "cosmossdk.io/errors" + sdkmath "cosmossdk.io/math" + restakingtype "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" +) + +// NewTxCmd returns a root CLI command handler for deposit commands +func NewTxCmd() *cobra.Command { + txCmd := &cobra.Command{ + Use: restakingtype.ModuleName, + Short: "restaking subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + txCmd.AddCommand( + RegisterClientChain(), + RegisterAsset(), + ) + return txCmd +} + +// RegisterClientChain register client chain +// todo: this function should be controlled by governance in the future +func RegisterClientChain() *cobra.Command { + cmd := &cobra.Command{ + Use: "RegisterClientChain Name MetaInfo LZChainId AddressLength", + Short: "register client chain", + Args: cobra.MinimumNArgs(4), + RunE: func(cmd *cobra.Command, args []string) error { + cliCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + sender := cliCtx.GetFromAddress() + msg := &restakingtype.RegisterClientChainReq{ + FromAddress: sender.String(), + Info: &restakingtype.ClientChainInfo{ + Name: args[0], + MetaInfo: args[1], + }, + } + lzChainID, err := strconv.ParseUint(args[2], 10, 64) + if err != nil { + return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[2])) + } + addressLength, err := strconv.ParseUint(args[3], 10, 64) + if err != nil { + return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[3])) + } + msg.Info.LayerZeroChainID = lzChainID + msg.Info.AddressLength = uint32(addressLength) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// RegisterAsset register the asset on the client chain +// todo: this function should be controlled by governance in the future +func RegisterAsset() *cobra.Command { + cmd := &cobra.Command{ + Use: "RegisterAsset Name Symbol Address MetaInfo TotalSupply LZChainId Decimals", + Short: "register asset", + Args: cobra.MinimumNArgs(7), + RunE: func(cmd *cobra.Command, args []string) error { + cliCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + sender := cliCtx.GetFromAddress() + msg := &restakingtype.RegisterAssetReq{ + FromAddress: sender.String(), + Info: &restakingtype.AssetInfo{ + Name: args[0], + Symbol: args[1], + Address: strings.ToLower(args[2]), + MetaInfo: args[3], + }, + } + totalSupply, ok := sdkmath.NewIntFromString(args[4]) + if !ok { + return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[4])) + } + + lzChainID, err := strconv.ParseUint(args[5], 10, 64) + if err != nil { + return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[5])) + } + decimal, err := strconv.ParseUint(args[6], 10, 64) + if err != nil { + return errorsmod.Wrap(restakingtype.ErrCliCmdInputArg, fmt.Sprintf("error arg is:%v", args[6])) + } + + msg.Info.TotalSupply = totalSupply + msg.Info.LayerZeroChainID = lzChainID + msg.Info.Decimals = uint32(decimal) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/restaking_assets_manage/genesis.go b/x/restaking_assets_manage/genesis.go index ecafcfdc6..2f1322ad7 100644 --- a/x/restaking_assets_manage/genesis.go +++ b/x/restaking_assets_manage/genesis.go @@ -1,4 +1,4 @@ -package restaking_assets_manage +package restaking_assets_manage // nolint: revive,stylecheck // Package naming to be fixed later. import ( "encoding/json" @@ -11,7 +11,7 @@ import ( ) // NewGenesisState - Create a new genesis state -func NewGenesisState(chain []*restakingtype.ClientChainInfo, token []*restakingtype.ClientChainTokenInfo) *restakingtype.GenesisState { +func NewGenesisState(chain []*restakingtype.ClientChainInfo, token []*restakingtype.AssetInfo) *restakingtype.GenesisState { return &restakingtype.GenesisState{ DefaultSupportedClientChains: chain, DefaultSupportedClientChainTokens: token, @@ -22,24 +22,24 @@ func NewGenesisState(chain []*restakingtype.ClientChainInfo, token []*restakingt func DefaultGenesisState() *restakingtype.GenesisState { // todo: set eth as client chain and usdt as asset in the genesis state ethClientChain := &restakingtype.ClientChainInfo{ - ChainName: "ethereum", - ChainMetaInfo: "ethereum blockchain", - OriginChainId: 1, - FinalityNeedBlockDelay: 10, - LayerZeroChainId: 101, - AddressLength: 20, + Name: "ethereum", + MetaInfo: "ethereum blockchain", + ChainId: 1, + FinalizationBlocks: 10, + LayerZeroChainID: 101, + AddressLength: 20, } - usdtClientChainAsset := &restakingtype.ClientChainTokenInfo{ + usdtClientChainAsset := &restakingtype.AssetInfo{ Name: "Tether USD", Symbol: "USDT", Address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", Decimals: 6, - LayerZeroChainId: ethClientChain.LayerZeroChainId, - AssetMetaInfo: "Tether USD token", + LayerZeroChainID: ethClientChain.LayerZeroChainID, + MetaInfo: "Tether USD token", } totalSupply, _ := sdk.NewIntFromString("40022689732746729") usdtClientChainAsset.TotalSupply = totalSupply - return NewGenesisState([]*restakingtype.ClientChainInfo{ethClientChain}, []*restakingtype.ClientChainTokenInfo{usdtClientChainAsset}) + return NewGenesisState([]*restakingtype.ClientChainInfo{ethClientChain}, []*restakingtype.AssetInfo{usdtClientChainAsset}) } // GetGenesisStateFromAppState returns x/restaking_assets_manage GenesisState given raw application @@ -56,7 +56,7 @@ func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMe // ValidateGenesis performs basic validation of restaking_assets_manage genesis data returning an // error for any failed validation criteria. -func ValidateGenesis(data restakingtype.GenesisState) error { +func ValidateGenesis(restakingtype.GenesisState) error { // todo: check the validation of client chain and token info return nil } @@ -99,7 +99,7 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *restakingtype.GenesisState clientChainList = append(clientChainList, v) } - clientChainAssetsList := make([]*restakingtype.ClientChainTokenInfo, 0) + clientChainAssetsList := make([]*restakingtype.AssetInfo, 0) clientChainAssets, _ := k.GetAllStakingAssetsInfo(c) for _, v := range clientChainAssets { clientChainAssetsList = append(clientChainAssetsList, v.AssetBasicInfo) diff --git a/x/restaking_assets_manage/keeper/client_chain.go b/x/restaking_assets_manage/keeper/client_chain.go index c106bcf64..f0507ffc4 100644 --- a/x/restaking_assets_manage/keeper/client_chain.go +++ b/x/restaking_assets_manage/keeper/client_chain.go @@ -11,14 +11,14 @@ import ( // It provides a function to register the client chains supported by exoCore.It's called by genesis configuration now,however it will be called by the governance in the future func (k Keeper) SetClientChainInfo(ctx sdk.Context, info *restakingtype.ClientChainInfo) (err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixClientChainInfo) - //key := common.HexToAddress(incentive.Contract) + bz := k.cdc.MustMarshal(info) - store.Set([]byte(hexutil.EncodeUint64(info.LayerZeroChainId)), bz) + store.Set([]byte(hexutil.EncodeUint64(info.LayerZeroChainID)), bz) return nil } -func (k Keeper) ClientChainInfoIsExist(ctx sdk.Context, index uint64) bool { +func (k Keeper) IsExistedClientChain(ctx sdk.Context, index uint64) bool { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixClientChainInfo) return store.Has([]byte(hexutil.EncodeUint64(index))) } @@ -47,7 +47,7 @@ func (k Keeper) GetAllClientChainInfo(ctx sdk.Context) (infos map[uint64]*restak for ; iterator.Valid(); iterator.Next() { var chainInfo restakingtype.ClientChainInfo k.cdc.MustUnmarshal(iterator.Value(), &chainInfo) - ret[chainInfo.LayerZeroChainId] = &chainInfo + ret[chainInfo.LayerZeroChainID] = &chainInfo } return ret, nil } diff --git a/x/restaking_assets_manage/keeper/client_chain_and_asset_test.go b/x/restaking_assets_manage/keeper/client_chain_and_asset_test.go index dde9dda69..a776ee0a4 100644 --- a/x/restaking_assets_manage/keeper/client_chain_and_asset_test.go +++ b/x/restaking_assets_manage/keeper/client_chain_and_asset_test.go @@ -13,7 +13,7 @@ func (suite *KeeperTestSuite) TestGenesisClientChainAndAssetInfo() { suite.NoError(err) suite.ctx.Logger().Info("the clientChains is:", "info", clientChains) for _, clientChain := range defaultGensisState.DefaultSupportedClientChains { - info, ok := clientChains[clientChain.LayerZeroChainId] + info, ok := clientChains[clientChain.LayerZeroChainID] suite.True(ok) suite.Equal(info, clientChain) } @@ -26,16 +26,16 @@ func (suite *KeeperTestSuite) TestGenesisClientChainAndAssetInfo() { assets, err := suite.app.StakingAssetsManageKeeper.GetAllStakingAssetsInfo(suite.ctx) suite.NoError(err) for _, asset := range defaultGensisState.DefaultSupportedClientChainTokens { - _, assetId := types.GetStakeIDAndAssetIdFromStr(asset.LayerZeroChainId, "", asset.Address) - suite.ctx.Logger().Info("the asset id is:", "assetId", assetId) - info, ok := assets[assetId] + _, assetID := types.GetStakeIDAndAssetIDFromStr(asset.LayerZeroChainID, "", asset.Address) + suite.ctx.Logger().Info("the asset id is:", "assetID", assetID) + info, ok := assets[assetID] suite.True(ok) suite.Equal(asset, info.AssetBasicInfo) } usdtAsset := defaultGensisState.DefaultSupportedClientChainTokens[0] - _, assetId := types.GetStakeIDAndAssetIdFromStr(usdtAsset.LayerZeroChainId, "", usdtAsset.Address) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetId) + _, assetID := types.GetStakeIDAndAssetIDFromStr(usdtAsset.LayerZeroChainID, "", usdtAsset.Address) + assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) suite.NoError(err) suite.Equal(usdtAsset, assetInfo.AssetBasicInfo) } diff --git a/x/restaking_assets_manage/keeper/client_chain_asset.go b/x/restaking_assets_manage/keeper/client_chain_asset.go index 5bc8fba0f..3af480696 100644 --- a/x/restaking_assets_manage/keeper/client_chain_asset.go +++ b/x/restaking_assets_manage/keeper/client_chain_asset.go @@ -9,12 +9,12 @@ import ( // UpdateStakingAssetTotalAmount updating the total deposited amount of a specified asset in exoCore chain // The function will be called when stakers deposit and withdraw their assets -func (k Keeper) UpdateStakingAssetTotalAmount(ctx sdk.Context, assetId string, changeAmount sdkmath.Int) (err error) { +func (k Keeper) UpdateStakingAssetTotalAmount(ctx sdk.Context, assetID string, changeAmount sdkmath.Int) (err error) { if changeAmount.IsNil() { return nil } store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixReStakingAssetInfo) - key := []byte(assetId) + key := []byte(assetID) ifExist := store.Has(key) if !ifExist { return restakingtype.ErrNoClientChainAssetKey @@ -25,7 +25,6 @@ func (k Keeper) UpdateStakingAssetTotalAmount(ctx sdk.Context, assetId string, c ret := restakingtype.StakingAssetInfo{} k.cdc.MustUnmarshal(value, &ret) - //calculate and set new amount err = UpdateAssetValue(&ret.StakingTotalAmount, &changeAmount) if err != nil { return err @@ -40,28 +39,33 @@ func (k Keeper) UpdateStakingAssetTotalAmount(ctx sdk.Context, assetId string, c // SetStakingAssetInfo todo: Temporarily use clientChainAssetAddr+'_'+layerZeroChainId as the key. // It provides a function to register the client chain assets supported by exoCore.It's called by genesis configuration now,however it will be called by the governance in the future func (k Keeper) SetStakingAssetInfo(ctx sdk.Context, info *restakingtype.StakingAssetInfo) (err error) { + // check if the client chain exist + if !k.IsExistedClientChain(ctx, info.AssetBasicInfo.LayerZeroChainID) { + return restakingtype.ErrNoClientChainKey + } + store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixReStakingAssetInfo) - //key := common.HexToAddress(incentive.Contract) + bz := k.cdc.MustMarshal(info) - _, assetId := restakingtype.GetStakeIDAndAssetIdFromStr(info.AssetBasicInfo.LayerZeroChainId, "", info.AssetBasicInfo.Address) - store.Set([]byte(assetId), bz) + _, assetID := restakingtype.GetStakeIDAndAssetIDFromStr(info.AssetBasicInfo.LayerZeroChainID, "", info.AssetBasicInfo.Address) + store.Set([]byte(assetID), bz) return nil } -func (k Keeper) IsStakingAsset(ctx sdk.Context, assetId string) bool { +func (k Keeper) IsStakingAsset(ctx sdk.Context, assetID string) bool { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixReStakingAssetInfo) - return store.Has([]byte(assetId)) + return store.Has([]byte(assetID)) } -func (k Keeper) GetStakingAssetInfo(ctx sdk.Context, assetId string) (info *restakingtype.StakingAssetInfo, err error) { +func (k Keeper) GetStakingAssetInfo(ctx sdk.Context, assetID string) (info *restakingtype.StakingAssetInfo, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixReStakingAssetInfo) - ifExist := store.Has([]byte(assetId)) + ifExist := store.Has([]byte(assetID)) if !ifExist { return nil, restakingtype.ErrNoClientChainAssetKey } - value := store.Get([]byte(assetId)) + value := store.Get([]byte(assetID)) ret := restakingtype.StakingAssetInfo{} k.cdc.MustUnmarshal(value, &ret) @@ -77,8 +81,8 @@ func (k Keeper) GetAllStakingAssetsInfo(ctx sdk.Context) (allAssets map[string]* for ; iterator.Valid(); iterator.Next() { var assetInfo restakingtype.StakingAssetInfo k.cdc.MustUnmarshal(iterator.Value(), &assetInfo) - _, assetId := restakingtype.GetStakeIDAndAssetIdFromStr(assetInfo.AssetBasicInfo.LayerZeroChainId, "", assetInfo.AssetBasicInfo.Address) - ret[assetId] = &assetInfo + _, assetID := restakingtype.GetStakeIDAndAssetIDFromStr(assetInfo.AssetBasicInfo.LayerZeroChainID, "", assetInfo.AssetBasicInfo.Address) + ret[assetID] = &assetInfo } return ret, nil } diff --git a/x/restaking_assets_manage/keeper/exocore_addr.go b/x/restaking_assets_manage/keeper/exocore_addr.go index abd5b139e..186627ae4 100644 --- a/x/restaking_assets_manage/keeper/exocore_addr.go +++ b/x/restaking_assets_manage/keeper/exocore_addr.go @@ -5,7 +5,7 @@ import ( ) // GetStakerExoCoreAddr outdated, will be deprecated. -func (k Keeper) GetStakerExoCoreAddr(ctx sdk.Context, stakerId string) (string, error) { +func (k Keeper) GetStakerExoCoreAddr(sdk.Context, string) (string, error) { // TODO implement me panic("implement me") } diff --git a/x/restaking_assets_manage/keeper/grpc_query.go b/x/restaking_assets_manage/keeper/grpc_query.go index 248a78ed6..37e61a503 100644 --- a/x/restaking_assets_manage/keeper/grpc_query.go +++ b/x/restaking_assets_manage/keeper/grpc_query.go @@ -9,15 +9,15 @@ import ( "google.golang.org/grpc/status" ) -// QueClientChainInfoByIndex query client chain info by clientChainLzId +// QueClientChainInfoByIndex query client chain info by clientChainLzID func (k Keeper) QueClientChainInfoByIndex(ctx context.Context, info *restakingtype.QueryClientChainInfo) (*restakingtype.ClientChainInfo, error) { c := sdk.UnwrapSDKContext(ctx) return k.GetClientChainInfoByIndex(c, info.ChainIndex) } // QueAllClientChainInfo query all client chain info that have been registered in exoCore -// the key of returned map is clientChainLzId, the value is the client chain info. -func (k Keeper) QueAllClientChainInfo(ctx context.Context, info *restakingtype.QueryAllClientChainInfo) (*restakingtype.QueryAllClientChainInfoResponse, error) { +// the key of returned map is clientChainLzID, the value is the client chain info. +func (k Keeper) QueAllClientChainInfo(ctx context.Context, _ *restakingtype.QueryAllClientChainInfo) (*restakingtype.QueryAllClientChainInfoResponse, error) { c := sdk.UnwrapSDKContext(ctx) allInfo, err := k.GetAllClientChainInfo(c) if err != nil { @@ -26,14 +26,14 @@ func (k Keeper) QueAllClientChainInfo(ctx context.Context, info *restakingtype.Q return &restakingtype.QueryAllClientChainInfoResponse{AllClientChainInfos: allInfo}, nil } -// QueStakingAssetInfo query the specified client chain asset info by inputting assetId +// QueStakingAssetInfo query the specified client chain asset info by inputting assetID func (k Keeper) QueStakingAssetInfo(ctx context.Context, info *restakingtype.QueryStakingAssetInfo) (*restakingtype.StakingAssetInfo, error) { c := sdk.UnwrapSDKContext(ctx) - return k.GetStakingAssetInfo(c, info.AssetId) + return k.GetStakingAssetInfo(c, info.AssetID) } // QueAllStakingAssetsInfo query the info about all client chain assets that have been registered -func (k Keeper) QueAllStakingAssetsInfo(ctx context.Context, info *restakingtype.QueryAllStakingAssetsInfo) (*restakingtype.QueryAllStakingAssetsInfoResponse, error) { +func (k Keeper) QueAllStakingAssetsInfo(ctx context.Context, _ *restakingtype.QueryAllStakingAssetsInfo) (*restakingtype.QueryAllStakingAssetsInfoResponse, error) { c := sdk.UnwrapSDKContext(ctx) allInfo, err := k.GetAllStakingAssetsInfo(c) if err != nil { @@ -42,20 +42,20 @@ func (k Keeper) QueAllStakingAssetsInfo(ctx context.Context, info *restakingtype return &restakingtype.QueryAllStakingAssetsInfoResponse{AllStakingAssetsInfo: allInfo}, nil } -// QueStakerAssetInfos query th state of all assets for a staker specified by stakerId +// QueStakerAssetInfos query th state of all assets for a staker specified by stakerID func (k Keeper) QueStakerAssetInfos(ctx context.Context, info *restakingtype.QueryStakerAssetInfo) (*restakingtype.QueryAssetInfoResponse, error) { c := sdk.UnwrapSDKContext(ctx) - assetInfos, err := k.GetStakerAssetInfos(c, info.StakerId) + assetInfos, err := k.GetStakerAssetInfos(c, info.StakerID) if err != nil { return nil, err } return &restakingtype.QueryAssetInfoResponse{AssetInfos: assetInfos}, nil } -// QueStakerSpecifiedAssetAmount query the specified asset state of a staker, using stakerId and assetId as query parameters +// QueStakerSpecifiedAssetAmount query the specified asset state of a staker, using stakerID and assetID as query parameters func (k Keeper) QueStakerSpecifiedAssetAmount(ctx context.Context, req *restakingtype.QuerySpecifiedAssetAmountReq) (*restakingtype.StakerSingleAssetOrChangeInfo, error) { c := sdk.UnwrapSDKContext(ctx) - return k.GetStakerSpecifiedAssetInfo(c, req.StakerId, req.AssetId) + return k.GetStakerSpecifiedAssetInfo(c, req.StakerID, req.AssetID) } // QueOperatorAssetInfos query th state of all assets for an operator specified by operator address @@ -72,20 +72,20 @@ func (k Keeper) QueOperatorAssetInfos(ctx context.Context, infos *restakingtype. return &restakingtype.QueryOperatorAssetInfosResponse{AssetInfos: assetInfos}, nil } -// QueOperatorSpecifiedAssetAmount query the specified asset state of an operator, using operator address and assetId as query parameters +// QueOperatorSpecifiedAssetAmount query the specified asset state of an operator, using operator address and assetID as query parameters func (k Keeper) QueOperatorSpecifiedAssetAmount(ctx context.Context, req *restakingtype.QueryOperatorSpecifiedAssetAmountReq) (*restakingtype.OperatorSingleAssetOrChangeInfo, error) { c := sdk.UnwrapSDKContext(ctx) addr, err := sdk.AccAddressFromBech32(req.OperatorAddr) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } - return k.GetOperatorSpecifiedAssetInfo(c, addr, req.AssetId) + return k.GetOperatorSpecifiedAssetInfo(c, addr, req.AssetID) } // QueStakerExoCoreAddr outdated,will be deprecated func (k Keeper) QueStakerExoCoreAddr(ctx context.Context, req *restakingtype.QueryStakerExCoreAddr) (*restakingtype.QueryStakerExCoreAddrResponse, error) { c := sdk.UnwrapSDKContext(ctx) - exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.StakerId) + exoCoreAddr, err := k.GetStakerExoCoreAddr(c, req.StakerID) if err != nil { return nil, err } diff --git a/x/restaking_assets_manage/keeper/keeper.go b/x/restaking_assets_manage/keeper/keeper.go index 1918c4b27..4a727500d 100644 --- a/x/restaking_assets_manage/keeper/keeper.go +++ b/x/restaking_assets_manage/keeper/keeper.go @@ -25,13 +25,13 @@ func NewKeeper( } // GetAllOperatorAssetOptedInMiddleWare This function should be implemented in the operator opt-in module -func (k Keeper) GetAllOperatorAssetOptedInMiddleWare(operatorAddr sdk.Address) (optedInInfos map[string][]sdk.Address, err error) { +func (k Keeper) GetAllOperatorAssetOptedInMiddleWare(sdk.Address) (optedInInfos map[string][]sdk.Address, err error) { // TODO implement me panic("implement me") } // SetOperatorAssetOptedInMiddleWare This function should be implemented in the operator opt-in module -func (k Keeper) SetOperatorAssetOptedInMiddleWare(operatorAddr sdk.Address, setInfo map[string]sdk.Address) (middleWares []sdk.Address, err error) { +func (k Keeper) SetOperatorAssetOptedInMiddleWare(sdk.Address, map[string]sdk.Address) (middleWares []sdk.Address, err error) { // TODO implement me panic("implement me") } @@ -43,23 +43,23 @@ type IRestakingAssetsManage interface { GetAllClientChainInfo(ctx sdk.Context) (infos map[uint64]*restakingtype.ClientChainInfo, err error) SetStakingAssetInfo(ctx sdk.Context, info *restakingtype.StakingAssetInfo) (err error) - GetStakingAssetInfo(ctx sdk.Context, assetId string) (info *restakingtype.StakingAssetInfo, err error) + GetStakingAssetInfo(ctx sdk.Context, assetID string) (info *restakingtype.StakingAssetInfo, err error) GetAllStakingAssetsInfo(ctx sdk.Context) (allAssets map[string]*restakingtype.StakingAssetInfo, err error) - GetStakerAssetInfos(ctx sdk.Context, stakerId string) (assetsInfo map[string]*restakingtype.StakerSingleAssetOrChangeInfo, err error) - GetStakerSpecifiedAssetInfo(ctx sdk.Context, stakerId string, assetId string) (info *restakingtype.StakerSingleAssetOrChangeInfo, err error) - UpdateStakerAssetState(ctx sdk.Context, stakerId string, assetId string, changeAmount restakingtype.StakerSingleAssetOrChangeInfo) (err error) + GetStakerAssetInfos(ctx sdk.Context, stakerID string) (assetsInfo map[string]*restakingtype.StakerSingleAssetOrChangeInfo, err error) + GetStakerSpecifiedAssetInfo(ctx sdk.Context, stakerID string, assetID string) (info *restakingtype.StakerSingleAssetOrChangeInfo, err error) + UpdateStakerAssetState(ctx sdk.Context, stakerID string, assetID string, changeAmount restakingtype.StakerSingleAssetOrChangeInfo) (err error) GetOperatorAssetInfos(ctx sdk.Context, operatorAddr sdk.Address) (assetsInfo map[string]*restakingtype.OperatorSingleAssetOrChangeInfo, err error) - GetOperatorSpecifiedAssetInfo(ctx sdk.Context, operatorAddr sdk.Address, assetId string) (info *restakingtype.OperatorSingleAssetOrChangeInfo, err error) - UpdateOperatorAssetState(ctx sdk.Context, operatorAddr sdk.Address, assetId string, changeAmount restakingtype.OperatorSingleAssetOrChangeInfo) (err error) + GetOperatorSpecifiedAssetInfo(ctx sdk.Context, operatorAddr sdk.Address, assetID string) (info *restakingtype.OperatorSingleAssetOrChangeInfo, err error) + UpdateOperatorAssetState(ctx sdk.Context, operatorAddr sdk.Address, assetID string, changeAmount restakingtype.OperatorSingleAssetOrChangeInfo) (err error) // SetStakerExoCoreAddr handle the SetStakerExoCoreAddr txs from msg service SetStakerExoCoreAddr(ctx context.Context, addr *restakingtype.MsgSetExoCoreAddr) (*restakingtype.MsgSetExoCoreAddrResponse, error) - GetStakerExoCoreAddr(ctx sdk.Context, stakerId string) (string, error) + GetStakerExoCoreAddr(ctx sdk.Context, stakerID string) (string, error) // GetOperatorAssetOptedInMiddleWare :the following three interfaces should be implemented in operator opt-in module - GetOperatorAssetOptedInMiddleWare(operatorAddr sdk.Address, assetId string) (middleWares []sdk.Address, err error) + GetOperatorAssetOptedInMiddleWare(operatorAddr sdk.Address, assetID string) (middleWares []sdk.Address, err error) GetAllOperatorAssetOptedInMiddleWare(operatorAddr sdk.Address) (optedInInfos map[string][]sdk.Address, err error) SetOperatorAssetOptedInMiddleWare(operatorAddr sdk.Address, setInfo map[string]sdk.Address) (middleWares []sdk.Address, err error) } diff --git a/x/restaking_assets_manage/keeper/msg_server.go b/x/restaking_assets_manage/keeper/msg_server.go index fc1355729..715134df8 100644 --- a/x/restaking_assets_manage/keeper/msg_server.go +++ b/x/restaking_assets_manage/keeper/msg_server.go @@ -4,6 +4,8 @@ import ( "context" "strings" + "cosmossdk.io/math" + restakingtype "github.com/ExocoreNetwork/exocore/x/restaking_assets_manage/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,19 +18,39 @@ var _ restakingtype.MsgServer = &Keeper{} // don't check if the staker has existed temporarily,so users can set their ExoCoreAddr multiple times. // It may be modified later to allow setting only once func (k Keeper) SetStakerExoCoreAddr(ctx context.Context, addrInfo *restakingtype.MsgSetExoCoreAddr) (*restakingtype.MsgSetExoCoreAddrResponse, error) { - //todo: verify client chain signature according to the client chain signature algorithm type. + // todo: verify client chain signature according to the client chain signature algorithm type. c := sdk.UnwrapSDKContext(ctx) - //save to KeyPrefixReStakerExoCoreAddr store := prefix.NewStore(c.KVStore(k.storeKey), restakingtype.KeyPrefixReStakerExoCoreAddr) - //key := common.HexToAddress(incentive.Contract) + bz := k.cdc.MustMarshal(addrInfo) key := strings.Join([]string{addrInfo.ClientChainAddr, hexutil.EncodeUint64(addrInfo.ClientChainIndex)}, "_") store.Set([]byte(key), bz) - //todo: save to KeyPrefixReStakerExoCoreAddrReverse + // todo: save to KeyPrefixReStakerExoCoreAddrReverse return &restakingtype.MsgSetExoCoreAddrResponse{}, nil } + +func (k Keeper) RegisterClientChain(ctx context.Context, req *restakingtype.RegisterClientChainReq) (*restakingtype.RegisterClientChainResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + err := k.SetClientChainInfo(c, req.Info) + if err != nil { + return nil, err + } + return nil, nil +} + +func (k Keeper) RegisterAsset(ctx context.Context, req *restakingtype.RegisterAssetReq) (*restakingtype.RegisterAssetResponse, error) { + c := sdk.UnwrapSDKContext(ctx) + err := k.SetStakingAssetInfo(c, &restakingtype.StakingAssetInfo{ + AssetBasicInfo: req.Info, + StakingTotalAmount: math.NewInt(0), + }) + if err != nil { + return nil, err + } + return nil, nil +} diff --git a/x/restaking_assets_manage/keeper/operator_asset.go b/x/restaking_assets_manage/keeper/operator_asset.go index 7bd0056e7..1a9e3cde8 100644 --- a/x/restaking_assets_manage/keeper/operator_asset.go +++ b/x/restaking_assets_manage/keeper/operator_asset.go @@ -21,18 +21,18 @@ func (k Keeper) GetOperatorAssetInfos(ctx sdk.Context, operatorAddr sdk.Address) for ; iterator.Valid(); iterator.Next() { var stateInfo restakingtype.OperatorSingleAssetOrChangeInfo k.cdc.MustUnmarshal(iterator.Value(), &stateInfo) - _, assetId, err := restakingtype.ParseStakerAndAssetIdFromKey(iterator.Key()) + _, assetID, err := restakingtype.ParseStakerAndAssetIDFromKey(iterator.Key()) if err != nil { return nil, err } - ret[assetId] = &stateInfo + ret[assetID] = &stateInfo } return ret, nil } -func (k Keeper) GetOperatorSpecifiedAssetInfo(ctx sdk.Context, operatorAddr sdk.Address, assetId string) (info *restakingtype.OperatorSingleAssetOrChangeInfo, err error) { +func (k Keeper) GetOperatorSpecifiedAssetInfo(ctx sdk.Context, operatorAddr sdk.Address, assetID string) (info *restakingtype.OperatorSingleAssetOrChangeInfo, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixOperatorAssetInfos) - key := restakingtype.GetAssetStateKey(operatorAddr.String(), assetId) + key := restakingtype.GetAssetStateKey(operatorAddr.String(), assetID) ifExist := store.Has(key) if !ifExist { return nil, restakingtype.ErrNoOperatorAssetKey @@ -49,10 +49,9 @@ func (k Keeper) GetOperatorSpecifiedAssetInfo(ctx sdk.Context, operatorAddr sdk. // The input `changeAmount` represents the values that you want to add or decrease,using positive or negative values for increasing and decreasing,respectively. The function will calculate and update new state after a successful check. // The function will be called when there is delegation or undelegation related to the operator. In the future,it will also be called when the operator deposit their own assets. -func (k Keeper) UpdateOperatorAssetState(ctx sdk.Context, operatorAddr sdk.Address, assetId string, changeAmount restakingtype.OperatorSingleAssetOrChangeInfo) (err error) { - //get the latest state,use the default initial state if the state hasn't been stored +func (k Keeper) UpdateOperatorAssetState(ctx sdk.Context, operatorAddr sdk.Address, assetID string, changeAmount restakingtype.OperatorSingleAssetOrChangeInfo) (err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixOperatorAssetInfos) - key := restakingtype.GetAssetStateKey(operatorAddr.String(), assetId) + key := restakingtype.GetAssetStateKey(operatorAddr.String(), assetID) assetState := restakingtype.OperatorSingleAssetOrChangeInfo{ TotalAmountOrWantChangeValue: math.NewInt(0), OperatorOwnAmountOrWantChangeValue: math.NewInt(0), @@ -77,14 +76,12 @@ func (k Keeper) UpdateOperatorAssetState(ctx sdk.Context, operatorAddr sdk.Addre return errorsmod.Wrap(err, "UpdateOperatorAssetState WaitUndelegationAmountOrWantChangeValue error") } - //store the updated state bz := k.cdc.MustMarshal(&assetState) store.Set(key, bz) return nil } // GetOperatorAssetOptedInMiddleWare This function should be implemented in the operator opt-in module -func (k Keeper) GetOperatorAssetOptedInMiddleWare(operatorAddr sdk.Address, assetId string) (middleWares []sdk.Address, err error) { - //TODO implement me +func (k Keeper) GetOperatorAssetOptedInMiddleWare(sdk.Address, string) (middleWares []sdk.Address, err error) { panic("implement me") } diff --git a/x/restaking_assets_manage/keeper/staker_asset.go b/x/restaking_assets_manage/keeper/staker_asset.go index dcff0355a..7ddecd348 100644 --- a/x/restaking_assets_manage/keeper/staker_asset.go +++ b/x/restaking_assets_manage/keeper/staker_asset.go @@ -30,27 +30,27 @@ func UpdateAssetValue(valueToUpdate *math.Int, changeValue *math.Int) error { return nil } -func (k Keeper) GetStakerAssetInfos(ctx sdk.Context, stakerId string) (assetsInfo map[string]*restakingtype.StakerSingleAssetOrChangeInfo, err error) { +func (k Keeper) GetStakerAssetInfos(ctx sdk.Context, stakerID string) (assetsInfo map[string]*restakingtype.StakerSingleAssetOrChangeInfo, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixReStakerAssetInfos) - iterator := sdk.KVStorePrefixIterator(store, []byte(stakerId)) + iterator := sdk.KVStorePrefixIterator(store, []byte(stakerID)) defer iterator.Close() ret := make(map[string]*restakingtype.StakerSingleAssetOrChangeInfo, 0) for ; iterator.Valid(); iterator.Next() { var stateInfo restakingtype.StakerSingleAssetOrChangeInfo k.cdc.MustUnmarshal(iterator.Value(), &stateInfo) - _, assetId, err := restakingtype.ParseStakerAndAssetIdFromKey(iterator.Key()) + _, assetID, err := restakingtype.ParseStakerAndAssetIDFromKey(iterator.Key()) if err != nil { return nil, err } - ret[assetId] = &stateInfo + ret[assetID] = &stateInfo } return ret, nil } -func (k Keeper) GetStakerSpecifiedAssetInfo(ctx sdk.Context, stakerId string, assetId string) (info *restakingtype.StakerSingleAssetOrChangeInfo, err error) { +func (k Keeper) GetStakerSpecifiedAssetInfo(ctx sdk.Context, stakerID string, assetID string) (info *restakingtype.StakerSingleAssetOrChangeInfo, err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixReStakerAssetInfos) - key := restakingtype.GetAssetStateKey(stakerId, assetId) + key := restakingtype.GetAssetStateKey(stakerID, assetID) ifExist := store.Has(key) if !ifExist { return nil, errorsmod.Wrap(restakingtype.ErrNoStakerAssetKey, fmt.Sprintf("the key is:%s", key)) @@ -66,10 +66,9 @@ func (k Keeper) GetStakerSpecifiedAssetInfo(ctx sdk.Context, stakerId string, as // UpdateStakerAssetState It's used to update the staker asset state // The input `changeAmount` represents the values that you want to add or decrease,using positive or negative values for increasing and decreasing,respectively. The function will calculate and update new state after a successful check. // The function will be called when there is deposit or withdraw related to the specified staker. -func (k Keeper) UpdateStakerAssetState(ctx sdk.Context, stakerId string, assetId string, changeAmount restakingtype.StakerSingleAssetOrChangeInfo) (err error) { - //get the latest state,use the default initial state if the state hasn't been stored +func (k Keeper) UpdateStakerAssetState(ctx sdk.Context, stakerID string, assetID string, changeAmount restakingtype.StakerSingleAssetOrChangeInfo) (err error) { store := prefix.NewStore(ctx.KVStore(k.storeKey), restakingtype.KeyPrefixReStakerAssetInfos) - key := restakingtype.GetAssetStateKey(stakerId, assetId) + key := restakingtype.GetAssetStateKey(stakerID, assetID) assetState := restakingtype.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: math.NewInt(0), CanWithdrawAmountOrWantChangeValue: math.NewInt(0), diff --git a/x/restaking_assets_manage/keeper/staker_asset_test.go b/x/restaking_assets_manage/keeper/staker_asset_test.go index e38f62cdf..9d8232c32 100644 --- a/x/restaking_assets_manage/keeper/staker_asset_test.go +++ b/x/restaking_assets_manage/keeper/staker_asset_test.go @@ -9,7 +9,7 @@ import ( ) func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { - stakerId := fmt.Sprintf("%s_%s", suite.address, "0") + stakerID := fmt.Sprintf("%s_%s", suite.address, "0") ethUniAssetId := fmt.Sprintf("%s_%s", "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "101") ethUniInitialChangeValue := restakingtype.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: math.NewInt(1000), @@ -17,28 +17,28 @@ func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { } // test the initial storage of statker assets state - err := suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUniAssetId, ethUniInitialChangeValue) + err := suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) suite.Require().NoError(err) // test that the retrieved value is correct - getInfo, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, ethUniAssetId) + getInfo, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) suite.Require().NoError(err) suite.Require().True(ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue.Equal(getInfo.TotalDepositAmountOrWantChangeValue)) suite.Require().True(ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue.Equal(getInfo.CanWithdrawAmountOrWantChangeValue)) - //test ErrInputUpdateStateIsZero + // test ErrInputUpdateStateIsZero /* ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(0) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(0) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUniAssetId, ethUniInitialChangeValue) + err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) suite.Require().Error(err, types2.ErrInputUpdateStateIsZero)*/ // test valid increase of staker asset state ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(500) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(500) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUniAssetId, ethUniInitialChangeValue) + err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) suite.Require().NoError(err) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, ethUniAssetId) + getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1500))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1500))) @@ -46,9 +46,9 @@ func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { // test valid decrease of staker asset state ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(-500) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(-500) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUniAssetId, ethUniInitialChangeValue) + err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) suite.Require().NoError(err) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, ethUniAssetId) + getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1000))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1000))) @@ -56,18 +56,18 @@ func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { // test the decreased amount is bigger than original state ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(-2000) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(-500) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUniAssetId, ethUniInitialChangeValue) + err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) suite.Require().Error(err, restakingtype.ErrSubAmountIsMoreThanOrigin) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, ethUniAssetId) + getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1000))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1000))) ethUniInitialChangeValue.TotalDepositAmountOrWantChangeValue = math.NewInt(-500) ethUniInitialChangeValue.CanWithdrawAmountOrWantChangeValue = math.NewInt(-2000) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUniAssetId, ethUniInitialChangeValue) + err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) suite.Require().Error(err, restakingtype.ErrSubAmountIsMoreThanOrigin) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, ethUniAssetId) + getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUniAssetId) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(1000))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(1000))) @@ -78,16 +78,16 @@ func (suite *KeeperTestSuite) TestUpdateStakerAssetsState() { TotalDepositAmountOrWantChangeValue: math.NewInt(2000), CanWithdrawAmountOrWantChangeValue: math.NewInt(2000), } - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUsdtAssetId, ethUsdtInitialChangeValue) + err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUsdtAssetId, ethUsdtInitialChangeValue) suite.Require().NoError(err) - getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, ethUsdtAssetId) + getInfo, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, ethUsdtAssetId) suite.Require().NoError(err) suite.Require().True(getInfo.TotalDepositAmountOrWantChangeValue.Equal(math.NewInt(2000))) suite.Require().True(getInfo.CanWithdrawAmountOrWantChangeValue.Equal(math.NewInt(2000))) } func (suite *KeeperTestSuite) TestGetStakerAssetInfos() { - stakerId := fmt.Sprintf("%s_%s", suite.address, "0") + stakerID := fmt.Sprintf("%s_%s", suite.address, "0") ethUniAssetId := fmt.Sprintf("%s_%s", "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", "101") ethUsdtAssetId := fmt.Sprintf("%s_%s", "0xdac17f958d2ee523a2206206994597c13d831ec7", "101") ethUniInitialChangeValue := restakingtype.StakerSingleAssetOrChangeInfo{ @@ -98,13 +98,13 @@ func (suite *KeeperTestSuite) TestGetStakerAssetInfos() { TotalDepositAmountOrWantChangeValue: math.NewInt(2000), CanWithdrawAmountOrWantChangeValue: math.NewInt(2000), } - err := suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUniAssetId, ethUniInitialChangeValue) + err := suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUniAssetId, ethUniInitialChangeValue) suite.Require().NoError(err) - err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerId, ethUsdtAssetId, ethUsdtInitialChangeValue) + err = suite.app.StakingAssetsManageKeeper.UpdateStakerAssetState(suite.ctx, stakerID, ethUsdtAssetId, ethUsdtInitialChangeValue) suite.Require().NoError(err) // test get all assets state of staker - assetsInfo, err := suite.app.StakingAssetsManageKeeper.GetStakerAssetInfos(suite.ctx, stakerId) + assetsInfo, err := suite.app.StakingAssetsManageKeeper.GetStakerAssetInfos(suite.ctx, stakerID) suite.Require().NoError(err) uniState, isExist := assetsInfo[ethUniAssetId] suite.Require().True(isExist) diff --git a/x/restaking_assets_manage/module.go b/x/restaking_assets_manage/module.go index 6e5d3b4fd..c1c8988c4 100644 --- a/x/restaking_assets_manage/module.go +++ b/x/restaking_assets_manage/module.go @@ -1,4 +1,4 @@ -package restaking_assets_manage +package restaking_assets_manage // nolint: revive,stylecheck // Package naming to be fixed later. import ( "context" @@ -19,8 +19,6 @@ import ( "github.com/spf13/cobra" ) -const consensusVersion = 0 - // type check to ensure the interface is properly implemented var ( _ module.AppModule = AppModule{} @@ -45,7 +43,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the auth module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var data restakingtype.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", restakingtype.ModuleName, err) @@ -65,7 +63,7 @@ func (b AppModuleBasic) RegisterGRPCGatewayRoutes(c client.Context, serveMux *ru } func (b AppModuleBasic) GetTxCmd() *cobra.Command { - return nil + return cli.NewTxCmd() } func (b AppModuleBasic) GetQueryCmd() *cobra.Command { @@ -77,7 +75,7 @@ type AppModule struct { keeper keeper.Keeper } -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { +func NewAppModule(_ codec.Codec, keeper keeper.Keeper) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{}, keeper: keeper, diff --git a/x/restaking_assets_manage/types/codec.go b/x/restaking_assets_manage/types/codec.go index 05421d364..faf229824 100644 --- a/x/restaking_assets_manage/types/codec.go +++ b/x/restaking_assets_manage/types/codec.go @@ -23,7 +23,9 @@ var ( const ( // Amino names - setExoCoreAddrName = "exocore/MsgSetExoCoreAddr" + setExoCoreAddrName = "exocore/MsgSetExoCoreAddr" + registerClientChain = "exocore/RegisterClientChain" + registerAsset = "exocore/RegisterAsset" ) // NOTE: This is required for the GetSignBytes function @@ -42,9 +44,11 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -// RegisterLegacyAminoCodec registers the necessary x/revenue interfaces and +// RegisterLegacyAminoCodec registers the necessary x/restaking_assets_manage interfaces and // concrete types on the provided LegacyAmino codec. These types are used for // Amino JSON serialization and EIP-712 compatibility. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgSetExoCoreAddr{}, setExoCoreAddrName, nil) + cdc.RegisterConcrete(&RegisterClientChainReq{}, registerClientChain, nil) + cdc.RegisterConcrete(&RegisterAssetReq{}, registerAsset, nil) } diff --git a/x/restaking_assets_manage/types/errors.go b/x/restaking_assets_manage/types/errors.go index b37301f4a..683cf2c8b 100644 --- a/x/restaking_assets_manage/types/errors.go +++ b/x/restaking_assets_manage/types/errors.go @@ -7,13 +7,13 @@ import ( // errors var ( ErrNoClientChainKey = errorsmod.Register(ModuleName, 0, "there is no stored key for the input chain index") - ErrNoClientChainAssetKey = errorsmod.Register(ModuleName, 1, "there is no stored key for the input assetId") + ErrNoClientChainAssetKey = errorsmod.Register(ModuleName, 1, "there is no stored key for the input assetID") - ErrNoStakerAssetKey = errorsmod.Register(ModuleName, 2, "there is no stored key for the input staker and assetId") + ErrNoStakerAssetKey = errorsmod.Register(ModuleName, 2, "there is no stored key for the input staker and assetID") ErrSubAmountIsMoreThanOrigin = errorsmod.Register(ModuleName, 3, "the amount that want to decrease is more than the original state amount") - ErrNoOperatorAssetKey = errorsmod.Register(ModuleName, 4, "there is no stored key for the input operator address and assetId") + ErrNoOperatorAssetKey = errorsmod.Register(ModuleName, 4, "there is no stored key for the input operator address and assetID") ErrParseAssetsStateKey = errorsmod.Register(ModuleName, 5, "assets state key can't be parsed") diff --git a/x/restaking_assets_manage/types/general.go b/x/restaking_assets_manage/types/general.go index 5f364df3a..75f92a609 100644 --- a/x/restaking_assets_manage/types/general.go +++ b/x/restaking_assets_manage/types/general.go @@ -12,7 +12,7 @@ const ( GeneralAssetsAddrLength = 32 GeneralClientChainAddrLength = 32 - ClientChainLzIdIndexInTopics = 0 + ClientChainLzIDIndexInTopics = 0 LzNonceIndexInTopics = 2 ExoCoreOperatorAddrLength = 44 @@ -35,28 +35,28 @@ const ( Slash ) -// GetStakeIDAndAssetId stakerId = stakerAddress+'_'+clientChainLzId,assetId = assetAddress+'_'+clientChainLzId -func GetStakeIDAndAssetId(clientChainLzId uint64, stakerAddress []byte, assetsAddress []byte) (stakeId string, assetId string) { - clientChainLzIdStr := hexutil.EncodeUint64(clientChainLzId) +// GetStakeIDAndAssetID stakerID = stakerAddress+'_'+clientChainLzID,assetID = assetAddress+'_'+clientChainLzID +func GetStakeIDAndAssetID(clientChainLzID uint64, stakerAddress []byte, assetsAddress []byte) (stakeID string, assetID string) { + clientChainLzIDStr := hexutil.EncodeUint64(clientChainLzID) if stakerAddress != nil { - stakeId = strings.Join([]string{hexutil.Encode(stakerAddress), clientChainLzIdStr}, "_") + stakeID = strings.Join([]string{hexutil.Encode(stakerAddress), clientChainLzIDStr}, "_") } if assetsAddress != nil { - assetId = strings.Join([]string{hexutil.Encode(assetsAddress), clientChainLzIdStr}, "_") + assetID = strings.Join([]string{hexutil.Encode(assetsAddress), clientChainLzIDStr}, "_") } return } -// GetStakeIDAndAssetIdFromStr stakerId = stakerAddress+'_'+clientChainLzId,assetId = assetAddress+'_'+clientChainLzId -func GetStakeIDAndAssetIdFromStr(clientChainLzId uint64, stakerAddress string, assetsAddress string) (stakeId string, assetId string) { - clientChainLzIdStr := hexutil.EncodeUint64(clientChainLzId) +// GetStakeIDAndAssetIDFromStr stakerID = stakerAddress+'_'+clientChainLzID,assetID = assetAddress+'_'+clientChainLzID +func GetStakeIDAndAssetIDFromStr(clientChainLzID uint64, stakerAddress string, assetsAddress string) (stakeID string, assetID string) { + clientChainLzIDStr := hexutil.EncodeUint64(clientChainLzID) if stakerAddress != "" { - stakeId = strings.Join([]string{strings.ToLower(stakerAddress), clientChainLzIdStr}, "_") + stakeID = strings.Join([]string{strings.ToLower(stakerAddress), clientChainLzIDStr}, "_") } if assetsAddress != "" { - assetId = strings.Join([]string{strings.ToLower(assetsAddress), clientChainLzIdStr}, "_") + assetID = strings.Join([]string{strings.ToLower(assetsAddress), clientChainLzIDStr}, "_") } return } diff --git a/x/restaking_assets_manage/types/genesis.pb.go b/x/restaking_assets_manage/types/genesis.pb.go index 5a1be6790..1852a552c 100644 --- a/x/restaking_assets_manage/types/genesis.pb.go +++ b/x/restaking_assets_manage/types/genesis.pb.go @@ -25,8 +25,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the restaking_assets_manage module's genesis state. type GenesisState struct { - DefaultSupportedClientChains []*ClientChainInfo `protobuf:"bytes,1,rep,name=DefaultSupportedClientChains,proto3" json:"DefaultSupportedClientChains,omitempty"` - DefaultSupportedClientChainTokens []*ClientChainTokenInfo `protobuf:"bytes,2,rep,name=DefaultSupportedClientChainTokens,proto3" json:"DefaultSupportedClientChainTokens,omitempty"` + DefaultSupportedClientChains []*ClientChainInfo `protobuf:"bytes,1,rep,name=DefaultSupportedClientChains,proto3" json:"DefaultSupportedClientChains,omitempty"` + DefaultSupportedClientChainTokens []*AssetInfo `protobuf:"bytes,2,rep,name=DefaultSupportedClientChainTokens,proto3" json:"DefaultSupportedClientChainTokens,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -69,7 +69,7 @@ func (m *GenesisState) GetDefaultSupportedClientChains() []*ClientChainInfo { return nil } -func (m *GenesisState) GetDefaultSupportedClientChainTokens() []*ClientChainTokenInfo { +func (m *GenesisState) GetDefaultSupportedClientChainTokens() []*AssetInfo { if m != nil { return m.DefaultSupportedClientChainTokens } @@ -85,24 +85,24 @@ func init() { } var fileDescriptor_554af23024865cd5 = []byte{ - // 257 bytes of a gzipped FileDescriptorProto + // 268 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x48, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x2e, 0x49, 0xcc, 0xce, 0xcc, 0x4b, 0x8f, 0x4f, 0x2c, 0x2e, 0x4e, 0x2d, 0x29, 0x8e, 0xcf, 0x4d, 0xcc, 0x4b, 0x4c, 0x4f, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x52, 0x82, 0xea, 0xd0, 0xc3, 0xa1, 0x43, 0xaf, 0xcc, 0x50, 0x4a, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xac, 0x5c, 0x1f, - 0xc4, 0x82, 0xe8, 0x94, 0xd2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x62, 0xa5, 0x16, 0x26, 0x2e, + 0x1e, 0x77, 0x88, 0xc5, 0xc1, 0x25, 0x89, 0x25, 0xa9, 0x42, 0xe5, 0x5c, 0x32, 0x2e, 0xa9, 0x69, + 0x89, 0xa5, 0x39, 0x25, 0xc1, 0xa5, 0x05, 0x05, 0xf9, 0x45, 0x25, 0xa9, 0x29, 0xce, 0x39, 0x99, + 0xa9, 0x79, 0x25, 0xce, 0x19, 0x89, 0x99, 0x79, 0xc5, 0x12, 0x8c, 0x0a, 0xcc, 0x1a, 0xdc, 0x46, + 0xc6, 0x7a, 0x84, 0x9d, 0xa7, 0x87, 0xa4, 0xcf, 0x33, 0x2f, 0x2d, 0x3f, 0x08, 0xaf, 0xc1, 0x42, + 0xd5, 0x5c, 0x8a, 0x78, 0xe4, 0x43, 0xf2, 0xb3, 0x53, 0xf3, 0x8a, 0x25, 0x98, 0xc0, 0xb6, 0xeb, + 0x12, 0x63, 0xbb, 0x23, 0x48, 0x00, 0x6c, 0x2f, 0x61, 0x73, 0x9d, 0xa2, 0x4f, 0x3c, 0x92, 0x63, + 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, + 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x31, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, + 0x3f, 0x57, 0xdf, 0x15, 0x62, 0xab, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0x2c, 0x9c, + 0x2b, 0x70, 0x86, 0x74, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0xa8, 0x8d, 0x01, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x9b, 0xe4, 0x07, 0xcf, 0x05, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -286,7 +286,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DefaultSupportedClientChainTokens = append(m.DefaultSupportedClientChainTokens, &ClientChainTokenInfo{}) + m.DefaultSupportedClientChainTokens = append(m.DefaultSupportedClientChainTokens, &AssetInfo{}) if err := m.DefaultSupportedClientChainTokens[len(m.DefaultSupportedClientChainTokens)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/restaking_assets_manage/types/keys.go b/x/restaking_assets_manage/types/keys.go index 776f1f283..ca71d3d45 100644 --- a/x/restaking_assets_manage/types/keys.go +++ b/x/restaking_assets_manage/types/keys.go @@ -40,9 +40,9 @@ const ( prefixRestakerExocoreAddrReverse - prefixReStakingAssetList - prefixReStakerAssetList - prefixOperatorAssetList + // prefixReStakingAssetList + // prefixReStakerAssetList + // prefixOperatorAssetList ) // KVStore key prefixes @@ -106,12 +106,12 @@ var ( KeyPrefixReStakerExoCoreAddrReverse = []byte{prefixRestakerExocoreAddrReverse} ) -// GetAssetStateKey assetStateKey = stakerId+'/'+assetId -func GetAssetStateKey(stakerId, assetId string) []byte { - return []byte(strings.Join([]string{stakerId, assetId}, "/")) +// GetAssetStateKey assetStateKey = stakerID+'/'+assetID +func GetAssetStateKey(stakerID, assetID string) []byte { + return []byte(strings.Join([]string{stakerID, assetID}, "/")) } -func ParseStakerAndAssetIdFromKey(key []byte) (stakerId string, assetId string, err error) { +func ParseStakerAndAssetIDFromKey(key []byte) (stakerID string, assetID string, err error) { stringList := strings.Split(string(key), "/") if len(stringList) != 2 { return "", "", errorsmod.Wrap(ErrParseAssetsStateKey, fmt.Sprintf("the stringList is:%v", stringList)) diff --git a/x/restaking_assets_manage/types/msg.go b/x/restaking_assets_manage/types/msg.go index 5e6ba7191..8905d2b89 100644 --- a/x/restaking_assets_manage/types/msg.go +++ b/x/restaking_assets_manage/types/msg.go @@ -5,7 +5,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -var _ sdk.Msg = &MsgSetExoCoreAddr{} +var ( + _ sdk.Msg = &MsgSetExoCoreAddr{} + _ sdk.Msg = &RegisterClientChainReq{} + _ sdk.Msg = &RegisterAssetReq{} +) // GetSigners returns the expected signers for a MsgUpdateParams message. func (m *MsgSetExoCoreAddr) GetSigners() []sdk.AccAddress { @@ -28,3 +32,41 @@ func (m *MsgSetExoCoreAddr) ValidateBasic() error { func (m *MsgSetExoCoreAddr) GetSignBytes() []byte { return nil } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *RegisterClientChainReq) GetSigners() []sdk.AccAddress { + addr := sdk.MustAccAddressFromBech32(m.FromAddress) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check of the provided data +func (m *RegisterClientChainReq) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.FromAddress); err != nil { + return errorsmod.Wrap(err, "invalid from address") + } + return nil +} + +// GetSignBytes implements the LegacyMsg interface. +func (m *RegisterClientChainReq) GetSignBytes() []byte { + return nil +} + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *RegisterAssetReq) GetSigners() []sdk.AccAddress { + addr := sdk.MustAccAddressFromBech32(m.FromAddress) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check of the provided data +func (m *RegisterAssetReq) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.FromAddress); err != nil { + return errorsmod.Wrap(err, "invalid from address") + } + return nil +} + +// GetSignBytes implements the LegacyMsg interface. +func (m *RegisterAssetReq) GetSignBytes() []byte { + return nil +} diff --git a/x/restaking_assets_manage/types/query.pb.go b/x/restaking_assets_manage/types/query.pb.go index bad8dd2db..b95e30b2a 100644 --- a/x/restaking_assets_manage/types/query.pb.go +++ b/x/restaking_assets_manage/types/query.pb.go @@ -156,7 +156,7 @@ func (m *QueryAllClientChainInfoResponse) GetAllClientChainInfos() map[uint64]*C } type QueryStakingAssetInfo struct { - AssetId string `protobuf:"bytes,1,opt,name=assetId,proto3" json:"assetId,omitempty"` + AssetID string `protobuf:"bytes,1,opt,name=assetID,proto3" json:"assetID,omitempty"` } func (m *QueryStakingAssetInfo) Reset() { *m = QueryStakingAssetInfo{} } @@ -192,9 +192,9 @@ func (m *QueryStakingAssetInfo) XXX_DiscardUnknown() { var xxx_messageInfo_QueryStakingAssetInfo proto.InternalMessageInfo -func (m *QueryStakingAssetInfo) GetAssetId() string { +func (m *QueryStakingAssetInfo) GetAssetID() string { if m != nil { - return m.AssetId + return m.AssetID } return "" } @@ -280,7 +280,7 @@ func (m *QueryAllStakingAssetsInfoResponse) GetAllStakingAssetsInfo() map[string } type QueryStakerAssetInfo struct { - StakerId string `protobuf:"bytes,1,opt,name=stakerId,proto3" json:"stakerId,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` } func (m *QueryStakerAssetInfo) Reset() { *m = QueryStakerAssetInfo{} } @@ -316,9 +316,9 @@ func (m *QueryStakerAssetInfo) XXX_DiscardUnknown() { var xxx_messageInfo_QueryStakerAssetInfo proto.InternalMessageInfo -func (m *QueryStakerAssetInfo) GetStakerId() string { +func (m *QueryStakerAssetInfo) GetStakerID() string { if m != nil { - return m.StakerId + return m.StakerID } return "" } @@ -368,8 +368,8 @@ func (m *QueryAssetInfoResponse) GetAssetInfos() map[string]*StakerSingleAssetOr } type QuerySpecifiedAssetAmountReq struct { - StakerId string `protobuf:"bytes,1,opt,name=stakerId,proto3" json:"stakerId,omitempty"` - AssetId string `protobuf:"bytes,2,opt,name=assetId,proto3" json:"assetId,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=stakerID,proto3" json:"stakerID,omitempty"` + AssetID string `protobuf:"bytes,2,opt,name=assetID,proto3" json:"assetID,omitempty"` } func (m *QuerySpecifiedAssetAmountReq) Reset() { *m = QuerySpecifiedAssetAmountReq{} } @@ -405,16 +405,16 @@ func (m *QuerySpecifiedAssetAmountReq) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySpecifiedAssetAmountReq proto.InternalMessageInfo -func (m *QuerySpecifiedAssetAmountReq) GetStakerId() string { +func (m *QuerySpecifiedAssetAmountReq) GetStakerID() string { if m != nil { - return m.StakerId + return m.StakerID } return "" } -func (m *QuerySpecifiedAssetAmountReq) GetAssetId() string { +func (m *QuerySpecifiedAssetAmountReq) GetAssetID() string { if m != nil { - return m.AssetId + return m.AssetID } return "" } @@ -509,7 +509,7 @@ func (m *QueryOperatorAssetInfosResponse) GetAssetInfos() map[string]*OperatorSi type QueryOperatorSpecifiedAssetAmountReq struct { OperatorAddr string `protobuf:"bytes,1,opt,name=operatorAddr,proto3" json:"operatorAddr,omitempty"` - AssetId string `protobuf:"bytes,2,opt,name=assetId,proto3" json:"assetId,omitempty"` + AssetID string `protobuf:"bytes,2,opt,name=assetID,proto3" json:"assetID,omitempty"` } func (m *QueryOperatorSpecifiedAssetAmountReq) Reset() { *m = QueryOperatorSpecifiedAssetAmountReq{} } @@ -552,15 +552,15 @@ func (m *QueryOperatorSpecifiedAssetAmountReq) GetOperatorAddr() string { return "" } -func (m *QueryOperatorSpecifiedAssetAmountReq) GetAssetId() string { +func (m *QueryOperatorSpecifiedAssetAmountReq) GetAssetID() string { if m != nil { - return m.AssetId + return m.AssetID } return "" } type QueryStakerExCoreAddr struct { - StakerId string `protobuf:"bytes,1,opt,name=StakerId,proto3" json:"StakerId,omitempty"` + StakerID string `protobuf:"bytes,1,opt,name=StakerID,proto3" json:"StakerID,omitempty"` } func (m *QueryStakerExCoreAddr) Reset() { *m = QueryStakerExCoreAddr{} } @@ -596,9 +596,9 @@ func (m *QueryStakerExCoreAddr) XXX_DiscardUnknown() { var xxx_messageInfo_QueryStakerExCoreAddr proto.InternalMessageInfo -func (m *QueryStakerExCoreAddr) GetStakerId() string { +func (m *QueryStakerExCoreAddr) GetStakerID() string { if m != nil { - return m.StakerId + return m.StakerID } return "" } @@ -673,68 +673,68 @@ func init() { } var fileDescriptor_6d13900d4f268106 = []byte{ - // 961 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x4f, 0x3b, 0x45, - 0x18, 0x67, 0xfa, 0xf7, 0xaf, 0x30, 0x98, 0x48, 0x86, 0xaa, 0xed, 0x82, 0x15, 0x37, 0x1e, 0x88, - 0xc6, 0xdd, 0x50, 0x8c, 0xb6, 0x54, 0xa2, 0x65, 0xad, 0x01, 0x62, 0x44, 0x5a, 0x13, 0x82, 0x31, - 0x69, 0x96, 0x76, 0x58, 0x56, 0xda, 0x9d, 0xb2, 0xb3, 0x25, 0x6d, 0x08, 0x86, 0x70, 0xd1, 0x93, - 0x31, 0xe1, 0xa6, 0x1f, 0x42, 0x0f, 0x1e, 0xfc, 0x08, 0x1e, 0x3c, 0xa0, 0x26, 0xc6, 0xa3, 0x82, - 0xd1, 0x78, 0xf7, 0x03, 0x98, 0xce, 0xbe, 0x76, 0xbb, 0x5b, 0xa6, 0x2f, 0xb7, 0xce, 0xcc, 0xf3, - 0xf6, 0x7b, 0x7e, 0xb3, 0xcf, 0x6f, 0x0a, 0x25, 0xdc, 0x21, 0x35, 0x62, 0x62, 0xd9, 0xc4, 0xd4, - 0x52, 0x4f, 0x75, 0x43, 0xab, 0xaa, 0x94, 0x62, 0x8b, 0x56, 0x9b, 0xaa, 0xa1, 0x6a, 0x58, 0x3e, - 0x5f, 0x93, 0xcf, 0xda, 0xd8, 0xec, 0x4a, 0x2d, 0x93, 0x58, 0x04, 0x89, 0x8e, 0xbd, 0x14, 0x63, - 0x2f, 0x9d, 0xaf, 0x09, 0x49, 0x8d, 0x68, 0x84, 0x99, 0xcb, 0xbd, 0x5f, 0xb6, 0xa7, 0xb0, 0xac, - 0x11, 0xa2, 0x35, 0xb0, 0xac, 0xb6, 0x74, 0x59, 0x35, 0x0c, 0x62, 0xa9, 0x96, 0x4e, 0x0c, 0xea, - 0x9c, 0x2e, 0xd5, 0x08, 0x6d, 0x12, 0x6a, 0xe7, 0x0a, 0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 0x99, 0xdb, 0xfb, 0xcc, 0xcc, 0xef, 0xf7, 0x99, 0x99, 0x8f, 0xb3, 0x9a, 0x6e, 0x9d, 0xb4, - 0x8f, 0xa4, 0x1a, 0x69, 0x7a, 0x89, 0x3a, 0xb1, 0xa9, 0xac, 0x6e, 0x0b, 0xd3, 0xa3, 0x27, 0xd9, - 0x9f, 0xf3, 0xf5, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xc0, 0x6c, 0x77, 0x7b, 0x8b, 0x10, 0x00, - 0x00, + // 975 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0xee, 0x64, 0x59, 0xd8, 0x9d, 0x45, 0x62, 0x35, 0x1b, 0x20, 0xf1, 0x2e, 0xa1, 0x58, 0x1c, + 0x2a, 0x10, 0xb6, 0x9a, 0x22, 0x48, 0x36, 0x54, 0x90, 0x7a, 0x83, 0xb6, 0x3d, 0xec, 0xd2, 0x04, + 0xa9, 0x2a, 0x20, 0x45, 0x6e, 0x32, 0x75, 0x4d, 0x13, 0x4f, 0xea, 0x71, 0x4a, 0xa2, 0xaa, 0xa8, + 0xea, 0x05, 0x4e, 0x08, 0xa9, 0x37, 0xf8, 0x11, 0x70, 0xe0, 0xc0, 0x4f, 0xe0, 0xc0, 0xa1, 0x80, + 0x84, 0x38, 0x42, 0x8b, 0x40, 0xdc, 0xf9, 0x01, 0xab, 0xcc, 0xf8, 0x2b, 0x8e, 0x9d, 0x4e, 0x3e, + 0x6e, 0x99, 0x99, 0xf7, 0xeb, 0x79, 0x9f, 0xf1, 0xfb, 0x4c, 0xa0, 0x82, 0x7b, 0xa4, 0x41, 0x6c, + 0xac, 0xda, 0x98, 0x3a, 0xfa, 0xbe, 0x69, 0x19, 0x75, 0x9d, 0x52, 0xec, 0xd0, 0x7a, 0x5b, 0xb7, + 0x74, 0x03, 0x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xff, 0x7e, 0xff, 0x1a, 0x38, 0xfd, 0xed, 0xef, 0xb3, 0xd4, + 0xbb, 0x68, 0x55, 0x15, 0x10, 0xff, 0xe4, 0xd2, 0xff, 0x02, 0xac, 0xe7, 0xa3, 0x4a, 0x88, 0x4a, + 0x33, 0x48, 0xb2, 0xa4, 0xcd, 0x41, 0xcf, 0xe5, 0xf7, 0x03, 0x9c, 0x25, 0x54, 0x14, 0xc4, 0x19, + 0x83, 0xe4, 0x67, 0x00, 0xef, 0x6c, 0x76, 0xf1, 0x88, 0xd6, 0x16, 0x85, 0x8b, 0x8c, 0xba, 0x4a, + 0x53, 0xa9, 0x8e, 0xfc, 0x20, 0x00, 0x54, 0x44, 0x6f, 0x0b, 0x02, 0x1a, 0x29, 0xfb, 0x3f, 0xc0, + 0xa6, 0x63, 0x9c, 0x66, 0xa2, 0xd5, 0x99, 0x24, 0x5c, 0xaa, 0xcc, 0xe5, 0x05, 0x20, 0x3f, 0x0c, + 0x70, 0xae, 0xa2, 0x92, 0x38, 0x71, 0xa3, 0x78, 0x7e, 0x09, 0xa8, 0xc3, 0x61, 0x15, 0x28, 0x4c, + 0x44, 0x5d, 0xc8, 0x55, 0xba, 0x3f, 0xbd, 0x16, 0x4f, 0xcf, 0xdf, 0x50, 0xed, 0xff, 0x03, 0x36, + 0xb1, 0x5c, 0x89, 0x8d, 0x19, 0xb1, 0xe8, 0x3d, 0x71, 0x74, 0xf1, 0x13, 0x5a, 0x9a, 0x5d, 0xe4, + 0xe5, 0x47, 0x01, 0x58, 0x0d, 0x95, 0x27, 0x02, 0x1b, 0x0b, 0xca, 0x9d, 0x34, 0x31, 0x92, 0x5e, + 0x9a, 0x41, 0x5c, 0x27, 0x98, 0x34, 0xc9, 0xca, 0x3c, 0xdd, 0xa4, 0x89, 0x41, 0x72, 0xc2, 0x9f, + 0x17, 0xe3, 0xf4, 0x13, 0x3d, 0x9c, 0xb8, 0xe0, 0x24, 0x92, 0xe7, 0x21, 0xff, 0x73, 0xa7, 0xf9, + 0x1f, 0xc0, 0xde, 0xd3, 0x9e, 0x1a, 0x13, 0x5f, 0xc3, 0x8b, 0x13, 0x7e, 0xb2, 0x81, 0x0e, 0x8b, + 0xdd, 0xe6, 0xb1, 0x8f, 0x00, 0xf9, 0x83, 0x00, 0x66, 0x05, 0x69, 0x13, 0xc1, 0x0c, 0x81, 0x50, + 0x8f, 0xbc, 0x67, 0xc7, 0xf1, 0xda, 0xc7, 0x3f, 0x5d, 0xe4, 0xc0, 0xf9, 0x45, 0x0e, 0xfc, 0x79, + 0x91, 0x03, 0x5f, 0x5f, 0xe6, 0x16, 0xce, 0x2f, 0x73, 0x0b, 0x7f, 0x5c, 0xe6, 0x16, 0x3e, 0x2a, + 0x1b, 0xa6, 0xb3, 0xd7, 0xdd, 0x51, 0x1a, 0xa4, 0xad, 0x56, 0x78, 0xa2, 0x47, 0xd8, 0xf9, 0x8c, + 0xd8, 0xfb, 0x7e, 0xde, 0x5e, 0x62, 0x66, 0xa7, 0xdf, 0xc1, 0x74, 0xe7, 0x69, 0xf6, 0x5f, 0x7d, + 0xe5, 0x49, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x2b, 0xcf, 0xb5, 0x9a, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1225,10 +1225,10 @@ func (m *QueryStakingAssetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AssetId) > 0 { - i -= len(m.AssetId) - copy(dAtA[i:], m.AssetId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetId))) + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetID))) i-- dAtA[i] = 0xa } @@ -1327,10 +1327,10 @@ func (m *QueryStakerAssetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.StakerId) > 0 { - i -= len(m.StakerId) - copy(dAtA[i:], m.StakerId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerId))) + if len(m.StakerID) > 0 { + i -= len(m.StakerID) + copy(dAtA[i:], m.StakerID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerID))) i-- dAtA[i] = 0xa } @@ -1406,17 +1406,17 @@ func (m *QuerySpecifiedAssetAmountReq) MarshalToSizedBuffer(dAtA []byte) (int, e _ = i var l int _ = l - if len(m.AssetId) > 0 { - i -= len(m.AssetId) - copy(dAtA[i:], m.AssetId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetId))) + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetID))) i-- dAtA[i] = 0x12 } - if len(m.StakerId) > 0 { - i -= len(m.StakerId) - copy(dAtA[i:], m.StakerId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerId))) + if len(m.StakerID) > 0 { + i -= len(m.StakerID) + copy(dAtA[i:], m.StakerID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerID))) i-- dAtA[i] = 0xa } @@ -1522,10 +1522,10 @@ func (m *QueryOperatorSpecifiedAssetAmountReq) MarshalToSizedBuffer(dAtA []byte) _ = i var l int _ = l - if len(m.AssetId) > 0 { - i -= len(m.AssetId) - copy(dAtA[i:], m.AssetId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetId))) + if len(m.AssetID) > 0 { + i -= len(m.AssetID) + copy(dAtA[i:], m.AssetID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.AssetID))) i-- dAtA[i] = 0x12 } @@ -1559,10 +1559,10 @@ func (m *QueryStakerExCoreAddr) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.StakerId) > 0 { - i -= len(m.StakerId) - copy(dAtA[i:], m.StakerId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerId))) + if len(m.StakerID) > 0 { + i -= len(m.StakerID) + copy(dAtA[i:], m.StakerID) + i = encodeVarintQuery(dAtA, i, uint64(len(m.StakerID))) i-- dAtA[i] = 0xa } @@ -1659,7 +1659,7 @@ func (m *QueryStakingAssetInfo) Size() (n int) { } var l int _ = l - l = len(m.AssetId) + l = len(m.AssetID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1703,7 +1703,7 @@ func (m *QueryStakerAssetInfo) Size() (n int) { } var l int _ = l - l = len(m.StakerId) + l = len(m.StakerID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1738,11 +1738,11 @@ func (m *QuerySpecifiedAssetAmountReq) Size() (n int) { } var l int _ = l - l = len(m.StakerId) + l = len(m.StakerID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.AssetId) + l = len(m.AssetID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1794,7 +1794,7 @@ func (m *QueryOperatorSpecifiedAssetAmountReq) Size() (n int) { if l > 0 { n += 1 + l + sovQuery(uint64(l)) } - l = len(m.AssetId) + l = len(m.AssetID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1807,7 +1807,7 @@ func (m *QueryStakerExCoreAddr) Size() (n int) { } var l int _ = l - l = len(m.StakerId) + l = len(m.StakerID) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -2148,7 +2148,7 @@ func (m *QueryStakingAssetInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2176,7 +2176,7 @@ func (m *QueryStakingAssetInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AssetId = string(dAtA[iNdEx:postIndex]) + m.AssetID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2459,7 +2459,7 @@ func (m *QueryStakerAssetInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2487,7 +2487,7 @@ func (m *QueryStakerAssetInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StakerId = string(dAtA[iNdEx:postIndex]) + m.StakerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2720,7 +2720,7 @@ func (m *QuerySpecifiedAssetAmountReq) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2748,11 +2748,11 @@ func (m *QuerySpecifiedAssetAmountReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StakerId = string(dAtA[iNdEx:postIndex]) + m.StakerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2780,7 +2780,7 @@ func (m *QuerySpecifiedAssetAmountReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AssetId = string(dAtA[iNdEx:postIndex]) + m.AssetID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3127,7 +3127,7 @@ func (m *QueryOperatorSpecifiedAssetAmountReq) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AssetID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3155,7 +3155,7 @@ func (m *QueryOperatorSpecifiedAssetAmountReq) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AssetId = string(dAtA[iNdEx:postIndex]) + m.AssetID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3209,7 +3209,7 @@ func (m *QueryStakerExCoreAddr) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StakerId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StakerID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3237,7 +3237,7 @@ func (m *QueryStakerExCoreAddr) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StakerId = string(dAtA[iNdEx:postIndex]) + m.StakerID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/restaking_assets_manage/types/query.pb.gw.go b/x/restaking_assets_manage/types/query.pb.gw.go index f342bf4cc..0dbf2efec 100644 --- a/x/restaking_assets_manage/types/query.pb.gw.go +++ b/x/restaking_assets_manage/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join var ( filter_Query_QueClientChainInfoByIndex_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} @@ -294,15 +296,15 @@ func request_Query_QueStakerExoCoreAddr_0(ctx context.Context, marshaler runtime _ = err ) - val, ok = pathParams["StakerId"] + val, ok = pathParams["StakerID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "StakerId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "StakerID") } - protoReq.StakerId, err = runtime.String(val) + protoReq.StakerID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "StakerId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "StakerID", err) } msg, err := client.QueStakerExoCoreAddr(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -321,15 +323,15 @@ func local_request_Query_QueStakerExoCoreAddr_0(ctx context.Context, marshaler r _ = err ) - val, ok = pathParams["StakerId"] + val, ok = pathParams["StakerID"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "StakerId") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "StakerID") } - protoReq.StakerId, err = runtime.String(val) + protoReq.StakerID, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "StakerId", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "StakerID", err) } msg, err := server.QueStakerExoCoreAddr(ctx, &protoReq) @@ -340,12 +342,14 @@ func local_request_Query_QueStakerExoCoreAddr_0(ctx context.Context, marshaler r // 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. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_QueClientChainInfoByIndex_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 { @@ -353,6 +357,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueClientChainInfoByIndex_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) @@ -366,6 +371,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueAllClientChainInfo_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 { @@ -373,6 +380,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueAllClientChainInfo_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) @@ -386,6 +394,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueStakingAssetInfo_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 { @@ -393,6 +403,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueStakingAssetInfo_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) @@ -406,6 +417,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueAllStakingAssetsInfo_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 { @@ -413,6 +426,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueAllStakingAssetsInfo_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) @@ -426,6 +440,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueStakerAssetInfos_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 { @@ -433,6 +449,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueStakerAssetInfos_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) @@ -446,6 +463,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueStakerSpecifiedAssetAmount_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 { @@ -453,6 +472,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueStakerSpecifiedAssetAmount_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) @@ -466,6 +486,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueOperatorAssetInfos_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 { @@ -473,6 +495,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueOperatorAssetInfos_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) @@ -486,6 +509,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueOperatorSpecifiedAssetAmount_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 { @@ -493,6 +518,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueOperatorSpecifiedAssetAmount_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) @@ -506,6 +532,8 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_QueStakerExoCoreAddr_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 { @@ -513,6 +541,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_QueStakerExoCoreAddr_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) @@ -764,7 +793,7 @@ var ( pattern_Query_QueOperatorSpecifiedAssetAmount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"exocore", "restaking_assets_manage", "v1", "QueStakerSpecifiedAssetAmount"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_QueStakerExoCoreAddr_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "restaking_assets_manage", "v1", "QueStakerExoCoreAddr", "StakerId"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_QueStakerExoCoreAddr_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"exocore", "restaking_assets_manage", "v1", "QueStakerExoCoreAddr", "StakerID"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/x/restaking_assets_manage/types/tx.pb.go b/x/restaking_assets_manage/types/tx.pb.go index 04d21e14b..709249830 100644 --- a/x/restaking_assets_manage/types/tx.pb.go +++ b/x/restaking_assets_manage/types/tx.pb.go @@ -33,14 +33,14 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ClientChainInfo struct { - ChainName string `protobuf:"bytes,1,opt,name=ChainName,proto3" json:"ChainName,omitempty"` - ChainMetaInfo string `protobuf:"bytes,2,opt,name=ChainMetaInfo,proto3" json:"ChainMetaInfo,omitempty"` - OriginChainId uint64 `protobuf:"varint,3,opt,name=OriginChainId,proto3" json:"OriginChainId,omitempty"` - ExoCoreChainIndex uint64 `protobuf:"varint,4,opt,name=ExoCoreChainIndex,proto3" json:"ExoCoreChainIndex,omitempty"` - FinalityNeedBlockDelay uint64 `protobuf:"varint,5,opt,name=FinalityNeedBlockDelay,proto3" json:"FinalityNeedBlockDelay,omitempty"` - LayerZeroChainId uint64 `protobuf:"varint,6,opt,name=LayerZeroChainId,proto3" json:"LayerZeroChainId,omitempty"` - SignatureType string `protobuf:"bytes,7,opt,name=SignatureType,proto3" json:"SignatureType,omitempty"` - AddressLength uint32 `protobuf:"varint,8,opt,name=AddressLength,proto3" json:"AddressLength,omitempty"` + Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` + MetaInfo string `protobuf:"bytes,2,opt,name=MetaInfo,proto3" json:"MetaInfo,omitempty"` + ChainId uint64 `protobuf:"varint,3,opt,name=ChainId,proto3" json:"ChainId,omitempty"` + ExoCoreChainIndex uint64 `protobuf:"varint,4,opt,name=ExoCoreChainIndex,proto3" json:"ExoCoreChainIndex,omitempty"` + FinalizationBlocks uint64 `protobuf:"varint,5,opt,name=FinalizationBlocks,proto3" json:"FinalizationBlocks,omitempty"` + LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=LayerZeroChainID,proto3" json:"LayerZeroChainID,omitempty"` + SignatureType string `protobuf:"bytes,7,opt,name=SignatureType,proto3" json:"SignatureType,omitempty"` + AddressLength uint32 `protobuf:"varint,8,opt,name=AddressLength,proto3" json:"AddressLength,omitempty"` } func (m *ClientChainInfo) Reset() { *m = ClientChainInfo{} } @@ -76,23 +76,23 @@ func (m *ClientChainInfo) XXX_DiscardUnknown() { var xxx_messageInfo_ClientChainInfo proto.InternalMessageInfo -func (m *ClientChainInfo) GetChainName() string { +func (m *ClientChainInfo) GetName() string { if m != nil { - return m.ChainName + return m.Name } return "" } -func (m *ClientChainInfo) GetChainMetaInfo() string { +func (m *ClientChainInfo) GetMetaInfo() string { if m != nil { - return m.ChainMetaInfo + return m.MetaInfo } return "" } -func (m *ClientChainInfo) GetOriginChainId() uint64 { +func (m *ClientChainInfo) GetChainId() uint64 { if m != nil { - return m.OriginChainId + return m.ChainId } return 0 } @@ -104,16 +104,16 @@ func (m *ClientChainInfo) GetExoCoreChainIndex() uint64 { return 0 } -func (m *ClientChainInfo) GetFinalityNeedBlockDelay() uint64 { +func (m *ClientChainInfo) GetFinalizationBlocks() uint64 { if m != nil { - return m.FinalityNeedBlockDelay + return m.FinalizationBlocks } return 0 } -func (m *ClientChainInfo) GetLayerZeroChainId() uint64 { +func (m *ClientChainInfo) GetLayerZeroChainID() uint64 { if m != nil { - return m.LayerZeroChainId + return m.LayerZeroChainID } return 0 } @@ -132,29 +132,29 @@ func (m *ClientChainInfo) GetAddressLength() uint32 { return 0 } -type ClientChainTokenInfo struct { +type AssetInfo struct { Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` Symbol string `protobuf:"bytes,2,opt,name=Symbol,proto3" json:"Symbol,omitempty"` Address string `protobuf:"bytes,3,opt,name=Address,proto3" json:"Address,omitempty"` Decimals uint32 `protobuf:"varint,4,opt,name=Decimals,proto3" json:"Decimals,omitempty"` TotalSupply github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,5,opt,name=TotalSupply,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"TotalSupply"` - LayerZeroChainId uint64 `protobuf:"varint,6,opt,name=LayerZeroChainId,proto3" json:"LayerZeroChainId,omitempty"` + LayerZeroChainID uint64 `protobuf:"varint,6,opt,name=LayerZeroChainID,proto3" json:"LayerZeroChainID,omitempty"` ExoCoreChainIndex uint64 `protobuf:"varint,7,opt,name=ExoCoreChainIndex,proto3" json:"ExoCoreChainIndex,omitempty"` - AssetMetaInfo string `protobuf:"bytes,8,opt,name=AssetMetaInfo,proto3" json:"AssetMetaInfo,omitempty"` + MetaInfo string `protobuf:"bytes,8,opt,name=MetaInfo,proto3" json:"MetaInfo,omitempty"` } -func (m *ClientChainTokenInfo) Reset() { *m = ClientChainTokenInfo{} } -func (m *ClientChainTokenInfo) String() string { return proto.CompactTextString(m) } -func (*ClientChainTokenInfo) ProtoMessage() {} -func (*ClientChainTokenInfo) Descriptor() ([]byte, []int) { +func (m *AssetInfo) Reset() { *m = AssetInfo{} } +func (m *AssetInfo) String() string { return proto.CompactTextString(m) } +func (*AssetInfo) ProtoMessage() {} +func (*AssetInfo) Descriptor() ([]byte, []int) { return fileDescriptor_b24e66e530cc30d1, []int{1} } -func (m *ClientChainTokenInfo) XXX_Unmarshal(b []byte) error { +func (m *AssetInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ClientChainTokenInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *AssetInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ClientChainTokenInfo.Marshal(b, m, deterministic) + return xxx_messageInfo_AssetInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -164,69 +164,69 @@ func (m *ClientChainTokenInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *ClientChainTokenInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientChainTokenInfo.Merge(m, src) +func (m *AssetInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_AssetInfo.Merge(m, src) } -func (m *ClientChainTokenInfo) XXX_Size() int { +func (m *AssetInfo) XXX_Size() int { return m.Size() } -func (m *ClientChainTokenInfo) XXX_DiscardUnknown() { - xxx_messageInfo_ClientChainTokenInfo.DiscardUnknown(m) +func (m *AssetInfo) XXX_DiscardUnknown() { + xxx_messageInfo_AssetInfo.DiscardUnknown(m) } -var xxx_messageInfo_ClientChainTokenInfo proto.InternalMessageInfo +var xxx_messageInfo_AssetInfo proto.InternalMessageInfo -func (m *ClientChainTokenInfo) GetName() string { +func (m *AssetInfo) GetName() string { if m != nil { return m.Name } return "" } -func (m *ClientChainTokenInfo) GetSymbol() string { +func (m *AssetInfo) GetSymbol() string { if m != nil { return m.Symbol } return "" } -func (m *ClientChainTokenInfo) GetAddress() string { +func (m *AssetInfo) GetAddress() string { if m != nil { return m.Address } return "" } -func (m *ClientChainTokenInfo) GetDecimals() uint32 { +func (m *AssetInfo) GetDecimals() uint32 { if m != nil { return m.Decimals } return 0 } -func (m *ClientChainTokenInfo) GetLayerZeroChainId() uint64 { +func (m *AssetInfo) GetLayerZeroChainID() uint64 { if m != nil { - return m.LayerZeroChainId + return m.LayerZeroChainID } return 0 } -func (m *ClientChainTokenInfo) GetExoCoreChainIndex() uint64 { +func (m *AssetInfo) GetExoCoreChainIndex() uint64 { if m != nil { return m.ExoCoreChainIndex } return 0 } -func (m *ClientChainTokenInfo) GetAssetMetaInfo() string { +func (m *AssetInfo) GetMetaInfo() string { if m != nil { - return m.AssetMetaInfo + return m.MetaInfo } return "" } type StakingAssetInfo struct { - AssetBasicInfo *ClientChainTokenInfo `protobuf:"bytes,1,opt,name=AssetBasicInfo,proto3" json:"AssetBasicInfo,omitempty"` + AssetBasicInfo *AssetInfo `protobuf:"bytes,1,opt,name=AssetBasicInfo,proto3" json:"AssetBasicInfo,omitempty"` StakingTotalAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=StakingTotalAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"StakingTotalAmount"` } @@ -263,7 +263,7 @@ func (m *StakingAssetInfo) XXX_DiscardUnknown() { var xxx_messageInfo_StakingAssetInfo proto.InternalMessageInfo -func (m *StakingAssetInfo) GetAssetBasicInfo() *ClientChainTokenInfo { +func (m *StakingAssetInfo) GetAssetBasicInfo() *AssetInfo { if m != nil { return m.AssetBasicInfo } @@ -514,9 +514,157 @@ func (m *MsgSetExoCoreAddrResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetExoCoreAddrResponse proto.InternalMessageInfo +type RegisterClientChainReq struct { + FromAddress string `protobuf:"bytes,1,opt,name=FromAddress,proto3" json:"FromAddress,omitempty"` + Info *ClientChainInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` +} + +func (m *RegisterClientChainReq) Reset() { *m = RegisterClientChainReq{} } +func (m *RegisterClientChainReq) String() string { return proto.CompactTextString(m) } +func (*RegisterClientChainReq) ProtoMessage() {} +func (*RegisterClientChainReq) Descriptor() ([]byte, []int) { + return fileDescriptor_b24e66e530cc30d1, []int{9} +} +func (m *RegisterClientChainReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisterClientChainReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisterClientChainReq.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 *RegisterClientChainReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisterClientChainReq.Merge(m, src) +} +func (m *RegisterClientChainReq) XXX_Size() int { + return m.Size() +} +func (m *RegisterClientChainReq) XXX_DiscardUnknown() { + xxx_messageInfo_RegisterClientChainReq.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisterClientChainReq proto.InternalMessageInfo + +type RegisterClientChainResponse struct { +} + +func (m *RegisterClientChainResponse) Reset() { *m = RegisterClientChainResponse{} } +func (m *RegisterClientChainResponse) String() string { return proto.CompactTextString(m) } +func (*RegisterClientChainResponse) ProtoMessage() {} +func (*RegisterClientChainResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b24e66e530cc30d1, []int{10} +} +func (m *RegisterClientChainResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisterClientChainResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisterClientChainResponse.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 *RegisterClientChainResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisterClientChainResponse.Merge(m, src) +} +func (m *RegisterClientChainResponse) XXX_Size() int { + return m.Size() +} +func (m *RegisterClientChainResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RegisterClientChainResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisterClientChainResponse proto.InternalMessageInfo + +type RegisterAssetReq struct { + FromAddress string `protobuf:"bytes,1,opt,name=FromAddress,proto3" json:"FromAddress,omitempty"` + Info *AssetInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"` +} + +func (m *RegisterAssetReq) Reset() { *m = RegisterAssetReq{} } +func (m *RegisterAssetReq) String() string { return proto.CompactTextString(m) } +func (*RegisterAssetReq) ProtoMessage() {} +func (*RegisterAssetReq) Descriptor() ([]byte, []int) { + return fileDescriptor_b24e66e530cc30d1, []int{11} +} +func (m *RegisterAssetReq) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisterAssetReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisterAssetReq.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 *RegisterAssetReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisterAssetReq.Merge(m, src) +} +func (m *RegisterAssetReq) XXX_Size() int { + return m.Size() +} +func (m *RegisterAssetReq) XXX_DiscardUnknown() { + xxx_messageInfo_RegisterAssetReq.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisterAssetReq proto.InternalMessageInfo + +type RegisterAssetResponse struct { +} + +func (m *RegisterAssetResponse) Reset() { *m = RegisterAssetResponse{} } +func (m *RegisterAssetResponse) String() string { return proto.CompactTextString(m) } +func (*RegisterAssetResponse) ProtoMessage() {} +func (*RegisterAssetResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b24e66e530cc30d1, []int{12} +} +func (m *RegisterAssetResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisterAssetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisterAssetResponse.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 *RegisterAssetResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisterAssetResponse.Merge(m, src) +} +func (m *RegisterAssetResponse) XXX_Size() int { + return m.Size() +} +func (m *RegisterAssetResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RegisterAssetResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisterAssetResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*ClientChainInfo)(nil), "exocore.restaking_assets_manage.v1.ClientChainInfo") - proto.RegisterType((*ClientChainTokenInfo)(nil), "exocore.restaking_assets_manage.v1.ClientChainTokenInfo") + proto.RegisterType((*AssetInfo)(nil), "exocore.restaking_assets_manage.v1.AssetInfo") proto.RegisterType((*StakingAssetInfo)(nil), "exocore.restaking_assets_manage.v1.StakingAssetInfo") proto.RegisterType((*StakerSingleAssetOrChangeInfo)(nil), "exocore.restaking_assets_manage.v1.StakerSingleAssetOrChangeInfo") proto.RegisterType((*StakerAllAssetsInfo)(nil), "exocore.restaking_assets_manage.v1.StakerAllAssetsInfo") @@ -526,6 +674,10 @@ func init() { proto.RegisterMapType((map[string]*OperatorSingleAssetOrChangeInfo)(nil), "exocore.restaking_assets_manage.v1.OperatorAllAssetsInfo.AllAssetsStateEntry") proto.RegisterType((*MsgSetExoCoreAddr)(nil), "exocore.restaking_assets_manage.v1.MsgSetExoCoreAddr") proto.RegisterType((*MsgSetExoCoreAddrResponse)(nil), "exocore.restaking_assets_manage.v1.MsgSetExoCoreAddrResponse") + proto.RegisterType((*RegisterClientChainReq)(nil), "exocore.restaking_assets_manage.v1.RegisterClientChainReq") + proto.RegisterType((*RegisterClientChainResponse)(nil), "exocore.restaking_assets_manage.v1.RegisterClientChainResponse") + proto.RegisterType((*RegisterAssetReq)(nil), "exocore.restaking_assets_manage.v1.RegisterAssetReq") + proto.RegisterType((*RegisterAssetResponse)(nil), "exocore.restaking_assets_manage.v1.RegisterAssetResponse") } func init() { @@ -533,70 +685,78 @@ func init() { } var fileDescriptor_b24e66e530cc30d1 = []byte{ - // 1008 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0x4d, 0x6f, 0x1b, 0x45, - 0x18, 0xf6, 0xda, 0xf9, 0x7c, 0xad, 0xb4, 0xc9, 0x34, 0x14, 0xc7, 0x14, 0x3b, 0x32, 0x08, 0xac, - 0x40, 0x6c, 0xd5, 0x88, 0x2a, 0x8a, 0x00, 0xc9, 0x71, 0x8a, 0x14, 0x91, 0xd4, 0xd2, 0x3a, 0x10, - 0xd1, 0x03, 0x61, 0x62, 0x4f, 0xd7, 0x23, 0xef, 0xce, 0x58, 0x3b, 0xe3, 0xd4, 0xbe, 0x55, 0x08, - 0x21, 0x84, 0x10, 0x82, 0x0b, 0x1c, 0xb8, 0xf4, 0x27, 0xe4, 0xd0, 0x1f, 0xd1, 0x03, 0x87, 0xaa, - 0x17, 0x02, 0x87, 0x0a, 0x25, 0x87, 0xf0, 0x33, 0xd0, 0xce, 0xec, 0x26, 0xeb, 0xd8, 0x6e, 0xb6, - 0xb4, 0x95, 0x7a, 0x49, 0x76, 0x9e, 0x79, 0xbf, 0xe6, 0x79, 0x9f, 0x37, 0x33, 0x81, 0xf7, 0x48, - 0x97, 0xd7, 0xb9, 0x4b, 0x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 0xdd, 0x7c, 0x1e, 0xea, 0x3f, 0x33, - 0xce, 0xc3, 0xde, 0x95, 0x5f, 0x0f, 0x3f, 0x14, 0xcf, 0x9e, 0x6a, 0x03, 0x38, 0xfa, 0x04, 0xd2, - 0x7a, 0xec, 0x43, 0xb7, 0xea, 0xe9, 0x0b, 0x4a, 0xbf, 0x46, 0xcc, 0xa7, 0x58, 0xac, 0xde, 0xf8, - 0xfe, 0x7e, 0x36, 0xf6, 0xef, 0xfd, 0x6c, 0xec, 0x9b, 0x93, 0x83, 0xa5, 0xf0, 0x49, 0x7f, 0x38, - 0x39, 0x58, 0x5a, 0x08, 0x1e, 0xd8, 0x03, 0x1c, 0xe6, 0xde, 0x80, 0x85, 0x01, 0xd0, 0x24, 0xa2, - 0xcd, 0x99, 0x20, 0xa5, 0xdf, 0x0d, 0x48, 0x6c, 0x09, 0xcb, 0x1b, 0xe0, 0xf9, 0x1a, 0x91, 0x3a, - 0x7d, 0xb8, 0x03, 0x1f, 0x46, 0xe9, 0xf3, 0x40, 0xfc, 0xf4, 0xc7, 0xff, 0xcb, 0x2d, 0x28, 0x2b, - 0x3d, 0x7e, 0xef, 0xe4, 0x60, 0xc9, 0x58, 0xdb, 0x7c, 0x78, 0x94, 0x31, 0x1e, 0x1d, 0x65, 0x8c, - 0x7f, 0x8e, 0x32, 0xc6, 0xcf, 0xc7, 0x99, 0xd8, 0xa3, 0xe3, 0x4c, 0xec, 0xf0, 0x38, 0x13, 0xbb, - 0x5d, 0x0a, 0xcd, 0x69, 0x70, 0xf4, 0xee, 0xc8, 0xff, 0x2e, 0xd4, 0xdc, 0xee, 0x4d, 0xa8, 0xd7, - 0xfd, 0x07, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xd9, 0x3c, 0x38, 0x8d, 0x0c, 0x00, 0x00, + // 1129 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57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66, + 0xdb, 0x8f, 0x63, 0x79, 0x7d, 0xad, 0x74, 0xc9, 0x8f, 0xd3, 0x1b, 0xff, 0x06, 0x00, 0x00, 0xff, + 0xff, 0x91, 0x6a, 0xc4, 0xed, 0x4c, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -612,6 +772,8 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { SetStakerExoCoreAddr(ctx context.Context, in *MsgSetExoCoreAddr, opts ...grpc.CallOption) (*MsgSetExoCoreAddrResponse, error) + RegisterClientChain(ctx context.Context, in *RegisterClientChainReq, opts ...grpc.CallOption) (*RegisterClientChainResponse, error) + RegisterAsset(ctx context.Context, in *RegisterAssetReq, opts ...grpc.CallOption) (*RegisterAssetResponse, error) } type msgClient struct { @@ -631,9 +793,29 @@ func (c *msgClient) SetStakerExoCoreAddr(ctx context.Context, in *MsgSetExoCoreA return out, nil } +func (c *msgClient) RegisterClientChain(ctx context.Context, in *RegisterClientChainReq, opts ...grpc.CallOption) (*RegisterClientChainResponse, error) { + out := new(RegisterClientChainResponse) + err := c.cc.Invoke(ctx, "/exocore.restaking_assets_manage.v1.Msg/RegisterClientChain", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) RegisterAsset(ctx context.Context, in *RegisterAssetReq, opts ...grpc.CallOption) (*RegisterAssetResponse, error) { + out := new(RegisterAssetResponse) + err := c.cc.Invoke(ctx, "/exocore.restaking_assets_manage.v1.Msg/RegisterAsset", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { SetStakerExoCoreAddr(context.Context, *MsgSetExoCoreAddr) (*MsgSetExoCoreAddrResponse, error) + RegisterClientChain(context.Context, *RegisterClientChainReq) (*RegisterClientChainResponse, error) + RegisterAsset(context.Context, *RegisterAssetReq) (*RegisterAssetResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -643,6 +825,12 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) SetStakerExoCoreAddr(ctx context.Context, req *MsgSetExoCoreAddr) (*MsgSetExoCoreAddrResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SetStakerExoCoreAddr not implemented") } +func (*UnimplementedMsgServer) RegisterClientChain(ctx context.Context, req *RegisterClientChainReq) (*RegisterClientChainResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterClientChain not implemented") +} +func (*UnimplementedMsgServer) RegisterAsset(ctx context.Context, req *RegisterAssetReq) (*RegisterAssetResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterAsset not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -666,6 +854,42 @@ func _Msg_SetStakerExoCoreAddr_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Msg_RegisterClientChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterClientChainReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterClientChain(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.restaking_assets_manage.v1.Msg/RegisterClientChain", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterClientChain(ctx, req.(*RegisterClientChainReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_RegisterAsset_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterAssetReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterAsset(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/exocore.restaking_assets_manage.v1.Msg/RegisterAsset", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterAsset(ctx, req.(*RegisterAssetReq)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "exocore.restaking_assets_manage.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -674,6 +898,14 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SetStakerExoCoreAddr", Handler: _Msg_SetStakerExoCoreAddr_Handler, }, + { + MethodName: "RegisterClientChain", + Handler: _Msg_RegisterClientChain_Handler, + }, + { + MethodName: "RegisterAsset", + Handler: _Msg_RegisterAsset_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "exocore/restaking_assets_manage/v1/tx.proto", @@ -711,13 +943,13 @@ func (m *ClientChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - if m.LayerZeroChainId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.LayerZeroChainId)) + if m.LayerZeroChainID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.LayerZeroChainID)) i-- dAtA[i] = 0x30 } - if m.FinalityNeedBlockDelay != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.FinalityNeedBlockDelay)) + if m.FinalizationBlocks != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.FinalizationBlocks)) i-- dAtA[i] = 0x28 } @@ -726,29 +958,29 @@ func (m *ClientChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if m.OriginChainId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.OriginChainId)) + if m.ChainId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ChainId)) i-- dAtA[i] = 0x18 } - if len(m.ChainMetaInfo) > 0 { - i -= len(m.ChainMetaInfo) - copy(dAtA[i:], m.ChainMetaInfo) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainMetaInfo))) + if len(m.MetaInfo) > 0 { + i -= len(m.MetaInfo) + copy(dAtA[i:], m.MetaInfo) + i = encodeVarintTx(dAtA, i, uint64(len(m.MetaInfo))) i-- dAtA[i] = 0x12 } - if len(m.ChainName) > 0 { - i -= len(m.ChainName) - copy(dAtA[i:], m.ChainName) - i = encodeVarintTx(dAtA, i, uint64(len(m.ChainName))) + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *ClientChainTokenInfo) Marshal() (dAtA []byte, err error) { +func (m *AssetInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -758,20 +990,20 @@ func (m *ClientChainTokenInfo) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ClientChainTokenInfo) MarshalTo(dAtA []byte) (int, error) { +func (m *AssetInfo) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ClientChainTokenInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *AssetInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.AssetMetaInfo) > 0 { - i -= len(m.AssetMetaInfo) - copy(dAtA[i:], m.AssetMetaInfo) - i = encodeVarintTx(dAtA, i, uint64(len(m.AssetMetaInfo))) + if len(m.MetaInfo) > 0 { + i -= len(m.MetaInfo) + copy(dAtA[i:], m.MetaInfo) + i = encodeVarintTx(dAtA, i, uint64(len(m.MetaInfo))) i-- dAtA[i] = 0x42 } @@ -780,8 +1012,8 @@ func (m *ClientChainTokenInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x38 } - if m.LayerZeroChainId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.LayerZeroChainId)) + if m.LayerZeroChainID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.LayerZeroChainID)) i-- dAtA[i] = 0x30 } @@ -1152,6 +1384,136 @@ func (m *MsgSetExoCoreAddrResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *RegisterClientChainReq) 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 *RegisterClientChainReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RegisterClientChainReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Info != nil { + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RegisterClientChainResponse) 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 *RegisterClientChainResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RegisterClientChainResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *RegisterAssetReq) 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 *RegisterAssetReq) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RegisterAssetReq) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Info != nil { + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.FromAddress) > 0 { + i -= len(m.FromAddress) + copy(dAtA[i:], m.FromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.FromAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RegisterAssetResponse) 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 *RegisterAssetResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RegisterAssetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1169,25 +1531,25 @@ func (m *ClientChainInfo) Size() (n int) { } var l int _ = l - l = len(m.ChainName) + l = len(m.Name) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ChainMetaInfo) + l = len(m.MetaInfo) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.OriginChainId != 0 { - n += 1 + sovTx(uint64(m.OriginChainId)) + if m.ChainId != 0 { + n += 1 + sovTx(uint64(m.ChainId)) } if m.ExoCoreChainIndex != 0 { n += 1 + sovTx(uint64(m.ExoCoreChainIndex)) } - if m.FinalityNeedBlockDelay != 0 { - n += 1 + sovTx(uint64(m.FinalityNeedBlockDelay)) + if m.FinalizationBlocks != 0 { + n += 1 + sovTx(uint64(m.FinalizationBlocks)) } - if m.LayerZeroChainId != 0 { - n += 1 + sovTx(uint64(m.LayerZeroChainId)) + if m.LayerZeroChainID != 0 { + n += 1 + sovTx(uint64(m.LayerZeroChainID)) } l = len(m.SignatureType) if l > 0 { @@ -1199,7 +1561,7 @@ func (m *ClientChainInfo) Size() (n int) { return n } -func (m *ClientChainTokenInfo) Size() (n int) { +func (m *AssetInfo) Size() (n int) { if m == nil { return 0 } @@ -1222,13 +1584,13 @@ func (m *ClientChainTokenInfo) Size() (n int) { } l = m.TotalSupply.Size() n += 1 + l + sovTx(uint64(l)) - if m.LayerZeroChainId != 0 { - n += 1 + sovTx(uint64(m.LayerZeroChainId)) + if m.LayerZeroChainID != 0 { + n += 1 + sovTx(uint64(m.LayerZeroChainID)) } if m.ExoCoreChainIndex != 0 { n += 1 + sovTx(uint64(m.ExoCoreChainIndex)) } - l = len(m.AssetMetaInfo) + l = len(m.MetaInfo) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1361,14 +1723,66 @@ func (m *MsgSetExoCoreAddrResponse) Size() (n int) { return n } -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { - l := len(dAtA) +func (m *RegisterClientChainReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Info != nil { + l = m.Info.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *RegisterClientChainResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *RegisterAssetReq) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Info != nil { + l = m.Info.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *RegisterAssetResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx @@ -1398,7 +1812,7 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1426,11 +1840,11 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainName = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainMetaInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MetaInfo", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1458,13 +1872,13 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainMetaInfo = string(dAtA[iNdEx:postIndex]) + m.MetaInfo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } - m.OriginChainId = 0 + m.ChainId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1474,7 +1888,7 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.OriginChainId |= uint64(b&0x7F) << shift + m.ChainId |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1500,9 +1914,9 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { } case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalityNeedBlockDelay", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FinalizationBlocks", wireType) } - m.FinalityNeedBlockDelay = 0 + m.FinalizationBlocks = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1512,16 +1926,16 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.FinalityNeedBlockDelay |= uint64(b&0x7F) << shift + m.FinalizationBlocks |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LayerZeroChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LayerZeroChainID", wireType) } - m.LayerZeroChainId = 0 + m.LayerZeroChainID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1531,7 +1945,7 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LayerZeroChainId |= uint64(b&0x7F) << shift + m.LayerZeroChainID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1608,7 +2022,7 @@ func (m *ClientChainInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *ClientChainTokenInfo) Unmarshal(dAtA []byte) error { +func (m *AssetInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1631,10 +2045,10 @@ func (m *ClientChainTokenInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ClientChainTokenInfo: wiretype end group for non-group") + return fmt.Errorf("proto: AssetInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ClientChainTokenInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AssetInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1788,9 +2202,9 @@ func (m *ClientChainTokenInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LayerZeroChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LayerZeroChainID", wireType) } - m.LayerZeroChainId = 0 + m.LayerZeroChainID = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1800,7 +2214,7 @@ func (m *ClientChainTokenInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LayerZeroChainId |= uint64(b&0x7F) << shift + m.LayerZeroChainID |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -1826,7 +2240,7 @@ func (m *ClientChainTokenInfo) Unmarshal(dAtA []byte) error { } case 8: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AssetMetaInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MetaInfo", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1854,7 +2268,7 @@ func (m *ClientChainTokenInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.AssetMetaInfo = string(dAtA[iNdEx:postIndex]) + m.MetaInfo = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1936,7 +2350,7 @@ func (m *StakingAssetInfo) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.AssetBasicInfo == nil { - m.AssetBasicInfo = &ClientChainTokenInfo{} + m.AssetBasicInfo = &AssetInfo{} } if err := m.AssetBasicInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2906,6 +3320,342 @@ func (m *MsgSetExoCoreAddrResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *RegisterClientChainReq) 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: RegisterClientChainReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterClientChainReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", 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.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", 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.Info == nil { + m.Info = &ClientChainInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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 *RegisterClientChainResponse) 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: RegisterClientChainResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterClientChainResponse: 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 *RegisterAssetReq) 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: RegisterAssetReq: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterAssetReq: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FromAddress", 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.FromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", 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.Info == nil { + m.Info = &AssetInfo{} + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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 *RegisterAssetResponse) 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: RegisterAssetResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisterAssetResponse: 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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/reward/client/cli/query.go b/x/reward/client/cli/query.go index ea1e5b64a..c6bbdacb1 100644 --- a/x/reward/client/cli/query.go +++ b/x/reward/client/cli/query.go @@ -14,7 +14,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group reward queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/reward/client/cli/tx.go b/x/reward/client/cli/tx.go index 1681a0b70..7a28d01b4 100644 --- a/x/reward/client/cli/tx.go +++ b/x/reward/client/cli/tx.go @@ -2,7 +2,6 @@ package cli import ( "fmt" - "time" "github.com/spf13/cobra" @@ -14,13 +13,6 @@ import ( "github.com/ExocoreNetwork/exocore/x/reward/types" ) -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ diff --git a/x/reward/keeper/claim_reward.go b/x/reward/keeper/claim_reward.go index 483a6de98..ff7a64529 100644 --- a/x/reward/keeper/claim_reward.go +++ b/x/reward/keeper/claim_reward.go @@ -21,7 +21,7 @@ import ( ) type RewardParams struct { - ClientChainLzId uint64 + ClientChainLzID uint64 Action types.CrossChainOpType AssetsAddress []byte WithdrawRewardAddress []byte @@ -67,15 +67,15 @@ func getRewardParamsFromEventLog(log *ethtypes.Log) (*RewardParams, error) { readEnd += types.CrossChainOpAmountLength amount := sdkmath.NewIntFromBigInt(big.NewInt(0).SetBytes(log.Data[readStart:readEnd])) - var clientChainLzId uint64 - r = bytes.NewReader(log.Topics[types.ClientChainLzIdIndexInTopics][:]) - err = binary.Read(r, binary.BigEndian, &clientChainLzId) + var clientChainLzID uint64 + r = bytes.NewReader(log.Topics[types.ClientChainLzIDIndexInTopics][:]) + err = binary.Read(r, binary.BigEndian, &clientChainLzID) if err != nil { - return nil, errorsmod.Wrap(err, "error occurred when binary read clientChainLzId from topic") + return nil, errorsmod.Wrap(err, "error occurred when binary read clientChainLzID from topic") } return &RewardParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: action, AssetsAddress: assetsAddress, WithdrawRewardAddress: rewardAddr, @@ -83,14 +83,14 @@ func getRewardParamsFromEventLog(log *ethtypes.Log) (*RewardParams, error) { }, nil } -func getStakeIDAndAssetId(params *RewardParams) (stakeId string, assetId string) { - clientChainLzIdStr := hexutil.EncodeUint64(params.ClientChainLzId) - stakeId = strings.Join([]string{hexutil.Encode(params.WithdrawRewardAddress[:]), clientChainLzIdStr}, "_") - assetId = strings.Join([]string{hexutil.Encode(params.AssetsAddress[:]), clientChainLzIdStr}, "_") +func getStakeIDAndAssetID(params *RewardParams) (stakeID string, assetID string) { + clientChainLzIDStr := hexutil.EncodeUint64(params.ClientChainLzID) + stakeID = strings.Join([]string{hexutil.Encode(params.WithdrawRewardAddress), clientChainLzIDStr}, "_") + assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress), clientChainLzIDStr}, "_") return } -func (k Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (k Keeper) PostTxProcessing(ctx sdk.Context, _ core.Message, receipt *ethtypes.Receipt) error { // TODO check if contract address is valid layerZero relayer address // check if log address and topicId is valid params, err := k.GetParams(ctx) @@ -129,10 +129,10 @@ func (k Keeper) RewardForWithdraw(ctx sdk.Context, event *RewardParams) error { if event.OpAmount.IsNegative() { return errorsmod.Wrap(rtypes.ErrRewardAmountIsNegative, fmt.Sprintf("the amount is:%s", event.OpAmount)) } - stakeId, assetId := getStakeIDAndAssetId(event) + stakeID, assetID := getStakeIDAndAssetID(event) // check is asset exist - if !k.restakingStateKeeper.IsStakingAsset(ctx, assetId) { - return errorsmod.Wrap(rtypes.ErrRewardAssetNotExist, fmt.Sprintf("the assetId is:%s", assetId)) + if !k.restakingStateKeeper.IsStakingAsset(ctx, assetID) { + return errorsmod.Wrap(rtypes.ErrRewardAssetNotExist, fmt.Sprintf("the assetID is:%s", assetID)) } // TODO @@ -140,11 +140,11 @@ func (k Keeper) RewardForWithdraw(ctx sdk.Context, event *RewardParams) error { TotalDepositAmountOrWantChangeValue: event.OpAmount, CanWithdrawAmountOrWantChangeValue: event.OpAmount, } - err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakeId, assetId, changeAmount) + err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakeID, assetID, changeAmount) if err != nil { return err } - if err = k.restakingStateKeeper.UpdateStakingAssetTotalAmount(ctx, assetId, event.OpAmount); err != nil { + if err = k.restakingStateKeeper.UpdateStakingAssetTotalAmount(ctx, assetID, event.OpAmount); err != nil { return err } return nil diff --git a/x/reward/keeper/claim_reward_test.go b/x/reward/keeper/claim_reward_test.go index 1d5ac332a..d2caf5818 100644 --- a/x/reward/keeper/claim_reward_test.go +++ b/x/reward/keeper/claim_reward_test.go @@ -12,7 +12,7 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") usdcAddress := common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") event := &keeper.RewardParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.WithDrawReward, WithdrawRewardAddress: suite.address[:], OpAmount: sdkmath.NewInt(10), @@ -29,8 +29,8 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { suite.NoError(err) // check state after reward - stakerId, assetId := types.GetStakeIDAndAssetId(event.ClientChainLzId, event.WithdrawRewardAddress, event.AssetsAddress) - info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(event.ClientChainLzID, event.WithdrawRewardAddress, event.AssetsAddress) + info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: sdkmath.NewInt(10), @@ -38,7 +38,7 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *info) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetId) + assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) suite.NoError(err) suite.Equal(sdkmath.NewInt(10), assetInfo.StakingTotalAmount) } diff --git a/x/reward/keeper/params.go b/x/reward/keeper/params.go index 73a900479..4d838582d 100644 --- a/x/reward/keeper/params.go +++ b/x/reward/keeper/params.go @@ -13,7 +13,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error { return types.ErrInvalidEvmAddressFormat } if len(common.FromHex(params.ExoCoreLzAppEventTopic)) != common.HashLength { - return types.ErrInvalidLzUaTopicIdLength + return types.ErrInvalidLzUaTopicIDLength } store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixParams) // key := common.HexToAddress(incentive.Contract) diff --git a/x/reward/module.go b/x/reward/module.go index 718cc5071..a49c68a47 100644 --- a/x/reward/module.go +++ b/x/reward/module.go @@ -58,13 +58,13 @@ func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +// DefaultGenesis returns a default GenesisState for the module, marshaled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesis()) } // ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -74,7 +74,9 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module diff --git a/x/reward/types/errors.go b/x/reward/types/errors.go index 97f66d05a..75688e4d1 100644 --- a/x/reward/types/errors.go +++ b/x/reward/types/errors.go @@ -10,7 +10,7 @@ import ( var ( ErrSample = errorsmod.Register(ModuleName, 1100, "sample error") ErrInvalidEvmAddressFormat = errorsmod.Register(ModuleName, 0, "the evm address format is error") - ErrInvalidLzUaTopicIdLength = errorsmod.Register(ModuleName, 1, "the LZUaTopicId length isn't equal to HashLength") + ErrInvalidLzUaTopicIDLength = errorsmod.Register(ModuleName, 1, "the LZUaTopicID length isn't equal to HashLength") ErrNoParamsKey = errorsmod.Register(ModuleName, 2, "there is no stored key for params") ErrRewardAmountIsNegative = errorsmod.Register(ModuleName, 3, "the reward amount is negative") ErrRewardAssetNotExist = errorsmod.Register(ModuleName, 4, "the reward asset doesn't exist") diff --git a/x/reward/types/genesis.pb.go b/x/reward/types/genesis.pb.go index 49541e125..0d0363ec8 100644 --- a/x/reward/types/genesis.pb.go +++ b/x/reward/types/genesis.pb.go @@ -75,7 +75,7 @@ func init() { func init() { proto.RegisterFile("exocore/reward/genesis.proto", fileDescriptor_4ccfae99a1ae8f42) } var fileDescriptor_4ccfae99a1ae8f42 = []byte{ - // 183 bytes of a gzipped FileDescriptorProto + // 195 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0xca, 0xea, 0x41, 0x64, 0xa5, @@ -83,11 +83,12 @@ var fileDescriptor_4ccfae99a1ae8f42 = []byte{ 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0x23, 0x94, 0x5c, 0xb8, 0x78, 0xdc, 0x21, 0x66, 0x06, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0x99, 0x70, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0xc4, 0xf4, 0x50, 0xed, 0xd0, 0x0b, 0x00, 0xcb, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, - 0x55, 0xeb, 0x64, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, - 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x8a, 0xe9, - 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x30, 0x77, 0x54, 0xc0, 0x5c, 0x52, - 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0x89, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xaa, - 0x1c, 0x4a, 0x98, 0xec, 0x00, 0x00, 0x00, + 0x55, 0xeb, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, + 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, 0xe9, + 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0x93, 0xfc, 0x52, 0x4b, + 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0x61, 0xce, 0xaa, 0x80, 0x39, 0xac, 0xa4, 0xb2, 0x20, 0xb5, 0x38, + 0x89, 0x0d, 0xec, 0x30, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x52, 0x1d, 0xec, 0xf9, 0xfb, + 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/reward/types/params.pb.go b/x/reward/types/params.pb.go index 97fd90153..7ce7c11a7 100644 --- a/x/reward/types/params.pb.go +++ b/x/reward/types/params.pb.go @@ -83,7 +83,7 @@ func init() { func init() { proto.RegisterFile("exocore/reward/params.proto", fileDescriptor_1a29ebcfb63d5930) } var fileDescriptor_1a29ebcfb63d5930 = []byte{ - // 190 bytes of a gzipped FileDescriptorProto + // 201 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, 0xd1, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xea, 0x41, 0x24, 0xa5, 0x44, @@ -91,11 +91,12 @@ var fileDescriptor_1a29ebcfb63d5930 = []byte{ 0x58, 0x97, 0x90, 0x01, 0x97, 0x70, 0x6a, 0x45, 0xbe, 0x73, 0x7e, 0x51, 0xaa, 0x4f, 0x95, 0x63, 0x41, 0x81, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x36, 0x29, 0x21, 0x33, 0x2e, 0x31, 0x64, 0x61, 0xd7, 0xb2, 0xd4, 0xbc, 0x92, 0x90, 0xfc, 0x82, - 0xcc, 0x64, 0x09, 0x26, 0xb0, 0x26, 0x1c, 0xb2, 0x4e, 0xd6, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, + 0xcc, 0x64, 0x09, 0x26, 0xb0, 0x26, 0x1c, 0xb2, 0x4e, 0x5e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, - 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x98, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, - 0x0f, 0xf3, 0x5b, 0x05, 0xcc, 0x77, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x77, 0x1b, - 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x14, 0x22, 0xd5, 0x83, 0xfc, 0x00, 0x00, 0x00, + 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, + 0xef, 0x0a, 0x71, 0xbe, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0xcc, 0xab, 0x15, 0x30, + 0xcf, 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xbd, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, + 0xff, 0x73, 0x5a, 0x65, 0xb8, 0x0b, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/reward/types/query.pb.go b/x/reward/types/query.pb.go index 757219ea9..4e81c4f0e 100644 --- a/x/reward/types/query.pb.go +++ b/x/reward/types/query.pb.go @@ -121,25 +121,26 @@ func init() { func init() { proto.RegisterFile("exocore/reward/query.proto", fileDescriptor_03321eafc9126bed) } var fileDescriptor_03321eafc9126bed = []byte{ - // 282 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x31, 0x4b, 0xc4, 0x30, - 0x14, 0xc7, 0xaf, 0x82, 0x1d, 0x22, 0x38, 0xc4, 0xe3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0xdf, - 0x93, 0xc3, 0x7f, 0x19, 0xbf, 0x4b, 0xca, 0x9e, 0xde, 0x3e, 0x5f, 0x36, 0xc6, 0x74, 0x24, 0xfe, - 0x3c, 0xef, 0xec, 0xf4, 0xb5, 0x65, 0xd1, 0xa2, 0x65, 0xd1, 0x47, 0xcb, 0xa2, 0xe7, 0x8e, 0x0d, - 0x16, 0x1d, 0x1b, 0xbc, 0x77, 0x6c, 0x70, 0x7d, 0xa0, 0x0a, 0x77, 0xdb, 0x64, 0x3c, 0xc7, 0xf2, - 0xc7, 0x9d, 0x7d, 0xdb, 0x6e, 0xae, 0xc1, 0x66, 0x71, 0xff, 0x38, 0x27, 0x5f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0xbc, 0x0b, 0xc2, 0xc5, 0xc7, 0x01, 0x00, 0x00, + // 292 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x41, 0x4b, 0xc3, 0x30, + 0x14, 0xc7, 0x57, 0xc1, 0x1d, 0x22, 0x78, 0x88, 0x63, 0x8c, 0x2a, 0x41, 0xea, 0x45, 0x3c, 0x24, + 0x6e, 0x7e, 0x03, 0x61, 0x17, 0x0f, 0xa2, 0x1e, 0xbd, 0xa5, 0xf3, 0x11, 0x8b, 0xb6, 0x2f, 0x4d, + 0x52, 0xb7, 0x79, 0xf4, 0x13, 0x08, 0x7e, 0x29, 0x8f, 0x03, 0x2f, 0x1e, 0xa5, 0xf5, 0x83, 0xc8, + 0x9a, 0x28, 0x6c, 0x8a, 0xb7, 0xf2, 0xfe, 0xbf, 0xff, 0xaf, 0xef, 0x85, 0xc4, 0x30, 0xc3, 0x09, + 0x1a, 0x10, 0x06, 0xa6, 0xd2, 0xdc, 0x88, 0xb2, 0x02, 0x33, 0xe7, 0xda, 0xa0, 0x43, 0xba, 0x1d, + 0x32, 0xee, 0xb3, 0xb8, 0xa7, 0x50, 0x61, 0x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b, 0x6d, 0xb6, 0xc4, + 0xd6, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/reward/types/query.pb.gw.go b/x/reward/types/query.pb.gw.go index 17252797c..67784ea28 100644 --- a/x/reward/types/query.pb.gw.go +++ b/x/reward/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -52,12 +54,14 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // 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. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_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 { @@ -65,6 +69,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_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) diff --git a/x/reward/types/tx.pb.go b/x/reward/types/tx.pb.go index cad854ffe..d3a6bd2bd 100644 --- a/x/reward/types/tx.pb.go +++ b/x/reward/types/tx.pb.go @@ -135,7 +135,7 @@ func init() { func init() { proto.RegisterFile("exocore/reward/tx.proto", fileDescriptor_9cd4863caedb1c8f) } var fileDescriptor_9cd4863caedb1c8f = []byte{ - // 319 bytes of a gzipped FileDescriptorProto + // 330 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4f, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x4a, 0x2d, 0x4f, 0x2c, 0x4a, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x4a, 0xe8, 0x41, 0x24, 0xa4, 0x24, 0xd3, 0xf3, 0xf3, 0xd3, @@ -151,11 +151,12 @@ var fileDescriptor_9cd4863caedb1c8f = []byte{ 0x77, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x08, 0xaa, 0xd6, 0x8a, 0xaf, 0xe9, 0xf9, 0x06, 0x2d, 0x84, 0x29, 0x4a, 0x92, 0x5c, 0xe2, 0x68, 0x0e, 0x0a, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x35, 0x8a, 0xe7, 0x62, 0xf6, 0x2d, 0x4e, 0x17, 0x8a, 0xe0, 0xe2, 0x41, 0x71, 0xaf, 0x3c, 0xba, - 0x3d, 0x68, 0xfa, 0xa5, 0xd4, 0x09, 0x28, 0x80, 0x59, 0xe0, 0x64, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, + 0x3d, 0x68, 0xfa, 0xa5, 0xd4, 0x09, 0x28, 0x80, 0x59, 0xe0, 0xe4, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, - 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x8a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, - 0xb9, 0xfa, 0xb0, 0xf0, 0xac, 0x80, 0xc7, 0x6f, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x44, - 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x99, 0x5a, 0x2d, 0x17, 0xfe, 0x01, 0x00, 0x00, + 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x06, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, + 0xb9, 0xfa, 0xae, 0x10, 0xc3, 0xfc, 0x52, 0x4b, 0xca, 0xf3, 0x8b, 0xb2, 0xf5, 0x61, 0xc1, 0x5b, + 0x01, 0x8f, 0xee, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x00, 0x1b, 0x03, 0x02, 0x00, 0x00, + 0xff, 0xff, 0x2a, 0x46, 0x9e, 0xfc, 0x0d, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/reward/types/types.pb.go b/x/reward/types/types.pb.go index cd276c0f6..bf693dde9 100644 --- a/x/reward/types/types.pb.go +++ b/x/reward/types/types.pb.go @@ -109,27 +109,27 @@ func init() { func init() { proto.RegisterFile("exocore/reward/types.proto", fileDescriptor_620cd6dbeff3c5e2) } var fileDescriptor_620cd6dbeff3c5e2 = []byte{ - // 310 bytes of a gzipped FileDescriptorProto + // 319 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x3d, 0x4e, 0xc3, 0x30, - 0x18, 0x8d, 0x4b, 0x29, 0xaa, 0x41, 0x0c, 0x16, 0x43, 0x09, 0x92, 0x5b, 0x98, 0xba, 0xd4, 0xa6, - 0x30, 0x32, 0x20, 0xc2, 0x01, 0x40, 0x19, 0x18, 0xd8, 0x9c, 0xc4, 0x2a, 0x11, 0x4d, 0xbe, 0xca, - 0x0e, 0xa5, 0xdc, 0x82, 0x89, 0x43, 0x70, 0x06, 0x0e, 0x90, 0xb1, 0x23, 0x53, 0x81, 0xe4, 0x16, - 0x4c, 0xc8, 0x71, 0x22, 0xe8, 0xc6, 0x94, 0x27, 0xbd, 0xbc, 0x3f, 0x7f, 0xd8, 0x95, 0x0b, 0x08, - 0x41, 0x49, 0xae, 0xe4, 0xa3, 0x50, 0x11, 0xcf, 0x9e, 0x66, 0x52, 0xb3, 0x99, 0x82, 0x0c, 0xc8, - 0x6e, 0xcd, 0x31, 0xcb, 0xb9, 0x7b, 0x13, 0x98, 0x40, 0x45, 0x71, 0x83, 0xec, 0x5f, 0x2e, 0x0d, - 0x41, 0x27, 0xa0, 0x79, 0x20, 0xb4, 0xe4, 0xf3, 0x71, 0x20, 0x33, 0x31, 0xe6, 0x21, 0xc4, 0xa9, - 0xe5, 0x8f, 0x5e, 0x5a, 0xb8, 0x7d, 0x0d, 0x30, 0x25, 0x04, 0xb7, 0x53, 0x91, 0xc8, 0x1e, 0x1a, - 0xa0, 0x61, 0xd7, 0xaf, 0x30, 0x39, 0xc3, 0x5b, 0xd6, 0x5c, 0xf7, 0x5a, 0x83, 0x8d, 0xe1, 0xf6, - 0xc9, 0x01, 0x5b, 0x0f, 0x65, 0x46, 0xca, 0xfc, 0x0a, 0x7b, 0xed, 0x7c, 0xd5, 0x77, 0xfc, 0x46, - 0xe1, 0xbe, 0x21, 0xdc, 0xb1, 0x0c, 0xb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, 0xe1, 0x65, 0x09, + 0x3a, 0x74, 0xca, 0x41, 0x7f, 0xf9, 0x45, 0xbd, 0xe5, 0x86, 0xa2, 0xd5, 0x86, 0xa2, 0xcf, 0x0d, + 0x45, 0xcf, 0x19, 0xf5, 0x56, 0x19, 0xf5, 0xde, 0x33, 0xea, 0xdd, 0x77, 0xff, 0xc8, 0x5d, 0xbb, + 0x95, 0xf4, 0xa5, 0x99, 0x83, 0x1a, 0xf2, 0xf2, 0x64, 0x8b, 0xad, 0xa3, 0x45, 0xb5, 0x7c, 0xdf, + 0xe7, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x85, 0xb2, 0x49, 0x53, 0xd3, 0x01, 0x00, 0x00, } func (m *Pool) Marshal() (dAtA []byte, err error) { diff --git a/x/slash/client/cli/query.go b/x/slash/client/cli/query.go index 8e82b83f0..00f9e1fda 100644 --- a/x/slash/client/cli/query.go +++ b/x/slash/client/cli/query.go @@ -9,7 +9,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(_ string) *cobra.Command { // Group exocore-slash queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/slash/client/cli/tx.go b/x/slash/client/cli/tx.go index c71227fd5..19235e4dc 100644 --- a/x/slash/client/cli/tx.go +++ b/x/slash/client/cli/tx.go @@ -2,7 +2,6 @@ package cli import ( "fmt" - "time" "github.com/spf13/cobra" @@ -12,13 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" ) -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ diff --git a/x/slash/keeper/execute_slash.go b/x/slash/keeper/execute_slash.go index a8e2c8273..d6c238791 100644 --- a/x/slash/keeper/execute_slash.go +++ b/x/slash/keeper/execute_slash.go @@ -21,7 +21,7 @@ import ( ) type SlashParams struct { - ClientChainLzId uint64 + ClientChainLzID uint64 Action types.CrossChainOpType AssetsAddress []byte OperatorAddress sdk.AccAddress @@ -31,9 +31,13 @@ type SlashParams struct { OpAmount sdkmath.Int Proof []byte } + +// nolint: unused // This is to be implemented. type OperatorFrozenStatus struct { + // nolint: unused // This is to be implemented. operatorAddress sdk.AccAddress - status bool + // nolint: unused // This is to be implemented. + status bool } func (k Keeper) getParamsFromEventLog(ctx sdk.Context, log *ethtypes.Log) (*SlashParams, error) { @@ -52,13 +56,13 @@ func (k Keeper) getParamsFromEventLog(ctx sdk.Context, log *ethtypes.Log) (*Slas return nil, nil } - var clientChainLzId uint64 - r = bytes.NewReader(log.Topics[types.ClientChainLzIdIndexInTopics][:]) - err = binary.Read(r, binary.BigEndian, &clientChainLzId) + var clientChainLzID uint64 + r = bytes.NewReader(log.Topics[types.ClientChainLzIDIndexInTopics][:]) + err = binary.Read(r, binary.BigEndian, &clientChainLzID) if err != nil { - return nil, errorsmod.Wrap(err, "error occurred when binary read clientChainLzId from topic") + return nil, errorsmod.Wrap(err, "error occurred when binary read clientChainLzID from topic") } - clientChainInfo, err := k.restakingStateKeeper.GetClientChainInfoByIndex(ctx, clientChainLzId) + clientChainInfo, err := k.restakingStateKeeper.GetClientChainInfoByIndex(ctx, clientChainLzID) if err != nil { return nil, errorsmod.Wrap(err, "error occurred when get client chain info") } @@ -100,7 +104,7 @@ func (k Keeper) getParamsFromEventLog(ctx sdk.Context, log *ethtypes.Log) (*Slas amount := sdkmath.NewIntFromBigInt(big.NewInt(0).SetBytes(log.Data[readStart:readEnd])) return &SlashParams{ - ClientChainLzId: clientChainLzId, + ClientChainLzID: clientChainLzID, Action: action, AssetsAddress: assetsAddress, StakerAddress: stakerAddress, @@ -109,14 +113,14 @@ func (k Keeper) getParamsFromEventLog(ctx sdk.Context, log *ethtypes.Log) (*Slas }, nil } -func getStakeIDAndAssetId(params *SlashParams) (stakeId string, assetId string) { - clientChainLzIdStr := hexutil.EncodeUint64(params.ClientChainLzId) - stakeId = strings.Join([]string{hexutil.Encode(params.StakerAddress[:]), clientChainLzIdStr}, "_") - assetId = strings.Join([]string{hexutil.Encode(params.AssetsAddress[:]), clientChainLzIdStr}, "_") +func getStakeIDAndAssetID(params *SlashParams) (stakeID string, assetID string) { + clientChainLzIDStr := hexutil.EncodeUint64(params.ClientChainLzID) + stakeID = strings.Join([]string{hexutil.Encode(params.StakerAddress), clientChainLzIDStr}, "_") + assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress), clientChainLzIDStr}, "_") return } -func (k Keeper) FilterCrossChainEventLogs(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) ([]*ethtypes.Log, error) { +func (k Keeper) FilterCrossChainEventLogs(ctx sdk.Context, _ core.Message, receipt *ethtypes.Receipt) ([]*ethtypes.Log, error) { params, err := k.GetParams(ctx) if err != nil { return nil, err @@ -130,7 +134,7 @@ func (k Keeper) FilterCrossChainEventLogs(ctx sdk.Context, msg core.Message, rec return needLogs, nil } -func (k Keeper) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error { +func (k Keeper) PostTxProcessing(ctx sdk.Context, _ core.Message, receipt *ethtypes.Receipt) error { params, err := k.GetParams(ctx) if err != nil { return err @@ -179,21 +183,21 @@ func (k Keeper) Slash(ctx sdk.Context, event *SlashParams) error { if event.OpAmount.IsNegative() { return errorsmod.Wrap(rtypes.ErrSlashAmountIsNegative, fmt.Sprintf("the amount is:%s", event.OpAmount)) } - stakeId, assetId := getStakeIDAndAssetId(event) + stakeID, assetID := getStakeIDAndAssetID(event) // check is asset exist - if !k.restakingStateKeeper.IsStakingAsset(ctx, assetId) { - return errorsmod.Wrap(rtypes.ErrSlashAssetNotExist, fmt.Sprintf("the assetId is:%s", assetId)) + if !k.restakingStateKeeper.IsStakingAsset(ctx, assetID) { + return errorsmod.Wrap(rtypes.ErrSlashAssetNotExist, fmt.Sprintf("the assetID is:%s", assetID)) } changeAmount := types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: event.OpAmount.Neg(), CanWithdrawAmountOrWantChangeValue: event.OpAmount.Neg(), } - err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakeId, assetId, changeAmount) + err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakeID, assetID, changeAmount) if err != nil { return err } - if err = k.restakingStateKeeper.UpdateStakingAssetTotalAmount(ctx, assetId, event.OpAmount.Neg()); err != nil { + if err = k.restakingStateKeeper.UpdateStakingAssetTotalAmount(ctx, assetID, event.OpAmount.Neg()); err != nil { return err } return nil @@ -212,7 +216,7 @@ func (k Keeper) Slash(ctx sdk.Context, event *SlashParams) error { // return k.GetFrozenStatus(ctx, string(event.OperatorAddress)) // } -// func (k Keeper) OperatorAssetSlashedProportion(ctx sdk.Context, opAddr sdk.AccAddress, assetId string, startHeight, endHeight uint64) sdkmath.LegacyDec { +// func (k Keeper) OperatorAssetSlashedProportion(ctx sdk.Context, opAddr sdk.AccAddress, assetID string, startHeight, endHeight uint64) sdkmath.LegacyDec { // //TODO // return sdkmath.LegacyNewDec(3) // } diff --git a/x/slash/keeper/execute_slash_test.go b/x/slash/keeper/execute_slash_test.go index c14271123..0986a2ac7 100644 --- a/x/slash/keeper/execute_slash_test.go +++ b/x/slash/keeper/execute_slash_test.go @@ -13,14 +13,14 @@ func (suite *KeeperTestSuite) TestSlash() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") usdcAddress := common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") event := &keeper.SlashParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Slash, StakerAddress: suite.address[:], OpAmount: sdkmath.NewInt(90), } depositEvent := &depositKeeper.DepositParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Deposit, StakerAddress: suite.address[:], OpAmount: sdkmath.NewInt(100), @@ -40,8 +40,8 @@ func (suite *KeeperTestSuite) TestSlash() { suite.NoError(err) suite.app.Logger().Info("the assets is:", "assets", assets) - stakerId, assetId := types.GetStakeIDAndAssetId(depositEvent.ClientChainLzId, depositEvent.StakerAddress, depositEvent.AssetsAddress) - info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(depositEvent.ClientChainLzID, depositEvent.StakerAddress, depositEvent.AssetsAddress) + info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -55,8 +55,8 @@ func (suite *KeeperTestSuite) TestSlash() { suite.NoError(err) // check state after slash - stakerId, assetId = types.GetStakeIDAndAssetId(event.ClientChainLzId, event.StakerAddress, event.AssetsAddress) - info, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID = types.GetStakeIDAndAssetID(event.ClientChainLzID, event.StakerAddress, event.AssetsAddress) + info, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: sdkmath.NewInt(10), @@ -64,7 +64,7 @@ func (suite *KeeperTestSuite) TestSlash() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *info) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetId) + assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) suite.NoError(err) suite.Equal(sdkmath.NewInt(10), assetInfo.StakingTotalAmount) } diff --git a/x/slash/keeper/keeper.go b/x/slash/keeper/keeper.go index cda9177c8..fedfe1286 100644 --- a/x/slash/keeper/keeper.go +++ b/x/slash/keeper/keeper.go @@ -48,5 +48,5 @@ type IEXOSlash interface { IsOperatorFrozen(ctx sdk.Context, event *SlashParams) (bool, error) SetParams(ctx sdk.Context, params *types.Params) error GetParams(ctx sdk.Context) (*types.Params, error) - OperatorAssetSlashedProportion(ctx sdk.Context, opAddr sdk.AccAddress, assetId string, startHeight, endHeight uint64) sdkmath.LegacyDec + OperatorAssetSlashedProportion(ctx sdk.Context, opAddr sdk.AccAddress, assetID string, startHeight, endHeight uint64) sdkmath.LegacyDec } diff --git a/x/slash/keeper/msg_server.go b/x/slash/keeper/msg_server.go index 899797486..d334d6086 100644 --- a/x/slash/keeper/msg_server.go +++ b/x/slash/keeper/msg_server.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) +// nolint: unused // Implementation of the msgServer (via proto) to be done. type msgServer struct { Keeper } diff --git a/x/slash/keeper/params.go b/x/slash/keeper/params.go index 91d36ed70..a7a10d4d0 100644 --- a/x/slash/keeper/params.go +++ b/x/slash/keeper/params.go @@ -15,7 +15,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error { return types.ErrInvalidEvmAddressFormat } if len(common.FromHex(params.ExoCoreLzAppEventTopic)) != common.HashLength { - return types.ErrInvalidLzUaTopicIdLength + return types.ErrInvalidLzUaTopicIDLength } params.ExoCoreLzAppAddress = strings.ToLower(params.ExoCoreLzAppAddress) params.ExoCoreLzAppEventTopic = strings.ToLower(params.ExoCoreLzAppEventTopic) diff --git a/x/slash/module.go b/x/slash/module.go index cff84f4ee..a5542864e 100644 --- a/x/slash/module.go +++ b/x/slash/module.go @@ -51,13 +51,13 @@ func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +// DefaultGenesis returns a default GenesisState for the module, marshaled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesis()) } // ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -67,7 +67,9 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module diff --git a/x/slash/types/errors.go b/x/slash/types/errors.go index 3e8bcd3e6..e048b5d9a 100644 --- a/x/slash/types/errors.go +++ b/x/slash/types/errors.go @@ -9,7 +9,7 @@ import ( // x/slash module sentinel errors var ( ErrInvalidEvmAddressFormat = errorsmod.Register(ModuleName, 0, "the evm address format is error") - ErrInvalidLzUaTopicIdLength = errorsmod.Register(ModuleName, 1, "the LZUaTopicId length isn't equal to HashLength") + ErrInvalidLzUaTopicIDLength = errorsmod.Register(ModuleName, 1, "the LZUaTopicID length isn't equal to HashLength") ErrNoParamsKey = errorsmod.Register(ModuleName, 2, "there is no stored key for slash module params") ErrSlashAmountIsNegative = errorsmod.Register(ModuleName, 3, "the slash amount is negative") ErrSlashAssetNotExist = errorsmod.Register(ModuleName, 4, "the slash asset doesn't exist") diff --git a/x/slash/types/genesis.pb.go b/x/slash/types/genesis.pb.go index 9a7a24c54..ab8531252 100644 --- a/x/slash/types/genesis.pb.go +++ b/x/slash/types/genesis.pb.go @@ -75,7 +75,7 @@ func init() { func init() { proto.RegisterFile("exocore/slash/genesis.proto", fileDescriptor_0800c20695e285d5) } var fileDescriptor_0800c20695e285d5 = []byte{ - // 182 bytes of a gzipped FileDescriptorProto + // 194 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xd0, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x4a, 0xea, 0x81, 0x25, 0xa5, 0x44, @@ -83,11 +83,12 @@ var fileDescriptor_0800c20695e285d5 = []byte{ 0x89, 0x45, 0x89, 0xb9, 0x50, 0x03, 0x94, 0x9c, 0xb9, 0x78, 0xdc, 0x21, 0x26, 0x06, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0x19, 0x73, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x44, 0xf5, 0x50, 0x6c, 0xd0, 0x0b, 0x00, 0x4b, 0x3a, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, - 0xea, 0x64, 0x75, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, - 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x0a, 0xe9, 0x99, - 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x30, 0x57, 0x54, 0x40, 0xdd, 0x51, 0x52, - 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, 0x87, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xed, 0x5d, - 0x06, 0xc1, 0xe7, 0x00, 0x00, 0x00, + 0xea, 0xe4, 0x79, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, + 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xfa, 0xe9, 0x99, + 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xae, 0x10, 0x83, 0xfc, 0x52, 0x4b, 0xca, + 0xf3, 0x8b, 0xb2, 0xf5, 0x61, 0x8e, 0xaa, 0x80, 0x3a, 0xab, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, + 0x0d, 0xec, 0x2c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xab, 0xe9, 0x4d, 0xf6, 0x00, + 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/slash/types/params.pb.go b/x/slash/types/params.pb.go index ae4924f09..dbded7051 100644 --- a/x/slash/types/params.pb.go +++ b/x/slash/types/params.pb.go @@ -83,7 +83,7 @@ func init() { func init() { proto.RegisterFile("exocore/slash/params.proto", fileDescriptor_a98d46ef8bcc0f8a) } var fileDescriptor_a98d46ef8bcc0f8a = []byte{ - // 189 bytes of a gzipped FileDescriptorProto + // 200 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xd0, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0xca, 0xe9, 0x81, 0xe5, 0xa4, 0x44, 0xd2, @@ -91,11 +91,12 @@ var fileDescriptor_a98d46ef8bcc0f8a = []byte{ 0x93, 0x90, 0x01, 0x97, 0x70, 0x6a, 0x45, 0xbe, 0x73, 0x7e, 0x51, 0xaa, 0x4f, 0x95, 0x63, 0x41, 0x81, 0x63, 0x4a, 0x4a, 0x51, 0x6a, 0x71, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x36, 0x29, 0x21, 0x33, 0x2e, 0x31, 0x64, 0x61, 0xd7, 0xb2, 0xd4, 0xbc, 0x92, 0x90, 0xfc, 0x82, 0xcc, - 0x64, 0x09, 0x26, 0xb0, 0x26, 0x1c, 0xb2, 0x4e, 0x56, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, + 0x64, 0x09, 0x26, 0xb0, 0x26, 0x1c, 0xb2, 0x4e, 0x9e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, 0x78, - 0x2c, 0xc7, 0x10, 0xa5, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x0f, - 0xf3, 0x59, 0x05, 0xd4, 0x6f, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x67, 0x1b, 0x03, - 0x02, 0x00, 0x00, 0xff, 0xff, 0xff, 0x5f, 0xa7, 0x41, 0xf9, 0x00, 0x00, 0x00, + 0x2c, 0xc7, 0x10, 0xa5, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0xef, + 0x0a, 0x71, 0xbd, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0xcc, 0xa3, 0x15, 0x50, 0xaf, + 0x96, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x7d, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, + 0x6f, 0x99, 0x26, 0xee, 0x08, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/x/slash/types/query.pb.go b/x/slash/types/query.pb.go index 8dd02aeb5..b79a22056 100644 --- a/x/slash/types/query.pb.go +++ b/x/slash/types/query.pb.go @@ -121,7 +121,7 @@ func init() { func init() { proto.RegisterFile("exocore/slash/query.proto", fileDescriptor_8cd6399098c1a574) } var fileDescriptor_8cd6399098c1a574 = []byte{ - // 267 bytes of a gzipped FileDescriptorProto + // 278 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xd0, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x4a, 0xe9, 0x81, 0xa5, 0xa4, 0x44, 0xd2, 0xf3, @@ -134,11 +134,12 @@ var fileDescriptor_8cd6399098c1a574 = []byte{ 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x44, 0xf5, 0x50, 0x5c, 0xae, 0x07, 0x55, 0x0e, 0x55, 0x64, 0x54, 0xce, 0xc5, 0x0a, 0x36, 0x45, 0x28, 0x8f, 0x8b, 0x0d, 0x22, 0x25, 0xa4, 0x88, 0xa6, 0x03, 0xd3, 0x6e, 0x29, 0x25, 0x7c, 0x4a, 0x20, 0x0e, 0x51, 0x92, 0x6d, 0xba, 0xfc, 0x64, 0x32, 0x93, - 0xb8, 0x90, 0xa8, 0x3e, 0x36, 0xaf, 0x39, 0x59, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, + 0xb8, 0x90, 0xa8, 0x3e, 0x36, 0xaf, 0x39, 0x79, 0x9e, 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, 0x42, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0x2e, 0x5c, 0x6b, - 0x05, 0x54, 0x73, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x5c, 0x8c, 0x01, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x0b, 0x83, 0x1e, 0xa4, 0xb0, 0x01, 0x00, 0x00, + 0x1c, 0x43, 0x94, 0x7e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0xbe, 0x2b, + 0x44, 0xab, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0x36, 0xdc, 0xa4, 0x0a, 0xa8, 0x59, 0x25, 0x95, + 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x60, 0x32, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x61, 0xd5, + 0xbc, 0x52, 0xbf, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/slash/types/query.pb.gw.go b/x/slash/types/query.pb.gw.go index 9edbdedb6..82bdc46cb 100644 --- a/x/slash/types/query.pb.gw.go +++ b/x/slash/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -52,12 +54,14 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // 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. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_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 { @@ -65,6 +69,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_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) diff --git a/x/slash/types/tx.pb.go b/x/slash/types/tx.pb.go index ff08bd24e..89c83dc28 100644 --- a/x/slash/types/tx.pb.go +++ b/x/slash/types/tx.pb.go @@ -134,7 +134,7 @@ func init() { func init() { proto.RegisterFile("exocore/slash/tx.proto", fileDescriptor_6ec062c35f00efd9) } var fileDescriptor_6ec062c35f00efd9 = []byte{ - // 300 bytes of a gzipped FileDescriptorProto + // 311 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xce, 0x49, 0x2c, 0xce, 0xd0, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x8a, 0xeb, 0x81, 0xc5, 0xa5, 0xa4, 0x50, 0x95, 0x15, 0x24, 0x16, @@ -149,11 +149,12 @@ var fileDescriptor_6ec062c35f00efd9 = []byte{ 0xc4, 0x3d, 0x79, 0x86, 0x20, 0xa8, 0x52, 0x2b, 0xbe, 0xa6, 0xe7, 0x1b, 0xb4, 0x10, 0x86, 0x28, 0x49, 0x72, 0x89, 0xa3, 0xb9, 0x27, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0xd5, 0x28, 0x96, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x8c, 0x8b, 0x07, 0xc5, 0xb9, 0x72, 0x68, 0xd6, 0xa0, 0x69, - 0x97, 0x52, 0xc3, 0x2f, 0x0f, 0x33, 0xde, 0xc9, 0xea, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, + 0x97, 0x52, 0xc3, 0x2f, 0x0f, 0x33, 0xde, 0xc9, 0xf3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, - 0xe5, 0x18, 0xa2, 0x14, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x61, - 0xb1, 0x52, 0x01, 0x8b, 0xbe, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x68, 0x1a, 0x03, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x90, 0x0f, 0xfa, 0xd8, 0xdc, 0x01, 0x00, 0x00, + 0xe5, 0x18, 0xa2, 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x5d, + 0x21, 0x66, 0xf9, 0xa5, 0x96, 0x94, 0xe7, 0x17, 0x65, 0xeb, 0xc3, 0x22, 0xa9, 0x02, 0x16, 0x9b, + 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0xc0, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x0e, + 0x3b, 0x4b, 0x60, 0xeb, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/withdraw/client/cli/query.go b/x/withdraw/client/cli/query.go index 35f0a6bf3..c657de13e 100644 --- a/x/withdraw/client/cli/query.go +++ b/x/withdraw/client/cli/query.go @@ -14,7 +14,7 @@ import ( ) // GetQueryCmd returns the cli query commands for this module -func GetQueryCmd(queryRoute string) *cobra.Command { +func GetQueryCmd(string) *cobra.Command { // Group withdraw queries under a subcommand cmd := &cobra.Command{ Use: types.ModuleName, diff --git a/x/withdraw/client/cli/tx.go b/x/withdraw/client/cli/tx.go index 7fe7d3b3c..3f8afd530 100644 --- a/x/withdraw/client/cli/tx.go +++ b/x/withdraw/client/cli/tx.go @@ -2,7 +2,6 @@ package cli import ( "fmt" - "time" "github.com/spf13/cobra" @@ -15,13 +14,6 @@ import ( "github.com/ExocoreNetwork/exocore/x/withdraw/types" ) -var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) - -const ( - flagPacketTimeoutTimestamp = "packet-timeout-timestamp" - listSeparator = "," -) - // GetTxCmd returns the transaction commands for this module func GetTxCmd() *cobra.Command { cmd := &cobra.Command{ diff --git a/x/withdraw/keeper/claim_withdraw.go b/x/withdraw/keeper/claim_withdraw.go index 35c7e9b32..1b4275352 100644 --- a/x/withdraw/keeper/claim_withdraw.go +++ b/x/withdraw/keeper/claim_withdraw.go @@ -13,7 +13,7 @@ import ( ) type WithdrawParams struct { - ClientChainLzId uint64 + ClientChainLzID uint64 Action types.CrossChainOpType AssetsAddress []byte WithdrawAddress []byte @@ -59,15 +59,15 @@ type WithdrawParams struct { // readEnd += types.CrossChainOpAmountLength // amount := sdkmath.NewIntFromBigInt(big.NewInt(0).SetBytes(log.Data[readStart:readEnd])) -// var clientChainLzId uint64 -// r = bytes.NewReader(log.Topics[types.ClientChainLzIdIndexInTopics][:]) -// err = binary.Read(r, binary.BigEndian, &clientChainLzId) +// var clientChainLzID uint64 +// r = bytes.NewReader(log.Topics[types.ClientChainLzIDIndexInTopics][:]) +// err = binary.Read(r, binary.BigEndian, &clientChainLzID) // if err != nil { -// return nil, errorsmod.Wrap(err, "error occurred when binary read clientChainLzId from topic") +// return nil, errorsmod.Wrap(err, "error occurred when binary read clientChainLzID from topic") // } // return &WithdrawParams{ -// ClientChainLzId: clientChainLzId, +// ClientChainLzID: clientChainLzID, // Action: action, // AssetsAddress: assetsAddress, // WithdrawAddress: withdrawAddress, @@ -75,10 +75,10 @@ type WithdrawParams struct { // }, nil // } -func getStakeIDAndAssetId(params *WithdrawParams) (stakeId string, assetId string) { - clientChainLzIdStr := hexutil.EncodeUint64(params.ClientChainLzId) - stakeId = strings.Join([]string{hexutil.Encode(params.WithdrawAddress[:]), clientChainLzIdStr}, "_") - assetId = strings.Join([]string{hexutil.Encode(params.AssetsAddress[:]), clientChainLzIdStr}, "_") +func getStakeIDAndAssetID(params *WithdrawParams) (stakeID string, assetID string) { + clientChainLzIDStr := hexutil.EncodeUint64(params.ClientChainLzID) + stakeID = strings.Join([]string{hexutil.Encode(params.WithdrawAddress), clientChainLzIDStr}, "_") + assetID = strings.Join([]string{hexutil.Encode(params.AssetsAddress), clientChainLzIDStr}, "_") return } @@ -122,21 +122,21 @@ func (k Keeper) Withdraw(ctx sdk.Context, params *WithdrawParams) error { if params.OpAmount.IsNegative() { return errorsmod.Wrap(withdrawtype.ErrWithdrawAmountIsNegative, fmt.Sprintf("the amount is:%s", params.OpAmount)) } - stakeId, assetId := getStakeIDAndAssetId(params) + stakeID, assetID := getStakeIDAndAssetID(params) // check if asset exist - if !k.restakingStateKeeper.IsStakingAsset(ctx, assetId) { - return errorsmod.Wrap(withdrawtype.ErrWithdrawAssetNotExist, fmt.Sprintf("the assetId is:%s", assetId)) + if !k.restakingStateKeeper.IsStakingAsset(ctx, assetID) { + return errorsmod.Wrap(withdrawtype.ErrWithdrawAssetNotExist, fmt.Sprintf("the assetID is:%s", assetID)) } changeAmount := types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: params.OpAmount.Neg(), CanWithdrawAmountOrWantChangeValue: params.OpAmount.Neg(), } - err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakeId, assetId, changeAmount) + err := k.restakingStateKeeper.UpdateStakerAssetState(ctx, stakeID, assetID, changeAmount) if err != nil { return err } - if err = k.restakingStateKeeper.UpdateStakingAssetTotalAmount(ctx, assetId, params.OpAmount.Neg()); err != nil { + if err = k.restakingStateKeeper.UpdateStakingAssetTotalAmount(ctx, assetID, params.OpAmount.Neg()); err != nil { return err } return nil diff --git a/x/withdraw/keeper/claim_withdraw_test.go b/x/withdraw/keeper/claim_withdraw_test.go index 4bb4250a6..d1457d887 100644 --- a/x/withdraw/keeper/claim_withdraw_test.go +++ b/x/withdraw/keeper/claim_withdraw_test.go @@ -13,14 +13,14 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { usdtAddress := common.HexToAddress("0xdAC17F958D2ee523a2206206994597C13D831ec7") usdcAddress := common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48") event := &keeper.WithdrawParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.WithdrawPrinciple, WithdrawAddress: suite.address[:], OpAmount: sdkmath.NewInt(90), } depositEvent := &depositKeeper.DepositParams{ - ClientChainLzId: 101, + ClientChainLzID: 101, Action: types.Deposit, StakerAddress: suite.address[:], OpAmount: sdkmath.NewInt(100), @@ -40,8 +40,8 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { suite.NoError(err) suite.app.Logger().Info("the assets is:", "assets", assets) - stakerId, assetId := types.GetStakeIDAndAssetId(depositEvent.ClientChainLzId, depositEvent.StakerAddress, depositEvent.AssetsAddress) - info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID := types.GetStakeIDAndAssetID(depositEvent.ClientChainLzID, depositEvent.StakerAddress, depositEvent.AssetsAddress) + info, err := suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: depositEvent.OpAmount, @@ -54,8 +54,8 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { suite.NoError(err) // check state after withdraw - stakerId, assetId = types.GetStakeIDAndAssetId(event.ClientChainLzId, event.WithdrawAddress, event.AssetsAddress) - info, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerId, assetId) + stakerID, assetID = types.GetStakeIDAndAssetID(event.ClientChainLzID, event.WithdrawAddress, event.AssetsAddress) + info, err = suite.app.StakingAssetsManageKeeper.GetStakerSpecifiedAssetInfo(suite.ctx, stakerID, assetID) suite.NoError(err) suite.Equal(types.StakerSingleAssetOrChangeInfo{ TotalDepositAmountOrWantChangeValue: sdkmath.NewInt(10), @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestClaimWithdrawRequest() { WaitUndelegationAmountOrWantChangeValue: sdkmath.NewInt(0), }, *info) - assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetId) + assetInfo, err := suite.app.StakingAssetsManageKeeper.GetStakingAssetInfo(suite.ctx, assetID) suite.NoError(err) suite.Equal(sdkmath.NewInt(10), assetInfo.StakingTotalAmount) } diff --git a/x/withdraw/keeper/msg_server.go b/x/withdraw/keeper/msg_server.go index 71fd4b521..b28983140 100644 --- a/x/withdraw/keeper/msg_server.go +++ b/x/withdraw/keeper/msg_server.go @@ -6,11 +6,12 @@ import ( "github.com/ExocoreNetwork/exocore/x/withdraw/types" ) +// nolint: unused // To be implemented when creating the requests. type msgServer struct { Keeper } -func (k Keeper) UpdateParams(ctx context.Context, params *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k Keeper) UpdateParams(context.Context, *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { // c := sdk.UnwrapSDKContext(ctx) // err := k.SetParams(c, ¶ms.Params) // if err != nil { diff --git a/x/withdraw/keeper/params.go b/x/withdraw/keeper/params.go index f366860c1..dadd48482 100644 --- a/x/withdraw/keeper/params.go +++ b/x/withdraw/keeper/params.go @@ -1,13 +1,8 @@ package keeper import ( - "strings" - paramstypes "github.com/ExocoreNetwork/exocore/x/deposit/types" - types "github.com/ExocoreNetwork/exocore/x/withdraw/types" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" ) // GetParams get all parameters as types.Params @@ -28,18 +23,19 @@ func (k Keeper) GetParams(ctx sdk.Context) (*paramstypes.Params, error) { } // SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params *types.Params) error { - // check if addr is evm address - if !common.IsHexAddress(params.ExoCoreLzAppAddress) { - return types.ErrInvalidEvmAddressFormat - } - if len(common.FromHex(params.ExoCoreLzAppEventTopic)) != common.HashLength { - return types.ErrInvalidLzUaTopicIdLength - } - params.ExoCoreLzAppAddress = strings.ToLower(params.ExoCoreLzAppAddress) - params.ExoCoreLzAppEventTopic = strings.ToLower(params.ExoCoreLzAppEventTopic) - store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixParams) - bz := k.cdc.MustMarshal(params) - store.Set(types.ParamsKey, bz) - return nil +func (k Keeper) SetParams(ctx sdk.Context, params *paramstypes.Params) error { + // // check if addr is evm address + // if !common.IsHexAddress(params.ExoCoreLzAppAddress) { + // return types.ErrInvalidEvmAddressFormat + // } + // if len(common.FromHex(params.ExoCoreLzAppEventTopic)) != common.HashLength { + // return types.ErrInvalidLzUaTopicIDLength + // } + // params.ExoCoreLzAppAddress = strings.ToLower(params.ExoCoreLzAppAddress) + // params.ExoCoreLzAppEventTopic = strings.ToLower(params.ExoCoreLzAppEventTopic) + // store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixParams) + // bz := k.cdc.MustMarshal(params) + // store.Set(types.ParamsKey, bz) + // return nil + return k.depositKeeper.SetParams(ctx, params) } diff --git a/x/withdraw/keeper/params_test.go b/x/withdraw/keeper/params_test.go index ee8bf7ab1..37f43c88b 100644 --- a/x/withdraw/keeper/params_test.go +++ b/x/withdraw/keeper/params_test.go @@ -1,11 +1,11 @@ package keeper_test import ( - withdrawtype "github.com/ExocoreNetwork/exocore/x/withdraw/types" + paramstypes "github.com/ExocoreNetwork/exocore/x/deposit/types" ) func (suite *KeeperTestSuite) TestParams() { - params := &withdrawtype.Params{ + params := ¶mstypes.Params{ ExoCoreLzAppAddress: "0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD", ExoCoreLzAppEventTopic: "0xc6a377bfc4eb120024a8ac08eef205be16b817020812c73223e81d1bdb9708ec", } diff --git a/x/withdraw/keeper/query_params.go b/x/withdraw/keeper/query_params.go index b2654597e..27d691691 100644 --- a/x/withdraw/keeper/query_params.go +++ b/x/withdraw/keeper/query_params.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { c := sdk.UnwrapSDKContext(goCtx) params, err := k.GetParams(c) if err != nil { diff --git a/x/withdraw/module.go b/x/withdraw/module.go index 61f2fb4b4..a01e2e564 100644 --- a/x/withdraw/module.go +++ b/x/withdraw/module.go @@ -58,13 +58,13 @@ func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { types.RegisterInterfaces(reg) } -// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing +// DefaultGenesis returns a default GenesisState for the module, marshaled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { return cdc.MustMarshalJSON(types.DefaultGenesis()) } // ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var genState types.GenesisState if err := cdc.UnmarshalJSON(bz, &genState); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -74,7 +74,9 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module diff --git a/x/withdraw/types/errors.go b/x/withdraw/types/errors.go index 73d302b8c..503ffe80f 100644 --- a/x/withdraw/types/errors.go +++ b/x/withdraw/types/errors.go @@ -10,7 +10,7 @@ import ( var ( ErrSample = errorsmod.Register(ModuleName, 1100, "sample error") ErrInvalidEvmAddressFormat = errorsmod.Register(ModuleName, 0, "the evm address format is error") - ErrInvalidLzUaTopicIdLength = errorsmod.Register(ModuleName, 1, "the LZUaTopicId length isn't equal to HashLength") + ErrInvalidLzUaTopicIDLength = errorsmod.Register(ModuleName, 1, "the LZUaTopicID length isn't equal to HashLength") ErrNoParamsKey = errorsmod.Register(ModuleName, 2, "there is no stored key for params") ErrWithdrawAmountIsNegative = errorsmod.Register(ModuleName, 3, "the withdraw amount is negative") ErrWithdrawAssetNotExist = errorsmod.Register(ModuleName, 4, "the withdraw asset doesn't exist") diff --git a/x/withdraw/types/query.pb.go b/x/withdraw/types/query.pb.go index 6612c2109..0f71e5881 100644 --- a/x/withdraw/types/query.pb.go +++ b/x/withdraw/types/query.pb.go @@ -6,11 +6,11 @@ package types import ( context "context" fmt "fmt" + types "github.com/ExocoreNetwork/exocore/x/deposit/types" _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - types "github.com/ExocoreNetwork/exocore/x/deposit/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -122,26 +122,27 @@ func init() { func init() { proto.RegisterFile("exocore/withdraw/query.proto", fileDescriptor_59bca5e59812c328) } var fileDescriptor_59bca5e59812c328 = []byte{ - // 300 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0xb1, 0x4e, 0xc3, 0x30, - 0x18, 0x84, 0x6b, 0x24, 0x3a, 0x98, 0x05, 0x99, 0x0e, 0x55, 0x54, 0x59, 0x55, 0x01, 0x09, 0x31, - 0xd8, 0x4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bd, 0x46, 0x4e, 0xd8, 0xdf, 0x25, 0xd8, 0x6e, - 0x89, 0xe0, 0xf4, 0x1f, 0xca, 0x97, 0x9a, 0x4d, 0x9f, 0xde, 0x3e, 0x5f, 0xf6, 0x02, 0x32, 0xe6, - 0x3b, 0xe3, 0xfb, 0x0a, 0x57, 0x97, 0xaf, 0x35, 0x45, 0x9b, 0x9a, 0xa2, 0x8f, 0x9a, 0xa2, 0xe7, - 0x86, 0x0e, 0x36, 0x0d, 0x1d, 0xbc, 0x37, 0x74, 0x70, 0x7f, 0xac, 0xb4, 0x5b, 0x14, 0x31, 0x4b, - 0x20, 0xfd, 0x76, 0xaf, 0x7e, 0xfc, 0x6e, 0x6d, 0xa4, 0x8d, 0x87, 0xed, 0x52, 0x17, 0x5f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0xd4, 0x37, 0xe8, 0x06, 0xdd, 0x01, 0x00, 0x00, + // 310 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x90, 0x31, 0x4b, 0x03, 0x31, + 0x14, 0xc7, 0x7b, 0x82, 0x1d, 0xe2, 0x22, 0xb1, 0x43, 0x39, 0x4a, 0x28, 0x45, 0x41, 0x1c, 0x12, + 0xee, 0xfc, 0x06, 0x82, 0x83, 0x20, 0xa2, 0x8e, 0x6e, 0xb9, 0xf6, 0x91, 0x06, 0xed, 0xbd, 0x34, + 0x49, 0x7b, 0xed, 0x26, 0x7e, 0x02, 0xc1, 0x2f, 0xe5, 0x58, 0x70, 0x71, 0x94, 0x9e, 0x1f, 0x44, + 0x7a, 0xb9, 0x53, 0xb4, 0x83, 0x5b, 0x78, 0xff, 0xdf, 0xfb, 0xf1, 0xcf, 0x23, 0x3d, 0x58, 0xe0, + 0x10, 0x2d, 0x88, 0x42, 0xfb, 0xf1, 0xc8, 0xca, 0x42, 0x4c, 0x67, 0x60, 0x97, 0xdc, 0x58, 0xf4, + 0x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xb0, 0x7d, 0x05, 0xbe, 0x40, 0x7b, 0xff, 0x2d, 0x5b, 0xfc, 0xe8, + 0xfc, 0xd2, 0x80, 0xcb, 0xda, 0xd5, 0xe1, 0x4e, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xea, 0xd2, + 0x25, 0x41, 0xec, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/withdraw/types/query.pb.gw.go b/x/withdraw/types/query.pb.gw.go index 0bf7a3bbc..5b7cd856b 100644 --- a/x/withdraw/types/query.pb.gw.go +++ b/x/withdraw/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest @@ -52,12 +54,14 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // 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. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_Params_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 { @@ -65,6 +69,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Params_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) diff --git a/x/withdraw/types/tx.pb.go b/x/withdraw/types/tx.pb.go index 552be4574..b7af85d30 100644 --- a/x/withdraw/types/tx.pb.go +++ b/x/withdraw/types/tx.pb.go @@ -6,13 +6,13 @@ package types import ( context "context" fmt "fmt" + types "github.com/ExocoreNetwork/exocore/x/deposit/types" _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - types "github.com/ExocoreNetwork/exocore/x/deposit/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -136,7 +136,7 @@ func init() { func init() { proto.RegisterFile("exocore/withdraw/tx.proto", fileDescriptor_9fa45fb8759a8d92) } var fileDescriptor_9fa45fb8759a8d92 = []byte{ - // 337 bytes of a gzipped FileDescriptorProto + // 348 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xad, 0xc8, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xd7, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x80, 0x4a, 0xe9, 0xc1, 0xa4, 0xa4, 0xc4, 0x93, 0xf3, @@ -153,12 +153,12 @@ var fileDescriptor_9fa45fb8759a8d92 = []byte{ 0xaa, 0xde, 0x8a, 0xaf, 0xe9, 0xf9, 0x06, 0x2d, 0x84, 0x49, 0x4a, 0x92, 0x5c, 0xe2, 0x68, 0x8e, 0x0a, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x35, 0xca, 0xe2, 0x62, 0xf6, 0x2d, 0x4e, 0x17, 0x8a, 0xe1, 0xe2, 0x41, 0x71, 0xb3, 0xa2, 0x1e, 0x7a, 0xc8, 0xea, 0xa1, 0x99, 0x20, 0xa5, 0x49, - 0x50, 0x09, 0xcc, 0x12, 0x29, 0xd6, 0x86, 0xe7, 0x1b, 0xb4, 0x18, 0x9d, 0x6c, 0x4f, 0x3c, 0x92, + 0x50, 0x09, 0xcc, 0x12, 0x29, 0xd6, 0x86, 0xe7, 0x1b, 0xb4, 0x18, 0x9d, 0x7c, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, - 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0x4a, 0x39, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, - 0x39, 0x3f, 0x57, 0x1f, 0x16, 0xc6, 0x15, 0x48, 0xf1, 0x5d, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, - 0x0e, 0x62, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb3, 0xf5, 0xde, 0xf5, 0x10, 0x02, 0x00, - 0x00, + 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x28, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, + 0x39, 0x3f, 0x57, 0xdf, 0x15, 0x62, 0xaa, 0x5f, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0xb6, 0x3e, 0x2c, + 0xc8, 0x2b, 0x90, 0xa2, 0xbf, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0xe2, 0xc6, 0x80, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xbb, 0x4a, 0x31, 0x2f, 0x1f, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used.