Skip to content

draft: cron-module, added implicit hash to the header #465

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

Open
wants to merge 2 commits into
base: secret-0.50.x
Choose a base branch
from
Open
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
13 changes: 10 additions & 3 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package baseapp

import (
"context"
"crypto/sha256"
"encoding/hex"
"fmt"
"sort"
"strings"
Expand Down Expand Up @@ -45,8 +47,10 @@ func (app *BaseApp) InitChain(req *abci.RequestInitChain) (*abci.ResponseInitCha

// On a new chain, we consider the init chain block height as 0, even though
// req.InitialHeight is 1 by default.
initHeader := cmtproto.Header{ChainID: req.ChainId, Time: req.Time}
app.logger.Info("InitChain", "initialHeight", req.InitialHeight, "chainID", req.ChainId)
emptyHash := sha256.Sum256([]byte{})

initHeader := cmtproto.Header{ChainID: req.ChainId, Time: req.Time, ImplicitHash: emptyHash[:]}
app.logger.Info("InitChain", "initialHeight", req.InitialHeight, "chainID", req.ChainId, "emptyHash", hex.EncodeToString(emptyHash[:]))

// Set the initial height, which will be used to determine if we are proposing
// or processing the first block or not.
Expand Down Expand Up @@ -390,6 +394,7 @@ func (app *BaseApp) PrepareProposal(req *abci.RequestPrepareProposal) (resp *abc
ProposerAddress: req.ProposerAddress,
NextValidatorsHash: req.NextValidatorsHash,
AppHash: app.LastCommitID().Hash,
ImplicitHash: req.ImplicitHash,
}
app.setState(execModePrepareProposal, header)

Expand Down Expand Up @@ -474,6 +479,7 @@ func (app *BaseApp) ProcessProposal(req *abci.RequestProcessProposal) (resp *abc
ProposerAddress: req.ProposerAddress,
NextValidatorsHash: req.NextValidatorsHash,
AppHash: app.LastCommitID().Hash,
ImplicitHash: req.ImplicitHash,
}
app.setState(execModeProcessProposal, header)

Expand Down Expand Up @@ -561,7 +567,7 @@ func (app *BaseApp) ExtendVote(_ context.Context, req *abci.RequestExtendVote) (
if req.Height == app.initialHeight {
ctx, _ = app.finalizeBlockState.Context().CacheContext()
} else {
emptyHeader := cmtproto.Header{ChainID: app.chainID, Height: req.Height}
emptyHeader := cmtproto.Header{ChainID: app.chainID, Height: req.Height, ImplicitHash: req.ImplicitHash}
ms := app.cms.CacheMultiStore()
ctx = sdk.NewContext(ms, emptyHeader, false, app.logger).WithStreamingManager(app.streamingManager)
}
Expand Down Expand Up @@ -722,6 +728,7 @@ func (app *BaseApp) internalFinalizeBlock(ctx context.Context, req *abci.Request
AppHash: app.LastCommitID().Hash,
DataHash: txs.Hash(),
EncryptedRandom: req.EncryptedRandom,
ImplicitHash: req.ImplicitHash,
}

// finalizeBlockState should be set on InitChain or ProcessProposal. If it is
Expand Down
62 changes: 32 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
go 1.21
go 1.22.11

toolchain go1.24.0

module github.com/cosmos/cosmos-sdk

replace github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.9-secret.3
replace github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.17-secret-13-add-implicit-hash

require (
cosmossdk.io/api v0.7.6
Expand All @@ -28,7 +30,7 @@ require (
github.com/cosmos/gogogateway v1.2.0
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ledger-cosmos-go v0.13.3
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/google/go-cmp v0.6.0
Expand All @@ -46,21 +48,21 @@ require (
github.com/magiconair/properties v1.8.7
github.com/manifoldco/promptui v0.9.0
github.com/mattn/go-isatty v0.0.20
github.com/prometheus/client_golang v1.20.1
github.com/prometheus/common v0.55.0
github.com/prometheus/client_golang v1.20.5
github.com/prometheus/common v0.62.0
github.com/rs/zerolog v1.33.0
github.com/spf13/cast v1.7.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/stretchr/testify v1.10.0
github.com/tendermint/go-amino v0.16.0
golang.org/x/crypto v0.27.0
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0
golang.org/x/sync v0.8.0
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.35.1
golang.org/x/crypto v0.32.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/sync v0.10.0
google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a
google.golang.org/grpc v1.70.0
google.golang.org/protobuf v1.36.4
gotest.tools/v3 v3.5.1
pgregory.net/rapid v1.1.0
sigs.k8s.io/yaml v1.4.0
Expand All @@ -72,23 +74,21 @@ require (
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/bufbuild/protocompile v0.6.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.2 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/cometbft/cometbft-db v0.11.0 // indirect
github.com/cometbft/cometbft-db v0.14.1 // indirect
github.com/cosmos/iavl v1.2.2 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/danieljoos/wincred v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand All @@ -98,15 +98,17 @@ require (
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/kit v0.13.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.2 // indirect
github.com/golang/glog v1.2.3 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
Expand All @@ -122,11 +124,10 @@ require (
github.com/klauspost/compress v1.17.9 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/linxGnu/grocksdb v1.8.14 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/highwayhash v1.0.3 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mtibben/percent v0.2.1 // indirect
Expand All @@ -135,7 +136,7 @@ require (
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
Expand All @@ -145,23 +146,24 @@ require (
github.com/rs/cors v1.11.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/scrtlabs/tm-secret-enclave v1.11.8 // indirect
github.com/sasha-s/go-deadlock v0.3.5 // indirect
github.com/scrtlabs/tm-secret-enclave v1.12.3-implicit-hash // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.10 // indirect
go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
Expand Down
Loading
Loading