Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: events for Callisto #276

Merged
merged 20 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Build
on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-proto.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check Proto Generation

on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-swagger.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Check Proto Swagger Generation

on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ permissions:
security-events: write

on:
merge_group:
push:
branches: [develop, main, master]
pull_request:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/consensuswarn.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Consensus Warn"

on:
merge_group:
pull_request_target:
types:
- opened
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: "Dependency Review"
# only run on pull requests and not any branch.
on: pull_request
on:
merge_group:
pull_request:

permissions:
contents: read
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docker-localnet.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Docker build for localnet
on:
merge_group:
pull_request:
push:
branches:
Expand All @@ -12,7 +13,7 @@ permissions:
contents: read

jobs:
build:
docker-localnet-build:
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Docker build in root directory
on:
merge_group:
pull_request:
push:
branches:
Expand All @@ -12,7 +13,7 @@ permissions:
contents: read

jobs:
build:
docker-build:
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ permissions:
contents: write

on:
merge_group:
push:
tags:
- "v*.*.*"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Lint
# 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:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Protobuf
# Protobuf runs buf (https://buf.build/) lint and check-breakage
# This workflow is only run when a .proto file has been changed
on:
merge_group:
pull_request:
paths:
- "proto/**"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Run Gosec
on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Semgrep
permissions:
contents: read
on:
merge_group:
# Scan changed files in PRs, block on new issues only (existing issues ignored)
pull_request: {}
push:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ permissions:
contents: read

on:
merge_group:
push:
branches: ["develop", "main", "master"]
pull_request:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: Tests
on:
merge_group:
pull_request:
push:
branches:
Expand Down
1 change: 1 addition & 0 deletions app/ethtest_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
OperatorAddress: operator.String(),
OperatorInfo: operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
ApproveAddr: operator.String(),
OperatorMetaInfo: "operator1",
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
},
Expand Down
1 change: 1 addition & 0 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState,
OperatorInfo: operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
ApproveAddr: operator.String(),
Commission: stakingtypes.NewCommission(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()),
},
},
Expand Down
4 changes: 3 additions & 1 deletion client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@
"url": "./tmp-swagger-gen/exocore/dogfood/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "DogfoodParams"
"Params": "DogfoodParams",
"Validator": "DogfoodValidator",
"Validators": "DogfoodValidators"
}
}
},
Expand Down
443 changes: 422 additions & 21 deletions client/docs/swagger-ui/swagger.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cmd/exocored/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ func getTestExocoreGenesis(
OperatorInfo: operatortypes.OperatorInfo{
EarningsAddr: operator.String(),
OperatorMetaInfo: "operator1",
ApproveAddr: operator.String(),
Commission: stakingtypes.NewCommission(
sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec(),
),
Expand Down
1 change: 1 addition & 0 deletions local_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
# x/operator
jq '.app_state["operator"]["operators"][0]["operator_address"]="'"$LOCAL_ADDRESS_EXO"'"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["earnings_addr"]="'"$LOCAL_ADDRESS_EXO"'"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["approve_addr"]="'"$LOCAL_ADDRESS_EXO"'"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["operator_meta_info"]="operator1"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["commission"]["commission_rates"]["rate"]="0.0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["operator"]["operators"][0]["operator_info"]["commission"]["commission_rates"]["max_rate"]="0.0"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
Expand Down
4 changes: 2 additions & 2 deletions precompiles/assets/assets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (s *AssetsPrecompileSuite) TestRunWithdrawPrincipal() {
AssetsAddress: assetAddress,
OpAmount: depositAmount,
}
err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
_, err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
s.Require().NoError(err)
}

Expand Down Expand Up @@ -909,7 +909,7 @@ func (s *AssetsPrecompileSuite) TestGetStakerBalanceByToken() {
WithdrawableAmount: sdkmath.NewInt(70),
PendingUndelegationAmount: sdkmath.NewInt(30),
}
err = s.App.AssetsKeeper.UpdateStakerAssetState(s.Ctx, stakerID, assetID, assetDelta)
_, err = s.App.AssetsKeeper.UpdateStakerAssetState(s.Ctx, stakerID, assetID, assetDelta)
s.Require().NoError(err)

input, err := s.precompile.Pack(
Expand Down
14 changes: 4 additions & 10 deletions precompiles/assets/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (p Precompile) DepositOrWithdraw(
}

// call assets keeper to perform the deposit or withdraw action
err = p.assetsKeeper.PerformDepositOrWithdraw(ctx, depositWithdrawParams)
finalDepositAmount, err := p.assetsKeeper.PerformDepositOrWithdraw(ctx, depositWithdrawParams)
if err != nil {
return nil, err
}
Expand All @@ -72,13 +72,8 @@ func (p Precompile) DepositOrWithdraw(
}
}

// get the latest asset state of staker to return.
stakerID, assetID := assetstypes.GetStakerIDAndAssetID(depositWithdrawParams.ClientChainLzID, depositWithdrawParams.StakerAddress, depositWithdrawParams.AssetsAddress)
info, err := p.assetsKeeper.GetStakerSpecifiedAssetInfo(ctx, stakerID, assetID)
if err != nil {
return nil, err
}
return method.Outputs.Pack(true, info.TotalDepositAmount.BigInt())
// return the latest asset state of staker
return method.Outputs.Pack(true, finalDepositAmount.BigInt())
}

func (p Precompile) RegisterOrUpdateClientChain(
Expand All @@ -97,8 +92,7 @@ func (p Precompile) RegisterOrUpdateClientChain(
if err != nil {
return nil, err
}
updated := p.assetsKeeper.ClientChainExists(ctx, clientChainInfo.LayerZeroChainID)
err = p.assetsKeeper.SetClientChainInfo(ctx, clientChainInfo)
updated, err := p.assetsKeeper.SetClientChainInfo(ctx, clientChainInfo)
if err != nil {
return nil, err
}
Expand Down
2 changes: 2 additions & 0 deletions precompiles/avs/avs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ func (suite *AVSManagerPrecompileSuite) TestRegisterOperatorToAVS() {
FromAddress: operatorAddress.String(),
Info: &operatortypes.OperatorInfo{
EarningsAddr: operatorAddress.String(),
ApproveAddr: operatorAddress.String(),
},
}
_, err := suite.OperatorMsgServer.RegisterOperator(sdk.WrapSDKContext(suite.Ctx), registerReq)
Expand Down Expand Up @@ -674,6 +675,7 @@ func (suite *AVSManagerPrecompileSuite) TestDeregisterOperatorFromAVS() {
FromAddress: operatorAddress.String(),
Info: &operatortypes.OperatorInfo{
EarningsAddr: operatorAddress.String(),
ApproveAddr: operatorAddress.String(),
},
}
_, err := suite.OperatorMsgServer.RegisterOperator(sdk.WrapSDKContext(suite.Ctx), registerReq)
Expand Down
3 changes: 2 additions & 1 deletion precompiles/avs/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (suite *AVSManagerPrecompileSuite) prepareOperator(addr string) {
FromAddress: suite.operatorAddr.String(),
Info: &operatorTypes.OperatorInfo{
EarningsAddr: suite.operatorAddr.String(),
ApproveAddr: suite.operatorAddr.String(),
},
}
_, err = s.OperatorMsgServer.RegisterOperator(s.Ctx, registerReq)
Expand All @@ -61,7 +62,7 @@ func (suite *AVSManagerPrecompileSuite) prepareDeposit(assetAddr common.Address,
OpAmount: suite.depositAmount,
AssetsAddress: assetAddr[:],
}
err := suite.App.AssetsKeeper.PerformDepositOrWithdraw(suite.Ctx, depositParam)
_, err := suite.App.AssetsKeeper.PerformDepositOrWithdraw(suite.Ctx, depositParam)
suite.NoError(err)
}

Expand Down
6 changes: 4 additions & 2 deletions precompiles/delegation/delegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,15 @@ func (s *DelegationPrecompileSuite) TestRunDelegate() {
AssetsAddress: usdtAddress,
OpAmount: depositAmount,
}
err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
_, err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
s.Require().NoError(err)
}
registerOperator := func() {
registerReq := &operatortypes.RegisterOperatorReq{
FromAddress: opAccAddr,
Info: &operatortypes.OperatorInfo{
EarningsAddr: opAccAddr,
ApproveAddr: opAccAddr,
},
}
_, err := s.OperatorMsgServer.RegisterOperator(s.Ctx, registerReq)
Expand Down Expand Up @@ -301,7 +302,7 @@ func (s *DelegationPrecompileSuite) TestRunUnDelegate() {
AssetsAddress: usdtAddress,
OpAmount: depositAmount,
}
err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
_, err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
s.Require().NoError(err)
}

Expand All @@ -325,6 +326,7 @@ func (s *DelegationPrecompileSuite) TestRunUnDelegate() {
FromAddress: operatorAddr,
Info: &operatortypes.OperatorInfo{
EarningsAddr: operatorAddr,
ApproveAddr: operatorAddr,
},
}
_, err := s.OperatorMsgServer.RegisterOperator(s.Ctx, registerReq)
Expand Down
2 changes: 1 addition & 1 deletion precompiles/reward/reward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (s *RewardPrecompileTestSuite) TestRunRewardThroughClientChain() {
AssetsAddress: usdtAddress,
OpAmount: depositAmount,
}
err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
_, err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
s.Require().NoError(err)
}

Expand Down
2 changes: 1 addition & 1 deletion precompiles/slash/slash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (s *SlashPrecompileTestSuite) TestRunSlash() {
AssetsAddress: usdtAddress,
OpAmount: depositAmount,
}
err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
_, err := s.App.AssetsKeeper.PerformDepositOrWithdraw(s.Ctx, params)
s.Require().NoError(err)
}

Expand Down
1 change: 1 addition & 0 deletions proto/exocore/delegation/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,5 @@ service Query {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/exocore/delegation/v1/delegated_stakers/{operator}/{asset_id}";
}

}
Loading
Loading