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: add header and comet info service #15850

Merged
merged 38 commits into from
May 3, 2023
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
63cc148
experimentation of block info service
tac0turtle Apr 15, 2023
0ed3898
remove nil check
tac0turtle Apr 15, 2023
1d97881
move blockinfo to types
tac0turtle Apr 15, 2023
ef59eb7
define our own types
tac0turtle Apr 16, 2023
0144793
fix build
tac0turtle Apr 16, 2023
947de98
fix build
tac0turtle Apr 16, 2023
d9437f2
address comments
tac0turtle Apr 16, 2023
5f772ce
fix build & lint
tac0turtle Apr 17, 2023
e1f53cc
Merge branch 'main' into marko/block_info
tac0turtle Apr 17, 2023
3f136c0
fix build & lint
tac0turtle Apr 17, 2023
cf9b6d7
minor change
tac0turtle Apr 17, 2023
a5d72fd
fix test
tac0turtle Apr 17, 2023
7ed99df
fix tests
tac0turtle Apr 17, 2023
ec6f5d5
add getblockinfo
tac0turtle Apr 17, 2023
56c340e
implement changes
tac0turtle Apr 17, 2023
5b1cd47
address feedback
tac0turtle Apr 18, 2023
0206cb2
Merge branch 'main' into marko/block_info
tac0turtle Apr 18, 2023
a6d45bf
adjust adr
tac0turtle Apr 18, 2023
6995674
make it structs
tac0turtle Apr 18, 2023
06fcbe5
update docs
tac0turtle Apr 18, 2023
22ae764
add docs
tac0turtle Apr 18, 2023
4b85274
fixxie
tac0turtle Apr 18, 2023
46fee3c
WIP on comet block info (#15889)
aaronc Apr 24, 2023
2cfb91d
fix
tac0turtle Apr 25, 2023
9c509b2
minor changes
tac0turtle Apr 25, 2023
99903f9
adjust changes
tac0turtle Apr 25, 2023
d3b8000
implement voteinfos interface
tac0turtle Apr 26, 2023
f6aafd0
rename comet.Service to comet.InfoService
tac0turtle Apr 28, 2023
a6f68c0
address cosmetic changes
tac0turtle Apr 30, 2023
938b449
fix evidence integration tests
tac0turtle Apr 30, 2023
5d313a1
Merge branch 'main' into marko/block_info
tac0turtle Apr 30, 2023
02e3dde
fix build
tac0turtle May 1, 2023
640086d
Merge branch 'main' into marko/block_info
tac0turtle May 2, 2023
95864c7
fix tests
tac0turtle May 2, 2023
238de6d
Merge branch 'main' into marko/block_info
tac0turtle May 3, 2023
b9f01ea
migrate evidence to use len and get
tac0turtle May 3, 2023
3a692ec
fix lint and test in evidence module
tac0turtle May 3, 2023
abf9ac7
fix integration test and go mod tidy all modules
tac0turtle May 3, 2023
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
Prev Previous commit
Next Next commit
Merge branch 'main' into marko/block_info
tac0turtle committed Apr 30, 2023
commit 5d313a1acca052096526b0236018d250dd94b4df
2 changes: 2 additions & 0 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
@@ -284,6 +284,7 @@ func (app *BaseApp) PrepareProposal(req abci.RequestPrepareProposal) (resp abci.
}

app.prepareProposalState.ctx = app.getContextForProposal(app.prepareProposalState.ctx, req.Height).
WithVoteInfos(toVoteInfo(req.LocalLastCommit.Votes)). // this is a set of votes that are not finalized yet, wait for commit
WithBlockHeight(req.Height).
WithBlockTime(req.Time).
WithProposer(req.ProposerAddress).
@@ -341,6 +342,7 @@ func (app *BaseApp) ProcessProposal(req abci.RequestProcessProposal) (resp abci.
app.setState(runTxProcessProposal, emptyHeader)

app.processProposalState.ctx = app.getContextForProposal(app.processProposalState.ctx, req.Height).
WithVoteInfos(req.ProposedLastCommit.Votes). // this is a set of votes that are not finalized yet, wait for commit
WithBlockHeight(req.Height).
WithBlockTime(req.Time).
WithHeaderHash(req.Hash).
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -163,6 +163,9 @@ require (
// Below are the long-lived replace of the Cosmos SDK
replace (
cosmossdk.io/core => ./core
cosmossdk.io/store => ./store
// TODO: remove after release 0.6.2
cosmossdk.io/x/tx => ./x/tx
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
32 changes: 32 additions & 0 deletions runtime/module.go
Original file line number Diff line number Diff line change
@@ -6,7 +6,9 @@ import (

runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1"
appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cosmos/gogoproto/proto"
@@ -237,3 +239,33 @@ func ProvideCometInfoService() comet.InfoService {
func ProvideHeaderInfoService(app *AppBuilder) header.Service {
return headerInfoService{}
}

// globalAccAddressCodec is a temporary address codec that we will use until we
// can populate it with the correct bech32 prefixes without depending on the global.
type globalAccAddressCodec struct{}

func (g globalAccAddressCodec) StringToBytes(text string) ([]byte, error) {
if text == "" {
return nil, nil
}
return sdk.AccAddressFromBech32(text)
}

func (g globalAccAddressCodec) BytesToString(bz []byte) (string, error) {
if bz == nil {
return "", nil
}
return sdk.AccAddress(bz).String(), nil
}

// globalValAddressCodec is a temporary address codec that we will use until we
// can populate it with the correct bech32 prefixes without depending on the global.
type globalValAddressCodec struct{}

func (g globalValAddressCodec) StringToBytes(text string) ([]byte, error) {
return sdk.ValAddressFromBech32(text)
}

func (g globalValAddressCodec) BytesToString(bz []byte) (string, error) {
return sdk.ValAddress(bz).String(), nil
}
2 changes: 1 addition & 1 deletion simapp/go.mod
Original file line number Diff line number Diff line change
@@ -204,9 +204,9 @@ replace (
cosmossdk.io/x/evidence => ../x/evidence
cosmossdk.io/x/feegrant => ../x/feegrant
cosmossdk.io/x/nft => ../x/nft
cosmossdk.io/x/upgrade => ../x/upgrade
// TODO: remove after release 0.6.2
cosmossdk.io/x/tx => ../x/tx
cosmossdk.io/x/upgrade => ../x/upgrade
)

// Below are the long-lived replace of the SimApp
2 changes: 0 additions & 2 deletions simapp/go.sum
Original file line number Diff line number Diff line change
@@ -198,8 +198,6 @@ cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0=
cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4=
cosmossdk.io/math v1.0.0 h1:ro9w7eKx23om2tZz/VM2Pf+z2WAbGX1yDQQOJ6iGeJw=
cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k=
cosmossdk.io/x/tx v0.6.1 h1:WwPkb7bfxGqrCKgPZuL6oW/9R51ufeFzWaXwIva6dVk=
cosmossdk.io/x/tx v0.6.1/go.mod h1:ps6ZlSuAjZFvHjZb7Kqp51Kf/UHQ/nEdEbjzXaYUhIk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
2 changes: 1 addition & 1 deletion tests/go.mod
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ require (
pgregory.net/rapid v0.5.7
)

require cosmossdk.io/core v0.6.1
require cosmossdk.io/core v0.6.2-0.20230323161322-ccd8d40119e4

require (
cloud.google.com/go v0.110.0 // indirect
9 changes: 5 additions & 4 deletions tests/integration/evidence/keeper/infraction_test.go
Original file line number Diff line number Diff line change
@@ -6,15 +6,16 @@ import (
"testing"
"time"

abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"

"cosmossdk.io/core/comet"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"cosmossdk.io/x/evidence/exported"
"cosmossdk.io/x/evidence/keeper"
"cosmossdk.io/x/evidence/testutil"
"cosmossdk.io/x/evidence/types"
abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"

codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
6 changes: 3 additions & 3 deletions tools/rosetta/go.mod
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@ require (
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230412222916-60cfeb46143b // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-db v1.0.0-rc.1 // indirect
github.com/cosmos/cosmos-proto v1.0.0-beta.3 // indirect
@@ -142,7 +141,8 @@ require (

// TODO: remove after merge of https://github.com/cosmos/cosmos-sdk/pull/15873 and tagging releases
replace (
github.com/cosmos/cosmos-sdk => ../..
cosmossdk.io/x/tx => ../../x/tx
cosmossdk.io/core => ../../core
cosmossdk.io/store => ../../store
cosmossdk.io/x/tx => ../../x/tx
github.com/cosmos/cosmos-sdk => ../..
)
10 changes: 0 additions & 10 deletions tools/rosetta/go.sum
Original file line number Diff line number Diff line change
@@ -39,8 +39,6 @@ cosmossdk.io/api v0.4.1 h1:0ikaYM6GyxTYYcfBiyR8YnLCfhNnhKpEFnaSepCTmqg=
cosmossdk.io/api v0.4.1/go.mod h1:jR7k5ok90LxW2lFUXvd8Vpo/dr4PpiyVegxdm7b1ZdE=
cosmossdk.io/collections v0.1.0 h1:nzJGeiq32KnZroSrhB6rPifw4I85Cgmzw/YAmr4luv8=
cosmossdk.io/collections v0.1.0/go.mod h1:xbauc0YsbUF8qKMVeBZl0pFCunxBIhKN/WlxpZ3lBuo=
cosmossdk.io/core v0.6.1 h1:OBy7TI2W+/gyn2z40vVvruK3di+cAluinA6cybFbE7s=
cosmossdk.io/core v0.6.1/go.mod h1:g3MMBCBXtxbDWBURDVnJE7XML4BG5qENhs0gzkcpuFA=
cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw=
cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU=
cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w=
@@ -49,10 +47,6 @@ cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0=
cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4=
cosmossdk.io/math v1.0.0 h1:ro9w7eKx23om2tZz/VM2Pf+z2WAbGX1yDQQOJ6iGeJw=
cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k=
cosmossdk.io/store v0.1.0-alpha.1.0.20230328185921-37ba88872dbc h1:9piuA+NYmhe+SyMPtMoboLw/djgDbrI3dD5TG020Tnk=
cosmossdk.io/store v0.1.0-alpha.1.0.20230328185921-37ba88872dbc/go.mod h1:UFF5rmjN7WYVfxo6ArdY/l1+yyWMURBWOmSJypGqFHQ=
cosmossdk.io/x/tx v0.6.1 h1:WwPkb7bfxGqrCKgPZuL6oW/9R51ufeFzWaXwIva6dVk=
cosmossdk.io/x/tx v0.6.1/go.mod h1:ps6ZlSuAjZFvHjZb7Kqp51Kf/UHQ/nEdEbjzXaYUhIk=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
@@ -158,8 +152,6 @@ github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN
github.com/cometbft/cometbft v0.37.1 h1:KLxkQTK2hICXYq21U2hn1W5hOVYUdQgDQ1uB+90xPIg=
github.com/cometbft/cometbft v0.37.1/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs=
github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo=
github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4=
github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
@@ -172,8 +164,6 @@ github.com/cosmos/cosmos-db v1.0.0-rc.1 h1:SjnT8B6WKMW9WEIX32qMhnEEKcI7ZP0+G1Sa9
github.com/cosmos/cosmos-db v1.0.0-rc.1/go.mod h1:Dnmk3flSf5lkwCqvvjNpoxjpXzhxnCAFzKHlbaForso=
github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o=
github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I=
github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230424095137-b73c17cb9cc8 h1:zIl1WnrW5ZP1VwhpbwVBZtCntkNKYNIkg4233/dZ3BU=
github.com/cosmos/cosmos-sdk v0.46.0-beta2.0.20230424095137-b73c17cb9cc8/go.mod h1:JicgV9n3SAu5uuoyDvQ2gSHYLyFvyRrIUYB5T2Q4HRw=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
11 changes: 6 additions & 5 deletions x/crisis/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import (
sdkmath "cosmossdk.io/math"
storetypes "cosmossdk.io/store/types"

addresscodec "github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/testutil"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -48,9 +49,9 @@ func (s *KeeperTestSuite) TestMsgVerifyInvariant() {
err := s.keeper.SetConstantFee(s.ctx, constantFee)
s.Require().NoError(err)

kr := keyring.NewInMemory(moduletestutil.MakeTestEncodingConfig(crisis.AppModuleBasic{}).Codec)

account := testutil.CreateKeyringAccounts(s.T(), kr, 1)
encCfg := moduletestutil.MakeTestEncodingConfig(crisis.AppModuleBasic{})
kr := keyring.NewInMemory(encCfg.Codec)
testutil.CreateKeyringAccounts(s.T(), kr, 1)

sender := testutil.CreateKeyringAccounts(s.T(), kr, 1)[0]

@@ -86,7 +87,7 @@ func (s *KeeperTestSuite) TestMsgVerifyInvariant() {
{
name: "unregistered invariant route",
input: &types.MsgVerifyInvariant{
Sender: account[0].Address.String(),
Sender: sender.Address.String(),
InvariantModuleName: "module",
InvariantRoute: "invalidroute",
},
@@ -96,7 +97,7 @@ func (s *KeeperTestSuite) TestMsgVerifyInvariant() {
{
name: "valid invariant",
input: &types.MsgVerifyInvariant{
Sender: account[0].Address.String(),
Sender: sender.Address.String(),
InvariantModuleName: "bank",
InvariantRoute: "total-supply",
},
You are viewing a condensed version of this merge commit. You can view the full changes here.