From 6dea524983e596a549dba455ba83cd376c1e454a Mon Sep 17 00:00:00 2001 From: rachid Date: Tue, 20 Sep 2022 23:32:49 +0200 Subject: [PATCH 01/27] feat: remove unnecessary keyring dependency --- go.mod | 4 ++-- go.sum | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 5d7ab3079e..cdcfebe2d2 100644 --- a/go.mod +++ b/go.mod @@ -39,6 +39,7 @@ require ( cloud.google.com/go/iam v0.3.0 // indirect cloud.google.com/go/storage v1.14.0 // indirect filippo.io/edwards25519 v1.0.0-rc.1 // indirect + github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect github.com/StackExchange/wmi v1.2.1 // indirect @@ -112,7 +113,6 @@ require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect github.com/klauspost/compress v1.15.6 // indirect github.com/lib/pq v1.10.6 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect @@ -176,8 +176,8 @@ require ( ) replace ( - github.com/99designs/keyring => github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 github.com/cosmos/cosmos-sdk => github.com/celestiaorg/cosmos-sdk v1.3.0-sdk-v0.46.0 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/tendermint/tendermint => github.com/celestiaorg/celestia-core v1.5.0-tm-v0.34.20 ) + diff --git a/go.sum b/go.sum index 8201d8e555..bf6e5b4cb5 100644 --- a/go.sum +++ b/go.sum @@ -71,6 +71,10 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmG filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= +github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= +github.com/99designs/keyring v1.2.1 h1:tYLp1ULvO7i3fI5vE21ReQuj99QFSs7lGm0xWyJo87o= +github.com/99designs/keyring v1.2.1/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= @@ -256,8 +260,6 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.19.0 h1:sgyrjqOkycXiN7Tuupuo4QAldKFg7Sipyfeg/IL7cps= github.com/cosmos/iavl v0.19.0/go.mod h1:l5h9pAB3m5fihB3pXVgwYqdY8aBsMagqz7T0MUjxZeA= -github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= -github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= @@ -271,7 +273,6 @@ github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= -github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= @@ -314,7 +315,6 @@ github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:Htrtb github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac h1:opbrjaN/L8gg6Xh5D04Tem+8xVcz6ajZlGCs49mQgyg= github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= 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/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -659,8 +659,6 @@ github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8 github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= @@ -967,7 +965,6 @@ github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3 github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -1253,7 +1250,6 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From a044dbf3b131228a4bbedfecb2f4841f50127586 Mon Sep 17 00:00:00 2001 From: rachid Date: Tue, 20 Sep 2022 23:37:15 +0200 Subject: [PATCH 02/27] fix: use app Module Basics instead of separately defining them --- testutil/common.go | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/testutil/common.go b/testutil/common.go index 817307e892..edebeae3f8 100644 --- a/testutil/common.go +++ b/testutil/common.go @@ -19,32 +19,23 @@ import ( "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/cosmos/cosmos-sdk/x/auth/vesting" "github.com/cosmos/cosmos-sdk/x/bank" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - "github.com/cosmos/cosmos-sdk/x/crisis" "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - "github.com/cosmos/cosmos-sdk/x/genutil" - "github.com/cosmos/cosmos-sdk/x/mint" "github.com/cosmos/cosmos-sdk/x/params" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" gethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" @@ -58,21 +49,7 @@ import ( var ( // ModuleBasics is a mock module basic manager for testing - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - genutil.AppModuleBasic{}, - bank.AppModuleBasic{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distribution.AppModuleBasic{}, - params.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - vesting.AppModuleBasic{}, - ) + ModuleBasics = app.ModuleBasics // TestingStakeParams is a set of staking params for testing TestingStakeParams = stakingtypes.Params{ UnbondingTime: 100, From ccbea1ae690fa8b535b6f82aaea82ae2bc1de18e Mon Sep 17 00:00:00 2001 From: rachid Date: Tue, 20 Sep 2022 23:38:55 +0200 Subject: [PATCH 03/27] fix: remove ADR unnecessary changelogs --- docs/architecture/ADR-002-QGB-ValSet.md | 4 ---- docs/architecture/ADR-003-QGB-DataCommitment.md | 4 ---- 2 files changed, 8 deletions(-) diff --git a/docs/architecture/ADR-002-QGB-ValSet.md b/docs/architecture/ADR-002-QGB-ValSet.md index 39201f60ed..002c44d6a6 100644 --- a/docs/architecture/ADR-002-QGB-ValSet.md +++ b/docs/architecture/ADR-002-QGB-ValSet.md @@ -1,9 +1,5 @@ # ADR 002: QGB Valsets -## Changelog - -- {date}: {changelog} - ## Context To accommodate the requirements of the [Quantum Gravity Bridge](https://github.com/celestiaorg/quantum-gravity-bridge/blob/master/ethereum/solidity/src/QuantumGravityBridge.sol), We will need to add support for `ValSet`s, i.e. Validator Sets, which reflect the current state of the bridge validators. diff --git a/docs/architecture/ADR-003-QGB-DataCommitment.md b/docs/architecture/ADR-003-QGB-DataCommitment.md index eb57907c04..3caef0e6ed 100644 --- a/docs/architecture/ADR-003-QGB-DataCommitment.md +++ b/docs/architecture/ADR-003-QGB-DataCommitment.md @@ -1,9 +1,5 @@ # ADR 003: QGB Data Commitments -## Changelog - -- {date}: {changelog} - ## Context To accommodate the requirements of the [Quantum Gravity Bridge](https://github.com/celestiaorg/quantum-gravity-bridge/blob/master/ethereum/solidity/src/QuantumGravityBridge.sol), We will need to add support for `DataCommitment`s messages, i.e. commitments generated over a set of blocks to attest their existence. From b71401b2ddfb3b1118afe1620a4ac2f4e8d75b78 Mon Sep 17 00:00:00 2001 From: rachid Date: Tue, 20 Sep 2022 23:39:12 +0200 Subject: [PATCH 04/27] fix: valsets -> valset in ADR --- docs/architecture/ADR-002-QGB-ValSet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/architecture/ADR-002-QGB-ValSet.md b/docs/architecture/ADR-002-QGB-ValSet.md index 002c44d6a6..f0b17db2e3 100644 --- a/docs/architecture/ADR-002-QGB-ValSet.md +++ b/docs/architecture/ADR-002-QGB-ValSet.md @@ -1,4 +1,4 @@ -# ADR 002: QGB Valsets +# ADR 002: QGB ValSet ## Context From 9c12e527ca8787780de1c3185b5f5090013b24c7 Mon Sep 17 00:00:00 2001 From: rachid Date: Tue, 20 Sep 2022 23:43:37 +0200 Subject: [PATCH 05/27] fix: proto Queries -> queries --- proto/qgb/query.proto | 10 +++++----- x/qgb/types/query.pb.go | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/proto/qgb/query.proto b/proto/qgb/query.proto index 8a44b380eb..a60bb4a5a4 100644 --- a/proto/qgb/query.proto +++ b/proto/qgb/query.proto @@ -14,20 +14,20 @@ option go_package = "github.com/celestiaorg/celestia-app/x/qgb/types"; // Query defines the gRPC querier service. service Query { - // Params Queries the current parameters for the qgb module + // Params queries the current parameters for the qgb module rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/qgb/params"; } // attestations' requests queries - // AttestationRequestByNonce Queries attestation request by nonce. + // AttestationRequestByNonce queries attestation request by nonce. // Returns nil if not found. rpc AttestationRequestByNonce(QueryAttestationRequestByNonceRequest) returns (QueryAttestationRequestByNonceResponse) { option (google.api.http).get = "/qgb/attestations/requests/{nonce}"; } - // LatestAttestationNonce Queries latest attestation nonce. + // LatestAttestationNonce queries latest attestation nonce. rpc LatestAttestationNonce(QueryLatestAttestationNonceRequest) returns (QueryLatestAttestationNonceResponse) { option (google.api.http).get = "/qgb/attestations/nonce/latest"; @@ -61,9 +61,9 @@ message QueryAttestationRequestByNonceResponse { [ (cosmos_proto.accepts_interface) = "AttestationRequestI" ]; } -// QueryLatestAttestationNonceRequest Latest attestation nonce request +// QueryLatestAttestationNonceRequest latest attestation nonce request message QueryLatestAttestationNonceRequest {} -// QueryLatestAttestationNonceResponse Latest attestation nonce response +// QueryLatestAttestationNonceResponse latest attestation nonce response message QueryLatestAttestationNonceResponse { uint64 nonce = 1; } // QueryLastValsetRequestBeforeNonceRequest last Valset request before universal diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go index d0b4f96ca5..18bee196bd 100644 --- a/x/qgb/types/query.pb.go +++ b/x/qgb/types/query.pb.go @@ -209,7 +209,7 @@ func (m *QueryAttestationRequestByNonceResponse) GetAttestation() *types.Any { return nil } -// QueryLatestAttestationNonceRequest Latest attestation nonce request +// QueryLatestAttestationNonceRequest latest attestation nonce request type QueryLatestAttestationNonceRequest struct { } @@ -246,7 +246,7 @@ func (m *QueryLatestAttestationNonceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLatestAttestationNonceRequest proto.InternalMessageInfo -// QueryLatestAttestationNonceResponse Latest attestation nonce response +// QueryLatestAttestationNonceResponse latest attestation nonce response type QueryLatestAttestationNonceResponse struct { Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` } @@ -540,12 +540,12 @@ 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 QueryClient interface { - // Params Queries the current parameters for the qgb module + // Params queries the current parameters for the qgb module Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // AttestationRequestByNonce Queries attestation request by nonce. + // AttestationRequestByNonce queries attestation request by nonce. // Returns nil if not found. AttestationRequestByNonce(ctx context.Context, in *QueryAttestationRequestByNonceRequest, opts ...grpc.CallOption) (*QueryAttestationRequestByNonceResponse, error) - // LatestAttestationNonce Queries latest attestation nonce. + // LatestAttestationNonce queries latest attestation nonce. LatestAttestationNonce(ctx context.Context, in *QueryLatestAttestationNonceRequest, opts ...grpc.CallOption) (*QueryLatestAttestationNonceResponse, error) // LastUnbondingHeight LastUnbondingHeight(ctx context.Context, in *QueryLastUnbondingHeightRequest, opts ...grpc.CallOption) (*QueryLastUnbondingHeightResponse, error) @@ -597,12 +597,12 @@ func (c *queryClient) LastUnbondingHeight(ctx context.Context, in *QueryLastUnbo // QueryServer is the server API for Query service. type QueryServer interface { - // Params Queries the current parameters for the qgb module + // Params queries the current parameters for the qgb module Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // AttestationRequestByNonce Queries attestation request by nonce. + // AttestationRequestByNonce queries attestation request by nonce. // Returns nil if not found. AttestationRequestByNonce(context.Context, *QueryAttestationRequestByNonceRequest) (*QueryAttestationRequestByNonceResponse, error) - // LatestAttestationNonce Queries latest attestation nonce. + // LatestAttestationNonce queries latest attestation nonce. LatestAttestationNonce(context.Context, *QueryLatestAttestationNonceRequest) (*QueryLatestAttestationNonceResponse, error) // LastUnbondingHeight LastUnbondingHeight(context.Context, *QueryLastUnbondingHeightRequest) (*QueryLastUnbondingHeightResponse, error) From 953deee132aa32de373b8a4e6cf85cc58f550358 Mon Sep 17 00:00:00 2001 From: rachid Date: Tue, 20 Sep 2022 23:54:33 +0200 Subject: [PATCH 06/27] fix: add LastUnbondingHeight proto docs --- proto/qgb/query.proto | 2 +- x/qgb/types/query.pb.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/qgb/query.proto b/proto/qgb/query.proto index a60bb4a5a4..f6bdecb914 100644 --- a/proto/qgb/query.proto +++ b/proto/qgb/query.proto @@ -35,7 +35,7 @@ service Query { // misc - // LastUnbondingHeight + // LastUnbondingHeight returns the last unbonding height rpc LastUnbondingHeight(QueryLastUnbondingHeightRequest) returns (QueryLastUnbondingHeightResponse) { option (google.api.http).get = "/qgb/unbonding"; diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go index 18bee196bd..3a76a73053 100644 --- a/x/qgb/types/query.pb.go +++ b/x/qgb/types/query.pb.go @@ -547,7 +547,7 @@ type QueryClient interface { AttestationRequestByNonce(ctx context.Context, in *QueryAttestationRequestByNonceRequest, opts ...grpc.CallOption) (*QueryAttestationRequestByNonceResponse, error) // LatestAttestationNonce queries latest attestation nonce. LatestAttestationNonce(ctx context.Context, in *QueryLatestAttestationNonceRequest, opts ...grpc.CallOption) (*QueryLatestAttestationNonceResponse, error) - // LastUnbondingHeight + // LastUnbondingHeight returns the last unbonding height LastUnbondingHeight(ctx context.Context, in *QueryLastUnbondingHeightRequest, opts ...grpc.CallOption) (*QueryLastUnbondingHeightResponse, error) } @@ -604,7 +604,7 @@ type QueryServer interface { AttestationRequestByNonce(context.Context, *QueryAttestationRequestByNonceRequest) (*QueryAttestationRequestByNonceResponse, error) // LatestAttestationNonce queries latest attestation nonce. LatestAttestationNonce(context.Context, *QueryLatestAttestationNonceRequest) (*QueryLatestAttestationNonceResponse, error) - // LastUnbondingHeight + // LastUnbondingHeight returns the last unbonding height LastUnbondingHeight(context.Context, *QueryLastUnbondingHeightRequest) (*QueryLastUnbondingHeightResponse, error) } From 2458e724976790506da501287067a3c2f497da1b Mon Sep 17 00:00:00 2001 From: rachid Date: Tue, 20 Sep 2022 23:58:01 +0200 Subject: [PATCH 07/27] fix: remove unnecessary QGB proto comments --- proto/qgb/query.proto | 7 +------ x/qgb/types/query.pb.go | 6 ------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/proto/qgb/query.proto b/proto/qgb/query.proto index f6bdecb914..a5bb7890d4 100644 --- a/proto/qgb/query.proto +++ b/proto/qgb/query.proto @@ -42,17 +42,14 @@ service Query { } } -// QueryParamsRequest message QueryParamsRequest {} -// QueryParamsResponse + message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } -// QueryAttestationRequestByNonceRequest message QueryAttestationRequestByNonceRequest { uint64 nonce = 1; } -// QueryAttestationRequestByNonceResponse message QueryAttestationRequestByNonceResponse { // AttestationRequestI is either a Data Commitment or a Valset. // This was decided as part of the universal nonce approach under: @@ -74,8 +71,6 @@ message QueryLastValsetRequestBeforeNonceRequest { uint64 nonce = 1; } // response message QueryLastValsetRequestBeforeNonceResponse { Valset valset = 1; } -// QueryLastUnbondingHeightRequest message QueryLastUnbondingHeightRequest {} -// QueryLastUnbondingHeightResponse message QueryLastUnbondingHeightResponse { uint64 height = 1; } diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go index 3a76a73053..3cecfc02b9 100644 --- a/x/qgb/types/query.pb.go +++ b/x/qgb/types/query.pb.go @@ -32,7 +32,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamsRequest type QueryParamsRequest struct { } @@ -69,7 +68,6 @@ func (m *QueryParamsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo -// QueryParamsResponse type QueryParamsResponse struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -114,7 +112,6 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -// QueryAttestationRequestByNonceRequest type QueryAttestationRequestByNonceRequest struct { Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` } @@ -159,7 +156,6 @@ func (m *QueryAttestationRequestByNonceRequest) GetNonce() uint64 { return 0 } -// QueryAttestationRequestByNonceResponse type QueryAttestationRequestByNonceResponse struct { // AttestationRequestI is either a Data Commitment or a Valset. // This was decided as part of the universal nonce approach under: @@ -389,7 +385,6 @@ func (m *QueryLastValsetRequestBeforeNonceResponse) GetValset() *Valset { return nil } -// QueryLastUnbondingHeightRequest type QueryLastUnbondingHeightRequest struct { } @@ -426,7 +421,6 @@ func (m *QueryLastUnbondingHeightRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLastUnbondingHeightRequest proto.InternalMessageInfo -// QueryLastUnbondingHeightResponse type QueryLastUnbondingHeightResponse struct { Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` } From 7fdb18c784e82163a22932b2ec1c3d9605162520 Mon Sep 17 00:00:00 2001 From: rachid Date: Tue, 20 Sep 2022 23:59:41 +0200 Subject: [PATCH 08/27] fix: remove unnecessary QGB proto comments --- proto/qgb/query.proto | 3 +-- x/qgb/types/query.pb.go | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/proto/qgb/query.proto b/proto/qgb/query.proto index a5bb7890d4..fc443be346 100644 --- a/proto/qgb/query.proto +++ b/proto/qgb/query.proto @@ -58,9 +58,8 @@ message QueryAttestationRequestByNonceResponse { [ (cosmos_proto.accepts_interface) = "AttestationRequestI" ]; } -// QueryLatestAttestationNonceRequest latest attestation nonce request message QueryLatestAttestationNonceRequest {} -// QueryLatestAttestationNonceResponse latest attestation nonce response + message QueryLatestAttestationNonceResponse { uint64 nonce = 1; } // QueryLastValsetRequestBeforeNonceRequest last Valset request before universal diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go index 3cecfc02b9..d743f1a2c9 100644 --- a/x/qgb/types/query.pb.go +++ b/x/qgb/types/query.pb.go @@ -205,7 +205,6 @@ func (m *QueryAttestationRequestByNonceResponse) GetAttestation() *types.Any { return nil } -// QueryLatestAttestationNonceRequest latest attestation nonce request type QueryLatestAttestationNonceRequest struct { } @@ -242,7 +241,6 @@ func (m *QueryLatestAttestationNonceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLatestAttestationNonceRequest proto.InternalMessageInfo -// QueryLatestAttestationNonceResponse latest attestation nonce response type QueryLatestAttestationNonceResponse struct { Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` } From ba92fef2e81ec711fbdd7b7d87f84b16492e986c Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:00:41 +0200 Subject: [PATCH 09/27] fix: remove unnecessary TODO --- testutil/common.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/testutil/common.go b/testutil/common.go index edebeae3f8..a16aaa2139 100644 --- a/testutil/common.go +++ b/testutil/common.go @@ -41,9 +41,6 @@ import ( "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" tmversion "github.com/tendermint/tendermint/proto/tendermint/version" - - // TODO add payment module - dbm "github.com/tendermint/tm-db" ) From 7abd03c3e88a81842e86185aa88ce497045ef300 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:23:41 +0200 Subject: [PATCH 10/27] fix: update common.go comment --- testutil/common.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testutil/common.go b/testutil/common.go index a16aaa2139..6ff494576a 100644 --- a/testutil/common.go +++ b/testutil/common.go @@ -111,7 +111,7 @@ var ( sdk.ValAddress(AccPubKeys[4].Address()), } - // OrchPubKeys AccPubKeys holds the pub keys for the account keys + // OrchPubKeys holds the pub keys for the orchestrator OrchPubKeys = []ccrypto.PubKey{ OrchPrivKeys[0].PubKey(), OrchPrivKeys[1].PubKey(), @@ -394,7 +394,7 @@ func SetupFiveValChain(t *testing.T) (TestInput, sdk.Context) { // Set the balance for the account require.NoError(t, input.BankKeeper.MintCoins(input.Context, types.ModuleName, InitCoins)) - // nolint + input.BankKeeper.SendCoinsFromModuleToAccount(input.Context, types.ModuleName, acc.GetAddress(), InitCoins) // Set the account in state @@ -485,7 +485,7 @@ func SetupTestChain(t *testing.T, weights []uint64) (TestInput, sdk.Context) { staking.EndBlocker(input.Context, input.StakingKeeper) } - // some inputs can cause the validator creation ot not work, this checks that + // some inputs can cause the validator creation not to work, this checks that // everything was successful validators := input.StakingKeeper.GetBondedValidatorsByPower(input.Context) require.Equal(t, len(weights), len(validators)) From ae8d3ac41825955cc2f9a6151a42a6f02a9cda28 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:24:37 +0200 Subject: [PATCH 11/27] fix: add Hooks struct docs --- x/qgb/keeper/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/hooks.go b/x/qgb/keeper/hooks.go index 7b2d016fb2..c3afdecf77 100644 --- a/x/qgb/keeper/hooks.go +++ b/x/qgb/keeper/hooks.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// Wrapper struct +// Hooks is a wrapper struct around Keeper. type Hooks struct { k Keeper } From 648e992770666b2a1f44fb1ec2e1d5604038f733 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:24:46 +0200 Subject: [PATCH 12/27] fix: remove nolint from abci_test --- x/qgb/abci_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/x/qgb/abci_test.go b/x/qgb/abci_test.go index 2d2bb40b71..da10fe9f6a 100644 --- a/x/qgb/abci_test.go +++ b/x/qgb/abci_test.go @@ -40,7 +40,6 @@ func TestValsetCreationUponUnbonding(t *testing.T) { // begin unbonding msgServer := stakingkeeper.NewMsgServerImpl(input.StakingKeeper) undelegateMsg := testutil.NewTestMsgUnDelegateValidator(testutil.ValAddrs[0], testutil.StakingAmount) - // nolint _, err = msgServer.Undelegate(input.Context, undelegateMsg) require.NoError(t, err) From dc3660c351e74c650746f7e0e95fcc58b04b1f1f Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:25:18 +0200 Subject: [PATCH 13/27] fix: decapitalize first word of hooks panic --- x/qgb/keeper/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/hooks.go b/x/qgb/keeper/hooks.go index c3afdecf77..d76a73e9ce 100644 --- a/x/qgb/keeper/hooks.go +++ b/x/qgb/keeper/hooks.go @@ -15,7 +15,7 @@ func (k Keeper) Hooks() Hooks { // the chain when called. Keep this check to make such a mistake // obvious if k.storeKey == nil { - panic("Hooks initialized before GravityKeeper!") + panic("hooks initialized before GravityKeeper!") } return Hooks{k} } From 8b9fb3a466c12e282593e6a9230caa5850fecb5c Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:25:52 +0200 Subject: [PATCH 14/27] fix: decapitalize docs --- x/qgb/keeper/keeper_attestation.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/qgb/keeper/keeper_attestation.go b/x/qgb/keeper/keeper_attestation.go index acce29886c..86406c4771 100644 --- a/x/qgb/keeper/keeper_attestation.go +++ b/x/qgb/keeper/keeper_attestation.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// SetAttestationRequest Sets a new attestation request to the store to be signed +// SetAttestationRequest sets a new attestation request to the store to be signed // by orchestrators afterwards. func (k Keeper) SetAttestationRequest(ctx sdk.Context, at types.AttestationRequestI) error { k.StoreAttestation(ctx, at) @@ -23,7 +23,7 @@ func (k Keeper) SetAttestationRequest(ctx sdk.Context, at types.AttestationReque return nil } -// StoreAttestation Saves the attestation in store. +// StoreAttestation saves the attestation in store. // Should panic if overwriting existing one. func (k Keeper) StoreAttestation(ctx sdk.Context, at types.AttestationRequestI) { nonce := at.GetNonce() From bd95387091a494db47500e5a264bf8daf2161053 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:26:12 +0200 Subject: [PATCH 15/27] fix: remove exclamation mark from panic in keeper_attestation.go --- x/qgb/keeper/keeper_attestation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/keeper_attestation.go b/x/qgb/keeper/keeper_attestation.go index 86406c4771..9d1c15b969 100644 --- a/x/qgb/keeper/keeper_attestation.go +++ b/x/qgb/keeper/keeper_attestation.go @@ -45,7 +45,7 @@ func (k Keeper) StoreAttestation(ctx sdk.Context, at types.AttestationRequestI) // expected that this value will only increase by one and it panics otherwise. func (k Keeper) SetLatestAttestationNonce(ctx sdk.Context, nonce uint64) { if k.CheckLatestAttestationNonce(ctx) && k.GetLatestAttestationNonce(ctx)+1 != nonce { - panic("not incrementing latest attestation nonce correctly!") + panic("not incrementing latest attestation nonce correctly") } store := ctx.KVStore(k.storeKey) From 9884669c8387ba7c6fee6e23d66559b1b42df1fe Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:26:36 +0200 Subject: [PATCH 16/27] fix: cosmetics keeper_attestation.go panic --- x/qgb/keeper/keeper_attestation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/keeper_attestation.go b/x/qgb/keeper/keeper_attestation.go index 9d1c15b969..bd0285e878 100644 --- a/x/qgb/keeper/keeper_attestation.go +++ b/x/qgb/keeper/keeper_attestation.go @@ -31,7 +31,7 @@ func (k Keeper) StoreAttestation(ctx sdk.Context, at types.AttestationRequestI) store := ctx.KVStore(k.storeKey) if store.Has(key) { - panic("Trying to overwrite existing attestation request!") + panic("trying to overwrite existing attestation request") } b, err := k.cdc.MarshalInterface(at) From a22b1476784972e252212d06e9eac7be2d8b10c4 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:26:56 +0200 Subject: [PATCH 17/27] fix: cosmetics panic --- x/qgb/keeper/keeper_attestation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/keeper_attestation.go b/x/qgb/keeper/keeper_attestation.go index bd0285e878..027bb24d51 100644 --- a/x/qgb/keeper/keeper_attestation.go +++ b/x/qgb/keeper/keeper_attestation.go @@ -69,7 +69,7 @@ func (k Keeper) GetLatestAttestationNonce(ctx sdk.Context) uint64 { store := ctx.KVStore(k.storeKey) bytes := store.Get([]byte(types.LatestAttestationtNonce)) if bytes == nil { - panic("Nil LatestAttestationNonce") + panic("nil LatestAttestationNonce") } return UInt64FromBytes(bytes) } From 5e4841582a0d2e5dc81df8a2932ff7311f446d00 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:27:16 +0200 Subject: [PATCH 18/27] fix: remove unnecessary docs space --- x/qgb/keeper/keeper_attestation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/keeper_attestation.go b/x/qgb/keeper/keeper_attestation.go index 027bb24d51..bcf5f2723a 100644 --- a/x/qgb/keeper/keeper_attestation.go +++ b/x/qgb/keeper/keeper_attestation.go @@ -75,7 +75,7 @@ func (k Keeper) GetLatestAttestationNonce(ctx sdk.Context) uint64 { } // GetAttestationByNonce returns an attestation request by nonce. -// Returns (nil, false, nil) if the attestation is not found . +// Returns (nil, false, nil) if the attestation is not found. func (k Keeper) GetAttestationByNonce(ctx sdk.Context, nonce uint64) (types.AttestationRequestI, bool, error) { store := ctx.KVStore(k.storeKey) bz := store.Get([]byte(types.GetAttestationKey(nonce))) From 0582f48375633f171ef0733e81bff3573951d278 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:27:56 +0200 Subject: [PATCH 19/27] fix: docs cosmetics --- x/qgb/keeper/keeper_data_commitment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/keeper_data_commitment.go b/x/qgb/keeper/keeper_data_commitment.go index 2757c3f277..269bfb8ec4 100644 --- a/x/qgb/keeper/keeper_data_commitment.go +++ b/x/qgb/keeper/keeper_data_commitment.go @@ -7,7 +7,7 @@ import ( // TODO add unit tests for all the keepers -// GetCurrentDataCommitment Creates latest data commitment at current height according to +// GetCurrentDataCommitment creates latest data commitment at current height according to // the data commitment window specified func (k Keeper) GetCurrentDataCommitment(ctx sdk.Context) (types.DataCommitment, error) { beginBlock := uint64(ctx.BlockHeight()) - k.GetDataCommitmentWindowParam(ctx) From 714a716dcceea223c0dccde20ee161be6aa155c9 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:28:34 +0200 Subject: [PATCH 20/27] fix: docs cosmetics --- x/qgb/keeper/keeper_valset.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/x/qgb/keeper/keeper_valset.go b/x/qgb/keeper/keeper_valset.go index 59d187dcda..f9b202179f 100644 --- a/x/qgb/keeper/keeper_valset.go +++ b/x/qgb/keeper/keeper_valset.go @@ -42,8 +42,9 @@ func (k Keeper) GetLatestValset(ctx sdk.Context) (*types.Valset, error) { panic(sdkerrors.Wrap(sdkerrors.ErrNotFound, "couldn't find latest valset")) } -// SetLastUnBondingBlockHeight sets the last unbonding block height. Note this value is not saved and loaded in genesis -// and is reset to zero on chain upgrade. +// SetLastUnBondingBlockHeight sets the last unbonding block height. Note this +// value is not saved to state or loaded at genesis. This value is reset to zero +// on chain upgrade. func (k Keeper) SetLastUnBondingBlockHeight(ctx sdk.Context, unbondingBlockHeight uint64) { store := ctx.KVStore(k.storeKey) store.Set([]byte(types.LastUnBondingBlockHeight), types.UInt64Bytes(unbondingBlockHeight)) @@ -108,9 +109,12 @@ func (k Keeper) GetCurrentValset(ctx sdk.Context) (types.Valset, error) { // normalizeValidatorPower scales rawPower with respect to totalValidatorPower to take a value between 0 and 2^32 // Uses BigInt operations to avoid overflow errors // Example: rawPower = max (2^63 - 1), totalValidatorPower = 1 validator: (2^63 - 1) -// result: (2^63 - 1) * 2^32 / (2^63 - 1) = 2^32 = 4294967296 [this is the multiplier value below, our max output] +// +// result: (2^63 - 1) * 2^32 / (2^63 - 1) = 2^32 = 4294967296 [this is the multiplier value below, our max output] +// // Example: rawPower = max (2^63 - 1), totalValidatorPower = 1000 validators with the same power: 1000*(2^63 - 1) -// result: (2^63 - 1) * 2^32 / (1000(2^63 - 1)) = 2^32 / 1000 = 4294967 +// +// result: (2^63 - 1) * 2^32 / (1000(2^63 - 1)) = 2^32 / 1000 = 4294967 func normalizeValidatorPower(rawPower uint64, totalValidatorPower cosmosmath.Int) uint64 { // Compute rawPower * multiplier / quotient // Set the upper limit to 2^32, which would happen if there is a single validator with all the power From 16179f8af9bdd6e68e2766a4a43752eca5f22a4f Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:29:27 +0200 Subject: [PATCH 21/27] fix: docs cosmetics --- x/qgb/keeper/keeper_valset.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/x/qgb/keeper/keeper_valset.go b/x/qgb/keeper/keeper_valset.go index f9b202179f..f5cb2d7358 100644 --- a/x/qgb/keeper/keeper_valset.go +++ b/x/qgb/keeper/keeper_valset.go @@ -50,8 +50,9 @@ func (k Keeper) SetLastUnBondingBlockHeight(ctx sdk.Context, unbondingBlockHeigh store.Set([]byte(types.LastUnBondingBlockHeight), types.UInt64Bytes(unbondingBlockHeight)) } -// GetLastUnBondingBlockHeight returns the last unbonding block height, returns zero if not set, this is not -// saved or loaded in genesis and is reset to zero on chain upgrade. +// GetLastUnBondingBlockHeight returns the last unbonding block height or zero +// if not set. This value is not saved or loaded at genesis. This value is reset +// to zero on chain upgrade. func (k Keeper) GetLastUnBondingBlockHeight(ctx sdk.Context) uint64 { store := ctx.KVStore(k.storeKey) bytes := store.Get([]byte(types.LastUnBondingBlockHeight)) From 3ca53ffe1d6284ea866d696051218046dc0ab5cd Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:29:32 +0200 Subject: [PATCH 22/27] fix: docs cosmetics --- x/qgb/keeper/query_valset.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/query_valset.go b/x/qgb/keeper/query_valset.go index 36b8cb731f..56adea4ea1 100644 --- a/x/qgb/keeper/query_valset.go +++ b/x/qgb/keeper/query_valset.go @@ -9,7 +9,7 @@ import ( // TODO add unit tests for all of these requests -// LastValsetBeforeHeight queries the last valset request before height +// LastValsetRequestBeforeNonce queries the last valset request before nonce func (k Keeper) LastValsetRequestBeforeNonce( c context.Context, req *types.QueryLastValsetRequestBeforeNonceRequest, From 8a59aa88096a8b959f7d26b010ce96807fcec6f3 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:32:04 +0200 Subject: [PATCH 23/27] fix: docs cosmetics --- x/qgb/types/genesis.go | 2 +- x/qgb/types/valset.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x/qgb/types/genesis.go b/x/qgb/types/genesis.go index 0ccdba7207..3019321bee 100644 --- a/x/qgb/types/genesis.go +++ b/x/qgb/types/genesis.go @@ -40,7 +40,7 @@ func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } -// ParamSetPairs implements the ParamSet interface and returns all the key/value pairs +// ParamSetPairs implements the ParamSet interface and returns all the key/value // pairs of auth module's parameters. func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ diff --git a/x/qgb/types/valset.go b/x/qgb/types/valset.go index 995db2a070..eabebc5bb7 100644 --- a/x/qgb/types/valset.go +++ b/x/qgb/types/valset.go @@ -55,7 +55,7 @@ func (v *Valset) SignBytes(bridgeID ethcmn.Hash) (ethcmn.Hash, error) { return hash, nil } -// Hash mimics the 'computeValsetHash' function used the qgb contracts by using +// Hash mimics the 'computeValsetHash' function used by the qgb contracts by using // a Valset to compute the hash of the abi encoded validator set. func (v *Valset) Hash() (ethcmn.Hash, error) { ethVals := make([]wrapper.Validator, len(v.Members)) From bfc84e05fcadb78386477d5848e3115b94503221 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:38:32 +0200 Subject: [PATCH 24/27] Revert "fix: remove unnecessary QGB proto comments" This reverts commit 7fdb18c784e82163a22932b2ec1c3d9605162520. --- proto/qgb/query.proto | 3 ++- x/qgb/types/query.pb.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/proto/qgb/query.proto b/proto/qgb/query.proto index fc443be346..a5bb7890d4 100644 --- a/proto/qgb/query.proto +++ b/proto/qgb/query.proto @@ -58,8 +58,9 @@ message QueryAttestationRequestByNonceResponse { [ (cosmos_proto.accepts_interface) = "AttestationRequestI" ]; } +// QueryLatestAttestationNonceRequest latest attestation nonce request message QueryLatestAttestationNonceRequest {} - +// QueryLatestAttestationNonceResponse latest attestation nonce response message QueryLatestAttestationNonceResponse { uint64 nonce = 1; } // QueryLastValsetRequestBeforeNonceRequest last Valset request before universal diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go index d743f1a2c9..3cecfc02b9 100644 --- a/x/qgb/types/query.pb.go +++ b/x/qgb/types/query.pb.go @@ -205,6 +205,7 @@ func (m *QueryAttestationRequestByNonceResponse) GetAttestation() *types.Any { return nil } +// QueryLatestAttestationNonceRequest latest attestation nonce request type QueryLatestAttestationNonceRequest struct { } @@ -241,6 +242,7 @@ func (m *QueryLatestAttestationNonceRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLatestAttestationNonceRequest proto.InternalMessageInfo +// QueryLatestAttestationNonceResponse latest attestation nonce response type QueryLatestAttestationNonceResponse struct { Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` } From 6c39ed64a1eaa4058d725e19856b035c8ff914d8 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:38:42 +0200 Subject: [PATCH 25/27] Revert "fix: remove unnecessary QGB proto comments" This reverts commit 2458e724976790506da501287067a3c2f497da1b. --- proto/qgb/query.proto | 7 ++++++- x/qgb/types/query.pb.go | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/proto/qgb/query.proto b/proto/qgb/query.proto index a5bb7890d4..f6bdecb914 100644 --- a/proto/qgb/query.proto +++ b/proto/qgb/query.proto @@ -42,14 +42,17 @@ service Query { } } +// QueryParamsRequest message QueryParamsRequest {} - +// QueryParamsResponse message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } +// QueryAttestationRequestByNonceRequest message QueryAttestationRequestByNonceRequest { uint64 nonce = 1; } +// QueryAttestationRequestByNonceResponse message QueryAttestationRequestByNonceResponse { // AttestationRequestI is either a Data Commitment or a Valset. // This was decided as part of the universal nonce approach under: @@ -71,6 +74,8 @@ message QueryLastValsetRequestBeforeNonceRequest { uint64 nonce = 1; } // response message QueryLastValsetRequestBeforeNonceResponse { Valset valset = 1; } +// QueryLastUnbondingHeightRequest message QueryLastUnbondingHeightRequest {} +// QueryLastUnbondingHeightResponse message QueryLastUnbondingHeightResponse { uint64 height = 1; } diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go index 3cecfc02b9..3a76a73053 100644 --- a/x/qgb/types/query.pb.go +++ b/x/qgb/types/query.pb.go @@ -32,6 +32,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryParamsRequest type QueryParamsRequest struct { } @@ -68,6 +69,7 @@ func (m *QueryParamsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo +// QueryParamsResponse type QueryParamsResponse struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -112,6 +114,7 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// QueryAttestationRequestByNonceRequest type QueryAttestationRequestByNonceRequest struct { Nonce uint64 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` } @@ -156,6 +159,7 @@ func (m *QueryAttestationRequestByNonceRequest) GetNonce() uint64 { return 0 } +// QueryAttestationRequestByNonceResponse type QueryAttestationRequestByNonceResponse struct { // AttestationRequestI is either a Data Commitment or a Valset. // This was decided as part of the universal nonce approach under: @@ -385,6 +389,7 @@ func (m *QueryLastValsetRequestBeforeNonceResponse) GetValset() *Valset { return nil } +// QueryLastUnbondingHeightRequest type QueryLastUnbondingHeightRequest struct { } @@ -421,6 +426,7 @@ func (m *QueryLastUnbondingHeightRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryLastUnbondingHeightRequest proto.InternalMessageInfo +// QueryLastUnbondingHeightResponse type QueryLastUnbondingHeightResponse struct { Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` } From 19c8c559a1d544b20faf84c65fa2892d35a830d9 Mon Sep 17 00:00:00 2001 From: rachid Date: Wed, 21 Sep 2022 00:40:05 +0200 Subject: [PATCH 26/27] fix: add no linter for common.go input.BankKeeper.SendCoinsFromModuleToAccount --- testutil/common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testutil/common.go b/testutil/common.go index 6ff494576a..9ef631c021 100644 --- a/testutil/common.go +++ b/testutil/common.go @@ -394,7 +394,7 @@ func SetupFiveValChain(t *testing.T) (TestInput, sdk.Context) { // Set the balance for the account require.NoError(t, input.BankKeeper.MintCoins(input.Context, types.ModuleName, InitCoins)) - + // nolint input.BankKeeper.SendCoinsFromModuleToAccount(input.Context, types.ModuleName, acc.GetAddress(), InitCoins) // Set the account in state From 92502997778b4323acf0340d210a3322e825709a Mon Sep 17 00:00:00 2001 From: CHAMI Rachid Date: Wed, 21 Sep 2022 17:13:44 +0200 Subject: [PATCH 27/27] Update x/qgb/keeper/hooks.go Co-authored-by: Rootul P --- x/qgb/keeper/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/qgb/keeper/hooks.go b/x/qgb/keeper/hooks.go index d76a73e9ce..e68e625da1 100644 --- a/x/qgb/keeper/hooks.go +++ b/x/qgb/keeper/hooks.go @@ -15,7 +15,7 @@ func (k Keeper) Hooks() Hooks { // the chain when called. Keep this check to make such a mistake // obvious if k.storeKey == nil { - panic("hooks initialized before GravityKeeper!") + panic("hooks initialized before GravityKeeper") } return Hooks{k} }