Skip to content

Commit

Permalink
chore(ci): re-attempt fix (#8)
Browse files Browse the repository at this point in the history
* chore(ci): fix DeliverTx

* chore(ci): disable Solidity test

* chore(build): remove extra tab

* chore(build): lint the proto files

* chore(build): generate proto

* chore(build): update for new proto

* chore(ci): remove blank line

* chore(lint): remove unused params

* chore(ci): upgrade vuln deps

* chore(ci): e2e test workflow

* chore(ci): disable e2e tests, we have none

* chore(ci): disable codecov upload

* chore(ci): fail only high vuln deps
  • Loading branch information
MaxMustermann2 authored Mar 4, 2024
1 parent 15dfdd6 commit a524619
Show file tree
Hide file tree
Showing 50 changed files with 897 additions and 803 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- name: "Dependency Review"
uses: actions/dependency-review-action@v3
if: env.GIT_DIFF
with:
fail-on-severity: high
- name: "Go vulnerability check"
run: make vulncheck
if: env.GIT_DIFF
2 changes: 2 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:

jobs:
test-e2e:
# disabled for now, since we don't have any e2e tests.
if: ${{ false }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/solidity-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:

jobs:
test-solidity:
# disabled for now, since we don't have any Solidity files.
if: ${{ false }}
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
make test-unit-cover
if: env.GIT_DIFF
- uses: codecov/codecov-action@v3
# disabled for now, since we don't have any codecov
if: ${{ false }}
with:
file: ./coverage.txt
fail_ci_if_error: true
if: env.GIT_DIFF
# if: env.GIT_DIFF
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /go/src/github.com/ExocoreNetwork/exocore

COPY go.mod go.sum ./

RUN set -eux; apk add --no-cache ca-certificates=20230506-r0 build-base=0.5-r3 git=2.40.1-r0 linux-headers=6.3-r0
RUN apk add --no-cache ca-certificates=20230506-r0 build-base=0.5-r3 git=2.40.1-r0 linux-headers=6.3-r0

RUN --mount=type=bind,target=. --mount=type=secret,id=GITHUB_TOKEN \
git config --global url."https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/".insteadOf "https://github.com/"; \
Expand All @@ -23,7 +23,7 @@ WORKDIR /root
COPY --from=build-env /go/src/github.com/ExocoreNetwork/exocore/build/exocored /usr/bin/exocored
COPY --from=build-env /go/bin/toml-cli /usr/bin/toml-cli

RUN apk add --no-cache ca-certificates=20230506-r0 jq=1.6-r3 curl=8.2.1-r0 bash=5.2.15-r5 vim=9.0.1568-r0 lz4=1.9.4-r4 rclone=1.62.2-r3 \
RUN apk add --no-cache ca-certificates=20230506-r0 jq=1.6-r4 curl=8.5.0-r0 bash=5.2.15-r5 vim=9.0.2073-r0 lz4=1.9.4-r4 rclone=1.62.2-r6 \
&& addgroup -g 1000 exocore \
&& adduser -S -h /home/exocore -D exocore -u 1000 -G exocore

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ ifdef GITHUB_TOKEN
DOCKER_ARGS += --secret id=GITHUB_TOKEN
endif
endif
NAMESPACE := tharsishq
NAMESPACE := ExocoreNetwork
PROJECT := exocore
DOCKER_IMAGE := $(NAMESPACE)/$(PROJECT)
DOCKER_IMAGE := $(shell echo $(NAMESPACE)/$(PROJECT) | tr '[:upper:]' '[:lower:]')
COMMIT_HASH := $(shell git rev-parse --short=7 HEAD)
DOCKER_TAG := $(COMMIT_HASH)
# e2e env
Expand Down Expand Up @@ -412,7 +412,7 @@ proto-format:

proto-lint:
@echo "Linting Protobuf files"
@$(protoImage) buf lint --error-format=json
@$(protoImage) buf lint --error-format=json

proto-check-breaking:
@echo "Checking Protobuf files for breaking changes"
Expand Down
14 changes: 14 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,20 @@ func (app *ExocoreApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abc
return app.mm.EndBlock(ctx, req)
}

// The DeliverTx method is intentionally decomposed to calculate the transactions per second.
func (app *ExocoreApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx) {
defer func() {
// TODO: Record the count along with the code and or reason so as to display
// in the transactions per second live dashboards.
if res.IsErr() {
app.tpsCounter.incrementFailure()
} else {
app.tpsCounter.incrementSuccess()
}
}()
return app.BaseApp.DeliverTx(req)
}

// InitChainer updates at chain initialization
func (app *ExocoreApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
var genesisState simapp.GenesisState
Expand Down
2 changes: 0 additions & 2 deletions app/tps_counter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ 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
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
golang.org/x/crypto v0.12.0
golang.org/x/exp v0.0.0-20230811145659-89c5cff77bcb
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e
google.golang.org/grpc v1.57.0
google.golang.org/grpc v1.57.1
sigs.k8s.io/yaml v1.3.0
)

Expand Down Expand Up @@ -97,7 +97,7 @@ require (
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dvsekhvalnov/jose2go v1.5.0 // indirect
github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88 // indirect
github.com/edsrzf/mmap-go v1.0.0 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM=
github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88 h1:y87odSHhV8WSSnjuFYC+K2V6LpZtEVcjmVWxtUkXZiQ=
github.com/dvsekhvalnov/jose2go v1.5.1-0.20231206184617-48ba0b76bc88/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
Expand Down Expand Up @@ -2232,6 +2234,8 @@ google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwS
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw=
google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg=
google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
Expand Down
31 changes: 17 additions & 14 deletions proto/exocore/delegation/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,59 @@ 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 staker_id = 1 [(gogoproto.customname) = "StakerID"];
string asset_id = 2 [(gogoproto.customname) = "AssetID"];
}

message DelegationAmounts{
string CanUndelegationAmount = 1
message DelegationAmounts {
string can_undelegation_amount = 1
[
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string WaitUndelegationAmount = 2
string wait_undelegation_amount = 2
[
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
}

message QueryDelegationInfoResponse{
string TotalDelegatedAmount = 1
message QueryDelegationInfoResponse {
string total_delegated_amount = 1
[
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
map<string, DelegationAmounts > delegationInfos = 2;
map<string, DelegationAmounts > delegation_infos = 2;
}

message SingleDelegationInfoReq {
string stakerID = 1;
string operatorAddr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string assetID = 3;
string staker_id = 1 [(gogoproto.customname) = "StakerID"];
string operator_addr = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string asset_id = 3 [(gogoproto.customname) = "AssetID"];
}

message QueryOperatorInfoReq {
string OperatorAddr = 1
string operator_addr = 1
[(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// Query is the service API for the delegation module.
service Query {
// OperatorInfo queries the operator information.
rpc QueryOperatorInfo(QueryOperatorInfoReq) returns(OperatorInfo){
option (google.api.http).get = "/exocore/delegation/v1/GetOperatorInfo";
}
// Balance queries the balance of a single coin for a single account.
// DelegationInfo queries the delegation information for {stakerID, assetID}.
rpc QueryDelegationInfo(DelegationInfoReq) returns (QueryDelegationInfoResponse) {
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/exocore/delegation/v1/GetDelegationInfo";
}

// SingleDelegationInfo queries the single delegation information for
// {chain, staker, asset, operator}.
rpc QuerySingleDelegationInfo(SingleDelegationInfoReq) returns(DelegationAmounts){
option (cosmos.query.v1.module_query_safe) = true;
option (google.api.http).get = "/exocore/delegation/v1/QuerySingleDelegationInfo";
Expand Down
76 changes: 39 additions & 37 deletions proto/exocore/delegation/v1/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "amino/amino.proto";
option go_package = "github.com/ExocoreNetwork/exocore/x/delegation/types";

message ValueField {
string Amount = 1
string amount = 1
[
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
Expand All @@ -19,30 +19,30 @@ message ValueField {
}

message DelegatedSingleAssetInfo {
string AssetID = 1;
string TotalDelegatedAmount = 2
string asset_id = 1 [(gogoproto.customname) = "AssetID"];
string total_delegated_amount = 2
[
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
map<string, ValueField> PerOperatorAmounts = 3;
map<string, ValueField> per_operator_amounts = 3;
}

message clientChainEarningAddrList {
repeated clientChainEarningAddrInfo EarningInfoList = 1;
message ClientChainEarningAddrList {
repeated ClientChainEarningAddrInfo earning_info_list = 1;
}

message clientChainEarningAddrInfo {
uint64 lzClientChainID = 1;
string clientChainEarningAddr = 2;
message ClientChainEarningAddrInfo {
uint64 lz_client_chain_id = 1 [(gogoproto.customname) = "LzClientChainID"];
string client_chain_earning_addr = 2;
}

message OperatorInfo{
string EarningsAddr = 1;
string ApproveAddr = 2;
string OperatorMetaInfo = 3;
clientChainEarningAddrList ClientChainEarningsAddr = 4;
message OperatorInfo {
string earnings_addr = 1;
string approve_addr = 2;
string operator_meta_info = 3;
ClientChainEarningAddrList client_chain_earnings_addr = 4;
}

message RegisterOperatorReq {
Expand All @@ -51,52 +51,52 @@ message RegisterOperatorReq {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string FromAddress = 1
string from_address = 1
[(cosmos_proto.scalar) = "cosmos.AddressString"];
OperatorInfo info = 2;
}

message DelegationApproveInfo{
message DelegationApproveInfo {
string signature = 1;
string salt = 2;
}

message RegisterOperatorResponse{}

message DelegationIncOrDecInfo{
message DelegationIncOrDecInfo {
option (cosmos.msg.v1.signer) = "fromAddress";
option (amino.name) = "cosmos-sdk/MsgAddOrDecreaseDelegation";

option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string fromAddress = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

map<string, ValueField> perOperatorAmounts = 2;
map<string, ValueField> per_operator_amounts = 2;
}

message MsgDelegation{
DelegationIncOrDecInfo baseInfo = 1;
DelegationApproveInfo approvedInfo = 2;
message MsgDelegation {
DelegationIncOrDecInfo base_info = 1;
DelegationApproveInfo approved_info = 2;
}

message UndelegationRecord{
string stakerID = 1;
string assetID = 2;
string OperatorAddr = 3
message UndelegationRecord {
string staker_id = 1 [(gogoproto.customname) = "StakerID"];
string asset_id = 2 [(gogoproto.customname) = "AssetID"];
string operator_addr = 3
[(cosmos_proto.scalar) = "cosmos.AddressString"];
string txHash = 4;
bool isPending = 5;
uint64 BlockNumber = 6;
uint64 CompleteBlockNumber = 7;
uint64 LzTxNonce = 8;
string tx_hash = 4;
bool is_pending = 5;
uint64 block_number = 6;
uint64 complete_block_number = 7;
uint64 lz_tx_nonce = 8;
string amount = 9
[
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.nullable) = false
];
string actualCompletedAmount =10
string actual_completed_amount =10
[
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
Expand All @@ -105,22 +105,24 @@ message UndelegationRecord{
}

message UndelegationRecordKeyList {
repeated string keyList = 1;
repeated string key_list = 1;
}

message DelegationResponse{}
message DelegationResponse {}

message MsgUndelegation{
DelegationIncOrDecInfo baseInfo = 1;
message MsgUndelegation {
DelegationIncOrDecInfo base_info = 1;
}
message UndelegationResponse{}

// Msg defines the delegation Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// CreateClawbackVestingAccount creats a vesting account that is subject to clawback.
// RegisterOperator registers a new operator.
rpc RegisterOperator(RegisterOperatorReq) returns (RegisterOperatorResponse);
// DelegateAssetToOperator delegates asset to operator.
rpc DelegateAssetToOperator(MsgDelegation) returns (DelegationResponse);
// UndelegateAssetFromOperator undelegates asset from operator.
rpc UndelegateAssetFromOperator(MsgUndelegation) returns (UndelegationResponse);
}

Expand Down
6 changes: 4 additions & 2 deletions proto/exocore/deposit/v1/deposit.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ option go_package = "github.com/ExocoreNetwork/exocore/x/deposit/types";

// GenesisState defines the restaking_assets_manage module's genesis state.
message Params {
string exoCoreLzAppAddress = 1;
string exoCoreLzAppEventTopic =2;
string exocore_lz_app_address = 1
[(gogoproto.customname) = "ExoCoreLzAppAddress"];
string exocore_lz_app_event_topic = 2
[(gogoproto.customname) = "ExoCoreLzAppEventTopic"];
}
3 changes: 0 additions & 3 deletions proto/exocore/deposit/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
syntax = "proto3";
package exocore.deposit.v1;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/query/v1/query.proto";
import "cosmos_proto/cosmos.proto";
import "exocore/deposit/v1/deposit.proto";

option go_package = "github.com/ExocoreNetwork/exocore/x/deposit/types";
Expand Down
Loading

0 comments on commit a524619

Please sign in to comment.